Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/rentals.picotech.app/public_html/dist/assets/ drwxr-xr-x | |
| Viewing file: Select action/file-type: (function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const l of n)if(l.type==="childList")for(const i of l.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function a(n){const l={};return n.integrity&&(l.integrity=n.integrity),n.referrerPolicy&&(l.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?l.credentials="include":n.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(n){if(n.ep)return;n.ep=!0;const l=a(n);fetch(n.href,l)}})();function xh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mu={exports:{}},bl={},Au={exports:{}},le={};/**
* @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 Ls=Symbol.for("react.element"),hh=Symbol.for("react.portal"),ph=Symbol.for("react.fragment"),fh=Symbol.for("react.strict_mode"),yh=Symbol.for("react.profiler"),bh=Symbol.for("react.provider"),vh=Symbol.for("react.context"),kh=Symbol.for("react.forward_ref"),jh=Symbol.for("react.suspense"),wh=Symbol.for("react.memo"),Nh=Symbol.for("react.lazy"),Qd=Symbol.iterator;function _h(e){return e===null||typeof e!="object"?null:(e=Qd&&e[Qd]||e["@@iterator"],typeof e=="function"?e:null)}var Fu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Tu=Object.assign,Lu={};function Fa(e,r,a){this.props=e,this.context=r,this.refs=Lu,this.updater=a||Fu}Fa.prototype.isReactComponent={};Fa.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,r,"setState")};Fa.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ou(){}Ou.prototype=Fa.prototype;function Lo(e,r,a){this.props=e,this.context=r,this.refs=Lu,this.updater=a||Fu}var Oo=Lo.prototype=new Ou;Oo.constructor=Lo;Tu(Oo,Fa.prototype);Oo.isPureReactComponent=!0;var Jd=Array.isArray,Iu=Object.prototype.hasOwnProperty,Io={current:null},Bu={key:!0,ref:!0,__self:!0,__source:!0};function $u(e,r,a){var s,n={},l=null,i=null;if(r!=null)for(s in r.ref!==void 0&&(i=r.ref),r.key!==void 0&&(l=""+r.key),r)Iu.call(r,s)&&!Bu.hasOwnProperty(s)&&(n[s]=r[s]);var u=arguments.length-2;if(u===1)n.children=a;else if(1<u){for(var o=Array(u),c=0;c<u;c++)o[c]=arguments[c+2];n.children=o}if(e&&e.defaultProps)for(s in u=e.defaultProps,u)n[s]===void 0&&(n[s]=u[s]);return{$$typeof:Ls,type:e,key:l,ref:i,props:n,_owner:Io.current}}function Sh(e,r){return{$$typeof:Ls,type:e.type,key:r,ref:e.ref,props:e.props,_owner:e._owner}}function Bo(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ls}function Ch(e){var r={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return r[a]})}var Yd=/\/+/g;function Xl(e,r){return typeof e=="object"&&e!==null&&e.key!=null?Ch(""+e.key):r.toString(36)}function Nn(e,r,a,s,n){var l=typeof e;(l==="undefined"||l==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(l){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Ls:case hh:i=!0}}if(i)return i=e,n=n(i),e=s===""?"."+Xl(i,0):s,Jd(n)?(a="",e!=null&&(a=e.replace(Yd,"$&/")+"/"),Nn(n,r,a,"",function(c){return c})):n!=null&&(Bo(n)&&(n=Sh(n,a+(!n.key||i&&i.key===n.key?"":(""+n.key).replace(Yd,"$&/")+"/")+e)),r.push(n)),1;if(i=0,s=s===""?".":s+":",Jd(e))for(var u=0;u<e.length;u++){l=e[u];var o=s+Xl(l,u);i+=Nn(l,r,a,o,n)}else if(o=_h(e),typeof o=="function")for(e=o.call(e),u=0;!(l=e.next()).done;)l=l.value,o=s+Xl(l,u++),i+=Nn(l,r,a,o,n);else if(l==="object")throw r=String(e),Error("Objects are not valid as a React child (found: "+(r==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.");return i}function Ys(e,r,a){if(e==null)return e;var s=[],n=0;return Nn(e,s,"","",function(l){return r.call(a,l,n++)}),s}function Eh(e){if(e._status===-1){var r=e._result;r=r(),r.then(function(a){(e._status===0||e._status===-1)&&(e._status=1,e._result=a)},function(a){(e._status===0||e._status===-1)&&(e._status=2,e._result=a)}),e._status===-1&&(e._status=0,e._result=r)}if(e._status===1)return e._result.default;throw e._result}var Xe={current:null},_n={transition:null},Rh={ReactCurrentDispatcher:Xe,ReactCurrentBatchConfig:_n,ReactCurrentOwner:Io};function zu(){throw Error("act(...) is not supported in production builds of React.")}le.Children={map:Ys,forEach:function(e,r,a){Ys(e,function(){r.apply(this,arguments)},a)},count:function(e){var r=0;return Ys(e,function(){r++}),r},toArray:function(e){return Ys(e,function(r){return r})||[]},only:function(e){if(!Bo(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};le.Component=Fa;le.Fragment=ph;le.Profiler=yh;le.PureComponent=Lo;le.StrictMode=fh;le.Suspense=jh;le.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rh;le.act=zu;le.cloneElement=function(e,r,a){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var s=Tu({},e.props),n=e.key,l=e.ref,i=e._owner;if(r!=null){if(r.ref!==void 0&&(l=r.ref,i=Io.current),r.key!==void 0&&(n=""+r.key),e.type&&e.type.defaultProps)var u=e.type.defaultProps;for(o in r)Iu.call(r,o)&&!Bu.hasOwnProperty(o)&&(s[o]=r[o]===void 0&&u!==void 0?u[o]:r[o])}var o=arguments.length-2;if(o===1)s.children=a;else if(1<o){u=Array(o);for(var c=0;c<o;c++)u[c]=arguments[c+2];s.children=u}return{$$typeof:Ls,type:e.type,key:n,ref:l,props:s,_owner:i}};le.createContext=function(e){return e={$$typeof:vh,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:bh,_context:e},e.Consumer=e};le.createElement=$u;le.createFactory=function(e){var r=$u.bind(null,e);return r.type=e,r};le.createRef=function(){return{current:null}};le.forwardRef=function(e){return{$$typeof:kh,render:e}};le.isValidElement=Bo;le.lazy=function(e){return{$$typeof:Nh,_payload:{_status:-1,_result:e},_init:Eh}};le.memo=function(e,r){return{$$typeof:wh,type:e,compare:r===void 0?null:r}};le.startTransition=function(e){var r=_n.transition;_n.transition={};try{e()}finally{_n.transition=r}};le.unstable_act=zu;le.useCallback=function(e,r){return Xe.current.useCallback(e,r)};le.useContext=function(e){return Xe.current.useContext(e)};le.useDebugValue=function(){};le.useDeferredValue=function(e){return Xe.current.useDeferredValue(e)};le.useEffect=function(e,r){return Xe.current.useEffect(e,r)};le.useId=function(){return Xe.current.useId()};le.useImperativeHandle=function(e,r,a){return Xe.current.useImperativeHandle(e,r,a)};le.useInsertionEffect=function(e,r){return Xe.current.useInsertionEffect(e,r)};le.useLayoutEffect=function(e,r){return Xe.current.useLayoutEffect(e,r)};le.useMemo=function(e,r){return Xe.current.useMemo(e,r)};le.useReducer=function(e,r,a){return Xe.current.useReducer(e,r,a)};le.useRef=function(e){return Xe.current.useRef(e)};le.useState=function(e){return Xe.current.useState(e)};le.useSyncExternalStore=function(e,r,a){return Xe.current.useSyncExternalStore(e,r,a)};le.useTransition=function(){return Xe.current.useTransition()};le.version="18.3.1";Au.exports=le;var b=Au.exports;const De=xh(b);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ph=b,Dh=Symbol.for("react.element"),Mh=Symbol.for("react.fragment"),Ah=Object.prototype.hasOwnProperty,Fh=Ph.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Th={key:!0,ref:!0,__self:!0,__source:!0};function Uu(e,r,a){var s,n={},l=null,i=null;a!==void 0&&(l=""+a),r.key!==void 0&&(l=""+r.key),r.ref!==void 0&&(i=r.ref);for(s in r)Ah.call(r,s)&&!Th.hasOwnProperty(s)&&(n[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps,r)n[s]===void 0&&(n[s]=r[s]);return{$$typeof:Dh,type:e,key:l,ref:i,props:n,_owner:Fh.current}}bl.Fragment=Mh;bl.jsx=Uu;bl.jsxs=Uu;Mu.exports=bl;var t=Mu.exports,Vu={exports:{}},mt={},Hu={exports:{}},qu={};/**
* @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(e){function r(B,U){var V=B.length;B.push(U);e:for(;0<V;){var J=V-1>>>1,X=B[J];if(0<n(X,U))B[J]=U,B[V]=X,V=J;else break e}}function a(B){return B.length===0?null:B[0]}function s(B){if(B.length===0)return null;var U=B[0],V=B.pop();if(V!==U){B[0]=V;e:for(var J=0,X=B.length,z=X>>>1;J<z;){var E=2*(J+1)-1,$=B[E],Q=E+1,re=B[Q];if(0>n($,V))Q<X&&0>n(re,$)?(B[J]=re,B[Q]=V,J=Q):(B[J]=$,B[E]=V,J=E);else if(Q<X&&0>n(re,V))B[J]=re,B[Q]=V,J=Q;else break e}}return U}function n(B,U){var V=B.sortIndex-U.sortIndex;return V!==0?V:B.id-U.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var i=Date,u=i.now();e.unstable_now=function(){return i.now()-u}}var o=[],c=[],d=1,m=null,p=3,j=!1,v=!1,y=!1,f=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(B){for(var U=a(c);U!==null;){if(U.callback===null)s(c);else if(U.startTime<=B)s(c),U.sortIndex=U.expirationTime,r(o,U);else break;U=a(c)}}function h(B){if(y=!1,g(B),!v)if(a(o)!==null)v=!0,_(w);else{var U=a(c);U!==null&&H(h,U.startTime-B)}}function w(B,U){v=!1,y&&(y=!1,k(N),N=-1),j=!0;var V=p;try{for(g(U),m=a(o);m!==null&&(!(m.expirationTime>U)||B&&!F());){var J=m.callback;if(typeof J=="function"){m.callback=null,p=m.priorityLevel;var X=J(m.expirationTime<=U);U=e.unstable_now(),typeof X=="function"?m.callback=X:m===a(o)&&s(o),g(U)}else s(o);m=a(o)}if(m!==null)var z=!0;else{var E=a(c);E!==null&&H(h,E.startTime-U),z=!1}return z}finally{m=null,p=V,j=!1}}var S=!1,C=null,N=-1,D=5,R=-1;function F(){return!(e.unstable_now()-R<D)}function A(){if(C!==null){var B=e.unstable_now();R=B;var U=!0;try{U=C(!0,B)}finally{U?P():(S=!1,C=null)}}else S=!1}var P;if(typeof x=="function")P=function(){x(A)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,T=M.port2;M.port1.onmessage=A,P=function(){T.postMessage(null)}}else P=function(){f(A,0)};function _(B){C=B,S||(S=!0,P())}function H(B,U){N=f(function(){B(e.unstable_now())},U)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_continueExecution=function(){v||j||(v=!0,_(w))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return a(o)},e.unstable_next=function(B){switch(p){case 1:case 2:case 3:var U=3;break;default:U=p}var V=p;p=U;try{return B()}finally{p=V}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,U){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var V=p;p=B;try{return U()}finally{p=V}},e.unstable_scheduleCallback=function(B,U,V){var J=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?J+V:J):V=J,B){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=V+X,B={id:d++,callback:U,priorityLevel:B,startTime:V,expirationTime:X,sortIndex:-1},V>J?(B.sortIndex=V,r(c,B),a(o)===null&&B===a(c)&&(y?(k(N),N=-1):y=!0,H(h,V-J))):(B.sortIndex=X,r(o,B),v||j||(v=!0,_(w))),B},e.unstable_shouldYield=F,e.unstable_wrapCallback=function(B){var U=p;return function(){var V=p;p=U;try{return B.apply(this,arguments)}finally{p=V}}}})(qu);Hu.exports=qu;var Lh=Hu.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Oh=b,ct=Lh;function W(e){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+e,a=1;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+e+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Wu=new Set,fs={};function Gr(e,r){_a(e,r),_a(e+"Capture",r)}function _a(e,r){for(fs[e]=r,e=0;e<r.length;e++)Wu.add(r[e])}var rr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ri=Object.prototype.hasOwnProperty,Ih=/^[: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]*$/,Xd={},Kd={};function Bh(e){return Ri.call(Kd,e)?!0:Ri.call(Xd,e)?!1:Ih.test(e)?Kd[e]=!0:(Xd[e]=!0,!1)}function $h(e,r,a,s){if(a!==null&&a.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return s?!1:a!==null?!a.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function zh(e,r,a,s){if(r===null||typeof r>"u"||$h(e,r,a,s))return!0;if(s)return!1;if(a!==null)switch(a.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function Ke(e,r,a,s,n,l,i){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=s,this.attributeNamespace=n,this.mustUseProperty=a,this.propertyName=e,this.type=r,this.sanitizeURL=l,this.removeEmptyString=i}var Ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ie[e]=new Ke(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var r=e[0];Ie[r]=new Ke(r,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ie[e]=new Ke(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ie[e]=new Ke(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){Ie[e]=new Ke(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ie[e]=new Ke(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ie[e]=new Ke(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ie[e]=new Ke(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ie[e]=new Ke(e,5,!1,e.toLowerCase(),null,!1,!1)});var $o=/[\-:]([a-z])/g;function zo(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var r=e.replace($o,zo);Ie[r]=new Ke(r,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var r=e.replace($o,zo);Ie[r]=new Ke(r,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var r=e.replace($o,zo);Ie[r]=new Ke(r,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ie[e]=new Ke(e,1,!1,e.toLowerCase(),null,!1,!1)});Ie.xlinkHref=new Ke("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ie[e]=new Ke(e,1,!1,e.toLowerCase(),null,!0,!0)});function Uo(e,r,a,s){var n=Ie.hasOwnProperty(r)?Ie[r]:null;(n!==null?n.type!==0:s||!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(zh(r,a,n,s)&&(a=null),s||n===null?Bh(r)&&(a===null?e.removeAttribute(r):e.setAttribute(r,""+a)):n.mustUseProperty?e[n.propertyName]=a===null?n.type===3?!1:"":a:(r=n.attributeName,s=n.attributeNamespace,a===null?e.removeAttribute(r):(n=n.type,a=n===3||n===4&&a===!0?"":""+a,s?e.setAttributeNS(s,r,a):e.setAttribute(r,a))))}var or=Oh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Xs=Symbol.for("react.element"),na=Symbol.for("react.portal"),la=Symbol.for("react.fragment"),Vo=Symbol.for("react.strict_mode"),Pi=Symbol.for("react.profiler"),Qu=Symbol.for("react.provider"),Ju=Symbol.for("react.context"),Ho=Symbol.for("react.forward_ref"),Di=Symbol.for("react.suspense"),Mi=Symbol.for("react.suspense_list"),qo=Symbol.for("react.memo"),ur=Symbol.for("react.lazy"),Yu=Symbol.for("react.offscreen"),Gd=Symbol.iterator;function Ha(e){return e===null||typeof e!="object"?null:(e=Gd&&e[Gd]||e["@@iterator"],typeof e=="function"?e:null)}var Ne=Object.assign,Kl;function ss(e){if(Kl===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);Kl=r&&r[1]||""}return`
`+Kl+e}var Gl=!1;function Zl(e,r){if(!e||Gl)return"";Gl=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(r)if(r=function(){throw Error()},Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(r,[])}catch(c){var s=c}Reflect.construct(e,[],r)}else{try{r.call()}catch(c){s=c}e.call(r.prototype)}else{try{throw Error()}catch(c){s=c}e()}}catch(c){if(c&&s&&typeof c.stack=="string"){for(var n=c.stack.split(`
`),l=s.stack.split(`
`),i=n.length-1,u=l.length-1;1<=i&&0<=u&&n[i]!==l[u];)u--;for(;1<=i&&0<=u;i--,u--)if(n[i]!==l[u]){if(i!==1||u!==1)do if(i--,u--,0>u||n[i]!==l[u]){var o=`
`+n[i].replace(" at new "," at ");return e.displayName&&o.includes("<anonymous>")&&(o=o.replace("<anonymous>",e.displayName)),o}while(1<=i&&0<=u);break}}}finally{Gl=!1,Error.prepareStackTrace=a}return(e=e?e.displayName||e.name:"")?ss(e):""}function Uh(e){switch(e.tag){case 5:return ss(e.type);case 16:return ss("Lazy");case 13:return ss("Suspense");case 19:return ss("SuspenseList");case 0:case 2:case 15:return e=Zl(e.type,!1),e;case 11:return e=Zl(e.type.render,!1),e;case 1:return e=Zl(e.type,!0),e;default:return""}}function Ai(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case la:return"Fragment";case na:return"Portal";case Pi:return"Profiler";case Vo:return"StrictMode";case Di:return"Suspense";case Mi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ju:return(e.displayName||"Context")+".Consumer";case Qu:return(e._context.displayName||"Context")+".Provider";case Ho:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case qo:return r=e.displayName||null,r!==null?r:Ai(e.type)||"Memo";case ur:r=e._payload,e=e._init;try{return Ai(e(r))}catch{}}return null}function Vh(e){var r=e.type;switch(e.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=r.render,e=e.displayName||e.name||"",r.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ai(r);case 8:return r===Vo?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function Sr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Xu(e){var r=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Hh(e){var r=Xu(e)?"checked":"value",a=Object.getOwnPropertyDescriptor(e.constructor.prototype,r),s=""+e[r];if(!e.hasOwnProperty(r)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var n=a.get,l=a.set;return Object.defineProperty(e,r,{configurable:!0,get:function(){return n.call(this)},set:function(i){s=""+i,l.call(this,i)}}),Object.defineProperty(e,r,{enumerable:a.enumerable}),{getValue:function(){return s},setValue:function(i){s=""+i},stopTracking:function(){e._valueTracker=null,delete e[r]}}}}function Ks(e){e._valueTracker||(e._valueTracker=Hh(e))}function Ku(e){if(!e)return!1;var r=e._valueTracker;if(!r)return!0;var a=r.getValue(),s="";return e&&(s=Xu(e)?e.checked?"true":"false":e.value),e=s,e!==a?(r.setValue(e),!0):!1}function Hn(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Fi(e,r){var a=r.checked;return Ne({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??e._wrapperState.initialChecked})}function Zd(e,r){var a=r.defaultValue==null?"":r.defaultValue,s=r.checked!=null?r.checked:r.defaultChecked;a=Sr(r.value!=null?r.value:a),e._wrapperState={initialChecked:s,initialValue:a,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function Gu(e,r){r=r.checked,r!=null&&Uo(e,"checked",r,!1)}function Ti(e,r){Gu(e,r);var a=Sr(r.value),s=r.type;if(a!=null)s==="number"?(a===0&&e.value===""||e.value!=a)&&(e.value=""+a):e.value!==""+a&&(e.value=""+a);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}r.hasOwnProperty("value")?Li(e,r.type,a):r.hasOwnProperty("defaultValue")&&Li(e,r.type,Sr(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(e.defaultChecked=!!r.defaultChecked)}function ec(e,r,a){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var s=r.type;if(!(s!=="submit"&&s!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+e._wrapperState.initialValue,a||r===e.value||(e.value=r),e.defaultValue=r}a=e.name,a!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,a!==""&&(e.name=a)}function Li(e,r,a){(r!=="number"||Hn(e.ownerDocument)!==e)&&(a==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+a&&(e.defaultValue=""+a))}var ns=Array.isArray;function ba(e,r,a,s){if(e=e.options,r){r={};for(var n=0;n<a.length;n++)r["$"+a[n]]=!0;for(a=0;a<e.length;a++)n=r.hasOwnProperty("$"+e[a].value),e[a].selected!==n&&(e[a].selected=n),n&&s&&(e[a].defaultSelected=!0)}else{for(a=""+Sr(a),r=null,n=0;n<e.length;n++){if(e[n].value===a){e[n].selected=!0,s&&(e[n].defaultSelected=!0);return}r!==null||e[n].disabled||(r=e[n])}r!==null&&(r.selected=!0)}}function Oi(e,r){if(r.dangerouslySetInnerHTML!=null)throw Error(W(91));return Ne({},r,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function tc(e,r){var a=r.value;if(a==null){if(a=r.children,r=r.defaultValue,a!=null){if(r!=null)throw Error(W(92));if(ns(a)){if(1<a.length)throw Error(W(93));a=a[0]}r=a}r==null&&(r=""),a=r}e._wrapperState={initialValue:Sr(a)}}function Zu(e,r){var a=Sr(r.value),s=Sr(r.defaultValue);a!=null&&(a=""+a,a!==e.value&&(e.value=a),r.defaultValue==null&&e.defaultValue!==a&&(e.defaultValue=a)),s!=null&&(e.defaultValue=""+s)}function rc(e){var r=e.textContent;r===e._wrapperState.initialValue&&r!==""&&r!==null&&(e.value=r)}function em(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 Ii(e,r){return e==null||e==="http://www.w3.org/1999/xhtml"?em(r):e==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Gs,tm=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,a,s,n){MSApp.execUnsafeLocalFunction(function(){return e(r,a,s,n)})}:e}(function(e,r){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=r;else{for(Gs=Gs||document.createElement("div"),Gs.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=Gs.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;r.firstChild;)e.appendChild(r.firstChild)}});function ys(e,r){if(r){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=r;return}}e.textContent=r}var os={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},qh=["Webkit","ms","Moz","O"];Object.keys(os).forEach(function(e){qh.forEach(function(r){r=r+e.charAt(0).toUpperCase()+e.substring(1),os[r]=os[e]})});function rm(e,r,a){return r==null||typeof r=="boolean"||r===""?"":a||typeof r!="number"||r===0||os.hasOwnProperty(e)&&os[e]?(""+r).trim():r+"px"}function am(e,r){e=e.style;for(var a in r)if(r.hasOwnProperty(a)){var s=a.indexOf("--")===0,n=rm(a,r[a],s);a==="float"&&(a="cssFloat"),s?e.setProperty(a,n):e[a]=n}}var Wh=Ne({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 Bi(e,r){if(r){if(Wh[e]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(W(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(W(61))}if(r.style!=null&&typeof r.style!="object")throw Error(W(62))}}function $i(e,r){if(e.indexOf("-")===-1)return typeof r.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var zi=null;function Wo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ui=null,va=null,ka=null;function ac(e){if(e=Bs(e)){if(typeof Ui!="function")throw Error(W(280));var r=e.stateNode;r&&(r=Nl(r),Ui(e.stateNode,e.type,r))}}function sm(e){va?ka?ka.push(e):ka=[e]:va=e}function nm(){if(va){var e=va,r=ka;if(ka=va=null,ac(e),r)for(e=0;e<r.length;e++)ac(r[e])}}function lm(e,r){return e(r)}function im(){}var ei=!1;function om(e,r,a){if(ei)return e(r,a);ei=!0;try{return lm(e,r,a)}finally{ei=!1,(va!==null||ka!==null)&&(im(),nm())}}function bs(e,r){var a=e.stateNode;if(a===null)return null;var s=Nl(a);if(s===null)return null;a=s[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(W(231,r,typeof a));return a}var Vi=!1;if(rr)try{var qa={};Object.defineProperty(qa,"passive",{get:function(){Vi=!0}}),window.addEventListener("test",qa,qa),window.removeEventListener("test",qa,qa)}catch{Vi=!1}function Qh(e,r,a,s,n,l,i,u,o){var c=Array.prototype.slice.call(arguments,3);try{r.apply(a,c)}catch(d){this.onError(d)}}var ds=!1,qn=null,Wn=!1,Hi=null,Jh={onError:function(e){ds=!0,qn=e}};function Yh(e,r,a,s,n,l,i,u,o){ds=!1,qn=null,Qh.apply(Jh,arguments)}function Xh(e,r,a,s,n,l,i,u,o){if(Yh.apply(this,arguments),ds){if(ds){var c=qn;ds=!1,qn=null}else throw Error(W(198));Wn||(Wn=!0,Hi=c)}}function Zr(e){var r=e,a=e;if(e.alternate)for(;r.return;)r=r.return;else{e=r;do r=e,r.flags&4098&&(a=r.return),e=r.return;while(e)}return r.tag===3?a:null}function dm(e){if(e.tag===13){var r=e.memoizedState;if(r===null&&(e=e.alternate,e!==null&&(r=e.memoizedState)),r!==null)return r.dehydrated}return null}function sc(e){if(Zr(e)!==e)throw Error(W(188))}function Kh(e){var r=e.alternate;if(!r){if(r=Zr(e),r===null)throw Error(W(188));return r!==e?null:e}for(var a=e,s=r;;){var n=a.return;if(n===null)break;var l=n.alternate;if(l===null){if(s=n.return,s!==null){a=s;continue}break}if(n.child===l.child){for(l=n.child;l;){if(l===a)return sc(n),e;if(l===s)return sc(n),r;l=l.sibling}throw Error(W(188))}if(a.return!==s.return)a=n,s=l;else{for(var i=!1,u=n.child;u;){if(u===a){i=!0,a=n,s=l;break}if(u===s){i=!0,s=n,a=l;break}u=u.sibling}if(!i){for(u=l.child;u;){if(u===a){i=!0,a=l,s=n;break}if(u===s){i=!0,s=l,a=n;break}u=u.sibling}if(!i)throw Error(W(189))}}if(a.alternate!==s)throw Error(W(190))}if(a.tag!==3)throw Error(W(188));return a.stateNode.current===a?e:r}function cm(e){return e=Kh(e),e!==null?um(e):null}function um(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var r=um(e);if(r!==null)return r;e=e.sibling}return null}var mm=ct.unstable_scheduleCallback,nc=ct.unstable_cancelCallback,Gh=ct.unstable_shouldYield,Zh=ct.unstable_requestPaint,Ee=ct.unstable_now,ep=ct.unstable_getCurrentPriorityLevel,Qo=ct.unstable_ImmediatePriority,gm=ct.unstable_UserBlockingPriority,Qn=ct.unstable_NormalPriority,tp=ct.unstable_LowPriority,xm=ct.unstable_IdlePriority,vl=null,qt=null;function rp(e){if(qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(vl,e,void 0,(e.current.flags&128)===128)}catch{}}var Mt=Math.clz32?Math.clz32:np,ap=Math.log,sp=Math.LN2;function np(e){return e>>>=0,e===0?32:31-(ap(e)/sp|0)|0}var Zs=64,en=4194304;function ls(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Jn(e,r){var a=e.pendingLanes;if(a===0)return 0;var s=0,n=e.suspendedLanes,l=e.pingedLanes,i=a&268435455;if(i!==0){var u=i&~n;u!==0?s=ls(u):(l&=i,l!==0&&(s=ls(l)))}else i=a&~n,i!==0?s=ls(i):l!==0&&(s=ls(l));if(s===0)return 0;if(r!==0&&r!==s&&!(r&n)&&(n=s&-s,l=r&-r,n>=l||n===16&&(l&4194240)!==0))return r;if(s&4&&(s|=a&16),r=e.entangledLanes,r!==0)for(e=e.entanglements,r&=s;0<r;)a=31-Mt(r),n=1<<a,s|=e[a],r&=~n;return s}function lp(e,r){switch(e){case 1:case 2:case 4:return r+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ip(e,r){for(var a=e.suspendedLanes,s=e.pingedLanes,n=e.expirationTimes,l=e.pendingLanes;0<l;){var i=31-Mt(l),u=1<<i,o=n[i];o===-1?(!(u&a)||u&s)&&(n[i]=lp(u,r)):o<=r&&(e.expiredLanes|=u),l&=~u}}function qi(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function hm(){var e=Zs;return Zs<<=1,!(Zs&4194240)&&(Zs=64),e}function ti(e){for(var r=[],a=0;31>a;a++)r.push(e);return r}function Os(e,r,a){e.pendingLanes|=r,r!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,r=31-Mt(r),e[r]=a}function op(e,r){var a=e.pendingLanes&~r;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=r,e.mutableReadLanes&=r,e.entangledLanes&=r,r=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0<a;){var n=31-Mt(a),l=1<<n;r[n]=0,s[n]=-1,e[n]=-1,a&=~l}}function Jo(e,r){var a=e.entangledLanes|=r;for(e=e.entanglements;a;){var s=31-Mt(a),n=1<<s;n&r|e[s]&r&&(e[s]|=r),a&=~n}}var ue=0;function pm(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var fm,Yo,ym,bm,vm,Wi=!1,tn=[],yr=null,br=null,vr=null,vs=new Map,ks=new Map,gr=[],dp="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 lc(e,r){switch(e){case"focusin":case"focusout":yr=null;break;case"dragenter":case"dragleave":br=null;break;case"mouseover":case"mouseout":vr=null;break;case"pointerover":case"pointerout":vs.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":ks.delete(r.pointerId)}}function Wa(e,r,a,s,n,l){return e===null||e.nativeEvent!==l?(e={blockedOn:r,domEventName:a,eventSystemFlags:s,nativeEvent:l,targetContainers:[n]},r!==null&&(r=Bs(r),r!==null&&Yo(r)),e):(e.eventSystemFlags|=s,r=e.targetContainers,n!==null&&r.indexOf(n)===-1&&r.push(n),e)}function cp(e,r,a,s,n){switch(r){case"focusin":return yr=Wa(yr,e,r,a,s,n),!0;case"dragenter":return br=Wa(br,e,r,a,s,n),!0;case"mouseover":return vr=Wa(vr,e,r,a,s,n),!0;case"pointerover":var l=n.pointerId;return vs.set(l,Wa(vs.get(l)||null,e,r,a,s,n)),!0;case"gotpointercapture":return l=n.pointerId,ks.set(l,Wa(ks.get(l)||null,e,r,a,s,n)),!0}return!1}function km(e){var r=Lr(e.target);if(r!==null){var a=Zr(r);if(a!==null){if(r=a.tag,r===13){if(r=dm(a),r!==null){e.blockedOn=r,vm(e.priority,function(){ym(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Sn(e){if(e.blockedOn!==null)return!1;for(var r=e.targetContainers;0<r.length;){var a=Qi(e.domEventName,e.eventSystemFlags,r[0],e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);zi=s,a.target.dispatchEvent(s),zi=null}else return r=Bs(a),r!==null&&Yo(r),e.blockedOn=a,!1;r.shift()}return!0}function ic(e,r,a){Sn(e)&&a.delete(r)}function up(){Wi=!1,yr!==null&&Sn(yr)&&(yr=null),br!==null&&Sn(br)&&(br=null),vr!==null&&Sn(vr)&&(vr=null),vs.forEach(ic),ks.forEach(ic)}function Qa(e,r){e.blockedOn===r&&(e.blockedOn=null,Wi||(Wi=!0,ct.unstable_scheduleCallback(ct.unstable_NormalPriority,up)))}function js(e){function r(n){return Qa(n,e)}if(0<tn.length){Qa(tn[0],e);for(var a=1;a<tn.length;a++){var s=tn[a];s.blockedOn===e&&(s.blockedOn=null)}}for(yr!==null&&Qa(yr,e),br!==null&&Qa(br,e),vr!==null&&Qa(vr,e),vs.forEach(r),ks.forEach(r),a=0;a<gr.length;a++)s=gr[a],s.blockedOn===e&&(s.blockedOn=null);for(;0<gr.length&&(a=gr[0],a.blockedOn===null);)km(a),a.blockedOn===null&&gr.shift()}var ja=or.ReactCurrentBatchConfig,Yn=!0;function mp(e,r,a,s){var n=ue,l=ja.transition;ja.transition=null;try{ue=1,Xo(e,r,a,s)}finally{ue=n,ja.transition=l}}function gp(e,r,a,s){var n=ue,l=ja.transition;ja.transition=null;try{ue=4,Xo(e,r,a,s)}finally{ue=n,ja.transition=l}}function Xo(e,r,a,s){if(Yn){var n=Qi(e,r,a,s);if(n===null)ui(e,r,s,Xn,a),lc(e,s);else if(cp(n,e,r,a,s))s.stopPropagation();else if(lc(e,s),r&4&&-1<dp.indexOf(e)){for(;n!==null;){var l=Bs(n);if(l!==null&&fm(l),l=Qi(e,r,a,s),l===null&&ui(e,r,s,Xn,a),l===n)break;n=l}n!==null&&s.stopPropagation()}else ui(e,r,s,null,a)}}var Xn=null;function Qi(e,r,a,s){if(Xn=null,e=Wo(s),e=Lr(e),e!==null)if(r=Zr(e),r===null)e=null;else if(a=r.tag,a===13){if(e=dm(r),e!==null)return e;e=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;e=null}else r!==e&&(e=null);return Xn=e,null}function jm(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(ep()){case Qo:return 1;case gm:return 4;case Qn:case tp:return 16;case xm:return 536870912;default:return 16}default:return 16}}var pr=null,Ko=null,Cn=null;function wm(){if(Cn)return Cn;var e,r=Ko,a=r.length,s,n="value"in pr?pr.value:pr.textContent,l=n.length;for(e=0;e<a&&r[e]===n[e];e++);var i=a-e;for(s=1;s<=i&&r[a-s]===n[l-s];s++);return Cn=n.slice(e,1<s?1-s:void 0)}function En(e){var r=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&r===13&&(e=13)):e=r,e===10&&(e=13),32<=e||e===13?e:0}function rn(){return!0}function oc(){return!1}function gt(e){function r(a,s,n,l,i){this._reactName=a,this._targetInst=n,this.type=s,this.nativeEvent=l,this.target=i,this.currentTarget=null;for(var u in e)e.hasOwnProperty(u)&&(a=e[u],this[u]=a?a(l):l[u]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?rn:oc,this.isPropagationStopped=oc,this}return Ne(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=rn)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=rn)},persist:function(){},isPersistent:rn}),r}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Go=gt(Ta),Is=Ne({},Ta,{view:0,detail:0}),xp=gt(Is),ri,ai,Ja,kl=Ne({},Is,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zo,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ja&&(Ja&&e.type==="mousemove"?(ri=e.screenX-Ja.screenX,ai=e.screenY-Ja.screenY):ai=ri=0,Ja=e),ri)},movementY:function(e){return"movementY"in e?e.movementY:ai}}),dc=gt(kl),hp=Ne({},kl,{dataTransfer:0}),pp=gt(hp),fp=Ne({},Is,{relatedTarget:0}),si=gt(fp),yp=Ne({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),bp=gt(yp),vp=Ne({},Ta,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kp=gt(vp),jp=Ne({},Ta,{data:0}),cc=gt(jp),wp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Np={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"},_p={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sp(e){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(e):(e=_p[e])?!!r[e]:!1}function Zo(){return Sp}var Cp=Ne({},Is,{key:function(e){if(e.key){var r=wp[e.key]||e.key;if(r!=="Unidentified")return r}return e.type==="keypress"?(e=En(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Np[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zo,charCode:function(e){return e.type==="keypress"?En(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?En(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ep=gt(Cp),Rp=Ne({},kl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),uc=gt(Rp),Pp=Ne({},Is,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zo}),Dp=gt(Pp),Mp=Ne({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ap=gt(Mp),Fp=Ne({},kl,{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}),Tp=gt(Fp),Lp=[9,13,27,32],ed=rr&&"CompositionEvent"in window,cs=null;rr&&"documentMode"in document&&(cs=document.documentMode);var Op=rr&&"TextEvent"in window&&!cs,Nm=rr&&(!ed||cs&&8<cs&&11>=cs),mc=" ",gc=!1;function _m(e,r){switch(e){case"keyup":return Lp.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sm(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ia=!1;function Ip(e,r){switch(e){case"compositionend":return Sm(r);case"keypress":return r.which!==32?null:(gc=!0,mc);case"textInput":return e=r.data,e===mc&&gc?null:e;default:return null}}function Bp(e,r){if(ia)return e==="compositionend"||!ed&&_m(e,r)?(e=wm(),Cn=Ko=pr=null,ia=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Nm&&r.locale!=="ko"?null:r.data;default:return null}}var $p={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 xc(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r==="input"?!!$p[e.type]:r==="textarea"}function Cm(e,r,a,s){sm(s),r=Kn(r,"onChange"),0<r.length&&(a=new Go("onChange","change",null,a,s),e.push({event:a,listeners:r}))}var us=null,ws=null;function zp(e){Im(e,0)}function jl(e){var r=ca(e);if(Ku(r))return e}function Up(e,r){if(e==="change")return r}var Em=!1;if(rr){var ni;if(rr){var li="oninput"in document;if(!li){var hc=document.createElement("div");hc.setAttribute("oninput","return;"),li=typeof hc.oninput=="function"}ni=li}else ni=!1;Em=ni&&(!document.documentMode||9<document.documentMode)}function pc(){us&&(us.detachEvent("onpropertychange",Rm),ws=us=null)}function Rm(e){if(e.propertyName==="value"&&jl(ws)){var r=[];Cm(r,ws,e,Wo(e)),om(zp,r)}}function Vp(e,r,a){e==="focusin"?(pc(),us=r,ws=a,us.attachEvent("onpropertychange",Rm)):e==="focusout"&&pc()}function Hp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return jl(ws)}function qp(e,r){if(e==="click")return jl(r)}function Wp(e,r){if(e==="input"||e==="change")return jl(r)}function Qp(e,r){return e===r&&(e!==0||1/e===1/r)||e!==e&&r!==r}var Ft=typeof Object.is=="function"?Object.is:Qp;function Ns(e,r){if(Ft(e,r))return!0;if(typeof e!="object"||e===null||typeof r!="object"||r===null)return!1;var a=Object.keys(e),s=Object.keys(r);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var n=a[s];if(!Ri.call(r,n)||!Ft(e[n],r[n]))return!1}return!0}function fc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yc(e,r){var a=fc(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=r&&s>=r)return{node:a,offset:r-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=fc(a)}}function Pm(e,r){return e&&r?e===r?!0:e&&e.nodeType===3?!1:r&&r.nodeType===3?Pm(e,r.parentNode):"contains"in e?e.contains(r):e.compareDocumentPosition?!!(e.compareDocumentPosition(r)&16):!1:!1}function Dm(){for(var e=window,r=Hn();r instanceof e.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)e=r.contentWindow;else break;r=Hn(e.document)}return r}function td(e){var r=e&&e.nodeName&&e.nodeName.toLowerCase();return r&&(r==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||r==="textarea"||e.contentEditable==="true")}function Jp(e){var r=Dm(),a=e.focusedElem,s=e.selectionRange;if(r!==a&&a&&a.ownerDocument&&Pm(a.ownerDocument.documentElement,a)){if(s!==null&&td(a)){if(r=s.start,e=s.end,e===void 0&&(e=r),"selectionStart"in a)a.selectionStart=r,a.selectionEnd=Math.min(e,a.value.length);else if(e=(r=a.ownerDocument||document)&&r.defaultView||window,e.getSelection){e=e.getSelection();var n=a.textContent.length,l=Math.min(s.start,n);s=s.end===void 0?l:Math.min(s.end,n),!e.extend&&l>s&&(n=s,s=l,l=n),n=yc(a,l);var i=yc(a,s);n&&i&&(e.rangeCount!==1||e.anchorNode!==n.node||e.anchorOffset!==n.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(r=r.createRange(),r.setStart(n.node,n.offset),e.removeAllRanges(),l>s?(e.addRange(r),e.extend(i.node,i.offset)):(r.setEnd(i.node,i.offset),e.addRange(r)))}}for(r=[],e=a;e=e.parentNode;)e.nodeType===1&&r.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<r.length;a++)e=r[a],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Yp=rr&&"documentMode"in document&&11>=document.documentMode,oa=null,Ji=null,ms=null,Yi=!1;function bc(e,r,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Yi||oa==null||oa!==Hn(s)||(s=oa,"selectionStart"in s&&td(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),ms&&Ns(ms,s)||(ms=s,s=Kn(Ji,"onSelect"),0<s.length&&(r=new Go("onSelect","select",null,r,a),e.push({event:r,listeners:s}),r.target=oa)))}function an(e,r){var a={};return a[e.toLowerCase()]=r.toLowerCase(),a["Webkit"+e]="webkit"+r,a["Moz"+e]="moz"+r,a}var da={animationend:an("Animation","AnimationEnd"),animationiteration:an("Animation","AnimationIteration"),animationstart:an("Animation","AnimationStart"),transitionend:an("Transition","TransitionEnd")},ii={},Mm={};rr&&(Mm=document.createElement("div").style,"AnimationEvent"in window||(delete da.animationend.animation,delete da.animationiteration.animation,delete da.animationstart.animation),"TransitionEvent"in window||delete da.transitionend.transition);function wl(e){if(ii[e])return ii[e];if(!da[e])return e;var r=da[e],a;for(a in r)if(r.hasOwnProperty(a)&&a in Mm)return ii[e]=r[a];return e}var Am=wl("animationend"),Fm=wl("animationiteration"),Tm=wl("animationstart"),Lm=wl("transitionend"),Om=new Map,vc="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 Rr(e,r){Om.set(e,r),Gr(r,[e])}for(var oi=0;oi<vc.length;oi++){var di=vc[oi],Xp=di.toLowerCase(),Kp=di[0].toUpperCase()+di.slice(1);Rr(Xp,"on"+Kp)}Rr(Am,"onAnimationEnd");Rr(Fm,"onAnimationIteration");Rr(Tm,"onAnimationStart");Rr("dblclick","onDoubleClick");Rr("focusin","onFocus");Rr("focusout","onBlur");Rr(Lm,"onTransitionEnd");_a("onMouseEnter",["mouseout","mouseover"]);_a("onMouseLeave",["mouseout","mouseover"]);_a("onPointerEnter",["pointerout","pointerover"]);_a("onPointerLeave",["pointerout","pointerover"]);Gr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Gr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Gr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Gr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Gr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Gr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var is="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(" "),Gp=new Set("cancel close invalid load scroll toggle".split(" ").concat(is));function kc(e,r,a){var s=e.type||"unknown-event";e.currentTarget=a,Xh(s,r,void 0,e),e.currentTarget=null}function Im(e,r){r=(r&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],n=s.event;s=s.listeners;e:{var l=void 0;if(r)for(var i=s.length-1;0<=i;i--){var u=s[i],o=u.instance,c=u.currentTarget;if(u=u.listener,o!==l&&n.isPropagationStopped())break e;kc(n,u,c),l=o}else for(i=0;i<s.length;i++){if(u=s[i],o=u.instance,c=u.currentTarget,u=u.listener,o!==l&&n.isPropagationStopped())break e;kc(n,u,c),l=o}}}if(Wn)throw e=Hi,Wn=!1,Hi=null,e}function he(e,r){var a=r[eo];a===void 0&&(a=r[eo]=new Set);var s=e+"__bubble";a.has(s)||(Bm(r,e,2,!1),a.add(s))}function ci(e,r,a){var s=0;r&&(s|=4),Bm(a,e,s,r)}var sn="_reactListening"+Math.random().toString(36).slice(2);function _s(e){if(!e[sn]){e[sn]=!0,Wu.forEach(function(a){a!=="selectionchange"&&(Gp.has(a)||ci(a,!1,e),ci(a,!0,e))});var r=e.nodeType===9?e:e.ownerDocument;r===null||r[sn]||(r[sn]=!0,ci("selectionchange",!1,r))}}function Bm(e,r,a,s){switch(jm(r)){case 1:var n=mp;break;case 4:n=gp;break;default:n=Xo}a=n.bind(null,r,a,e),n=void 0,!Vi||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(n=!0),s?n!==void 0?e.addEventListener(r,a,{capture:!0,passive:n}):e.addEventListener(r,a,!0):n!==void 0?e.addEventListener(r,a,{passive:n}):e.addEventListener(r,a,!1)}function ui(e,r,a,s,n){var l=s;if(!(r&1)&&!(r&2)&&s!==null)e:for(;;){if(s===null)return;var i=s.tag;if(i===3||i===4){var u=s.stateNode.containerInfo;if(u===n||u.nodeType===8&&u.parentNode===n)break;if(i===4)for(i=s.return;i!==null;){var o=i.tag;if((o===3||o===4)&&(o=i.stateNode.containerInfo,o===n||o.nodeType===8&&o.parentNode===n))return;i=i.return}for(;u!==null;){if(i=Lr(u),i===null)return;if(o=i.tag,o===5||o===6){s=l=i;continue e}u=u.parentNode}}s=s.return}om(function(){var c=l,d=Wo(a),m=[];e:{var p=Om.get(e);if(p!==void 0){var j=Go,v=e;switch(e){case"keypress":if(En(a)===0)break e;case"keydown":case"keyup":j=Ep;break;case"focusin":v="focus",j=si;break;case"focusout":v="blur",j=si;break;case"beforeblur":case"afterblur":j=si;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":j=dc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":j=pp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":j=Dp;break;case Am:case Fm:case Tm:j=bp;break;case Lm:j=Ap;break;case"scroll":j=xp;break;case"wheel":j=Tp;break;case"copy":case"cut":case"paste":j=kp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":j=uc}var y=(r&4)!==0,f=!y&&e==="scroll",k=y?p!==null?p+"Capture":null:p;y=[];for(var x=c,g;x!==null;){g=x;var h=g.stateNode;if(g.tag===5&&h!==null&&(g=h,k!==null&&(h=bs(x,k),h!=null&&y.push(Ss(x,h,g)))),f)break;x=x.return}0<y.length&&(p=new j(p,v,null,a,d),m.push({event:p,listeners:y}))}}if(!(r&7)){e:{if(p=e==="mouseover"||e==="pointerover",j=e==="mouseout"||e==="pointerout",p&&a!==zi&&(v=a.relatedTarget||a.fromElement)&&(Lr(v)||v[ar]))break e;if((j||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,j?(v=a.relatedTarget||a.toElement,j=c,v=v?Lr(v):null,v!==null&&(f=Zr(v),v!==f||v.tag!==5&&v.tag!==6)&&(v=null)):(j=null,v=c),j!==v)){if(y=dc,h="onMouseLeave",k="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(y=uc,h="onPointerLeave",k="onPointerEnter",x="pointer"),f=j==null?p:ca(j),g=v==null?p:ca(v),p=new y(h,x+"leave",j,a,d),p.target=f,p.relatedTarget=g,h=null,Lr(d)===c&&(y=new y(k,x+"enter",v,a,d),y.target=g,y.relatedTarget=f,h=y),f=h,j&&v)t:{for(y=j,k=v,x=0,g=y;g;g=ta(g))x++;for(g=0,h=k;h;h=ta(h))g++;for(;0<x-g;)y=ta(y),x--;for(;0<g-x;)k=ta(k),g--;for(;x--;){if(y===k||k!==null&&y===k.alternate)break t;y=ta(y),k=ta(k)}y=null}else y=null;j!==null&&jc(m,p,j,y,!1),v!==null&&f!==null&&jc(m,f,v,y,!0)}}e:{if(p=c?ca(c):window,j=p.nodeName&&p.nodeName.toLowerCase(),j==="select"||j==="input"&&p.type==="file")var w=Up;else if(xc(p))if(Em)w=Wp;else{w=Hp;var S=Vp}else(j=p.nodeName)&&j.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(w=qp);if(w&&(w=w(e,c))){Cm(m,w,a,d);break e}S&&S(e,p,c),e==="focusout"&&(S=p._wrapperState)&&S.controlled&&p.type==="number"&&Li(p,"number",p.value)}switch(S=c?ca(c):window,e){case"focusin":(xc(S)||S.contentEditable==="true")&&(oa=S,Ji=c,ms=null);break;case"focusout":ms=Ji=oa=null;break;case"mousedown":Yi=!0;break;case"contextmenu":case"mouseup":case"dragend":Yi=!1,bc(m,a,d);break;case"selectionchange":if(Yp)break;case"keydown":case"keyup":bc(m,a,d)}var C;if(ed)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else ia?_m(e,a)&&(N="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(N="onCompositionStart");N&&(Nm&&a.locale!=="ko"&&(ia||N!=="onCompositionStart"?N==="onCompositionEnd"&&ia&&(C=wm()):(pr=d,Ko="value"in pr?pr.value:pr.textContent,ia=!0)),S=Kn(c,N),0<S.length&&(N=new cc(N,e,null,a,d),m.push({event:N,listeners:S}),C?N.data=C:(C=Sm(a),C!==null&&(N.data=C)))),(C=Op?Ip(e,a):Bp(e,a))&&(c=Kn(c,"onBeforeInput"),0<c.length&&(d=new cc("onBeforeInput","beforeinput",null,a,d),m.push({event:d,listeners:c}),d.data=C))}Im(m,r)})}function Ss(e,r,a){return{instance:e,listener:r,currentTarget:a}}function Kn(e,r){for(var a=r+"Capture",s=[];e!==null;){var n=e,l=n.stateNode;n.tag===5&&l!==null&&(n=l,l=bs(e,a),l!=null&&s.unshift(Ss(e,l,n)),l=bs(e,r),l!=null&&s.push(Ss(e,l,n))),e=e.return}return s}function ta(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function jc(e,r,a,s,n){for(var l=r._reactName,i=[];a!==null&&a!==s;){var u=a,o=u.alternate,c=u.stateNode;if(o!==null&&o===s)break;u.tag===5&&c!==null&&(u=c,n?(o=bs(a,l),o!=null&&i.unshift(Ss(a,o,u))):n||(o=bs(a,l),o!=null&&i.push(Ss(a,o,u)))),a=a.return}i.length!==0&&e.push({event:r,listeners:i})}var Zp=/\r\n?/g,ef=/\u0000|\uFFFD/g;function wc(e){return(typeof e=="string"?e:""+e).replace(Zp,`
`).replace(ef,"")}function nn(e,r,a){if(r=wc(r),wc(e)!==r&&a)throw Error(W(425))}function Gn(){}var Xi=null,Ki=null;function Gi(e,r){return e==="textarea"||e==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Zi=typeof setTimeout=="function"?setTimeout:void 0,tf=typeof clearTimeout=="function"?clearTimeout:void 0,Nc=typeof Promise=="function"?Promise:void 0,rf=typeof queueMicrotask=="function"?queueMicrotask:typeof Nc<"u"?function(e){return Nc.resolve(null).then(e).catch(af)}:Zi;function af(e){setTimeout(function(){throw e})}function mi(e,r){var a=r,s=0;do{var n=a.nextSibling;if(e.removeChild(a),n&&n.nodeType===8)if(a=n.data,a==="/$"){if(s===0){e.removeChild(n),js(r);return}s--}else a!=="$"&&a!=="$?"&&a!=="$!"||s++;a=n}while(a);js(r)}function kr(e){for(;e!=null;e=e.nextSibling){var r=e.nodeType;if(r===1||r===3)break;if(r===8){if(r=e.data,r==="$"||r==="$!"||r==="$?")break;if(r==="/$")return null}}return e}function _c(e){e=e.previousSibling;for(var r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"){if(r===0)return e;r--}else a==="/$"&&r++}e=e.previousSibling}return null}var La=Math.random().toString(36).slice(2),Vt="__reactFiber$"+La,Cs="__reactProps$"+La,ar="__reactContainer$"+La,eo="__reactEvents$"+La,sf="__reactListeners$"+La,nf="__reactHandles$"+La;function Lr(e){var r=e[Vt];if(r)return r;for(var a=e.parentNode;a;){if(r=a[ar]||a[Vt]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(e=_c(e);e!==null;){if(a=e[Vt])return a;e=_c(e)}return r}e=a,a=e.parentNode}return null}function Bs(e){return e=e[Vt]||e[ar],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ca(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(W(33))}function Nl(e){return e[Cs]||null}var to=[],ua=-1;function Pr(e){return{current:e}}function fe(e){0>ua||(e.current=to[ua],to[ua]=null,ua--)}function me(e,r){ua++,to[ua]=e.current,e.current=r}var Cr={},We=Pr(Cr),et=Pr(!1),Hr=Cr;function Sa(e,r){var a=e.type.contextTypes;if(!a)return Cr;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===r)return s.__reactInternalMemoizedMaskedChildContext;var n={},l;for(l in a)n[l]=r[l];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=r,e.__reactInternalMemoizedMaskedChildContext=n),n}function tt(e){return e=e.childContextTypes,e!=null}function Zn(){fe(et),fe(We)}function Sc(e,r,a){if(We.current!==Cr)throw Error(W(168));me(We,r),me(et,a)}function $m(e,r,a){var s=e.stateNode;if(r=r.childContextTypes,typeof s.getChildContext!="function")return a;s=s.getChildContext();for(var n in s)if(!(n in r))throw Error(W(108,Vh(e)||"Unknown",n));return Ne({},a,s)}function el(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Cr,Hr=We.current,me(We,e),me(et,et.current),!0}function Cc(e,r,a){var s=e.stateNode;if(!s)throw Error(W(169));a?(e=$m(e,r,Hr),s.__reactInternalMemoizedMergedChildContext=e,fe(et),fe(We),me(We,e)):fe(et),me(et,a)}var Kt=null,_l=!1,gi=!1;function zm(e){Kt===null?Kt=[e]:Kt.push(e)}function lf(e){_l=!0,zm(e)}function Dr(){if(!gi&&Kt!==null){gi=!0;var e=0,r=ue;try{var a=Kt;for(ue=1;e<a.length;e++){var s=a[e];do s=s(!0);while(s!==null)}Kt=null,_l=!1}catch(n){throw Kt!==null&&(Kt=Kt.slice(e+1)),mm(Qo,Dr),n}finally{ue=r,gi=!1}}return null}var ma=[],ga=0,tl=null,rl=0,ht=[],pt=0,qr=null,Gt=1,Zt="";function Fr(e,r){ma[ga++]=rl,ma[ga++]=tl,tl=e,rl=r}function Um(e,r,a){ht[pt++]=Gt,ht[pt++]=Zt,ht[pt++]=qr,qr=e;var s=Gt;e=Zt;var n=32-Mt(s)-1;s&=~(1<<n),a+=1;var l=32-Mt(r)+n;if(30<l){var i=n-n%5;l=(s&(1<<i)-1).toString(32),s>>=i,n-=i,Gt=1<<32-Mt(r)+n|a<<n|s,Zt=l+e}else Gt=1<<l|a<<n|s,Zt=e}function rd(e){e.return!==null&&(Fr(e,1),Um(e,1,0))}function ad(e){for(;e===tl;)tl=ma[--ga],ma[ga]=null,rl=ma[--ga],ma[ga]=null;for(;e===qr;)qr=ht[--pt],ht[pt]=null,Zt=ht[--pt],ht[pt]=null,Gt=ht[--pt],ht[pt]=null}var ot=null,it=null,be=!1,Dt=null;function Vm(e,r){var a=ft(5,null,null,0);a.elementType="DELETED",a.stateNode=r,a.return=e,r=e.deletions,r===null?(e.deletions=[a],e.flags|=16):r.push(a)}function Ec(e,r){switch(e.tag){case 5:var a=e.type;return r=r.nodeType!==1||a.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(e.stateNode=r,ot=e,it=kr(r.firstChild),!0):!1;case 6:return r=e.pendingProps===""||r.nodeType!==3?null:r,r!==null?(e.stateNode=r,ot=e,it=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(a=qr!==null?{id:Gt,overflow:Zt}:null,e.memoizedState={dehydrated:r,treeContext:a,retryLane:1073741824},a=ft(18,null,null,0),a.stateNode=r,a.return=e,e.child=a,ot=e,it=null,!0):!1;default:return!1}}function ro(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ao(e){if(be){var r=it;if(r){var a=r;if(!Ec(e,r)){if(ro(e))throw Error(W(418));r=kr(a.nextSibling);var s=ot;r&&Ec(e,r)?Vm(s,a):(e.flags=e.flags&-4097|2,be=!1,ot=e)}}else{if(ro(e))throw Error(W(418));e.flags=e.flags&-4097|2,be=!1,ot=e}}}function Rc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ot=e}function ln(e){if(e!==ot)return!1;if(!be)return Rc(e),be=!0,!1;var r;if((r=e.tag!==3)&&!(r=e.tag!==5)&&(r=e.type,r=r!=="head"&&r!=="body"&&!Gi(e.type,e.memoizedProps)),r&&(r=it)){if(ro(e))throw Hm(),Error(W(418));for(;r;)Vm(e,r),r=kr(r.nextSibling)}if(Rc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(W(317));e:{for(e=e.nextSibling,r=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"){if(r===0){it=kr(e.nextSibling);break e}r--}else a!=="$"&&a!=="$!"&&a!=="$?"||r++}e=e.nextSibling}it=null}}else it=ot?kr(e.stateNode.nextSibling):null;return!0}function Hm(){for(var e=it;e;)e=kr(e.nextSibling)}function Ca(){it=ot=null,be=!1}function sd(e){Dt===null?Dt=[e]:Dt.push(e)}var of=or.ReactCurrentBatchConfig;function Ya(e,r,a){if(e=a.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(W(309));var s=a.stateNode}if(!s)throw Error(W(147,e));var n=s,l=""+e;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===l?r.ref:(r=function(i){var u=n.refs;i===null?delete u[l]:u[l]=i},r._stringRef=l,r)}if(typeof e!="string")throw Error(W(284));if(!a._owner)throw Error(W(290,e))}return e}function on(e,r){throw e=Object.prototype.toString.call(r),Error(W(31,e==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":e))}function Pc(e){var r=e._init;return r(e._payload)}function qm(e){function r(k,x){if(e){var g=k.deletions;g===null?(k.deletions=[x],k.flags|=16):g.push(x)}}function a(k,x){if(!e)return null;for(;x!==null;)r(k,x),x=x.sibling;return null}function s(k,x){for(k=new Map;x!==null;)x.key!==null?k.set(x.key,x):k.set(x.index,x),x=x.sibling;return k}function n(k,x){return k=_r(k,x),k.index=0,k.sibling=null,k}function l(k,x,g){return k.index=g,e?(g=k.alternate,g!==null?(g=g.index,g<x?(k.flags|=2,x):g):(k.flags|=2,x)):(k.flags|=1048576,x)}function i(k){return e&&k.alternate===null&&(k.flags|=2),k}function u(k,x,g,h){return x===null||x.tag!==6?(x=vi(g,k.mode,h),x.return=k,x):(x=n(x,g),x.return=k,x)}function o(k,x,g,h){var w=g.type;return w===la?d(k,x,g.props.children,h,g.key):x!==null&&(x.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===ur&&Pc(w)===x.type)?(h=n(x,g.props),h.ref=Ya(k,x,g),h.return=k,h):(h=Tn(g.type,g.key,g.props,null,k.mode,h),h.ref=Ya(k,x,g),h.return=k,h)}function c(k,x,g,h){return x===null||x.tag!==4||x.stateNode.containerInfo!==g.containerInfo||x.stateNode.implementation!==g.implementation?(x=ki(g,k.mode,h),x.return=k,x):(x=n(x,g.children||[]),x.return=k,x)}function d(k,x,g,h,w){return x===null||x.tag!==7?(x=zr(g,k.mode,h,w),x.return=k,x):(x=n(x,g),x.return=k,x)}function m(k,x,g){if(typeof x=="string"&&x!==""||typeof x=="number")return x=vi(""+x,k.mode,g),x.return=k,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Xs:return g=Tn(x.type,x.key,x.props,null,k.mode,g),g.ref=Ya(k,null,x),g.return=k,g;case na:return x=ki(x,k.mode,g),x.return=k,x;case ur:var h=x._init;return m(k,h(x._payload),g)}if(ns(x)||Ha(x))return x=zr(x,k.mode,g,null),x.return=k,x;on(k,x)}return null}function p(k,x,g,h){var w=x!==null?x.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return w!==null?null:u(k,x,""+g,h);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Xs:return g.key===w?o(k,x,g,h):null;case na:return g.key===w?c(k,x,g,h):null;case ur:return w=g._init,p(k,x,w(g._payload),h)}if(ns(g)||Ha(g))return w!==null?null:d(k,x,g,h,null);on(k,g)}return null}function j(k,x,g,h,w){if(typeof h=="string"&&h!==""||typeof h=="number")return k=k.get(g)||null,u(x,k,""+h,w);if(typeof h=="object"&&h!==null){switch(h.$$typeof){case Xs:return k=k.get(h.key===null?g:h.key)||null,o(x,k,h,w);case na:return k=k.get(h.key===null?g:h.key)||null,c(x,k,h,w);case ur:var S=h._init;return j(k,x,g,S(h._payload),w)}if(ns(h)||Ha(h))return k=k.get(g)||null,d(x,k,h,w,null);on(x,h)}return null}function v(k,x,g,h){for(var w=null,S=null,C=x,N=x=0,D=null;C!==null&&N<g.length;N++){C.index>N?(D=C,C=null):D=C.sibling;var R=p(k,C,g[N],h);if(R===null){C===null&&(C=D);break}e&&C&&R.alternate===null&&r(k,C),x=l(R,x,N),S===null?w=R:S.sibling=R,S=R,C=D}if(N===g.length)return a(k,C),be&&Fr(k,N),w;if(C===null){for(;N<g.length;N++)C=m(k,g[N],h),C!==null&&(x=l(C,x,N),S===null?w=C:S.sibling=C,S=C);return be&&Fr(k,N),w}for(C=s(k,C);N<g.length;N++)D=j(C,k,N,g[N],h),D!==null&&(e&&D.alternate!==null&&C.delete(D.key===null?N:D.key),x=l(D,x,N),S===null?w=D:S.sibling=D,S=D);return e&&C.forEach(function(F){return r(k,F)}),be&&Fr(k,N),w}function y(k,x,g,h){var w=Ha(g);if(typeof w!="function")throw Error(W(150));if(g=w.call(g),g==null)throw Error(W(151));for(var S=w=null,C=x,N=x=0,D=null,R=g.next();C!==null&&!R.done;N++,R=g.next()){C.index>N?(D=C,C=null):D=C.sibling;var F=p(k,C,R.value,h);if(F===null){C===null&&(C=D);break}e&&C&&F.alternate===null&&r(k,C),x=l(F,x,N),S===null?w=F:S.sibling=F,S=F,C=D}if(R.done)return a(k,C),be&&Fr(k,N),w;if(C===null){for(;!R.done;N++,R=g.next())R=m(k,R.value,h),R!==null&&(x=l(R,x,N),S===null?w=R:S.sibling=R,S=R);return be&&Fr(k,N),w}for(C=s(k,C);!R.done;N++,R=g.next())R=j(C,k,N,R.value,h),R!==null&&(e&&R.alternate!==null&&C.delete(R.key===null?N:R.key),x=l(R,x,N),S===null?w=R:S.sibling=R,S=R);return e&&C.forEach(function(A){return r(k,A)}),be&&Fr(k,N),w}function f(k,x,g,h){if(typeof g=="object"&&g!==null&&g.type===la&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Xs:e:{for(var w=g.key,S=x;S!==null;){if(S.key===w){if(w=g.type,w===la){if(S.tag===7){a(k,S.sibling),x=n(S,g.props.children),x.return=k,k=x;break e}}else if(S.elementType===w||typeof w=="object"&&w!==null&&w.$$typeof===ur&&Pc(w)===S.type){a(k,S.sibling),x=n(S,g.props),x.ref=Ya(k,S,g),x.return=k,k=x;break e}a(k,S);break}else r(k,S);S=S.sibling}g.type===la?(x=zr(g.props.children,k.mode,h,g.key),x.return=k,k=x):(h=Tn(g.type,g.key,g.props,null,k.mode,h),h.ref=Ya(k,x,g),h.return=k,k=h)}return i(k);case na:e:{for(S=g.key;x!==null;){if(x.key===S)if(x.tag===4&&x.stateNode.containerInfo===g.containerInfo&&x.stateNode.implementation===g.implementation){a(k,x.sibling),x=n(x,g.children||[]),x.return=k,k=x;break e}else{a(k,x);break}else r(k,x);x=x.sibling}x=ki(g,k.mode,h),x.return=k,k=x}return i(k);case ur:return S=g._init,f(k,x,S(g._payload),h)}if(ns(g))return v(k,x,g,h);if(Ha(g))return y(k,x,g,h);on(k,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,x!==null&&x.tag===6?(a(k,x.sibling),x=n(x,g),x.return=k,k=x):(a(k,x),x=vi(g,k.mode,h),x.return=k,k=x),i(k)):a(k,x)}return f}var Ea=qm(!0),Wm=qm(!1),al=Pr(null),sl=null,xa=null,nd=null;function ld(){nd=xa=sl=null}function id(e){var r=al.current;fe(al),e._currentValue=r}function so(e,r,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&r)!==r?(e.childLanes|=r,s!==null&&(s.childLanes|=r)):s!==null&&(s.childLanes&r)!==r&&(s.childLanes|=r),e===a)break;e=e.return}}function wa(e,r){sl=e,nd=xa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&r&&(Ze=!0),e.firstContext=null)}function kt(e){var r=e._currentValue;if(nd!==e)if(e={context:e,memoizedValue:r,next:null},xa===null){if(sl===null)throw Error(W(308));xa=e,sl.dependencies={lanes:0,firstContext:e}}else xa=xa.next=e;return r}var Or=null;function od(e){Or===null?Or=[e]:Or.push(e)}function Qm(e,r,a,s){var n=r.interleaved;return n===null?(a.next=a,od(r)):(a.next=n.next,n.next=a),r.interleaved=a,sr(e,s)}function sr(e,r){e.lanes|=r;var a=e.alternate;for(a!==null&&(a.lanes|=r),a=e,e=e.return;e!==null;)e.childLanes|=r,a=e.alternate,a!==null&&(a.childLanes|=r),a=e,e=e.return;return a.tag===3?a.stateNode:null}var mr=!1;function dd(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jm(e,r){e=e.updateQueue,r.updateQueue===e&&(r.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function er(e,r){return{eventTime:e,lane:r,tag:0,payload:null,callback:null,next:null}}function jr(e,r,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,oe&2){var n=s.pending;return n===null?r.next=r:(r.next=n.next,n.next=r),s.pending=r,sr(e,a)}return n=s.interleaved,n===null?(r.next=r,od(s)):(r.next=n.next,n.next=r),s.interleaved=r,sr(e,a)}function Rn(e,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194240)!==0)){var s=r.lanes;s&=e.pendingLanes,a|=s,r.lanes=a,Jo(e,a)}}function Dc(e,r){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var n=null,l=null;if(a=a.firstBaseUpdate,a!==null){do{var i={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};l===null?n=l=i:l=l.next=i,a=a.next}while(a!==null);l===null?n=l=r:l=l.next=r}else n=l=r;a={baseState:s.baseState,firstBaseUpdate:n,lastBaseUpdate:l,shared:s.shared,effects:s.effects},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=r:e.next=r,a.lastBaseUpdate=r}function nl(e,r,a,s){var n=e.updateQueue;mr=!1;var l=n.firstBaseUpdate,i=n.lastBaseUpdate,u=n.shared.pending;if(u!==null){n.shared.pending=null;var o=u,c=o.next;o.next=null,i===null?l=c:i.next=c,i=o;var d=e.alternate;d!==null&&(d=d.updateQueue,u=d.lastBaseUpdate,u!==i&&(u===null?d.firstBaseUpdate=c:u.next=c,d.lastBaseUpdate=o))}if(l!==null){var m=n.baseState;i=0,d=c=o=null,u=l;do{var p=u.lane,j=u.eventTime;if((s&p)===p){d!==null&&(d=d.next={eventTime:j,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var v=e,y=u;switch(p=r,j=a,y.tag){case 1:if(v=y.payload,typeof v=="function"){m=v.call(j,m,p);break e}m=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=y.payload,p=typeof v=="function"?v.call(j,m,p):v,p==null)break e;m=Ne({},m,p);break e;case 2:mr=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,p=n.effects,p===null?n.effects=[u]:p.push(u))}else j={eventTime:j,lane:p,tag:u.tag,payload:u.payload,callback:u.callback,next:null},d===null?(c=d=j,o=m):d=d.next=j,i|=p;if(u=u.next,u===null){if(u=n.shared.pending,u===null)break;p=u,u=p.next,p.next=null,n.lastBaseUpdate=p,n.shared.pending=null}}while(!0);if(d===null&&(o=m),n.baseState=o,n.firstBaseUpdate=c,n.lastBaseUpdate=d,r=n.shared.interleaved,r!==null){n=r;do i|=n.lane,n=n.next;while(n!==r)}else l===null&&(n.shared.lanes=0);Qr|=i,e.lanes=i,e.memoizedState=m}}function Mc(e,r,a){if(e=r.effects,r.effects=null,e!==null)for(r=0;r<e.length;r++){var s=e[r],n=s.callback;if(n!==null){if(s.callback=null,s=a,typeof n!="function")throw Error(W(191,n));n.call(s)}}}var $s={},Wt=Pr($s),Es=Pr($s),Rs=Pr($s);function Ir(e){if(e===$s)throw Error(W(174));return e}function cd(e,r){switch(me(Rs,r),me(Es,e),me(Wt,$s),e=r.nodeType,e){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:Ii(null,"");break;default:e=e===8?r.parentNode:r,r=e.namespaceURI||null,e=e.tagName,r=Ii(r,e)}fe(Wt),me(Wt,r)}function Ra(){fe(Wt),fe(Es),fe(Rs)}function Ym(e){Ir(Rs.current);var r=Ir(Wt.current),a=Ii(r,e.type);r!==a&&(me(Es,e),me(Wt,a))}function ud(e){Es.current===e&&(fe(Wt),fe(Es))}var je=Pr(0);function ll(e){for(var r=e;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if(r.flags&128)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var xi=[];function md(){for(var e=0;e<xi.length;e++)xi[e]._workInProgressVersionPrimary=null;xi.length=0}var Pn=or.ReactCurrentDispatcher,hi=or.ReactCurrentBatchConfig,Wr=0,we=null,Me=null,Fe=null,il=!1,gs=!1,Ps=0,df=0;function Be(){throw Error(W(321))}function gd(e,r){if(r===null)return!1;for(var a=0;a<r.length&&a<e.length;a++)if(!Ft(e[a],r[a]))return!1;return!0}function xd(e,r,a,s,n,l){if(Wr=l,we=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Pn.current=e===null||e.memoizedState===null?gf:xf,e=a(s,n),gs){l=0;do{if(gs=!1,Ps=0,25<=l)throw Error(W(301));l+=1,Fe=Me=null,r.updateQueue=null,Pn.current=hf,e=a(s,n)}while(gs)}if(Pn.current=ol,r=Me!==null&&Me.next!==null,Wr=0,Fe=Me=we=null,il=!1,r)throw Error(W(300));return e}function hd(){var e=Ps!==0;return Ps=0,e}function Ut(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Fe===null?we.memoizedState=Fe=e:Fe=Fe.next=e,Fe}function jt(){if(Me===null){var e=we.alternate;e=e!==null?e.memoizedState:null}else e=Me.next;var r=Fe===null?we.memoizedState:Fe.next;if(r!==null)Fe=r,Me=e;else{if(e===null)throw Error(W(310));Me=e,e={memoizedState:Me.memoizedState,baseState:Me.baseState,baseQueue:Me.baseQueue,queue:Me.queue,next:null},Fe===null?we.memoizedState=Fe=e:Fe=Fe.next=e}return Fe}function Ds(e,r){return typeof r=="function"?r(e):r}function pi(e){var r=jt(),a=r.queue;if(a===null)throw Error(W(311));a.lastRenderedReducer=e;var s=Me,n=s.baseQueue,l=a.pending;if(l!==null){if(n!==null){var i=n.next;n.next=l.next,l.next=i}s.baseQueue=n=l,a.pending=null}if(n!==null){l=n.next,s=s.baseState;var u=i=null,o=null,c=l;do{var d=c.lane;if((Wr&d)===d)o!==null&&(o=o.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),s=c.hasEagerState?c.eagerState:e(s,c.action);else{var m={lane:d,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};o===null?(u=o=m,i=s):o=o.next=m,we.lanes|=d,Qr|=d}c=c.next}while(c!==null&&c!==l);o===null?i=s:o.next=u,Ft(s,r.memoizedState)||(Ze=!0),r.memoizedState=s,r.baseState=i,r.baseQueue=o,a.lastRenderedState=s}if(e=a.interleaved,e!==null){n=e;do l=n.lane,we.lanes|=l,Qr|=l,n=n.next;while(n!==e)}else n===null&&(a.lanes=0);return[r.memoizedState,a.dispatch]}function fi(e){var r=jt(),a=r.queue;if(a===null)throw Error(W(311));a.lastRenderedReducer=e;var s=a.dispatch,n=a.pending,l=r.memoizedState;if(n!==null){a.pending=null;var i=n=n.next;do l=e(l,i.action),i=i.next;while(i!==n);Ft(l,r.memoizedState)||(Ze=!0),r.memoizedState=l,r.baseQueue===null&&(r.baseState=l),a.lastRenderedState=l}return[l,s]}function Xm(){}function Km(e,r){var a=we,s=jt(),n=r(),l=!Ft(s.memoizedState,n);if(l&&(s.memoizedState=n,Ze=!0),s=s.queue,pd(e0.bind(null,a,s,e),[e]),s.getSnapshot!==r||l||Fe!==null&&Fe.memoizedState.tag&1){if(a.flags|=2048,Ms(9,Zm.bind(null,a,s,n,r),void 0,null),Te===null)throw Error(W(349));Wr&30||Gm(a,r,n)}return n}function Gm(e,r,a){e.flags|=16384,e={getSnapshot:r,value:a},r=we.updateQueue,r===null?(r={lastEffect:null,stores:null},we.updateQueue=r,r.stores=[e]):(a=r.stores,a===null?r.stores=[e]:a.push(e))}function Zm(e,r,a,s){r.value=a,r.getSnapshot=s,t0(r)&&r0(e)}function e0(e,r,a){return a(function(){t0(r)&&r0(e)})}function t0(e){var r=e.getSnapshot;e=e.value;try{var a=r();return!Ft(e,a)}catch{return!0}}function r0(e){var r=sr(e,1);r!==null&&At(r,e,1,-1)}function Ac(e){var r=Ut();return typeof e=="function"&&(e=e()),r.memoizedState=r.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ds,lastRenderedState:e},r.queue=e,e=e.dispatch=mf.bind(null,we,e),[r.memoizedState,e]}function Ms(e,r,a,s){return e={tag:e,create:r,destroy:a,deps:s,next:null},r=we.updateQueue,r===null?(r={lastEffect:null,stores:null},we.updateQueue=r,r.lastEffect=e.next=e):(a=r.lastEffect,a===null?r.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,r.lastEffect=e)),e}function a0(){return jt().memoizedState}function Dn(e,r,a,s){var n=Ut();we.flags|=e,n.memoizedState=Ms(1|r,a,void 0,s===void 0?null:s)}function Sl(e,r,a,s){var n=jt();s=s===void 0?null:s;var l=void 0;if(Me!==null){var i=Me.memoizedState;if(l=i.destroy,s!==null&&gd(s,i.deps)){n.memoizedState=Ms(r,a,l,s);return}}we.flags|=e,n.memoizedState=Ms(1|r,a,l,s)}function Fc(e,r){return Dn(8390656,8,e,r)}function pd(e,r){return Sl(2048,8,e,r)}function s0(e,r){return Sl(4,2,e,r)}function n0(e,r){return Sl(4,4,e,r)}function l0(e,r){if(typeof r=="function")return e=e(),r(e),function(){r(null)};if(r!=null)return e=e(),r.current=e,function(){r.current=null}}function i0(e,r,a){return a=a!=null?a.concat([e]):null,Sl(4,4,l0.bind(null,r,e),a)}function fd(){}function o0(e,r){var a=jt();r=r===void 0?null:r;var s=a.memoizedState;return s!==null&&r!==null&&gd(r,s[1])?s[0]:(a.memoizedState=[e,r],e)}function d0(e,r){var a=jt();r=r===void 0?null:r;var s=a.memoizedState;return s!==null&&r!==null&&gd(r,s[1])?s[0]:(e=e(),a.memoizedState=[e,r],e)}function c0(e,r,a){return Wr&21?(Ft(a,r)||(a=hm(),we.lanes|=a,Qr|=a,e.baseState=!0),r):(e.baseState&&(e.baseState=!1,Ze=!0),e.memoizedState=a)}function cf(e,r){var a=ue;ue=a!==0&&4>a?a:4,e(!0);var s=hi.transition;hi.transition={};try{e(!1),r()}finally{ue=a,hi.transition=s}}function u0(){return jt().memoizedState}function uf(e,r,a){var s=Nr(e);if(a={lane:s,action:a,hasEagerState:!1,eagerState:null,next:null},m0(e))g0(r,a);else if(a=Qm(e,r,a,s),a!==null){var n=Je();At(a,e,s,n),x0(a,r,s)}}function mf(e,r,a){var s=Nr(e),n={lane:s,action:a,hasEagerState:!1,eagerState:null,next:null};if(m0(e))g0(r,n);else{var l=e.alternate;if(e.lanes===0&&(l===null||l.lanes===0)&&(l=r.lastRenderedReducer,l!==null))try{var i=r.lastRenderedState,u=l(i,a);if(n.hasEagerState=!0,n.eagerState=u,Ft(u,i)){var o=r.interleaved;o===null?(n.next=n,od(r)):(n.next=o.next,o.next=n),r.interleaved=n;return}}catch{}finally{}a=Qm(e,r,n,s),a!==null&&(n=Je(),At(a,e,s,n),x0(a,r,s))}}function m0(e){var r=e.alternate;return e===we||r!==null&&r===we}function g0(e,r){gs=il=!0;var a=e.pending;a===null?r.next=r:(r.next=a.next,a.next=r),e.pending=r}function x0(e,r,a){if(a&4194240){var s=r.lanes;s&=e.pendingLanes,a|=s,r.lanes=a,Jo(e,a)}}var ol={readContext:kt,useCallback:Be,useContext:Be,useEffect:Be,useImperativeHandle:Be,useInsertionEffect:Be,useLayoutEffect:Be,useMemo:Be,useReducer:Be,useRef:Be,useState:Be,useDebugValue:Be,useDeferredValue:Be,useTransition:Be,useMutableSource:Be,useSyncExternalStore:Be,useId:Be,unstable_isNewReconciler:!1},gf={readContext:kt,useCallback:function(e,r){return Ut().memoizedState=[e,r===void 0?null:r],e},useContext:kt,useEffect:Fc,useImperativeHandle:function(e,r,a){return a=a!=null?a.concat([e]):null,Dn(4194308,4,l0.bind(null,r,e),a)},useLayoutEffect:function(e,r){return Dn(4194308,4,e,r)},useInsertionEffect:function(e,r){return Dn(4,2,e,r)},useMemo:function(e,r){var a=Ut();return r=r===void 0?null:r,e=e(),a.memoizedState=[e,r],e},useReducer:function(e,r,a){var s=Ut();return r=a!==void 0?a(r):r,s.memoizedState=s.baseState=r,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},s.queue=e,e=e.dispatch=uf.bind(null,we,e),[s.memoizedState,e]},useRef:function(e){var r=Ut();return e={current:e},r.memoizedState=e},useState:Ac,useDebugValue:fd,useDeferredValue:function(e){return Ut().memoizedState=e},useTransition:function(){var e=Ac(!1),r=e[0];return e=cf.bind(null,e[1]),Ut().memoizedState=e,[r,e]},useMutableSource:function(){},useSyncExternalStore:function(e,r,a){var s=we,n=Ut();if(be){if(a===void 0)throw Error(W(407));a=a()}else{if(a=r(),Te===null)throw Error(W(349));Wr&30||Gm(s,r,a)}n.memoizedState=a;var l={value:a,getSnapshot:r};return n.queue=l,Fc(e0.bind(null,s,l,e),[e]),s.flags|=2048,Ms(9,Zm.bind(null,s,l,a,r),void 0,null),a},useId:function(){var e=Ut(),r=Te.identifierPrefix;if(be){var a=Zt,s=Gt;a=(s&~(1<<32-Mt(s)-1)).toString(32)+a,r=":"+r+"R"+a,a=Ps++,0<a&&(r+="H"+a.toString(32)),r+=":"}else a=df++,r=":"+r+"r"+a.toString(32)+":";return e.memoizedState=r},unstable_isNewReconciler:!1},xf={readContext:kt,useCallback:o0,useContext:kt,useEffect:pd,useImperativeHandle:i0,useInsertionEffect:s0,useLayoutEffect:n0,useMemo:d0,useReducer:pi,useRef:a0,useState:function(){return pi(Ds)},useDebugValue:fd,useDeferredValue:function(e){var r=jt();return c0(r,Me.memoizedState,e)},useTransition:function(){var e=pi(Ds)[0],r=jt().memoizedState;return[e,r]},useMutableSource:Xm,useSyncExternalStore:Km,useId:u0,unstable_isNewReconciler:!1},hf={readContext:kt,useCallback:o0,useContext:kt,useEffect:pd,useImperativeHandle:i0,useInsertionEffect:s0,useLayoutEffect:n0,useMemo:d0,useReducer:fi,useRef:a0,useState:function(){return fi(Ds)},useDebugValue:fd,useDeferredValue:function(e){var r=jt();return Me===null?r.memoizedState=e:c0(r,Me.memoizedState,e)},useTransition:function(){var e=fi(Ds)[0],r=jt().memoizedState;return[e,r]},useMutableSource:Xm,useSyncExternalStore:Km,useId:u0,unstable_isNewReconciler:!1};function Rt(e,r){if(e&&e.defaultProps){r=Ne({},r),e=e.defaultProps;for(var a in e)r[a]===void 0&&(r[a]=e[a]);return r}return r}function no(e,r,a,s){r=e.memoizedState,a=a(s,r),a=a==null?r:Ne({},r,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Cl={isMounted:function(e){return(e=e._reactInternals)?Zr(e)===e:!1},enqueueSetState:function(e,r,a){e=e._reactInternals;var s=Je(),n=Nr(e),l=er(s,n);l.payload=r,a!=null&&(l.callback=a),r=jr(e,l,n),r!==null&&(At(r,e,n,s),Rn(r,e,n))},enqueueReplaceState:function(e,r,a){e=e._reactInternals;var s=Je(),n=Nr(e),l=er(s,n);l.tag=1,l.payload=r,a!=null&&(l.callback=a),r=jr(e,l,n),r!==null&&(At(r,e,n,s),Rn(r,e,n))},enqueueForceUpdate:function(e,r){e=e._reactInternals;var a=Je(),s=Nr(e),n=er(a,s);n.tag=2,r!=null&&(n.callback=r),r=jr(e,n,s),r!==null&&(At(r,e,s,a),Rn(r,e,s))}};function Tc(e,r,a,s,n,l,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,l,i):r.prototype&&r.prototype.isPureReactComponent?!Ns(a,s)||!Ns(n,l):!0}function h0(e,r,a){var s=!1,n=Cr,l=r.contextType;return typeof l=="object"&&l!==null?l=kt(l):(n=tt(r)?Hr:We.current,s=r.contextTypes,l=(s=s!=null)?Sa(e,n):Cr),r=new r(a,l),e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=Cl,e.stateNode=r,r._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=l),r}function Lc(e,r,a,s){e=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,s),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,s),r.state!==e&&Cl.enqueueReplaceState(r,r.state,null)}function lo(e,r,a,s){var n=e.stateNode;n.props=a,n.state=e.memoizedState,n.refs={},dd(e);var l=r.contextType;typeof l=="object"&&l!==null?n.context=kt(l):(l=tt(r)?Hr:We.current,n.context=Sa(e,l)),n.state=e.memoizedState,l=r.getDerivedStateFromProps,typeof l=="function"&&(no(e,r,l,a),n.state=e.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(r=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),r!==n.state&&Cl.enqueueReplaceState(n,n.state,null),nl(e,a,n,s),n.state=e.memoizedState),typeof n.componentDidMount=="function"&&(e.flags|=4194308)}function Pa(e,r){try{var a="",s=r;do a+=Uh(s),s=s.return;while(s);var n=a}catch(l){n=`
Error generating stack: `+l.message+`
`+l.stack}return{value:e,source:r,stack:n,digest:null}}function yi(e,r,a){return{value:e,source:null,stack:a??null,digest:r??null}}function io(e,r){try{console.error(r.value)}catch(a){setTimeout(function(){throw a})}}var pf=typeof WeakMap=="function"?WeakMap:Map;function p0(e,r,a){a=er(-1,a),a.tag=3,a.payload={element:null};var s=r.value;return a.callback=function(){cl||(cl=!0,yo=s),io(e,r)},a}function f0(e,r,a){a=er(-1,a),a.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var n=r.value;a.payload=function(){return s(n)},a.callback=function(){io(e,r)}}var l=e.stateNode;return l!==null&&typeof l.componentDidCatch=="function"&&(a.callback=function(){io(e,r),typeof s!="function"&&(wr===null?wr=new Set([this]):wr.add(this));var i=r.stack;this.componentDidCatch(r.value,{componentStack:i!==null?i:""})}),a}function Oc(e,r,a){var s=e.pingCache;if(s===null){s=e.pingCache=new pf;var n=new Set;s.set(r,n)}else n=s.get(r),n===void 0&&(n=new Set,s.set(r,n));n.has(a)||(n.add(a),e=Pf.bind(null,e,r,a),r.then(e,e))}function Ic(e){do{var r;if((r=e.tag===13)&&(r=e.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return e;e=e.return}while(e!==null);return null}function Bc(e,r,a,s,n){return e.mode&1?(e.flags|=65536,e.lanes=n,e):(e===r?e.flags|=65536:(e.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(r=er(-1,1),r.tag=2,jr(a,r,1))),a.lanes|=1),e)}var ff=or.ReactCurrentOwner,Ze=!1;function Qe(e,r,a,s){r.child=e===null?Wm(r,null,a,s):Ea(r,e.child,a,s)}function $c(e,r,a,s,n){a=a.render;var l=r.ref;return wa(r,n),s=xd(e,r,a,s,l,n),a=hd(),e!==null&&!Ze?(r.updateQueue=e.updateQueue,r.flags&=-2053,e.lanes&=~n,nr(e,r,n)):(be&&a&&rd(r),r.flags|=1,Qe(e,r,s,n),r.child)}function zc(e,r,a,s,n){if(e===null){var l=a.type;return typeof l=="function"&&!_d(l)&&l.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(r.tag=15,r.type=l,y0(e,r,l,s,n)):(e=Tn(a.type,null,s,r,r.mode,n),e.ref=r.ref,e.return=r,r.child=e)}if(l=e.child,!(e.lanes&n)){var i=l.memoizedProps;if(a=a.compare,a=a!==null?a:Ns,a(i,s)&&e.ref===r.ref)return nr(e,r,n)}return r.flags|=1,e=_r(l,s),e.ref=r.ref,e.return=r,r.child=e}function y0(e,r,a,s,n){if(e!==null){var l=e.memoizedProps;if(Ns(l,s)&&e.ref===r.ref)if(Ze=!1,r.pendingProps=s=l,(e.lanes&n)!==0)e.flags&131072&&(Ze=!0);else return r.lanes=e.lanes,nr(e,r,n)}return oo(e,r,a,s,n)}function b0(e,r,a){var s=r.pendingProps,n=s.children,l=e!==null?e.memoizedState:null;if(s.mode==="hidden")if(!(r.mode&1))r.memoizedState={baseLanes:0,cachePool:null,transitions:null},me(pa,lt),lt|=a;else{if(!(a&1073741824))return e=l!==null?l.baseLanes|a:a,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:e,cachePool:null,transitions:null},r.updateQueue=null,me(pa,lt),lt|=e,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=l!==null?l.baseLanes:a,me(pa,lt),lt|=s}else l!==null?(s=l.baseLanes|a,r.memoizedState=null):s=a,me(pa,lt),lt|=s;return Qe(e,r,n,a),r.child}function v0(e,r){var a=r.ref;(e===null&&a!==null||e!==null&&e.ref!==a)&&(r.flags|=512,r.flags|=2097152)}function oo(e,r,a,s,n){var l=tt(a)?Hr:We.current;return l=Sa(r,l),wa(r,n),a=xd(e,r,a,s,l,n),s=hd(),e!==null&&!Ze?(r.updateQueue=e.updateQueue,r.flags&=-2053,e.lanes&=~n,nr(e,r,n)):(be&&s&&rd(r),r.flags|=1,Qe(e,r,a,n),r.child)}function Uc(e,r,a,s,n){if(tt(a)){var l=!0;el(r)}else l=!1;if(wa(r,n),r.stateNode===null)Mn(e,r),h0(r,a,s),lo(r,a,s,n),s=!0;else if(e===null){var i=r.stateNode,u=r.memoizedProps;i.props=u;var o=i.context,c=a.contextType;typeof c=="object"&&c!==null?c=kt(c):(c=tt(a)?Hr:We.current,c=Sa(r,c));var d=a.getDerivedStateFromProps,m=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function";m||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==s||o!==c)&&Lc(r,i,s,c),mr=!1;var p=r.memoizedState;i.state=p,nl(r,s,i,n),o=r.memoizedState,u!==s||p!==o||et.current||mr?(typeof d=="function"&&(no(r,a,d,s),o=r.memoizedState),(u=mr||Tc(r,a,u,s,p,o,c))?(m||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(r.flags|=4194308)):(typeof i.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=s,r.memoizedState=o),i.props=s,i.state=o,i.context=c,s=u):(typeof i.componentDidMount=="function"&&(r.flags|=4194308),s=!1)}else{i=r.stateNode,Jm(e,r),u=r.memoizedProps,c=r.type===r.elementType?u:Rt(r.type,u),i.props=c,m=r.pendingProps,p=i.context,o=a.contextType,typeof o=="object"&&o!==null?o=kt(o):(o=tt(a)?Hr:We.current,o=Sa(r,o));var j=a.getDerivedStateFromProps;(d=typeof j=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(u!==m||p!==o)&&Lc(r,i,s,o),mr=!1,p=r.memoizedState,i.state=p,nl(r,s,i,n);var v=r.memoizedState;u!==m||p!==v||et.current||mr?(typeof j=="function"&&(no(r,a,j,s),v=r.memoizedState),(c=mr||Tc(r,a,c,s,p,v,o)||!1)?(d||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(s,v,o),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(s,v,o)),typeof i.componentDidUpdate=="function"&&(r.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&p===e.memoizedState||(r.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&p===e.memoizedState||(r.flags|=1024),r.memoizedProps=s,r.memoizedState=v),i.props=s,i.state=v,i.context=o,s=c):(typeof i.componentDidUpdate!="function"||u===e.memoizedProps&&p===e.memoizedState||(r.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&p===e.memoizedState||(r.flags|=1024),s=!1)}return co(e,r,a,s,l,n)}function co(e,r,a,s,n,l){v0(e,r);var i=(r.flags&128)!==0;if(!s&&!i)return n&&Cc(r,a,!1),nr(e,r,l);s=r.stateNode,ff.current=r;var u=i&&typeof a.getDerivedStateFromError!="function"?null:s.render();return r.flags|=1,e!==null&&i?(r.child=Ea(r,e.child,null,l),r.child=Ea(r,null,u,l)):Qe(e,r,u,l),r.memoizedState=s.state,n&&Cc(r,a,!0),r.child}function k0(e){var r=e.stateNode;r.pendingContext?Sc(e,r.pendingContext,r.pendingContext!==r.context):r.context&&Sc(e,r.context,!1),cd(e,r.containerInfo)}function Vc(e,r,a,s,n){return Ca(),sd(n),r.flags|=256,Qe(e,r,a,s),r.child}var uo={dehydrated:null,treeContext:null,retryLane:0};function mo(e){return{baseLanes:e,cachePool:null,transitions:null}}function j0(e,r,a){var s=r.pendingProps,n=je.current,l=!1,i=(r.flags&128)!==0,u;if((u=i)||(u=e!==null&&e.memoizedState===null?!1:(n&2)!==0),u?(l=!0,r.flags&=-129):(e===null||e.memoizedState!==null)&&(n|=1),me(je,n&1),e===null)return ao(r),e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(r.mode&1?e.data==="$!"?r.lanes=8:r.lanes=1073741824:r.lanes=1,null):(i=s.children,e=s.fallback,l?(s=r.mode,l=r.child,i={mode:"hidden",children:i},!(s&1)&&l!==null?(l.childLanes=0,l.pendingProps=i):l=Pl(i,s,0,null),e=zr(e,s,a,null),l.return=r,e.return=r,l.sibling=e,r.child=l,r.child.memoizedState=mo(a),r.memoizedState=uo,e):yd(r,i));if(n=e.memoizedState,n!==null&&(u=n.dehydrated,u!==null))return yf(e,r,i,s,u,n,a);if(l){l=s.fallback,i=r.mode,n=e.child,u=n.sibling;var o={mode:"hidden",children:s.children};return!(i&1)&&r.child!==n?(s=r.child,s.childLanes=0,s.pendingProps=o,r.deletions=null):(s=_r(n,o),s.subtreeFlags=n.subtreeFlags&14680064),u!==null?l=_r(u,l):(l=zr(l,i,a,null),l.flags|=2),l.return=r,s.return=r,s.sibling=l,r.child=s,s=l,l=r.child,i=e.child.memoizedState,i=i===null?mo(a):{baseLanes:i.baseLanes|a,cachePool:null,transitions:i.transitions},l.memoizedState=i,l.childLanes=e.childLanes&~a,r.memoizedState=uo,s}return l=e.child,e=l.sibling,s=_r(l,{mode:"visible",children:s.children}),!(r.mode&1)&&(s.lanes=a),s.return=r,s.sibling=null,e!==null&&(a=r.deletions,a===null?(r.deletions=[e],r.flags|=16):a.push(e)),r.child=s,r.memoizedState=null,s}function yd(e,r){return r=Pl({mode:"visible",children:r},e.mode,0,null),r.return=e,e.child=r}function dn(e,r,a,s){return s!==null&&sd(s),Ea(r,e.child,null,a),e=yd(r,r.pendingProps.children),e.flags|=2,r.memoizedState=null,e}function yf(e,r,a,s,n,l,i){if(a)return r.flags&256?(r.flags&=-257,s=yi(Error(W(422))),dn(e,r,i,s)):r.memoizedState!==null?(r.child=e.child,r.flags|=128,null):(l=s.fallback,n=r.mode,s=Pl({mode:"visible",children:s.children},n,0,null),l=zr(l,n,i,null),l.flags|=2,s.return=r,l.return=r,s.sibling=l,r.child=s,r.mode&1&&Ea(r,e.child,null,i),r.child.memoizedState=mo(i),r.memoizedState=uo,l);if(!(r.mode&1))return dn(e,r,i,null);if(n.data==="$!"){if(s=n.nextSibling&&n.nextSibling.dataset,s)var u=s.dgst;return s=u,l=Error(W(419)),s=yi(l,s,void 0),dn(e,r,i,s)}if(u=(i&e.childLanes)!==0,Ze||u){if(s=Te,s!==null){switch(i&-i){case 4:n=2;break;case 16:n=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:n=32;break;case 536870912:n=268435456;break;default:n=0}n=n&(s.suspendedLanes|i)?0:n,n!==0&&n!==l.retryLane&&(l.retryLane=n,sr(e,n),At(s,e,n,-1))}return Nd(),s=yi(Error(W(421))),dn(e,r,i,s)}return n.data==="$?"?(r.flags|=128,r.child=e.child,r=Df.bind(null,e),n._reactRetry=r,null):(e=l.treeContext,it=kr(n.nextSibling),ot=r,be=!0,Dt=null,e!==null&&(ht[pt++]=Gt,ht[pt++]=Zt,ht[pt++]=qr,Gt=e.id,Zt=e.overflow,qr=r),r=yd(r,s.children),r.flags|=4096,r)}function Hc(e,r,a){e.lanes|=r;var s=e.alternate;s!==null&&(s.lanes|=r),so(e.return,r,a)}function bi(e,r,a,s,n){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:n}:(l.isBackwards=r,l.rendering=null,l.renderingStartTime=0,l.last=s,l.tail=a,l.tailMode=n)}function w0(e,r,a){var s=r.pendingProps,n=s.revealOrder,l=s.tail;if(Qe(e,r,s.children,a),s=je.current,s&2)s=s&1|2,r.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=r.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hc(e,a,r);else if(e.tag===19)Hc(e,a,r);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===r)break e;for(;e.sibling===null;){if(e.return===null||e.return===r)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(me(je,s),!(r.mode&1))r.memoizedState=null;else switch(n){case"forwards":for(a=r.child,n=null;a!==null;)e=a.alternate,e!==null&&ll(e)===null&&(n=a),a=a.sibling;a=n,a===null?(n=r.child,r.child=null):(n=a.sibling,a.sibling=null),bi(r,!1,n,a,l);break;case"backwards":for(a=null,n=r.child,r.child=null;n!==null;){if(e=n.alternate,e!==null&&ll(e)===null){r.child=n;break}e=n.sibling,n.sibling=a,a=n,n=e}bi(r,!0,a,null,l);break;case"together":bi(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function Mn(e,r){!(r.mode&1)&&e!==null&&(e.alternate=null,r.alternate=null,r.flags|=2)}function nr(e,r,a){if(e!==null&&(r.dependencies=e.dependencies),Qr|=r.lanes,!(a&r.childLanes))return null;if(e!==null&&r.child!==e.child)throw Error(W(153));if(r.child!==null){for(e=r.child,a=_r(e,e.pendingProps),r.child=a,a.return=r;e.sibling!==null;)e=e.sibling,a=a.sibling=_r(e,e.pendingProps),a.return=r;a.sibling=null}return r.child}function bf(e,r,a){switch(r.tag){case 3:k0(r),Ca();break;case 5:Ym(r);break;case 1:tt(r.type)&&el(r);break;case 4:cd(r,r.stateNode.containerInfo);break;case 10:var s=r.type._context,n=r.memoizedProps.value;me(al,s._currentValue),s._currentValue=n;break;case 13:if(s=r.memoizedState,s!==null)return s.dehydrated!==null?(me(je,je.current&1),r.flags|=128,null):a&r.child.childLanes?j0(e,r,a):(me(je,je.current&1),e=nr(e,r,a),e!==null?e.sibling:null);me(je,je.current&1);break;case 19:if(s=(a&r.childLanes)!==0,e.flags&128){if(s)return w0(e,r,a);r.flags|=128}if(n=r.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),me(je,je.current),s)break;return null;case 22:case 23:return r.lanes=0,b0(e,r,a)}return nr(e,r,a)}var N0,go,_0,S0;N0=function(e,r){for(var a=r.child;a!==null;){if(a.tag===5||a.tag===6)e.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return;a=a.return}a.sibling.return=a.return,a=a.sibling}};go=function(){};_0=function(e,r,a,s){var n=e.memoizedProps;if(n!==s){e=r.stateNode,Ir(Wt.current);var l=null;switch(a){case"input":n=Fi(e,n),s=Fi(e,s),l=[];break;case"select":n=Ne({},n,{value:void 0}),s=Ne({},s,{value:void 0}),l=[];break;case"textarea":n=Oi(e,n),s=Oi(e,s),l=[];break;default:typeof n.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Gn)}Bi(a,s);var i;a=null;for(c in n)if(!s.hasOwnProperty(c)&&n.hasOwnProperty(c)&&n[c]!=null)if(c==="style"){var u=n[c];for(i in u)u.hasOwnProperty(i)&&(a||(a={}),a[i]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(fs.hasOwnProperty(c)?l||(l=[]):(l=l||[]).push(c,null));for(c in s){var o=s[c];if(u=n!=null?n[c]:void 0,s.hasOwnProperty(c)&&o!==u&&(o!=null||u!=null))if(c==="style")if(u){for(i in u)!u.hasOwnProperty(i)||o&&o.hasOwnProperty(i)||(a||(a={}),a[i]="");for(i in o)o.hasOwnProperty(i)&&u[i]!==o[i]&&(a||(a={}),a[i]=o[i])}else a||(l||(l=[]),l.push(c,a)),a=o;else c==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,u=u?u.__html:void 0,o!=null&&u!==o&&(l=l||[]).push(c,o)):c==="children"?typeof o!="string"&&typeof o!="number"||(l=l||[]).push(c,""+o):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(fs.hasOwnProperty(c)?(o!=null&&c==="onScroll"&&he("scroll",e),l||u===o||(l=[])):(l=l||[]).push(c,o))}a&&(l=l||[]).push("style",a);var c=l;(r.updateQueue=c)&&(r.flags|=4)}};S0=function(e,r,a,s){a!==s&&(r.flags|=4)};function Xa(e,r){if(!be)switch(e.tailMode){case"hidden":r=e.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?r||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function $e(e){var r=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(r)for(var n=e.child;n!==null;)a|=n.lanes|n.childLanes,s|=n.subtreeFlags&14680064,s|=n.flags&14680064,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)a|=n.lanes|n.childLanes,s|=n.subtreeFlags,s|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=s,e.childLanes=a,r}function vf(e,r,a){var s=r.pendingProps;switch(ad(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $e(r),null;case 1:return tt(r.type)&&Zn(),$e(r),null;case 3:return s=r.stateNode,Ra(),fe(et),fe(We),md(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(ln(r)?r.flags|=4:e===null||e.memoizedState.isDehydrated&&!(r.flags&256)||(r.flags|=1024,Dt!==null&&(ko(Dt),Dt=null))),go(e,r),$e(r),null;case 5:ud(r);var n=Ir(Rs.current);if(a=r.type,e!==null&&r.stateNode!=null)_0(e,r,a,s,n),e.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!s){if(r.stateNode===null)throw Error(W(166));return $e(r),null}if(e=Ir(Wt.current),ln(r)){s=r.stateNode,a=r.type;var l=r.memoizedProps;switch(s[Vt]=r,s[Cs]=l,e=(r.mode&1)!==0,a){case"dialog":he("cancel",s),he("close",s);break;case"iframe":case"object":case"embed":he("load",s);break;case"video":case"audio":for(n=0;n<is.length;n++)he(is[n],s);break;case"source":he("error",s);break;case"img":case"image":case"link":he("error",s),he("load",s);break;case"details":he("toggle",s);break;case"input":Zd(s,l),he("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!l.multiple},he("invalid",s);break;case"textarea":tc(s,l),he("invalid",s)}Bi(a,l),n=null;for(var i in l)if(l.hasOwnProperty(i)){var u=l[i];i==="children"?typeof u=="string"?s.textContent!==u&&(l.suppressHydrationWarning!==!0&&nn(s.textContent,u,e),n=["children",u]):typeof u=="number"&&s.textContent!==""+u&&(l.suppressHydrationWarning!==!0&&nn(s.textContent,u,e),n=["children",""+u]):fs.hasOwnProperty(i)&&u!=null&&i==="onScroll"&&he("scroll",s)}switch(a){case"input":Ks(s),ec(s,l,!0);break;case"textarea":Ks(s),rc(s);break;case"select":case"option":break;default:typeof l.onClick=="function"&&(s.onclick=Gn)}s=n,r.updateQueue=s,s!==null&&(r.flags|=4)}else{i=n.nodeType===9?n:n.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=em(a)),e==="http://www.w3.org/1999/xhtml"?a==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=i.createElement(a,{is:s.is}):(e=i.createElement(a),a==="select"&&(i=e,s.multiple?i.multiple=!0:s.size&&(i.size=s.size))):e=i.createElementNS(e,a),e[Vt]=r,e[Cs]=s,N0(e,r,!1,!1),r.stateNode=e;e:{switch(i=$i(a,s),a){case"dialog":he("cancel",e),he("close",e),n=s;break;case"iframe":case"object":case"embed":he("load",e),n=s;break;case"video":case"audio":for(n=0;n<is.length;n++)he(is[n],e);n=s;break;case"source":he("error",e),n=s;break;case"img":case"image":case"link":he("error",e),he("load",e),n=s;break;case"details":he("toggle",e),n=s;break;case"input":Zd(e,s),n=Fi(e,s),he("invalid",e);break;case"option":n=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},n=Ne({},s,{value:void 0}),he("invalid",e);break;case"textarea":tc(e,s),n=Oi(e,s),he("invalid",e);break;default:n=s}Bi(a,n),u=n;for(l in u)if(u.hasOwnProperty(l)){var o=u[l];l==="style"?am(e,o):l==="dangerouslySetInnerHTML"?(o=o?o.__html:void 0,o!=null&&tm(e,o)):l==="children"?typeof o=="string"?(a!=="textarea"||o!=="")&&ys(e,o):typeof o=="number"&&ys(e,""+o):l!=="suppressContentEditableWarning"&&l!=="suppressHydrationWarning"&&l!=="autoFocus"&&(fs.hasOwnProperty(l)?o!=null&&l==="onScroll"&&he("scroll",e):o!=null&&Uo(e,l,o,i))}switch(a){case"input":Ks(e),ec(e,s,!1);break;case"textarea":Ks(e),rc(e);break;case"option":s.value!=null&&e.setAttribute("value",""+Sr(s.value));break;case"select":e.multiple=!!s.multiple,l=s.value,l!=null?ba(e,!!s.multiple,l,!1):s.defaultValue!=null&&ba(e,!!s.multiple,s.defaultValue,!0);break;default:typeof n.onClick=="function"&&(e.onclick=Gn)}switch(a){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(r.flags|=4)}r.ref!==null&&(r.flags|=512,r.flags|=2097152)}return $e(r),null;case 6:if(e&&r.stateNode!=null)S0(e,r,e.memoizedProps,s);else{if(typeof s!="string"&&r.stateNode===null)throw Error(W(166));if(a=Ir(Rs.current),Ir(Wt.current),ln(r)){if(s=r.stateNode,a=r.memoizedProps,s[Vt]=r,(l=s.nodeValue!==a)&&(e=ot,e!==null))switch(e.tag){case 3:nn(s.nodeValue,a,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&nn(s.nodeValue,a,(e.mode&1)!==0)}l&&(r.flags|=4)}else s=(a.nodeType===9?a:a.ownerDocument).createTextNode(s),s[Vt]=r,r.stateNode=s}return $e(r),null;case 13:if(fe(je),s=r.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(be&&it!==null&&r.mode&1&&!(r.flags&128))Hm(),Ca(),r.flags|=98560,l=!1;else if(l=ln(r),s!==null&&s.dehydrated!==null){if(e===null){if(!l)throw Error(W(318));if(l=r.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(W(317));l[Vt]=r}else Ca(),!(r.flags&128)&&(r.memoizedState=null),r.flags|=4;$e(r),l=!1}else Dt!==null&&(ko(Dt),Dt=null),l=!0;if(!l)return r.flags&65536?r:null}return r.flags&128?(r.lanes=a,r):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(r.child.flags|=8192,r.mode&1&&(e===null||je.current&1?Ae===0&&(Ae=3):Nd())),r.updateQueue!==null&&(r.flags|=4),$e(r),null);case 4:return Ra(),go(e,r),e===null&&_s(r.stateNode.containerInfo),$e(r),null;case 10:return id(r.type._context),$e(r),null;case 17:return tt(r.type)&&Zn(),$e(r),null;case 19:if(fe(je),l=r.memoizedState,l===null)return $e(r),null;if(s=(r.flags&128)!==0,i=l.rendering,i===null)if(s)Xa(l,!1);else{if(Ae!==0||e!==null&&e.flags&128)for(e=r.child;e!==null;){if(i=ll(e),i!==null){for(r.flags|=128,Xa(l,!1),s=i.updateQueue,s!==null&&(r.updateQueue=s,r.flags|=4),r.subtreeFlags=0,s=a,a=r.child;a!==null;)l=a,e=s,l.flags&=14680066,i=l.alternate,i===null?(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=i.childLanes,l.lanes=i.lanes,l.child=i.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=i.memoizedProps,l.memoizedState=i.memoizedState,l.updateQueue=i.updateQueue,l.type=i.type,e=i.dependencies,l.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),a=a.sibling;return me(je,je.current&1|2),r.child}e=e.sibling}l.tail!==null&&Ee()>Da&&(r.flags|=128,s=!0,Xa(l,!1),r.lanes=4194304)}else{if(!s)if(e=ll(i),e!==null){if(r.flags|=128,s=!0,a=e.updateQueue,a!==null&&(r.updateQueue=a,r.flags|=4),Xa(l,!0),l.tail===null&&l.tailMode==="hidden"&&!i.alternate&&!be)return $e(r),null}else 2*Ee()-l.renderingStartTime>Da&&a!==1073741824&&(r.flags|=128,s=!0,Xa(l,!1),r.lanes=4194304);l.isBackwards?(i.sibling=r.child,r.child=i):(a=l.last,a!==null?a.sibling=i:r.child=i,l.last=i)}return l.tail!==null?(r=l.tail,l.rendering=r,l.tail=r.sibling,l.renderingStartTime=Ee(),r.sibling=null,a=je.current,me(je,s?a&1|2:a&1),r):($e(r),null);case 22:case 23:return wd(),s=r.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(r.flags|=8192),s&&r.mode&1?lt&1073741824&&($e(r),r.subtreeFlags&6&&(r.flags|=8192)):$e(r),null;case 24:return null;case 25:return null}throw Error(W(156,r.tag))}function kf(e,r){switch(ad(r),r.tag){case 1:return tt(r.type)&&Zn(),e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 3:return Ra(),fe(et),fe(We),md(),e=r.flags,e&65536&&!(e&128)?(r.flags=e&-65537|128,r):null;case 5:return ud(r),null;case 13:if(fe(je),e=r.memoizedState,e!==null&&e.dehydrated!==null){if(r.alternate===null)throw Error(W(340));Ca()}return e=r.flags,e&65536?(r.flags=e&-65537|128,r):null;case 19:return fe(je),null;case 4:return Ra(),null;case 10:return id(r.type._context),null;case 22:case 23:return wd(),null;case 24:return null;default:return null}}var cn=!1,ze=!1,jf=typeof WeakSet=="function"?WeakSet:Set,K=null;function ha(e,r){var a=e.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(s){Se(e,r,s)}else a.current=null}function xo(e,r,a){try{a()}catch(s){Se(e,r,s)}}var qc=!1;function wf(e,r){if(Xi=Yn,e=Dm(),td(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var n=s.anchorOffset,l=s.focusNode;s=s.focusOffset;try{a.nodeType,l.nodeType}catch{a=null;break e}var i=0,u=-1,o=-1,c=0,d=0,m=e,p=null;t:for(;;){for(var j;m!==a||n!==0&&m.nodeType!==3||(u=i+n),m!==l||s!==0&&m.nodeType!==3||(o=i+s),m.nodeType===3&&(i+=m.nodeValue.length),(j=m.firstChild)!==null;)p=m,m=j;for(;;){if(m===e)break t;if(p===a&&++c===n&&(u=i),p===l&&++d===s&&(o=i),(j=m.nextSibling)!==null)break;m=p,p=m.parentNode}m=j}a=u===-1||o===-1?null:{start:u,end:o}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ki={focusedElem:e,selectionRange:a},Yn=!1,K=r;K!==null;)if(r=K,e=r.child,(r.subtreeFlags&1028)!==0&&e!==null)e.return=r,K=e;else for(;K!==null;){r=K;try{var v=r.alternate;if(r.flags&1024)switch(r.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var y=v.memoizedProps,f=v.memoizedState,k=r.stateNode,x=k.getSnapshotBeforeUpdate(r.elementType===r.type?y:Rt(r.type,y),f);k.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var g=r.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(h){Se(r,r.return,h)}if(e=r.sibling,e!==null){e.return=r.return,K=e;break}K=r.return}return v=qc,qc=!1,v}function xs(e,r,a){var s=r.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var n=s=s.next;do{if((n.tag&e)===e){var l=n.destroy;n.destroy=void 0,l!==void 0&&xo(r,a,l)}n=n.next}while(n!==s)}}function El(e,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var s=a.create;a.destroy=s()}a=a.next}while(a!==r)}}function ho(e){var r=e.ref;if(r!==null){var a=e.stateNode;switch(e.tag){case 5:e=a;break;default:e=a}typeof r=="function"?r(e):r.current=e}}function C0(e){var r=e.alternate;r!==null&&(e.alternate=null,C0(r)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(r=e.stateNode,r!==null&&(delete r[Vt],delete r[Cs],delete r[eo],delete r[sf],delete r[nf])),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 E0(e){return e.tag===5||e.tag===3||e.tag===4}function Wc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||E0(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function po(e,r,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,r?a.nodeType===8?a.parentNode.insertBefore(e,r):a.insertBefore(e,r):(a.nodeType===8?(r=a.parentNode,r.insertBefore(e,a)):(r=a,r.appendChild(e)),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=Gn));else if(s!==4&&(e=e.child,e!==null))for(po(e,r,a),e=e.sibling;e!==null;)po(e,r,a),e=e.sibling}function fo(e,r,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,r?a.insertBefore(e,r):a.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(fo(e,r,a),e=e.sibling;e!==null;)fo(e,r,a),e=e.sibling}var Le=null,Pt=!1;function cr(e,r,a){for(a=a.child;a!==null;)R0(e,r,a),a=a.sibling}function R0(e,r,a){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(vl,a)}catch{}switch(a.tag){case 5:ze||ha(a,r);case 6:var s=Le,n=Pt;Le=null,cr(e,r,a),Le=s,Pt=n,Le!==null&&(Pt?(e=Le,a=a.stateNode,e.nodeType===8?e.parentNode.removeChild(a):e.removeChild(a)):Le.removeChild(a.stateNode));break;case 18:Le!==null&&(Pt?(e=Le,a=a.stateNode,e.nodeType===8?mi(e.parentNode,a):e.nodeType===1&&mi(e,a),js(e)):mi(Le,a.stateNode));break;case 4:s=Le,n=Pt,Le=a.stateNode.containerInfo,Pt=!0,cr(e,r,a),Le=s,Pt=n;break;case 0:case 11:case 14:case 15:if(!ze&&(s=a.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){n=s=s.next;do{var l=n,i=l.destroy;l=l.tag,i!==void 0&&(l&2||l&4)&&xo(a,r,i),n=n.next}while(n!==s)}cr(e,r,a);break;case 1:if(!ze&&(ha(a,r),s=a.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=a.memoizedProps,s.state=a.memoizedState,s.componentWillUnmount()}catch(u){Se(a,r,u)}cr(e,r,a);break;case 21:cr(e,r,a);break;case 22:a.mode&1?(ze=(s=ze)||a.memoizedState!==null,cr(e,r,a),ze=s):cr(e,r,a);break;default:cr(e,r,a)}}function Qc(e){var r=e.updateQueue;if(r!==null){e.updateQueue=null;var a=e.stateNode;a===null&&(a=e.stateNode=new jf),r.forEach(function(s){var n=Mf.bind(null,e,s);a.has(s)||(a.add(s),s.then(n,n))})}}function Et(e,r){var a=r.deletions;if(a!==null)for(var s=0;s<a.length;s++){var n=a[s];try{var l=e,i=r,u=i;e:for(;u!==null;){switch(u.tag){case 5:Le=u.stateNode,Pt=!1;break e;case 3:Le=u.stateNode.containerInfo,Pt=!0;break e;case 4:Le=u.stateNode.containerInfo,Pt=!0;break e}u=u.return}if(Le===null)throw Error(W(160));R0(l,i,n),Le=null,Pt=!1;var o=n.alternate;o!==null&&(o.return=null),n.return=null}catch(c){Se(n,r,c)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)P0(r,e),r=r.sibling}function P0(e,r){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Et(r,e),$t(e),s&4){try{xs(3,e,e.return),El(3,e)}catch(y){Se(e,e.return,y)}try{xs(5,e,e.return)}catch(y){Se(e,e.return,y)}}break;case 1:Et(r,e),$t(e),s&512&&a!==null&&ha(a,a.return);break;case 5:if(Et(r,e),$t(e),s&512&&a!==null&&ha(a,a.return),e.flags&32){var n=e.stateNode;try{ys(n,"")}catch(y){Se(e,e.return,y)}}if(s&4&&(n=e.stateNode,n!=null)){var l=e.memoizedProps,i=a!==null?a.memoizedProps:l,u=e.type,o=e.updateQueue;if(e.updateQueue=null,o!==null)try{u==="input"&&l.type==="radio"&&l.name!=null&&Gu(n,l),$i(u,i);var c=$i(u,l);for(i=0;i<o.length;i+=2){var d=o[i],m=o[i+1];d==="style"?am(n,m):d==="dangerouslySetInnerHTML"?tm(n,m):d==="children"?ys(n,m):Uo(n,d,m,c)}switch(u){case"input":Ti(n,l);break;case"textarea":Zu(n,l);break;case"select":var p=n._wrapperState.wasMultiple;n._wrapperState.wasMultiple=!!l.multiple;var j=l.value;j!=null?ba(n,!!l.multiple,j,!1):p!==!!l.multiple&&(l.defaultValue!=null?ba(n,!!l.multiple,l.defaultValue,!0):ba(n,!!l.multiple,l.multiple?[]:"",!1))}n[Cs]=l}catch(y){Se(e,e.return,y)}}break;case 6:if(Et(r,e),$t(e),s&4){if(e.stateNode===null)throw Error(W(162));n=e.stateNode,l=e.memoizedProps;try{n.nodeValue=l}catch(y){Se(e,e.return,y)}}break;case 3:if(Et(r,e),$t(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{js(r.containerInfo)}catch(y){Se(e,e.return,y)}break;case 4:Et(r,e),$t(e);break;case 13:Et(r,e),$t(e),n=e.child,n.flags&8192&&(l=n.memoizedState!==null,n.stateNode.isHidden=l,!l||n.alternate!==null&&n.alternate.memoizedState!==null||(kd=Ee())),s&4&&Qc(e);break;case 22:if(d=a!==null&&a.memoizedState!==null,e.mode&1?(ze=(c=ze)||d,Et(r,e),ze=c):Et(r,e),$t(e),s&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!d&&e.mode&1)for(K=e,d=e.child;d!==null;){for(m=K=d;K!==null;){switch(p=K,j=p.child,p.tag){case 0:case 11:case 14:case 15:xs(4,p,p.return);break;case 1:ha(p,p.return);var v=p.stateNode;if(typeof v.componentWillUnmount=="function"){s=p,a=p.return;try{r=s,v.props=r.memoizedProps,v.state=r.memoizedState,v.componentWillUnmount()}catch(y){Se(s,a,y)}}break;case 5:ha(p,p.return);break;case 22:if(p.memoizedState!==null){Yc(m);continue}}j!==null?(j.return=p,K=j):Yc(m)}d=d.sibling}e:for(d=null,m=e;;){if(m.tag===5){if(d===null){d=m;try{n=m.stateNode,c?(l=n.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none"):(u=m.stateNode,o=m.memoizedProps.style,i=o!=null&&o.hasOwnProperty("display")?o.display:null,u.style.display=rm("display",i))}catch(y){Se(e,e.return,y)}}}else if(m.tag===6){if(d===null)try{m.stateNode.nodeValue=c?"":m.memoizedProps}catch(y){Se(e,e.return,y)}}else if((m.tag!==22&&m.tag!==23||m.memoizedState===null||m===e)&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===e)break e;for(;m.sibling===null;){if(m.return===null||m.return===e)break e;d===m&&(d=null),m=m.return}d===m&&(d=null),m.sibling.return=m.return,m=m.sibling}}break;case 19:Et(r,e),$t(e),s&4&&Qc(e);break;case 21:break;default:Et(r,e),$t(e)}}function $t(e){var r=e.flags;if(r&2){try{e:{for(var a=e.return;a!==null;){if(E0(a)){var s=a;break e}a=a.return}throw Error(W(160))}switch(s.tag){case 5:var n=s.stateNode;s.flags&32&&(ys(n,""),s.flags&=-33);var l=Wc(e);fo(e,l,n);break;case 3:case 4:var i=s.stateNode.containerInfo,u=Wc(e);po(e,u,i);break;default:throw Error(W(161))}}catch(o){Se(e,e.return,o)}e.flags&=-3}r&4096&&(e.flags&=-4097)}function Nf(e,r,a){K=e,D0(e)}function D0(e,r,a){for(var s=(e.mode&1)!==0;K!==null;){var n=K,l=n.child;if(n.tag===22&&s){var i=n.memoizedState!==null||cn;if(!i){var u=n.alternate,o=u!==null&&u.memoizedState!==null||ze;u=cn;var c=ze;if(cn=i,(ze=o)&&!c)for(K=n;K!==null;)i=K,o=i.child,i.tag===22&&i.memoizedState!==null?Xc(n):o!==null?(o.return=i,K=o):Xc(n);for(;l!==null;)K=l,D0(l),l=l.sibling;K=n,cn=u,ze=c}Jc(e)}else n.subtreeFlags&8772&&l!==null?(l.return=n,K=l):Jc(e)}}function Jc(e){for(;K!==null;){var r=K;if(r.flags&8772){var a=r.alternate;try{if(r.flags&8772)switch(r.tag){case 0:case 11:case 15:ze||El(5,r);break;case 1:var s=r.stateNode;if(r.flags&4&&!ze)if(a===null)s.componentDidMount();else{var n=r.elementType===r.type?a.memoizedProps:Rt(r.type,a.memoizedProps);s.componentDidUpdate(n,a.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var l=r.updateQueue;l!==null&&Mc(r,l,s);break;case 3:var i=r.updateQueue;if(i!==null){if(a=null,r.child!==null)switch(r.child.tag){case 5:a=r.child.stateNode;break;case 1:a=r.child.stateNode}Mc(r,i,a)}break;case 5:var u=r.stateNode;if(a===null&&r.flags&4){a=u;var o=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":o.autoFocus&&a.focus();break;case"img":o.src&&(a.src=o.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var c=r.alternate;if(c!==null){var d=c.memoizedState;if(d!==null){var m=d.dehydrated;m!==null&&js(m)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}ze||r.flags&512&&ho(r)}catch(p){Se(r,r.return,p)}}if(r===e){K=null;break}if(a=r.sibling,a!==null){a.return=r.return,K=a;break}K=r.return}}function Yc(e){for(;K!==null;){var r=K;if(r===e){K=null;break}var a=r.sibling;if(a!==null){a.return=r.return,K=a;break}K=r.return}}function Xc(e){for(;K!==null;){var r=K;try{switch(r.tag){case 0:case 11:case 15:var a=r.return;try{El(4,r)}catch(o){Se(r,a,o)}break;case 1:var s=r.stateNode;if(typeof s.componentDidMount=="function"){var n=r.return;try{s.componentDidMount()}catch(o){Se(r,n,o)}}var l=r.return;try{ho(r)}catch(o){Se(r,l,o)}break;case 5:var i=r.return;try{ho(r)}catch(o){Se(r,i,o)}}}catch(o){Se(r,r.return,o)}if(r===e){K=null;break}var u=r.sibling;if(u!==null){u.return=r.return,K=u;break}K=r.return}}var _f=Math.ceil,dl=or.ReactCurrentDispatcher,bd=or.ReactCurrentOwner,yt=or.ReactCurrentBatchConfig,oe=0,Te=null,Pe=null,Oe=0,lt=0,pa=Pr(0),Ae=0,As=null,Qr=0,Rl=0,vd=0,hs=null,Ge=null,kd=0,Da=1/0,Xt=null,cl=!1,yo=null,wr=null,un=!1,fr=null,ul=0,ps=0,bo=null,An=-1,Fn=0;function Je(){return oe&6?Ee():An!==-1?An:An=Ee()}function Nr(e){return e.mode&1?oe&2&&Oe!==0?Oe&-Oe:of.transition!==null?(Fn===0&&(Fn=hm()),Fn):(e=ue,e!==0||(e=window.event,e=e===void 0?16:jm(e.type)),e):1}function At(e,r,a,s){if(50<ps)throw ps=0,bo=null,Error(W(185));Os(e,a,s),(!(oe&2)||e!==Te)&&(e===Te&&(!(oe&2)&&(Rl|=a),Ae===4&&xr(e,Oe)),rt(e,s),a===1&&oe===0&&!(r.mode&1)&&(Da=Ee()+500,_l&&Dr()))}function rt(e,r){var a=e.callbackNode;ip(e,r);var s=Jn(e,e===Te?Oe:0);if(s===0)a!==null&&nc(a),e.callbackNode=null,e.callbackPriority=0;else if(r=s&-s,e.callbackPriority!==r){if(a!=null&&nc(a),r===1)e.tag===0?lf(Kc.bind(null,e)):zm(Kc.bind(null,e)),rf(function(){!(oe&6)&&Dr()}),a=null;else{switch(pm(s)){case 1:a=Qo;break;case 4:a=gm;break;case 16:a=Qn;break;case 536870912:a=xm;break;default:a=Qn}a=B0(a,M0.bind(null,e))}e.callbackPriority=r,e.callbackNode=a}}function M0(e,r){if(An=-1,Fn=0,oe&6)throw Error(W(327));var a=e.callbackNode;if(Na()&&e.callbackNode!==a)return null;var s=Jn(e,e===Te?Oe:0);if(s===0)return null;if(s&30||s&e.expiredLanes||r)r=ml(e,s);else{r=s;var n=oe;oe|=2;var l=F0();(Te!==e||Oe!==r)&&(Xt=null,Da=Ee()+500,$r(e,r));do try{Ef();break}catch(u){A0(e,u)}while(!0);ld(),dl.current=l,oe=n,Pe!==null?r=0:(Te=null,Oe=0,r=Ae)}if(r!==0){if(r===2&&(n=qi(e),n!==0&&(s=n,r=vo(e,n))),r===1)throw a=As,$r(e,0),xr(e,s),rt(e,Ee()),a;if(r===6)xr(e,s);else{if(n=e.current.alternate,!(s&30)&&!Sf(n)&&(r=ml(e,s),r===2&&(l=qi(e),l!==0&&(s=l,r=vo(e,l))),r===1))throw a=As,$r(e,0),xr(e,s),rt(e,Ee()),a;switch(e.finishedWork=n,e.finishedLanes=s,r){case 0:case 1:throw Error(W(345));case 2:Tr(e,Ge,Xt);break;case 3:if(xr(e,s),(s&130023424)===s&&(r=kd+500-Ee(),10<r)){if(Jn(e,0)!==0)break;if(n=e.suspendedLanes,(n&s)!==s){Je(),e.pingedLanes|=e.suspendedLanes&n;break}e.timeoutHandle=Zi(Tr.bind(null,e,Ge,Xt),r);break}Tr(e,Ge,Xt);break;case 4:if(xr(e,s),(s&4194240)===s)break;for(r=e.eventTimes,n=-1;0<s;){var i=31-Mt(s);l=1<<i,i=r[i],i>n&&(n=i),s&=~l}if(s=n,s=Ee()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*_f(s/1960))-s,10<s){e.timeoutHandle=Zi(Tr.bind(null,e,Ge,Xt),s);break}Tr(e,Ge,Xt);break;case 5:Tr(e,Ge,Xt);break;default:throw Error(W(329))}}}return rt(e,Ee()),e.callbackNode===a?M0.bind(null,e):null}function vo(e,r){var a=hs;return e.current.memoizedState.isDehydrated&&($r(e,r).flags|=256),e=ml(e,r),e!==2&&(r=Ge,Ge=a,r!==null&&ko(r)),e}function ko(e){Ge===null?Ge=e:Ge.push.apply(Ge,e)}function Sf(e){for(var r=e;;){if(r.flags&16384){var a=r.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var s=0;s<a.length;s++){var n=a[s],l=n.getSnapshot;n=n.value;try{if(!Ft(l(),n))return!1}catch{return!1}}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function xr(e,r){for(r&=~vd,r&=~Rl,e.suspendedLanes|=r,e.pingedLanes&=~r,e=e.expirationTimes;0<r;){var a=31-Mt(r),s=1<<a;e[a]=-1,r&=~s}}function Kc(e){if(oe&6)throw Error(W(327));Na();var r=Jn(e,0);if(!(r&1))return rt(e,Ee()),null;var a=ml(e,r);if(e.tag!==0&&a===2){var s=qi(e);s!==0&&(r=s,a=vo(e,s))}if(a===1)throw a=As,$r(e,0),xr(e,r),rt(e,Ee()),a;if(a===6)throw Error(W(345));return e.finishedWork=e.current.alternate,e.finishedLanes=r,Tr(e,Ge,Xt),rt(e,Ee()),null}function jd(e,r){var a=oe;oe|=1;try{return e(r)}finally{oe=a,oe===0&&(Da=Ee()+500,_l&&Dr())}}function Jr(e){fr!==null&&fr.tag===0&&!(oe&6)&&Na();var r=oe;oe|=1;var a=yt.transition,s=ue;try{if(yt.transition=null,ue=1,e)return e()}finally{ue=s,yt.transition=a,oe=r,!(oe&6)&&Dr()}}function wd(){lt=pa.current,fe(pa)}function $r(e,r){e.finishedWork=null,e.finishedLanes=0;var a=e.timeoutHandle;if(a!==-1&&(e.timeoutHandle=-1,tf(a)),Pe!==null)for(a=Pe.return;a!==null;){var s=a;switch(ad(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&Zn();break;case 3:Ra(),fe(et),fe(We),md();break;case 5:ud(s);break;case 4:Ra();break;case 13:fe(je);break;case 19:fe(je);break;case 10:id(s.type._context);break;case 22:case 23:wd()}a=a.return}if(Te=e,Pe=e=_r(e.current,null),Oe=lt=r,Ae=0,As=null,vd=Rl=Qr=0,Ge=hs=null,Or!==null){for(r=0;r<Or.length;r++)if(a=Or[r],s=a.interleaved,s!==null){a.interleaved=null;var n=s.next,l=a.pending;if(l!==null){var i=l.next;l.next=n,s.next=i}a.pending=s}Or=null}return e}function A0(e,r){do{var a=Pe;try{if(ld(),Pn.current=ol,il){for(var s=we.memoizedState;s!==null;){var n=s.queue;n!==null&&(n.pending=null),s=s.next}il=!1}if(Wr=0,Fe=Me=we=null,gs=!1,Ps=0,bd.current=null,a===null||a.return===null){Ae=1,As=r,Pe=null;break}e:{var l=e,i=a.return,u=a,o=r;if(r=Oe,u.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){var c=o,d=u,m=d.tag;if(!(d.mode&1)&&(m===0||m===11||m===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var j=Ic(i);if(j!==null){j.flags&=-257,Bc(j,i,u,l,r),j.mode&1&&Oc(l,c,r),r=j,o=c;var v=r.updateQueue;if(v===null){var y=new Set;y.add(o),r.updateQueue=y}else v.add(o);break e}else{if(!(r&1)){Oc(l,c,r),Nd();break e}o=Error(W(426))}}else if(be&&u.mode&1){var f=Ic(i);if(f!==null){!(f.flags&65536)&&(f.flags|=256),Bc(f,i,u,l,r),sd(Pa(o,u));break e}}l=o=Pa(o,u),Ae!==4&&(Ae=2),hs===null?hs=[l]:hs.push(l),l=i;do{switch(l.tag){case 3:l.flags|=65536,r&=-r,l.lanes|=r;var k=p0(l,o,r);Dc(l,k);break e;case 1:u=o;var x=l.type,g=l.stateNode;if(!(l.flags&128)&&(typeof x.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(wr===null||!wr.has(g)))){l.flags|=65536,r&=-r,l.lanes|=r;var h=f0(l,u,r);Dc(l,h);break e}}l=l.return}while(l!==null)}L0(a)}catch(w){r=w,Pe===a&&a!==null&&(Pe=a=a.return);continue}break}while(!0)}function F0(){var e=dl.current;return dl.current=ol,e===null?ol:e}function Nd(){(Ae===0||Ae===3||Ae===2)&&(Ae=4),Te===null||!(Qr&268435455)&&!(Rl&268435455)||xr(Te,Oe)}function ml(e,r){var a=oe;oe|=2;var s=F0();(Te!==e||Oe!==r)&&(Xt=null,$r(e,r));do try{Cf();break}catch(n){A0(e,n)}while(!0);if(ld(),oe=a,dl.current=s,Pe!==null)throw Error(W(261));return Te=null,Oe=0,Ae}function Cf(){for(;Pe!==null;)T0(Pe)}function Ef(){for(;Pe!==null&&!Gh();)T0(Pe)}function T0(e){var r=I0(e.alternate,e,lt);e.memoizedProps=e.pendingProps,r===null?L0(e):Pe=r,bd.current=null}function L0(e){var r=e;do{var a=r.alternate;if(e=r.return,r.flags&32768){if(a=kf(a,r),a!==null){a.flags&=32767,Pe=a;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ae=6,Pe=null;return}}else if(a=vf(a,r,lt),a!==null){Pe=a;return}if(r=r.sibling,r!==null){Pe=r;return}Pe=r=e}while(r!==null);Ae===0&&(Ae=5)}function Tr(e,r,a){var s=ue,n=yt.transition;try{yt.transition=null,ue=1,Rf(e,r,a,s)}finally{yt.transition=n,ue=s}return null}function Rf(e,r,a,s){do Na();while(fr!==null);if(oe&6)throw Error(W(327));a=e.finishedWork;var n=e.finishedLanes;if(a===null)return null;if(e.finishedWork=null,e.finishedLanes=0,a===e.current)throw Error(W(177));e.callbackNode=null,e.callbackPriority=0;var l=a.lanes|a.childLanes;if(op(e,l),e===Te&&(Pe=Te=null,Oe=0),!(a.subtreeFlags&2064)&&!(a.flags&2064)||un||(un=!0,B0(Qn,function(){return Na(),null})),l=(a.flags&15990)!==0,a.subtreeFlags&15990||l){l=yt.transition,yt.transition=null;var i=ue;ue=1;var u=oe;oe|=4,bd.current=null,wf(e,a),P0(a,e),Jp(Ki),Yn=!!Xi,Ki=Xi=null,e.current=a,Nf(a),Zh(),oe=u,ue=i,yt.transition=l}else e.current=a;if(un&&(un=!1,fr=e,ul=n),l=e.pendingLanes,l===0&&(wr=null),rp(a.stateNode),rt(e,Ee()),r!==null)for(s=e.onRecoverableError,a=0;a<r.length;a++)n=r[a],s(n.value,{componentStack:n.stack,digest:n.digest});if(cl)throw cl=!1,e=yo,yo=null,e;return ul&1&&e.tag!==0&&Na(),l=e.pendingLanes,l&1?e===bo?ps++:(ps=0,bo=e):ps=0,Dr(),null}function Na(){if(fr!==null){var e=pm(ul),r=yt.transition,a=ue;try{if(yt.transition=null,ue=16>e?16:e,fr===null)var s=!1;else{if(e=fr,fr=null,ul=0,oe&6)throw Error(W(331));var n=oe;for(oe|=4,K=e.current;K!==null;){var l=K,i=l.child;if(K.flags&16){var u=l.deletions;if(u!==null){for(var o=0;o<u.length;o++){var c=u[o];for(K=c;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:xs(8,d,l)}var m=d.child;if(m!==null)m.return=d,K=m;else for(;K!==null;){d=K;var p=d.sibling,j=d.return;if(C0(d),d===c){K=null;break}if(p!==null){p.return=j,K=p;break}K=j}}}var v=l.alternate;if(v!==null){var y=v.child;if(y!==null){v.child=null;do{var f=y.sibling;y.sibling=null,y=f}while(y!==null)}}K=l}}if(l.subtreeFlags&2064&&i!==null)i.return=l,K=i;else e:for(;K!==null;){if(l=K,l.flags&2048)switch(l.tag){case 0:case 11:case 15:xs(9,l,l.return)}var k=l.sibling;if(k!==null){k.return=l.return,K=k;break e}K=l.return}}var x=e.current;for(K=x;K!==null;){i=K;var g=i.child;if(i.subtreeFlags&2064&&g!==null)g.return=i,K=g;else e:for(i=x;K!==null;){if(u=K,u.flags&2048)try{switch(u.tag){case 0:case 11:case 15:El(9,u)}}catch(w){Se(u,u.return,w)}if(u===i){K=null;break e}var h=u.sibling;if(h!==null){h.return=u.return,K=h;break e}K=u.return}}if(oe=n,Dr(),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(vl,e)}catch{}s=!0}return s}finally{ue=a,yt.transition=r}}return!1}function Gc(e,r,a){r=Pa(a,r),r=p0(e,r,1),e=jr(e,r,1),r=Je(),e!==null&&(Os(e,1,r),rt(e,r))}function Se(e,r,a){if(e.tag===3)Gc(e,e,a);else for(;r!==null;){if(r.tag===3){Gc(r,e,a);break}else if(r.tag===1){var s=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(wr===null||!wr.has(s))){e=Pa(a,e),e=f0(r,e,1),r=jr(r,e,1),e=Je(),r!==null&&(Os(r,1,e),rt(r,e));break}}r=r.return}}function Pf(e,r,a){var s=e.pingCache;s!==null&&s.delete(r),r=Je(),e.pingedLanes|=e.suspendedLanes&a,Te===e&&(Oe&a)===a&&(Ae===4||Ae===3&&(Oe&130023424)===Oe&&500>Ee()-kd?$r(e,0):vd|=a),rt(e,r)}function O0(e,r){r===0&&(e.mode&1?(r=en,en<<=1,!(en&130023424)&&(en=4194304)):r=1);var a=Je();e=sr(e,r),e!==null&&(Os(e,r,a),rt(e,a))}function Df(e){var r=e.memoizedState,a=0;r!==null&&(a=r.retryLane),O0(e,a)}function Mf(e,r){var a=0;switch(e.tag){case 13:var s=e.stateNode,n=e.memoizedState;n!==null&&(a=n.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(W(314))}s!==null&&s.delete(r),O0(e,a)}var I0;I0=function(e,r,a){if(e!==null)if(e.memoizedProps!==r.pendingProps||et.current)Ze=!0;else{if(!(e.lanes&a)&&!(r.flags&128))return Ze=!1,bf(e,r,a);Ze=!!(e.flags&131072)}else Ze=!1,be&&r.flags&1048576&&Um(r,rl,r.index);switch(r.lanes=0,r.tag){case 2:var s=r.type;Mn(e,r),e=r.pendingProps;var n=Sa(r,We.current);wa(r,a),n=xd(null,r,s,e,n,a);var l=hd();return r.flags|=1,typeof n=="object"&&n!==null&&typeof n.render=="function"&&n.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,tt(s)?(l=!0,el(r)):l=!1,r.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,dd(r),n.updater=Cl,r.stateNode=n,n._reactInternals=r,lo(r,s,e,a),r=co(null,r,s,!0,l,a)):(r.tag=0,be&&l&&rd(r),Qe(null,r,n,a),r=r.child),r;case 16:s=r.elementType;e:{switch(Mn(e,r),e=r.pendingProps,n=s._init,s=n(s._payload),r.type=s,n=r.tag=Ff(s),e=Rt(s,e),n){case 0:r=oo(null,r,s,e,a);break e;case 1:r=Uc(null,r,s,e,a);break e;case 11:r=$c(null,r,s,e,a);break e;case 14:r=zc(null,r,s,Rt(s.type,e),a);break e}throw Error(W(306,s,""))}return r;case 0:return s=r.type,n=r.pendingProps,n=r.elementType===s?n:Rt(s,n),oo(e,r,s,n,a);case 1:return s=r.type,n=r.pendingProps,n=r.elementType===s?n:Rt(s,n),Uc(e,r,s,n,a);case 3:e:{if(k0(r),e===null)throw Error(W(387));s=r.pendingProps,l=r.memoizedState,n=l.element,Jm(e,r),nl(r,s,null,a);var i=r.memoizedState;if(s=i.element,l.isDehydrated)if(l={element:s,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},r.updateQueue.baseState=l,r.memoizedState=l,r.flags&256){n=Pa(Error(W(423)),r),r=Vc(e,r,s,a,n);break e}else if(s!==n){n=Pa(Error(W(424)),r),r=Vc(e,r,s,a,n);break e}else for(it=kr(r.stateNode.containerInfo.firstChild),ot=r,be=!0,Dt=null,a=Wm(r,null,s,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Ca(),s===n){r=nr(e,r,a);break e}Qe(e,r,s,a)}r=r.child}return r;case 5:return Ym(r),e===null&&ao(r),s=r.type,n=r.pendingProps,l=e!==null?e.memoizedProps:null,i=n.children,Gi(s,n)?i=null:l!==null&&Gi(s,l)&&(r.flags|=32),v0(e,r),Qe(e,r,i,a),r.child;case 6:return e===null&&ao(r),null;case 13:return j0(e,r,a);case 4:return cd(r,r.stateNode.containerInfo),s=r.pendingProps,e===null?r.child=Ea(r,null,s,a):Qe(e,r,s,a),r.child;case 11:return s=r.type,n=r.pendingProps,n=r.elementType===s?n:Rt(s,n),$c(e,r,s,n,a);case 7:return Qe(e,r,r.pendingProps,a),r.child;case 8:return Qe(e,r,r.pendingProps.children,a),r.child;case 12:return Qe(e,r,r.pendingProps.children,a),r.child;case 10:e:{if(s=r.type._context,n=r.pendingProps,l=r.memoizedProps,i=n.value,me(al,s._currentValue),s._currentValue=i,l!==null)if(Ft(l.value,i)){if(l.children===n.children&&!et.current){r=nr(e,r,a);break e}}else for(l=r.child,l!==null&&(l.return=r);l!==null;){var u=l.dependencies;if(u!==null){i=l.child;for(var o=u.firstContext;o!==null;){if(o.context===s){if(l.tag===1){o=er(-1,a&-a),o.tag=2;var c=l.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?o.next=o:(o.next=d.next,d.next=o),c.pending=o}}l.lanes|=a,o=l.alternate,o!==null&&(o.lanes|=a),so(l.return,a,r),u.lanes|=a;break}o=o.next}}else if(l.tag===10)i=l.type===r.type?null:l.child;else if(l.tag===18){if(i=l.return,i===null)throw Error(W(341));i.lanes|=a,u=i.alternate,u!==null&&(u.lanes|=a),so(i,a,r),i=l.sibling}else i=l.child;if(i!==null)i.return=l;else for(i=l;i!==null;){if(i===r){i=null;break}if(l=i.sibling,l!==null){l.return=i.return,i=l;break}i=i.return}l=i}Qe(e,r,n.children,a),r=r.child}return r;case 9:return n=r.type,s=r.pendingProps.children,wa(r,a),n=kt(n),s=s(n),r.flags|=1,Qe(e,r,s,a),r.child;case 14:return s=r.type,n=Rt(s,r.pendingProps),n=Rt(s.type,n),zc(e,r,s,n,a);case 15:return y0(e,r,r.type,r.pendingProps,a);case 17:return s=r.type,n=r.pendingProps,n=r.elementType===s?n:Rt(s,n),Mn(e,r),r.tag=1,tt(s)?(e=!0,el(r)):e=!1,wa(r,a),h0(r,s,n),lo(r,s,n,a),co(null,r,s,!0,e,a);case 19:return w0(e,r,a);case 22:return b0(e,r,a)}throw Error(W(156,r.tag))};function B0(e,r){return mm(e,r)}function Af(e,r,a,s){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ft(e,r,a,s){return new Af(e,r,a,s)}function _d(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ff(e){if(typeof e=="function")return _d(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ho)return 11;if(e===qo)return 14}return 2}function _r(e,r){var a=e.alternate;return a===null?(a=ft(e.tag,r,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=r,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&14680064,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,r=e.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a}function Tn(e,r,a,s,n,l){var i=2;if(s=e,typeof e=="function")_d(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case la:return zr(a.children,n,l,r);case Vo:i=8,n|=8;break;case Pi:return e=ft(12,a,r,n|2),e.elementType=Pi,e.lanes=l,e;case Di:return e=ft(13,a,r,n),e.elementType=Di,e.lanes=l,e;case Mi:return e=ft(19,a,r,n),e.elementType=Mi,e.lanes=l,e;case Yu:return Pl(a,n,l,r);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Qu:i=10;break e;case Ju:i=9;break e;case Ho:i=11;break e;case qo:i=14;break e;case ur:i=16,s=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return r=ft(i,a,r,n),r.elementType=e,r.type=s,r.lanes=l,r}function zr(e,r,a,s){return e=ft(7,e,s,r),e.lanes=a,e}function Pl(e,r,a,s){return e=ft(22,e,s,r),e.elementType=Yu,e.lanes=a,e.stateNode={isHidden:!1},e}function vi(e,r,a){return e=ft(6,e,null,r),e.lanes=a,e}function ki(e,r,a){return r=ft(4,e.children!==null?e.children:[],e.key,r),r.lanes=a,r.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},r}function Tf(e,r,a,s,n){this.tag=r,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=ti(0),this.expirationTimes=ti(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ti(0),this.identifierPrefix=s,this.onRecoverableError=n,this.mutableSourceEagerHydrationData=null}function Sd(e,r,a,s,n,l,i,u,o){return e=new Tf(e,r,a,u,o),r===1?(r=1,l===!0&&(r|=8)):r=0,l=ft(3,null,null,r),e.current=l,l.stateNode=e,l.memoizedState={element:s,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},dd(l),e}function Lf(e,r,a){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:na,key:s==null?null:""+s,children:e,containerInfo:r,implementation:a}}function $0(e){if(!e)return Cr;e=e._reactInternals;e:{if(Zr(e)!==e||e.tag!==1)throw Error(W(170));var r=e;do{switch(r.tag){case 3:r=r.stateNode.context;break e;case 1:if(tt(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(W(171))}if(e.tag===1){var a=e.type;if(tt(a))return $m(e,a,r)}return r}function z0(e,r,a,s,n,l,i,u,o){return e=Sd(a,s,!0,e,n,l,i,u,o),e.context=$0(null),a=e.current,s=Je(),n=Nr(a),l=er(s,n),l.callback=r??null,jr(a,l,n),e.current.lanes=n,Os(e,n,s),rt(e,s),e}function Dl(e,r,a,s){var n=r.current,l=Je(),i=Nr(n);return a=$0(a),r.context===null?r.context=a:r.pendingContext=a,r=er(l,i),r.payload={element:e},s=s===void 0?null:s,s!==null&&(r.callback=s),e=jr(n,r,i),e!==null&&(At(e,n,i,l),Rn(e,n,i)),i}function gl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Zc(e,r){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<r?a:r}}function Cd(e,r){Zc(e,r),(e=e.alternate)&&Zc(e,r)}function Of(){return null}var U0=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ed(e){this._internalRoot=e}Ml.prototype.render=Ed.prototype.render=function(e){var r=this._internalRoot;if(r===null)throw Error(W(409));Dl(e,r,null,null)};Ml.prototype.unmount=Ed.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var r=e.containerInfo;Jr(function(){Dl(null,e,null,null)}),r[ar]=null}};function Ml(e){this._internalRoot=e}Ml.prototype.unstable_scheduleHydration=function(e){if(e){var r=bm();e={blockedOn:null,target:e,priority:r};for(var a=0;a<gr.length&&r!==0&&r<gr[a].priority;a++);gr.splice(a,0,e),a===0&&km(e)}};function Rd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Al(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function eu(){}function If(e,r,a,s,n){if(n){if(typeof s=="function"){var l=s;s=function(){var c=gl(i);l.call(c)}}var i=z0(r,s,e,0,null,!1,!1,"",eu);return e._reactRootContainer=i,e[ar]=i.current,_s(e.nodeType===8?e.parentNode:e),Jr(),i}for(;n=e.lastChild;)e.removeChild(n);if(typeof s=="function"){var u=s;s=function(){var c=gl(o);u.call(c)}}var o=Sd(e,0,!1,null,null,!1,!1,"",eu);return e._reactRootContainer=o,e[ar]=o.current,_s(e.nodeType===8?e.parentNode:e),Jr(function(){Dl(r,o,a,s)}),o}function Fl(e,r,a,s,n){var l=a._reactRootContainer;if(l){var i=l;if(typeof n=="function"){var u=n;n=function(){var o=gl(i);u.call(o)}}Dl(r,i,e,n)}else i=If(a,r,e,n,s);return gl(i)}fm=function(e){switch(e.tag){case 3:var r=e.stateNode;if(r.current.memoizedState.isDehydrated){var a=ls(r.pendingLanes);a!==0&&(Jo(r,a|1),rt(r,Ee()),!(oe&6)&&(Da=Ee()+500,Dr()))}break;case 13:Jr(function(){var s=sr(e,1);if(s!==null){var n=Je();At(s,e,1,n)}}),Cd(e,1)}};Yo=function(e){if(e.tag===13){var r=sr(e,134217728);if(r!==null){var a=Je();At(r,e,134217728,a)}Cd(e,134217728)}};ym=function(e){if(e.tag===13){var r=Nr(e),a=sr(e,r);if(a!==null){var s=Je();At(a,e,r,s)}Cd(e,r)}};bm=function(){return ue};vm=function(e,r){var a=ue;try{return ue=e,r()}finally{ue=a}};Ui=function(e,r,a){switch(r){case"input":if(Ti(e,a),r=a.name,a.type==="radio"&&r!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<a.length;r++){var s=a[r];if(s!==e&&s.form===e.form){var n=Nl(s);if(!n)throw Error(W(90));Ku(s),Ti(s,n)}}}break;case"textarea":Zu(e,a);break;case"select":r=a.value,r!=null&&ba(e,!!a.multiple,r,!1)}};lm=jd;im=Jr;var Bf={usingClientEntryPoint:!1,Events:[Bs,ca,Nl,sm,nm,jd]},Ka={findFiberByHostInstance:Lr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},$f={bundleType:Ka.bundleType,version:Ka.version,rendererPackageName:Ka.rendererPackageName,rendererConfig:Ka.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:or.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=cm(e),e===null?null:e.stateNode},findFiberByHostInstance:Ka.findFiberByHostInstance||Of,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mn=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mn.isDisabled&&mn.supportsFiber)try{vl=mn.inject($f),qt=mn}catch{}}mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Bf;mt.createPortal=function(e,r){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Rd(r))throw Error(W(200));return Lf(e,r,null,a)};mt.createRoot=function(e,r){if(!Rd(e))throw Error(W(299));var a=!1,s="",n=U0;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(s=r.identifierPrefix),r.onRecoverableError!==void 0&&(n=r.onRecoverableError)),r=Sd(e,1,!1,null,null,a,!1,s,n),e[ar]=r.current,_s(e.nodeType===8?e.parentNode:e),new Ed(r)};mt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var r=e._reactInternals;if(r===void 0)throw typeof e.render=="function"?Error(W(188)):(e=Object.keys(e).join(","),Error(W(268,e)));return e=cm(r),e=e===null?null:e.stateNode,e};mt.flushSync=function(e){return Jr(e)};mt.hydrate=function(e,r,a){if(!Al(r))throw Error(W(200));return Fl(null,e,r,!0,a)};mt.hydrateRoot=function(e,r,a){if(!Rd(e))throw Error(W(405));var s=a!=null&&a.hydratedSources||null,n=!1,l="",i=U0;if(a!=null&&(a.unstable_strictMode===!0&&(n=!0),a.identifierPrefix!==void 0&&(l=a.identifierPrefix),a.onRecoverableError!==void 0&&(i=a.onRecoverableError)),r=z0(r,null,e,1,a??null,n,!1,l,i),e[ar]=r.current,_s(e),s)for(e=0;e<s.length;e++)a=s[e],n=a._getVersion,n=n(a._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[a,n]:r.mutableSourceEagerHydrationData.push(a,n);return new Ml(r)};mt.render=function(e,r,a){if(!Al(r))throw Error(W(200));return Fl(null,e,r,!1,a)};mt.unmountComponentAtNode=function(e){if(!Al(e))throw Error(W(40));return e._reactRootContainer?(Jr(function(){Fl(null,null,e,!1,function(){e._reactRootContainer=null,e[ar]=null})}),!0):!1};mt.unstable_batchedUpdates=jd;mt.unstable_renderSubtreeIntoContainer=function(e,r,a,s){if(!Al(a))throw Error(W(200));if(e==null||e._reactInternals===void 0)throw Error(W(38));return Fl(e,r,a,!1,s)};mt.version="18.3.1-next-f1338f8080-20240426";function V0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(V0)}catch(e){console.error(e)}}V0(),Vu.exports=mt;var zf=Vu.exports,H0,tu=zf;H0=tu.createRoot,tu.hydrateRoot;/**
* react-router v7.9.6
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/var ru="popstate";function Uf(e={}){function r(s,n){let{pathname:l,search:i,hash:u}=s.location;return jo("",{pathname:l,search:i,hash:u},n.state&&n.state.usr||null,n.state&&n.state.key||"default")}function a(s,n){return typeof n=="string"?n:Fs(n)}return Hf(r,a,null,e)}function ve(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function wt(e,r){if(!e){typeof console<"u"&&console.warn(r);try{throw new Error(r)}catch{}}}function Vf(){return Math.random().toString(36).substring(2,10)}function au(e,r){return{usr:e.state,key:e.key,idx:r}}function jo(e,r,a=null,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof r=="string"?Oa(r):r,state:a,key:r&&r.key||s||Vf()}}function Fs({pathname:e="/",search:r="",hash:a=""}){return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function Oa(e){let r={};if(e){let a=e.indexOf("#");a>=0&&(r.hash=e.substring(a),e=e.substring(0,a));let s=e.indexOf("?");s>=0&&(r.search=e.substring(s),e=e.substring(0,s)),e&&(r.pathname=e)}return r}function Hf(e,r,a,s={}){let{window:n=document.defaultView,v5Compat:l=!1}=s,i=n.history,u="POP",o=null,c=d();c==null&&(c=0,i.replaceState({...i.state,idx:c},""));function d(){return(i.state||{idx:null}).idx}function m(){u="POP";let f=d(),k=f==null?null:f-c;c=f,o&&o({action:u,location:y.location,delta:k})}function p(f,k){u="PUSH";let x=jo(y.location,f,k);c=d()+1;let g=au(x,c),h=y.createHref(x);try{i.pushState(g,"",h)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;n.location.assign(h)}l&&o&&o({action:u,location:y.location,delta:1})}function j(f,k){u="REPLACE";let x=jo(y.location,f,k);c=d();let g=au(x,c),h=y.createHref(x);i.replaceState(g,"",h),l&&o&&o({action:u,location:y.location,delta:0})}function v(f){return qf(f)}let y={get action(){return u},get location(){return e(n,i)},listen(f){if(o)throw new Error("A history only accepts one active listener");return n.addEventListener(ru,m),o=f,()=>{n.removeEventListener(ru,m),o=null}},createHref(f){return r(n,f)},createURL:v,encodeLocation(f){let k=v(f);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:p,replace:j,go(f){return i.go(f)}};return y}function qf(e,r=!1){let a="http://localhost";typeof window<"u"&&(a=window.location.origin!=="null"?window.location.origin:window.location.href),ve(a,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Fs(e);return s=s.replace(/ $/,"%20"),!r&&s.startsWith("//")&&(s=a+s),new URL(s,a)}function q0(e,r,a="/"){return Wf(e,r,a,!1)}function Wf(e,r,a,s){let n=typeof r=="string"?Oa(r):r,l=lr(n.pathname||"/",a);if(l==null)return null;let i=W0(e);Qf(i);let u=null;for(let o=0;u==null&&o<i.length;++o){let c=sy(l);u=ry(i[o],c,s)}return u}function W0(e,r=[],a=[],s="",n=!1){let l=(i,u,o=n,c)=>{let d={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:u,route:i};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(s)&&o)return;ve(d.relativePath.startsWith(s),`Absolute route path "${d.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(s.length)}let m=tr([s,d.relativePath]),p=a.concat(d);i.children&&i.children.length>0&&(ve(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),W0(i.children,r,p,m,o)),!(i.path==null&&!i.index)&&r.push({path:m,score:ey(m,i.index),routesMeta:p})};return e.forEach((i,u)=>{var o;if(i.path===""||!((o=i.path)!=null&&o.includes("?")))l(i,u);else for(let c of Q0(i.path))l(i,u,!0,c)}),r}function Q0(e){let r=e.split("/");if(r.length===0)return[];let[a,...s]=r,n=a.endsWith("?"),l=a.replace(/\?$/,"");if(s.length===0)return n?[l,""]:[l];let i=Q0(s.join("/")),u=[];return u.push(...i.map(o=>o===""?l:[l,o].join("/"))),n&&u.push(...i),u.map(o=>e.startsWith("/")&&o===""?"/":o)}function Qf(e){e.sort((r,a)=>r.score!==a.score?a.score-r.score:ty(r.routesMeta.map(s=>s.childrenIndex),a.routesMeta.map(s=>s.childrenIndex)))}var Jf=/^:[\w-]+$/,Yf=3,Xf=2,Kf=1,Gf=10,Zf=-2,su=e=>e==="*";function ey(e,r){let a=e.split("/"),s=a.length;return a.some(su)&&(s+=Zf),r&&(s+=Xf),a.filter(n=>!su(n)).reduce((n,l)=>n+(Jf.test(l)?Yf:l===""?Kf:Gf),s)}function ty(e,r){return e.length===r.length&&e.slice(0,-1).every((s,n)=>s===r[n])?e[e.length-1]-r[r.length-1]:0}function ry(e,r,a=!1){let{routesMeta:s}=e,n={},l="/",i=[];for(let u=0;u<s.length;++u){let o=s[u],c=u===s.length-1,d=l==="/"?r:r.slice(l.length)||"/",m=xl({path:o.relativePath,caseSensitive:o.caseSensitive,end:c},d),p=o.route;if(!m&&c&&a&&!s[s.length-1].route.index&&(m=xl({path:o.relativePath,caseSensitive:o.caseSensitive,end:!1},d)),!m)return null;Object.assign(n,m.params),i.push({params:n,pathname:tr([l,m.pathname]),pathnameBase:dy(tr([l,m.pathnameBase])),route:p}),m.pathnameBase!=="/"&&(l=tr([l,m.pathnameBase]))}return i}function xl(e,r){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,s]=ay(e.path,e.caseSensitive,e.end),n=r.match(a);if(!n)return null;let l=n[0],i=l.replace(/(.)\/+$/,"$1"),u=n.slice(1);return{params:s.reduce((c,{paramName:d,isOptional:m},p)=>{if(d==="*"){let v=u[p]||"";i=l.slice(0,l.length-v.length).replace(/(.)\/+$/,"$1")}const j=u[p];return m&&!j?c[d]=void 0:c[d]=(j||"").replace(/%2F/g,"/"),c},{}),pathname:l,pathnameBase:i,pattern:e}}function ay(e,r=!1,a=!0){wt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,u,o)=>(s.push({paramName:u,isOptional:o!=null}),o?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,r?void 0:"i"),s]}function sy(e){try{return e.split("/").map(r=>decodeURIComponent(r).replace(/\//g,"%2F")).join("/")}catch(r){return wt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${r}).`),e}}function lr(e,r){if(r==="/")return e;if(!e.toLowerCase().startsWith(r.toLowerCase()))return null;let a=r.endsWith("/")?r.length-1:r.length,s=e.charAt(a);return s&&s!=="/"?null:e.slice(a)||"/"}var ny=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ly=e=>ny.test(e);function iy(e,r="/"){let{pathname:a,search:s="",hash:n=""}=typeof e=="string"?Oa(e):e,l;if(a)if(ly(a))l=a;else{if(a.includes("//")){let i=a;a=a.replace(/\/\/+/g,"/"),wt(!1,`Pathnames cannot have embedded double slashes - normalizing ${i} -> ${a}`)}a.startsWith("/")?l=nu(a.substring(1),"/"):l=nu(a,r)}else l=r;return{pathname:l,search:cy(s),hash:uy(n)}}function nu(e,r){let a=r.replace(/\/+$/,"").split("/");return e.split("/").forEach(n=>{n===".."?a.length>1&&a.pop():n!=="."&&a.push(n)}),a.length>1?a.join("/"):"/"}function ji(e,r,a,s){return`Cannot include a '${e}' character in a manually specified \`to.${r}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function oy(e){return e.filter((r,a)=>a===0||r.route.path&&r.route.path.length>0)}function Pd(e){let r=oy(e);return r.map((a,s)=>s===r.length-1?a.pathname:a.pathnameBase)}function Dd(e,r,a,s=!1){let n;typeof e=="string"?n=Oa(e):(n={...e},ve(!n.pathname||!n.pathname.includes("?"),ji("?","pathname","search",n)),ve(!n.pathname||!n.pathname.includes("#"),ji("#","pathname","hash",n)),ve(!n.search||!n.search.includes("#"),ji("#","search","hash",n)));let l=e===""||n.pathname==="",i=l?"/":n.pathname,u;if(i==null)u=a;else{let m=r.length-1;if(!s&&i.startsWith("..")){let p=i.split("/");for(;p[0]==="..";)p.shift(),m-=1;n.pathname=p.join("/")}u=m>=0?r[m]:"/"}let o=iy(n,u),c=i&&i!=="/"&&i.endsWith("/"),d=(l||i===".")&&a.endsWith("/");return!o.pathname.endsWith("/")&&(c||d)&&(o.pathname+="/"),o}var tr=e=>e.join("/").replace(/\/\/+/g,"/"),dy=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),cy=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,uy=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function my(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var J0=["POST","PUT","PATCH","DELETE"];new Set(J0);var gy=["GET",...J0];new Set(gy);var Ia=b.createContext(null);Ia.displayName="DataRouter";var Tl=b.createContext(null);Tl.displayName="DataRouterState";b.createContext(!1);var Y0=b.createContext({isTransitioning:!1});Y0.displayName="ViewTransition";var xy=b.createContext(new Map);xy.displayName="Fetchers";var hy=b.createContext(null);hy.displayName="Await";var Lt=b.createContext(null);Lt.displayName="Navigation";var zs=b.createContext(null);zs.displayName="Location";var Nt=b.createContext({outlet:null,matches:[],isDataRoute:!1});Nt.displayName="Route";var Md=b.createContext(null);Md.displayName="RouteError";function py(e,{relative:r}={}){ve(Ba(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:s}=b.useContext(Lt),{hash:n,pathname:l,search:i}=Us(e,{relative:r}),u=l;return a!=="/"&&(u=l==="/"?a:tr([a,l])),s.createHref({pathname:u,search:i,hash:n})}function Ba(){return b.useContext(zs)!=null}function dr(){return ve(Ba(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(zs).location}var X0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function K0(e){b.useContext(Lt).static||b.useLayoutEffect(e)}function $a(){let{isDataRoute:e}=b.useContext(Nt);return e?My():fy()}function fy(){ve(Ba(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Ia),{basename:r,navigator:a}=b.useContext(Lt),{matches:s}=b.useContext(Nt),{pathname:n}=dr(),l=JSON.stringify(Pd(s)),i=b.useRef(!1);return K0(()=>{i.current=!0}),b.useCallback((o,c={})=>{if(wt(i.current,X0),!i.current)return;if(typeof o=="number"){a.go(o);return}let d=Dd(o,JSON.parse(l),n,c.relative==="path");e==null&&r!=="/"&&(d.pathname=d.pathname==="/"?r:tr([r,d.pathname])),(c.replace?a.replace:a.push)(d,c.state,c)},[r,a,l,n,e])}var yy=b.createContext(null);function by(e){let r=b.useContext(Nt).outlet;return b.useMemo(()=>r&&b.createElement(yy.Provider,{value:e},r),[r,e])}function vy(){let{matches:e}=b.useContext(Nt),r=e[e.length-1];return r?r.params:{}}function Us(e,{relative:r}={}){let{matches:a}=b.useContext(Nt),{pathname:s}=dr(),n=JSON.stringify(Pd(a));return b.useMemo(()=>Dd(e,JSON.parse(n),s,r==="path"),[e,n,s,r])}function ky(e,r){return G0(e,r)}function G0(e,r,a,s,n){var x;ve(Ba(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=b.useContext(Lt),{matches:i}=b.useContext(Nt),u=i[i.length-1],o=u?u.params:{},c=u?u.pathname:"/",d=u?u.pathnameBase:"/",m=u&&u.route;{let g=m&&m.path||"";Z0(c,!m||g.endsWith("*")||g.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${g}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
Please change the parent <Route path="${g}"> to <Route path="${g==="/"?"*":`${g}/*`}">.`)}let p=dr(),j;if(r){let g=typeof r=="string"?Oa(r):r;ve(d==="/"||((x=g.pathname)==null?void 0:x.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${g.pathname}" was given in the \`location\` prop.`),j=g}else j=p;let v=j.pathname||"/",y=v;if(d!=="/"){let g=d.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(g.length).join("/")}let f=q0(e,{pathname:y});wt(m||f!=null,`No routes matched location "${j.pathname}${j.search}${j.hash}" `),wt(f==null||f[f.length-1].route.element!==void 0||f[f.length-1].route.Component!==void 0||f[f.length-1].route.lazy!==void 0,`Matched leaf route at location "${j.pathname}${j.search}${j.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let k=Sy(f&&f.map(g=>Object.assign({},g,{params:Object.assign({},o,g.params),pathname:tr([d,l.encodeLocation?l.encodeLocation(g.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?d:tr([d,l.encodeLocation?l.encodeLocation(g.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),i,a,s,n);return r&&k?b.createElement(zs.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...j},navigationType:"POP"}},k):k}function jy(){let e=Dy(),r=my(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",n={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:l},"ErrorBoundary")," or"," ",b.createElement("code",{style:l},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},r),a?b.createElement("pre",{style:n},a):null,i)}var wy=b.createElement(jy,null),Ny=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){this.props.onError?this.props.onError(e,r):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?b.createElement(Nt.Provider,{value:this.props.routeContext},b.createElement(Md.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function _y({routeContext:e,match:r,children:a}){let s=b.useContext(Ia);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),b.createElement(Nt.Provider,{value:e},a)}function Sy(e,r=[],a=null,s=null,n=null){if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(r.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let l=e,i=a==null?void 0:a.errors;if(i!=null){let d=l.findIndex(m=>m.route.id&&(i==null?void 0:i[m.route.id])!==void 0);ve(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),l=l.slice(0,Math.min(l.length,d+1))}let u=!1,o=-1;if(a)for(let d=0;d<l.length;d++){let m=l[d];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(o=d),m.route.id){let{loaderData:p,errors:j}=a,v=m.route.loader&&!p.hasOwnProperty(m.route.id)&&(!j||j[m.route.id]===void 0);if(m.route.lazy||v){u=!0,o>=0?l=l.slice(0,o+1):l=[l[0]];break}}}let c=a&&s?(d,m)=>{var p,j;s(d,{location:a.location,params:((j=(p=a.matches)==null?void 0:p[0])==null?void 0:j.params)??{},errorInfo:m})}:void 0;return l.reduceRight((d,m,p)=>{let j,v=!1,y=null,f=null;a&&(j=i&&m.route.id?i[m.route.id]:void 0,y=m.route.errorElement||wy,u&&(o<0&&p===0?(Z0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),v=!0,f=null):o===p&&(v=!0,f=m.route.hydrateFallbackElement||null)));let k=r.concat(l.slice(0,p+1)),x=()=>{let g;return j?g=y:v?g=f:m.route.Component?g=b.createElement(m.route.Component,null):m.route.element?g=m.route.element:g=d,b.createElement(_y,{match:m,routeContext:{outlet:d,matches:k,isDataRoute:a!=null},children:g})};return a&&(m.route.ErrorBoundary||m.route.errorElement||p===0)?b.createElement(Ny,{location:a.location,revalidation:a.revalidation,component:y,error:j,children:x(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:c}):x()},null)}function Ad(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Cy(e){let r=b.useContext(Ia);return ve(r,Ad(e)),r}function Ey(e){let r=b.useContext(Tl);return ve(r,Ad(e)),r}function Ry(e){let r=b.useContext(Nt);return ve(r,Ad(e)),r}function Fd(e){let r=Ry(e),a=r.matches[r.matches.length-1];return ve(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function Py(){return Fd("useRouteId")}function Dy(){var s;let e=b.useContext(Md),r=Ey("useRouteError"),a=Fd("useRouteError");return e!==void 0?e:(s=r.errors)==null?void 0:s[a]}function My(){let{router:e}=Cy("useNavigate"),r=Fd("useNavigate"),a=b.useRef(!1);return K0(()=>{a.current=!0}),b.useCallback(async(n,l={})=>{wt(a.current,X0),a.current&&(typeof n=="number"?e.navigate(n):await e.navigate(n,{fromRouteId:r,...l}))},[e,r])}var lu={};function Z0(e,r,a){!r&&!lu[e]&&(lu[e]=!0,wt(!1,a))}b.memo(Ay);function Ay({routes:e,future:r,state:a,unstable_onError:s}){return G0(e,void 0,a,s,r)}function Td({to:e,replace:r,state:a,relative:s}){ve(Ba(),"<Navigate> may be used only in the context of a <Router> component.");let{static:n}=b.useContext(Lt);wt(!n,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=b.useContext(Nt),{pathname:i}=dr(),u=$a(),o=Dd(e,Pd(l),i,s==="path"),c=JSON.stringify(o);return b.useEffect(()=>{u(JSON.parse(c),{replace:r,state:a,relative:s})},[u,c,s,r,a]),null}function Fy(e){return by(e.context)}function ce(e){ve(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Ty({basename:e="/",children:r=null,location:a,navigationType:s="POP",navigator:n,static:l=!1}){ve(!Ba(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:i,navigator:n,static:l,future:{}}),[i,n,l]);typeof a=="string"&&(a=Oa(a));let{pathname:o="/",search:c="",hash:d="",state:m=null,key:p="default"}=a,j=b.useMemo(()=>{let v=lr(o,i);return v==null?null:{location:{pathname:v,search:c,hash:d,state:m,key:p},navigationType:s}},[i,o,c,d,m,p,s]);return wt(j!=null,`<Router basename="${i}"> is not able to match the URL "${o}${c}${d}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:b.createElement(Lt.Provider,{value:u},b.createElement(zs.Provider,{children:r,value:j}))}function Ly({children:e,location:r}){return ky(wo(e),r)}function wo(e,r=[]){let a=[];return b.Children.forEach(e,(s,n)=>{if(!b.isValidElement(s))return;let l=[...r,n];if(s.type===b.Fragment){a.push.apply(a,wo(s.props.children,l));return}ve(s.type===ce,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ve(!s.props.index||!s.props.children,"An index route cannot have child routes.");let i={id:s.props.id||l.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(i.children=wo(s.props.children,l)),a.push(i)}),a}var Ln="get",On="application/x-www-form-urlencoded";function Ll(e){return e!=null&&typeof e.tagName=="string"}function Oy(e){return Ll(e)&&e.tagName.toLowerCase()==="button"}function Iy(e){return Ll(e)&&e.tagName.toLowerCase()==="form"}function By(e){return Ll(e)&&e.tagName.toLowerCase()==="input"}function $y(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zy(e,r){return e.button===0&&(!r||r==="_self")&&!$y(e)}var gn=null;function Uy(){if(gn===null)try{new FormData(document.createElement("form"),0),gn=!1}catch{gn=!0}return gn}var Vy=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function wi(e){return e!=null&&!Vy.has(e)?(wt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${On}"`),null):e}function Hy(e,r){let a,s,n,l,i;if(Iy(e)){let u=e.getAttribute("action");s=u?lr(u,r):null,a=e.getAttribute("method")||Ln,n=wi(e.getAttribute("enctype"))||On,l=new FormData(e)}else if(Oy(e)||By(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let o=e.getAttribute("formaction")||u.getAttribute("action");if(s=o?lr(o,r):null,a=e.getAttribute("formmethod")||u.getAttribute("method")||Ln,n=wi(e.getAttribute("formenctype"))||wi(u.getAttribute("enctype"))||On,l=new FormData(u,e),!Uy()){let{name:c,type:d,value:m}=e;if(d==="image"){let p=c?`${c}.`:"";l.append(`${p}x`,"0"),l.append(`${p}y`,"0")}else c&&l.append(c,m)}}else{if(Ll(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Ln,s=null,n=On,i=e}return l&&n==="text/plain"&&(i=l,l=void 0),{action:s,method:a.toLowerCase(),encType:n,formData:l,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ld(e,r){if(e===!1||e===null||typeof e>"u")throw new Error(r)}function qy(e,r,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s.pathname==="/"?s.pathname=`_root.${a}`:r&&lr(s.pathname,r)==="/"?s.pathname=`${r.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function Wy(e,r){if(e.id in r)return r[e.id];try{let a=await import(e.module);return r[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Qy(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Jy(e,r,a){let s=await Promise.all(e.map(async n=>{let l=r.routes[n.route.id];if(l){let i=await Wy(l,a);return i.links?i.links():[]}return[]}));return Gy(s.flat(1).filter(Qy).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function iu(e,r,a,s,n,l){let i=(o,c)=>a[c]?o.route.id!==a[c].route.id:!0,u=(o,c)=>{var d;return a[c].pathname!==o.pathname||((d=a[c].route.path)==null?void 0:d.endsWith("*"))&&a[c].params["*"]!==o.params["*"]};return l==="assets"?r.filter((o,c)=>i(o,c)||u(o,c)):l==="data"?r.filter((o,c)=>{var m;let d=s.routes[o.route.id];if(!d||!d.hasLoader)return!1;if(i(o,c)||u(o,c))return!0;if(o.route.shouldRevalidate){let p=o.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:((m=a[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:o.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function Yy(e,r,{includeHydrateFallback:a}={}){return Xy(e.map(s=>{let n=r.routes[s.route.id];if(!n)return[];let l=[n.module];return n.clientActionModule&&(l=l.concat(n.clientActionModule)),n.clientLoaderModule&&(l=l.concat(n.clientLoaderModule)),a&&n.hydrateFallbackModule&&(l=l.concat(n.hydrateFallbackModule)),n.imports&&(l=l.concat(n.imports)),l}).flat(1))}function Xy(e){return[...new Set(e)]}function Ky(e){let r={},a=Object.keys(e).sort();for(let s of a)r[s]=e[s];return r}function Gy(e,r){let a=new Set;return new Set(r),e.reduce((s,n)=>{let l=JSON.stringify(Ky(n));return a.has(l)||(a.add(l),s.push({key:l,link:n})),s},[])}function eg(){let e=b.useContext(Ia);return Ld(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Zy(){let e=b.useContext(Tl);return Ld(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Od=b.createContext(void 0);Od.displayName="FrameworkContext";function tg(){let e=b.useContext(Od);return Ld(e,"You must render this element inside a <HydratedRouter> element"),e}function eb(e,r){let a=b.useContext(Od),[s,n]=b.useState(!1),[l,i]=b.useState(!1),{onFocus:u,onBlur:o,onMouseEnter:c,onMouseLeave:d,onTouchStart:m}=r,p=b.useRef(null);b.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let y=k=>{k.forEach(x=>{i(x.isIntersecting)})},f=new IntersectionObserver(y,{threshold:.5});return p.current&&f.observe(p.current),()=>{f.disconnect()}}},[e]),b.useEffect(()=>{if(s){let y=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(y)}}},[s]);let j=()=>{n(!0)},v=()=>{n(!1),i(!1)};return a?e!=="intent"?[l,p,{}]:[l,p,{onFocus:Ga(u,j),onBlur:Ga(o,v),onMouseEnter:Ga(c,j),onMouseLeave:Ga(d,v),onTouchStart:Ga(m,j)}]:[!1,p,{}]}function Ga(e,r){return a=>{e&&e(a),a.defaultPrevented||r(a)}}function tb({page:e,...r}){let{router:a}=eg(),s=b.useMemo(()=>q0(a.routes,e,a.basename),[a.routes,e,a.basename]);return s?b.createElement(ab,{page:e,matches:s,...r}):null}function rb(e){let{manifest:r,routeModules:a}=tg(),[s,n]=b.useState([]);return b.useEffect(()=>{let l=!1;return Jy(e,r,a).then(i=>{l||n(i)}),()=>{l=!0}},[e,r,a]),s}function ab({page:e,matches:r,...a}){let s=dr(),{manifest:n,routeModules:l}=tg(),{basename:i}=eg(),{loaderData:u,matches:o}=Zy(),c=b.useMemo(()=>iu(e,r,o,n,s,"data"),[e,r,o,n,s]),d=b.useMemo(()=>iu(e,r,o,n,s,"assets"),[e,r,o,n,s]),m=b.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let v=new Set,y=!1;if(r.forEach(k=>{var g;let x=n.routes[k.route.id];!x||!x.hasLoader||(!c.some(h=>h.route.id===k.route.id)&&k.route.id in u&&((g=l[k.route.id])!=null&&g.shouldRevalidate)||x.hasClientLoader?y=!0:v.add(k.route.id))}),v.size===0)return[];let f=qy(e,i,"data");return y&&v.size>0&&f.searchParams.set("_routes",r.filter(k=>v.has(k.route.id)).map(k=>k.route.id).join(",")),[f.pathname+f.search]},[i,u,s,n,c,r,e,l]),p=b.useMemo(()=>Yy(d,n),[d,n]),j=rb(d);return b.createElement(b.Fragment,null,m.map(v=>b.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...a})),p.map(v=>b.createElement("link",{key:v,rel:"modulepreload",href:v,...a})),j.map(({key:v,link:y})=>b.createElement("link",{key:v,nonce:a.nonce,...y})))}function sb(...e){return r=>{e.forEach(a=>{typeof a=="function"?a(r):a!=null&&(a.current=r)})}}var rg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{rg&&(window.__reactRouterVersion="7.9.6")}catch{}function nb({basename:e,children:r,window:a}){let s=b.useRef();s.current==null&&(s.current=Uf({window:a,v5Compat:!0}));let n=s.current,[l,i]=b.useState({action:n.action,location:n.location}),u=b.useCallback(o=>{b.startTransition(()=>i(o))},[i]);return b.useLayoutEffect(()=>n.listen(u),[n,u]),b.createElement(Ty,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:n})}var ag=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ol=b.forwardRef(function({onClick:r,discover:a="render",prefetch:s="none",relative:n,reloadDocument:l,replace:i,state:u,target:o,to:c,preventScrollReset:d,viewTransition:m,...p},j){let{basename:v}=b.useContext(Lt),y=typeof c=="string"&&ag.test(c),f,k=!1;if(typeof c=="string"&&y&&(f=c,rg))try{let D=new URL(window.location.href),R=c.startsWith("//")?new URL(D.protocol+c):new URL(c),F=lr(R.pathname,v);R.origin===D.origin&&F!=null?c=F+R.search+R.hash:k=!0}catch{wt(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let x=py(c,{relative:n}),[g,h,w]=eb(s,p),S=ob(c,{replace:i,state:u,target:o,preventScrollReset:d,relative:n,viewTransition:m});function C(D){r&&r(D),D.defaultPrevented||S(D)}let N=b.createElement("a",{...p,...w,href:f||x,onClick:k||l?r:C,ref:sb(j,h),target:o,"data-discover":!y&&a==="render"?"true":void 0});return g&&!y?b.createElement(b.Fragment,null,N,b.createElement(tb,{page:x})):N});Ol.displayName="Link";var sg=b.forwardRef(function({"aria-current":r="page",caseSensitive:a=!1,className:s="",end:n=!1,style:l,to:i,viewTransition:u,children:o,...c},d){let m=Us(i,{relative:c.relative}),p=dr(),j=b.useContext(Tl),{navigator:v,basename:y}=b.useContext(Lt),f=j!=null&&gb(m)&&u===!0,k=v.encodeLocation?v.encodeLocation(m).pathname:m.pathname,x=p.pathname,g=j&&j.navigation&&j.navigation.location?j.navigation.location.pathname:null;a||(x=x.toLowerCase(),g=g?g.toLowerCase():null,k=k.toLowerCase()),g&&y&&(g=lr(g,y)||g);const h=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let w=x===k||!n&&x.startsWith(k)&&x.charAt(h)==="/",S=g!=null&&(g===k||!n&&g.startsWith(k)&&g.charAt(k.length)==="/"),C={isActive:w,isPending:S,isTransitioning:f},N=w?r:void 0,D;typeof s=="function"?D=s(C):D=[s,w?"active":null,S?"pending":null,f?"transitioning":null].filter(Boolean).join(" ");let R=typeof l=="function"?l(C):l;return b.createElement(Ol,{...c,"aria-current":N,className:D,ref:d,style:R,to:i,viewTransition:u},typeof o=="function"?o(C):o)});sg.displayName="NavLink";var lb=b.forwardRef(({discover:e="render",fetcherKey:r,navigate:a,reloadDocument:s,replace:n,state:l,method:i=Ln,action:u,onSubmit:o,relative:c,preventScrollReset:d,viewTransition:m,...p},j)=>{let v=ub(),y=mb(u,{relative:c}),f=i.toLowerCase()==="get"?"get":"post",k=typeof u=="string"&&ag.test(u),x=g=>{if(o&&o(g),g.defaultPrevented)return;g.preventDefault();let h=g.nativeEvent.submitter,w=(h==null?void 0:h.getAttribute("formmethod"))||i;v(h||g.currentTarget,{fetcherKey:r,method:w,navigate:a,replace:n,state:l,relative:c,preventScrollReset:d,viewTransition:m})};return b.createElement("form",{ref:j,method:f,action:y,onSubmit:s?o:x,...p,"data-discover":!k&&e==="render"?"true":void 0})});lb.displayName="Form";function ib(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ng(e){let r=b.useContext(Ia);return ve(r,ib(e)),r}function ob(e,{target:r,replace:a,state:s,preventScrollReset:n,relative:l,viewTransition:i}={}){let u=$a(),o=dr(),c=Us(e,{relative:l});return b.useCallback(d=>{if(zy(d,r)){d.preventDefault();let m=a!==void 0?a:Fs(o)===Fs(c);u(e,{replace:m,state:s,preventScrollReset:n,relative:l,viewTransition:i})}},[o,u,c,a,s,r,e,n,l,i])}var db=0,cb=()=>`__${String(++db)}__`;function ub(){let{router:e}=ng("useSubmit"),{basename:r}=b.useContext(Lt),a=Py();return b.useCallback(async(s,n={})=>{let{action:l,method:i,encType:u,formData:o,body:c}=Hy(s,r);if(n.navigate===!1){let d=n.fetcherKey||cb();await e.fetch(d,a,n.action||l,{preventScrollReset:n.preventScrollReset,formData:o,body:c,formMethod:n.method||i,formEncType:n.encType||u,flushSync:n.flushSync})}else await e.navigate(n.action||l,{preventScrollReset:n.preventScrollReset,formData:o,body:c,formMethod:n.method||i,formEncType:n.encType||u,replace:n.replace,state:n.state,fromRouteId:a,flushSync:n.flushSync,viewTransition:n.viewTransition})},[e,r,a])}function mb(e,{relative:r}={}){let{basename:a}=b.useContext(Lt),s=b.useContext(Nt);ve(s,"useFormAction must be used inside a RouteContext");let[n]=s.matches.slice(-1),l={...Us(e||".",{relative:r})},i=dr();if(e==null){l.search=i.search;let u=new URLSearchParams(l.search),o=u.getAll("index");if(o.some(d=>d==="")){u.delete("index"),o.filter(m=>m).forEach(m=>u.append("index",m));let d=u.toString();l.search=d?`?${d}`:""}}return(!e||e===".")&&n.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(l.pathname=l.pathname==="/"?a:tr([a,l.pathname])),Fs(l)}function gb(e,{relative:r}={}){let a=b.useContext(Y0);ve(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=ng("useViewTransitionState"),n=Us(e,{relative:r});if(!a.isTransitioning)return!1;let l=lr(a.currentLocation.pathname,s)||a.currentLocation.pathname,i=lr(a.nextLocation.pathname,s)||a.nextLocation.pathname;return xl(n.pathname,i)!=null||xl(n.pathname,l)!=null}function lg(e,r){return function(){return e.apply(r,arguments)}}const{toString:xb}=Object.prototype,{getPrototypeOf:Id}=Object,{iterator:Il,toStringTag:ig}=Symbol,Bl=(e=>r=>{const a=xb.call(r);return e[a]||(e[a]=a.slice(8,-1).toLowerCase())})(Object.create(null)),Ot=e=>(e=e.toLowerCase(),r=>Bl(r)===e),$l=e=>r=>typeof r===e,{isArray:za}=Array,Ma=$l("undefined");function Vs(e){return e!==null&&!Ma(e)&&e.constructor!==null&&!Ma(e.constructor)&&at(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const og=Ot("ArrayBuffer");function hb(e){let r;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?r=ArrayBuffer.isView(e):r=e&&e.buffer&&og(e.buffer),r}const pb=$l("string"),at=$l("function"),dg=$l("number"),Hs=e=>e!==null&&typeof e=="object",fb=e=>e===!0||e===!1,In=e=>{if(Bl(e)!=="object")return!1;const r=Id(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(ig in e)&&!(Il in e)},yb=e=>{if(!Hs(e)||Vs(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},bb=Ot("Date"),vb=Ot("File"),kb=Ot("Blob"),jb=Ot("FileList"),wb=e=>Hs(e)&&at(e.pipe),Nb=e=>{let r;return e&&(typeof FormData=="function"&&e instanceof FormData||at(e.append)&&((r=Bl(e))==="formdata"||r==="object"&&at(e.toString)&&e.toString()==="[object FormData]"))},_b=Ot("URLSearchParams"),[Sb,Cb,Eb,Rb]=["ReadableStream","Request","Response","Headers"].map(Ot),Pb=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function qs(e,r,{allOwnKeys:a=!1}={}){if(e===null||typeof e>"u")return;let s,n;if(typeof e!="object"&&(e=[e]),za(e))for(s=0,n=e.length;s<n;s++)r.call(null,e[s],s,e);else{if(Vs(e))return;const l=a?Object.getOwnPropertyNames(e):Object.keys(e),i=l.length;let u;for(s=0;s<i;s++)u=l[s],r.call(null,e[u],u,e)}}function cg(e,r){if(Vs(e))return null;r=r.toLowerCase();const a=Object.keys(e);let s=a.length,n;for(;s-- >0;)if(n=a[s],r===n.toLowerCase())return n;return null}const Br=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ug=e=>!Ma(e)&&e!==Br;function No(){const{caseless:e,skipUndefined:r}=ug(this)&&this||{},a={},s=(n,l)=>{const i=e&&cg(a,l)||l;In(a[i])&&In(n)?a[i]=No(a[i],n):In(n)?a[i]=No({},n):za(n)?a[i]=n.slice():(!r||!Ma(n))&&(a[i]=n)};for(let n=0,l=arguments.length;n<l;n++)arguments[n]&&qs(arguments[n],s);return a}const Db=(e,r,a,{allOwnKeys:s}={})=>(qs(r,(n,l)=>{a&&at(n)?e[l]=lg(n,a):e[l]=n},{allOwnKeys:s}),e),Mb=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ab=(e,r,a,s)=>{e.prototype=Object.create(r.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:r.prototype}),a&&Object.assign(e.prototype,a)},Fb=(e,r,a,s)=>{let n,l,i;const u={};if(r=r||{},e==null)return r;do{for(n=Object.getOwnPropertyNames(e),l=n.length;l-- >0;)i=n[l],(!s||s(i,e,r))&&!u[i]&&(r[i]=e[i],u[i]=!0);e=a!==!1&&Id(e)}while(e&&(!a||a(e,r))&&e!==Object.prototype);return r},Tb=(e,r,a)=>{e=String(e),(a===void 0||a>e.length)&&(a=e.length),a-=r.length;const s=e.indexOf(r,a);return s!==-1&&s===a},Lb=e=>{if(!e)return null;if(za(e))return e;let r=e.length;if(!dg(r))return null;const a=new Array(r);for(;r-- >0;)a[r]=e[r];return a},Ob=(e=>r=>e&&r instanceof e)(typeof Uint8Array<"u"&&Id(Uint8Array)),Ib=(e,r)=>{const s=(e&&e[Il]).call(e);let n;for(;(n=s.next())&&!n.done;){const l=n.value;r.call(e,l[0],l[1])}},Bb=(e,r)=>{let a;const s=[];for(;(a=e.exec(r))!==null;)s.push(a);return s},$b=Ot("HTMLFormElement"),zb=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(a,s,n){return s.toUpperCase()+n}),ou=(({hasOwnProperty:e})=>(r,a)=>e.call(r,a))(Object.prototype),Ub=Ot("RegExp"),mg=(e,r)=>{const a=Object.getOwnPropertyDescriptors(e),s={};qs(a,(n,l)=>{let i;(i=r(n,l,e))!==!1&&(s[l]=i||n)}),Object.defineProperties(e,s)},Vb=e=>{mg(e,(r,a)=>{if(at(e)&&["arguments","caller","callee"].indexOf(a)!==-1)return!1;const s=e[a];if(at(s)){if(r.enumerable=!1,"writable"in r){r.writable=!1;return}r.set||(r.set=()=>{throw Error("Can not rewrite read-only method '"+a+"'")})}})},Hb=(e,r)=>{const a={},s=n=>{n.forEach(l=>{a[l]=!0})};return za(e)?s(e):s(String(e).split(r)),a},qb=()=>{},Wb=(e,r)=>e!=null&&Number.isFinite(e=+e)?e:r;function Qb(e){return!!(e&&at(e.append)&&e[ig]==="FormData"&&e[Il])}const Jb=e=>{const r=new Array(10),a=(s,n)=>{if(Hs(s)){if(r.indexOf(s)>=0)return;if(Vs(s))return s;if(!("toJSON"in s)){r[n]=s;const l=za(s)?[]:{};return qs(s,(i,u)=>{const o=a(i,n+1);!Ma(o)&&(l[u]=o)}),r[n]=void 0,l}}return s};return a(e,0)},Yb=Ot("AsyncFunction"),Xb=e=>e&&(Hs(e)||at(e))&&at(e.then)&&at(e.catch),gg=((e,r)=>e?setImmediate:r?((a,s)=>(Br.addEventListener("message",({source:n,data:l})=>{n===Br&&l===a&&s.length&&s.shift()()},!1),n=>{s.push(n),Br.postMessage(a,"*")}))(`axios@${Math.random()}`,[]):a=>setTimeout(a))(typeof setImmediate=="function",at(Br.postMessage)),Kb=typeof queueMicrotask<"u"?queueMicrotask.bind(Br):typeof process<"u"&&process.nextTick||gg,Gb=e=>e!=null&&at(e[Il]),L={isArray:za,isArrayBuffer:og,isBuffer:Vs,isFormData:Nb,isArrayBufferView:hb,isString:pb,isNumber:dg,isBoolean:fb,isObject:Hs,isPlainObject:In,isEmptyObject:yb,isReadableStream:Sb,isRequest:Cb,isResponse:Eb,isHeaders:Rb,isUndefined:Ma,isDate:bb,isFile:vb,isBlob:kb,isRegExp:Ub,isFunction:at,isStream:wb,isURLSearchParams:_b,isTypedArray:Ob,isFileList:jb,forEach:qs,merge:No,extend:Db,trim:Pb,stripBOM:Mb,inherits:Ab,toFlatObject:Fb,kindOf:Bl,kindOfTest:Ot,endsWith:Tb,toArray:Lb,forEachEntry:Ib,matchAll:Bb,isHTMLForm:$b,hasOwnProperty:ou,hasOwnProp:ou,reduceDescriptors:mg,freezeMethods:Vb,toObjectSet:Hb,toCamelCase:zb,noop:qb,toFiniteNumber:Wb,findKey:cg,global:Br,isContextDefined:ug,isSpecCompliantForm:Qb,toJSONObject:Jb,isAsyncFn:Yb,isThenable:Xb,setImmediate:gg,asap:Kb,isIterable:Gb};function se(e,r,a,s,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",r&&(this.code=r),a&&(this.config=a),s&&(this.request=s),n&&(this.response=n,this.status=n.status?n.status:null)}L.inherits(se,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:L.toJSONObject(this.config),code:this.code,status:this.status}}});const xg=se.prototype,hg={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{hg[e]={value:e}});Object.defineProperties(se,hg);Object.defineProperty(xg,"isAxiosError",{value:!0});se.from=(e,r,a,s,n,l)=>{const i=Object.create(xg);L.toFlatObject(e,i,function(d){return d!==Error.prototype},c=>c!=="isAxiosError");const u=e&&e.message?e.message:"Error",o=r==null&&e?e.code:r;return se.call(i,u,o,a,s,n),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",l&&Object.assign(i,l),i};const Zb=null;function _o(e){return L.isPlainObject(e)||L.isArray(e)}function pg(e){return L.endsWith(e,"[]")?e.slice(0,-2):e}function du(e,r,a){return e?e.concat(r).map(function(n,l){return n=pg(n),!a&&l?"["+n+"]":n}).join(a?".":""):r}function ev(e){return L.isArray(e)&&!e.some(_o)}const tv=L.toFlatObject(L,{},null,function(r){return/^is[A-Z]/.test(r)});function zl(e,r,a){if(!L.isObject(e))throw new TypeError("target must be an object");r=r||new FormData,a=L.toFlatObject(a,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,f){return!L.isUndefined(f[y])});const s=a.metaTokens,n=a.visitor||d,l=a.dots,i=a.indexes,o=(a.Blob||typeof Blob<"u"&&Blob)&&L.isSpecCompliantForm(r);if(!L.isFunction(n))throw new TypeError("visitor must be a function");function c(v){if(v===null)return"";if(L.isDate(v))return v.toISOString();if(L.isBoolean(v))return v.toString();if(!o&&L.isBlob(v))throw new se("Blob is not supported. Use a Buffer instead.");return L.isArrayBuffer(v)||L.isTypedArray(v)?o&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function d(v,y,f){let k=v;if(v&&!f&&typeof v=="object"){if(L.endsWith(y,"{}"))y=s?y:y.slice(0,-2),v=JSON.stringify(v);else if(L.isArray(v)&&ev(v)||(L.isFileList(v)||L.endsWith(y,"[]"))&&(k=L.toArray(v)))return y=pg(y),k.forEach(function(g,h){!(L.isUndefined(g)||g===null)&&r.append(i===!0?du([y],h,l):i===null?y:y+"[]",c(g))}),!1}return _o(v)?!0:(r.append(du(f,y,l),c(v)),!1)}const m=[],p=Object.assign(tv,{defaultVisitor:d,convertValue:c,isVisitable:_o});function j(v,y){if(!L.isUndefined(v)){if(m.indexOf(v)!==-1)throw Error("Circular reference detected in "+y.join("."));m.push(v),L.forEach(v,function(k,x){(!(L.isUndefined(k)||k===null)&&n.call(r,k,L.isString(x)?x.trim():x,y,p))===!0&&j(k,y?y.concat(x):[x])}),m.pop()}}if(!L.isObject(e))throw new TypeError("data must be an object");return j(e),r}function cu(e){const r={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return r[s]})}function Bd(e,r){this._pairs=[],e&&zl(e,this,r)}const fg=Bd.prototype;fg.append=function(r,a){this._pairs.push([r,a])};fg.toString=function(r){const a=r?function(s){return r.call(this,s,cu)}:cu;return this._pairs.map(function(n){return a(n[0])+"="+a(n[1])},"").join("&")};function rv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function yg(e,r,a){if(!r)return e;const s=a&&a.encode||rv;L.isFunction(a)&&(a={serialize:a});const n=a&&a.serialize;let l;if(n?l=n(r,a):l=L.isURLSearchParams(r)?r.toString():new Bd(r,a).toString(s),l){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+l}return e}class uu{constructor(){this.handlers=[]}use(r,a,s){return this.handlers.push({fulfilled:r,rejected:a,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(r){this.handlers[r]&&(this.handlers[r]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(r){L.forEach(this.handlers,function(s){s!==null&&r(s)})}}const bg={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},av=typeof URLSearchParams<"u"?URLSearchParams:Bd,sv=typeof FormData<"u"?FormData:null,nv=typeof Blob<"u"?Blob:null,lv={isBrowser:!0,classes:{URLSearchParams:av,FormData:sv,Blob:nv},protocols:["http","https","file","blob","url","data"]},$d=typeof window<"u"&&typeof document<"u",So=typeof navigator=="object"&&navigator||void 0,iv=$d&&(!So||["ReactNative","NativeScript","NS"].indexOf(So.product)<0),ov=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",dv=$d&&window.location.href||"http://localhost",cv=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:$d,hasStandardBrowserEnv:iv,hasStandardBrowserWebWorkerEnv:ov,navigator:So,origin:dv},Symbol.toStringTag,{value:"Module"})),Ve={...cv,...lv};function uv(e,r){return zl(e,new Ve.classes.URLSearchParams,{visitor:function(a,s,n,l){return Ve.isNode&&L.isBuffer(a)?(this.append(s,a.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...r})}function mv(e){return L.matchAll(/\w+|\[(\w*)]/g,e).map(r=>r[0]==="[]"?"":r[1]||r[0])}function gv(e){const r={},a=Object.keys(e);let s;const n=a.length;let l;for(s=0;s<n;s++)l=a[s],r[l]=e[l];return r}function vg(e){function r(a,s,n,l){let i=a[l++];if(i==="__proto__")return!0;const u=Number.isFinite(+i),o=l>=a.length;return i=!i&&L.isArray(n)?n.length:i,o?(L.hasOwnProp(n,i)?n[i]=[n[i],s]:n[i]=s,!u):((!n[i]||!L.isObject(n[i]))&&(n[i]=[]),r(a,s,n[i],l)&&L.isArray(n[i])&&(n[i]=gv(n[i])),!u)}if(L.isFormData(e)&&L.isFunction(e.entries)){const a={};return L.forEachEntry(e,(s,n)=>{r(mv(s),n,a,0)}),a}return null}function xv(e,r,a){if(L.isString(e))try{return(r||JSON.parse)(e),L.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(a||JSON.stringify)(e)}const Ws={transitional:bg,adapter:["xhr","http","fetch"],transformRequest:[function(r,a){const s=a.getContentType()||"",n=s.indexOf("application/json")>-1,l=L.isObject(r);if(l&&L.isHTMLForm(r)&&(r=new FormData(r)),L.isFormData(r))return n?JSON.stringify(vg(r)):r;if(L.isArrayBuffer(r)||L.isBuffer(r)||L.isStream(r)||L.isFile(r)||L.isBlob(r)||L.isReadableStream(r))return r;if(L.isArrayBufferView(r))return r.buffer;if(L.isURLSearchParams(r))return a.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),r.toString();let u;if(l){if(s.indexOf("application/x-www-form-urlencoded")>-1)return uv(r,this.formSerializer).toString();if((u=L.isFileList(r))||s.indexOf("multipart/form-data")>-1){const o=this.env&&this.env.FormData;return zl(u?{"files[]":r}:r,o&&new o,this.formSerializer)}}return l||n?(a.setContentType("application/json",!1),xv(r)):r}],transformResponse:[function(r){const a=this.transitional||Ws.transitional,s=a&&a.forcedJSONParsing,n=this.responseType==="json";if(L.isResponse(r)||L.isReadableStream(r))return r;if(r&&L.isString(r)&&(s&&!this.responseType||n)){const i=!(a&&a.silentJSONParsing)&&n;try{return JSON.parse(r,this.parseReviver)}catch(u){if(i)throw u.name==="SyntaxError"?se.from(u,se.ERR_BAD_RESPONSE,this,null,this.response):u}}return r}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ve.classes.FormData,Blob:Ve.classes.Blob},validateStatus:function(r){return r>=200&&r<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};L.forEach(["delete","get","head","post","put","patch"],e=>{Ws.headers[e]={}});const hv=L.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),pv=e=>{const r={};let a,s,n;return e&&e.split(`
`).forEach(function(i){n=i.indexOf(":"),a=i.substring(0,n).trim().toLowerCase(),s=i.substring(n+1).trim(),!(!a||r[a]&&hv[a])&&(a==="set-cookie"?r[a]?r[a].push(s):r[a]=[s]:r[a]=r[a]?r[a]+", "+s:s)}),r},mu=Symbol("internals");function Za(e){return e&&String(e).trim().toLowerCase()}function Bn(e){return e===!1||e==null?e:L.isArray(e)?e.map(Bn):String(e)}function fv(e){const r=Object.create(null),a=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=a.exec(e);)r[s[1]]=s[2];return r}const yv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ni(e,r,a,s,n){if(L.isFunction(s))return s.call(this,r,a);if(n&&(r=a),!!L.isString(r)){if(L.isString(s))return r.indexOf(s)!==-1;if(L.isRegExp(s))return s.test(r)}}function bv(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(r,a,s)=>a.toUpperCase()+s)}function vv(e,r){const a=L.toCamelCase(" "+r);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+a,{value:function(n,l,i){return this[s].call(this,r,n,l,i)},configurable:!0})})}let st=class{constructor(r){r&&this.set(r)}set(r,a,s){const n=this;function l(u,o,c){const d=Za(o);if(!d)throw new Error("header name must be a non-empty string");const m=L.findKey(n,d);(!m||n[m]===void 0||c===!0||c===void 0&&n[m]!==!1)&&(n[m||o]=Bn(u))}const i=(u,o)=>L.forEach(u,(c,d)=>l(c,d,o));if(L.isPlainObject(r)||r instanceof this.constructor)i(r,a);else if(L.isString(r)&&(r=r.trim())&&!yv(r))i(pv(r),a);else if(L.isObject(r)&&L.isIterable(r)){let u={},o,c;for(const d of r){if(!L.isArray(d))throw TypeError("Object iterator must return a key-value pair");u[c=d[0]]=(o=u[c])?L.isArray(o)?[...o,d[1]]:[o,d[1]]:d[1]}i(u,a)}else r!=null&&l(a,r,s);return this}get(r,a){if(r=Za(r),r){const s=L.findKey(this,r);if(s){const n=this[s];if(!a)return n;if(a===!0)return fv(n);if(L.isFunction(a))return a.call(this,n,s);if(L.isRegExp(a))return a.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(r,a){if(r=Za(r),r){const s=L.findKey(this,r);return!!(s&&this[s]!==void 0&&(!a||Ni(this,this[s],s,a)))}return!1}delete(r,a){const s=this;let n=!1;function l(i){if(i=Za(i),i){const u=L.findKey(s,i);u&&(!a||Ni(s,s[u],u,a))&&(delete s[u],n=!0)}}return L.isArray(r)?r.forEach(l):l(r),n}clear(r){const a=Object.keys(this);let s=a.length,n=!1;for(;s--;){const l=a[s];(!r||Ni(this,this[l],l,r,!0))&&(delete this[l],n=!0)}return n}normalize(r){const a=this,s={};return L.forEach(this,(n,l)=>{const i=L.findKey(s,l);if(i){a[i]=Bn(n),delete a[l];return}const u=r?bv(l):String(l).trim();u!==l&&delete a[l],a[u]=Bn(n),s[u]=!0}),this}concat(...r){return this.constructor.concat(this,...r)}toJSON(r){const a=Object.create(null);return L.forEach(this,(s,n)=>{s!=null&&s!==!1&&(a[n]=r&&L.isArray(s)?s.join(", "):s)}),a}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([r,a])=>r+": "+a).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(r){return r instanceof this?r:new this(r)}static concat(r,...a){const s=new this(r);return a.forEach(n=>s.set(n)),s}static accessor(r){const s=(this[mu]=this[mu]={accessors:{}}).accessors,n=this.prototype;function l(i){const u=Za(i);s[u]||(vv(n,i),s[u]=!0)}return L.isArray(r)?r.forEach(l):l(r),this}};st.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);L.reduceDescriptors(st.prototype,({value:e},r)=>{let a=r[0].toUpperCase()+r.slice(1);return{get:()=>e,set(s){this[a]=s}}});L.freezeMethods(st);function _i(e,r){const a=this||Ws,s=r||a,n=st.from(s.headers);let l=s.data;return L.forEach(e,function(u){l=u.call(a,l,n.normalize(),r?r.status:void 0)}),n.normalize(),l}function kg(e){return!!(e&&e.__CANCEL__)}function Ua(e,r,a){se.call(this,e??"canceled",se.ERR_CANCELED,r,a),this.name="CanceledError"}L.inherits(Ua,se,{__CANCEL__:!0});function jg(e,r,a){const s=a.config.validateStatus;!a.status||!s||s(a.status)?e(a):r(new se("Request failed with status code "+a.status,[se.ERR_BAD_REQUEST,se.ERR_BAD_RESPONSE][Math.floor(a.status/100)-4],a.config,a.request,a))}function kv(e){const r=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return r&&r[1]||""}function jv(e,r){e=e||10;const a=new Array(e),s=new Array(e);let n=0,l=0,i;return r=r!==void 0?r:1e3,function(o){const c=Date.now(),d=s[l];i||(i=c),a[n]=o,s[n]=c;let m=l,p=0;for(;m!==n;)p+=a[m++],m=m%e;if(n=(n+1)%e,n===l&&(l=(l+1)%e),c-i<r)return;const j=d&&c-d;return j?Math.round(p*1e3/j):void 0}}function wv(e,r){let a=0,s=1e3/r,n,l;const i=(c,d=Date.now())=>{a=d,n=null,l&&(clearTimeout(l),l=null),e(...c)};return[(...c)=>{const d=Date.now(),m=d-a;m>=s?i(c,d):(n=c,l||(l=setTimeout(()=>{l=null,i(n)},s-m)))},()=>n&&i(n)]}const hl=(e,r,a=3)=>{let s=0;const n=jv(50,250);return wv(l=>{const i=l.loaded,u=l.lengthComputable?l.total:void 0,o=i-s,c=n(o),d=i<=u;s=i;const m={loaded:i,total:u,progress:u?i/u:void 0,bytes:o,rate:c||void 0,estimated:c&&u&&d?(u-i)/c:void 0,event:l,lengthComputable:u!=null,[r?"download":"upload"]:!0};e(m)},a)},gu=(e,r)=>{const a=e!=null;return[s=>r[0]({lengthComputable:a,total:e,loaded:s}),r[1]]},xu=e=>(...r)=>L.asap(()=>e(...r)),Nv=Ve.hasStandardBrowserEnv?((e,r)=>a=>(a=new URL(a,Ve.origin),e.protocol===a.protocol&&e.host===a.host&&(r||e.port===a.port)))(new URL(Ve.origin),Ve.navigator&&/(msie|trident)/i.test(Ve.navigator.userAgent)):()=>!0,_v=Ve.hasStandardBrowserEnv?{write(e,r,a,s,n,l,i){if(typeof document>"u")return;const u=[`${e}=${encodeURIComponent(r)}`];L.isNumber(a)&&u.push(`expires=${new Date(a).toUTCString()}`),L.isString(s)&&u.push(`path=${s}`),L.isString(n)&&u.push(`domain=${n}`),l===!0&&u.push("secure"),L.isString(i)&&u.push(`SameSite=${i}`),document.cookie=u.join("; ")},read(e){if(typeof document>"u")return null;const r=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return r?decodeURIComponent(r[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Sv(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Cv(e,r){return r?e.replace(/\/?\/$/,"")+"/"+r.replace(/^\/+/,""):e}function wg(e,r,a){let s=!Sv(r);return e&&(s||a==!1)?Cv(e,r):r}const hu=e=>e instanceof st?{...e}:e;function Yr(e,r){r=r||{};const a={};function s(c,d,m,p){return L.isPlainObject(c)&&L.isPlainObject(d)?L.merge.call({caseless:p},c,d):L.isPlainObject(d)?L.merge({},d):L.isArray(d)?d.slice():d}function n(c,d,m,p){if(L.isUndefined(d)){if(!L.isUndefined(c))return s(void 0,c,m,p)}else return s(c,d,m,p)}function l(c,d){if(!L.isUndefined(d))return s(void 0,d)}function i(c,d){if(L.isUndefined(d)){if(!L.isUndefined(c))return s(void 0,c)}else return s(void 0,d)}function u(c,d,m){if(m in r)return s(c,d);if(m in e)return s(void 0,c)}const o={url:l,method:l,data:l,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:u,headers:(c,d,m)=>n(hu(c),hu(d),m,!0)};return L.forEach(Object.keys({...e,...r}),function(d){const m=o[d]||n,p=m(e[d],r[d],d);L.isUndefined(p)&&m!==u||(a[d]=p)}),a}const Ng=e=>{const r=Yr({},e);let{data:a,withXSRFToken:s,xsrfHeaderName:n,xsrfCookieName:l,headers:i,auth:u}=r;if(r.headers=i=st.from(i),r.url=yg(wg(r.baseURL,r.url,r.allowAbsoluteUrls),e.params,e.paramsSerializer),u&&i.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),L.isFormData(a)){if(Ve.hasStandardBrowserEnv||Ve.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(L.isFunction(a.getHeaders)){const o=a.getHeaders(),c=["content-type","content-length"];Object.entries(o).forEach(([d,m])=>{c.includes(d.toLowerCase())&&i.set(d,m)})}}if(Ve.hasStandardBrowserEnv&&(s&&L.isFunction(s)&&(s=s(r)),s||s!==!1&&Nv(r.url))){const o=n&&l&&_v.read(l);o&&i.set(n,o)}return r},Ev=typeof XMLHttpRequest<"u",Rv=Ev&&function(e){return new Promise(function(a,s){const n=Ng(e);let l=n.data;const i=st.from(n.headers).normalize();let{responseType:u,onUploadProgress:o,onDownloadProgress:c}=n,d,m,p,j,v;function y(){j&&j(),v&&v(),n.cancelToken&&n.cancelToken.unsubscribe(d),n.signal&&n.signal.removeEventListener("abort",d)}let f=new XMLHttpRequest;f.open(n.method.toUpperCase(),n.url,!0),f.timeout=n.timeout;function k(){if(!f)return;const g=st.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),w={data:!u||u==="text"||u==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:g,config:e,request:f};jg(function(C){a(C),y()},function(C){s(C),y()},w),f=null}"onloadend"in f?f.onloadend=k:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(k)},f.onabort=function(){f&&(s(new se("Request aborted",se.ECONNABORTED,e,f)),f=null)},f.onerror=function(h){const w=h&&h.message?h.message:"Network Error",S=new se(w,se.ERR_NETWORK,e,f);S.event=h||null,s(S),f=null},f.ontimeout=function(){let h=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const w=n.transitional||bg;n.timeoutErrorMessage&&(h=n.timeoutErrorMessage),s(new se(h,w.clarifyTimeoutError?se.ETIMEDOUT:se.ECONNABORTED,e,f)),f=null},l===void 0&&i.setContentType(null),"setRequestHeader"in f&&L.forEach(i.toJSON(),function(h,w){f.setRequestHeader(w,h)}),L.isUndefined(n.withCredentials)||(f.withCredentials=!!n.withCredentials),u&&u!=="json"&&(f.responseType=n.responseType),c&&([p,v]=hl(c,!0),f.addEventListener("progress",p)),o&&f.upload&&([m,j]=hl(o),f.upload.addEventListener("progress",m),f.upload.addEventListener("loadend",j)),(n.cancelToken||n.signal)&&(d=g=>{f&&(s(!g||g.type?new Ua(null,e,f):g),f.abort(),f=null)},n.cancelToken&&n.cancelToken.subscribe(d),n.signal&&(n.signal.aborted?d():n.signal.addEventListener("abort",d)));const x=kv(n.url);if(x&&Ve.protocols.indexOf(x)===-1){s(new se("Unsupported protocol "+x+":",se.ERR_BAD_REQUEST,e));return}f.send(l||null)})},Pv=(e,r)=>{const{length:a}=e=e?e.filter(Boolean):[];if(r||a){let s=new AbortController,n;const l=function(c){if(!n){n=!0,u();const d=c instanceof Error?c:this.reason;s.abort(d instanceof se?d:new Ua(d instanceof Error?d.message:d))}};let i=r&&setTimeout(()=>{i=null,l(new se(`timeout ${r} of ms exceeded`,se.ETIMEDOUT))},r);const u=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(l):c.removeEventListener("abort",l)}),e=null)};e.forEach(c=>c.addEventListener("abort",l));const{signal:o}=s;return o.unsubscribe=()=>L.asap(u),o}},Dv=function*(e,r){let a=e.byteLength;if(a<r){yield e;return}let s=0,n;for(;s<a;)n=s+r,yield e.slice(s,n),s=n},Mv=async function*(e,r){for await(const a of Av(e))yield*Dv(a,r)},Av=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const r=e.getReader();try{for(;;){const{done:a,value:s}=await r.read();if(a)break;yield s}}finally{await r.cancel()}},pu=(e,r,a,s)=>{const n=Mv(e,r);let l=0,i,u=o=>{i||(i=!0,s&&s(o))};return new ReadableStream({async pull(o){try{const{done:c,value:d}=await n.next();if(c){u(),o.close();return}let m=d.byteLength;if(a){let p=l+=m;a(p)}o.enqueue(new Uint8Array(d))}catch(c){throw u(c),c}},cancel(o){return u(o),n.return()}},{highWaterMark:2})},fu=64*1024,{isFunction:xn}=L,Fv=(({Request:e,Response:r})=>({Request:e,Response:r}))(L.global),{ReadableStream:yu,TextEncoder:bu}=L.global,vu=(e,...r)=>{try{return!!e(...r)}catch{return!1}},Tv=e=>{e=L.merge.call({skipUndefined:!0},Fv,e);const{fetch:r,Request:a,Response:s}=e,n=r?xn(r):typeof fetch=="function",l=xn(a),i=xn(s);if(!n)return!1;const u=n&&xn(yu),o=n&&(typeof bu=="function"?(v=>y=>v.encode(y))(new bu):async v=>new Uint8Array(await new a(v).arrayBuffer())),c=l&&u&&vu(()=>{let v=!1;const y=new a(Ve.origin,{body:new yu,method:"POST",get duplex(){return v=!0,"half"}}).headers.has("Content-Type");return v&&!y}),d=i&&u&&vu(()=>L.isReadableStream(new s("").body)),m={stream:d&&(v=>v.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!m[v]&&(m[v]=(y,f)=>{let k=y&&y[v];if(k)return k.call(y);throw new se(`Response type '${v}' is not supported`,se.ERR_NOT_SUPPORT,f)})});const p=async v=>{if(v==null)return 0;if(L.isBlob(v))return v.size;if(L.isSpecCompliantForm(v))return(await new a(Ve.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(L.isArrayBufferView(v)||L.isArrayBuffer(v))return v.byteLength;if(L.isURLSearchParams(v)&&(v=v+""),L.isString(v))return(await o(v)).byteLength},j=async(v,y)=>{const f=L.toFiniteNumber(v.getContentLength());return f??p(y)};return async v=>{let{url:y,method:f,data:k,signal:x,cancelToken:g,timeout:h,onDownloadProgress:w,onUploadProgress:S,responseType:C,headers:N,withCredentials:D="same-origin",fetchOptions:R}=Ng(v),F=r||fetch;C=C?(C+"").toLowerCase():"text";let A=Pv([x,g&&g.toAbortSignal()],h),P=null;const M=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let T;try{if(S&&c&&f!=="get"&&f!=="head"&&(T=await j(N,k))!==0){let J=new a(y,{method:"POST",body:k,duplex:"half"}),X;if(L.isFormData(k)&&(X=J.headers.get("content-type"))&&N.setContentType(X),J.body){const[z,E]=gu(T,hl(xu(S)));k=pu(J.body,fu,z,E)}}L.isString(D)||(D=D?"include":"omit");const _=l&&"credentials"in a.prototype,H={...R,signal:A,method:f.toUpperCase(),headers:N.normalize().toJSON(),body:k,duplex:"half",credentials:_?D:void 0};P=l&&new a(y,H);let B=await(l?F(P,R):F(y,H));const U=d&&(C==="stream"||C==="response");if(d&&(w||U&&M)){const J={};["status","statusText","headers"].forEach($=>{J[$]=B[$]});const X=L.toFiniteNumber(B.headers.get("content-length")),[z,E]=w&&gu(X,hl(xu(w),!0))||[];B=new s(pu(B.body,fu,z,()=>{E&&E(),M&&M()}),J)}C=C||"text";let V=await m[L.findKey(m,C)||"text"](B,v);return!U&&M&&M(),await new Promise((J,X)=>{jg(J,X,{data:V,headers:st.from(B.headers),status:B.status,statusText:B.statusText,config:v,request:P})})}catch(_){throw M&&M(),_&&_.name==="TypeError"&&/Load failed|fetch/i.test(_.message)?Object.assign(new se("Network Error",se.ERR_NETWORK,v,P),{cause:_.cause||_}):se.from(_,_&&_.code,v,P)}}},Lv=new Map,_g=e=>{let r=e&&e.env||{};const{fetch:a,Request:s,Response:n}=r,l=[s,n,a];let i=l.length,u=i,o,c,d=Lv;for(;u--;)o=l[u],c=d.get(o),c===void 0&&d.set(o,c=u?new Map:Tv(r)),d=c;return c};_g();const zd={http:Zb,xhr:Rv,fetch:{get:_g}};L.forEach(zd,(e,r)=>{if(e){try{Object.defineProperty(e,"name",{value:r})}catch{}Object.defineProperty(e,"adapterName",{value:r})}});const ku=e=>`- ${e}`,Ov=e=>L.isFunction(e)||e===null||e===!1;function Iv(e,r){e=L.isArray(e)?e:[e];const{length:a}=e;let s,n;const l={};for(let i=0;i<a;i++){s=e[i];let u;if(n=s,!Ov(s)&&(n=zd[(u=String(s)).toLowerCase()],n===void 0))throw new se(`Unknown adapter '${u}'`);if(n&&(L.isFunction(n)||(n=n.get(r))))break;l[u||"#"+i]=n}if(!n){const i=Object.entries(l).map(([o,c])=>`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let u=a?i.length>1?`since :
`+i.map(ku).join(`
`):" "+ku(i[0]):"as no adapter specified";throw new se("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return n}const Sg={getAdapter:Iv,adapters:zd};function Si(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ua(null,e)}function ju(e){return Si(e),e.headers=st.from(e.headers),e.data=_i.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Sg.getAdapter(e.adapter||Ws.adapter,e)(e).then(function(s){return Si(e),s.data=_i.call(e,e.transformResponse,s),s.headers=st.from(s.headers),s},function(s){return kg(s)||(Si(e),s&&s.response&&(s.response.data=_i.call(e,e.transformResponse,s.response),s.response.headers=st.from(s.response.headers))),Promise.reject(s)})}const Cg="1.13.2",Ul={};["object","boolean","number","function","string","symbol"].forEach((e,r)=>{Ul[e]=function(s){return typeof s===e||"a"+(r<1?"n ":" ")+e}});const wu={};Ul.transitional=function(r,a,s){function n(l,i){return"[Axios v"+Cg+"] Transitional option '"+l+"'"+i+(s?". "+s:"")}return(l,i,u)=>{if(r===!1)throw new se(n(i," has been removed"+(a?" in "+a:"")),se.ERR_DEPRECATED);return a&&!wu[i]&&(wu[i]=!0,console.warn(n(i," has been deprecated since v"+a+" and will be removed in the near future"))),r?r(l,i,u):!0}};Ul.spelling=function(r){return(a,s)=>(console.warn(`${s} is likely a misspelling of ${r}`),!0)};function Bv(e,r,a){if(typeof e!="object")throw new se("options must be an object",se.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let n=s.length;for(;n-- >0;){const l=s[n],i=r[l];if(i){const u=e[l],o=u===void 0||i(u,l,e);if(o!==!0)throw new se("option "+l+" must be "+o,se.ERR_BAD_OPTION_VALUE);continue}if(a!==!0)throw new se("Unknown option "+l,se.ERR_BAD_OPTION)}}const $n={assertOptions:Bv,validators:Ul},zt=$n.validators;let Ur=class{constructor(r){this.defaults=r||{},this.interceptors={request:new uu,response:new uu}}async request(r,a){try{return await this._request(r,a)}catch(s){if(s instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const l=n.stack?n.stack.replace(/^.+\n/,""):"";try{s.stack?l&&!String(s.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(s.stack+=`
`+l):s.stack=l}catch{}}throw s}}_request(r,a){typeof r=="string"?(a=a||{},a.url=r):a=r||{},a=Yr(this.defaults,a);const{transitional:s,paramsSerializer:n,headers:l}=a;s!==void 0&&$n.assertOptions(s,{silentJSONParsing:zt.transitional(zt.boolean),forcedJSONParsing:zt.transitional(zt.boolean),clarifyTimeoutError:zt.transitional(zt.boolean)},!1),n!=null&&(L.isFunction(n)?a.paramsSerializer={serialize:n}:$n.assertOptions(n,{encode:zt.function,serialize:zt.function},!0)),a.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?a.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:a.allowAbsoluteUrls=!0),$n.assertOptions(a,{baseUrl:zt.spelling("baseURL"),withXsrfToken:zt.spelling("withXSRFToken")},!0),a.method=(a.method||this.defaults.method||"get").toLowerCase();let i=l&&L.merge(l.common,l[a.method]);l&&L.forEach(["delete","get","head","post","put","patch","common"],v=>{delete l[v]}),a.headers=st.concat(i,l);const u=[];let o=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(a)===!1||(o=o&&y.synchronous,u.unshift(y.fulfilled,y.rejected))});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let d,m=0,p;if(!o){const v=[ju.bind(this),void 0];for(v.unshift(...u),v.push(...c),p=v.length,d=Promise.resolve(a);m<p;)d=d.then(v[m++],v[m++]);return d}p=u.length;let j=a;for(;m<p;){const v=u[m++],y=u[m++];try{j=v(j)}catch(f){y.call(this,f);break}}try{d=ju.call(this,j)}catch(v){return Promise.reject(v)}for(m=0,p=c.length;m<p;)d=d.then(c[m++],c[m++]);return d}getUri(r){r=Yr(this.defaults,r);const a=wg(r.baseURL,r.url,r.allowAbsoluteUrls);return yg(a,r.params,r.paramsSerializer)}};L.forEach(["delete","get","head","options"],function(r){Ur.prototype[r]=function(a,s){return this.request(Yr(s||{},{method:r,url:a,data:(s||{}).data}))}});L.forEach(["post","put","patch"],function(r){function a(s){return function(l,i,u){return this.request(Yr(u||{},{method:r,headers:s?{"Content-Type":"multipart/form-data"}:{},url:l,data:i}))}}Ur.prototype[r]=a(),Ur.prototype[r+"Form"]=a(!0)});let $v=class Eg{constructor(r){if(typeof r!="function")throw new TypeError("executor must be a function.");let a;this.promise=new Promise(function(l){a=l});const s=this;this.promise.then(n=>{if(!s._listeners)return;let l=s._listeners.length;for(;l-- >0;)s._listeners[l](n);s._listeners=null}),this.promise.then=n=>{let l;const i=new Promise(u=>{s.subscribe(u),l=u}).then(n);return i.cancel=function(){s.unsubscribe(l)},i},r(function(l,i,u){s.reason||(s.reason=new Ua(l,i,u),a(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(r){if(this.reason){r(this.reason);return}this._listeners?this._listeners.push(r):this._listeners=[r]}unsubscribe(r){if(!this._listeners)return;const a=this._listeners.indexOf(r);a!==-1&&this._listeners.splice(a,1)}toAbortSignal(){const r=new AbortController,a=s=>{r.abort(s)};return this.subscribe(a),r.signal.unsubscribe=()=>this.unsubscribe(a),r.signal}static source(){let r;return{token:new Eg(function(n){r=n}),cancel:r}}};function zv(e){return function(a){return e.apply(null,a)}}function Uv(e){return L.isObject(e)&&e.isAxiosError===!0}const Co={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Co).forEach(([e,r])=>{Co[r]=e});function Rg(e){const r=new Ur(e),a=lg(Ur.prototype.request,r);return L.extend(a,Ur.prototype,r,{allOwnKeys:!0}),L.extend(a,r,null,{allOwnKeys:!0}),a.create=function(n){return Rg(Yr(e,n))},a}const Ce=Rg(Ws);Ce.Axios=Ur;Ce.CanceledError=Ua;Ce.CancelToken=$v;Ce.isCancel=kg;Ce.VERSION=Cg;Ce.toFormData=zl;Ce.AxiosError=se;Ce.Cancel=Ce.CanceledError;Ce.all=function(r){return Promise.all(r)};Ce.spread=zv;Ce.isAxiosError=Uv;Ce.mergeConfig=Yr;Ce.AxiosHeaders=st;Ce.formToJSON=e=>vg(L.isHTMLForm(e)?new FormData(e):e);Ce.getAdapter=Sg.getAdapter;Ce.HttpStatusCode=Co;Ce.default=Ce;const{Axios:jN,AxiosError:wN,CanceledError:NN,isCancel:_N,CancelToken:SN,VERSION:CN,all:EN,Cancel:RN,isAxiosError:PN,spread:DN,toFormData:MN,AxiosHeaders:AN,HttpStatusCode:FN,formToJSON:TN,getAdapter:LN,mergeConfig:ON}=Ce,Pg="/api";let Vr=null;const Ud=async()=>{try{return Vr=(await Ce.get(`${Pg}/csrf-token`,{withCredentials:!0})).data.csrfToken,Vr}catch(e){return console.error("Failed to fetch CSRF token:",e),null}};Ud();const Y=Ce.create({baseURL:Pg,headers:{"Content-Type":"application/json"},withCredentials:!0});Y.interceptors.request.use(async e=>{const r=localStorage.getItem("token");return r&&(e.headers.Authorization=`Bearer ${r}`),["post","put","delete","patch"].includes(e.method.toLowerCase())&&(Vr||await Ud(),Vr&&(e.headers["X-CSRF-Token"]=Vr)),e},e=>Promise.reject(e));Y.interceptors.response.use(e=>e,async e=>{var a,s,n,l;const r=e.config;return((a=e.response)==null?void 0:a.status)===403&&((n=(s=e.response)==null?void 0:s.data)==null?void 0:n.message)==="Invalid CSRF token"&&!r._retry&&(r._retry=!0,await Ud(),Vr)?(r.headers["X-CSRF-Token"]=Vr,Y(r)):(((l=e.response)==null?void 0:l.status)===401&&(localStorage.removeItem("token"),localStorage.removeItem("user")),Promise.reject(e))});const Nu={login:e=>Y.post("/auth/login",e),getMe:()=>Y.get("/auth/me"),changePassword:e=>Y.put("/auth/change-password",e),request:()=>Y.get("/request")},sa={getAll:()=>Y.get("/users"),create:e=>Y.post("/users",e),update:(e,r)=>Y.put(`/users/${e}`,r,{headers:{"Content-Type":"multipart/form-data"}}),delete:e=>Y.delete(`/users/${e}`),toggleStatus:e=>Y.patch(`/users/${e}/toggle-status`),getAllActivity:()=>Y.get("/users/activity")},hn={getAll:()=>Y.get("/buildings"),getById:e=>Y.get(`/buildings/${e}`),create:e=>Y.post("/buildings",e,{headers:{"Content-Type":"multipart/form-data"}}),update:(e,r)=>Y.put(`/buildings/${e}`,r,{headers:{"Content-Type":"multipart/form-data"}}),delete:e=>Y.delete(`/buildings/${e}`)},ra={getAll:()=>Y.get("/floors"),getById:e=>Y.get(`/floors/${e}`),create:e=>Y.post("/floors",e),update:(e,r)=>Y.put(`/floors/${e}`,r),delete:e=>Y.delete(`/floors/${e}`),getBybuildId:e=>Y.get("/floors",{params:{building_id:e}})},es={getAll:()=>Y.get("/rooms"),getById:e=>Y.get(`/rooms/${e}`),create:e=>Y.post("/rooms",e),update:(e,r)=>Y.put(`/rooms/${e}`,r),delete:e=>Y.delete(`/rooms/${e}`)},pn={getAll:()=>Y.get("/beds"),getById:e=>Y.get(`/beds/${e}`),create:e=>Y.post("/beds",e),update:(e,r)=>Y.put(`/beds/${e}`,r),delete:e=>Y.delete(`/beds/${e}`)},fn={getAll:()=>Y.get("/renters"),getById:e=>Y.get(`/renters/${e}`),create:async e=>{const r=new FormData;return Object.entries(e).forEach(([a,s])=>{s!=null&&typeof s!="object"&&r.append(a,s)}),e.preferences&&r.append("preferences",JSON.stringify(e.preferences)),await Hv(r,e.documents||[]),Y.post("/renters",r,{headers:{"Content-Type":"multipart/form-data"}})},update:(e,r)=>Y.put(`/renters/${e}`,r),delete:e=>Y.delete(`/renters/${e}`)},yn={getAll:()=>Y.get("/rents"),getById:e=>Y.get(`/rents/${e}`),create:e=>Y.post("/rents",e),update:(e,r)=>Y.put(`/rents/${e}`,r),delete:e=>Y.delete(`/rents/${e}`)},bn={getAll:()=>Y.get("/maintenance"),getById:e=>Y.get(`/maintenance/${e}`),create:e=>Y.post("/maintenance",e),update:(e,r)=>Y.put(`/maintenance/${e}`,r),delete:e=>Y.delete(`/maintenance/${e}`)},vn={getAll:()=>Y.get("/expense"),getById:e=>Y.get(`/expense/${e}`),create:e=>Y.post("/expense",e,{headers:{"Content-Type":"multipart/form-data"}}),update:(e,r)=>Y.put(`/expense/${e}`,r,{headers:{"Content-Type":"multipart/form-data"}}),delete:e=>Y.delete(`/expense/${e}`)},kn={getAll:()=>Y.get("/notices"),getById:e=>Y.get(`/notices/${e}`),create:e=>Y.post("/notices",e),update:(e,r)=>Y.put(`/notices/${e}`,r),delete:e=>Y.delete(`/notices/${e}`)},ts={getAll:()=>Y.get("/visitors"),getById:e=>Y.get(`/visitors/${e}`),create:e=>Y.post("/visitors",e),update:(e,r)=>Y.put(`/visitors/${e}`,r),delete:e=>Y.delete(`/visitors/${e}`),checkout:e=>Y.post(`/visitors/checkout/${e}`)},_u={getAll:()=>Y.get("/settings"),update:e=>Y.post("/settings",e,{headers:{"Content-Type":"multipart/form-data"}})},Su={uploadRenterDocument:(e,r,a,s)=>{console.log(a);const n=new FormData;return n.append("file",a),n.append("description",s),Y.post(`/upload/renter/${e}/${r}`,n,{headers:{"Content-Type":"multipart/form-data"}})},deleteDocument:e=>Y.delete(`/upload/document/${e}`)},jn={getAll:()=>Y.get("/category"),getById:e=>Y.get(`/category/${e}`),create:e=>Y.post("/category",e),update:(e,r)=>Y.put(`/category/${e}`,r),delete:e=>Y.delete(`/category/${e}`)},Vv={download:()=>Y.get("/request/download/apk")};async function Hv(e,r){for(let s=0;s<r.length;s++){const n=r[s];if(n.file_url&&n.file_name){const i=await(await fetch(n.file_url)).blob();e.append("documents",i,n.file_name)}}const a=r.map(({description:s,type:n,file_name:l})=>({description:s,type:n,file_name:l}));e.append("documentsMeta",JSON.stringify(a))}let qv={data:""},Wv=e=>{if(typeof window=="object"){let r=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return r.nonce=window.__nonce__,r.parentNode||(e||document.head).appendChild(r),r.firstChild}return e||qv},Qv=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Jv=/\/\*[^]*?\*\/| +/g,Cu=/\n+/g,hr=(e,r)=>{let a="",s="",n="";for(let l in e){let i=e[l];l[0]=="@"?l[1]=="i"?a=l+" "+i+";":s+=l[1]=="f"?hr(i,l):l+"{"+hr(i,l[1]=="k"?"":r)+"}":typeof i=="object"?s+=hr(i,r?r.replace(/([^,])+/g,u=>l.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,o=>/&/.test(o)?o.replace(/&/g,u):u?u+" "+o:o)):l):i!=null&&(l=/^--/.test(l)?l:l.replace(/[A-Z]/g,"-$&").toLowerCase(),n+=hr.p?hr.p(l,i):l+":"+i+";")}return a+(r&&n?r+"{"+n+"}":n)+s},Yt={},Dg=e=>{if(typeof e=="object"){let r="";for(let a in e)r+=a+Dg(e[a]);return r}return e},Yv=(e,r,a,s,n)=>{let l=Dg(e),i=Yt[l]||(Yt[l]=(o=>{let c=0,d=11;for(;c<o.length;)d=101*d+o.charCodeAt(c++)>>>0;return"go"+d})(l));if(!Yt[i]){let o=l!==e?e:(c=>{let d,m,p=[{}];for(;d=Qv.exec(c.replace(Jv,""));)d[4]?p.shift():d[3]?(m=d[3].replace(Cu," ").trim(),p.unshift(p[0][m]=p[0][m]||{})):p[0][d[1]]=d[2].replace(Cu," ").trim();return p[0]})(e);Yt[i]=hr(n?{["@keyframes "+i]:o}:o,a?"":"."+i)}let u=a&&Yt.g?Yt.g:null;return a&&(Yt.g=Yt[i]),((o,c,d,m)=>{m?c.data=c.data.replace(m,o):c.data.indexOf(o)===-1&&(c.data=d?o+c.data:c.data+o)})(Yt[i],r,s,u),i},Xv=(e,r,a)=>e.reduce((s,n,l)=>{let i=r[l];if(i&&i.call){let u=i(a),o=u&&u.props&&u.props.className||/^go/.test(u)&&u;i=o?"."+o:u&&typeof u=="object"?u.props?"":hr(u,""):u===!1?"":u}return s+n+(i??"")},"");function Vl(e){let r=this||{},a=e.call?e(r.p):e;return Yv(a.unshift?a.raw?Xv(a,[].slice.call(arguments,1),r.p):a.reduce((s,n)=>Object.assign(s,n&&n.call?n(r.p):n),{}):a,Wv(r.target),r.g,r.o,r.k)}let Mg,Eo,Ro;Vl.bind({g:1});let ir=Vl.bind({k:1});function Kv(e,r,a,s){hr.p=r,Mg=e,Eo=a,Ro=s}function Mr(e,r){let a=this||{};return function(){let s=arguments;function n(l,i){let u=Object.assign({},l),o=u.className||n.className;a.p=Object.assign({theme:Eo&&Eo()},u),a.o=/ *go\d+/.test(o),u.className=Vl.apply(a,s)+(o?" "+o:"");let c=e;return e[0]&&(c=u.as||e,delete u.as),Ro&&c[0]&&Ro(u),Mg(c,u)}return n}}var Gv=e=>typeof e=="function",pl=(e,r)=>Gv(e)?e(r):e,Zv=(()=>{let e=0;return()=>(++e).toString()})(),Ag=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let r=matchMedia("(prefers-reduced-motion: reduce)");e=!r||r.matches}return e}})(),ek=20,Vd="default",Fg=(e,r)=>{let{toastLimit:a}=e.settings;switch(r.type){case 0:return{...e,toasts:[r.toast,...e.toasts].slice(0,a)};case 1:return{...e,toasts:e.toasts.map(i=>i.id===r.toast.id?{...i,...r.toast}:i)};case 2:let{toast:s}=r;return Fg(e,{type:e.toasts.find(i=>i.id===s.id)?1:0,toast:s});case 3:let{toastId:n}=r;return{...e,toasts:e.toasts.map(i=>i.id===n||n===void 0?{...i,dismissed:!0,visible:!1}:i)};case 4:return r.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(i=>i.id!==r.toastId)};case 5:return{...e,pausedAt:r.time};case 6:let l=r.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+l}))}}},zn=[],Tg={toasts:[],pausedAt:void 0,settings:{toastLimit:ek}},Ht={},Lg=(e,r=Vd)=>{Ht[r]=Fg(Ht[r]||Tg,e),zn.forEach(([a,s])=>{a===r&&s(Ht[r])})},Og=e=>Object.keys(Ht).forEach(r=>Lg(e,r)),tk=e=>Object.keys(Ht).find(r=>Ht[r].toasts.some(a=>a.id===e)),Hl=(e=Vd)=>r=>{Lg(r,e)},rk={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},ak=(e={},r=Vd)=>{let[a,s]=b.useState(Ht[r]||Tg),n=b.useRef(Ht[r]);b.useEffect(()=>(n.current!==Ht[r]&&s(Ht[r]),zn.push([r,s]),()=>{let i=zn.findIndex(([u])=>u===r);i>-1&&zn.splice(i,1)}),[r]);let l=a.toasts.map(i=>{var u,o,c;return{...e,...e[i.type],...i,removeDelay:i.removeDelay||((u=e[i.type])==null?void 0:u.removeDelay)||(e==null?void 0:e.removeDelay),duration:i.duration||((o=e[i.type])==null?void 0:o.duration)||(e==null?void 0:e.duration)||rk[i.type],style:{...e.style,...(c=e[i.type])==null?void 0:c.style,...i.style}}});return{...a,toasts:l}},sk=(e,r="blank",a)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:r,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...a,id:(a==null?void 0:a.id)||Zv()}),Qs=e=>(r,a)=>{let s=sk(r,e,a);return Hl(s.toasterId||tk(s.id))({type:2,toast:s}),s.id},q=(e,r)=>Qs("blank")(e,r);q.error=Qs("error");q.success=Qs("success");q.loading=Qs("loading");q.custom=Qs("custom");q.dismiss=(e,r)=>{let a={type:3,toastId:e};r?Hl(r)(a):Og(a)};q.dismissAll=e=>q.dismiss(void 0,e);q.remove=(e,r)=>{let a={type:4,toastId:e};r?Hl(r)(a):Og(a)};q.removeAll=e=>q.remove(void 0,e);q.promise=(e,r,a)=>{let s=q.loading(r.loading,{...a,...a==null?void 0:a.loading});return typeof e=="function"&&(e=e()),e.then(n=>{let l=r.success?pl(r.success,n):void 0;return l?q.success(l,{id:s,...a,...a==null?void 0:a.success}):q.dismiss(s),n}).catch(n=>{let l=r.error?pl(r.error,n):void 0;l?q.error(l,{id:s,...a,...a==null?void 0:a.error}):q.dismiss(s)}),e};var nk=1e3,lk=(e,r="default")=>{let{toasts:a,pausedAt:s}=ak(e,r),n=b.useRef(new Map).current,l=b.useCallback((m,p=nk)=>{if(n.has(m))return;let j=setTimeout(()=>{n.delete(m),i({type:4,toastId:m})},p);n.set(m,j)},[]);b.useEffect(()=>{if(s)return;let m=Date.now(),p=a.map(j=>{if(j.duration===1/0)return;let v=(j.duration||0)+j.pauseDuration-(m-j.createdAt);if(v<0){j.visible&&q.dismiss(j.id);return}return setTimeout(()=>q.dismiss(j.id,r),v)});return()=>{p.forEach(j=>j&&clearTimeout(j))}},[a,s,r]);let i=b.useCallback(Hl(r),[r]),u=b.useCallback(()=>{i({type:5,time:Date.now()})},[i]),o=b.useCallback((m,p)=>{i({type:1,toast:{id:m,height:p}})},[i]),c=b.useCallback(()=>{s&&i({type:6,time:Date.now()})},[s,i]),d=b.useCallback((m,p)=>{let{reverseOrder:j=!1,gutter:v=8,defaultPosition:y}=p||{},f=a.filter(g=>(g.position||y)===(m.position||y)&&g.height),k=f.findIndex(g=>g.id===m.id),x=f.filter((g,h)=>h<k&&g.visible).length;return f.filter(g=>g.visible).slice(...j?[x+1]:[0,x]).reduce((g,h)=>g+(h.height||0)+v,0)},[a]);return b.useEffect(()=>{a.forEach(m=>{if(m.dismissed)l(m.id,m.removeDelay);else{let p=n.get(m.id);p&&(clearTimeout(p),n.delete(m.id))}})},[a,l]),{toasts:a,handlers:{updateHeight:o,startPause:u,endPause:c,calculateOffset:d}}},ik=ir`
from {
transform: scale(0) rotate(45deg);
opacity: 0;
}
to {
transform: scale(1) rotate(45deg);
opacity: 1;
}`,ok=ir`
from {
transform: scale(0);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}`,dk=ir`
from {
transform: scale(0) rotate(90deg);
opacity: 0;
}
to {
transform: scale(1) rotate(90deg);
opacity: 1;
}`,ck=Mr("div")`
width: 20px;
opacity: 0;
height: 20px;
border-radius: 10px;
background: ${e=>e.primary||"#ff4b4b"};
position: relative;
transform: rotate(45deg);
animation: ${ik} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
animation-delay: 100ms;
&:after,
&:before {
content: '';
animation: ${ok} 0.15s ease-out forwards;
animation-delay: 150ms;
position: absolute;
border-radius: 3px;
opacity: 0;
background: ${e=>e.secondary||"#fff"};
bottom: 9px;
left: 4px;
height: 2px;
width: 12px;
}
&:before {
animation: ${dk} 0.15s ease-out forwards;
animation-delay: 180ms;
transform: rotate(90deg);
}
`,uk=ir`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`,mk=Mr("div")`
width: 12px;
height: 12px;
box-sizing: border-box;
border: 2px solid;
border-radius: 100%;
border-color: ${e=>e.secondary||"#e0e0e0"};
border-right-color: ${e=>e.primary||"#616161"};
animation: ${uk} 1s linear infinite;
`,gk=ir`
from {
transform: scale(0) rotate(45deg);
opacity: 0;
}
to {
transform: scale(1) rotate(45deg);
opacity: 1;
}`,xk=ir`
0% {
height: 0;
width: 0;
opacity: 0;
}
40% {
height: 0;
width: 6px;
opacity: 1;
}
100% {
opacity: 1;
height: 10px;
}`,hk=Mr("div")`
width: 20px;
opacity: 0;
height: 20px;
border-radius: 10px;
background: ${e=>e.primary||"#61d345"};
position: relative;
transform: rotate(45deg);
animation: ${gk} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
animation-delay: 100ms;
&:after {
content: '';
box-sizing: border-box;
animation: ${xk} 0.2s ease-out forwards;
opacity: 0;
animation-delay: 200ms;
position: absolute;
border-right: 2px solid;
border-bottom: 2px solid;
border-color: ${e=>e.secondary||"#fff"};
bottom: 6px;
left: 6px;
height: 10px;
width: 6px;
}
`,pk=Mr("div")`
position: absolute;
`,fk=Mr("div")`
position: relative;
display: flex;
justify-content: center;
align-items: center;
min-width: 20px;
min-height: 20px;
`,yk=ir`
from {
transform: scale(0.6);
opacity: 0.4;
}
to {
transform: scale(1);
opacity: 1;
}`,bk=Mr("div")`
position: relative;
transform: scale(0.6);
opacity: 0.4;
min-width: 20px;
animation: ${yk} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
forwards;
`,vk=({toast:e})=>{let{icon:r,type:a,iconTheme:s}=e;return r!==void 0?typeof r=="string"?b.createElement(bk,null,r):r:a==="blank"?null:b.createElement(fk,null,b.createElement(mk,{...s}),a!=="loading"&&b.createElement(pk,null,a==="error"?b.createElement(ck,{...s}):b.createElement(hk,{...s})))},kk=e=>`
0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`,jk=e=>`
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
`,wk="0%{opacity:0;} 100%{opacity:1;}",Nk="0%{opacity:1;} 100%{opacity:0;}",_k=Mr("div")`
display: flex;
align-items: center;
background: #fff;
color: #363636;
line-height: 1.3;
will-change: transform;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
max-width: 350px;
pointer-events: auto;
padding: 8px 10px;
border-radius: 8px;
`,Sk=Mr("div")`
display: flex;
justify-content: center;
margin: 4px 10px;
color: inherit;
flex: 1 1 auto;
white-space: pre-line;
`,Ck=(e,r)=>{let a=e.includes("top")?1:-1,[s,n]=Ag()?[wk,Nk]:[kk(a),jk(a)];return{animation:r?`${ir(s)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ir(n)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},Ek=b.memo(({toast:e,position:r,style:a,children:s})=>{let n=e.height?Ck(e.position||r||"top-center",e.visible):{opacity:0},l=b.createElement(vk,{toast:e}),i=b.createElement(Sk,{...e.ariaProps},pl(e.message,e));return b.createElement(_k,{className:e.className,style:{...n,...a,...e.style}},typeof s=="function"?s({icon:l,message:i}):b.createElement(b.Fragment,null,l,i))});Kv(b.createElement);var Rk=({id:e,className:r,style:a,onHeightUpdate:s,children:n})=>{let l=b.useCallback(i=>{if(i){let u=()=>{let o=i.getBoundingClientRect().height;s(e,o)};u(),new MutationObserver(u).observe(i,{subtree:!0,childList:!0,characterData:!0})}},[e,s]);return b.createElement("div",{ref:l,className:r,style:a},n)},Pk=(e,r)=>{let a=e.includes("top"),s=a?{top:0}:{bottom:0},n=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Ag()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${r*(a?1:-1)}px)`,...s,...n}},Dk=Vl`
z-index: 9999;
> * {
pointer-events: auto;
}
`,wn=16,Mk=({reverseOrder:e,position:r="top-center",toastOptions:a,gutter:s,children:n,toasterId:l,containerStyle:i,containerClassName:u})=>{let{toasts:o,handlers:c}=lk(a,l);return b.createElement("div",{"data-rht-toaster":l||"",style:{position:"fixed",zIndex:9999,top:wn,left:wn,right:wn,bottom:wn,pointerEvents:"none",...i},className:u,onMouseEnter:c.startPause,onMouseLeave:c.endPause},o.map(d=>{let m=d.position||r,p=c.calculateOffset(d,{reverseOrder:e,gutter:s,defaultPosition:r}),j=Pk(m,p);return b.createElement(Rk,{id:d.id,key:d.id,onHeightUpdate:c.updateHeight,className:d.visible?Dk:"",style:j},d.type==="custom"?pl(d.message,d):n?n(d):b.createElement(Ek,{toast:d,position:m}))}))};const Ig=b.createContext(void 0),ie=()=>{const e=b.useContext(Ig);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},Ak=({children:e})=>{const[r,a]=b.useState(null),[s,n]=b.useState([]),[l,i]=b.useState(!1),[u,o]=b.useState(!0),c=()=>{localStorage.removeItem("token"),localStorage.removeItem("user"),localStorage.removeItem("token_expiry"),a(null),i(!1)},d=()=>{if(localStorage.getItem("token")){const h=Date.now()+18e5;localStorage.setItem("token_expiry",h.toString())}},m=async()=>{const g=localStorage.getItem("token"),h=localStorage.getItem("token_expiry");if(g&&h)if(Date.now()>Number(h))c();else try{const w=await Nu.getMe();a(w.data),i(!0),d()}catch{c()}o(!1)};b.useEffect(()=>{m()},[]);const p=async(g,h)=>{try{const w=await Nu.login({email:g,password:h}),{token:S,user:C}=w.data;return localStorage.setItem("token",S),localStorage.setItem("user",JSON.stringify(C)),d(),a(C),i(!0),C}catch(w){return w.response.data.message&&q.error(w.response.data.message),console.error("Login error:",w),!1}};b.useEffect(()=>{let g;const h=()=>{const S=localStorage.getItem("token_expiry");if(!S)return;const C=Number(S)-Date.now();C>0?g=setTimeout(()=>{c()},C):c()};l&&h();const w=()=>{d(),clearTimeout(g),h()};return window.addEventListener("click",w),()=>{window.removeEventListener("click",w),clearTimeout(g)}},[l]);const j=g=>r?r.permissions.includes(g):!1,v=async()=>{try{const g=await sa.getAll();n(g.data)}catch(g){console.error("Fetch users error:",g)}};b.useEffect(()=>{l&&v()},[l]);const y=async g=>{try{const h=await sa.create(g);n(w=>[...w,h.data])}catch(h){throw console.error("Add user error:",h),q.error("Add failed"),h}},f=async(g,h)=>{try{const w=await sa.update(g,h);n(S=>S.map(C=>C.id===g?w.data:C)),(r==null?void 0:r.id)===g&&(a(w.data),localStorage.setItem("user",JSON.stringify(w.data))),q.success("Update successful")}catch(w){throw console.error("Update user error:",w),q.error("Update failed"),w}},k=async g=>{try{await sa.delete(g),n(h=>h.filter(w=>w.id!==g))}catch(h){throw console.error("Delete user error:",h),h}},x=async g=>{try{const h=await sa.toggleStatus(g);n(w=>w.map(S=>S.id===g?h.data:S))}catch(h){throw console.error("Toggle user status error:",h),h}};return t.jsx(Ig.Provider,{value:{user:r,users:s,login:p,logout:c,isAuthenticated:l,hasPermission:j,addUser:y,updateUser:f,deleteUser:k,toggleUserStatus:x,fetchUsers:v,loading:u},children:e})},Bg=b.createContext(void 0),$g=()=>{const e=b.useContext(Bg);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},Fk=({children:e})=>{const[r,a]=b.useState(!1);b.useEffect(()=>{const n=localStorage.getItem("theme");n||localStorage.setItem("theme","dark");const l=window.matchMedia("(prefers-color-scheme: dark)").matches;n==="dark"||!n&&l?(a(!0),document.documentElement.classList.add("dark")):(a(!1),document.documentElement.classList.remove("dark"))},[]);const s=()=>{const n=!r;a(n),n?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))};return t.jsx(Bg.Provider,{value:{isDarkMode:r,toggleTheme:s},children:e})},zg=b.createContext(void 0),te=()=>{const e=b.useContext(zg);if(e===void 0)throw new Error("useLanguage must be used within a LanguageProvider");return e},Tk={en:{dashboard:"Dashboard",buildings:"Buildings",rooms:"Rooms",renters:"Renters",rent:"Rent Management",reports:"Reports",settings:"Settings",login:"Login",logout:"Logout",email:"Email",password:"Password",totalBuildings:"Total Buildings",totalRooms:"Total Rooms",totalRenters:"Total Renters",occupancyRate:"Occupancy Rate",monthlyRevenue:"Monthly Revenue",pendingPayments:"Pending Payments",addBuilding:"Add Building",addRoom:"Add Room",addRenter:"Add Renter",name:"Name",address:"Address",floors:"Floors",actions:"Actions",edit:"Edit",delete:"Delete",save:"Save",cancel:"Cancel",phone:"Phone",nid:"NID",room:"Room",bed:"Bed",noDataAvailable:"No Data Available",rentAmount:"Rent Amount",dueDate:"Due Date",status:"Status",paid:"Paid",pending:"Pending",overdue:"Overdue",total_beds:"Total Beds",total_rooms:"Total Rooms",available:"Available",occupied:"Occupied",maintenance:"Maintenance",reserved:"Reserved",allRooms:"All Rooms",allStatus:"All Status",search:"Search",allBuildings:"All Buildings",parking:"Parking",beds:"Beds",parkingSpaces:"Parking Spaces",occupiedBeds:"Occupied Beds",contactNumber:"Contact Number",contactEmail:"Contact Email",openingHours:"Opening Hours",description:"Description",image:"Image",monthlyExpenses:"Monthly Expenses",netIncome:"Net Income",averageRent:"Average Rent",overduePayments:"Overdue Payments",upcomingDues:"Upcoming Dues",maintenanceRequests:"Maintenance Requests",revenue:"Revenue",expenses:"Expenses",revenueAnalytics:"Revenue Analytics",occupancyOverview:"Occupancy Overview",recentActivity:"Recent Activity",maintenanceAlerts:"Maintenance Alerts",quickActions:"Quick Actions",floorManagement:"Floor Management",floorManagementDes:"Manage floors across all buildings with maintenance tracking",addFloor:"Add Floor",residential:"Residential",commercial:"Commercial",needsAttention:"Needs Attention",underMaintenance:"Under Maintenance",totalFloors:"Total Floors",filters:"Filters",recordPayment:"Record Payment",generateReport:"Generate Report",propertiesmanaged:"properties managed",activetenants:"Active tenants",currentoccupancy:"Current occupancy",totalrentcollected:"Total rent collected",operatingcosts:"Operating costs",profitthismonth:"Profit this month",perbedmonth:"Per room/month",awaitingpayment:"Awaiting payment",pastduedate:"Past due date",duethisweek:"Due this week",urgent:"urgent",good:"Good",floor:"Floor",floorName:"Floor Name",notes:"Notes",building:"Building",amenities:"Amenities",noamenities:"No amenities",lastInspection:"Last Inspection",lastInspectionDate:"Last Inspection Date",roomOccupancy:"Room Occupancy",commonArea:"Common Area",allTypes:"All Types",floorTypes:"Floor Types",floorType:"Floor Type",maintenanceStatus:"Maintenance Status",occupiedRooms:"Occupied Rooms",anyadditionalnotes:"Any additional notes about this floor...",update:"Update",create:"Create",editRoom:"Edit Room",editBuilding:"Edit Building",addNewFloor:"Add New Floor",editFloor:"Edit Floor",full:"Full",selectabuilding:"Select a building",selectafloor:"Select a floor",partial:"Partial",roomNumber:"Room Number",facilities:"Facilities",nofacilitiesavailable:"No facilities available",occupancy:"Occupancy",buildinghasbedslimit:"Building has beds limit",buildinghasroomslimit:"Building has rooms limit",rentperbed:"Rent per bed",welcomebackproperties:"Welcome back! Here's what's happening with your properties.",bedManagement:"Bed Management",addBed:"Add Bed",addNewBed:"Add New Bed",editBed:"Edit Bed",bedNumber:"Bed Number",monthlyRent:"Monthly Rent",renter:"Renter",selectarenter:"Select a renter",assignrenter:"Assign Renter",never:"Never",anyadditionalnotesbed:"Any additional notes about this bed...",norenter:"No Renter",location:"Location",lastCleaned:"Last Cleaned",bedDetails:"Bed Details",searchbedsroomsrenters:"Search beds, rooms, renters...",bedManagementdes:"Manage individual beds across all buildings and rooms",selectaroom:"Select a Room",contact:"Contact",company:"Company",days:"days",relation:"Relation",vegetarian:"Vegetarian",both:"Both",references:"References",previousAddress:"Previous Address",additionalInformation:"Additional Information",uploadedDocuments:"Uploaded Documents",uploadFile:"Upload File",documents:"Documents",documentsType:"Documents Type",allowed:"Allowed",smokingAllowed:"Smoking Allowed",petAllowed:"Pet Allowed",restricted:"Restricted",not_allowed:"Not Allowed",guestPolicy:"Guest Policy",non_Vegetarian:"Non-Vegetarian",foodType:"Food Type",preferences:"Preferences",financialInformation:"Financial Information",roomAssignment:"Room Assignment",selectabed:"Select a bed",monthlyIncome:"Monthly Income",occupation:"Occupation",alternatePhone:"Alternate Phone",personalInformation:"Personal Information",roomBed:"Room & Bed",checkin:"Check-in",editRenter:"Edit Renter",securityDeposit:"Security Deposit",noticePeriod:"Notice Period",leaseInformation:"Lease Information",checkinDate:"Check-in Date",leaseStartDate:"Lease Start Date",leaseEndDate:"Lease End Date",emergencyContact:"Emergency Contact",addPayment:"Add Payment",paidPayment:"paid Payment",pendingPayment:"pending Payment",overduePayment:"overdue Payment",period:"Period",month:"Month",year:"Year",paymentDetails:"Payment Details",viewDetails:"View Details",markasPaid:"Mark as Paid",maintenanceManagement:"Maintenance Management",maintenanceManagementdes:"Track and manage maintenance requests across all properties",addMaintenanceRequest:"Add Maintenance Request",totalRequests:"Total Requests",inProgress:"In Progress",completed:"Completed",cancelled:"Cancelled",priority:"Priority",low:"Low",medium:"Medium",high:"High",cost:"Cost",scheduledDate:"Scheduled Date",type:"Type",requestDetails:"Request Details",cleaning:"Cleaning",repair:"Repair",inspection:"Inspection",upgrade:"Upgrade",allpriority:"All Priorities",editMaintenanceRequest:"Edit Maintenance Request",optional:"Optional",assignedTo:"Assigned To",estimatedCost:"Estimated Cost",request:"request",describethemaintenanceissuetask:"Describe the maintenance issue or task...",staffmembercontractorname:"Staff member or contractor name",additionalnotescomments:"Additional notes or comments...",expenseManagement:"Expense Management",expenseManagementdes:"Track and manage all property-related expenses",addExpense:"Add Expense",totalExpenses:"Total Expenses",thisMonth:"This Month",utilities:"Utilities",category:"Category",other:"Other",supplies:"Supplies",staff:"Staff",fromDate:"From Date",toDate:"To Date",allCategories:"All Categories",expenseDetails:"Expense Details",vendor:"Vendor",amount:"Amount",approvedby:"Approved by",editExpense:"Edit Expense",addNewExpense:"Add New Expense",vendorSupplier:"Vendor/Supplier",receiptInvoiceNumber:"Receipt Invoice Number",receiptinvoicereference:"Receipt or invoice reference",manageradminname:"Manager or admin name",companypersonname:"Company or person name",describetheexpense:"Describe the expense...",date:"Date",booked:"Booked",in_progress:"In progress",paid_date:"Paid Date",payment_method:"Payment Method",transactionId:"Transaction ID",reservationNote:"Reservation Information",enterReservationNote:"Add any special instructions or details about this reservation",total_available:"Total Available",total_occupied:"Total Occupied",total_maintenance:"Total Maintenance",total_booked:"Total Booked",allfloors:"All Floors",searchByRoomNumber:"Search By Room Number",document:"Document",uploadedDocument:"Uploaded Document",visitors:"Visitors",visiting:"Visiting",purpose:"Purpose",vehicle:"Vehicle",checkOut:"Check Out",checkinTime:"Check-in Time",checkoutTime:"Check-out Time",visitorDetails:"Visitor Details",todayVisitors:"Today's Visitors",checkedOut:"Checked Out",checkedIn:"Checked In",totalVisitors:"Total Visitors",currentlyInside:"Currently Inside",registerVisitor:"Register Visitor",visitorManagement:"Visitor Management",visitorManagementdes:"Track and manage visitor check-ins and check-outs",searchvisitorsrentersrooms:"Search visitors, renters, rooms...",registerNewVisitor:"Register New Visitor",editVisitor:"Edit Visitor",iDVerified:"ID Verified",register:"Register",visitor:"Visitor",anyadditionalnotesvistor:"Any additional notes about the visit...",visitorName:"Visitor Name",visitorPhone:"Visitor Phone",visitingRenter:"Visiting Renter",purposeofVisit:"Purpose of Visit",vehicleNumber:"Vehicle Number",vehicleNumberDHA:"e.g., DHA-1234",securityguardstaff:"Security guard or staff name",purposeofVisitplace:"e.g., Personal visit, Business meeting, Delivery",advancedReports:"Advanced Reports",advancedReportsdes:"Generate detailed reports with custom filtering options",reportFilters:"Report Filters",paymentStatus:"Payment Status",reportType:"Report Type",summary:"Summary",detailed:"Detailed",comparative:"Comparative",totalRevenue:"Total Revenue",pendingRevenue:"Pending Revenue",netProfit:"Net Profit",exportReports:"Export Reports",revenueReports:"Revenue Reports",expenseReports:"Expense Reports",occupancyReports:"Occupancy Reports",renterReports:"Renter Reports",expenseBreakdowCategory:"Expense Breakdown by Category",staffManagement:"Staff Management",addStaffMember:"Add Staff Member",staffManagementdes:"Manage user accounts and permissions",user:"User",role:"Role",manager:"Manager",admin:"Admin",department:"Department",selectDepartment:"Select Department",phoneNumber:"Phone Number",emailAddress:"Email Address",fullName:"Full Name",roleDepartment:"Role & Department",permissions:"Permissions",lastLogin:"Last Login",activeUser:"Active User",staffMember:"Staff Member",editStaffMember:"Edit Staff Member",viewData:"View Data",viewDatades:"Can view all information",editData:"Edit Data",editDatades:"Can modify existing records",manageRecords:"Manage Records",manageRecordsdes:"Can create and manage records",deleteRecords:"Delete Records",deleteRecordsdes:"Can delete records",generateReports:"Generate Reports",generateReportsdes:"Can access and generate reports",systemSettings:"System Settings",systemSettingsdes:"Can modify system settings",userManagement:"User Management",userManagementdes:"Can manage user accounts",themeSettings:"Theme Settings",currenttheme:"Current theme",darkMode:"Dark Mode",dark:"Dark",light:"Light",avatar:"Avatar",languageSettings:"Language Settings",selectlanguage:"Select Language",profileSettings:"Profile Settings",updateProfile:"Update Profile",currencySettings:"Currency Settings",currencySymbol:"Currency Symbol",countryCode:"Country Code",countryName:"Country Name",applicationSettings:"Application Settings",applicationName:"Application Name",logo:"Logo",favicon:"Favicon",loginbackground:"Login background",smtp:"SMTP",smtpHost:"SMTP Host",smtpPort:"SMTP Port",smtpUsername:"SMTP Username",smtpPassword:"SMTP Password",fromEmail:"From Email",expense:"Expense",completedDate:"Completed Date",availableRooms:"Available Rooms",bookedRooms:"Booked Rooms",oldPassword:"Old Password",newPassword:"New Password",confirmPassword:"Confirm Password",changePassword:"Change Password",totalPayments:"Total Payments",totalMaintenance:"Total Maintenance",joinedAt:" Joined At",searchByRentersId:"Search by Name, Email, Phone, or Emirates ID",renterDetails:"Renter Informations",renterinfo:"Renter Info",financialInfo:"Financial Info",rentInfo:"Rent Info",pendingRent:"Pending Rents",viewAllMaintenanceRequests:"View all maintenance requests",maintenanceDetails:"Maintenance Details",close:"Close",manage:"Manage",user_management:"User Management",noDocuments:"No Documents",accessRestricted:"Access Restricted",accessRestrictedDes:"You must be logged in to view this content.Please sign in to continue.",pageNotFound:"Page Not Found",pageNotFoundDes:"The page you are looking for does not exist or has been moved.",loginNow:"Login to Continue",view_buildings:"Can view buildings",view_floors:"Can view floors",view_rooms:"Can view rooms",view_renters:"Can view renters",view_rents:"Can view rents",view_maintenance:"Can view maintenance",view_expenses:"Can view expenses",view_visitors:"Can view visitors",accessRestrictedPermissionDes:"You do not have the required permissions to view this content."},bn:{dashboard:"ড্যাশবোর্ড",buildings:"বিল্ডিং",rooms:"রুম",renters:"ভাড়াটিয়া",rent:"ভাড়া ব্যবস্থাপনা",reports:"রিপোর্ট",settings:"সেটিংস",login:"লগইন",logout:"লগআউট",email:"ইমেইল",password:"পাসওয়ার্ড",totalBuildings:"মোট বিল্ডিং",totalRooms:"মোট রুম",totalRenters:"মোট ভাড়াটিয়া",occupancyRate:"দখল হার",monthlyRevenue:"মাসিক আয়",pendingPayments:"অপেক্ষমান পেমেন্ট",addBuilding:"বিল্ডিং যোগ করুন",addRoom:"রুম যোগ করুন",addRenter:"ভাড়াটিয়া যোগ করুন",name:"নাম",address:"ঠিকানা",floors:"তলা",actions:"কার্যক্রম",edit:"সম্পাদনা",delete:"মুছে ফেলুন",save:"সংরক্ষণ",cancel:"বাতিল",phone:"ফোন",nid:"এনআইডি",room:"রুম",bed:"বিছানা",rentAmount:"ভাড়ার পরিমাণ",dueDate:"শেষ তারিখ",status:"অবস্থা",paid:"পরিশোধিত",pending:"অপেক্ষমান",overdue:"বকেয়া",total_beds:"মোট বিছানা",total_rooms:"মোট কক্ষ",available:"খালি",occupied:"দখলকৃত",maintenance:"রক্ষণাবেক্ষণ",reserved:"সংরক্ষিত",allRooms:"সকল কক্ষ",allStatus:"সকল অবস্থা",search:"অনুসন্ধান",allBuildings:"সকল ভবন",parking:"পার্কিং",beds:"বিছানা",parkingSpaces:"পার্কিং স্থান",occupiedBeds:"দখলকৃত বিছানা",contactNumber:"যোগাযোগ নম্বর",contactEmail:"যোগাযোগ ইমেইল",openingHours:"খোলার সময়",description:"বর্ণনা",image:"ছবি",monthlyExpenses:"মাসিক খরচ",netIncome:"নিট আয়",averageRent:"গড় ভাড়া",overduePayments:"বাকি পরিশোধ",upcomingDues:"আসন্ন বকেয়া",maintenanceRequests:"রক্ষণাবেক্ষণ অনুরোধ",revenue:"আয়",expenses:"খরচ",revenueAnalytics:"আয় বিশ্লেষণ",occupancyOverview:"দখলসংক্রান্ত পর্যালোচনা",recentActivity:"সাম্প্রতিক কার্যকলাপ",maintenanceAlerts:"রক্ষণাবেক্ষণ সতর্কতা",quickActions:"দ্রুত অ্যাকশন",floorManagement:"ফ্লোর ব্যবস্থাপনা",floorManagementDes:"রক্ষণাবেক্ষণ ট্র্যাকিং সহ সব ভবনের ফ্লোর পরিচালনা করুন",addFloor:"ফ্লোর যোগ করুন",residential:"আবাসিক",commercial:"বাণিজ্যিক",needsAttention:"মনোযোগ প্রয়োজন",underMaintenance:"রক্ষণাবেক্ষণে",totalFloors:"মোট ফ্লোর",filters:"ফিল্টার",recordPayment:"পেমেন্ট রেকর্ড করুন",generateReport:"রিপোর্ট তৈরি করুন",propertiesmanaged:"পরিচালিত সম্পত্তি",activetenants:"সক্রিয় ভাড়াটে",currentoccupancy:"বর্তমান দখল",totalrentcollected:"মোট ভাড়া সংগ্রহ",operatingcosts:"পরিচালন ব্যয়",profitthismonth:"এই মাসের লাভ",perbedmonth:"প্রতি বেড/মাস",awaitingpayment:"পেমেন্টের অপেক্ষায়",pastduedate:"নির্ধারিত সময় পেরিয়ে গেছে",duethisweek:"এই সপ্তাহে বাকি",urgent:"জরুরি",good:"ভালো",floor:"তলা",floorName:"তলার নাম",notes:"নোট",building:"ভবন",amenities:"সুবিধাসমূহ",noamenities:"কোনো সুবিধা নেই",lastInspection:"শেষ পরিদর্শন",lastInspectionDate:"শেষ পরিদর্শনের তারিখ",roomOccupancy:"রুম দখল",commonArea:"সাধারণ এলাকা",allTypes:"সব ধরনের",floorTypes:"তলার ধরনসমূহ",floorType:"তলার ধরন",maintenanceStatus:"রক্ষণাবেক্ষণ অবস্থা",occupiedRooms:"দখলকৃত কক্ষ",anyadditionalnotes:"এই তলা সম্পর্কে কোনো অতিরিক্ত নোট...",update:"আপডেট",create:"তৈরি করুন",editRoom:"রুম সম্পাদনা করুন",editBuilding:"ভবন সম্পাদনা করুন",addNewFloor:"নতুন তলা যোগ করুন",editFloor:"তলা সম্পাদনা করুন",full:"পূর্ণ",selectabuilding:"একটি ভবন নির্বাচন করুন",selectafloor:"একটি তলা নির্বাচন করুন",partial:"আংশিক",roomNumber:"রুম নম্বর",facilities:"সুবিধাসমূহ",nofacilitiesavailable:"কোনো সুবিধা উপলব্ধ নেই",occupancy:"দখল",buildinghasbedslimit:"ভবনের বেড সীমা রয়েছে",buildinghasroomslimit:"ভবনের রুম সীমা রয়েছে",rentperbed:"প্রতি বেড ভাড়া",welcomebackproperties:"ফিরে আসার জন্য স্বাগতম! আপনার সম্পত্তি নিয়ে এটি চলছে।",bedManagement:"বেড ব্যবস্থাপনা",addBed:"বেড যোগ করুন",addNewBed:"নতুন বেড যোগ করুন",editBed:"বেড সম্পাদনা করুন",bedNumber:"বেড নম্বর",monthlyRent:"মাসিক ভাড়া",renter:"ভাড়াটে",selectarenter:"একজন ভাড়াটে নির্বাচন করুন",assignrenter:"ভাড়াটেকে বরাদ্দ দিন",never:"কখনো না",anyadditionalnotesbed:"এই বেড সম্পর্কে অতিরিক্ত নোট...",norenter:"কোনো ভাড়াটে নেই",location:"অবস্থান",lastCleaned:"শেষ পরিষ্কার",bedDetails:"বেডের বিবরণ",searchbedsroomsrenters:"বেড, রুম, ভাড়াটে খুঁজুন...",bedManagementdes:"সব ভবন ও রুমে পৃথক বেড পরিচালনা করুন",selectaroom:"একটি রুম নির্বাচন করুন",contact:"যোগাযোগ",company:"কোম্পানি",days:"দিন",relation:"সম্পর্ক",vegetarian:"নিরামিষভোজী",both:"উভয়",references:"রেফারেন্স",previousAddress:"আগের ঠিকানা",additionalInformation:"অতিরিক্ত তথ্য",uploadedDocuments:"আপলোডকৃত ডকুমেন্টস",uploadFile:"ফাইল আপলোড করুন",documents:"ডকুমেন্টস",documentsType:"ডকুমেন্টের ধরন",allowed:"অনুমোদিত",smokingAllowed:"ধূমপান অনুমোদিত",petAllowed:"পোষা প্রাণী অনুমোদিত",restricted:"নিষিদ্ধ",not_allowed:"অনুমোদিত নয়",guestPolicy:"অতিথি নীতিমালা",non_Vegetarian:"অমিষভোজী",foodType:"খাবারের ধরন",preferences:"পছন্দ",financialInformation:"আর্থিক তথ্য",roomAssignment:"রুম বরাদ্দ",selectabed:"একটি বেড নির্বাচন করুন",monthlyIncome:"মাসিক আয়",occupation:"পেশা",alternatePhone:"বিকল্প ফোন",personalInformation:"ব্যক্তিগত তথ্য",roomBed:"রুম ও বেড",checkin:"চেক-ইন",editRenter:"ভাড়াটে সম্পাদনা করুন",securityDeposit:"জামানত",noticePeriod:"নোটিশ পিরিয়ড",leaseInformation:"লিজ সম্পর্কিত তথ্য",checkinDate:"চেক-ইন তারিখ",leaseStartDate:"লিজ শুরুর তারিখ",leaseEndDate:"লিজ শেষের তারিখ",emergencyContact:"জরুরি যোগাযোগ",addPayment:"পেমেন্ট যোগ করুন",paidPayment:"পরিশোধিত পেমেন্ট",pendingPayment:"বাকি থাকা পেমেন্ট",overduePayment:"বিলম্বিত পেমেন্ট",period:"সময়কাল",month:"মাস",year:"বছর",paymentDetails:"পেমেন্টের বিবরণ",viewDetails:"বিস্তারিত দেখুন",markasPaid:"পরিশোধিত হিসেবে চিহ্নিত করুন",maintenanceManagement:"রক্ষণাবেক্ষণ ব্যবস্থাপনা",maintenanceManagementdes:"সব সম্পত্তির রক্ষণাবেক্ষণ অনুরোধ ট্র্যাক ও পরিচালনা করুন",addMaintenanceRequest:"রক্ষণাবেক্ষণ অনুরোধ যোগ করুন",totalRequests:"মোট অনুরোধ",inProgress:"চলমান",completed:"সম্পন্ন",cancelled:"বাতিল",priority:"অগ্রাধিকার",low:"কম",medium:"মধ্যম",high:"উচ্চ",cost:"খরচ",scheduledDate:"নির্ধারিত তারিখ",type:"ধরন",requestDetails:"অনুরোধের বিবরণ",cleaning:"পরিষ্কার",repair:"মেরামত",inspection:"পরিদর্শন",upgrade:"উন্নয়ন",allpriority:"সব অগ্রাধিকার",editMaintenanceRequest:"রক্ষণাবেক্ষণ অনুরোধ সম্পাদনা করুন",optional:"ঐচ্ছিক",assignedTo:"বরাদ্দপ্রাপ্ত",estimatedCost:"আনুমানিক খরচ",request:"অনুরোধ",describethemaintenanceissuetask:"রক্ষণাবেক্ষণের সমস্যা বা কাজটি বর্ণনা করুন...",staffmembercontractorname:"স্টাফ সদস্য বা কন্ট্রাক্টরের নাম",additionalnotescomments:"অতিরিক্ত নোট বা মন্তব্য...",expenseManagement:"ব্যয় ব্যবস্থাপনা",expenseManagementdes:"সব সম্পত্তি-সম্পর্কিত ব্যয় ট্র্যাক ও পরিচালনা করুন",addExpense:"ব্যয় যোগ করুন",totalExpenses:"মোট ব্যয়",thisMonth:"এই মাস",utilities:"ইউটিলিটিজ",category:"বিভাগ",other:"অন্যান্য",supplies:"সরবরাহ",staff:"স্টাফ",fromDate:"তারিখ হতে",toDate:"তারিখ পর্যন্ত",allCategories:"সব বিভাগ",expenseDetails:"ব্যয়ের বিবরণ",vendor:"সরবরাহকারী",approvedby:"অনুমোদনকারী:",amount:"পরিমাণ",editExpense:"ব্যয় সম্পাদনা করুন",addNewExpense:"নতুন ব্যয় যোগ করুন",vendorSupplier:"সরবরাহকারী/বিক্রেতা",receiptInvoiceNumber:"রসিদ বা ইনভয়েস নম্বর",receiptinvoicereference:"রসিদ বা ইনভয়েস রেফারেন্স",manageradminname:"ম্যানেজার বা অ্যাডমিনের নাম",companypersonname:"কোম্পানি বা ব্যক্তির নাম",describetheexpense:"ব্যয়ের বিবরণ লিখুন...",date:"তারিখ",booked:"বুক করা হয়েছে",in_progress:"চলমান",paid_date:"পরিশোধের তারিখ",payment_method:"পরিশোধ পদ্ধতি",transactionId:"লেনদেন আইডি",reservationNote:"রিজার্ভেশনের তথ্য",enterReservationNote:"এই রিজার্ভেশন সম্পর্কিত বিশেষ নির্দেশাবলী বা বিস্তারিত যোগ করুন",total_available:"মোট উপলব্ধ",total_occupied:"মোট দখলকৃত",total_maintenance:"মোট রক্ষণাবেক্ষণ",total_booked:"মোট বুকিং",allfloors:"সব তলা",searchByRoomNumber:"রুম নম্বর দিয়ে অনুসন্ধান করুন",document:"দলিল",uploadedDocument:"আপলোড করা দলিল",visitors:"অতিথিরা",visiting:"পরিদর্শনরত",purpose:"উদ্দেশ্য",vehicle:"গাড়ি",checkOut:"চেক আউট",checkinTime:"চেক-ইন সময়",checkoutTime:"চেক-আউট সময়",visitorDetails:"অতিথির বিবরণ",todayVisitors:"আজকের অতিথিরা",checkedOut:"চেক আউট করেছেন",checkedIn:"চেক ইন করেছেন",totalVisitors:"মোট অতিথিরা",currentlyInside:"বর্তমানে ভিতরে",registerVisitor:"অতিথি নিবন্ধন করুন",visitorManagement:"অতিথি ব্যবস্থাপনা",visitorManagementdes:"অতিথিদের চেক-ইন এবং চেক-আউট ট্র্যাক এবং পরিচালনা করুন",searchvisitorsrentersrooms:"অতিথি, ভাড়াটিয়া, রুম অনুসন্ধান করুন...",registerNewVisitor:"নতুন অতিথি নিবন্ধন করুন",editVisitor:"অতিথি সম্পাদনা করুন",iDVerified:"আইডি যাচাই হয়েছে",register:"নিবন্ধন করুন",visitor:"অতিথি",anyadditionalnotesvistor:"ভিজিট সম্পর্কে অতিরিক্ত নোট...",visitorName:"অতিথির নাম",visitorPhone:"অতিথির ফোন",visitingRenter:"পরিদর্শনরত ভাড়াটিয়া",purposeofVisit:"পরিদর্শনের উদ্দেশ্য",vehicleNumber:"গাড়ির নম্বর",vehicleNumberDHA:"যেমন, DHA-1234",securityguardstaff:"নিরাপত্তা রক্ষী বা স্টাফের নাম",purposeofVisitplace:"যেমন, ব্যক্তিগত ভিজিট, ব্যবসায়িক মিটিং, ডেলিভারি",advancedReports:"উন্নত রিপোর্ট",advancedReportsdes:"কাস্টম ফিল্টার অপশন সহ বিস্তারিত রিপোর্ট তৈরি করুন",reportFilters:"রিপোর্ট ফিল্টার",paymentStatus:"পেমেন্ট স্ট্যাটাস",reportType:"রিপোর্টের ধরন",summary:"সারাংশ",detailed:"বিস্তারিত",comparative:"তুলনামূলক",totalRevenue:"মোট রাজস্ব",pendingRevenue:"মুলতুবি রাজস্ব",netProfit:"নেট মুনাফা",exportReports:"রিপোর্ট এক্সপোর্ট করুন",revenueReports:"রাজস্ব রিপোর্ট",expenseReports:"ব্যয় রিপোর্ট",occupancyReports:"অকুপেন্সি রিপোর্ট",renterReports:"ভাড়াটিয়া রিপোর্ট",expenseBreakdowCategory:"ব্যয়ের বিভাগ অনুযায়ী বিশ্লেষণ",staffManagement:"স্টাফ ব্যবস্থাপনা",addStaffMember:"স্টাফ সদস্য যোগ করুন",staffManagementdes:"ব্যবহারকারী অ্যাকাউন্ট এবং অনুমতি পরিচালনা করুন",user:"ব্যবহারকারী",role:"ভূমিকা",manager:"ম্যানেজার",admin:"অ্যাডমিন",department:"বিভাগ",selectDepartment:"বিভাগ নির্বাচন করুন",phoneNumber:"ফোন নম্বর",emailAddress:"ইমেইল ঠিকানা",fullName:"পূর্ণ নাম",roleDepartment:"ভূমিকা ও বিভাগ",permissions:"অনুমতিসমূহ",lastLogin:"সর্বশেষ লগইন",activeUser:"সক্রিয় ব্যবহারকারী",staffMember:"স্টাফ সদস্য",editStaffMember:"স্টাফ সদস্য সম্পাদনা করুন",viewData:"ডেটা দেখুন",viewDatades:"সমস্ত তথ্য দেখতে পারে",editData:"ডেটা সম্পাদনা করুন",editDatades:"বিদ্যমান রেকর্ড পরিবর্তন করতে পারে",manageRecords:"রেকর্ড পরিচালনা করুন",manageRecordsdes:"রেকর্ড তৈরি এবং পরিচালনা করতে পারে",deleteRecords:"রেকর্ড মুছুন",deleteRecordsdes:"রেকর্ড মুছে ফেলতে পারে",generateReports:"রিপোর্ট তৈরি করুন",generateReportsdes:"রিপোর্ট অ্যাক্সেস এবং তৈরি করতে পারে",systemSettings:"সিস্টেম সেটিংস",systemSettingsdes:"সিস্টেম সেটিংস পরিবর্তন করতে পারে",userManagement:"ব্যবহারকারী ব্যবস্থাপনা",userManagementdes:"ব্যবহারকারী অ্যাকাউন্ট পরিচালনা করতে পারে",themeSettings:"থিম সেটিংস",currenttheme:"বর্তমান থিম",darkMode:"ডার্ক মোড",dark:"ডার্ক",light:"লাইট",avatar:"অ্যাভাটার",languageSettings:"ভাষা সেটিংস",selectlanguage:"ভাষা নির্বাচন করুন",profileSettings:"প্রোফাইল সেটিংস",updateProfile:"প্রোফাইল আপডেট করুন",currencySettings:"মুদ্রা সেটিংস",currencySymbol:"মুদ্রার চিহ্ন",countryCode:"দেশের কোড",countryName:"দেশের নাম",applicationSettings:"অ্যাপ্লিকেশন সেটিংস",applicationName:"অ্যাপ্লিকেশনের নাম",logo:"লোগো",favicon:"ফেভিকন",loginbackground:"লগইন ব্যাকগ্রাউন্ড",smtp:"SMTP",smtpHost:"SMTP হোস্ট",smtpPort:"SMTP পোর্ট",smtpUsername:"SMTP ইউজারনেম",smtpPassword:"SMTP পাসওয়ার্ড",fromEmail:"ফ্রম ইমেইল",expense:"ব্যয়",completedDate:"সমাপ্তির তারিখ",availableRooms:"উপলব্ধ রুম",bookedRooms:"বুক করা রুম",oldPassword:"পুরানো পাসওয়ার্ড",newPassword:"নতুন পাসওয়ার্ড",confirmPassword:"পাসওয়ার্ড নিশ্চিত করুন",changePassword:"পাসওয়ার্ড পরিবর্তন করুন",totalPayments:"মোট পেমেন্ট",totalMaintenance:"মোট রক্ষণাবেক্ষণ",joinedAt:"যোগদান তারিখ",searchByRentersId:"নাম, ইমেইল, ফোন, অথবা এমিরেটস আইডি দিয়ে অনুসন্ধান করুন",renterDetails:"ভাড়াটিয়ার তথ্য",renterinfo:"ভাড়াটিয়ার তথ্য",financialInfo:"আর্থিক তথ্য",rentInfo:"ভাড়া সম্পর্কিত তথ্য",pendingRent:"বকেয়া ভাড়া",viewAllMaintenanceRequests:"সব রক্ষণাবেক্ষণ অনুরোধ দেখুন",maintenanceDetails:"রক্ষণাবেক্ষণ বিবরণ",close:"বন্ধ করুন",manage:"পরিচালনা করুন",user_management:"ব্যবহারকারী ব্যবস্থাপনা",noDocuments:"কোনো নথি নেই",accessRestricted:"অ্যাক্সেস সীমিত",accessRestrictedDes:"এই কনটেন্টটি দেখতে আপনাকে লগইন করতে হবে। অনুগ্রহ করে প্রবেশ করুন।",pageNotFound:"পেজ পাওয়া যায়নি",pageNotFoundDes:"আপনি যে পেজটি খুঁজছেন তা বিদ্যমান নেই অথবা সরানো হয়েছে।",loginNow:"চালিয়ে যেতে লগইন করুন",view_buildings:"ভবন দেখতে পারবেন",view_floors:"তলা দেখতে পারবেন",view_rooms:"কক্ষ দেখতে পারবেন",view_renters:"ভাড়াটিয়া দেখতে পারবেন",view_rents:"ভাড়া দেখতে পারবেন",view_maintenance:"রক্ষণাবেক্ষণ দেখতে পারবেন",view_expenses:"খরচ দেখতে পারবেন",view_visitors:"অতিথি দেখতে পারবেন",accessRestrictedPermissionDes:"এই কনটেন্ট দেখার জন্য আপনার প্রয়োজনীয় অনুমতি নেই।"},ar:{dashboard:"لوحة التحكم",buildings:"المباني",rooms:"الغرف",renters:"المستأجرون",rent:"إدارة الإيجار",reports:"التقارير",settings:"الإعدادات",login:"تسجيل الدخول",logout:"تسجيل الخروج",email:"البريد الإلكتروني",password:"كلمة المرور",totalBuildings:"إجمالي المباني",totalRooms:"إجمالي الغرف",totalRenters:"إجمالي المستأجرين",occupancyRate:"معدل الإشغال",monthlyRevenue:"الإيرادات الشهرية",pendingPayments:"المدفوعات المعلقة",addBuilding:"إضافة مبنى",addRoom:"إضافة غرفة",addRenter:"إضافة مستأجر",name:"الاسم",address:"العنوان",floors:"الطوابق",actions:"الإجراءات",edit:"تعديل",delete:"حذف",save:"حفظ",cancel:"إلغاء",phone:"الهاتف",nid:"الرقم القومي",room:"غرفة",bed:"سرير",rentAmount:"قيمة الإيجار",dueDate:"تاريخ الاستحقاق",status:"الحالة",paid:"مدفوع",pending:"معلق",overdue:"متأخر",total_beds:"إجمالي الأسرة",total_rooms:"إجمالي الغرف",available:"متاح",occupied:"مشغول",maintenance:"صيانة",reserved:"محجوز",allRooms:"جميع الغرف",allStatus:"جميع الحالات",search:"بحث",allBuildings:"جميع المباني",parking:"موقف سيارات",beds:"أسرة",parkingSpaces:"أماكن الوقوف",occupiedBeds:"الأسرة المشغولة",contactNumber:"رقم الاتصال",contactEmail:"البريد الإلكتروني للتواصل",openingHours:"ساعات العمل",description:"الوصف",image:"صورة",monthlyExpenses:"المصروفات الشهرية",netIncome:"صافي الدخل",averageRent:"متوسط الإيجار",overduePayments:"المدفوعات المتأخرة",upcomingDues:"المستحقات القادمة",maintenanceRequests:"طلبات الصيانة",revenue:"الإيرادات",expenses:"النفقات",revenueAnalytics:"تحليلات الإيرادات",occupancyOverview:"نظرة عامة على الإشغال",recentActivity:"النشاطات الأخيرة",maintenanceAlerts:"تنبيهات الصيانة",quickActions:"إجراءات سريعة",floorManagement:"إدارة الطوابق",floorManagementDes:"إدارة الطوابق في جميع المباني مع تتبع الصيانة",addFloor:"إضافة طابق",residential:"سكني",commercial:"تجاري",needsAttention:"يحتاج إلى الانتباه",underMaintenance:"تحت الصيانة",totalFloors:"إجمالي الطوابق",filters:"الفلاتر",recordPayment:"تسجيل الدفع",generateReport:"إنشاء تقرير",propertiesmanaged:"العقارات المُدارة",activetenants:"المستأجرون النشطون",currentoccupancy:"الإشغال الحالي",totalrentcollected:"إجمالي الإيجار المحصل",operatingcosts:"تكاليف التشغيل",profitthismonth:"الربح هذا الشهر",perbedmonth:"لكل سرير/شهر",awaitingpayment:"في انتظار الدفع",pastduedate:"تاريخ الاستحقاق مضى",duethisweek:"مستحق هذا الأسبوع",urgent:"عاجل",good:"جيد",floor:"الطابق",floorName:"اسم الطابق",notes:"ملاحظات",building:"المبنى",amenities:"الخدمات",noamenities:"لا توجد خدمات",lastInspection:"آخر تفتيش",lastInspectionDate:"تاريخ آخر تفتيش",roomOccupancy:"إشغال الغرفة",commonArea:"المنطقة المشتركة",allTypes:"جميع الأنواع",floorTypes:"أنواع الطوابق",floorType:"نوع الطابق",maintenanceStatus:"حالة الصيانة",occupiedRooms:"الغرف المشغولة",anyadditionalnotes:"أي ملاحظات إضافية حول هذا الطابق...",update:"تحديث",create:"إنشاء",editRoom:"تعديل الغرفة",editBuilding:"تعديل المبنى",addNewFloor:"إضافة طابق جديد",editFloor:"تعديل الطابق",full:"ممتلئ",selectabuilding:"اختر مبنى",selectafloor:"اختر طابقًا",partial:"جزئي",roomNumber:"رقم الغرفة",facilities:"المرافق",nofacilitiesavailable:"لا توجد مرافق متاحة",occupancy:"الإشغال",buildinghasbedslimit:"للمبنى حد أقصى للأسرة",buildinghasroomslimit:"للمبنى حد أقصى للغرف",rentperbed:"الإيجار لكل سرير",welcomebackproperties:"مرحبًا بعودتك! إليك ما يحدث في ممتلكاتك.",bedManagement:"إدارة الأسرة",addBed:"إضافة سرير",addNewBed:"إضافة سرير جديد",editBed:"تعديل السرير",bedNumber:"رقم السرير",monthlyRent:"الإيجار الشهري",renter:"المستأجر",selectarenter:"اختر مستأجرًا",assignrenter:"تعيين مستأجر",never:"أبدًا",anyadditionalnotesbed:"أي ملاحظات إضافية حول هذا السرير...",norenter:"لا يوجد مستأجر",location:"الموقع",lastCleaned:"آخر تنظيف",bedDetails:"تفاصيل السرير",searchbedsroomsrenters:"ابحث عن الأسرة، الغرف، المستأجرين...",bedManagementdes:"إدارة الأسرة الفردية عبر جميع المباني والغرف",selectaroom:"اختر غرفة",contact:"جهة الاتصال",company:"الشركة",days:"أيام",relation:"العلاقة",vegetarian:"نباتي",both:"كلاهما",references:"المراجع",previousAddress:"العنوان السابق",additionalInformation:"معلومات إضافية",uploadedDocuments:"المستندات المرفوعة",uploadFile:"تحميل ملف",documents:"المستندات",documentsType:"نوع المستند",allowed:"مسموح",smokingAllowed:"التدخين مسموح",petAllowed:"الحيوانات الأليفة مسموحة",restricted:"مقيد",not_allowed:"غير مسموح",guestPolicy:"سياسة الضيوف",non_Vegetarian:"غير نباتي",foodType:"نوع الطعام",preferences:"التفضيلات",financialInformation:"المعلومات المالية",roomAssignment:"تخصيص الغرفة",selectabed:"اختر سريرًا",monthlyIncome:"الدخل الشهري",occupation:"الوظيفة",alternatePhone:"هاتف بديل",personalInformation:"المعلومات الشخصية",roomBed:"الغرفة والسرير",checkin:"تسجيل الوصول",editRenter:"تعديل المستأجر",securityDeposit:"الوديعة التأمينية",noticePeriod:"فترة الإشعار",leaseInformation:"معلومات عقد الإيجار",checkinDate:"تاريخ تسجيل الوصول",leaseStartDate:"تاريخ بدء الإيجار",leaseEndDate:"تاريخ انتهاء الإيجار",emergencyContact:"جهة الاتصال في حالة الطوارئ",addPayment:"إضافة دفعة",paidPayment:"دفعة مدفوعة",pendingPayment:"دفعة معلقة",overduePayment:"دفعة متأخرة",period:"الفترة",month:"شهر",year:"سنة",paymentDetails:"تفاصيل الدفع",viewDetails:"عرض التفاصيل",markasPaid:"تحديد كمدفوع",maintenanceManagement:"إدارة الصيانة",maintenanceManagementdes:"تتبع وإدارة طلبات الصيانة في جميع العقارات",addMaintenanceRequest:"إضافة طلب صيانة",totalRequests:"إجمالي الطلبات",inProgress:"قيد التنفيذ",completed:"مكتمل",cancelled:"ملغي",priority:"الأولوية",low:"منخفضة",medium:"متوسطة",high:"عالية",cost:"التكلفة",scheduledDate:"التاريخ المحدد",type:"النوع",requestDetails:"تفاصيل الطلب",cleaning:"تنظيف",repair:"إصلاح",inspection:"تفتيش",upgrade:"ترقية",allpriority:"جميع الأولويات",editMaintenanceRequest:"تعديل طلب الصيانة",optional:"اختياري",assignedTo:"مُسند إلى",estimatedCost:"التكلفة التقديرية",request:"طلب",describethemaintenanceissuetask:"وصف مشكلة أو مهمة الصيانة...",staffmembercontractorname:"اسم الموظف أو المقاول",additionalnotescomments:"ملاحظات أو تعليقات إضافية...",expenseManagement:"إدارة المصروفات",expenseManagementdes:"تتبع وإدارة جميع المصروفات المتعلقة بالعقارات",addExpense:"إضافة مصروف",totalExpenses:"إجمالي المصروفات",thisMonth:"هذا الشهر",utilities:"المرافق",category:"الفئة",other:"أخرى",supplies:"المستلزمات",staff:"الموظفون",fromDate:"من التاريخ",toDate:"إلى التاريخ",allCategories:"جميع الفئات",expenseDetails:"تفاصيل المصروف",vendor:"المورد",approvedby:"تمت الموافقة من قبل:",amount:"المبلغ",editExpense:"تعديل المصروف",addNewExpense:"إضافة مصروف جديد",vendorSupplier:"المورد / البائع",receiptInvoiceNumber:"رقم الفاتورة أو الإيصال",receiptinvoicereference:"مرجع الإيصال أو الفاتورة",manageradminname:"اسم المدير أو المسؤول",companypersonname:"اسم الشركة أو الشخص",describetheexpense:"وصف المصروف...",date:"التاريخ",booked:"محجوز",in_progress:"قيد التنفيذ",paid_date:"تاريخ الدفع",payment_method:"طريقة الدفع",transactionId:"معرف المعاملة",reservationNote:"معلومات الحجز",enterReservationNote:"أضف أي تعليمات خاصة أو تفاصيل عن هذا الحجز",total_available:"الإجمالي المتاح",total_occupied:"الإجمالي المشغول",total_maintenance:"إجمالي الصيانة",total_booked:"الإجمالي المحجوز",allfloors:"جميع الطوابق",searchByRoomNumber:"البحث حسب رقم الغرفة",document:"وثيقة",uploadedDocument:"الوثيقة المرفوعة",visitors:"الزوار",visiting:"زيارة",purpose:"الغاية",vehicle:"مركبة",checkOut:"تسجيل الخروج",checkinTime:"وقت الدخول",checkoutTime:"وقت الخروج",visitorDetails:"تفاصيل الزائر",todayVisitors:"زوار اليوم",checkedOut:"تم تسجيل الخروج",checkedIn:"تم تسجيل الدخول",totalVisitors:"مجموع الزوار",currentlyInside:"حالياً داخل",registerVisitor:"تسجيل الزائر",visitorManagement:"إدارة الزوار",visitorManagementdes:"تتبع وإدارة تسجيلات دخول وخروج الزوار",searchvisitorsrentersrooms:"ابحث عن الزوار، المستأجرين، الغرف...",registerNewVisitor:"تسجيل زائر جديد",editVisitor:"تعديل الزائر",iDVerified:"تم التحقق من الهوية",register:"تسجيل",visitor:"زائر",anyadditionalnotesvistor:"أي ملاحظات إضافية عن الزيارة...",visitorName:"اسم الزائر",visitorPhone:"هاتف الزائر",visitingRenter:"المستأجر الذي تتم زيارته",purposeofVisit:"غرض الزيارة",vehicleNumber:"رقم المركبة",vehicleNumberDHA:"مثال: DHA-1234",securityguardstaff:"اسم الحارس الأمني أو الموظف",purposeofVisitplace:"مثال: زيارة شخصية، اجتماع عمل، تسليم",advancedReports:"تقارير متقدمة",advancedReportsdes:"إنشاء تقارير مفصلة مع خيارات تصفية مخصصة",reportFilters:"مرشحات التقرير",paymentStatus:"حالة الدفع",reportType:"نوع التقرير",summary:"ملخص",detailed:"تفصيلي",comparative:"مقارن",totalRevenue:"إجمالي الإيرادات",pendingRevenue:"الإيرادات المعلقة",netProfit:"صافي الربح",exportReports:"تصدير التقارير",revenueReports:"تقارير الإيرادات",expenseReports:"تقارير المصروفات",occupancyReports:"تقارير الإشغال",renterReports:"تقارير المستأجرين",expenseBreakdowCategory:"تفصيل المصروفات حسب الفئة",staffManagement:"إدارة الموظفين",addStaffMember:"إضافة عضو فريق",staffManagementdes:"إدارة حسابات المستخدمين والصلاحيات",user:"المستخدم",role:"الدور",manager:"المدير",admin:"المسؤول",department:"القسم",selectDepartment:"اختر القسم",phoneNumber:"رقم الهاتف",emailAddress:"البريد الإلكتروني",fullName:"الاسم الكامل",roleDepartment:"الدور والقسم",permissions:"الأذونات",lastLogin:"آخر تسجيل دخول",activeUser:"المستخدم النشط",staffMember:"عضو الفريق",editStaffMember:"تعديل عضو الفريق",viewData:"عرض البيانات",viewDatades:"يمكنه عرض جميع المعلومات",editData:"تعديل البيانات",editDatades:"يمكنه تعديل السجلات الموجودة",manageRecords:"إدارة السجلات",manageRecordsdes:"يمكنه إنشاء وإدارة السجلات",deleteRecords:"حذف السجلات",deleteRecordsdes:"يمكنه حذف السجلات",generateReports:"إنشاء التقارير",generateReportsdes:"يمكنه الوصول وإنشاء التقارير",systemSettings:"إعدادات النظام",systemSettingsdes:"يمكنه تعديل إعدادات النظام",userManagement:"إدارة المستخدمين",userManagementdes:"يمكنه إدارة حسابات المستخدمين",themeSettings:"إعدادات السمة",currenttheme:"السمة الحالية",darkMode:"الوضع الداكن",dark:"داكن",light:"فاتح",avatar:"الصورة الرمزية",languageSettings:"إعدادات اللغة",selectlanguage:"اختر اللغة",profileSettings:"إعدادات الملف الشخصي",updateProfile:"تحديث الملف الشخصي",currencySettings:"إعدادات العملة",currencySymbol:"رمز العملة",countryCode:"رمز الدولة",countryName:"اسم الدولة",applicationSettings:"إعدادات التطبيق",applicationName:"اسم التطبيق",logo:"الشعار",favicon:"الأيقونة المفضلة",loginbackground:"خلفية تسجيل الدخول",smtp:"SMTP",smtpHost:"مضيف SMTP",smtpPort:"منفذ SMTP",smtpUsername:"اسم مستخدم SMTP",smtpPassword:"كلمة مرور SMTP",fromEmail:"من البريد الإلكتروني",expense:"مصروف",completedDate:"تاريخ الإكمال",availableRooms:"الغرف المتاحة",bookedRooms:"الغرف المحجوزة",oldPassword:"كلمة المرور القديمة",newPassword:"كلمة المرور الجديدة",confirmPassword:"تأكيد كلمة المرور",changePassword:"تغيير كلمة المرور",totalPayments:"إجمالي المدفوعات",totalMaintenance:"إجمالي الصيانة",joinedAt:"انضم في",searchByRentersId:"البحث بالاسم أو البريد الإلكتروني أو الهاتف أو رقم الهوية الإماراتية",renterDetails:"معلومات المستأجر",renterinfo:"معلومات المستأجر",financialInfo:"المعلومات المالية",rentInfo:"معلومات الإيجار",pendingRent:"الإيجارات المعلقة",viewAllMaintenanceRequests:"عرض جميع طلبات الصيانة",maintenanceDetails:"تفاصيل الصيانة",close:"إغلاق",manage:"إدارة",user_management:"إدارة المستخدمين",noDocuments:"لا توجد مستندات",accessRestricted:"الوصول مقيد",accessRestrictedDes:"يجب تسجيل الدخول لعرض هذا المحتوى. يرجى تسجيل الدخول للمتابعة.",pageNotFound:"الصفحة غير موجودة",pageNotFoundDes:"الصفحة التي تبحث عنها غير موجودة أو تم نقلها.",loginNow:"تسجيل الدخول للمتابعة",view_buildings:"يمكن عرض المباني",view_floors:"يمكن عرض الطوابق",view_rooms:"يمكن عرض الغرف",view_renters:"يمكن عرض المستأجرين",view_rents:"يمكن عرض الإيجارات",view_maintenance:"يمكن عرض الصيانة",view_expenses:"يمكن عرض النفقات",view_visitors:"يمكن عرض الزوار",accessRestrictedPermissionDes:"ليس لديك الصلاحيات المطلوبة لعرض هذا المحتوى."}},Lk=({children:e})=>{const[r,a]=b.useState("en");b.useEffect(()=>{const l=localStorage.getItem("language");l&&a(l)},[]);const s=l=>{a(l),localStorage.setItem("language",l)};b.useEffect(()=>{r==="ar"?document.documentElement.setAttribute("dir","rtl"):document.documentElement.setAttribute("dir","ltr")},[r]);const n=l=>{var i;return((i=Tk[r])==null?void 0:i[l])||l};return t.jsx(zg.Provider,{value:{language:r,setLanguage:s,t:n},children:e})},Ug=b.createContext(void 0),ae=()=>{const e=b.useContext(Ug);if(e===void 0)throw new Error("useData must be used within a DataProvider");return e},Ok=({children:e})=>{const{isAuthenticated:r}=ie(),[a,s]=b.useState([]),[n,l]=b.useState(!1),[i,u]=b.useState(null),[o,c]=b.useState([]),[d,m]=b.useState([]),[p,j]=b.useState([]),[v,y]=b.useState([]),[f,k]=b.useState([]),[x,g]=b.useState([]),[h,w]=b.useState([]),[S,C]=b.useState([]),[N,D]=b.useState([]),[R,F]=b.useState([]),[A,P]=b.useState([]),[M,T]=b.useState([]),[_,H]=b.useState(""),B=async()=>{try{l(!0),u(null);const O=await hn.getAll();s(O.data)}catch(O){u("Failed to fetch buildings"),console.error("Fetch buildings error:",O)}finally{l(!1)}},U=async()=>{try{l(!0),u(null);const O=await ra.getAll();c(O.data)}catch(O){u("Failed to fetch floors"),console.error("Fetch floors error:",O)}finally{l(!1)}},V=async()=>{try{l(!0),u(null);const O=await es.getAll();m(O.data)}catch(O){u("Failed to fetch rooms"),console.error("Fetch rooms error:",O)}finally{l(!1)}},J=async()=>{try{l(!0),u(null);const O=await pn.getAll();j(O.data)}catch(O){console.error("Fetch beds error:",O),u("Failed to fetch beds")}finally{l(!1)}},X=async()=>{try{l(!0);const O=await fn.getAll();y(O.data)}catch(O){u("Failed to fetch renters"),console.error("Fetch renters error:",O)}finally{l(!1)}},z=async()=>{try{l(!0);const O=await yn.getAll();k(O.data)}catch(O){u("Failed to fetch renters"),console.error("Fetch renters error:",O)}finally{l(!1)}},E=async()=>{try{l(!0);const O=await bn.getAll();g(O.data)}catch(O){console.error("Fetch maintenance error:",O),u("Failed to fetch maintenance records")}finally{l(!1)}},$=async()=>{try{l(!0);const O=await vn.getAll();w(O.data)}catch(O){console.error("Fetch expenses error:",O),u("Failed to fetch expenses")}finally{l(!1)}},Q=async()=>{try{l(!0);const O=await kn.getAll();C(O.data)}catch(O){console.error("Fetch notices error:",O),u("Failed to fetch notices")}finally{l(!1)}},re=async()=>{try{l(!0);const O=await ts.getAll();D(O.data)}catch(O){console.error("Fetch visitors error:",O),u("Failed to fetch visitors")}finally{l(!1)}},de=async()=>{try{l(!0);const O=await _u.getAll();F(O.data)}catch(O){console.error("Fetch settings error:",O),u("Failed to fetch settings")}finally{l(!1)}},G=async()=>{try{l(!0);const O=await sa.getAllActivity();P(O.data)}catch(O){console.error("Fetch settings error:",O),u("Failed to fetch settings")}finally{l(!1)}},St=async()=>{try{l(!0);const O=await jn.getAll();T(O.data)}catch(O){u("Failed to fetch renters"),console.error("Fetch renters error:",O)}finally{l(!1)}},xx=async O=>{try{const I=await hn.create(O);B(),G(),q.success("Building added successfully!")}catch(I){throw console.error("Add building error:",I),q.error("Failed to add building. Please try again."),I}},hx=async(O,I)=>{try{const Z=await hn.update(O,I);B(),G(),q.success("Building updated successfully!")}catch(Z){throw console.error("Update building error:",Z),q.error("Failed to update building. Please try again."),Z}},px=async O=>{try{await hn.delete(O),B(),G(),q.success("Building deleted successfully!")}catch(I){throw console.error("Delete building error:",I),q.error("Failed to delete building. Please try again."),I}},fx=()=>{const O=a.length,I=a.reduce((ke,Ct)=>ke+Ct.floors,0),Z=a.reduce((ke,Ct)=>ke+Ct.total_rooms,0),Va=v.filter(ke=>ke.status=="active").length,Ql=a.reduce((ke,Ct)=>{var qd;const Yl=((qd=Ct.buildingFloors)==null?void 0:qd.reduce((ch,uh)=>{var Wd;const mh=((Wd=uh.rooms)==null?void 0:Wd.filter(gh=>gh.status!=="available").length)||0;return ch+mh},0))||0;return ke+Yl},0),th=Z>0?Ql/Z*100:0,rh=f.filter(ke=>ke.status=="pending").length,ah=f.filter(ke=>ke.status=="overdue").length,sh=x.length,Jl=f.filter(ke=>ke.status==="paid"&&new Date(ke.due_date).getMonth()===new Date().getMonth()&&new Date(ke.due_date).getFullYear()===new Date().getFullYear()).reduce((ke,Ct)=>ke+Number(Ct.amount||0),0),Hd=h.filter(ke=>new Date(ke.date).getMonth()===new Date().getMonth()).reduce((ke,Ct)=>ke+Number(Ct.amount||0),0),nh=Jl-Hd,lh=Va>0?Jl/Va:0,ih=95.5,oh=3,dh=N.filter(ke=>{const Ct=new Date(ke.check_in_time).toISOString().split("T")[0],Yl=new Date().toISOString().split("T")[0];return Ct===Yl}).length;return{totalBuildings:O,totalFloors:I,totalRooms:Z,totalRenters:Va,occupancyRate:th,monthlyRevenue:Jl,pendingPayments:rh,overduePayments:ah,maintenanceRequests:sh,monthlyExpenses:Hd,netIncome:nh,averageRent:lh,collectionRate:ih,activeNotices:oh,todayVisitors:dh}},yx=async O=>{try{const I=await ra.create(O);U(),q.success("Floor created successfully!")}catch(I){throw console.error("Add floor error:",I),q.error(`${I.response.data.error}`),I}},bx=async(O,I)=>{try{const Z=await ra.update(O,I);U(),G(),q.success("Floor updated successfully!")}catch(Z){throw console.error("Update floor error:",Z),q.error("Failed to update floor. Please try again."),Z}},vx=async O=>{try{await ra.delete(O),U(),G(),q.success("Floor deleted successfully!")}catch(I){throw console.error("Delete floor error:",I),q.error("Failed to delete floor. Please try again."),I}},kx=async O=>{try{return(await ra.getById(O)).data}catch(I){throw console.error("Get floors error:",I),I}},jx=async O=>{try{return(await ra.getBybuildId(O)).data}catch(I){throw console.error("Get floors error:",I),I}},wx=async O=>{try{const I=await es.create(O);V(),U(),B(),G(),q.success("Room created successfully!")}catch(I){throw console.error("Add room error:",I),q.error(`${I.response.data.error}`),I}},Nx=async(O,I)=>{try{const Z=await es.update(O,I);V(),U(),B(),G(),q.success("Room updated successfully!")}catch(Z){throw console.error("update room error:",Z),q.error("Failed to update room. Please try again."),Z}},_x=async O=>{try{await es.delete(O),V(),U(),B(),G(),q.success("Room deleted successfully!")}catch(I){throw console.error("Delete room error:",I),q.error("Failed to delete room. Please try again."),I}},Sx=async O=>{try{return(await es.getById(O)).data}catch(I){throw console.error("Get rooms by floor error:",I),I}},Cx=async O=>{try{const I=await pn.create(O);J(),G(),q.success("Bed created successfully!")}catch(I){throw console.error("Add bed error:",I),q.error(`${I.response.data.error}`),I}},Ex=async(O,I)=>{try{const Z=await pn.update(O,I);J(),G(),q.success("Bed updated successfully!")}catch(Z){throw console.error("Update bed error:",Z),q.error("Failed to update bed. Please try again."),Z}},Rx=async O=>{try{await pn.delete(O),J(),G(),q.success("Bed deleted successfully!")}catch(I){throw console.error("Delete bed error:",I),q.error("Failed to delete bed. Please try again."),I}},Px=async O=>{try{const I=await fn.create(O);X(),G(),J(),V(),U(),B(),q.success("Renter created successfully!")}catch(I){throw console.error("Add renter error:",I),q.error("Failed to create Renter. Please try again."),I}},Dx=async(O,I)=>{try{const Z=await fn.update(O,I);X(),G(),J(),V(),U(),B(),q.success("Renter updated successfully!")}catch(Z){throw console.error("Update renter error:",Z),q.error("Failed to update Renter. Please try again."),Z}},Mx=async O=>{try{await fn.delete(O),X(),G(),J(),V(),U(),B(),q.success("Renter deleted successfully!")}catch(I){throw console.error("Delete renter error:",I),q.error("Failed to delete Renter. Please try again."),I}},Ax=async O=>{try{const I=await yn.create(O);z(),G(),q.success("RentPayment created successfully!")}catch(I){throw console.error("Add rent payment error:",I),q.error("Failed to create RentPayment. Please try again."),I}},Fx=async(O,I)=>{try{const Z=await yn.update(O,I);z(),G(),q.success("RentPayment updated successfully!")}catch(Z){throw console.error("Update rent payment error:",Z),q.error("Failed to update RentPayment. Please try again."),Z}},Tx=async O=>{try{await yn.delete(O),z(),G(),q.success("RentPayment deleted successfully!")}catch(I){throw console.error("Delete rent payment error:",I),q.error("Failed to delete RentPayment. Please try again."),I}},Lx=async O=>{try{const I=await bn.create(O);E(),G(),q.success("Maintenance created successfully!")}catch(I){throw console.error("Add maintenance error:",I),q.error("Failed to create Maintenance. Please try again."),I}},Ox=async(O,I)=>{try{const Z=await bn.update(O,I);E(),G(),q.success("Maintenance updated successfully!")}catch(Z){throw console.error("Update maintenance error:",Z),q.error("Failed to update Maintenance. Please try again."),Z}},Ix=async O=>{try{await bn.delete(O),E(),G(),q.success("Maintenance deleted successfully!")}catch(I){throw console.error("Delete maintenance error:",I),q.error("Failed to delete Maintenance. Please try again."),I}},Bx=async O=>{try{const I=await vn.create(O);$(),G(),q.success("Expenses created successfully!")}catch(I){throw console.error("Add expense error:",I),q.error("Failed to create Expenses. Please try again."),I}},$x=async(O,I)=>{try{const Z=await vn.update(O,I);$(),G(),q.success("Expenses updated successfully!")}catch(Z){throw console.error("Update expense error:",Z),q.error("Failed to update Expenses. Please try again."),Z}},zx=async O=>{try{await vn.delete(O),$(),G(),q.success("Expenses delete successfully!")}catch(I){throw console.error("Delete expense error:",I),q.error("Failed to delete Expenses. Please try again."),I}},Ux=async O=>{try{const I=await kn.create(O);Q()}catch(I){throw console.error("Add notice error:",I),I}},Vx=async(O,I)=>{try{const Z=await kn.update(O,I);Q()}catch(Z){throw console.error("Update notice error:",Z),Z}},Hx=async O=>{try{await kn.delete(O),Q()}catch(I){throw console.error("Delete notice error:",I),I}},qx=async O=>{try{const I=await ts.create(O);re(),q.success("Visitor create successfully!")}catch(I){throw console.error("Add visitor error:",I),q.error("Failed to create Visitor. Please try again."),I}},Wx=async(O,I)=>{try{const Z=await ts.update(O,I);re(),q.success("Visitor updated successfully!")}catch(Z){throw console.error("Update visitor error:",Z),q.error("Failed to update Visitor. Please try again."),Z}},Qx=async O=>{try{await ts.delete(O),re(),q.success("Visitor deleted successfully!")}catch(I){throw console.error("Delete visitor error:",I),q.error("Failed to delete Visitor. Please try again."),I}},Jx=async O=>{try{await ts.checkout(O),re(),q.success("Visitor checkout successfully!")}catch(I){throw console.error("checkout visitor error:",I),q.error("Failed to checkout Visitor. Please try again."),I}},Yx=async(O,I)=>{try{const Z=await fetch(I.file_url).then(Ql=>Ql.blob()),Va=new File([Z],I.file_name,{type:Z.type});await Su.uploadRenterDocument(O,I.type,Va,I.description),X(),q.success("Upload renter document successfully!")}catch(Z){throw console.error("Upload renter document error:",Z),q.error(`Upload renter document error: ${Z}`),Z}},Xx=async O=>{try{await Su.deleteDocument(O),X(),q.success("Delete renter document successfully!")}catch(I){throw console.error("Delete renter document error:",I),q.error(`Delete renter document error: ${I}`),I}},Kx=async O=>{try{const I=await _u.update(O);de(),q.success("Settings Updated successfully!")}catch(I){throw console.error("Update settings error:",I),q.error(`Settings Update error: ${I}`),I}},Gx=async O=>{try{const I=await jn.create(O);St(),q.success("Category created successfully!")}catch(I){throw console.error("Add rent payment error:",I),q.error(`Category create error: ${I}`),I}},Zx=async(O,I)=>{try{const Z=await jn.update(O,I);St(),q.success("Category updated successfully!")}catch(Z){throw console.error("Update rent payment error:",Z),q.error(`Category update error: ${Z}`),Z}},eh=async O=>{try{await jn.delete(O),St(),q.success("Category deleted successfully!")}catch(I){throw console.error("Delete rent payment error:",I),q.error(`Category delete error: ${I}`),I}};return b.useEffect(()=>{if(!r)return;const O=()=>{B(),U(),V(),J(),X(),z(),St(),E(),$(),Q(),re(),G(),de()};O();const I=setInterval(()=>{O()},10*60*1e3);return()=>clearInterval(I)},[r]),t.jsx(Ug.Provider,{value:{buildings:a,category:M,floors:o,activity:A,rooms:d,beds:p,renters:v,rentPayments:f,maintenance:x,expenses:h,notices:S,visitors:N,settings:R,loading:n,currencySymbol:_,error:i,fetchBuildings:B,fetchFloors:U,fetchSettings:de,fetchActivity:G,fetchRentPayments:z,fetchcategory:St,fetchrooms:V,addBuilding:xx,updateBuilding:hx,deleteBuilding:px,getStatistics:fx,addFloor:yx,updateFloor:bx,deleteFloor:vx,getFloorsById:kx,getFloorsBybuildId:jx,addRoom:wx,updateRoom:Nx,deleteRoom:_x,getRoomsById:Sx,addBed:Cx,updateBed:Ex,deleteBed:Rx,fetchRenters:X,addRenter:Px,updateRenter:Dx,deleteRenter:Mx,addRentPayment:Ax,updateRentPayment:Fx,deleteRentPayment:Tx,fetchMaintenance:E,addMaintenance:Lx,updateMaintenance:Ox,deleteMaintenance:Ix,fetchExpenses:$,addExpense:Bx,updateExpense:$x,deleteExpense:zx,fetchNotices:Q,addNotice:Ux,updateNotice:Vx,deleteNotice:Hx,fetchVisitors:re,addVisitor:qx,updateVisitor:Wx,deleteVisitor:Qx,checkoutVisitor:Jx,uploadRenterDocument:Yx,deleteDocument:Xx,applicationUpdate:Kx,addCategory:Gx,updateCategory:Zx,deleteCategory:eh},children:e})};/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var Ik={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bk=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ee=(e,r)=>{const a=b.forwardRef(({color:s="currentColor",size:n=24,strokeWidth:l=2,absoluteStrokeWidth:i,className:u="",children:o,...c},d)=>b.createElement("svg",{ref:d,...Ik,width:n,height:n,stroke:s,strokeWidth:i?Number(l)*24/Number(n):l,className:["lucide",`lucide-${Bk(e)}`,u].join(" "),...c},[...r.map(([m,p])=>b.createElement(m,p)),...Array.isArray(o)?o:[o]]));return a.displayName=`${e}`,a};/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Er=ee("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qt=ee("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xr=ee("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $k=ee("Bath",[["path",{d:"M9 6 6.5 3.5a1.5 1.5 0 0 0-1-.5C4.683 3 4 3.683 4 4.5V17a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"1r8yf5"}],["line",{x1:"10",x2:"8",y1:"5",y2:"7",key:"h5g8z4"}],["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"7",x2:"7",y1:"19",y2:"21",key:"16jp00"}],["line",{x1:"17",x2:"17",y1:"19",y2:"21",key:"1pxrnk"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ts=ee("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Eu=ee("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bt=ee("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ut=ee("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vg=ee("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vt=ee("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dt=ee("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Js=ee("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zk=ee("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aa=ee("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uk=ee("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nt=ee("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ue=ee("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _t=ee("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hg=ee("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Un=ee("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Vk=ee("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Hk=ee("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qg=ee("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wg=ee("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qk=ee("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wk=ee("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ql=ee("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qk=ee("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jk=ee("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Po=ee("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qg=ee("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ye=ee("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yk=ee("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jg=ee("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Aa=ee("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Do=ee("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ea=ee("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const It=ee("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yg=ee("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xk=ee("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kk=ee("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ar=ee("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gk=ee("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Mo=ee("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xg=ee("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fl=ee("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zk=ee("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Kg=ee("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qe=ee("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Wl=ee("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ej=ee("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Jt=ee("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
* @license lucide-react v0.344.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ye=ee("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),tj="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABs0lEQVR4nO2WvUoDQRDHFwRBQQR9BC2srUSQOHMiRsQuLyD4ABai3qzcS2hhZ2MTQcyOiKKCjb6ChaBgKm2VoKBE1pyJHzk3H/cV3B8MHLtzt/O/++/tCGGxWCyaXD7XJRrEy+e6m8mPHGK4JMbblZOpflOudzQ9oHP1PSItSIUXkrEsGTZMucS4U8nFM5EWXIWjkuGVGN6IYZMYz0lhUTKWdOjryhjs+sWX1lRmRKQFr5AZ1rbwizNHAa7oEIZEGpAM81LBU8PF+0GMj7LgzCVaPLEzSQwv1cL0Xqjuhzrxc17B8zrjRCLFe2quVzLcfC1weX+8b3XPGQwSUG+eGK+X8mM9sQsghsVftlC4JRVsB9omcB4WEhCAp836/o84jl2AVPgQlgBiuI9dgCUuJMPsx0mqsOgqzNbGQ/N/WYdpvZbxW4LPv8Vd1AIoYL2WCX5TUX0BrDtuBUgrAK2AlrAC2Ar45wKo009iV2FWP0gHHTgzUQtwA9YLnagExEbHC6BvXm03oH2vN0vNq+0XT1F6vVFMlkjcMiasgKSxApLG1AKE3iKEjakFiK1FsFgsFhEn73F9Gov27KSJAAAAAElFTkSuQmCC",rj=()=>{const[e,r]=b.useState(""),[a,s]=b.useState(""),[n,l]=b.useState(!1),[i,u]=b.useState(""),[o,c]=b.useState(!1),{login:d}=ie(),{t:m}=te(),p=$a(),j=async g=>{g.preventDefault(),u(""),c(!0);try{const h=await d(e,a);h.role!=="renter"?h.permissions.includes("view")?p("/dashboard"):p("/staff/dashboard"):h.role=="renter"?p("/user/dashboard"):u("Invalid email or password")}catch{u("Login failed. Please try again.")}finally{c(!1)}},{settings:v}=ae(),y=v.find(g=>g.name==="logo"),f=v.find(g=>g.name==="application_name"),k=v.find(g=>g.name==="loginbg"),x=async()=>{try{const h=(await Vv.download()).data.url;window.location.href=h}catch(g){console.error("Download failed:",g)}};return t.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 flex items-center justify-center p-4",style:{backgroundImage:k!=null&&k.value?`url(${k.value})`:"",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"cover"},children:[t.jsx("div",{className:"absolute top-4 right-4",children:t.jsxs("button",{onClick:x,rel:"noopener noreferrer",className:"group relative inline-flex items-center gap-1 overflow-hidden rounded-lg bg-gradient-to-r from-fuchsia-500 via-purple-600 to-indigo-700 px-3 py-2 text-sm text-white font-medium shadow-sm transition-all duration-300 hover:scale-105 hover:shadow-purple-400/30",children:[t.jsx("span",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 bg-gradient-to-r from-fuchsia-400 to-indigo-600 blur-md transition-opacity duration-300"}),t.jsx("img",{src:tj,alt:"Android",className:"relative z-10 h-4 w-4 drop-shadow-md transition-transform duration-300 group-hover:-rotate-6"}),t.jsx("span",{className:"relative z-10",children:"Download APK"}),t.jsx("span",{className:"absolute left-0 top-0 h-full w-1/3 bg-white/25 transform -skew-x-12 -translate-x-full group-hover:translate-x-[250%] transition-transform duration-700 ease-in-out"})]})}),t.jsxs("div",{className:"max-w-md w-full space-y-8",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:y!=null&&y.value?t.jsx("div",{className:"p-3 rounded-full",children:t.jsx("img",{src:y.value,alt:"Logo",className:"h-auto w-auto object-contain"})}):t.jsx("div",{className:"bg-blue-600 p-3 rounded-full",children:t.jsx(bt,{className:"h-8 w-8 text-white"})})}),t.jsxs("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:["Welcome to ",(f==null?void 0:f.value)||""]}),t.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Sign in to your account"})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-8",children:t.jsxs("form",{className:"space-y-6",onSubmit:j,children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:m("email")}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:t.jsx(ql,{className:"h-5 w-5 text-gray-400"})}),t.jsx("input",{id:"email",type:"email",value:e,onChange:g=>r(g.target.value),className:"block w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white transition-colors",placeholder:"Enter your email",required:!0})]})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:m("password")}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:t.jsx(qk,{className:"h-5 w-5 text-gray-400"})}),t.jsx("input",{id:"password",type:n?"text":"password",value:a,onChange:g=>s(g.target.value),className:"block w-full pl-10 pr-10 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent dark:bg-gray-700 dark:text-white transition-colors",placeholder:"Enter your password",required:!0}),t.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center",onClick:()=>l(!n),children:n?t.jsx(Uk,{className:"h-5 w-5 text-gray-400 hover:text-gray-600 transition-colors"}):t.jsx(nt,{className:"h-5 w-5 text-gray-400 hover:text-gray-600 transition-colors"})})]})]}),i&&t.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3 flex items-center",children:[t.jsx(Er,{className:"h-5 w-5 text-red-600 dark:text-red-400 mr-2"}),t.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:i})]}),t.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-lg transition-colors duration-200 flex items-center justify-center",children:o?t.jsx("div",{className:"w-5 h-5 border-2 border-white border-t-transparent rounded-full animate-spin"}):m("login")})]})})]})]})},aj=()=>{const[e,r]=b.useState(!1),{hasPermission:a}=ie(),{t:s}=te(),[n,l]=b.useState(window.innerWidth<768);b.useEffect(()=>{n&&r(!0)},[n]),b.useEffect(()=>{const m=()=>l(window.innerWidth<768);return window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]);const u=[{name:s("dashboard"),icon:Un,path:"/dashboard",permission:"view"},{name:s("buildings"),icon:bt,path:"/buildings",permission:"view_buildings"},{name:s("floors"),icon:qg,path:"/floors",permission:"view_floors"},{name:s("rooms"),icon:Un,path:"/rooms",permission:"view_rooms"},{name:s("renters"),icon:Wl,path:"/renters",permission:"view_customer"},{name:s("rent"),icon:Xr,path:"/rent",permission:"view_rents"},{name:s("maintenance"),icon:Jt,path:"/maintenance",permission:"view_maintenance"},{name:s("expenses"),icon:Jg,path:"/expenses",permission:"view_expenses"},{name:s("visitors"),icon:fl,path:"/visitors",permission:"view_visitors"},{name:s("reports"),icon:Ue,path:"/reports",permission:"reports"},{name:s("staff"),icon:Zk,path:"/staff",permission:"user_management"},{name:s("settings"),icon:Do,path:"/settings",permission:"settings"},{name:s("dashboard"),icon:Un,path:"/user/dashboard",permission:"renter"},{name:s("rent"),icon:Xr,path:"/user/rents",permission:"renter"},{name:s("maintenance"),icon:Jt,path:"/user/maintenance",permission:"renter"},{name:s("visitors"),icon:fl,path:"/user/visitors",permission:"renter"},{name:s("documents"),icon:Ue,path:"/user/documents",permission:"renter"},{name:s("settings"),icon:Do,path:"/user/settings",permission:"renter"}].filter(m=>a(m.permission)),{settings:o}=ae(),c=o.find(m=>m.name==="logo"),d=o.find(m=>m.name==="application_name");return b.useEffect(()=>{const m=o.find(p=>p.name==="favicon");if(m!=null&&m.value){const p=document.querySelector("link[rel~='icon']")||document.createElement("link");p.rel="icon",p.href=m.value,document.head.appendChild(p)}},[o]),t.jsxs("div",{className:`bg-white dark:bg-gray-800 shadow-lg transition-all duration-300 ${e?"w-16":"w-64"}`,children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[!e&&t.jsx("div",{className:"flex items-center w-full",children:c!=null&&c.value?t.jsx("img",{src:c.value,alt:"Logo",className:"h-8 w-full mr-2"}):t.jsxs(t.Fragment,{children:[t.jsx(bt,{className:"h-8 w-8 text-blue-600 mr-2"}),(d==null?void 0:d.value)&&t.jsx("h1",{className:"text-lg font-bold text-gray-900 dark:text-white",children:d.value})]})}),t.jsx("button",{onClick:()=>r(!e),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors hidden sm:block",children:e?t.jsx(Jk,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):t.jsx(ye,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})]}),t.jsx("nav",{className:"mt-4",children:t.jsx("div",{className:"px-3 space-y-1",children:u.map(m=>t.jsxs(sg,{to:m.path,className:({isActive:p})=>`flex items-center px-3 pt-2 pb-1 sm:py-2 rounded-lg text-sm font-medium transition-colors ${p?"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:e?m.name:void 0,children:[t.jsx(m.icon,{className:`h-5 w-5 ${e?"mr-0":"mr-3"} `}),!e&&t.jsx("span",{children:m.name})]},m.path))})})]})},sj=()=>{const{user:e,logout:r}=ie(),{isDarkMode:a,toggleTheme:s}=$g(),{language:n,setLanguage:l,t:i}=te(),{settings:u}=ae(),o=u.find(c=>c.name==="application_name");return t.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-sm border-b border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"flex items-center justify-between px-2 py-2 sm:px-4 sm:py-4",children:[t.jsx("div",{className:"flex items-center",children:(o==null?void 0:o.value)&&t.jsx("h1",{className:"hidden sm:block text-lg font-bold text-gray-900 dark:text-white",children:o.value})}),t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsx("button",{onClick:s,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:a?t.jsx(Yg,{className:"h-4 w-4 sm:h-5 sm:w-5 text-gray-600 dark:text-gray-400"}):t.jsx(Po,{className:"h-4 w-4 sm:h-5 sm:w-5 text-gray-600 dark:text-gray-400"})}),t.jsx("div",{className:"relative",children:t.jsxs("button",{onClick:()=>l(n==="en"?"ar":"en"),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex items-center",children:[t.jsx(Hg,{className:"h-4 w-4 sm:h-5 sm:w-5 text-gray-600 dark:text-gray-400 mr-1"}),t.jsx("span",{className:"text-[11px] sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:n.toUpperCase()})]})}),t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center",children:e!=null&&e.avatar?t.jsx("img",{src:e.avatar,alt:"User Avatar",className:"w-8 h-8 rounded-full object-cover"}):t.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center",children:t.jsx(qe,{className:"h-4 w-4 sm:h-5 sm:w-5 text-white"})})}),t.jsxs("div",{className:"ml-3",children:[t.jsx("p",{className:"text-[11px] sm:text-sm font-medium text-gray-700 dark:text-gray-300",children:e==null?void 0:e.name}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 capitalize",children:e==null?void 0:e.role})]})]}),t.jsx("button",{onClick:r,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",children:t.jsx(Wk,{className:"h-4 w-4 sm:h-5 sm:w-5 text-gray-600 dark:text-gray-400"})})]})]})]})})},nj=({children:e})=>{const r=dr();return b.useEffect(()=>{const a={"/dashboard":"Dashboard","/users":"Users","/settings":"Settings","/buildings":"Buildings","/floors":"Floors","/rooms":"Rooms","/beds":"Bed Management","/renters":"Renters","/rent":"Rent Management","/maintenance":"Maintenance Management","/expenses":"Expense Management","/visitors":"Visitor Management","/reports":"Advanced Reports","/staff":"Staff Management"};document.title=a[r.pathname]||"My App"},[r.pathname]),t.jsxs("div",{className:"flex h-screen bg-gray-50 dark:bg-gray-900",children:[t.jsx(aj,{}),t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[t.jsx(sj,{}),t.jsx("main",{className:"flex-1 overflow-x-hidden overflow-y-auto bg-gray-50 dark:bg-gray-900 p-6",children:t.jsx(Fy,{})})]})]})},lj=({children:e})=>{const{isAuthenticated:r,loading:a}=ie();return!r&&!a?t.jsx(Td,{to:"/login",replace:!0}):t.jsx(t.Fragment,{children:e})},ij=()=>{const{t:e}=te();return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900 text-center px-4",children:[t.jsx("h1",{className:"text-[10rem] sm:text-[15rem] font-extrabold text-red-500 leading-none select-none",children:"404"}),t.jsx("h2",{className:"text-3xl sm:text-5xl font-semibold text-gray-900 dark:text-white mb-4",children:e("pageNotFound")}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-8 max-w-xl",children:e("pageNotFoundDes")})]})},xt=({title:e,value:r,icon:a,color:s,trend:n,subtitle:l,className:i=""})=>{const o={blue:{bg:"bg-blue-50 dark:bg-blue-900/20",icon:"text-blue-600 dark:text-blue-400",border:"border-blue-800 dark:border-blue-800"},green:{bg:"bg-green-50 dark:bg-green-900/20",icon:"text-green-600 dark:text-green-400",border:"border-green-800 dark:border-green-800"},purple:{bg:"bg-purple-50 dark:bg-purple-900/20",icon:"text-purple-600 dark:text-purple-400",border:"border-purple-800 dark:border-purple-800"},orange:{bg:"bg-orange-50 dark:bg-orange-900/20",icon:"text-orange-600 dark:text-orange-400",border:"border-orange-800 dark:border-orange-800"},red:{bg:"bg-red-50 dark:bg-red-900/20",icon:"text-red-600 dark:text-red-400",border:"border-red-800 dark:border-red-800"},yellow:{bg:"bg-yellow-50 dark:bg-yellow-900/20",icon:"text-yellow-600 dark:text-yellow-400",border:"border-yellow-800 dark:border-yellow-800"}}[s];return t.jsx("div",{className:`bg-white dark:bg-gray-800 rounded-xl shadow-md p-6 border ${o.border} hover:shadow-lg transition-shadow duration-200 ${i}`,children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:e}),t.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:r}),l&&t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:l})]}),t.jsx("div",{className:`p-3 rounded-lg ${o.bg}`,children:t.jsx(a,{className:`h-6 w-6 ${o.icon}`})})]})})};function Ao(e){"@babel/helpers - typeof";return Ao=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ao(e)}function Bt(e,r){if(r.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+r.length+" present")}function He(e){Bt(1,arguments);var r=Object.prototype.toString.call(e);return e instanceof Date||Ao(e)==="object"&&r==="[object Date]"?new Date(e.getTime()):typeof e=="number"||r==="[object Number]"?new Date(e):((typeof e=="string"||r==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}var oj={};function dj(){return oj}function Ru(e){var r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),e.getTime()-r.getTime()}function Vn(e,r){Bt(2,arguments);var a=He(e),s=He(r),n=a.getTime()-s.getTime();return n<0?-1:n>0?1:n}function cj(e,r){Bt(2,arguments);var a=He(e),s=He(r),n=a.getFullYear()-s.getFullYear(),l=a.getMonth()-s.getMonth();return n*12+l}function uj(e,r){return Bt(2,arguments),He(e).getTime()-He(r).getTime()}var mj={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(r){return r<0?Math.ceil(r):Math.floor(r)}},gj="trunc";function xj(e){return mj[gj]}function hj(e){Bt(1,arguments);var r=He(e);return r.setHours(23,59,59,999),r}function pj(e){Bt(1,arguments);var r=He(e),a=r.getMonth();return r.setFullYear(r.getFullYear(),a+1,0),r.setHours(23,59,59,999),r}function fj(e){Bt(1,arguments);var r=He(e);return hj(r).getTime()===pj(r).getTime()}function yj(e,r){Bt(2,arguments);var a=He(e),s=He(r),n=Vn(a,s),l=Math.abs(cj(a,s)),i;if(l<1)i=0;else{a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-n*l);var u=Vn(a,s)===-n;fj(He(e))&&l===1&&Vn(e,s)===1&&(u=!1),i=n*(l-Number(u))}return i===0?0:i}function bj(e,r,a){Bt(2,arguments);var s=uj(e,r)/1e3;return xj()(s)}var vj={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},kj=function(r,a,s){var n,l=vj[r];return typeof l=="string"?n=l:a===1?n=l.one:n=l.other.replace("{{count}}",a.toString()),s!=null&&s.addSuffix?s.comparison&&s.comparison>0?"in "+n:n+" ago":n};function Ci(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=r.width?String(r.width):e.defaultWidth,s=e.formats[a]||e.formats[e.defaultWidth];return s}}var jj={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},wj={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Nj={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},_j={date:Ci({formats:jj,defaultWidth:"full"}),time:Ci({formats:wj,defaultWidth:"full"}),dateTime:Ci({formats:Nj,defaultWidth:"full"})},Sj={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Cj=function(r,a,s,n){return Sj[r]};function rs(e){return function(r,a){var s=a!=null&&a.context?String(a.context):"standalone",n;if(s==="formatting"&&e.formattingValues){var l=e.defaultFormattingWidth||e.defaultWidth,i=a!=null&&a.width?String(a.width):l;n=e.formattingValues[i]||e.formattingValues[l]}else{var u=e.defaultWidth,o=a!=null&&a.width?String(a.width):e.defaultWidth;n=e.values[o]||e.values[u]}var c=e.argumentCallback?e.argumentCallback(r):r;return n[c]}}var Ej={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Rj={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Pj={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Dj={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Mj={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Aj={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Fj=function(r,a){var s=Number(r),n=s%100;if(n>20||n<10)switch(n%10){case 1:return s+"st";case 2:return s+"nd";case 3:return s+"rd"}return s+"th"},Tj={ordinalNumber:Fj,era:rs({values:Ej,defaultWidth:"wide"}),quarter:rs({values:Rj,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:rs({values:Pj,defaultWidth:"wide"}),day:rs({values:Dj,defaultWidth:"wide"}),dayPeriod:rs({values:Mj,defaultWidth:"wide",formattingValues:Aj,defaultFormattingWidth:"wide"})};function as(e){return function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=a.width,n=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],l=r.match(n);if(!l)return null;var i=l[0],u=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],o=Array.isArray(u)?Oj(u,function(m){return m.test(i)}):Lj(u,function(m){return m.test(i)}),c;c=e.valueCallback?e.valueCallback(o):o,c=a.valueCallback?a.valueCallback(c):c;var d=r.slice(i.length);return{value:c,rest:d}}}function Lj(e,r){for(var a in e)if(e.hasOwnProperty(a)&&r(e[a]))return a}function Oj(e,r){for(var a=0;a<e.length;a++)if(r(e[a]))return a}function Ij(e){return function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.match(e.matchPattern);if(!s)return null;var n=s[0],l=r.match(e.parsePattern);if(!l)return null;var i=e.valueCallback?e.valueCallback(l[0]):l[0];i=a.valueCallback?a.valueCallback(i):i;var u=r.slice(n.length);return{value:i,rest:u}}}var Bj=/^(\d+)(th|st|nd|rd)?/i,$j=/\d+/i,zj={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Uj={any:[/^b/i,/^(a|c)/i]},Vj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Hj={any:[/1/i,/2/i,/3/i,/4/i]},qj={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Wj={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Qj={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Jj={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Yj={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Xj={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Kj={ordinalNumber:Ij({matchPattern:Bj,parsePattern:$j,valueCallback:function(r){return parseInt(r,10)}}),era:as({matchPatterns:zj,defaultMatchWidth:"wide",parsePatterns:Uj,defaultParseWidth:"any"}),quarter:as({matchPatterns:Vj,defaultMatchWidth:"wide",parsePatterns:Hj,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:as({matchPatterns:qj,defaultMatchWidth:"wide",parsePatterns:Wj,defaultParseWidth:"any"}),day:as({matchPatterns:Qj,defaultMatchWidth:"wide",parsePatterns:Jj,defaultParseWidth:"any"}),dayPeriod:as({matchPatterns:Yj,defaultMatchWidth:"any",parsePatterns:Xj,defaultParseWidth:"any"})},Gj={code:"en-US",formatDistance:kj,formatLong:_j,formatRelative:Cj,localize:Tj,match:Kj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Gg(e,r){if(e==null)throw new TypeError("assign requires that input parameter not be null or undefined");for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e}function Zj(e){return Gg({},e)}var Pu=1440,ew=2520,Ei=43200,tw=86400;function rw(e,r,a){var s,n;Bt(2,arguments);var l=dj(),i=(s=(n=a==null?void 0:a.locale)!==null&&n!==void 0?n:l.locale)!==null&&s!==void 0?s:Gj;if(!i.formatDistance)throw new RangeError("locale must contain formatDistance property");var u=Vn(e,r);if(isNaN(u))throw new RangeError("Invalid time value");var o=Gg(Zj(a),{addSuffix:!!(a!=null&&a.addSuffix),comparison:u}),c,d;u>0?(c=He(r),d=He(e)):(c=He(e),d=He(r));var m=bj(d,c),p=(Ru(d)-Ru(c))/1e3,j=Math.round((m-p)/60),v;if(j<2)return a!=null&&a.includeSeconds?m<5?i.formatDistance("lessThanXSeconds",5,o):m<10?i.formatDistance("lessThanXSeconds",10,o):m<20?i.formatDistance("lessThanXSeconds",20,o):m<40?i.formatDistance("halfAMinute",0,o):m<60?i.formatDistance("lessThanXMinutes",1,o):i.formatDistance("xMinutes",1,o):j===0?i.formatDistance("lessThanXMinutes",1,o):i.formatDistance("xMinutes",j,o);if(j<45)return i.formatDistance("xMinutes",j,o);if(j<90)return i.formatDistance("aboutXHours",1,o);if(j<Pu){var y=Math.round(j/60);return i.formatDistance("aboutXHours",y,o)}else{if(j<ew)return i.formatDistance("xDays",1,o);if(j<Ei){var f=Math.round(j/Pu);return i.formatDistance("xDays",f,o)}else if(j<tw)return v=Math.round(j/Ei),i.formatDistance("aboutXMonths",v,o)}if(v=yj(d,c),v<12){var k=Math.round(j/Ei);return i.formatDistance("xMonths",k,o)}else{var x=v%12,g=Math.floor(v/12);return x<3?i.formatDistance("aboutXYears",g,o):x<9?i.formatDistance("overXYears",g,o):i.formatDistance("almostXYears",g+1,o)}}function aw(e,r){return Bt(1,arguments),rw(e,Date.now(),r)}const sw=()=>{const{activity:e}=ae(),[r,a]=b.useState([]),s=["Floor","Room","Building","Bed"],n=["Renter","Maintenance","Expenses"],l=["Staff"];return b.useEffect(()=>{let i=Object.entries(e);i=e.map((u,o)=>{let c,d;if(!(!u||!u.model_name||!u.createdAt||!u.description))return s.includes(u.model_name)?(c=Ye,d="text-green-600"):n.includes(u.model_name)?(c=Xr,d="text-yellow-600"):l.includes(u.model_name)?(c=Kg,d="text-blue-600"):(c=Ye,d="text-gray-500"),{id:o+1,type:`${u.model_name.toLowerCase()}_added`,message:u.description,time:aw(new Date(u.createdAt),{addSuffix:!0}),icon:c,color:d}}),a(i)},[e]),t.jsx("div",{className:"space-y-4",children:r.length>0&&r.slice(0,5).map(i=>t.jsxs("div",{className:"flex items-start space-x-3",children:[t.jsx("div",{className:`p-2 rounded-lg bg-gray-50 dark:bg-gray-700 ${i.color}`,children:t.jsx(i.icon,{className:"h-4 w-4"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:i.message}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:i.time})]})]},i.id))})},nw=()=>{const{buildings:e}=ae();return t.jsx("div",{className:"space-y-4",children:e.map(r=>{var n,l;const a=(n=r.buildingFloors)==null?void 0:n.reduce((i,u)=>{var c;const o=((c=u.rooms)==null?void 0:c.filter(d=>d.status!=="available").length)||0;return i+o},0),s=r.total_rooms>0?a/r.total_rooms*100:0;return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:r.name}),t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:(r==null?void 0:r.total_rooms)>0?(((l=r.buildingFloors)==null?void 0:l.reduce((i,u)=>{var c;const o=((c=u.rooms)==null?void 0:c.filter(d=>d.status!=="available").length)||0;return i+o},0))/r.total_rooms*100).toFixed(1)+"%":"0.0%"})]}),t.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2",children:t.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${s}%`}})})]},r.id)})})},lw=({data:e})=>{const r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],a=Object.values(e).map(l=>Number(l)||0),s=Math.max(...a,1),n=new Date().getMonth();return t.jsxs("div",{className:"space-y-4 px-2 sm:px-4",children:[t.jsx("div",{className:"flex items-end justify-between h-48 sm:h-64 space-x-1 sm:space-x-2 overflow-x-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:r.map((l,i)=>{const u=e[i]||0,o=Number(u)||0,c=o/s*100,d=i===n;return t.jsxs("div",{className:"flex-1 min-w-[24px] sm:min-w-[40px] flex flex-col items-center",children:[t.jsx("div",{className:"w-full flex flex-col items-center justify-end h-full",children:t.jsx("div",{className:`w-full rounded-t-lg transition-all duration-300 ${d?"bg-blue-600":o>0?"bg-blue-400 hover:bg-blue-500":"bg-gray-200 dark:bg-gray-700"}`,style:{height:`${c}%`,minHeight:o>0?"4px":"0"}})}),t.jsx("div",{className:"mt-1 text-[9px] sm:text-xs text-gray-600 dark:text-gray-400",children:l}),t.jsx("div",{className:"text-[9px] sm:text-xs font-medium text-gray-900 dark:text-white",children:o>0?`${(o/1e3).toFixed(0)}k`:"0"})]},l)})}),t.jsxs("div",{className:"flex items-center justify-between text-[9px] sm:text-sm text-gray-600 dark:text-gray-400 px-1 sm:px-0",children:[t.jsx("span",{children:"Monthly Revenue Trend"}),t.jsxs("div",{className:"flex items-center space-x-3 sm:space-x-4",children:[t.jsxs("div",{className:"flex items-center space-x-1 sm:space-x-2",children:[t.jsx("div",{className:"w-3 h-3 bg-blue-600 rounded-full"}),t.jsx("span",{className:"text-[9px] sm:text-sm",children:"Current Month"})]}),t.jsxs("div",{className:"flex items-center space-x-1 sm:space-x-2",children:[t.jsx("div",{className:"w-3 h-3 bg-blue-400 rounded-full"}),t.jsx("span",{className:"text-[9px] sm:text-sm",children:"Previous Months"})]})]})]})]})},iw=()=>{const{maintenance:e=[]}=ae(),{t:r}=te(),a=l=>{switch(l){case"urgent":return t.jsx(Qt,{className:"h-4 w-4 text-red-600"});case"high":return t.jsx(Qt,{className:"h-4 w-4 text-orange-600"});case"medium":return t.jsx(dt,{className:"h-4 w-4 text-yellow-600"});default:return t.jsx(Jt,{className:"h-4 w-4 text-blue-600"})}},s=l=>{switch(l){case"completed":return"text-green-600";case"in_progress":return"text-blue-600";case"pending":return"text-yellow-600";default:return"text-gray-600"}},n=e.sort((l,i)=>{const u={urgent:4,high:3,medium:2,low:1};return u[i.priority]-u[l.priority]}).slice(0,5);return t.jsxs("div",{className:"space-y-4",children:[n.length===0?t.jsxs("div",{className:"text-center py-8",children:[t.jsx(vt,{className:"h-12 w-12 text-green-500 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No maintenance requests"})]}):n.map(l=>t.jsxs("div",{className:"flex items-start space-x-3 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg",children:[t.jsx("div",{className:"flex-shrink-0 mt-1",children:a(l.priority)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white truncate",children:l.description}),t.jsx("span",{className:`text-xs font-medium capitalize ${s(l.status)}`,children:l.status.replace("_"," ")})]}),t.jsxs("div",{className:"flex items-center justify-between mt-1",children:[t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[l.type," • ",l.priority," priority"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:new Date(l.scheduled_date).toLocaleDateString()})]}),l.cost&&t.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-300 mt-1",children:["Estimated cost: $",l.cost.toLocaleString()]})]})]},l.id)),e.length>5&&t.jsx("div",{className:"text-center",children:t.jsx(Ol,{to:"/maintenance",className:"text-sm text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:r("viewAllMaintenanceRequests")})})]})},ow=()=>{const{hasPermission:e}=ie(),r=$a(),{t:a}=te(),n=[{name:a("addRenter"),icon:Kg,color:"bg-gradient-QuickActions1 hover:bg-blue-600",permission:"manage",action:()=>{r("/renters")}},{name:a("recordPayment"),icon:Xr,color:"bg-gradient-QuickActions2 hover:bg-green-600",permission:"manage",action:()=>{r("/rent")}},{name:a("addBuilding"),icon:Ye,color:"bg-gradient-QuickActions3 hover:bg-purple-600",permission:"manage",action:()=>{r("/buildings")}},{name:a("maintenance"),icon:Jt,color:"bg-gradient-QuickActions4 hover:bg-orange-600",permission:"manage",action:()=>{r("/maintenance")}},{name:a("generateReport"),icon:Ue,color:"bg-gradient-QuickActions2 hover:bg-indigo-600",permission:"reports",action:()=>{r("/reports")}},{name:a("settings"),icon:Do,color:"bg-gradient-QuickActions1 hover:bg-gray-600",permission:"settings",action:()=>{r("/settings")}}].filter(l=>e(l.permission));return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:a("quickActions")}),t.jsx("div",{className:"grid grid-cols-2 gap-3",children:n.map(l=>t.jsxs("button",{onClick:l.action,className:`${l.color} text-white p-3 rounded-lg transition-colors duration-200 flex flex-col items-center space-y-2`,children:[t.jsx(l.icon,{className:"h-5 w-5"}),t.jsx("span",{className:"text-xs font-medium text-center",children:l.name})]},l.name))})]})};function ge(){const{settings:e}=ae(),r=e==null?void 0:e.find(a=>a.name==="country");if(r&&r.value){const a=JSON.parse(r.value);return a.symbol?a.symbol:"$"}else return"$"}const dw=()=>{const{getStatistics:e,rentPayments:r=[],maintenance:a=[],buildings:s=[]}=ae(),n=ge(),{t:l}=te(),[i,u]=b.useState(e()),[o,c]=b.useState("month");b.useEffect(()=>{const y=setInterval(()=>{u(e())},3e4);return()=>clearInterval(y)},[e]);const d=()=>{const y=new Date().getFullYear();return r.filter(f=>f.status==="paid"&&f.year===y).reduce((f,k)=>{const x=new Date(`${k.month} 1, ${k.year}`).getMonth();return f[x]=(f[x]||0)+Number(k.amount),f},{})},m=()=>{const y=new Date,f=new Date(y.getTime()+7*24*60*60*1e3);return r.filter(k=>{const x=new Date(k.due_date);return k.status==="pending"&&x>=y&&x<=f}).length},j={pending:a.filter(y=>y.status==="pending").length,inProgress:a.filter(y=>y.status==="in_progress").length,urgent:a.filter(y=>y.priority==="urgent").length},v=m();return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white truncate",children:l("dashboard")}),t.jsx("p",{className:"text-[10px] sm:text-[15px] text-blue-400 dark:text-gray-400 mt-1",children:l("welcomebackproperties")})]}),t.jsx("div",{className:"flex-shrink-0",children:t.jsxs(Ol,{to:"/pending-rent",className:"relative bg-blue-600 text-white px-2 py-2 sm:px-4 sm:py-2 text-[10px] sm:text-sm rounded-lg hover:bg-blue-700 transition",children:[l("pendingRent"),t.jsx("span",{className:"absolute -top-2 -right-2 bg-red-600 text-white text-xs font-bold px-2 py-0.5 rounded-full",children:i.pendingPayments})]})})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[t.jsx(xt,{title:l("totalBuildings"),value:i.totalBuildings,icon:bt,color:"blue",trend:5,subtitle:`${s.length} ${l("propertiesmanaged")}`}),t.jsx(xt,{title:l("total_rooms"),value:i.totalRooms,icon:Ts,color:"green",trend:12,subtitle:`${i.totalRooms-i.totalRenters} ${l("available")} `}),t.jsx(xt,{title:l("totalRenters"),value:i.totalRenters,icon:Wl,color:"purple",trend:8,subtitle:l("activetenants")}),t.jsx(xt,{title:l("occupancyRate"),value:`${i.occupancyRate.toFixed(1)}%`,icon:Mo,color:"orange",trend:-2,subtitle:l("currentoccupancy")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[t.jsx(xt,{title:l("monthlyRevenue"),value:`${n} ${i.monthlyRevenue.toLocaleString()}`,icon:Xr,color:"green",trend:15,subtitle:l("totalrentcollected")}),t.jsx(xt,{title:l("monthlyExpenses"),value:`${n} ${i.monthlyExpenses.toLocaleString()}`,icon:Gk,color:"red",trend:-5,subtitle:l("operatingcosts")}),t.jsx(xt,{title:l("netIncome"),value:`${n} ${i.netIncome.toLocaleString()}`,icon:Js,color:"blue",trend:20,subtitle:l("profitthismonth")}),t.jsx(xt,{title:l("averageRent"),value:`${n} ${Math.round(i.averageRent).toLocaleString()}`,icon:Un,color:"purple",trend:3,subtitle:l("perbedmonth")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[t.jsx(xt,{title:l("pendingPayments"),value:i.pendingPayments,icon:Er,color:"yellow",trend:0,subtitle:l("awaitingpayment")}),t.jsx(xt,{title:l("overduePayments"),value:i.overduePayments,icon:Er,color:"red",trend:-1,subtitle:l("pastduedate")}),t.jsx(xt,{title:l("upcomingDues"),value:v,icon:ut,color:"blue",trend:0,subtitle:l("duethisweek")}),t.jsx(xt,{title:l("maintenanceRequests"),value:i.maintenanceRequests,icon:Jt,color:"orange",trend:-10,subtitle:`${j.urgent} ${l("urgent")}`})]}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[t.jsx("div",{className:"lg:col-span-2",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6",children:[t.jsx("div",{className:"flex items-center justify-between mb-6",children:t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:l("revenueAnalytics")})}),t.jsx(lw,{data:d()})]})}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:l("occupancyOverview")}),t.jsx(nw,{})]}),t.jsx(ow,{})]})]}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:l("recentActivity")}),t.jsx(sw,{})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:l("maintenanceAlerts")}),t.jsx(iw,{})]})]})]})},cw=e=>!e||typeof e!="string"?!1:/<[^>]*>/.test(e),Zg=e=>{if(!e||typeof e!="string")return e;const r=document.createElement("div");return r.innerHTML=e,r.textContent||r.innerText||""},ex=(e,r="Input")=>cw(e)?`${r} cannot contain HTML tags`:null,pe=({value:e,onChange:r,onValidationError:a,fieldName:s="Input",autoSanitize:n=!0,...l})=>{const i=u=>{const o=u.target.value,c=ex(o,s);c&&a?a(c):a&&a(null),n&&(u.target.value=Zg(o)),r(u)};return t.jsx("input",{...l,value:e,onChange:i})},Tt=({value:e,onChange:r,onValidationError:a,fieldName:s="Input",autoSanitize:n=!0,...l})=>{const i=u=>{const o=u.target.value,c=ex(o,s);c&&a?a(c):a&&a(null),n&&(u.target.value=Zg(o)),r(u)};return t.jsx("textarea",{...l,value:e,onChange:i})},uw={"image/jpeg":["FFD8FF"],"image/png":["89504E47"],"image/gif":["474946"],"application/pdf":["25504446"],"application/msword":["D0CF11E0"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["504B0304"]},mw=(e,r=4)=>new Promise((a,s)=>{const n=new FileReader;n.onload=l=>{var o;const i=new Uint8Array((o=l.target)==null?void 0:o.result),u=Array.from(i).map(c=>c.toString(16).toUpperCase().padStart(2,"0")).join("");a(u)},n.onerror=s,n.readAsArrayBuffer(e.slice(0,r))}),gw=async e=>{try{const r=await mw(e,8),a=uw[e.type];return a?a.some(s=>r.startsWith(s)):(console.warn("Unknown file type:",e.type),!1)}catch(r){return console.error("File signature validation error:",r),!1}},xw=(e,r=10)=>{const a=r*1024*1024;return e.size<=a},hw=(e,r)=>{var s;const a=(s=e.name.split(".").pop())==null?void 0:s.toLowerCase();return a?r.includes(a):!1},pw=async(e,r={})=>{const{maxSizeMB:a=10,allowedExtensions:s=["jpg","jpeg","png","gif","pdf","doc","docx"],checkSignature:n=!0}=r;return xw(e,a)?hw(e,s)?n&&!await gw(e)?{valid:!1,error:"File content does not match file extension. Possible malicious file."}:{valid:!0}:{valid:!1,error:`File type not allowed. Allowed types: ${s.join(", ")}`}:{valid:!1,error:`File size must be less than ${a}MB`}},fa=({onChange:e,onValidationError:r,maxSizeMB:a=10,allowedExtensions:s=["jpg","jpeg","png","gif","pdf","doc","docx"],checkSignature:n=!0,...l})=>{const[i,u]=b.useState(!1),o=async c=>{var m;const d=((m=c.target.files)==null?void 0:m[0])||null;if(!d){e(null),r&&r(null);return}u(!0);try{const p=await pw(d,{maxSizeMB:a,allowedExtensions:s,checkSignature:n});p.valid?(r&&r(null),e(d)):(r&&r(p.error||"Invalid file"),c.target.value="",e(null))}catch(p){console.error("File validation error:",p),r&&r("File validation failed"),c.target.value="",e(null)}finally{u(!1)}};return t.jsxs("div",{className:"relative",children:[t.jsx("input",{...l,type:"file",onChange:o,disabled:i||l.disabled}),i&&t.jsx("span",{className:"text-sm text-gray-500 ml-2",children:"Validating file..."})]})},fw=({building:e,onClose:r})=>{const{addBuilding:a,updateBuilding:s}=ae(),{t:n}=te(),[l,i]=b.useState({}),[u,o]=b.useState({name:"",address:"",floors:1,total_rooms:1,parking_spaces:0,occupied_beds:0,contact_phone:"",contact_email:"",opening_hours:"",description:"",image:null}),[c,d]=b.useState({});b.useEffect(()=>{e&&o(e)},[e]);const m=f=>{const{name:k,value:x}=f.target;o(g=>({...g,[k]:k==="floors"||k==="total_rooms"||k==="parking_spaces"||k==="occupied_beds"?parseInt(x)||0:x}))},p=f=>{o(k=>({...k,image:f}))},j=f=>k=>{d(x=>({...x,[f]:k}))},v=()=>{const f={};return u.name.trim()||(f.name=n("Name is Required")),u.address.trim()||(f.address=n("Address is Required")),u.description.trim()||(f.description=n("Description is Required")),u.total_rooms<=0&&(f.total_rooms=n("Floor must be at least 1")),u.floors<=0&&(f.floors=n("Room must be at least 1")),u.contact_email&&!/^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/.test(u.contact_email)&&(f.contact_email=n("Invalid Email")),u.contact_phone&&!/^\+?[\d\s()-]{7,15}$/.test(u.contact_phone)&&(f.contact_phone=n("Invalid Phone Number")),f},y=async f=>{f.preventDefault();const k=v();if(i(k),Object.keys(k).length>0)return;if(Object.values(c).some(g=>g!==null)){alert("Please fix validation errors before submitting");return}const x=new FormData;x.append("name",u.name),x.append("address",u.address),x.append("floors",u.floors),x.append("total_rooms",u.total_rooms),x.append("parking_spaces",u.parking_spaces),x.append("occupied_beds",u.occupied_beds),x.append("contact_phone",u.contact_phone),x.append("contact_email",u.contact_email),x.append("opening_hours",u.opening_hours),x.append("description",u.description),u.image&&x.append("image",u.image),e?s(e.id,x):a(x),r()};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:n(e?"editBuilding":"addBuilding")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:y,className:"p-6 space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("name")}),t.jsx(pe,{placeholder:n("name"),type:"text",name:"name",value:u.name,onChange:m,onValidationError:j("name"),fieldName:"Building Name",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),l.name&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.name})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("address")}),t.jsx(Tt,{name:"address",value:u.address,onChange:m,onValidationError:j("address"),fieldName:"Address",rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),l.address&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.address})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("floors")}),t.jsx(pe,{type:"text",name:"floors",value:u.floors,onChange:m,min:"1",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),l.floors&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.floors})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("total_rooms")}),t.jsx(pe,{type:"text",name:"total_rooms",value:u.total_rooms,onChange:m,min:"1",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),l.total_rooms&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.total_rooms})]})]}),t.jsx("div",{className:"grid grid-cols-2 gap-4",children:t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("parkingSpaces")}),t.jsx("input",{type:"text",name:"parking_spaces",value:u.parking_spaces,onChange:m,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),l.parking_spaces&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.parking_spaces})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("contactNumber")}),t.jsx(pe,{type:"text",name:"contact_phone",value:u.contact_phone,onChange:m,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),l.contact_phone&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.contact_phone})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("contactEmail")}),t.jsx(pe,{type:"email",name:"contact_email",value:u.contact_email,onChange:m,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),l.contact_email&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.contact_email})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("openingHours")}),t.jsx(pe,{type:"text",name:"opening_hours",value:u.opening_hours,placeholder:"Mon-Fri: 9AM-6PM",onChange:m,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),l.opening_hours&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.opening_hours})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("image")}),t.jsx(fa,{onChange:p,onValidationError:j("image"),maxSizeMB:10,allowedExtensions:["jpg","jpeg","png","gif"],checkSignature:!0,accept:"image/*",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),l.image&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.image})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("description")}),t.jsx(Tt,{name:"description",value:u.description,onChange:m,onValidationError:j("description"),fieldName:"Description",rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),l.description&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:l.description})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:n("cancel")}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:n("save")})]})]})]})})},yw=()=>{const{buildings:e,deleteBuilding:r,loading:a}=ae(),{hasPermission:s}=ie(),{t:n}=te(),[l,i]=b.useState(!1),[u,o]=b.useState(null),[c,d]=b.useState(!0);b.useEffect(()=>{e!==void 0&&d(!1)},[e]);const m=y=>{o(y),i(!0)},p=y=>{window.confirm("Are you sure you want to delete this building?")&&r(y)},j=()=>{i(!1),o(null)},v=y=>new Date(y).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0});return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:n("buildings")}),s("manage")&&t.jsxs("button",{onClick:()=>i(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:n("addBuilding")})]})]}),c?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-500 dark:text-gray-400",children:[t.jsx(Wg,{className:"h-8 w-8 animate-spin text-blue-500 mb-3"}),t.jsx("p",{className:"text-lg font-medium",children:n("loading")||"Loading..."})]}):!e||e.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center text-gray-500 dark:text-gray-400",children:[t.jsx(bt,{className:"h-10 w-10 text-gray-400 mb-3"}),t.jsx("p",{className:"text-lg font-medium",children:"No Data available"})]}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(y=>{var f,k,x;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-3 sm:p-6 border border-blue-400 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-start justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"hidden sm:block p-2 bg-blue-50 dark:bg-blue-900/20 rounded-lg",children:t.jsx(bt,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-sm sm:text-lg font-semibold text-gray-900 dark:text-white",children:y.name}),t.jsx("div",{className:"flex items-center text-[10px] sm:text-[11px] text-gray-500 dark:text-gray-400",children:v(y.createdAt)}),t.jsxs("div",{className:"flex items-center text-[10px] sm:text-[11px] text-blue-500 dark:text-gray-400 mt-1",children:[t.jsx(Qk,{className:"hidden sm:inline h-4 w-4 mr-1"}),y.address]})]})]}),s("manage")&&t.jsxs("div",{className:"flex space-x-2",children:[s("edit")&&t.jsx("button",{onClick:()=>m(y),className:"p-1 sm:p-2 text-yellow-600 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:t.jsx(It,{className:"h-4 w-4"})}),s("delete")&&t.jsx("button",{onClick:()=>p(y.id),className:"p-1 sm:p-2 text-red-600 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:t.jsx(Ar,{className:"h-4 w-4"})})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(bt,{className:"h-4 w-4 text-gray-400"}),t.jsxs("span",{className:"text-[11px] sm:text-base text-gray-600 dark:text-gray-300",children:[y.floors," ",n("floors")]})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(Wl,{className:"h-4 w-4 text-gray-400"}),t.jsxs("span",{className:"text-[11px] sm:text-base text-gray-600 dark:text-gray-300",children:[y.total_rooms," ",n("rooms")]})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(Vg,{className:"h-4 w-4 text-gray-400"}),t.jsxs("span",{className:"text-[11px] sm:text-base text-gray-600 dark:text-gray-300",children:[y.parking_spaces," ",n("parking")]})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("div",{className:"w-4 h-4 bg-green-500 rounded-full"}),t.jsxs("span",{className:"text-[11px] sm:text-base text-gray-600 dark:text-gray-300",children:[(f=y.buildingFloors)==null?void 0:f.reduce((g,h)=>{var S;const w=((S=h.rooms)==null?void 0:S.length)||0;return g+w},0)," ",n("rooms")]})]})]}),t.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex justify-between text-sm",children:[t.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:n("occupancyRate")}),t.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:(y==null?void 0:y.total_rooms)>0?(((k=y.buildingFloors)==null?void 0:k.reduce((g,h)=>{var S;const w=((S=h.rooms)==null?void 0:S.filter(C=>C.status!=="available").length)||0;return g+w},0))/y.total_rooms*100).toFixed(1)+"%":"0.0%"})]}),t.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2 mt-2",children:t.jsx("div",{className:"bg-green-500 h-2 rounded-full transition-all duration-300",style:{width:`${y.total_rooms>0?((x=y.buildingFloors)==null?void 0:x.reduce((g,h)=>{var S;const w=((S=h.rooms)==null?void 0:S.filter(C=>C.status!=="available").length)||0;return g+w},0))/y.total_rooms*100:0}%`}})})]})]},y.id)})}),l&&t.jsx(fw,{building:u,onClose:j})]})},bw=({floor:e,onClose:r})=>{const{buildings:a,floors:s=[],addFloor:n,updateFloor:l}=ae(),[i,u]=b.useState({building_id:"",buildingName:"",floor_number:"",total_rooms:0,floor_type:"residential",amenities:[],maintenance_status:"good",last_inspection:"",notes:""}),{t:o}=te(),[c,d]=b.useState(0),[m,p]=b.useState({}),[j,v]=b.useState({}),y=w=>S=>{p(C=>({...C,[w]:S}))},f=["Common Area","Fire Exit","Laundry","Storage","Elevator Access","Emergency Exit","CCTV","Water Cooler","Vending Machine","Seating Area"];b.useEffect(()=>{if(e){let w=[];try{const R=JSON.parse(e.amenities);w=typeof R=="string"?JSON.parse(R):R,Array.isArray(w)||(w=[])}catch{w=[]}const S=a.find(R=>R.id===e.building_id),N=s.filter(R=>R.building_id===(S==null?void 0:S.id)).reduce((R,F)=>R+(F.total_rooms||0),0),D=(S==null?void 0:S.total_rooms)??0;N>=D,d(D-N),u({building_id:e.building_id,buildingName:e.buildingName,floor_number:e.floor_number,total_rooms:e.total_rooms,floor_type:e.floor_type,amenities:w,maintenance_status:e.maintenance_status,last_inspection:e.last_inspection||"",notes:e.notes||""})}},[e]);const k=()=>{const w={};return i.building_id||(w.building_id=o("select a Building")),(!i.floor_number||!i.floor_number.trim())&&(w.floor_number=o("Floor Name is Required")),["residential","commercial","parking","common"].includes(i.floor_type)||(w.floor_type=o("Invalid Floor Type")),i.total_rooms<=0?w.total_rooms=o("Rooms is Required"):i.building_id&&i.total_rooms>c&&(w.total_rooms=o("Exceeds Building Limit",{remaining:c})),["good","needs_attention","under_maintenance"].includes(i.maintenance_status)||(w.maintenance_status=o("Invalid Maintenance Status")),i.last_inspection&&new Date(i.last_inspection)>new Date&&(w.last_inspection=o("Invalid Inspection Date")),(!i.amenities||i.amenities.length===0)&&(w.amenities=o("Select At Least One Amenity")),w},x=w=>{w.preventDefault();const S=k();if(v(S),Object.keys(S).length>0)return;const C={...i,amenities:JSON.stringify(i.amenities)};if(e){if(e.total_rooms+c<C.total_rooms){q.error("No more rooms can be added. The building has reached its limit.");return}l(e.id,C)}else{if(c<C.total_rooms){q.error("No more rooms can be added. The building has reached its limit.");return}n(C)}r()},g=w=>{const{name:S,value:C}=w.target;if(u(N=>({...N,[S]:S==="total_rooms"?parseInt(C)||0:C})),S==="building_id"&&C){const N=a.find(A=>A.id===C),R=s.filter(A=>A.building_id===(N==null?void 0:N.id)).reduce((A,P)=>A+(P.total_rooms||0),0),F=(N==null?void 0:N.total_rooms)??0;if(R>=F){q.error("No more rooms can be added. The building has reached its limit.");return}else d(F-R);u(A=>({...A,buildingName:(N==null?void 0:N.name)||""}))}},h=w=>{u(S=>({...S,amenities:S.amenities.includes(w)?S.amenities.filter(C=>C!==w):[...S.amenities,w]}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:o(e?"editFloor":"addNewFloor")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:x,className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("building")}),t.jsxs("select",{name:"building_id",value:i.building_id,onChange:g,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:"Select a building"}),a.map(w=>t.jsx("option",{value:w.id,children:w.name},w.id))]}),j.building_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:j.building_id})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("floorName")}),t.jsx(pe,{type:"text",name:"floor_number",value:i.floor_number,onChange:g,onValidationError:y("floor_number"),fieldName:"Floor Name",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),j.floor_number&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:j.floor_number})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("floorType")}),t.jsxs("select",{name:"floor_type",value:i.floor_type,onChange:g,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"residential",children:o("residential")}),t.jsx("option",{value:"commercial",children:o("commercial")}),t.jsx("option",{value:"parking",children:o("parking")}),t.jsx("option",{value:"common",children:o("commonArea")})]}),j.floor_type&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:j.floor_type})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("maintenanceStatus")}),t.jsxs("select",{name:"maintenance_status",value:i.maintenance_status,onChange:g,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"good",children:o("good")}),t.jsx("option",{value:"needs_attention",children:o("needsAttention")}),t.jsx("option",{value:"under_maintenance",children:o("underMaintenance")})]}),j.maintenance_status&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:j.maintenance_status})]})]}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[o("totalRooms")," ",c>=0&&i.building_id&&`( ${o("buildinghasroomslimit")} ${c} )`]}),t.jsx("input",{type:"text",name:"total_rooms",value:i.total_rooms,onChange:g,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),j.total_rooms&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:j.total_rooms})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("lastInspectionDate")}),t.jsx("input",{type:"date",name:"last_inspection",value:i.last_inspection,onChange:g,required:!0,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),j.last_inspection&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:j.last_inspection})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("amenities")}),t.jsx("div",{className:"grid grid-cols-2 gap-2",children:f.map(w=>t.jsxs("label",{className:"flex items-center space-x-2",children:[t.jsx("input",{type:"checkbox",checked:i.amenities.includes(w),onChange:()=>h(w),className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:w})]},w))}),j.amenities&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:j.amenities})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("notes")}),t.jsx(Tt,{name:"notes",value:i.notes,onChange:g,onValidationError:y("notes"),fieldName:"Notes",rows:3,placeholder:o("anyadditionalnotes"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),m.notes&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.notes})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:o("cancel")}),t.jsxs("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[o(e?"update":"create")," ",o("floor")]})]})]})]})})},vw=()=>{const{floors:e=[],buildings:r=[],deleteFloor:a}=ae(),{hasPermission:s}=ie(),[n,l]=b.useState(!1),[i,u]=b.useState(null),[o,c]=b.useState({building_id:"",floor_type:"",maintenance_status:""}),{t:d}=te(),[m,p]=b.useState(!0),j=S=>{u(S),l(!0)};b.useEffect(()=>{o!==void 0&&p(!1)},[o]);const v=S=>{window.confirm("Are you sure you want to delete this floor? This will also delete all rooms and beds on this floor.")&&a(S)},y=()=>{l(!1),u(null)},f=S=>{switch(S){case"good":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"needs_attention":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";case"under_maintenance":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},k=S=>{switch(S){case"good":return t.jsx(vt,{className:"h-4 w-4 text-green-600"});case"needs_attention":return t.jsx(Qt,{className:"h-4 w-4 text-yellow-600"});case"under_maintenance":return t.jsx(Qt,{className:"h-4 w-4 text-red-600"});default:return t.jsx(vt,{className:"h-4 w-4 text-gray-600"})}},x=S=>{switch(S){case"residential":return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400";case"commercial":return"bg-purple-100 text-purple-800 dark:bg-purple-900/20 dark:text-purple-400";case"parking":return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400";case"common":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},g=e.filter(S=>!(o.building_id&&S.building_id!==o.building_id||o.floor_type&&S.floor_type!==o.floor_type||o.maintenance_status&&S.maintenance_status!==o.maintenance_status)),h={total:e.length,residential:e.filter(S=>S.floor_type==="residential").length,commercial:e.filter(S=>S.floor_type==="commercial").length,parking:e.filter(S=>S.floor_type==="parking").length,needsAttention:e.filter(S=>S.maintenance_status==="needs_attention").length,underMaintenance:e.filter(S=>S.maintenance_status==="under_maintenance").length},w=S=>new Date(S).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0});return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:d("floorManagement")}),t.jsx("p",{className:"text-[10px] sm:text-sm text-gray-600 dark:text-gray-400 mt-1",children:d("floorManagementDes")})]}),s("manage")&&t.jsxs("button",{onClick:()=>l(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:d("addFloor")})]})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:h.total}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:d("totalFloors")})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 sm:p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-900 dark:text-blue-100",children:h.residential}),t.jsx("div",{className:"text-xs sm:text-sm text-blue-600 dark:text-blue-400",children:d("residential")})]}),t.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 p-3 sm:p-4 rounded-lg border border-purple-200 dark:border-purple-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-purple-900 dark:text-purple-100",children:h.commercial}),t.jsx("div",{className:"text-xs sm:text-sm text-purple-600 dark:text-purple-400",children:d("commercial")})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/20 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-gray-100",children:h.parking}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:d("parking")})]}),t.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 sm:p-4 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-yellow-900 dark:text-yellow-100",children:h.needsAttention}),t.jsx("div",{className:"text-xs sm:text-sm text-yellow-600 dark:text-yellow-400",children:d("needsAttention")})]}),t.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 sm:p-4 rounded-lg border border-red-200 dark:border-red-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-red-900 dark:text-red-100",children:h.underMaintenance}),t.jsx("div",{className:"text-xs sm:text-sm text-red-600 dark:text-red-400",children:d("underMaintenance")})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6 ",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:d("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("buildings")}),t.jsxs("select",{value:o.building_id,onChange:S=>c(C=>({...C,building_id:S.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allBuildings")}),r.map(S=>t.jsx("option",{value:S.id,children:S.name},S.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("floorTypes")}),t.jsxs("select",{value:o.floor_type,onChange:S=>c(C=>({...C,floor_type:S.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allTypes")}),t.jsx("option",{value:"residential",children:d("residential")}),t.jsx("option",{value:"commercial",children:d("commercial")}),t.jsx("option",{value:"parking",children:d("parking")}),t.jsx("option",{value:"common",children:d("commonArea")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("maintenanceStatus")}),t.jsxs("select",{value:o.maintenance_status,onChange:S=>c(C=>({...C,maintenance_status:S.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allStatus")}),t.jsx("option",{value:"good",children:d("good")}),t.jsx("option",{value:"needs_attention",children:d("needsAttention")}),t.jsx("option",{value:"under_maintenance",children:d("underMaintenance")})]})]})]})]}),m?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-gray-500 dark:text-gray-400",children:[t.jsx(Wg,{className:"h-8 w-8 animate-spin text-blue-500 mb-3"}),t.jsx("p",{className:"text-lg font-medium",children:d("loading")||"Loading..."})]}):!g||g.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center text-gray-500 dark:text-gray-400",children:[t.jsx(bt,{className:"h-10 w-10 text-gray-400 mb-3"}),t.jsx("p",{className:"text-lg font-medium",children:"No Data available"})]}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:g.map(S=>{var C;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-3 sm:p-6 border border-blue-400 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-start justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"hidden sm:block p-2 bg-blue-50 dark:bg-blue-900/20 rounded-lg",children:t.jsx(bt,{className:"h-6 w-6 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsxs("h3",{className:"text-sm sm:text-lg font-semibold text-gray-900 dark:text-white",children:[d("floor")," ",S.floor_number]}),t.jsx("p",{className:"text-[10px] sm:text-[11px] text-gray-500 dark:text-gray-400",children:w(S.createdAt)}),t.jsx("p",{className:"text-[10px] sm:text-[11px] text-gray-500 dark:text-gray-400",children:((C=S.building)==null?void 0:C.name)||""})]})]}),s("manage")&&t.jsxs("div",{className:"flex space-x-2",children:[s("edit")&&t.jsx("button",{onClick:()=>j(S),className:"p-1 sm:p-2 text-yellow-600 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",children:t.jsx(It,{className:"h-4 w-4"})}),s("delete")&&t.jsx("button",{onClick:()=>v(S.id),className:"p-1 sm:p-2 text-red-600 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",children:t.jsx(Ar,{className:"h-4 w-4"})})]})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(Wl,{className:"h-4 w-4 text-gray-400"}),t.jsx("span",{className:"text-[11px] sm:text-sm text-gray-600 dark:text-gray-300",children:d("roomOccupancy")})]}),t.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[S.rooms.length,"/",S.total_rooms]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-[11px] sm:text-sm text-gray-600 dark:text-gray-300",children:d("floorTypes")}),t.jsx("span",{className:`px-2 py-1 rounded-full text-[10px] sm:text-xs font-medium capitalize ${x(S.floor_type)}`,children:S.floor_type})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-[11px] sm:text-sm text-gray-600 dark:text-gray-300",children:d("maintenanceStatus")}),t.jsxs("div",{className:"flex items-center space-x-1",children:[k(S.maintenance_status),t.jsx("span",{className:`px-2 py-1 rounded-full text-[10px] sm:text-xs font-medium capitalize ${f(S.maintenance_status)}`,children:S.maintenance_status.replace("_"," ")})]})]}),S.last_inspection&&t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-[11px] sm:text-sm text-gray-600 dark:text-gray-300",children:d("lastInspection")}),t.jsx("span",{className:"text-[11px] sm:text-sm text-gray-900 dark:text-white",children:new Date(S.last_inspection).toLocaleDateString()})]}),t.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-[11px] sm:text-sm text-gray-600 dark:text-gray-300 mb-2",children:d("amenities")}),t.jsx("div",{className:"flex flex-wrap gap-1",children:(()=>{let N=[];try{const D=JSON.parse(S.amenities);N=typeof D=="string"?JSON.parse(D):D,Array.isArray(N)||(N=[])}catch{N=[]}return N.length>0?N.map((D,R)=>t.jsx("span",{className:"px-2 py-1 bg-gray-100 dark:bg-gray-700 text-[10px] sm:text-xs text-gray-600 dark:text-gray-300 rounded-full",children:D},R)):t.jsx("span",{className:"text-[11px] sm:text-sm text-gray-500 dark:text-gray-400",children:d("noamenities")})})()})]}),S.notes&&t.jsx("div",{className:"pt-2",children:t.jsxs("p",{className:"text-[10px] sm:text-xs text-gray-500 dark:text-gray-400",children:[t.jsxs("strong",{children:[d("notes"),":"]})," ",S.notes]})})]})]},S.id)})}),n&&t.jsx(bw,{floor:i,onClose:y})]})},kw=({room:e,onClose:r})=>{const{buildings:a,rooms:s,addRoom:n,updateRoom:l,getFloorsBybuildId:i}=ae(),{t:u}=te(),[o,c]=b.useState({building_id:"",buildingName:"",room_number:"",reservation_note:"",available_from:null,floor_id:"",status:"available",occupied_beds:0,rent_per_bed:0,facilities:[]}),[d,m]=b.useState([]),p=ge(),[j,v]=b.useState(0),[y,f]=b.useState(""),k=["AC","WiFi","Attached Bathroom","Balcony","Parking","Kitchen Access","Laundry"],[x,g]=b.useState({}),[h,w]=b.useState({}),S=F=>A=>{g(P=>({...P,[F]:A}))};b.useEffect(()=>{o.building_id&&i(o.building_id).then(m)},[o.building_id]),b.useEffect(()=>{if(e){let F=[];try{const P=JSON.parse(e.facilities);F=typeof P=="string"?JSON.parse(P):P,Array.isArray(F)||(F=[])}catch{F=[]}const A=P=>{if(!P)return"";const[M,T]=P.split("T"),_=T.split(".")[0];return`${M} ${_}`};c({building_id:e.building_id,buildingName:e.buildingName,room_number:e.room_number,reservation_note:e.reservation_note,floor_id:e.floor_id,occupied_beds:e.occupied_beds,status:e.status,facilities:F,available_from:e.available_from?A(e.available_from):null,rent_per_bed:e.rent_per_bed})}},[e]);const C=()=>{const F={};return o.building_id||(F.building_id=u("selectBuilding")),o.floor_id||(F.floor_id=u("selectFloor")),(!o.room_number||!o.room_number.trim())&&(F.room_number=u("roomNumberRequired")),["available","occupied","maintenance","booked"].includes(o.status)||(F.status=u("invalidStatus")),o.rent_per_bed===null||o.rent_per_bed===void 0||o.rent_per_bed===""?F.rent_per_bed=u("rentRequired"):isNaN(Number(o.rent_per_bed))?F.rent_per_bed=u("rentMustBeNumber"):Number(o.rent_per_bed)<0&&(F.rent_per_bed=u("rentCannotBeNegative")),F},N=F=>{F.preventDefault();const A=C();if(w(A),Object.keys(A).length>0)return;const P=a.find(T=>T.id===o.building_id),M={...o,buildingName:(P==null?void 0:P.name)||"",facilities:JSON.stringify(o.facilities)};e?l(e.id,M):n(M),r()},D=F=>{const{name:A,value:P}=F.target,M=["occupied_beds","rent_per_bed"];if(c(T=>({...T,[A]:M.includes(A)?parseInt(P)||0:P})),A==="floor_id")if(P){const T=d.find(H=>H.id===P),_=s.filter(H=>H.floor_id===(T==null?void 0:T.id));f(`${_.length}/${T.total_rooms}`)}else f("")},R=F=>{c(A=>({...A,facilities:A.facilities.includes(F)?A.facilities.filter(P=>P!==F):[...A.facilities,F]}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:u(e?"editRoom":"addRoom")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:N,className:"p-6 space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("building")}),t.jsxs("select",{name:"building_id",value:o.building_id,onChange:D,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:u("selectabuilding")}),a.map(F=>t.jsx("option",{value:F.id,children:F.name},F.id))]}),h.building_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.building_id})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[u("roomNumber")," ",y&&`(${y})`]}),t.jsx(pe,{type:"text",name:"room_number",value:o.room_number,onChange:D,onValidationError:S("room_number"),fieldName:"Room Number",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),h.room_number&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.room_number})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("floor")}),t.jsxs("select",{name:"floor_id",value:o.floor_id,onChange:D,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:u("selectafloor")}),d.map(F=>t.jsx("option",{value:F.id,children:`${u("floor")} ${F.floor_number}`},F.id))]}),h.floor_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.floor_id})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("status")}),t.jsxs("select",{name:"status",value:o.status,onChange:D,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",disabled:e&&e.status=="occupied",children:[t.jsx("option",{value:"available",children:u("available")}),e&&e.status=="occupied"&&t.jsx("option",{value:"occupied",children:u("occupied")}),t.jsx("option",{value:"maintenance",children:u("maintenance")}),t.jsx("option",{value:"booked",children:u("booked")})]}),h.status&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.status})]}),t.jsxs("div",{children:[o.status==="booked"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("date")}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:t.jsx(ut,{className:"h-4 w-4 text-gray-400"})}),t.jsx("input",{type:"datetime-local",name:"available_from",value:o.available_from,onChange:D,required:!0,className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]}),t.jsxs("div",{className:"mt-4 mb-4",children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("reservationNote")}),t.jsx(Tt,{name:"reservation_note",value:o.reservation_note||"",onChange:D,onValidationError:S("reservation_note"),fieldName:"Reservation Note",rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",placeholder:u("enterReservationNote")}),x.reservation_note&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:x.reservation_note})]})]}),t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[u("rentAmount")," (",p,")"]}),t.jsx("input",{type:"text",name:"rent_per_bed",value:o.rent_per_bed,onChange:D,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),h.rent_per_bed&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.rent_per_bed})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("facilities")}),t.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(F=>t.jsxs("label",{className:"flex items-center space-x-2",children:[t.jsx("input",{type:"checkbox",checked:o.facilities.includes(F),onChange:()=>R(F),className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:F})]},F))})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:u("cancel")}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:u("save")})]})]})]})})},jw=({room:e,onClose:r})=>{const{renters:a}=ae(),{t:s}=te(),[n,l]=b.useState(null),i=ge(),u=[{value:"nid",label:"Emirates ID"},{value:"passport",label:"Passport"},{value:"contract",label:"Rental Contract"},{value:"photo",label:"Profile Photo"},{value:"income_proof",label:"Income Proof"},{value:"reference",label:"Reference Letter"},{value:"other",label:"Other Document"}];b.useEffect(()=>{if(e){const c=a.find(d=>d.id===e.renter_id);l(c||null)}},[e,a]);const o=c=>{var d;return((d=u.find(m=>m.value===c))==null?void 0:d.label)||c};return!e||!n?null:(console.log(n),t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:s("renterDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("div",{className:"p-6 grid grid-cols-1 md:grid-cols-2 gap-8",children:[t.jsx("section",{children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("name")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:n.name})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("email")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:n.email})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("phone")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:n.phone})]}),n.alternate_phone&&t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("alternatePhone")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:n.alternate_phone})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("Emirates ID")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:n.nid})]})]})}),t.jsxs("section",{children:[t.jsx("div",{className:"space-y-3 mb-6",children:t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("rentAmount")}),t.jsxs("p",{className:"font-medium text-gray-900 dark:text-white",children:[i," ",n.rent_amount]})]})}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("building")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:n.building.name})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("floor")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:e.floor.floor_number})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm text-gray-500",children:s("room")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:e.room_number})]})]})]})]}),t.jsx("div",{className:"pt-0 p-6",children:n.documents.length>0&&t.jsxs("div",{className:"space-y-2 pt-4",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:s("uploadedDocuments")}),n.documents.map(c=>t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Ue,{className:"h-5 w-5 text-blue-600"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:o(c.type)}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[c.file_name," • ",c.updated_at]}),c.description&&t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:c.description})]})]}),t.jsx("div",{className:"flex items-center space-x-2",children:t.jsx("button",{type:"button",onClick:()=>window.open(c.file_url,"_blank"),className:"p-1 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(nt,{className:"h-4 w-4"})})})]},c.id))]})})]})}))};var ww=Object.defineProperty,yl=Object.getOwnPropertySymbols,tx=Object.prototype.hasOwnProperty,rx=Object.prototype.propertyIsEnumerable,Du=(e,r,a)=>r in e?ww(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,Fo=(e,r)=>{for(var a in r||(r={}))tx.call(r,a)&&Du(e,a,r[a]);if(yl)for(var a of yl(r))rx.call(r,a)&&Du(e,a,r[a]);return e},To=(e,r)=>{var a={};for(var s in e)tx.call(e,s)&&r.indexOf(s)<0&&(a[s]=e[s]);if(e!=null&&yl)for(var s of yl(e))r.indexOf(s)<0&&rx.call(e,s)&&(a[s]=e[s]);return a};/**
* @license QR Code generator library (TypeScript)
* Copyright (c) Project Nayuki.
* SPDX-License-Identifier: MIT
*/var Kr;(e=>{const r=class ne{constructor(o,c,d,m){if(this.version=o,this.errorCorrectionLevel=c,this.modules=[],this.isFunction=[],o<ne.MIN_VERSION||o>ne.MAX_VERSION)throw new RangeError("Version value out of range");if(m<-1||m>7)throw new RangeError("Mask value out of range");this.size=o*4+17;let p=[];for(let v=0;v<this.size;v++)p.push(!1);for(let v=0;v<this.size;v++)this.modules.push(p.slice()),this.isFunction.push(p.slice());this.drawFunctionPatterns();const j=this.addEccAndInterleave(d);if(this.drawCodewords(j),m==-1){let v=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);const f=this.getPenaltyScore();f<v&&(m=y,v=f),this.applyMask(y)}}n(0<=m&&m<=7),this.mask=m,this.applyMask(m),this.drawFormatBits(m),this.isFunction=[]}static encodeText(o,c){const d=e.QrSegment.makeSegments(o);return ne.encodeSegments(d,c)}static encodeBinary(o,c){const d=e.QrSegment.makeBytes(o);return ne.encodeSegments([d],c)}static encodeSegments(o,c,d=1,m=40,p=-1,j=!0){if(!(ne.MIN_VERSION<=d&&d<=m&&m<=ne.MAX_VERSION)||p<-1||p>7)throw new RangeError("Invalid value");let v,y;for(v=d;;v++){const g=ne.getNumDataCodewords(v,c)*8,h=i.getTotalBits(o,v);if(h<=g){y=h;break}if(v>=m)throw new RangeError("Data too long")}for(const g of[ne.Ecc.MEDIUM,ne.Ecc.QUARTILE,ne.Ecc.HIGH])j&&y<=ne.getNumDataCodewords(v,g)*8&&(c=g);let f=[];for(const g of o){a(g.mode.modeBits,4,f),a(g.numChars,g.mode.numCharCountBits(v),f);for(const h of g.getData())f.push(h)}n(f.length==y);const k=ne.getNumDataCodewords(v,c)*8;n(f.length<=k),a(0,Math.min(4,k-f.length),f),a(0,(8-f.length%8)%8,f),n(f.length%8==0);for(let g=236;f.length<k;g^=253)a(g,8,f);let x=[];for(;x.length*8<f.length;)x.push(0);return f.forEach((g,h)=>x[h>>>3]|=g<<7-(h&7)),new ne(v,c,x,p)}getModule(o,c){return 0<=o&&o<this.size&&0<=c&&c<this.size&&this.modules[c][o]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const o=this.getAlignmentPatternPositions(),c=o.length;for(let d=0;d<c;d++)for(let m=0;m<c;m++)d==0&&m==0||d==0&&m==c-1||d==c-1&&m==0||this.drawAlignmentPattern(o[d],o[m]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(o){const c=this.errorCorrectionLevel.formatBits<<3|o;let d=c;for(let p=0;p<10;p++)d=d<<1^(d>>>9)*1335;const m=(c<<10|d)^21522;n(m>>>15==0);for(let p=0;p<=5;p++)this.setFunctionModule(8,p,s(m,p));this.setFunctionModule(8,7,s(m,6)),this.setFunctionModule(8,8,s(m,7)),this.setFunctionModule(7,8,s(m,8));for(let p=9;p<15;p++)this.setFunctionModule(14-p,8,s(m,p));for(let p=0;p<8;p++)this.setFunctionModule(this.size-1-p,8,s(m,p));for(let p=8;p<15;p++)this.setFunctionModule(8,this.size-15+p,s(m,p));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let o=this.version;for(let d=0;d<12;d++)o=o<<1^(o>>>11)*7973;const c=this.version<<12|o;n(c>>>18==0);for(let d=0;d<18;d++){const m=s(c,d),p=this.size-11+d%3,j=Math.floor(d/3);this.setFunctionModule(p,j,m),this.setFunctionModule(j,p,m)}}drawFinderPattern(o,c){for(let d=-4;d<=4;d++)for(let m=-4;m<=4;m++){const p=Math.max(Math.abs(m),Math.abs(d)),j=o+m,v=c+d;0<=j&&j<this.size&&0<=v&&v<this.size&&this.setFunctionModule(j,v,p!=2&&p!=4)}}drawAlignmentPattern(o,c){for(let d=-2;d<=2;d++)for(let m=-2;m<=2;m++)this.setFunctionModule(o+m,c+d,Math.max(Math.abs(m),Math.abs(d))!=1)}setFunctionModule(o,c,d){this.modules[c][o]=d,this.isFunction[c][o]=!0}addEccAndInterleave(o){const c=this.version,d=this.errorCorrectionLevel;if(o.length!=ne.getNumDataCodewords(c,d))throw new RangeError("Invalid argument");const m=ne.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][c],p=ne.ECC_CODEWORDS_PER_BLOCK[d.ordinal][c],j=Math.floor(ne.getNumRawDataModules(c)/8),v=m-j%m,y=Math.floor(j/m);let f=[];const k=ne.reedSolomonComputeDivisor(p);for(let g=0,h=0;g<m;g++){let w=o.slice(h,h+y-p+(g<v?0:1));h+=w.length;const S=ne.reedSolomonComputeRemainder(w,k);g<v&&w.push(0),f.push(w.concat(S))}let x=[];for(let g=0;g<f[0].length;g++)f.forEach((h,w)=>{(g!=y-p||w>=v)&&x.push(h[g])});return n(x.length==j),x}drawCodewords(o){if(o.length!=Math.floor(ne.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let c=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let m=0;m<this.size;m++)for(let p=0;p<2;p++){const j=d-p,y=(d+1&2)==0?this.size-1-m:m;!this.isFunction[y][j]&&c<o.length*8&&(this.modules[y][j]=s(o[c>>>3],7-(c&7)),c++)}}n(c==o.length*8)}applyMask(o){if(o<0||o>7)throw new RangeError("Mask value out of range");for(let c=0;c<this.size;c++)for(let d=0;d<this.size;d++){let m;switch(o){case 0:m=(d+c)%2==0;break;case 1:m=c%2==0;break;case 2:m=d%3==0;break;case 3:m=(d+c)%3==0;break;case 4:m=(Math.floor(d/3)+Math.floor(c/2))%2==0;break;case 5:m=d*c%2+d*c%3==0;break;case 6:m=(d*c%2+d*c%3)%2==0;break;case 7:m=((d+c)%2+d*c%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[c][d]&&m&&(this.modules[c][d]=!this.modules[c][d])}}getPenaltyScore(){let o=0;for(let p=0;p<this.size;p++){let j=!1,v=0,y=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[p][f]==j?(v++,v==5?o+=ne.PENALTY_N1:v>5&&o++):(this.finderPenaltyAddHistory(v,y),j||(o+=this.finderPenaltyCountPatterns(y)*ne.PENALTY_N3),j=this.modules[p][f],v=1);o+=this.finderPenaltyTerminateAndCount(j,v,y)*ne.PENALTY_N3}for(let p=0;p<this.size;p++){let j=!1,v=0,y=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[f][p]==j?(v++,v==5?o+=ne.PENALTY_N1:v>5&&o++):(this.finderPenaltyAddHistory(v,y),j||(o+=this.finderPenaltyCountPatterns(y)*ne.PENALTY_N3),j=this.modules[f][p],v=1);o+=this.finderPenaltyTerminateAndCount(j,v,y)*ne.PENALTY_N3}for(let p=0;p<this.size-1;p++)for(let j=0;j<this.size-1;j++){const v=this.modules[p][j];v==this.modules[p][j+1]&&v==this.modules[p+1][j]&&v==this.modules[p+1][j+1]&&(o+=ne.PENALTY_N2)}let c=0;for(const p of this.modules)c=p.reduce((j,v)=>j+(v?1:0),c);const d=this.size*this.size,m=Math.ceil(Math.abs(c*20-d*10)/d)-1;return n(0<=m&&m<=9),o+=m*ne.PENALTY_N4,n(0<=o&&o<=2568888),o}getAlignmentPatternPositions(){if(this.version==1)return[];{const o=Math.floor(this.version/7)+2,c=this.version==32?26:Math.ceil((this.version*4+4)/(o*2-2))*2;let d=[6];for(let m=this.size-7;d.length<o;m-=c)d.splice(1,0,m);return d}}static getNumRawDataModules(o){if(o<ne.MIN_VERSION||o>ne.MAX_VERSION)throw new RangeError("Version number out of range");let c=(16*o+128)*o+64;if(o>=2){const d=Math.floor(o/7)+2;c-=(25*d-10)*d-55,o>=7&&(c-=36)}return n(208<=c&&c<=29648),c}static getNumDataCodewords(o,c){return Math.floor(ne.getNumRawDataModules(o)/8)-ne.ECC_CODEWORDS_PER_BLOCK[c.ordinal][o]*ne.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][o]}static reedSolomonComputeDivisor(o){if(o<1||o>255)throw new RangeError("Degree out of range");let c=[];for(let m=0;m<o-1;m++)c.push(0);c.push(1);let d=1;for(let m=0;m<o;m++){for(let p=0;p<c.length;p++)c[p]=ne.reedSolomonMultiply(c[p],d),p+1<c.length&&(c[p]^=c[p+1]);d=ne.reedSolomonMultiply(d,2)}return c}static reedSolomonComputeRemainder(o,c){let d=c.map(m=>0);for(const m of o){const p=m^d.shift();d.push(0),c.forEach((j,v)=>d[v]^=ne.reedSolomonMultiply(j,p))}return d}static reedSolomonMultiply(o,c){if(o>>>8||c>>>8)throw new RangeError("Byte out of range");let d=0;for(let m=7;m>=0;m--)d=d<<1^(d>>>7)*285,d^=(c>>>m&1)*o;return n(d>>>8==0),d}finderPenaltyCountPatterns(o){const c=o[1];n(c<=this.size*3);const d=c>0&&o[2]==c&&o[3]==c*3&&o[4]==c&&o[5]==c;return(d&&o[0]>=c*4&&o[6]>=c?1:0)+(d&&o[6]>=c*4&&o[0]>=c?1:0)}finderPenaltyTerminateAndCount(o,c,d){return o&&(this.finderPenaltyAddHistory(c,d),c=0),c+=this.size,this.finderPenaltyAddHistory(c,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(o,c){c[0]==0&&(o+=this.size),c.pop(),c.unshift(o)}};r.MIN_VERSION=1,r.MAX_VERSION=40,r.PENALTY_N1=3,r.PENALTY_N2=3,r.PENALTY_N3=40,r.PENALTY_N4=10,r.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],r.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=r;function a(u,o,c){if(o<0||o>31||u>>>o)throw new RangeError("Value out of range");for(let d=o-1;d>=0;d--)c.push(u>>>d&1)}function s(u,o){return(u>>>o&1)!=0}function n(u){if(!u)throw new Error("Assertion error")}const l=class _e{constructor(o,c,d){if(this.mode=o,this.numChars=c,this.bitData=d,c<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(o){let c=[];for(const d of o)a(d,8,c);return new _e(_e.Mode.BYTE,o.length,c)}static makeNumeric(o){if(!_e.isNumeric(o))throw new RangeError("String contains non-numeric characters");let c=[];for(let d=0;d<o.length;){const m=Math.min(o.length-d,3);a(parseInt(o.substring(d,d+m),10),m*3+1,c),d+=m}return new _e(_e.Mode.NUMERIC,o.length,c)}static makeAlphanumeric(o){if(!_e.isAlphanumeric(o))throw new RangeError("String contains unencodable characters in alphanumeric mode");let c=[],d;for(d=0;d+2<=o.length;d+=2){let m=_e.ALPHANUMERIC_CHARSET.indexOf(o.charAt(d))*45;m+=_e.ALPHANUMERIC_CHARSET.indexOf(o.charAt(d+1)),a(m,11,c)}return d<o.length&&a(_e.ALPHANUMERIC_CHARSET.indexOf(o.charAt(d)),6,c),new _e(_e.Mode.ALPHANUMERIC,o.length,c)}static makeSegments(o){return o==""?[]:_e.isNumeric(o)?[_e.makeNumeric(o)]:_e.isAlphanumeric(o)?[_e.makeAlphanumeric(o)]:[_e.makeBytes(_e.toUtf8ByteArray(o))]}static makeEci(o){let c=[];if(o<0)throw new RangeError("ECI assignment value out of range");if(o<128)a(o,8,c);else if(o<16384)a(2,2,c),a(o,14,c);else if(o<1e6)a(6,3,c),a(o,21,c);else throw new RangeError("ECI assignment value out of range");return new _e(_e.Mode.ECI,0,c)}static isNumeric(o){return _e.NUMERIC_REGEX.test(o)}static isAlphanumeric(o){return _e.ALPHANUMERIC_REGEX.test(o)}getData(){return this.bitData.slice()}static getTotalBits(o,c){let d=0;for(const m of o){const p=m.mode.numCharCountBits(c);if(m.numChars>=1<<p)return 1/0;d+=4+p+m.bitData.length}return d}static toUtf8ByteArray(o){o=encodeURI(o);let c=[];for(let d=0;d<o.length;d++)o.charAt(d)!="%"?c.push(o.charCodeAt(d)):(c.push(parseInt(o.substring(d+1,d+3),16)),d+=2);return c}};l.NUMERIC_REGEX=/^[0-9]*$/,l.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,l.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let i=l;e.QrSegment=l})(Kr||(Kr={}));(e=>{(r=>{const a=class{constructor(n,l){this.ordinal=n,this.formatBits=l}};a.LOW=new a(0,1),a.MEDIUM=new a(1,0),a.QUARTILE=new a(2,3),a.HIGH=new a(3,2),r.Ecc=a})(e.QrCode||(e.QrCode={}))})(Kr||(Kr={}));(e=>{(r=>{const a=class{constructor(n,l){this.modeBits=n,this.numBitsCharCount=l}numCharCountBits(n){return this.numBitsCharCount[Math.floor((n+7)/17)]}};a.NUMERIC=new a(1,[10,12,14]),a.ALPHANUMERIC=new a(2,[9,11,13]),a.BYTE=new a(4,[8,16,16]),a.KANJI=new a(8,[8,10,12]),a.ECI=new a(7,[0,0,0]),r.Mode=a})(e.QrSegment||(e.QrSegment={}))})(Kr||(Kr={}));var ya=Kr;/**
* @license qrcode.react
* Copyright (c) Paul O'Shannessy
* SPDX-License-Identifier: ISC
*/var Nw={L:ya.QrCode.Ecc.LOW,M:ya.QrCode.Ecc.MEDIUM,Q:ya.QrCode.Ecc.QUARTILE,H:ya.QrCode.Ecc.HIGH},ax=128,sx="L",nx="#FFFFFF",lx="#000000",ix=!1,ox=1,_w=4,Sw=0,Cw=.1;function dx(e,r=0){const a=[];return e.forEach(function(s,n){let l=null;s.forEach(function(i,u){if(!i&&l!==null){a.push(`M${l+r} ${n+r}h${u-l}v1H${l+r}z`),l=null;return}if(u===s.length-1){if(!i)return;l===null?a.push(`M${u+r},${n+r} h1v1H${u+r}z`):a.push(`M${l+r},${n+r} h${u+1-l}v1H${l+r}z`);return}i&&l===null&&(l=u)})}),a.join("")}function cx(e,r){return e.slice().map((a,s)=>s<r.y||s>=r.y+r.h?a:a.map((n,l)=>l<r.x||l>=r.x+r.w?n:!1))}function Ew(e,r,a,s){if(s==null)return null;const n=e.length+a*2,l=Math.floor(r*Cw),i=n/r,u=(s.width||l)*i,o=(s.height||l)*i,c=s.x==null?e.length/2-u/2:s.x*i,d=s.y==null?e.length/2-o/2:s.y*i,m=s.opacity==null?1:s.opacity;let p=null;if(s.excavate){let v=Math.floor(c),y=Math.floor(d),f=Math.ceil(u+c-v),k=Math.ceil(o+d-y);p={x:v,y,w:f,h:k}}const j=s.crossOrigin;return{x:c,y:d,h:o,w:u,excavation:p,opacity:m,crossOrigin:j}}function Rw(e,r){return r!=null?Math.max(Math.floor(r),0):e?_w:Sw}function ux({value:e,level:r,minVersion:a,includeMargin:s,marginSize:n,imageSettings:l,size:i,boostLevel:u}){let o=De.useMemo(()=>{const v=(Array.isArray(e)?e:[e]).reduce((y,f)=>(y.push(...ya.QrSegment.makeSegments(f)),y),[]);return ya.QrCode.encodeSegments(v,Nw[r],a,void 0,void 0,u)},[e,r,a,u]);const{cells:c,margin:d,numCells:m,calculatedImageSettings:p}=De.useMemo(()=>{let j=o.getModules();const v=Rw(s,n),y=j.length+v*2,f=Ew(j,i,v,l);return{cells:j,margin:v,numCells:y,calculatedImageSettings:f}},[o,i,l,s,n]);return{qrcode:o,margin:d,cells:c,numCells:m,calculatedImageSettings:p}}var Pw=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),mx=De.forwardRef(function(r,a){const s=r,{value:n,size:l=ax,level:i=sx,bgColor:u=nx,fgColor:o=lx,includeMargin:c=ix,minVersion:d=ox,boostLevel:m,marginSize:p,imageSettings:j}=s,y=To(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:f}=y,k=To(y,["style"]),x=j==null?void 0:j.src,g=De.useRef(null),h=De.useRef(null),w=De.useCallback(M=>{g.current=M,typeof a=="function"?a(M):a&&(a.current=M)},[a]),[S,C]=De.useState(!1),{margin:N,cells:D,numCells:R,calculatedImageSettings:F}=ux({value:n,level:i,minVersion:d,boostLevel:m,includeMargin:c,marginSize:p,imageSettings:j,size:l});De.useEffect(()=>{if(g.current!=null){const M=g.current,T=M.getContext("2d");if(!T)return;let _=D;const H=h.current,B=F!=null&&H!==null&&H.complete&&H.naturalHeight!==0&&H.naturalWidth!==0;B&&F.excavation!=null&&(_=cx(D,F.excavation));const U=window.devicePixelRatio||1;M.height=M.width=l*U;const V=l/R*U;T.scale(V,V),T.fillStyle=u,T.fillRect(0,0,R,R),T.fillStyle=o,Pw?T.fill(new Path2D(dx(_,N))):D.forEach(function(J,X){J.forEach(function(z,E){z&&T.fillRect(E+N,X+N,1,1)})}),F&&(T.globalAlpha=F.opacity),B&&T.drawImage(H,F.x+N,F.y+N,F.w,F.h)}}),De.useEffect(()=>{C(!1)},[x]);const A=Fo({height:l,width:l},f);let P=null;return x!=null&&(P=De.createElement("img",{src:x,key:x,style:{display:"none"},onLoad:()=>{C(!0)},ref:h,crossOrigin:F==null?void 0:F.crossOrigin})),De.createElement(De.Fragment,null,De.createElement("canvas",Fo({style:A,height:l,width:l,ref:w,role:"img"},k)),P)});mx.displayName="QRCodeCanvas";var Dw=De.forwardRef(function(r,a){const s=r,{value:n,size:l=ax,level:i=sx,bgColor:u=nx,fgColor:o=lx,includeMargin:c=ix,minVersion:d=ox,boostLevel:m,title:p,marginSize:j,imageSettings:v}=s,y=To(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:f,cells:k,numCells:x,calculatedImageSettings:g}=ux({value:n,level:i,minVersion:d,boostLevel:m,includeMargin:c,marginSize:j,imageSettings:v,size:l});let h=k,w=null;v!=null&&g!=null&&(g.excavation!=null&&(h=cx(k,g.excavation)),w=De.createElement("image",{href:v.src,height:g.h,width:g.w,x:g.x+f,y:g.y+f,preserveAspectRatio:"none",opacity:g.opacity,crossOrigin:g.crossOrigin}));const S=dx(h,f);return De.createElement("svg",Fo({height:l,width:l,viewBox:`0 0 ${x} ${x}`,ref:a,role:"img"},y),!!p&&De.createElement("title",null,p),De.createElement("path",{fill:u,d:`M0,0 h${x}v${x}H0z`,shapeRendering:"crispEdges"}),De.createElement("path",{fill:o,d:S,shapeRendering:"crispEdges"}),w)});Dw.displayName="QRCodeSVG";const Mw=()=>{const{rooms:e=[],floors:r=[],buildings:a=[],deleteRoom:s}=ae(),{hasPermission:n}=ie(),{t:l}=te(),[i,u]=b.useState(!1),[o,c]=b.useState(!1),[d,m]=b.useState(null),[p,j]=b.useState(null),v=ge(),[y,f]=b.useState({status:"",building_id:"",floor_id:"",search:""}),[k,x]=b.useState(null),g=_=>{x(_)},h=_=>{m(_),u(!0)},w=_=>{j(_),c(!0)},S=_=>{window.confirm("Are you sure you want to delete this room?")&&s(_)},C=()=>{u(!1),m(null)},N=()=>{c(!1),j(null)},D=_=>{switch(_.toLowerCase()){case"wifi":return t.jsx(ej,{className:"h-4 w-4"});case"ac":return t.jsx("div",{className:"h-4 w-4 bg-blue-500 rounded-full"});case"attached bathroom":return t.jsx($k,{className:"h-4 w-4"});case"balcony":return t.jsx("div",{className:"h-4 w-4 bg-green-500 rounded-sm"});case"parking":return t.jsx(Vg,{className:"h-4 w-4"});default:return t.jsx("div",{className:"h-4 w-4 bg-gray-400 rounded-full"})}},R=e.filter(_=>{if(y.status&&_.status!==y.status||y.building_id&&_.building_id!==y.building_id||y.floor_id&&_.floor_id!==y.floor_id)return!1;if(y.search){const H=y.search.toLowerCase();return _.room_number.toLowerCase().includes(H)}return!0}),F={total_available:e.filter(_=>_.status==="available").length,total_occupied:e.filter(_=>_.status==="occupied").length,total_maintenance:e.filter(_=>_.status==="maintenance").length,total_booked:e.filter(_=>_.status==="booked").length},A=_=>_?new Date(_).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}):"N/A",P=e===void 0,M=e&&e.length>0,T=R.length>0;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:l("rooms")}),n("manage")&&t.jsxs("button",{onClick:()=>u(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:l("addRoom")})]})]}),M&&t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:F.total_available}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:l("total_available")})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 sm:p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-900 dark:text-blue-100",children:F.total_occupied}),t.jsx("div",{className:"text-xs sm:text-sm text-blue-600 dark:text-blue-400",children:l("total_occupied")})]}),t.jsxs("div",{className:"bg-orange-50 dark:bg-orange-900/20 p-3 sm:p-4 rounded-lg border border-orange-200 dark:border-orange-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-orange-900 dark:text-orange-100",children:F.total_booked}),t.jsx("div",{className:"text-xs sm:text-sm text-orange-600 dark:text-orange-400",children:l("total_booked")})]}),t.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 sm:p-4 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-900 dark:text-green-100",children:F.total_maintenance}),t.jsx("div",{className:"text-xs sm:text-sm text-green-600 dark:text-green-400",children:l("total_maintenance")})]})]}),P&&t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-8 text-center",children:t.jsxs("div",{className:"animate-pulse",children:[t.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-1/4 mx-auto mb-4"}),t.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-1/2 mx-auto"})]})}),!P&&!M&&t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-8 text-center",children:t.jsxs("div",{className:"max-w-md mx-auto",children:[t.jsx(Ts,{className:"h-16 w-16 text-gray-400 mx-auto mb-4"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Data Available"})]})}),M&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:l("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l("building")}),t.jsxs("select",{value:y.building_id,onChange:_=>f(H=>({...H,building_id:_.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:l("allBuildings")}),a.map(_=>t.jsx("option",{value:_.id,children:_.name},_.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l("floor")}),t.jsxs("select",{value:y.floor_id,onChange:_=>f(H=>({...H,floor_id:_.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:l("allfloors")}),r.filter(_=>!y.building_id||_.building_id===y.building_id).map(_=>t.jsxs("option",{value:_.id,children:[l("floor")," ",_.floor_number]},_.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l("status")}),t.jsxs("select",{value:y.status,onChange:_=>f(H=>({...H,status:_.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:l("allStatus")}),t.jsx("option",{value:"available",children:l("available")}),t.jsx("option",{value:"occupied",children:l("occupied")}),t.jsx("option",{value:"maintenance",children:l("maintenance")}),t.jsx("option",{value:"booked",children:l("booked")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l("search")}),t.jsxs("div",{className:"relative",children:[t.jsx(Aa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx("input",{type:"text",value:y.search,onChange:_=>f(H=>({...H,search:_.target.value})),placeholder:l("searchByRoomNumber"),className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]})]})]}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:T?R.map(_=>{var H,B;return t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg p-3 sm:p-6 border border-blue-400 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-start justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"hidden sm:block p-2 bg-purple-50 dark:bg-purple-900/20 rounded-lg",children:t.jsx(Ts,{className:"h-6 w-6 text-purple-600 dark:text-purple-400"})}),t.jsxs("div",{children:[t.jsxs("h3",{className:"text-sm sm:text-lg font-semibold text-gray-900 dark:text-white",children:[l("room")," ",_.room_number]}),t.jsx("p",{className:"text-[10px] sm:text-[11px] text-gray-500 dark:text-gray-400",children:A(_.createdAt)}),t.jsx("p",{className:"text-[11px] sm:text-sm text-gray-500 dark:text-gray-400",children:((H=_.building)==null?void 0:H.name)||"N/A"})]})]}),n("manage")&&t.jsxs("div",{className:"flex space-x-2",children:[n("edit")&&t.jsx("button",{onClick:()=>h(_),className:"p-1 text-yellow-600 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors",style:{margin:0},children:t.jsx(It,{className:"h-4 w-4"})}),t.jsx("button",{onClick:()=>g(_),className:"p-1 text-green-600 hover:text-green-600 hover:bg-green-50 dark:hover:bg-green-900/20 rounded-lg transition-colors",style:{margin:0},children:t.jsx(Yk,{className:"h-4 w-4"})}),n("delete")&&t.jsx("button",{onClick:()=>S(_.id),className:"p-1 text-red-600 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors",style:{margin:0},children:t.jsx(Ar,{className:"h-4 w-4"})})]})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(Xr,{className:"h-4 w-4 text-gray-400"}),t.jsx("span",{className:"text-[11px] sm:text-sm text-gray-600 dark:text-gray-300",children:l("rentperbed")})]}),t.jsxs("span",{className:"text-[11px] sm:text-sm font-medium text-gray-900 dark:text-white",children:[v," ",_.rent_per_bed]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{className:"text-[11px] sm:text-sm text-gray-600 dark:text-gray-300",children:[l("floor")," ",((B=_.floor)==null?void 0:B.floor_number)||"N/A"]}),t.jsxs("div",{className:"flex items-center gap-2",children:[_.status==="occupied"&&t.jsx("button",{onClick:()=>w(_),className:`p-1.5 sm:p-2 rounded-xl
text-gray-500 hover:text-blue-600
hover:bg-blue-50 dark:hover:bg-blue-900/30
transition-all duration-200 shadow-sm`,children:t.jsx(nt,{className:"h-4 w-4"})}),t.jsx("span",{className:`px-2.5 py-1 rounded-full text-[10px] sm:text-xs font-medium tracking-wide shadow-sm
${_.status==="available"?"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400":_.status==="occupied"?"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400":_.status==="maintenance"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400":_.status==="booked"?"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"}`,children:l(_.status)})]})]}),_.status==="booked"&&t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-[11px] sm:text-sm text-red-600 dark:text-red-400",children:l("Booked At")}),_.available_from&&t.jsx("p",{className:"text-[11px] sm:text-sm font-medium text-red-600 dark:text-red-400",children:A(_.available_from)})]}),t.jsxs("div",{className:"pt-3 border-t border-gray-200 dark:border-gray-700",children:[t.jsx("p",{className:"text-[11px] sm:text-sm text-gray-600 dark:text-gray-300 mb-2",children:l("facilities")}),t.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{let U=[];try{const V=JSON.parse(_.facilities);U=typeof V=="string"?JSON.parse(V):V,Array.isArray(U)||(U=[])}catch{U=[]}return U.length>0?U.map((V,J)=>t.jsxs("div",{className:"flex items-center space-x-1 bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded-full",children:[D(V),t.jsx("span",{className:"text-[10px] sm:text-xs text-gray-600 dark:text-gray-300",children:V})]},J)):t.jsx("div",{className:"text-[10px] sm:text-xs text-gray-500 italic",children:l("nofacilitiesavailable")})})()})]})]})]},_.id)}):t.jsxs("div",{className:"col-span-full bg-white dark:bg-gray-800 rounded-xl shadow-sm p-8 text-center",children:[t.jsx(Aa,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:l("noRoomsFound")||"No Rooms Found"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:l("noRoomsMatchFilters")||"Try adjusting your filters to see more results."})]})})]}),i&&t.jsx(kw,{room:d,onClose:C}),o&&t.jsx(jw,{room:p,onClose:N}),k&&t.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm z-50",style:{marginTop:0},children:t.jsxs("div",{className:"relative bg-white dark:bg-gray-900 p-6 sm:p-8 rounded-2xl shadow-2xl w-[90%] sm:w-[400px] animate-fadeIn",children:[t.jsx("button",{onClick:()=>x(null),className:"absolute top-3 right-3 p-2 text-gray-400 hover:text-red-500 transition-colors",children:"✕"}),t.jsx("h2",{className:"text-lg sm:text-xl font-semibold text-center text-gray-900 dark:text-white mb-2",children:l("Room QR Code")}),t.jsx("p",{className:"text-xs text-center text-gray-500 dark:text-gray-400 mb-4",children:l("Scan to view room details")}),t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"bg-white p-3 rounded-xl shadow-md dark:bg-gray-800",children:t.jsx(mx,{id:"qrCodeCanvas",value:`${window.location.origin}/room/${k.id}`,size:220,bgColor:"#ffffff",fgColor:"#111827",level:"H",includeMargin:!0})})}),t.jsxs("div",{className:"flex justify-center gap-3",children:[t.jsx("button",{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/room/${k.id}`),className:"px-3 py-2 text-xs sm:text-sm rounded-lg bg-blue-600 hover:bg-blue-700 text-white shadow-md transition",children:l("Copy URL")}),t.jsx("button",{onClick:()=>{const H=document.getElementById("qrCodeCanvas").toDataURL("image/png").replace("image/png","image/octet-stream"),B=document.createElement("a");B.href=H,B.download=`room-${k.id}-qrcode.png`,document.body.appendChild(B),B.click(),document.body.removeChild(B)},className:"px-3 py-2 text-xs sm:text-sm rounded-lg bg-green-600 hover:bg-green-700 text-white shadow-md transition",children:l("Download")})]})]})})]})},Aw=({bed:e,onClose:r})=>{const{buildings:a,rooms:s,renters:n=[],addBed:l,updateBed:i}=ae(),[u,o]=b.useState({building_id:"",room_id:"",bed_number:"",monthly_rent:0,status:"available",renter_id:"",last_cleaned:"",notes:""}),{t:c}=te(),[d,m]=b.useState([]),[p,j]=b.useState([]),v=ge();b.useEffect(()=>{e&&o({building_id:e.building_id,room_id:e.room_id,bed_number:e.bed_number,monthly_rent:e.monthly_rent,status:e.status,renter_id:e.renter_id||"",last_cleaned:e.last_cleaned||"",notes:e.notes||""})},[e]),b.useEffect(()=>{if(u.building_id){const h=s.filter(w=>w.building_id===u.building_id);m(h)}else m([])},[u.building_id,s]),b.useEffect(()=>{const h=n.filter(w=>w.status==="active"&&(!w.bed_id||w.bed_id===(e==null?void 0:e.id)));j(h)},[n,e]);const y=h=>{h.preventDefault();const w={...u,isOccupied:u.status==="occupied"};e?i(e.id,w):l(w),r()},f=h=>{const{name:w,value:S}=h.target;o(C=>({...C,[w]:w==="monthly_rent"?parseInt(S)||0:S}))},k=h=>{const w=h.target.value;o(S=>({...S,building_id:w,room_id:"",monthly_rent:0}))},x=h=>{const w=h.target.value,S=s.find(C=>C.id===w);o(C=>({...C,room_id:w,monthly_rent:(S==null?void 0:S.rent_per_bed)||0}))},g=h=>{const w=h.target.value;o(S=>({...S,status:w,renter_id:w!=="occupied"?"":S.renter_id}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:c(e?"editBed":"addNewBed")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:y,className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("building")}),t.jsxs("select",{name:"building_id",value:u.building_id,onChange:k,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:c("selectabuilding")}),a.map(h=>t.jsx("option",{value:h.id,children:h.name},h.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("room")}),t.jsxs("select",{name:"room_id",value:u.room_id,onChange:x,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,disabled:!u.building_id,children:[t.jsx("option",{value:"",children:c("selectaroom")}),d.map(h=>t.jsxs("option",{value:h.id,children:[c("room")," ",h.room_number," (Floor ",h.floor.floor_number??"",")"]},h.id))]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("bedNumber")}),t.jsx("input",{type:"text",name:"bed_number",value:u.bed_number,onChange:f,placeholder:"e.g., A1, B2, etc.",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[c("monthlyRent")," (",v,")"]}),t.jsx("input",{type:"text",name:"monthly_rent",value:u.monthly_rent,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("status")}),t.jsxs("select",{name:"status",value:u.status,onChange:g,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"available",children:c("available")}),t.jsx("option",{value:"occupied",children:c("occupied")}),t.jsx("option",{value:"maintenance",children:c("maintenance")}),t.jsx("option",{value:"reserved",children:c("reserved")})]})]}),u.status==="occupied"&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("assignrenter")}),t.jsxs("select",{name:"renter_id",value:u.renter_id,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:u.status==="occupied",children:[t.jsx("option",{value:"",children:c("selectarenter")}),p.map(h=>t.jsxs("option",{value:h.id,children:[h.name," - ",h.phone]},h.id))]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("lastCleaned")}),t.jsx("input",{type:"date",name:"last_cleaned",value:u.last_cleaned,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("notes")}),t.jsx("textarea",{name:"notes",value:u.notes,onChange:f,rows:3,placeholder:c("anyadditionalnotesbed"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:c("cancel")}),t.jsxs("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[c(e?"update":"create")," ",c("bed")]})]})]})]})})},Fw=()=>{const{beds:e=[],buildings:r=[],rooms:a=[],renters:s=[],deleteBed:n=()=>{}}=ae()??{},{hasPermission:l}=ie(),{t:i}=te(),[u,o]=b.useState(!1),[c,d]=b.useState(null),[m,p]=b.useState({building_id:"",room_id:"",status:"",search:""}),j=ge(),v=N=>{d(N),o(!0)},y=N=>{window.confirm("Are you sure you want to delete this bed?")&&n(N)},f=()=>{o(!1),d(null)},k=N=>{switch(N){case"available":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"occupied":return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400";case"maintenance":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";case"reserved":return"bg-purple-100 text-purple-800 dark:bg-purple-900/20 dark:text-purple-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},x=N=>{if(!N)return null;const D=s.find(R=>R.id===N);return D==null?void 0:D.name},g=N=>{const D=r.find(R=>R.id===N);return(D==null?void 0:D.name)||"Unknown Building"},h=N=>{const D=a.find(R=>R.id===N);return(D==null?void 0:D.room_number)||"Unknown Room"},w=()=>m.building_id?a.filter(N=>N.building_id===m.building_id):[],S=e.filter(N=>{var D;if(m.building_id&&N.building_id!==m.building_id||m.room_id&&N.room_id!==m.room_id||m.status&&N.status!==m.status)return!1;if(m.search){const R=m.search.toLowerCase(),F=g(N.building_id).toLowerCase(),A=h(N.room_id).toLowerCase(),P=N.bed_number.toLowerCase(),M=((D=x(N.renter_id))==null?void 0:D.toLowerCase())||"";return F.includes(R)||A.includes(R)||P.includes(R)||M.includes(R)}return!0}),C={total:e.length,available:e.filter(N=>N.status==="available").length,occupied:e.filter(N=>N.status==="occupied").length,maintenance:e.filter(N=>N.status==="maintenance").length,reserved:e.filter(N=>N.status==="reserved").length};return console.log(S),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:i("bedManagement")}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:i("bedManagementdes")})]}),l("manage")&&t.jsxs("button",{onClick:()=>o(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center space-x-2 transition-colors",children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{children:i("addBed")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:C.total}),t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:i("total_beds")})]}),t.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"text-2xl font-bold text-green-900 dark:text-green-100",children:C.available}),t.jsx("div",{className:"text-sm text-green-600 dark:text-green-400",children:i("available")})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"text-2xl font-bold text-blue-900 dark:text-blue-100",children:C.occupied}),t.jsx("div",{className:"text-sm text-blue-600 dark:text-blue-400",children:i("occupied")})]}),t.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-4 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[t.jsx("div",{className:"text-2xl font-bold text-yellow-900 dark:text-yellow-100",children:C.maintenance}),t.jsx("div",{className:"text-sm text-yellow-600 dark:text-yellow-400",children:i("maintenance")})]}),t.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 p-4 rounded-lg border border-purple-200 dark:border-purple-800",children:[t.jsx("div",{className:"text-2xl font-bold text-purple-900 dark:text-purple-100",children:C.reserved}),t.jsx("div",{className:"text-sm text-purple-600 dark:text-purple-400",children:i("reserved")})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:i("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("buildings")}),t.jsxs("select",{value:m.building_id,onChange:N=>p(D=>({...D,building_id:N.target.value,room_id:""})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:i("allBuildings")}),r.map(N=>t.jsx("option",{value:N.id,children:N.name},N.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("room")}),t.jsxs("select",{value:m.room_id,onChange:N=>p(D=>({...D,room_id:N.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",disabled:!m.building_id,children:[t.jsx("option",{value:"",children:i("allRooms")}),w().map(N=>t.jsxs("option",{value:N.id,children:[i("room")," ",N.room_number]},N.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("status")}),t.jsxs("select",{value:m.status,onChange:N=>p(D=>({...D,status:N.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:i("allStatus")}),t.jsx("option",{value:"available",children:i("available")}),t.jsx("option",{value:"occupied",children:i("occupied")}),t.jsx("option",{value:"maintenance",children:i("maintenance")}),t.jsx("option",{value:"reserved",children:i("reserved")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("search")}),t.jsxs("div",{className:"relative",children:[t.jsx(Aa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx("input",{type:"text",value:m.search,onChange:N=>p(D=>({...D,search:N.target.value})),placeholder:i("searchbedsroomsrenters"),className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]})]})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("bedDetails")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("location")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("renter")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("rent")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("status")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("lastCleaned")}),l("manage")&&t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("actions")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:S.map(N=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/20 rounded-full flex items-center justify-center",children:t.jsx(Ts,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})}),t.jsxs("div",{className:"ml-4",children:[t.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:[i("bed")," ",N.bed_number]}),t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["ID: ",N.id]})]})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[t.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:g(N.building_id)}),t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[i("floor")," ",N.room.floor.floor_number]}),t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[i("room")," ",h(N.room_id)]})]}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:N.renter_id?t.jsxs("div",{className:"flex items-center",children:[t.jsx(qe,{className:"h-4 w-4 text-gray-400 mr-2"}),t.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:x(N.renter_id)})]}):t.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:i("norenter")})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[j," ",N.monthly_rent.toLocaleString()]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full capitalize ${k(N.status)}`,children:N.status})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:N.last_cleaned?new Date(N.last_cleaned).toLocaleDateString():i("never")}),l("manage")&&t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:t.jsxs("div",{className:"flex space-x-2",children:[t.jsx("button",{onClick:()=>v(N),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(It,{className:"h-4 w-4"})}),l("delete")&&t.jsx("button",{onClick:()=>y(N.id),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(Ar,{className:"h-4 w-4"})})]})})]},N.id))})]})})}),u&&t.jsx(Aw,{bed:c,onClose:f})]})},Tw=({renter:e,onClose:r})=>{const{buildings:a,floors:s,rooms:n,beds:l,addRenter:i,updateRenter:u,uploadRenterDocument:o,deleteDocument:c}=ae(),{t:d}=te(),[m,p]=b.useState({name:"",email:"",password:"",phone:"",alternate_phone:"",nid:"",building_id:"",floor_id:"",room_id:"",room_number:"",floor_number:0,rent_amount:0,security_deposit:0,check_in_date:"",lease_start_date:"",lease_end_date:"",status:"active",emergency_contact:"",emergency_relation:"",occupation:"",company:"",monthly_income:0,previous_address:"",references:"",notice_period:30,preferences:{foodType:"both",smokingAllowed:!1,petAllowed:!1,guestPolicy:"restricted"},documents:[]}),[j,v]=b.useState([]),[y,f]=b.useState([]),[k,x]=b.useState([]),[g,h]=b.useState(!1),[w,S]=b.useState(""),[C,N]=b.useState({}),D=ge(),[R,F]=b.useState({}),A=z=>E=>{N($=>({...$,[z]:E}))},P=[{value:"nid",label:"Emirates ID"},{value:"passport",label:"Passport"},{value:"contract",label:"Rental Contract"},{value:"photo",label:"Profile Photo"},{value:"income_proof",label:"Income Proof"},{value:"reference",label:"Reference Letter"},{value:"other",label:"Other Document"}];b.useEffect(()=>{if(e){const z=E=>E?E.split("T")[0]:"";p({...e,check_in_date:z(e.check_in_date),lease_start_date:z(e.lease_start_date),lease_end_date:z(e.lease_end_date),preferences:e.preferences||{foodType:"both",smokingAllowed:!1,petAllowed:!1,guestPolicy:"restricted"},documents:e.documents||[]}),S(e.room.room_number)}},[e]),b.useEffect(()=>{if(m.building_id){const z=s.filter(E=>E.building_id===m.building_id);v(z)}else v([])},[m.building_id,s]),b.useEffect(()=>{if(m.floor_id){const z=n.filter(E=>E.floor_id===m.floor_id&&E.status==="available");f(z)}else f([])},[m.floor_id,n]),b.useEffect(()=>{if(m.room_id){const z=l.filter(E=>E.room_id===m.room_id&&E.status==="available");x(z)}else x([])},[m.room_id,l]);const M=()=>{const z={};return m.name.trim()||(z.name=d("Name is Required")),m.building_id||(z.building_id=d("Building is Required")),m.floor_id||(z.floor_id=d("Floor is Required")),m.room_id||(z.room_id=d("Room is Required")),m.rent_amount||(z.rent_amount=d("Amount is Required")),m.security_deposit||(z.security_deposit=d("Security Deposit is Required")),m.check_in_date||(z.check_in_date=d("Check in date is Required")),m.lease_start_date||(z.lease_start_date=d("Lease start date is Required")),m.lease_end_date||(z.lease_end_date=d("Lease end date is Required")),m.emergency_relation||(z.emergency_relation=d("Emergency Relation is Required")),e||(m.password.trim()?m.password.length<6&&(z.password=d("Password must be at least 6 characters")):z.password=d("Password is Required")),m.phone?m.phone&&!/^\+?[\d\s()-]{7,15}$/.test(m.phone)&&(z.phone=d("Invalid Phone Number")):z.phone=d("Phone is Required"),m.alternate_phone&&!/^\+?[\d\s()-]{7,15}$/.test(m.alternate_phone)&&(z.alternate_phone=d("Invalid Alternate Number")),m.emergency_contact?m.emergency_contact&&!/^\+?[\d\s()-]{7,15}$/.test(m.emergency_contact)&&(z.emergency_contact=d("Invalid Emergency Contact Number")):z.emergency_contact=d("Emergency Contact is Required"),z},T=z=>{z.preventDefault();const E=M();F(E),!(Object.keys(E).length>0)&&(e?u(e.id,m):i(m),r())},_=z=>{const{name:E,value:$,type:Q}=z.target;if(E.startsWith("preferences.")){const re=E.split(".")[1];p(de=>({...de,preferences:{...de.preferences,[re]:Q==="checkbox"?z.target.checked:$}}))}else p(re=>({...re,[E]:Q==="checkbox"?z.target.checked:["rent_amount","security_deposit","monthly_income","notice_period","floor_number"].includes(E)?parseInt($)||0:$}))},H=z=>{const E=z.target.value;p($=>({...$,building_id:E,floor_id:"",room_id:"",room_number:"",floor_number:0,rent_amount:0}))},B=z=>{const E=z.target.value,$=s.find(Q=>Q.id===E);p(Q=>({...Q,floor_id:E,floor_number:($==null?void 0:$.floor_number)||0,room_id:"",room_number:"",rent_amount:0}))},U=z=>{const E=z.target.value,$=n.find(Q=>Q.id===E);p(Q=>({...Q,room_id:E,room_number:($==null?void 0:$.room_number)||"",rent_amount:($==null?void 0:$.rent_per_bed)||0,security_deposit:($==null?void 0:$.security_deposit)||0}))},V=async z=>{var G;const E=(G=z.target.files)==null?void 0:G[0];if(!E)return;h(!0);const $=URL.createObjectURL(E),Q=document.getElementById("documentType").value,re=document.getElementById("documentDescription").value,de={type:Q,file_name:E.name,file_url:$,description:re||`${Q} document`};e?(o(e.id,de),p(St=>({...St,documents:[...St.documents,{...de,id:Date.now().toString(),updated_at:new Date().toISOString().split("T")[0]}]}))):p(St=>({...St,documents:[...St.documents,{...de,id:Date.now().toString(),updated_at:new Date().toISOString().split("T")[0]}]})),h(!1),z.target.value="",document.getElementById("documentDescription").value=""},J=z=>{e?(c(z),p(E=>({...E,documents:E.documents.filter($=>$.id!==z)}))):p(E=>({...E,documents:E.documents.filter($=>$.id!==z)}))},X=z=>{var E;return((E=P.find($=>$.value===z))==null?void 0:E.label)||z};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-4xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:d(e?"editRenter":"addRenter")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:T,className:"p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:d("personalInformation")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("name")," *"]}),t.jsx(pe,{type:"text",name:"name",value:m.name,onChange:_,onValidationError:A("name"),fieldName:"Name",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.name&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.name})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("email")," *"]}),t.jsx("input",{type:"email",name:"email",value:m.email,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.email&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.email})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("password")," *"]}),t.jsx("input",{type:"password",name:"password",value:m.password,required:!0,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),R.password&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.password})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("phone")," *"]}),t.jsx("input",{type:"tel",name:"phone",value:m.phone,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.phone&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.phone})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("alternatePhone")}),t.jsx("input",{type:"tel",name:"alternate_phone",value:m.alternate_phone,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),R.alternate_phone&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.alternate_phone})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("Emirates ID")}),t.jsx(pe,{type:"text",name:"nid",value:m.nid,onChange:_,onValidationError:A("nid"),fieldName:"Emirates ID",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),C.nid&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:C.nid})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("occupation")}),t.jsx(pe,{type:"text",name:"occupation",value:m.occupation,onChange:_,onValidationError:A("occupation"),fieldName:"Occupation",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),C.occupation&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:C.occupation})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("company")}),t.jsx(pe,{type:"text",name:"company",value:m.company,onChange:_,onValidationError:A("company"),fieldName:"Company",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),C.company&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:C.company})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("monthlyIncome")," (",D,")"]}),t.jsx("input",{type:"text",name:"monthly_income",value:m.monthly_income,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:d("roomAssignment")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("building")," *"]}),t.jsxs("select",{name:"building_id",value:m.building_id,onChange:H,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:d("selectabuilding")}),a.map(z=>t.jsx("option",{value:z.id,children:z.name},z.id))]}),R.building_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.building_id})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("floor")," *"]}),t.jsxs("select",{name:"floor_id",value:m.floor_id,onChange:B,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,disabled:!m.building_id,children:[t.jsx("option",{value:"",children:d("selectafloor")}),j.map(z=>t.jsxs("option",{value:z.id,children:[d("floor")," ",z.floor_number]},z.id))]}),R.floor_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.floor_id})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("room")," *"]}),t.jsxs("select",{name:"room_id",value:m.room_id,onChange:U,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!w&&!e,disabled:!m.floor_id,children:[t.jsx("option",{value:"",children:w&&e?` ${d("room")} ${w} `:d("selectaroom")}),y.map(z=>t.jsxs("option",{value:z.id,children:[d("room")," ",z.room_number]},z.id))]}),R.room_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.room_id})]})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:d("financialInformation")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("rentAmount")," (",D,") *"]}),t.jsx("input",{type:"text",name:"rent_amount",value:m.rent_amount,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.rent_amount&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.rent_amount})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("securityDeposit")," (",D,") *"]}),t.jsx("input",{type:"text",name:"security_deposit",value:m.security_deposit,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.security_deposit&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.security_deposit})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("noticePeriod")," (",d("days"),")"]}),t.jsx("input",{type:"text",name:"notice_period",value:m.notice_period,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:d("leaseInformation")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("checkinDate")," *"]}),t.jsx("input",{type:"date",name:"check_in_date",value:m.check_in_date,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.check_in_date&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.check_in_date})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("leaseStartDate")," *"]}),t.jsx("input",{type:"date",name:"lease_start_date",value:m.lease_start_date,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.lease_start_date&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.lease_start_date})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("leaseEndDate")," *"]}),t.jsx("input",{type:"date",name:"lease_end_date",value:m.lease_end_date,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.lease_end_date&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.lease_end_date})]})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:d("emergencyContact")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("emergencyContact")," *"]}),t.jsx("input",{type:"tel",name:"emergency_contact",value:m.emergency_contact,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.emergency_contact&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.emergency_contact})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("relation")," *"]}),t.jsx(pe,{type:"text",name:"emergency_relation",value:m.emergency_relation,onChange:_,onValidationError:A("emergency_relation"),fieldName:"Relation",placeholder:"e.g., Father, Mother, Brother",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),R.emergency_relation&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:R.emergency_relation})]})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:d("preferences")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("foodType")}),t.jsxs("select",{name:"preferences.foodType",value:m.preferences.foodType,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"vegetarian",children:d("vegetarian")}),t.jsx("option",{value:"non_vegetarian",children:d("non_Vegetarian")}),t.jsx("option",{value:"both",children:d("both")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("guestPolicy")}),t.jsxs("select",{name:"preferences.guestPolicy",value:m.preferences.guestPolicy,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"allowed",children:d("allowed")}),t.jsx("option",{value:"restricted",children:d("restricted")}),t.jsx("option",{value:"not_allowed",children:d("not_allowed")})]})]}),t.jsxs("div",{className:"flex items-center space-x-4",children:[t.jsxs("label",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",name:"preferences.smokingAllowed",checked:m.preferences.smokingAllowed,onChange:_,className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsx("span",{className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:d("smokingAllowed")})]}),t.jsxs("label",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",name:"preferences.petAllowed",checked:m.preferences.petAllowed,onChange:_,className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsx("span",{className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:d("petAllowed")})]})]})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:d("documents")}),t.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-lg mb-4",children:t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("documentsType")}),t.jsx("select",{id:"documentType",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-600 dark:text-white",children:P.map(z=>t.jsx("option",{value:z.value,children:z.label},z.value))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("description")}),t.jsx("input",{type:"text",id:"documentDescription",placeholder:"Optional description",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-600 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("uploadFile")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:"file",onChange:V,accept:".pdf,.jpg,.jpeg,.png,.doc,.docx",className:"hidden",id:"fileUpload",disabled:g}),t.jsxs("label",{htmlFor:"fileUpload",className:`flex items-center justify-center w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors ${g?"opacity-50 cursor-not-allowed":""}`,children:[t.jsx(Xg,{className:"h-4 w-4 mr-2"}),g?"Uploading...":"Choose File"]})]})]})]})}),m.documents.length>0&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:d("uploadedDocuments")}),m.documents.map(z=>t.jsxs("div",{className:"flex items-center justify-between p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Ue,{className:"h-5 w-5 text-blue-600"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:X(z.type)}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[z.file_name," • ",z.updated_at]}),z.description&&t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:z.description})]})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{type:"button",onClick:()=>window.open(z.file_url,"_blank"),className:"p-1 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(nt,{className:"h-4 w-4"})}),t.jsx("button",{type:"button",onClick:()=>J(z.id),className:"p-1 text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(Ar,{className:"h-4 w-4"})})]})]},z.id))]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:d("additionalInformation")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("previousAddress")}),t.jsx(Tt,{name:"previous_address",value:m.previous_address,onChange:_,onValidationError:A("previous_address"),fieldName:"Previous Address",rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),C.previous_address&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:C.previous_address})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("references")}),t.jsx(Tt,{name:"references",value:m.references,onChange:_,onValidationError:A("references"),fieldName:"References",rows:3,placeholder:"Reference contacts and details",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),C.references&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:C.references})]})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:d("cancel")}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:d("save")})]})]})]})})},Lw=({renter:e,onClose:r})=>{var u,o,c;const{t:a}=te(),s=ge(),[n,l]=b.useState(null);if(b.useEffect(()=>{if(e){const d=m=>m?m.split("T")[0]:"";l({...e,check_in_date:d(e.check_in_date),lease_start_date:d(e.lease_start_date),lease_end_date:d(e.lease_end_date),preferences:e.preferences||{foodType:"both",smokingAllowed:!1,petAllowed:!1,guestPolicy:"restricted"},documents:e.documents||[]})}},[e]),!n)return null;const i=d=>{var p;return((p=[{value:"nid",label:"Emirates ID"},{value:"passport",label:"Passport"},{value:"contract",label:"Rental Contract"},{value:"photo",label:"Profile Photo"},{value:"income_proof",label:"Income Proof"},{value:"reference",label:"Reference Letter"},{value:"other",label:"Other Document"}].find(j=>j.value===d))==null?void 0:p.label)||d};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-4xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:a("renterDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("div",{className:"p-6 space-y-6",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:a("personalInformation")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(xe,{label:a("name"),value:n.name}),t.jsx(xe,{label:a("email"),value:n.email}),t.jsx(xe,{label:a("phone"),value:n.phone}),t.jsx(xe,{label:a("alternatePhone"),value:n.alternate_phone}),t.jsx(xe,{label:a("Emirates ID"),value:n.nid}),t.jsx(xe,{label:a("occupation"),value:n.occupation}),t.jsx(xe,{label:a("company"),value:n.company}),t.jsx(xe,{label:`${a("monthlyIncome")} (${s})`,value:n.monthly_income})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:a("roomAssignment")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsx(xe,{label:a("building"),value:(u=n.building)==null?void 0:u.name}),t.jsx(xe,{label:a("floor"),value:(o=n.floor)==null?void 0:o.floor_number}),t.jsx(xe,{label:a("room"),value:(c=n.room)==null?void 0:c.room_number})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:a("financialInformation")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsx(xe,{label:`${a("rentAmount")} (${s})`,value:n.rent_amount}),t.jsx(xe,{label:`${a("securityDeposit")} (${s})`,value:n.security_deposit}),t.jsx(xe,{label:`${a("noticePeriod")} (${a("days")})`,value:n.notice_period})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:a("leaseInformation")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsx(xe,{label:a("checkinDate"),value:n.check_in_date}),t.jsx(xe,{label:a("leaseStartDate"),value:n.lease_start_date}),t.jsx(xe,{label:a("leaseEndDate"),value:n.lease_end_date})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:a("emergencyContact")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(xe,{label:a("emergencyContact"),value:n.emergency_contact}),t.jsx(xe,{label:a("relation"),value:n.emergency_relation})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:a("preferences")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(xe,{label:a("foodType"),value:n.preferences.foodType}),t.jsx(xe,{label:a("guestPolicy"),value:n.preferences.guestPolicy}),t.jsx(xe,{label:a("smokingAllowed"),value:n.preferences.smokingAllowed?a("yes"):a("no")}),t.jsx(xe,{label:a("petAllowed"),value:n.preferences.petAllowed?a("yes"):a("no")})]})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:a("documents")}),n.documents.length>0?t.jsx("div",{className:"space-y-2",children:n.documents.map(d=>t.jsxs("div",{className:"flex items-center justify-between p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Ue,{className:"h-5 w-5 text-blue-600"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:i(d.type)}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[d.file_name," • ",d.updated_at]}),d.description&&t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:d.description})]})]}),t.jsx("button",{type:"button",onClick:()=>window.open(d.file_url,"_blank"),className:"p-1 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(nt,{className:"h-4 w-4"})})]},d.id))}):t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:a("noDocuments")})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4",children:a("additionalInformation")}),t.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[t.jsx("div",{className:"flex-1",children:t.jsx(xe,{label:a("previousAddress"),value:n.previous_address,multiline:!0})}),t.jsx("div",{className:"flex-1",children:t.jsx(xe,{label:a("references"),value:n.references,multiline:!0})})]})]}),t.jsx("div",{className:"flex justify-end pt-4",children:t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:a("close")})})]})]})})},xe=({label:e,value:r,multiline:a})=>t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e}),a?t.jsx("p",{className:"text-gray-900 dark:text-white whitespace-pre-wrap",children:r||"-"}):t.jsx("p",{className:"text-gray-900 dark:text-white",children:r||"-"})]}),Ow=()=>{const{renters:e=[],floors:r=[],buildings:a=[],deleteRenter:s=()=>{}}=ae()??{},{hasPermission:n}=ie(),{t:l}=te(),[i,u]=b.useState(!1),[o,c]=b.useState(null),[d,m]=b.useState(!1),[p,j]=b.useState(null),v=ge(),[y,f]=b.useState({building_id:"",floor_id:"",search:""}),[k,x]=b.useState(e),[g,h]=b.useState(1),w=3,S=Math.ceil(k.length/w);b.useEffect(()=>{let M=e;y.building_id&&(M=M.filter(_=>_.building_id===y.building_id)),y.floor_id&&(M=M.filter(_=>_.floor_id===y.floor_id));const T=y.search;if(T){const _=T.toLowerCase();M=M.filter(H=>{var B,U,V,J;return((B=H.name)==null?void 0:B.toLowerCase().includes(_))||((U=H.email)==null?void 0:U.toLowerCase().includes(_))||((V=H.phone)==null?void 0:V.toLowerCase().includes(_))||((J=H.nid)==null?void 0:J.toLowerCase().includes(_))})}x(M)},[y,e]);const C=M=>{c(M),u(!0)},N=M=>{j(M),m(!0)},D=M=>{window.confirm("Are you sure you want to delete this renter?")&&s(M)},R=()=>{u(!1),c(null)},F=()=>{j(!1),m(null)},A=M=>new Date(M).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}),P=k.slice((g-1)*w,g*w);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:l("renters")}),t.jsx("div",{className:"flex items-center justify-center",children:n("manage")&&t.jsxs("button",{onClick:()=>u(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors ml-1`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:l("addRenter")})]})})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:l("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l("building")}),t.jsxs("select",{value:y.building_id,onChange:M=>f(T=>({...T,building_id:M.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:l("allBuildings")}),a.map(M=>t.jsx("option",{value:M.id,children:M.name},M.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l("floor")}),t.jsxs("select",{value:y.floor_id,onChange:M=>f(T=>({...T,floor_id:M.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:l("allfloors")}),r.filter(M=>!y.building_id||M.building_id===y.building_id).map(M=>t.jsxs("option",{value:M.id,children:[l("floor")," ",M.floor_number]},M.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:l("search")}),t.jsxs("div",{className:"relative",children:[t.jsx(Aa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx("input",{type:"text",value:y.search,onChange:M=>f(T=>({...T,search:M.target.value})),placeholder:l("searchByRentersId"),className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]})]})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:l("renter")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:l("contact")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:l("location")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:l("rent")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:l("checkin")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:l("status")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:P.length>0?P.map(M=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/20 rounded-full flex items-center justify-center",children:t.jsx(qe,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:M.name}),t.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:A(M.createdAt)}),t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Emirates ID: ",M.nid]}),n("manage")&&t.jsxs("div",{className:"flex space-x-2 pt-2",children:[n("edit")&&t.jsx("button",{onClick:()=>C(M),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(It,{className:"h-3 w-3"})}),n("delete")&&t.jsx("button",{onClick:()=>D(M.id),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(Ar,{className:"h-3 w-3"})}),t.jsx("button",{onClick:()=>N(M),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(nt,{className:"h-3 w-3"})})]})]})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[t.jsx(Qg,{className:"h-4 w-4 mr-2 text-gray-400"}),M.phone]}),t.jsxs("div",{className:"flex items-center text-sm text-gray-500 dark:text-gray-400",children:[t.jsx(ql,{className:"h-4 w-4 mr-2 text-gray-400"}),M.email]})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap align-top",children:t.jsxs("div",{className:"space-y-1 text-sm",children:[t.jsxs("div",{children:[t.jsxs("span",{className:"font-medium text-gray-900 dark:text-white",children:[l("Building"),": "]}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:M.building.name})]}),t.jsxs("div",{children:[t.jsxs("span",{className:"font-medium text-gray-900 dark:text-white",children:[l("Floor"),": "]}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:M.floor.floor_number})]}),t.jsxs("div",{children:[t.jsxs("span",{className:"font-medium text-gray-900 dark:text-white",children:[l("Room"),": "]}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:M.room.room_number})]})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[t.jsx(Js,{className:"h-4 w-4 mr-2 text-gray-400"}),v," ",M.rent_amount.toLocaleString()]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[t.jsx(ut,{className:"h-4 w-4 mr-2 text-gray-400"}),new Date(M.check_in_date).toLocaleDateString()]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${M.status==="active"?"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400":"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400"}`,children:M.status})})]},M.id)):t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-6 py-24 text-center",children:t.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3",children:[t.jsx(qe,{className:"h-12 w-12 text-gray-400 dark:text-gray-500"}),t.jsx("div",{className:"text-lg font-medium text-gray-500 dark:text-gray-400",children:"No data available"})]})})})})]})})}),S>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>h(M=>Math.max(M-1,1)),disabled:g===1,className:`px-3 py-1 rounded ${g===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let M=Math.max(1,g-1),T=Math.min(S,M+2);T-M<2&&(M=Math.max(1,T-2));const _=[];for(let H=M;H<=T;H++)_.push(t.jsx("button",{onClick:()=>h(H),className:`px-3 py-1 rounded ${g===H?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:H},H));return _})(),t.jsx("button",{onClick:()=>h(M=>Math.min(M+1,S)),disabled:g===S,className:`px-3 py-1 rounded ${g===S?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})}),i&&t.jsx(Tw,{renter:o,onClose:R}),d&&t.jsx(Lw,{renter:p,onClose:F})]})},Iw=({payment:e,onClose:r})=>{const{buildings:a,floors:s,rooms:n,renters:l,addRentPayment:i,updateRentPayment:u}=ae(),{t:o}=te(),[c,d]=b.useState({renter_id:"",building_id:"",floor_id:"",room_id:"",renterName:"",room_number:"",amount:0,due_date:"",paid_date:"",status:"pending",month:new Date().toLocaleString("default",{month:"long"}),year:new Date().getFullYear(),payment_method:"",transaction_id:""}),m=ge(),[p,j]=b.useState([]),[v,y]=b.useState([]),[f,k]=b.useState([]),x=["Cash","Bank Transfer","Mobile Banking","Check"],g=["January","February","March","April","May","June","July","August","September","October","November","December"],[h,w]=b.useState({});b.useEffect(()=>{e&&d({...e,due_date:(M=>M?M.split("T")[0]:"")(e.due_date)})},[e]);const S=()=>{const P={};return c.renter_id||(P.name=o("Renter is Required")),c.building_id||(P.building_id=o("Building is Required")),c.floor_id||(P.floor_id=o("Floor is Required")),c.room_id||(P.room_id=o("Room is Required")),c.amount||(P.amount=o("Amount is Required")),c.due_date||(P.due_date=o("Date is Required")),c.month||(P.month=o("Month is Required")),c.year||(P.year=o("Year is Required")),P},C=P=>{P.preventDefault();const M=S();w(M),!(Object.keys(M).length>0)&&(e?u(e.id,c):i(c),r())},N=P=>{const{name:M,value:T}=P.target;d(_=>({..._,[M]:M==="amount"||M==="year"?parseInt(T)||0:T}))},D=P=>{const M=P.target.value,T=l.find(_=>_.id===M);T&&d(_=>({..._,renter_id:M,renterName:T.name,room_number:T.room_id,amount:T.rent_amount}))};b.useEffect(()=>{if(c.building_id){const P=s.filter(M=>M.building_id===c.building_id);j(P)}else j([])},[c.building_id,s]),b.useEffect(()=>{if(c.floor_id){const P=n.filter(M=>M.floor_id===c.floor_id);y(P)}else y([])},[c.floor_id,n]),b.useEffect(()=>{if(c.room_id){const P=l.filter(M=>M.room_id===c.room_id&&M.status==="active");k(P)}else k([])},[c.room_id,l]);const R=P=>{const M=P.target.value;d(T=>({...T,building_id:M}))},F=P=>{const M=P.target.value;d(T=>({...T,floor_id:M}))},A=P=>{const M=P.target.value;d(T=>({...T,room_id:M}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:o(e?"paymentDetails":"addPayment")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:C,className:"p-6 space-y-4",children:[!e&&t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("buildings")}),t.jsxs("select",{name:"building_id",value:c.building_id,onChange:R,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:o("selectabuilding")}),a.map(P=>t.jsx("option",{value:P.id,children:P.name},P.id))]}),h.building_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.building_id})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("floor")}),t.jsxs("select",{name:"floor_id",value:c.floor_id,onChange:F,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,disabled:!c.building_id,children:[t.jsx("option",{value:"",children:o("selectafloor")}),p.map(P=>t.jsxs("option",{value:P.id,children:[o("floor")," ",P.floor_number]},P.id))]}),h.floor_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.floor_id})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("room")}),t.jsxs("select",{name:"room_id",value:c.room_id,onChange:A,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,disabled:!c.floor_id,children:[t.jsx("option",{value:"",children:o("selectaroom")}),v.map(P=>t.jsxs("option",{value:P.id,children:[o("room")," ",P.room_number]},P.id))]}),h.room_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.room_id})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("renter")}),t.jsxs("select",{name:"renter_id",value:c.renter_id,onChange:D,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,disabled:!c.room_id,children:[t.jsx("option",{value:"",children:o("selectarenter")}),f.map(P=>t.jsx("option",{value:P.id,children:P.name},P.id))]}),h.renter_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.renter_id})]})]}),e&&t.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-lg",children:t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/20 rounded-full flex items-center justify-center",children:t.jsx(qe,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:e.renterName}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[o("room")," ",e.renter.room.room_number]})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[o("amount")," (",m,")"]}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:"text",name:"amount",value:c.amount,onChange:N,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),h.amount&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.amount})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("date")}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:t.jsx(ut,{className:"h-4 w-4 text-gray-400"})}),t.jsx("input",{type:"date",name:"due_date",value:c.due_date,onChange:N,required:!0,className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),h.due_date&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.due_date})]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("month")}),t.jsxs("select",{name:"month",value:c.month,onChange:N,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:"Select month"}),g.map(P=>t.jsx("option",{value:P,children:P},P))]}),h.month&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.month})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("year")}),t.jsx("input",{type:"text",name:"year",value:c.year,onChange:N,min:"2020",max:"2030",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),h.year&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.year})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:o("status")}),t.jsxs("select",{name:"status",value:c.status,onChange:N,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"pending",children:o("pending")}),t.jsx("option",{value:"paid",children:o("paid")}),t.jsx("option",{value:"overdue",children:o("overdue")})]}),h.status&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:h.status})]}),c.status==="paid"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Payment Method"}),t.jsxs("select",{name:"payment_method",value:c.payment_method,onChange:N,required:!0,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:"Select Method"}),x.map(P=>t.jsx("option",{value:P,children:P},P))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Transaction ID"}),t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:t.jsx(Js,{className:"h-4 w-4 text-gray-400"})}),t.jsx("input",{type:"text",name:"transaction_id",value:c.transaction_id,onChange:N,className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"Optional"})]})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:o("cancel")}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:o("save")})]})]})]})})},Bw=({payment:e,onClose:r})=>{var l,i;const{t:a}=te(),s=ge(),n=u=>new Date(u).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0});return e?t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:a("paymentDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/20 rounded-full flex items-center justify-center",children:t.jsx(qe,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:e.renterName}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[a("room")," ",((i=(l=e==null?void 0:e.renter)==null?void 0:l.room)==null?void 0:i.room_number)||e.room_number]})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("amount")}),t.jsxs("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:[s,e.amount]})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("status")}),t.jsx("p",{className:`text-lg font-semibold ${e.status==="paid"?"text-green-600":e.status==="overdue"?"text-red-600":"text-yellow-600"}`,children:a(e.status)})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("month")}),t.jsxs("p",{className:"font-medium text-gray-900 dark:text-white",children:[e.month," ",e.year]})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg flex items-center space-x-2",children:[t.jsx(ut,{className:"h-4 w-4 text-gray-400"}),t.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:n(e.due_date)||"-"})]})]}),e.status==="paid"&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("paymentMethod")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:e.payment_method})]}),e.transaction_id&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg flex items-center space-x-2",children:[t.jsx(Js,{className:"h-4 w-4 text-gray-400"}),t.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:e.transaction_id})]})]}),t.jsx("div",{className:"flex justify-end pt-4",children:t.jsx("button",{onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:a("close")})})]})]})}):null},$w=()=>{const{rentPayments:e=[],updateRentPayment:r=()=>{}}=ae()??{},{hasPermission:a}=ie(),{t:s}=te(),[n,l]=b.useState(!1),[i,u]=b.useState(null),o=ge(),[c,d]=b.useState(!1),[m,p]=b.useState(null),[j,v]=b.useState(1),y=3,f=Math.ceil(e.length/y),k=N=>{u(N),l(!0)},x=N=>{p(N),d(!0)},g=N=>{r(N,{status:"paid",due_date:new Date().toISOString().split("T")[0],payment_method:"Cash",transaction_id:`TXN${Date.now()}`})},h=N=>{switch(N){case"paid":return t.jsx(vt,{className:"h-5 w-5 text-green-600"});case"pending":return t.jsx(dt,{className:"h-5 w-5 text-yellow-600"});case"overdue":return t.jsx(Er,{className:"h-5 w-5 text-red-600"});default:return t.jsx(dt,{className:"h-5 w-5 text-gray-600"})}},w=N=>{switch(N){case"paid":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"pending":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";case"overdue":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},S=N=>new Date(N).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}),C=e.slice((j-1)*y,j*y);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:s("rent")}),a("manage")&&t.jsxs("button",{onClick:()=>l(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:s("addPayment")})]})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 gap-4",children:[t.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 sm:p-6 rounded-xl border border-green-200 dark:border-green-800",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-green-600 dark:text-green-400",children:s("paidPayment")}),t.jsx("p",{className:"text-xl sm:text-2xl font-bold text-green-900 dark:text-green-100",children:e.filter(N=>N.status==="paid").length})]}),t.jsx(vt,{className:"h-8 w-8 text-green-600 hidden sm:inline"})]})}),t.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 sm:p-6 rounded-xl border border-yellow-200 dark:border-yellow-800",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-yellow-600 dark:text-yellow-400",children:s("pendingPayment")}),t.jsx("p",{className:"text-xl sm:text-2xl font-bold text-yellow-900 dark:text-yellow-100",children:e.filter(N=>N.status==="pending").length})]}),t.jsx(dt,{className:"h-8 w-8 text-yellow-600 hidden sm:inline"})]})}),t.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 sm:p-6 rounded-xl border border-red-200 dark:border-red-800",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-red-600 dark:text-red-400",children:s("overduePayment")}),t.jsx("p",{className:"text-xl sm:text-2xl font-bold text-red-900 dark:text-red-100",children:e.filter(N=>N.status==="overdue").length})]}),t.jsx(Er,{className:"h-8 w-8 text-red-600 hidden sm:inline"})]})})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("renter")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("room")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("amount")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("date")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("status")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("period")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:C.length>0?C.map(N=>{var D,R,F,A,P,M,T,_,H;return t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/20 rounded-full flex items-center justify-center",children:t.jsx(qe,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:N.renterName}),t.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:S(N.createdAt)}),a("manage")&&t.jsxs("div",{className:"flex space-x-2 pt-2",children:[a("edit")&&t.jsxs(t.Fragment,{children:[N.status!=="paid"&&t.jsx("button",{onClick:()=>g(N.id),className:"text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-300 px-2 py-1 rounded transition-colors",children:t.jsx(vt,{className:"h-4 w-4"})}),t.jsx("button",{onClick:()=>k(N),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300 px-2 py-1 rounded transition-colors",style:{marginLeft:0},children:t.jsx(It,{className:"h-4 w-4"})})]}),t.jsx("button",{onClick:()=>x(N),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300 px-2 py-1 rounded transition-colors",style:{marginLeft:0},children:t.jsx(nt,{className:"h-4 w-4"})})]})]})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[t.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:((F=(R=(D=N.renter)==null?void 0:D.room)==null?void 0:R.building)==null?void 0:F.name)||"N/A"}),t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("floor")," ",((M=(P=(A=N.renter)==null?void 0:A.room)==null?void 0:P.floor)==null?void 0:M.floor_number)||"N/A"]}),t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("room")," ",((_=(T=N.renter)==null?void 0:T.room)==null?void 0:_.room_number)||"N/A"]})]}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[o," ",((H=N.amount)==null?void 0:H.toLocaleString())||"0"]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[t.jsx(ut,{className:"h-4 w-4 mr-1 text-gray-400"}),N.due_date?new Date(N.due_date).toLocaleDateString():"N/A"]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[h(N.status),t.jsx("span",{className:`ml-2 px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${w(N.status)}`,children:N.status||"N/A"})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[N.month," ",N.year]})]},N.id)}):t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-6 py-24 text-center",children:t.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3",children:[t.jsx(Js,{className:"h-12 w-12 text-gray-400 dark:text-gray-500"}),t.jsx("div",{className:"text-lg font-medium text-gray-500 dark:text-gray-400",children:"No Data found"})]})})})})]})})}),f>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>v(N=>Math.max(N-1,1)),disabled:j===1,className:`px-3 py-1 rounded ${j===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let N=Math.max(1,j-1),D=Math.min(f,N+2);D-N<2&&(N=Math.max(1,D-2));const R=[];for(let F=N;F<=D;F++)R.push(t.jsx("button",{onClick:()=>v(F),className:`px-3 py-1 rounded ${j===F?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:F},F));return R})(),t.jsx("button",{onClick:()=>v(N=>Math.min(N+1,f)),disabled:j===f,className:`px-3 py-1 rounded ${j===f?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})}),n&&t.jsx(Iw,{payment:i,onClose:()=>{l(!1),u(null)}}),c&&t.jsx(Bw,{payment:m,onClose:()=>{d(!1),p(null)}})]})},zw=({payment:e,onClose:r})=>{const{updateRentPayment:a}=ae(),{t:s}=te(),n=ge(),[l,i]=b.useState({amount:0,due_date:"",paid_date:"",status:"paid",month:"",year:"",payment_method:"Cash",transaction_id:""}),u=["Cash","Bank Transfer","Mobile Banking","Check"];b.useEffect(()=>{if(e){const d=m=>m?m.split("T")[0]:"";i({amount:e.amount,due_date:d(e.due_date),paid_date:d(e.paid_date),status:"paid",month:e.month,year:e.year,payment_method:e.payment_method||"Cash",transaction_id:e.transaction_id||""})}},[e]);const o=d=>{const{name:m,value:p}=d.target;i(j=>({...j,[m]:m==="amount"||m==="year"?parseInt(p)||0:p}))},c=d=>{d.preventDefault(),a(e.id,l),r()};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:s("paymentDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:c,className:"p-6 space-y-4",children:[t.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[t.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-lg flex-1",children:t.jsx("div",{className:"flex items-center space-x-3",children:t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:e.renterName}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("building")," ",e.renter.room.building.name]}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("floor")," ",e.renter.room.floor.floor_number]}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("room")," ",e.renter.room.room_number]})]})})}),t.jsxs("div",{className:"p-4 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-700 dark:text-white flex-1 space-y-3",children:[t.jsxs("div",{style:{marginTop:0},children:[t.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("amount"),": "]}),t.jsxs("span",{className:"text-sm",children:[l.amount," (",n,")"]})]}),t.jsxs("div",{style:{marginTop:0},children:[t.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("date"),": "]}),t.jsx("span",{className:"text-sm",children:l.due_date})]}),t.jsxs("div",{style:{marginTop:0},children:[t.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("month"),": "]}),t.jsx("span",{className:"text-sm",children:l.month})]})]})]}),l.status==="paid"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Payment Method"}),t.jsx("select",{name:"payment_method",value:l.payment_method,onChange:o,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:u.map(d=>t.jsx("option",{value:d,children:d},d))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Transaction ID"}),t.jsx("input",{type:"text",name:"transaction_id",value:l.transaction_id,onChange:o,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"Optional"})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:s("cancel")}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:s("save")})]})]})]})})},Uw=()=>{const{rentPayments:e=[],buildings:r,floors:a,rooms:s,renters:n}=ae()??{},{hasPermission:l}=ie(),{t:i}=te(),[u,o]=b.useState(!1),[c,d]=b.useState(null),m=ge(),[p,j]=b.useState([]),[v,y]=b.useState({building_id:"",floor_id:"",room_id:"",renter_id:""});b.useEffect(()=>{const C=e.filter(N=>N.status==="pending");j(C),x(1)},[e]);const f=p.filter(C=>!(v.building_id&&C.renter.building_id!==v.building_id||v.floor_id&&C.renter.floor_id!==v.floor_id||v.room_id&&C.room_number!==v.room_id||v.renter_id&&C.renter_id!==v.renter_id)),[k,x]=b.useState(1),g=3,h=Math.ceil(f.length/g),w=C=>{d(C),o(!0)},S=f.slice((k-1)*g,k*g);return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:i("pendingRent")})}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:i("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("building")}),t.jsxs("select",{value:v.building_id,onChange:C=>y(N=>({...N,building_id:C.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:i("allBuildings")}),r.map(C=>t.jsx("option",{value:C.id,children:C.name},C.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("floor")}),t.jsxs("select",{value:v.floor_id,onChange:C=>y(N=>({...N,floor_id:C.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:i("allfloors")}),a.filter(C=>!v.building_id||C.building_id===v.building_id).map(C=>t.jsxs("option",{value:C.id,children:[i("floor")," ",C.floor_number]},C.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("room")}),t.jsxs("select",{value:v.room_id,onChange:C=>y(N=>({...N,room_id:C.target.value,renter_id:""})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:i("allRooms")}),s.filter(C=>!v.floor_id||C.floor_id===v.floor_id).map(C=>t.jsxs("option",{value:C.id,children:[i("room")," ",C.room_number]},C.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("renters")}),t.jsxs("select",{value:v.renter_id,onChange:C=>y(N=>({...N,renter_id:C.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:i("selectarenter")}),n.filter(C=>!(v.building_id&&C.building_id!==v.building_id||v.floor_id&&C.floor_id!==v.floor_id||v.room_id&&C.room_id!==v.room_id)).map(C=>t.jsx("option",{value:C.id,children:C.name},C.id))]})]})]})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("renterinfo")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("location")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("rentInfo")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:i("action")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:S.map(C=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"ml-4",children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:C.renterName}),t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:C.renter.email}),t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:C.renter.phone}),t.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:C.renter.nid})]})})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[t.jsxs("div",{className:"text-sm text-gray-900 dark:text-white",children:[i("building")," ",C.renter.room.building.name]}),t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[i("floor")," ",C.renter.room.floor.floor_number]}),t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[i("room")," ",C.renter.room.room_number]})]}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[m," ",C.amount.toLocaleString()]}),t.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:C.month})]}),l("manage")&&t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx("div",{className:"flex space-x-2 pt-2",children:C.status!=="paid"&&t.jsx("button",{onClick:()=>w(C),className:"bg-green-100 hover:bg-green-200 dark:bg-green-900/20 dark:hover:bg-green-800 text-green-600 dark:text-green-400 px-2 py-1 rounded transition-colors text-sm font-medium",children:i("markasPaid")})})})]},C.id))})]})})}),h>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>x(C=>Math.max(C-1,1)),disabled:k===1,className:`px-3 py-1 rounded ${k===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let C=Math.max(1,k-1),N=Math.min(h,C+2);N-C<2&&(C=Math.max(1,N-2));const D=[];for(let R=C;R<=N;R++)D.push(t.jsx("button",{onClick:()=>x(R),className:`px-3 py-1 rounded ${k===R?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:R},R));return D})(),t.jsx("button",{onClick:()=>x(C=>Math.min(C+1,h)),disabled:k===h,className:`px-3 py-1 rounded ${k===h?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})}),u&&t.jsx(zw,{payment:c,onClose:()=>{o(!1),d(null)}})]})},Vw=({maintenance:e,onClose:r})=>{const{buildings:a,rooms:s,floors:n,addMaintenance:l,updateMaintenance:i}=ae(),[u,o]=b.useState({building_id:"",floor_id:null,room_id:null,bed_id:null,type:"repair",description:"",priority:"medium",status:"pending",assigned_to:"",cost:0,scheduled_date:"",completed_date:"",notes:""}),{t:c}=te(),[d,m]=b.useState({}),[p,j]=b.useState([]),[v,y]=b.useState([]),[f,k]=b.useState({}),x=ge(),g=D=>R=>{k(F=>({...F,[D]:R}))};b.useEffect(()=>{e&&o({building_id:e.building_id,floor_id:e.floor_id||null,room_id:e.room_id||null,bed_id:e.bed_id||null,type:e.type,description:e.description,priority:e.priority,status:e.status,assigned_to:e.assigned_to||"",cost:e.cost||0,scheduled_date:e.scheduled_date,completed_date:e.completed_date||"",notes:e.notes||""})},[e]),b.useEffect(()=>{if(u.building_id){const D=n.filter(R=>R.building_id===u.building_id);j(D)}else j([])},[u.building_id,n]),b.useEffect(()=>{if(u.floor_id){const D=s.filter(R=>R.floor_id===u.floor_id);y(D)}else y([])},[u.floor_id,s]);const h=()=>{const D={};return u.building_id||(D.building_id=c("Building is Required")),D},w=D=>{D.preventDefault();const R=h();m(R),!(Object.keys(R).length>0)&&(e?i(e.id,u):l(u),r())},S=D=>{const{name:R,value:F}=D.target;o(A=>({...A,[R]:R==="cost"?parseInt(F)||0:F}))},C=D=>{const R=D.target.value;o(F=>({...F,building_id:R,room_id:null,bed_id:null}))},N=D=>{const R=D.target.value;o(F=>({...F,floor_id:R}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:c(e?"editMaintenanceRequest":"addMaintenanceRequest")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:w,className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("building")}),t.jsxs("select",{name:"building_id",value:u.building_id,onChange:C,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:c("selectabuilding")}),a.map(D=>t.jsx("option",{value:D.id,children:D.name},D.id))]}),d.building_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:d.building_id})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[c("floor")," (",c("optional"),")"]}),t.jsxs("select",{name:"floor_id",value:u.floor_id,onChange:N,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",disabled:!u.building_id,children:[t.jsx("option",{value:"",children:c("selectafloor")}),p.map(D=>t.jsxs("option",{value:D.id,children:[c("floor")," ",D.floor_number]},D.id))]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[c("room")," (",c("optional"),")"]}),t.jsxs("select",{name:"room_id",value:u.room_id,onChange:S,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",disabled:!u.floor_id,children:[t.jsx("option",{value:"",children:c("selectaroom")}),v.map(D=>t.jsxs("option",{value:D.id,children:[c("room")," ",D.room_number]},D.id))]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("type")}),t.jsxs("select",{name:"type",value:u.type,onChange:S,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"cleaning",children:c("cleaning")}),t.jsx("option",{value:"repair",children:c("repair")}),t.jsx("option",{value:"inspection",children:c("inspection")}),t.jsx("option",{value:"upgrade",children:c("upgrade")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("priority")}),t.jsxs("select",{name:"priority",value:u.priority,onChange:S,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"low",children:c("low")}),t.jsx("option",{value:"medium",children:c("medium")}),t.jsx("option",{value:"high",children:c("high")}),t.jsx("option",{value:"urgent",children:c("urgent")})]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("description")}),t.jsx(Tt,{name:"description",value:u.description,onChange:S,onValidationError:g("description"),fieldName:"Description",rows:3,placeholder:c("describethemaintenanceissuetask"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),f.description&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.description})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("assignedTo")}),t.jsx(pe,{type:"text",name:"assigned_to",value:u.assigned_to,onChange:S,onValidationError:g("assigned_to"),fieldName:"Assigned To",placeholder:c("staffmembercontractorname"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),f.assigned_to&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.assigned_to})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[c("estimatedCost")," (",x,")"]}),t.jsx("input",{type:"text",name:"cost",value:u.cost,onChange:S,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("scheduledDate")}),t.jsx("input",{type:"date",name:"scheduled_date",value:u.scheduled_date,onChange:S,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("status")}),t.jsxs("select",{name:"status",value:u.status,onChange:S,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"pending",children:c("pending")}),t.jsx("option",{value:"in_progress",children:c("in_progress")}),t.jsx("option",{value:"completed",children:c("completed")}),t.jsx("option",{value:"cancelled",children:c("cancelled")})]})]})]}),u.status==="completed"&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("completedDate")}),t.jsx("input",{type:"date",name:"completed_date",value:u.completed_date,onChange:S,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("notes")}),t.jsx(Tt,{name:"notes",value:u.notes,onChange:S,onValidationError:g("notes"),fieldName:"Notes",rows:2,placeholder:c("additionalnotescomments"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),f.notes&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.notes})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:c("cancel")}),t.jsxs("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[c(e?"update":"create")," ",c("request")]})]})]})]})})},Hw=({maintenance:e,onClose:r})=>{var i,u,o,c;const{t:a}=te(),s=ge();if(!e)return null;const n={pending:"text-yellow-600",in_progress:"text-blue-600",completed:"text-green-600",cancelled:"text-red-600"},l={low:"text-gray-500",medium:"text-blue-600",high:"text-orange-600",urgent:"text-red-600"};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:a("maintenanceDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500",children:a("building")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:((i=e==null?void 0:e.building)==null?void 0:i.name)||"-"})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500",children:a("floor")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:(o=(u=e==null?void 0:e.room)==null?void 0:u.floor)!=null&&o.floor_number?`${a("floor")} ${e.room.floor.floor_number}`:"-"})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500",children:a("room")}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:(c=e==null?void 0:e.room)!=null&&c.room_number?`${a("room")} ${e.room.room_number}`:"-"})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg flex items-center space-x-2",children:[t.jsx(Jt,{className:"h-4 w-4 text-gray-400"}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:a(e.type)})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500",children:a("priority")}),t.jsx("p",{className:`font-semibold ${l[e.priority]||""}`,children:a(e.priority)})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500",children:a("status")}),t.jsx("p",{className:`font-semibold ${n[e.status]||""}`,children:a(e.status)})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg flex items-center space-x-2",children:[t.jsx(qe,{className:"h-4 w-4 text-gray-400"}),t.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:e.assigned_to||"-"})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg flex items-center space-x-2",children:[t.jsx(ut,{className:"h-4 w-4 text-gray-400"}),t.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:e.scheduled_date||"-"})]}),e.completed_date&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg flex items-center space-x-2",children:[t.jsx(ut,{className:"h-4 w-4 text-gray-400"}),t.jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:e.completed_date})]})]}),e.cost>0&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg flex items-center space-x-2",children:[t.jsx(zk,{className:"h-4 w-4 text-gray-400"}),t.jsxs("span",{className:"font-medium text-gray-900 dark:text-white",children:[s,e.cost]})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg",children:[t.jsx("p",{className:"text-sm text-gray-500",children:a("description")}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:e.description})]}),e.notes&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-lg flex items-start space-x-2",children:[t.jsx(Ue,{className:"h-4 w-4 text-gray-400 mt-1"}),t.jsx("p",{className:"text-gray-900 dark:text-white",children:e.notes})]}),t.jsx("div",{className:"flex justify-end pt-4",children:t.jsx("button",{onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:a("close")})})]})]})})},qw=()=>{const{maintenance:e=[],buildings:r,updateMaintenance:a=()=>{}}=ae()??{},{hasPermission:s}=ie(),[n,l]=b.useState(!1),[i,u]=b.useState(null),[o,c]=b.useState({status:"",building_id:"",priority:"",type:""}),d=ge(),{t:m}=te(),[p,j]=b.useState(!1),[v,y]=b.useState(null),f=_=>{u(_),l(!0)},k=_=>{y(_),j(!0)},x=()=>{l(!1),u(null)},g=()=>{j(!1),j(null)},h=(_,H)=>{a(_,{status:H,completed_date:H==="completed"?new Date().toISOString().split("T")[0]:void 0})},w=_=>{switch(_){case"urgent":return t.jsx(Qt,{className:"h-4 w-4 text-red-600"});case"high":return t.jsx(Qt,{className:"h-4 w-4 text-orange-600"});case"medium":return t.jsx(dt,{className:"h-4 w-4 text-yellow-600"});default:return t.jsx(Jt,{className:"h-4 w-4 text-blue-600"})}},S=_=>{switch(_){case"completed":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"in_progress":return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400";case"pending":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";case"cancelled":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},C=_=>{switch(_){case"urgent":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";case"high":return"bg-orange-100 text-orange-800 dark:bg-orange-900/20 dark:text-orange-400";case"medium":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";default:return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400"}},N=e.filter(_=>!(o.status&&_.status!==o.status||o.building_id&&_.building_id!==o.building_id||o.priority&&_.priority!==o.priority||o.type&&_.type!==o.type)),D={total:e.length,pending:e.filter(_=>_.status==="pending").length,inProgress:e.filter(_=>_.status==="in_progress").length,completed:e.filter(_=>_.status==="completed").length,urgent:e.filter(_=>_.priority==="urgent").length},R=_=>new Date(_).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}),[F,A]=b.useState(1),P=3,M=Math.ceil(N.length/P),T=N.slice((F-1)*P,F*P);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:m("maintenanceManagement")}),t.jsx("p",{className:"text-[10px] sm:text-sm text-gray-600 dark:text-gray-400 mt-1",children:m("maintenanceManagementdes")})]}),s("manage")&&t.jsxs("button",{onClick:()=>l(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:m("addMaintenanceRequest")})]})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-5 lg:grid-cols-5 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:D.total}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:m("totalRequests")})]}),t.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 sm:p-4 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-yellow-900 dark:text-yellow-100",children:D.pending}),t.jsx("div",{className:"text-xs sm:text-sm text-yellow-600 dark:text-yellow-400",children:m("pending")})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 sm:p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-900 dark:text-blue-100",children:D.inProgress}),t.jsx("div",{className:"text-xs sm:text-sm text-blue-600 dark:text-blue-400",children:m("inProgress")})]}),t.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 sm:p-4 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-900 dark:text-green-100",children:D.completed}),t.jsx("div",{className:"text-xs sm:text-sm text-green-600 dark:text-green-400",children:m("completed")})]}),t.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 sm:p-4 rounded-lg border border-red-200 dark:border-red-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-red-900 dark:text-red-100",children:D.urgent}),t.jsx("div",{className:"text-xs sm:text-sm text-red-600 dark:text-red-400",children:m("urgent")})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:m("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:m("building")}),t.jsxs("select",{value:o.building_id,onChange:_=>c(H=>({...H,building_id:_.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:m("allBuildings")}),r.map(_=>t.jsx("option",{value:_.id,children:_.name},_.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:m("status")}),t.jsxs("select",{value:o.status,onChange:_=>c(H=>({...H,status:_.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:m("allStatus")}),t.jsx("option",{value:"pending",children:m("pending")}),t.jsx("option",{value:"in_progress",children:m("inProgress")}),t.jsx("option",{value:"completed",children:m("completed")}),t.jsx("option",{value:"cancelled",children:m("cancelled")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:m("priority")}),t.jsxs("select",{value:o.priority,onChange:_=>c(H=>({...H,priority:_.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:m("allpriority")}),t.jsx("option",{value:"low",children:m("low")}),t.jsx("option",{value:"medium",children:m("medium")}),t.jsx("option",{value:"high",children:m("high")}),t.jsx("option",{value:"urgent",children:m("urgent")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:m("type")}),t.jsxs("select",{value:o.type,onChange:_=>c(H=>({...H,type:_.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:m("allTypes")}),t.jsx("option",{value:"cleaning",children:m("cleaning")}),t.jsx("option",{value:"repair",children:m("repair")}),t.jsx("option",{value:"inspection",children:m("inspection")}),t.jsx("option",{value:"upgrade",children:m("upgrade")})]})]})]})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:m("requestDetails")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:m("location")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:m("priority")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:m("status")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:m("scheduledDate")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:m("cost")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:T.length>0?T.map(_=>{var H,B,U,V,J,X;return t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4",children:t.jsxs("div",{className:"flex items-start space-x-3",children:[t.jsx("div",{className:"flex-shrink-0 mt-1",children:w(_.priority)}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:((H=_.type)==null?void 0:H.charAt(0).toUpperCase())+((B=_.type)==null?void 0:B.slice(1))||"N/A"}),t.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:R(_.createdAt)}),_.assigned_to&&t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Assigned to: ",_.assigned_to]}),s("manage")&&t.jsxs("div",{className:"flex space-x-2 mt-2",children:[t.jsx("button",{onClick:()=>f(_),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(It,{className:"h-3 w-3"})}),t.jsx("button",{onClick:()=>k(_),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300 px-2 py-1 rounded transition-colors",children:t.jsx(nt,{className:"h-3 w-3"})})]})]})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[t.jsxs("div",{className:"text-sm text-gray-900 dark:text-white",children:["Building ",((U=_.building)==null?void 0:U.name)||"N/A"]}),_.room_id&&t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Room ",((V=_.room)==null?void 0:V.room_number)||"N/A"," from ( Floor ",((X=(J=_.room)==null?void 0:J.floor)==null?void 0:X.floor_number)||"N/A"," )"]})]}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full capitalize ${C(_.priority)}`,children:_.priority||"N/A"})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full capitalize ${S(_.status)}`,children:_.status?_.status.replace("_"," "):"N/A"}),s("edit")&&_.status!=="completed"&&t.jsxs("select",{value:_.status,onChange:z=>h(_.id,z.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"pending",children:"Pending"}),t.jsx("option",{value:"in_progress",children:"In Progress"}),t.jsx("option",{value:"completed",children:"Completed"}),t.jsx("option",{value:"cancelled",children:"Cancelled"})]})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:_.scheduled_date?new Date(_.scheduled_date).toLocaleDateString():"Not scheduled"}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white",children:_.cost?`${d} ${_.cost.toLocaleString()}`:"TBD"})]},_.id)}):t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-6 py-24 text-center",children:t.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3",children:[t.jsx(Jt,{className:"h-12 w-12 text-gray-400 dark:text-gray-500"}),t.jsx("div",{className:"text-lg font-medium text-gray-500 dark:text-gray-400",children:"No Data Available"})]})})})})]})})}),M>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>A(_=>Math.max(_-1,1)),disabled:F===1,className:`px-3 py-1 rounded ${F===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let _=Math.max(1,F-1),H=Math.min(M,_+2);H-_<2&&(_=Math.max(1,H-2));const B=[];for(let U=_;U<=H;U++)B.push(t.jsx("button",{onClick:()=>A(U),className:`px-3 py-1 rounded ${F===U?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:U},U));return B})(),t.jsx("button",{onClick:()=>A(_=>Math.min(_+1,M)),disabled:F===M,className:`px-3 py-1 rounded ${F===M?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})}),n&&t.jsx(Vw,{maintenance:i,onClose:x}),p&&t.jsx(Hw,{maintenance:v,onClose:g})]})},Ww=({expense:e,onClose:r})=>{var x;const{buildings:a,addExpense:s,updateExpense:n}=ae(),[l,i]=b.useState({building_id:"",category:"maintenance",description:"",amount:0,date:new Date().toISOString().split("T")[0],vendor:"",receipt:"",approved_by:"",document:null,oldDocument:null}),[u,o]=b.useState({}),c=ge(),{t:d}=te(),[m,p]=b.useState({});b.useEffect(()=>{if(e){const g=h=>h?h.split("T")[0]:"";i({building_id:e.building_id||"",category:e.category,description:e.description,amount:e.amount,date:g(e.date),vendor:e.vendor||"",receipt:e.receipt||"",approved_by:e.approved_by||"",document:null,oldDocument:e.document||null})}},[e]);const j=()=>{const g={};return l.description||(g.description=d("Description is Required")),g},v=g=>{g.preventDefault();const h=j();if(p(h),Object.keys(h).length>0)return;const w=new FormData;w.append("building_id",l.building_id),w.append("category",l.category),w.append("description",l.description),w.append("amount",l.amount),w.append("date",l.date),w.append("vendor",l.vendor),w.append("receipt",l.receipt),w.append("approved_by",l.approved_by),l.document&&w.append("document",l.document),e?n(e.id,l):s(l),r()},y=g=>{const{name:h,value:w}=g.target;i(S=>({...S,[h]:h==="amount"?parseFloat(w)||0:w}))},f=g=>{i(h=>({...h,document:g}))},k=g=>h=>{o(w=>({...w,[g]:h}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:d(e?"editExpense":"addNewExpense")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:v,className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("category")}),t.jsxs("select",{name:"category",value:l.category,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"maintenance",children:d("maintenance")}),t.jsx("option",{value:"utilities",children:d("utilities")}),t.jsx("option",{value:"staff",children:d("staff")}),t.jsx("option",{value:"supplies",children:d("supplies")}),t.jsx("option",{value:"other",children:d("other")})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("building")," (",d("optional"),")"]}),t.jsxs("select",{name:"building_id",value:l.building_id,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allBuildings")}),a.map(g=>t.jsx("option",{value:g.id,children:g.name},g.id))]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("description")}),t.jsx(Tt,{name:"description",value:l.description,onChange:y,onValidationError:k("description"),fieldName:"Description",rows:3,placeholder:d("describetheexpense"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),m.description&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.description})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("amount")," (",c,")"]}),t.jsx(pe,{type:"text",name:"amount",value:l.amount,onChange:y,step:"0.01",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("date")}),t.jsx(pe,{type:"date",name:"date",value:l.date,onChange:y,onValidationError:k("date"),fieldName:"Date",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("vendorSupplier")}),t.jsx(pe,{type:"text",name:"vendor",value:l.vendor,onChange:y,onValidationError:k("vendor"),fieldName:"Vendor",placeholder:d("companypersonname"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),u.vendor&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:u.vendor})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("Approved By")}),t.jsx(pe,{type:"text",name:"approved_by",value:l.approved_by,onChange:y,placeholder:d("manageradminname"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("receiptInvoiceNumber")}),t.jsx("input",{type:"text",name:"receipt",value:l.receipt,onChange:y,placeholder:d("receiptinvoicereference"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("document")}),t.jsx(fa,{onChange:f,onValidationError:k("document"),maxSizeMB:10,allowedExtensions:["jpg","jpeg","png","pdf","doc","docx"],checkSignature:!0,accept:"image/*,.pdf,.doc,.docx",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),u.document&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:u.document})]}),t.jsx("div",{children:l.oldDocument&&t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:d("uploadedDocument")}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-600 rounded-lg",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Ue,{className:"h-5 w-5 text-blue-600"}),t.jsx("div",{children:t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:(x=l.oldDocument)==null?void 0:x.replace(/^\/uploads\//,"")})})]}),t.jsx("div",{className:"flex items-center space-x-2",children:t.jsx("button",{type:"button",onClick:()=>window.open(l.oldDocument,"_blank"),className:"p-1 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(nt,{className:"h-4 w-4"})})})]})]})}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:d("cancel")}),t.jsxs("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[d(e?"update":"create")," ",d("expense")]})]})]})]})})},Qw=({expense:e,onClose:r})=>{var i;const{buildings:a}=ae(),{t:s}=te(),n=ge();if(!e)return null;const l=a.find(u=>u.id===e.building_id);return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:s("expenseDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("category")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:s(e.category)})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("building")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:(l==null?void 0:l.name)||s("allBuildings")})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("amount")}),t.jsxs("p",{className:"text-base text-gray-900 dark:text-gray-100",children:[n,e.amount]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("date")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:((i=e.date)==null?void 0:i.split("T")[0])||"-"})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("description")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.description||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("vendorSupplier")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.vendor||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("approvedBy")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.approved_by||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("receiptInvoiceNumber")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.receipt||"-"})]}),e.document&&t.jsxs("div",{children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("uploadedDocument")}),t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Ue,{className:"h-5 w-5 text-blue-600"}),t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 truncate",children:e.document.replace(/^\/uploads\//,"")})]}),t.jsx("button",{type:"button",onClick:()=>window.open(e.document,"_blank"),className:"p-1 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(nt,{className:"h-4 w-4"})})]})]})]})]})})},Jw=()=>{const{expenses:e=[],buildings:r=()=>{}}=ae()??{},{hasPermission:a}=ie(),[s,n]=b.useState(!1),[l,i]=b.useState(null),[u,o]=b.useState({category:"",building_id:"",dateFrom:"",dateTo:""}),c=ge(),{t:d}=te(),[m,p]=b.useState(!1),[j,v]=b.useState(null),y=A=>{i(A),n(!0)},f=A=>{v(A),p(!0)},k=()=>{n(!1),i(null)},x=()=>{p(!1),v(null)},g=A=>{switch(A){case"maintenance":return"bg-orange-100 text-orange-800 dark:bg-orange-900/20 dark:text-orange-400";case"utilities":return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400";case"staff":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"supplies":return"bg-purple-100 text-purple-800 dark:bg-purple-900/20 dark:text-purple-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},h=e.filter(A=>!(u.category&&A.category!==u.category||u.building_id&&A.building_id!==u.building_id||u.dateFrom&&A.date<u.dateFrom||u.dateTo&&A.date>u.dateTo)),w={total:e.reduce((A,P)=>A+Number(P.amount||0),0),thisMonth:e.filter(A=>new Date(A.date).getMonth()===new Date().getMonth()).reduce((A,P)=>A+Number(P.amount||0),0),maintenance:e.filter(A=>A.category==="maintenance").reduce((A,P)=>A+Number(P.amount||0),0),utilities:e.filter(A=>A.category==="utilities").reduce((A,P)=>A+Number(P.amount||0),0)},S=A=>new Date(A).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}),[C,N]=b.useState(1),D=3,R=Math.ceil(h.length/D),F=h.slice((C-1)*D,C*D);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:d("expenseManagement")}),t.jsx("p",{className:"text-[10px] sm:text-sm text-gray-600 dark:text-gray-400 mt-1",children:d("expenseManagementdes")})]}),a("manage")&&t.jsxs("button",{onClick:()=>n(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:d("addExpense")})]})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:[c," ",w.total.toLocaleString()]}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:d("totalExpenses")})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsxs("div",{className:"text-xl sm:text-2xl font-bold text-blue-900 dark:text-blue-100",children:[c," ",w.thisMonth.toLocaleString()]}),t.jsx("div",{className:"text-xs sm:text-sm text-blue-600 dark:text-blue-400",children:d("thisMonth")})]}),t.jsxs("div",{className:"bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg border border-orange-200 dark:border-orange-800",children:[t.jsxs("div",{className:"text-xl sm:text-2xl font-bold text-orange-900 dark:text-orange-100",children:[c," ",w.maintenance.toLocaleString()]}),t.jsx("div",{className:"text-xs sm:text-sm text-orange-600 dark:text-orange-400",children:d("maintenance")})]}),t.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsxs("div",{className:"text-xl sm:text-2xl font-bold text-green-900 dark:text-green-100",children:[c," ",w.utilities.toLocaleString()]}),t.jsx("div",{className:"text-xs sm:text-sm text-green-600 dark:text-green-400",children:d("utilities")})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:d("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("category")}),t.jsxs("select",{value:u.category,onChange:A=>o(P=>({...P,category:A.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allCategories")}),t.jsx("option",{value:"maintenance",children:d("maintenance")}),t.jsx("option",{value:"utilities",children:d("utilities")}),t.jsx("option",{value:"staff",children:d("staff")}),t.jsx("option",{value:"supplies",children:d("supplies")}),t.jsx("option",{value:"other",children:d("other")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("building")}),t.jsxs("select",{value:u.building_id,onChange:A=>o(P=>({...P,building_id:A.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allBuildings")}),r.map(A=>t.jsx("option",{value:A.id,children:A.name},A.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("fromDate")}),t.jsx("input",{type:"date",value:u.dateFrom,onChange:A=>o(P=>({...P,dateFrom:A.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("toDate")}),t.jsx("input",{type:"date",value:u.dateTo,onChange:A=>o(P=>({...P,dateTo:A.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("expenseDetails")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("category")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("amount")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("date")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("building")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("vendor")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:F.length>0?F.map(A=>{var P;return t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"w-10 h-10 bg-red-100 dark:bg-red-900/20 rounded-full flex items-center justify-center",children:t.jsx(Jg,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:A.description}),A.approved_by&&t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[d("approvedby")," : ",A.approved_by]}),a("edit")&&t.jsx("button",{onClick:()=>y(A),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(It,{className:"h-3 w-3"})}),a("delete")&&t.jsx("button",{onClick:()=>f(A),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300 px-2 py-1 rounded transition-colors",children:t.jsx(nt,{className:"h-3 w-3"})})]})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full capitalize ${g(A.category)}`,children:A.category})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm font-medium text-gray-900 dark:text-white",children:[c," ",A.amount.toLocaleString()]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-500 dark:text-gray-400",children:[t.jsx(ut,{className:"h-4 w-4 mr-1"}),S(A.date)]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white",children:A.building_id?((P=r.find(M=>M.id===A.building_id))==null?void 0:P.name)||"Unknown":"All Buildings"}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:A.vendor||"N/A"})]},A.id)}):t.jsx("tr",{children:t.jsx("td",{colSpan:"6",className:"px-6 py-8 text-center text-gray-500 dark:text-gray-400 text-sm",children:"No data available"})})})]})})}),R>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>N(A=>Math.max(A-1,1)),disabled:C===1,className:`px-3 py-1 rounded ${C===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let A=Math.max(1,C-1),P=Math.min(R,A+2);P-A<2&&(A=Math.max(1,P-2));const M=[];for(let T=A;T<=P;T++)M.push(t.jsx("button",{onClick:()=>N(T),className:`px-3 py-1 rounded ${C===T?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:T},T));return M})(),t.jsx("button",{onClick:()=>N(A=>Math.min(A+1,R)),disabled:C===R,className:`px-3 py-1 rounded ${C===R?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})}),s&&t.jsx(Ww,{expense:l,onClose:k}),m&&t.jsx(Qw,{expense:j,onClose:x})]})},Yw=()=>{const{getStatistics:e=()=>({}),buildings:r=[],renters:a=[],rooms:s=[],rentPayments:n=[],expenses:l=[],getFilteredData:i=()=>[]}=ae()??{},{t:u}=te(),[o,c]=b.useState({dateFrom:"",dateTo:"",building_id:"",status:"",reportType:"summary"});e();const d=ge(),m=(R,F)=>{c(A=>({...A,[R]:F}))},p=()=>n.filter(R=>!(o.dateFrom&&R.due_date<o.dateFrom||o.dateTo&&R.due_date>o.dateTo||o.status&&R.status!==o.status||o.building_id&&(!a.find(P=>P.id===R.renter_id)||!r.find(P=>P.id===o.building_id)))),j=()=>l.filter(R=>!(o.dateFrom&&R.date<o.dateFrom||o.dateTo&&R.date>o.dateTo||o.building_id&&R.building_id!==o.building_id)),v=()=>r.filter(R=>!(o.dateFrom&&R.createdAt<o.dateFrom||o.dateTo&&R.createdAt>o.dateTo||o.building_id&&R.id!==o.building_id)),y=()=>a.filter(R=>!(o.dateFrom&&R.createdAt<o.dateFrom||o.dateTo&&R.createdAt>o.dateTo||o.building_id&&R.building_id!==o.building_id)),f=()=>s.filter(R=>!(o.dateFrom&&R.createdAt<o.dateFrom||o.dateTo&&R.createdAt>o.dateTo||o.building_id&&R.building_id!==o.building_id)),k=R=>new Date(R).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}),x=R=>{const F=p(),A=j(),P=v(),M=y(),T=f();switch(R){case"revenue":return F.map(_=>({Date:k(_.due_date),Renter:_.renter.name,Room:_.renter.room.room_number,Amount:_.amount,Status:_.status,"Payment Method":_.payment_method||"N/A","Transaction ID":_.transaction_id||"N/A",Month:_.month,Year:_.year}));case"expenses":return A.map(_=>{var H;return{Date:k(_.date),Category:_.category,Description:_.description,Amount:_.amount,Vendor:_.vendor||"N/A",Building:((H=r.find(B=>B.id===_.building_id))==null?void 0:H.name)||"All Buildings","Approved By":_.approved_by||"N/A"}});case"occupancy":return P.map(_=>{const H=_.buildingFloors.reduce((J,X)=>{const z=X.rooms.filter(E=>E.status!=="available").length;return J+z},0),B=_.buildingFloors.reduce((J,X)=>{const z=X.rooms.filter(E=>E.status=="available").length;return J+z},0),U=_.buildingFloors.flatMap(J=>J.rooms.map(X=>X.id)),V=F.filter(J=>J.status==="paid"&&J.renter&&U.includes(J.renter.room_id)).reduce((J,X)=>J+Number(X.amount),0);return{Building:_.name,Address:_.address,"Occupied Rooms":H,"Available Rooms":B,"Occupancy Rate":_.total_rooms>0?`${(H/_.total_rooms*100).toFixed(1)}%`:"N/A","Monthly Revenue":V}});case"renters":return M.map(_=>({Name:_.name,Email:_.email,Phone:_.phone,NID:_.nid,Room:_.room_id,"Rent Amount":_.rent_amount,"Security Deposit":_.security_deposit,"Check-in Date":_.check_in_date,Status:_.status,Occupation:_.occupation||"N/A",Company:_.company||"N/A","Emergency Contact":_.emergency_contact}));case"availableRooms":return T.filter(_=>_.status==="available").map(_=>({"Room Number":_.room_number,"Room Type":_.room_type,Rent:_.rent_per_bed,Building:_.building.name,Floor:_.floor.floor_number}));case"bookedRooms":return T.filter(_=>_.status==="booked").map(_=>({"Room Number":_.room_number,"Room Type":_.room_type,Rent:_.rent_per_bed,Building:_.building.name,Floor:_.floor.floor_number,Date:k(_.available_from),Information:_.reservation_note}));default:return[]}},g=R=>{const F=x(R);if(F.length===0){alert("No data available for the selected filters");return}const A=h(F),P=`${R}_report_${o.dateFrom}_to_${o.dateTo}.csv`;w(A,P)},h=R=>{if(!R.length)return"";const F=Object.keys(R[0]).join(","),A=R.map(P=>Object.values(P).map(M=>`"${M}"`).join(",")).join(`
`);return`${F}
${A}`},w=(R,F)=>{const A=new Blob([R],{type:"text/csv;charset=utf-8;"}),P=document.createElement("a"),M=URL.createObjectURL(A);P.setAttribute("href",M),P.setAttribute("download",F),P.style.visibility="hidden",document.body.appendChild(P),P.click(),document.body.removeChild(P)},S=()=>{const R=p(),F=R.filter(M=>M.status==="paid").reduce((M,T)=>M+Number(T.amount||0),0),A=R.filter(M=>M.status==="pending").reduce((M,T)=>M+Number(T.amount||0),0),P=R.filter(M=>M.status==="overdue").reduce((M,T)=>M+Number(T.amount||0),0);return{totalRevenue:F,pendingRevenue:A,overdueRevenue:P}},C=()=>{const R=j(),F=R.reduce((P,M)=>P+Number(M.amount||0),0),A=R.reduce((P,M)=>(P[M.category]=(P[M.category]||0)+Number(M.amount||0),P),{});return{totalExpenses:F,categoryBreakdown:A}},N=S(),D=C();return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:u("advancedReports")}),t.jsx("p",{className:"text-[10px] sm:text-sm text-gray-600 dark:text-gray-400 mt-1",children:u("advancedReportsdes")})]})}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:u("reportFilters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("fromDate")}),t.jsx("input",{type:"date",value:o.dateFrom,onChange:R=>m("dateFrom",R.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("toDate")}),t.jsx("input",{type:"date",value:o.dateTo,onChange:R=>m("dateTo",R.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("building")}),t.jsxs("select",{value:o.building_id,onChange:R=>m("building_id",R.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:u("allBuildings")}),r.map(R=>t.jsx("option",{value:R.id,children:R.name},R.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:u("paymentStatus")}),t.jsxs("select",{value:o.status,onChange:R=>m("status",R.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:u("allStatus")}),t.jsx("option",{value:"paid",children:u("paid")}),t.jsx("option",{value:"pending",children:u("pending")}),t.jsx("option",{value:"overdue",children:u("overdue")})]})]})]})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 md:grid-cols-3 lg:grid-cols-3 gap-4",children:[t.jsx("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-gray-600 dark:text-gray-400",children:u("totalRevenue")}),t.jsxs("p",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:[d," ",N.totalRevenue.toLocaleString()]})]}),t.jsx(Xr,{className:"h-8 w-8 text-green-600 hidden sm:inline"})]})}),t.jsx("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-gray-600 dark:text-gray-400",children:u("pendingRevenue")}),t.jsxs("p",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:[d," ",N.pendingRevenue.toLocaleString()]})]}),t.jsx(Mo,{className:"h-8 w-8 text-yellow-600 hidden sm:inline"})]})}),t.jsx("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-gray-600 dark:text-gray-400",children:u("totalExpenses")}),t.jsxs("p",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:[d," ",D.totalExpenses.toLocaleString()]})]}),t.jsx(Mo,{className:"h-8 w-8 text-red-600 hidden sm:inline"})]})})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6",children:[t.jsx("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4",children:u("exportReports")}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("button",{onClick:()=>g("revenue"),className:"flex items-center justify-center space-x-2 p-4 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[t.jsx(Ue,{className:"h-5 w-5 text-green-600"}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:u("revenueReports")}),t.jsx(aa,{className:"h-4 w-4 text-gray-500"})]}),t.jsxs("button",{onClick:()=>g("expenses"),className:"flex items-center justify-center space-x-2 p-4 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[t.jsx(Ue,{className:"h-5 w-5 text-red-600"}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:u("expenseReports")}),t.jsx(aa,{className:"h-4 w-4 text-gray-500"})]}),t.jsxs("button",{onClick:()=>g("occupancy"),className:"flex items-center justify-center space-x-2 p-4 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[t.jsx(Ue,{className:"h-5 w-5 text-blue-600"}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:u("occupancyReports")}),t.jsx(aa,{className:"h-4 w-4 text-gray-500"})]}),t.jsxs("button",{onClick:()=>g("renters"),className:"flex items-center justify-center space-x-2 p-4 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[t.jsx(Ue,{className:"h-5 w-5 text-purple-600"}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:u("renterReports")}),t.jsx(aa,{className:"h-4 w-4 text-gray-500"})]}),t.jsxs("button",{onClick:()=>g("availableRooms"),className:"flex items-center justify-center space-x-2 p-4 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[t.jsx(Ue,{className:"h-5 w-5 text-blue-600"}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:u("availableRooms")}),t.jsx(aa,{className:"h-4 w-4 text-gray-500"})]}),t.jsxs("button",{onClick:()=>g("bookedRooms"),className:"flex items-center justify-center space-x-2 p-4 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",children:[t.jsx(Ue,{className:"h-5 w-5 text-yellow-500"}),t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:u("bookedRooms")}),t.jsx(aa,{className:"h-4 w-4 text-gray-500"})]})]})]}),Object.keys(D.categoryBreakdown).length>0&&t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsx("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4",children:u("expenseBreakdowCategory")}),t.jsx("div",{className:"space-y-3",children:Object.entries(D.categoryBreakdown).map(([R,F])=>t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400 capitalize",children:R.replace("_"," ")}),t.jsxs("span",{className:"text-xs sm:text-sm font-medium text-gray-900 dark:text-white",children:[d," ",F.toLocaleString()]})]},R))})]})]})},Xw=({user:e,onClose:r})=>{const{addUser:a,updateUser:s}=ie(),{buildings:n}=ae(),[l,i]=b.useState({name:"",email:"",phone:"",password:"",role:"staff",department:"",permissions:[],is_active:!0,building_id:""}),[u,o]=b.useState({}),{t:c}=te(),d=[{id:"view",label:c("viewData"),description:c("viewDatades")},{id:"edit",label:c("editData"),description:c("editDatades")},{id:"manage",label:c("manageRecords"),description:c("manageRecordsdes")},{id:"delete",label:c("deleteRecords"),description:c("deleteRecordsdes")},{id:"reports",label:c("generateReports"),description:c("generateReportsdes")},{id:"settings",label:c("systemSettings"),description:c("systemSettingsdes")},{id:"user_management",label:c("userManagement"),description:c("userManagementdes")},{id:"view_buildings",label:c("buildings"),description:c("view_buildings")},{id:"view_floors",label:c("buildings"),description:c("view_floors")},{id:"view_rooms",label:c("rooms"),description:c("view_rooms")},{id:"view_customer",label:c("renters"),description:c("view_renters")},{id:"view_rents",label:c("rent"),description:c("view_rents")},{id:"view_maintenance",label:c("maintenance"),description:c("view_maintenance")},{id:"view_expenses",label:c("expenses"),description:c("view_expenses")},{id:"view_visitors",label:c("visitors"),description:c("view_visitors")}],m={admin:["view","edit","manage","delete","reports","settings","user_management"],manager:["view","edit","manage","reports"],staff:["view","edit","manage"]},p=["Administration","Operations","Management","Maintenance","Finance","Customer Service"];b.useEffect(()=>{e&&i({name:e.name,email:e.email,phone:e.phone||"",password:"",role:e.role,department:e.department||"",permissions:typeof e.permissions=="string"?JSON.parse(e.permissions):e.permissions||[],is_active:e.is_active,building_id:e.building_id||""})},[e]);const j=()=>{const x={};return l.name.trim()||(x.name=c("Name is Required")),l.email.trim()?/^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/.test(l.email)||(x.email=c("Invalid Email")):x.email=c("Email is Required"),e||(l.password.trim()?l.password.length<6&&(x.password=c("Password must be at least 6 characters")):x.password=c("Password is Required")),l.phone&&!/^\+?[\d\s()-]{7,15}$/.test(l.phone)&&(x.phone=c("Invalid Phone Number")),l.role||(x.role=c("Role is Required")),l.department||(x.department=c("Department is Required")),l.permissions.length===0&&(x.permissions=c("Add a permission")),x},v=x=>{x.preventDefault();const g=j();o(g),!(Object.keys(g).length>0)&&(e?s(e.id,l):a(l),r())},y=x=>{const{name:g,value:h,type:w}=x.target;i(S=>({...S,[g]:w==="checkbox"?x.target.checked:h}))},f=x=>{const g=x.target.value;i(h=>({...h,role:g,permissions:m[g]}))},k=x=>{i(g=>({...g,permissions:g.permissions.includes(x)?g.permissions.filter(h=>h!==x):[...g.permissions,x]}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:c(e?"editStaffMember":"addStaffMember")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:v,className:"p-6 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("fullName")}),t.jsx("input",{type:"text",name:"name",value:l.name,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),u.name&&t.jsx("p",{className:"text-red-500 text-sm",children:u.name})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("emailAddress")}),t.jsx("input",{type:"email",name:"email",value:l.email,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),u.email&&t.jsx("p",{className:"text-red-500 text-sm",children:u.email})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("phoneNumber")}),t.jsx("input",{type:"tel",name:"phone",value:l.phone,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),u.phone&&t.jsx("p",{className:"text-red-500 text-sm",children:u.phone})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[c("password")," *"]}),t.jsx("input",{type:"password",name:"password",value:l.password,onChange:y,required:!e,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),u.password&&t.jsx("p",{className:"text-red-500 text-sm",children:u.password})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("role")}),t.jsxs("select",{name:"role",value:l.role,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"staff",children:c("staff")}),t.jsx("option",{value:"manager",children:c("manager")})]}),u.role&&t.jsx("p",{className:"text-red-500 text-sm",children:u.role})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("department")}),t.jsxs("select",{name:"department",value:l.department,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:c("selectDepartment")}),p.map(x=>t.jsx("option",{value:x,children:x},x))]}),u.department&&t.jsx("p",{className:"text-red-500 text-sm",children:u.department})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:c("permissions")}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:d.map(x=>t.jsxs("label",{className:"flex items-start space-x-3 p-3 border border-gray-200 dark:border-gray-600 rounded-lg",children:[t.jsx("input",{type:"checkbox",checked:l.permissions.includes(x.id),onChange:()=>k(x.id),className:"mt-1 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:x.label}),t.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.description})]})]},x.id))}),u.permissions&&t.jsx("p",{className:"text-red-500 text-sm mt-2",children:u.permissions})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",name:"is_active",checked:l.is_active,onChange:y,className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsx("label",{className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:c("activeUser")})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:c("cancel")}),t.jsxs("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[c(e?"update":"create")," ",c("staffMember")]})]})]})]})})},Kw=({user:e,onClose:r})=>{const{buildings:a}=ae(),{t:s}=te();if(!e)return null;const n=a.find(i=>i.id===e.building_id),l=i=>{let u=[];if(Array.isArray(i))u=i;else if(typeof i=="string")try{const c=JSON.parse(i);u=Array.isArray(c)?c:[i]}catch{u=[i]}const o={view:"View",edit:"Edit",manage:"Manage",delete:"Delete",reports:"Reports",settings:"Settings",user_management:"User Mgmt",view_buildings:"View Buildings",view_floors:"View Floors",view_rooms:"View Rooms",view_customer:"View Renters",view_rents:"View Rents",view_maintenance:"View Maintenance",view_expenses:"View Expenses",view_visitors:"View Visitors"};return u.map(c=>t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400",children:o[c]||c},c))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:s("staffDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("fullName")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.name})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("emailAddress")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.email})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("phoneNumber")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.phone||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("building")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:(n==null?void 0:n.name)||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("department")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.department||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("role")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.role})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-2",children:s("permissions")}),t.jsx("div",{className:"flex flex-wrap gap-2",children:l(e.permissions)})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:s("status")}),t.jsx("p",{className:`text-base font-semibold ${e.is_active?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"}`,children:e.is_active?s("Active"):s("Inactive")})]}),t.jsx("div",{className:"flex justify-end pt-4",children:t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:s("close")})})]})]})})},Gw=()=>{const{users:e,deleteUser:r,toggleUserStatus:a,hasPermission:s}=ie(),{t:n}=te(),[l,i]=b.useState(!1),[u,o]=b.useState(null),[c,d]=b.useState(!1),[m,p]=b.useState(null),[j,v]=b.useState(!0),[y,f]=b.useState(1),k=3;if(b.useEffect(()=>{e!=null&&v(!1)},[e]),!s("user_management"))return t.jsxs("div",{className:"text-center py-12",children:[t.jsx(ea,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"You don't have permission to manage staff members."})]});if(j)return t.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center text-gray-500 dark:text-gray-400",children:[t.jsx(qe,{className:"h-10 w-10 text-gray-400 mb-3"}),t.jsxs("p",{className:"text-lg font-medium",children:[n("loading"),"..."]})]});const x=(e==null?void 0:e.filter(P=>P.role!=="renter"))||[],g=Math.ceil(x.length/k),h=x.slice((y-1)*k,y*k),w=P=>{o(P),i(!0)},S=P=>{p(P),d(!0)},C=P=>{window.confirm("Are you sure you want to delete this user?")&&r(P)},N=()=>{i(!1),o(null)},D=()=>{d(!1),p(null)},R=P=>{switch(P){case"admin":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";case"manager":return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400";case"staff":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},F=P=>{let M=[];if(Array.isArray(P))M=P;else if(typeof P=="string")try{const _=JSON.parse(P);M=Array.isArray(_)?_:[P]}catch{M=[P]}const T={view:"View",edit:"Edit",manage:"Manage",delete:"Delete",reports:"Reports",settings:"Settings",user_management:"User Mgmt",view_buildings:"View Buildings",view_floors:"View Floors",view_rooms:"View Rooms",view_customer:"View Renters",view_rents:"View Rents",view_maintenance:"View Maintenance",view_expenses:"View Expenses",view_visitors:"View Visitors"};return M.map(_=>t.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400",children:T[_]||_},_))},A=P=>new Date(P).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0});return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:n("staffManagement")}),t.jsx("p",{className:"text-[10px] sm:text-sm text-gray-600 dark:text-gray-400 mt-1",children:n("staffManagementdes")})]}),t.jsxs("button",{onClick:()=>i(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:n("addStaffMember")})]})]}),x.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center text-gray-500 dark:text-gray-400",children:[t.jsx(qe,{className:"h-10 w-10 text-gray-400 mb-3"}),t.jsx("p",{className:"text-lg font-medium",children:n("noDataAvailable")||"No Data Available"})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:n("user")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:n("roleDepartment")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:n("permissions")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:n("status")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:n("lastLogin")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:h.map(P=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/20 rounded-full flex items-center justify-center",children:t.jsx(qe,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:P.name}),t.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:A(P.createdAt)}),t.jsxs("div",{className:"flex items-center text-sm text-gray-500 dark:text-gray-400",children:[t.jsx(ql,{className:"h-3 w-3 mr-1"}),P.email]}),P.phone&&t.jsxs("div",{className:"flex items-center text-sm text-gray-500 dark:text-gray-400",children:[t.jsx(Qg,{className:"h-3 w-3 mr-1"}),P.phone]}),t.jsxs("div",{className:"flex space-x-2 pt-2",children:[s("edit")&&t.jsx("button",{onClick:()=>w(P),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(It,{className:"h-3 w-3"})}),s("delete")&&t.jsx("button",{onClick:()=>C(P.id),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(Ar,{className:"h-3 w-3"})}),t.jsx("button",{onClick:()=>S(P),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300 px-2 py-1 rounded transition-colors",children:t.jsx(nt,{className:"h-3 w-3"})})]})]})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"space-y-1",children:[t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full capitalize ${R(P.role)}`,children:P.role}),P.department&&t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:P.department})]})}),t.jsx("td",{className:"px-6 py-4",children:t.jsx("div",{className:"flex flex-wrap gap-1",children:F(P.permissions)})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx("div",{className:"flex items-center",children:t.jsxs("button",{onClick:()=>a(P.id),className:"flex items-center space-x-2",children:[s("edit")&&t.jsx(t.Fragment,{children:P.is_active?t.jsx(Kk,{className:"h-5 w-5 text-green-600"}):t.jsx(Xk,{className:"h-5 w-5 text-gray-400"})}),t.jsx("span",{className:`text-sm ${P.is_active?"text-green-600":"text-gray-400"}`,children:P.is_active?"Active":"Inactive"})]})})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:P.last_login?new Date(P.last_login).toLocaleDateString():"Never"})]},P.id))})]})})}),g>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>f(P=>Math.max(P-1,1)),disabled:y===1,className:`px-3 py-1 rounded ${y===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let P=Math.max(1,y-1),M=Math.min(g,P+2);M-P<2&&(P=Math.max(1,M-2));const T=[];for(let _=P;_<=M;_++)T.push(t.jsx("button",{onClick:()=>f(_),className:`px-3 py-1 rounded ${y===_?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:_},_));return T})(),t.jsx("button",{onClick:()=>f(P=>Math.min(P+1,g)),disabled:y===g,className:`px-3 py-1 rounded ${y===g?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})})]}),l&&t.jsx(Xw,{user:u,onClose:N}),c&&t.jsx(Kw,{user:m,onClose:D})]})},Zw=({notice:e,onClose:r})=>{const{buildings:a,floors:s,renters:n,addNotice:l,updateNotice:i}=ae(),{user:u,users:o}=ie(),[c,d]=b.useState({title:"",content:"",type:"general",priority:"medium",target_audience:"all",target_ids:[],building_id:null,floor_id:null,expiry_date:"",is_active:!0}),[m,p]=b.useState({}),j=x=>g=>{p(h=>({...h,[x]:g}))};b.useEffect(()=>{e&&d({title:e.title,content:e.content,type:e.type,priority:e.priority,target_audience:e.target_audience,target_ids:e.target_ids||[],building_id:e.building_id||null,floor_id:e.floor_id||null,expiry_date:e.expiry_date||"",is_active:e.is_active})},[e]);const v=x=>{x.preventDefault();const g={...c,created_by:(u==null?void 0:u.name)||"Unknown"};e?i(e.id,g):l(g),r()},y=x=>{const{name:g,value:h,type:w}=x.target;d(S=>({...S,[g]:w==="checkbox"?x.target.checked:h}))},f=x=>{d(g=>({...g,target_ids:g.target_ids.includes(x)?g.target_ids.filter(h=>h!==x):[...g.target_ids,x]}))},k=()=>{switch(c.target_audience){case"renters":return n.filter(x=>x.status==="active");case"staff":return o.filter(x=>x.is_active);default:return[]}};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:e?"Edit Notice":"Create New Notice"}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:v,className:"p-6 space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Title *"}),t.jsx(pe,{type:"text",name:"title",value:c.title,onChange:y,onValidationError:j("title"),fieldName:"Title",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),m.title&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.title})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Content *"}),t.jsx(Tt,{name:"content",value:c.content,onChange:y,onValidationError:j("content"),fieldName:"Content",rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),m.content&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.content})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Type"}),t.jsxs("select",{name:"type",value:c.type,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"general",children:"General"}),t.jsx("option",{value:"maintenance",children:"Maintenance"}),t.jsx("option",{value:"payment",children:"Payment"}),t.jsx("option",{value:"emergency",children:"Emergency"}),t.jsx("option",{value:"event",children:"Event"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Priority"}),t.jsxs("select",{name:"priority",value:c.priority,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"low",children:"Low"}),t.jsx("option",{value:"medium",children:"Medium"}),t.jsx("option",{value:"high",children:"High"})]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Target Audience"}),t.jsxs("select",{name:"target_audience",value:c.target_audience,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"all",children:"All Users"}),t.jsx("option",{value:"renters",children:"Renters Only"}),t.jsx("option",{value:"staff",children:"Staff Only"}),t.jsx("option",{value:"specific",children:"Specific Users"})]})]}),c.target_audience==="specific"&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Select Recipients"}),t.jsx("div",{className:"max-h-40 overflow-y-auto border border-gray-300 dark:border-gray-600 rounded-lg p-3",children:k().map(x=>t.jsxs("label",{className:"flex items-center space-x-2 mb-2",children:[t.jsx("input",{type:"checkbox",checked:c.target_ids.includes(x.id),onChange:()=>f(x.id),className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsxs("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:[x.name," ",c.target_audience==="renters"&&`(Room ${x.room_number})`]})]},x.id))})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Building (Optional)"}),t.jsxs("select",{name:"building_id",value:c.building_id,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:"All Buildings"}),a.map(x=>t.jsx("option",{value:x.id,children:x.name},x.id))]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Floor (Optional)"}),t.jsxs("select",{name:"floor_id",value:c.floor_id,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",disabled:!c.building_id,children:[t.jsx("option",{value:"",children:"All Floors"}),s.filter(x=>x.building_id===c.building_id).map(x=>t.jsxs("option",{value:x.id,children:["Floor ",x.floor_number]},x.id))]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Expiry Date (Optional)"}),t.jsx("input",{type:"date",name:"expiry_date",value:c.expiry_date,onChange:y,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsx("input",{type:"checkbox",name:"is_active",checked:c.is_active,onChange:y,className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsx("label",{className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:"Active Notice"})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:"Cancel"}),t.jsxs("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[e?"Update":"Create"," Notice"]})]})]})]})})},eN=()=>{const{notices:e=[],updateNotice:r=()=>{},markNoticeAsRead:a=()=>{}}=ae()??{},{hasPermission:s,user:n}=ie(),[l,i]=b.useState(!1),[u,o]=b.useState(null),[c,d]=b.useState({type:"",priority:"",target_audience:"",is_active:""}),m=h=>{o(h),i(!0)},p=()=>{i(!1),o(null)},j=(h,w)=>{r(h,{is_active:!w})},v=h=>{n&&a(h,n.id)},y=h=>{switch(h){case"general":return t.jsx(Vk,{className:"h-4 w-4 text-blue-600"});case"maintenance":return t.jsx(Qt,{className:"h-4 w-4 text-orange-600"});case"payment":return t.jsx(ut,{className:"h-4 w-4 text-green-600"});case"emergency":return t.jsx(Qt,{className:"h-4 w-4 text-red-600"});case"event":return t.jsx(ut,{className:"h-4 w-4 text-purple-600"});default:return t.jsx(Eu,{className:"h-4 w-4 text-gray-600"})}},f=h=>{switch(h){case"general":return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400";case"maintenance":return"bg-orange-100 text-orange-800 dark:bg-orange-900/20 dark:text-orange-400";case"payment":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"emergency":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";case"event":return"bg-purple-100 text-purple-800 dark:bg-purple-900/20 dark:text-purple-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},k=h=>{switch(h){case"high":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";case"medium":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";case"low":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},x=e.filter(h=>!(c.type&&h.type!==c.type||c.priority&&h.priority!==c.priority||c.target_audience&&h.target_audience!==c.target_audience||c.is_active!==""&&h.is_active!==(c.is_active==="true"))),g={total:e.length,active:e.filter(h=>h.is_active).length,expired:e.filter(h=>!h.is_active||h.expiry_date&&new Date(h.expiry_date)<new Date).length,high:e.filter(h=>h.priority==="high").length,unread:e.filter(h=>!(h.read_by||[]).includes((n==null?void 0:n.id)||"")).length};return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:"Notice Management"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 mt-1",children:"Create and manage notices for renters and staff"})]}),s("manage")&&t.jsxs("button",{onClick:()=>i(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center space-x-2 transition-colors",children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{children:"Create Notice"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:g.total}),t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Total Notices"})]}),t.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"text-2xl font-bold text-green-900 dark:text-green-100",children:g.active}),t.jsx("div",{className:"text-sm text-green-600 dark:text-green-400",children:"Active"})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/20 p-4 rounded-lg border border-gray-200 dark:border-gray-800",children:[t.jsx("div",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:g.expired}),t.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Expired"})]}),t.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg border border-red-200 dark:border-red-800",children:[t.jsx("div",{className:"text-2xl font-bold text-red-900 dark:text-red-100",children:g.high}),t.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:"High Priority"})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"text-2xl font-bold text-blue-900 dark:text-blue-100",children:g.unread}),t.jsx("div",{className:"text-sm text-blue-600 dark:text-blue-400",children:"Unread"})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:"Filters"})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Type"}),t.jsxs("select",{value:c.type,onChange:h=>d(w=>({...w,type:h.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:"All Types"}),t.jsx("option",{value:"general",children:"General"}),t.jsx("option",{value:"maintenance",children:"Maintenance"}),t.jsx("option",{value:"payment",children:"Payment"}),t.jsx("option",{value:"emergency",children:"Emergency"}),t.jsx("option",{value:"event",children:"Event"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Priority"}),t.jsxs("select",{value:c.priority,onChange:h=>d(w=>({...w,priority:h.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:"All Priorities"}),t.jsx("option",{value:"low",children:"Low"}),t.jsx("option",{value:"medium",children:"Medium"}),t.jsx("option",{value:"high",children:"High"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Target Audience"}),t.jsxs("select",{value:c.target_audience,onChange:h=>d(w=>({...w,target_audience:h.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:"All Audiences"}),t.jsx("option",{value:"all",children:"All"}),t.jsx("option",{value:"renters",children:"Renters"}),t.jsx("option",{value:"staff",children:"Staff"}),t.jsx("option",{value:"specific",children:"Specific"})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Status"}),t.jsxs("select",{value:c.is_active,onChange:h=>d(w=>({...w,is_active:h.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:"All Status"}),t.jsx("option",{value:"true",children:"Active"}),t.jsx("option",{value:"false",children:"Inactive"})]})]})]})]}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:x.map(h=>t.jsxs("div",{className:`bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6 border ${h.is_active?"border-gray-200 dark:border-gray-700":"border-gray-300 dark:border-gray-600 opacity-75"}`,children:[t.jsxs("div",{className:"flex items-start justify-between mb-4",children:[t.jsxs("div",{className:"flex items-center space-x-2",children:[y(h.type),t.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium capitalize ${f(h.type)}`,children:h.type})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium capitalize ${k(h.priority)}`,children:h.priority}),s("manage")&&t.jsxs("div",{className:"flex space-x-1",children:[t.jsx("button",{onClick:()=>m(h),className:"p-1 text-gray-600 hover:text-blue-600 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded transition-colors",children:t.jsx(It,{className:"h-3 w-3"})}),t.jsx("button",{onClick:()=>j(h.id,h.is_active),className:`p-1 rounded transition-colors ${h.is_active?"text-green-600 hover:text-green-800":"text-gray-400 hover:text-green-600"}`,children:t.jsx(Eu,{className:"h-3 w-3"})})]})]})]}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:h.title}),t.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-4 line-clamp-3",children:h.content}),t.jsxs("div",{className:"space-y-2 text-xs text-gray-500 dark:text-gray-400",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{children:["Target: ",h.target_audience]}),t.jsxs("span",{children:["Created: ",new Date(h.createdAt).toLocaleDateString()]})]}),h.expiry_date&&t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{children:["Expires: ",new Date(h.expiry_date).toLocaleDateString()]}),t.jsx("span",{className:new Date(h.expiry_date)<new Date?"text-red-500":"text-green-500",children:new Date(h.expiry_date)<new Date?"Expired":"Active"})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{children:["By: ",h.created_by]}),t.jsxs("span",{children:["Read by: ",(h.readBy||h.readBy||[]).length]})]})]}),!(h.readBy||h.readBy||[]).includes((n==null?void 0:n.id)||"")&&t.jsx("button",{onClick:()=>v(h.id),className:"mt-4 w-full px-3 py-2 bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors text-sm",children:"Mark as Read"})]},h.id))}),l&&t.jsx(Zw,{notice:u,onClose:p})]})},tN=({visitor:e,onClose:r})=>{const{renters:a,buildings:s,addVisitor:n,updateVisitor:l}=ae(),[i,u]=b.useState({visitor_name:"",visitor_phone:"",building_id:"",visiting_renter_id:"",visiting_renter_name:"",room_number:"",floor_number:0,check_in_time:new Date().toISOString().slice(0,16),check_out_time:"",purpose:"",approved_by:"",id_verified:!1,vehicle_number:"",notes:""}),[o,c]=b.useState({}),{t:d}=te(),[m,p]=b.useState({}),j=x=>g=>{c(h=>({...h,[x]:g}))};b.useEffect(()=>{e&&u({visitor_name:e.visitor_name,visitor_phone:e.visitor_phone,building_id:e.building_id||"",visiting_renter_id:e.visiting_renter_id,visiting_renter_name:e.visiting_renter_name,room_number:e.room_number,floor_number:e.floor_number,check_in_time:e.check_in_time.slice(0,16),check_out_time:e.check_out_time?e.check_out_time.slice(0,16):"",purpose:e.purpose,approved_by:e.approved_by,id_verified:e.id_verified,vehicle_number:e.vehicle_number||"",notes:e.notes||""})},[e]);const v=()=>{const x={};return i.visitor_name||(x.visitor_name=d("Visitor Name is Required")),i.building_id||(x.building_id=d("Building is Required")),i.check_in_time||(x.check_in_time=d("Check in time is Required")),i.purpose||(x.purpose=d("Purpose is Required")),i.approved_by||(x.approved_by=d("Approved by is Required")),i.visitor_phone||(x.visitor_phone=d("Phone Number is Required")),i.visitor_phone&&!/^\+?[\d\s()-]{7,15}$/.test(i.visitor_phone)&&(x.visitor_phone=d("Invalid Phone Number")),x},y=x=>{x.preventDefault();const g=v();if(p(g),Object.keys(g).length>0)return;const h={...i,check_in_time:new Date(i.check_in_time).toISOString(),check_out_time:i.check_out_time?new Date(i.check_out_time).toISOString():void 0};e?l(e.id,h):n(h),r()},f=x=>{const{name:g,value:h,type:w}=x.target;u(S=>({...S,[g]:w==="checkbox"?x.target.checked:g==="floor_number"?parseInt(h)||0:h}))},k=x=>{const g=x.target.value;if(g){const h=a.find(w=>w.id===g);h&&u(w=>({...w,visiting_renter_id:g,building_id:h.building_id,visiting_renter_name:h.name,room_number:h.room_id,floor_number:h.floor_number}))}else u(h=>({...h,visiting_renter_id:"",building_id:"",visiting_renter_name:"",room_number:"",floor_number:""}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:d(e?"editVisitor":"registerNewVisitor")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:y,className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("visitorName")," *"]}),t.jsx(pe,{type:"text",name:"visitor_name",value:i.visitor_name,onChange:f,onValidationError:j("visitor_name"),fieldName:"Visitor Name",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),m.visitor_name&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.visitor_name})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("visitorPhone")," *"]}),t.jsx("input",{type:"tel",name:"visitor_phone",value:i.visitor_phone,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),m.visitor_phone&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.visitor_phone})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("visitingRenter")}),t.jsxs("select",{name:"visiting_renter_id",value:i.visiting_renter_id,onChange:k,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("selectarenter")}),a.filter(x=>x.status==="active").map(x=>t.jsxs("option",{value:x.id,children:[x.name," - ",d("room")," ",x.room.room_number," (",d("floor")," ",x.room.floor.floor_number,")"]},x.id))]}),m.visiting_renter_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.visiting_renter_id})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("building")," *"]}),t.jsxs("select",{name:"building_id",value:i.building_id,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"",children:d("selectabuilding")}),s.map(x=>t.jsx("option",{value:x.id,children:x.name},x.id))]}),m.building_id&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.building_id})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("checkinTime")," *"]}),t.jsx("input",{type:"datetime-local",name:"check_in_time",value:i.check_in_time,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),m.check_in_time&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.check_in_time})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("checkoutTime")}),t.jsx("input",{type:"datetime-local",name:"check_out_time",value:i.check_out_time,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),m.check_out_time&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.check_out_time})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("purposeofVisit")," *"]}),t.jsx(pe,{type:"text",name:"purpose",value:i.purpose,onChange:f,onValidationError:j("purpose"),fieldName:"Purpose",placeholder:d("purposeofVisitplace"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),m.purpose&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.purpose})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[d("approvedby")," *"]}),t.jsx(pe,{type:"text",name:"approved_by",value:i.approved_by,onChange:f,onValidationError:j("approved_by"),fieldName:"Approved By",placeholder:d("securityguardstaff"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0}),m.approved_by&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.approved_by})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("vehicleNumber")}),t.jsx("input",{type:"text",name:"vehicle_number",value:i.vehicle_number,onChange:f,placeholder:d("vehicleNumberDHA"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),m.vehicle_number&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:m.vehicle_number})]})]}),t.jsx("div",{children:t.jsxs("label",{className:"flex items-center space-x-2",children:[t.jsx("input",{type:"checkbox",name:"id_verified",checked:i.id_verified,onChange:f,className:"rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),t.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:d("iDVerified")})]})}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("notes")}),t.jsx(Tt,{name:"notes",value:i.notes,onChange:f,onValidationError:j("notes"),fieldName:"Notes",rows:3,placeholder:d("anyadditionalnotesvistor"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),o.notes&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:o.notes})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:d("cancel")}),t.jsxs("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[d(e?"update":"register")," ",d("visitor")]})]})]})]})})},rN=({visitor:e,onClose:r})=>{var o,c,d;const{renters:a,buildings:s}=ae(),{t:n}=te();if(!e)return null;const l=s.find(m=>m.id===e.building_id),i=a.find(m=>m.id===e.visiting_renter_id),u=m=>new Date(m).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0});return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:n("visitorDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("visitorName")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.visitor_name||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("visitorPhone")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.visitor_phone||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("visitingRenter")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:(i==null?void 0:i.name)||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("building")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:(l==null?void 0:l.name)||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("room")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:((o=i==null?void 0:i.room)==null?void 0:o.room_number)||e.room_number||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("floor")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:((d=(c=i==null?void 0:i.room)==null?void 0:c.floor)==null?void 0:d.floor_number)||e.floor_number||"-"})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("checkinTime")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:u(e.check_in_time)})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("checkoutTime")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:u(e.check_out_time)})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("purposeofVisit")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.purpose||"-"})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("approvedby")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.approved_by||"-"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("vehicleNumber")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.vehicle_number||"-"})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("iDVerified")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.id_verified?n("yes"):n("no")})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-500 dark:text-gray-400",children:n("notes")}),t.jsx("p",{className:"text-base text-gray-900 dark:text-gray-100",children:e.notes||"-"})]})]})]})})},aN=()=>{const{visitors:e=[],deleteVisitor:r,checkoutVisitor:a}=ae()??{},{hasPermission:s}=ie(),[n,l]=b.useState(!1),[i,u]=b.useState(null),[o,c]=b.useState({status:"",date:"",search:""}),{t:d}=te(),[m,p]=b.useState(!1),[j,v]=b.useState(null),y=T=>{u(T),l(!0)},f=T=>{v(T),p(!0)},k=T=>{a(T)},x=()=>{l(!1),u(null)},g=()=>{p(!1),v(null)},h=T=>T.check_out_time?"checked_out":"checked_in",w=T=>{switch(T){case"checked_in":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"checked_out":return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},S=e.filter(T=>{const _=h(T);if(o.status&&_!==o.status||o.date&&T.check_in_time.split("T")[0]!==o.date)return!1;if(o.search){const H=o.search.toLowerCase();return T.visitor_name.toLowerCase().includes(H)||T.visiting_renter_name.toLowerCase().includes(H)||T.room_number.toLowerCase().includes(H)}return!0}),C={total:e.length,checkedIn:e.filter(T=>!T.check_out_time).length,checkedOut:e.filter(T=>T.check_out_time).length,today:e.filter(T=>T.check_in_time.startsWith(new Date().toISOString().split("T")[0])).length},N=T=>{window.confirm("Are you sure you want to delete this visitor?")&&r(T)},D=T=>new Date(T).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}),[R,F]=b.useState(1),A=3,P=Math.ceil(S.length/A),M=S.slice((R-1)*A,R*A);return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:d("visitorManagement")}),t.jsx("p",{className:"text-[10px] sm:text-sm text-gray-600 dark:text-gray-400 mt-1",children:d("visitorManagementdes")})]}),s("manage")&&t.jsxs("button",{onClick:()=>l(!0),className:`bg-blue-600 hover:bg-blue-700 text-white
px-2 py-1 sm:px-4 sm:py-2 rounded-lg
flex items-center space-x-1 sm:space-x-2
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:d("registerVisitor")})]})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:C.total}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:d("totalVisitors")})]}),t.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 sm:p-4 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-900 dark:text-green-100",children:C.checkedIn}),t.jsx("div",{className:"text-xs sm:text-sm text-green-600 dark:text-green-400",children:d("currentlyInside")})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/20 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-gray-100",children:C.checkedOut}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:d("checkedOut")})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 sm:p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-900 dark:text-blue-100",children:C.today}),t.jsx("div",{className:"text-xs sm:text-sm text-blue-600 dark:text-blue-400",children:d("todayVisitors")})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:d("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("status")}),t.jsxs("select",{value:o.status,onChange:T=>c(_=>({..._,status:T.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allStatus")}),t.jsx("option",{value:"checked_in",children:d("checkedIn")}),t.jsx("option",{value:"checked_out",children:d("checkedOut")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("date")}),t.jsx("input",{type:"date",value:o.date,onChange:T=>c(_=>({..._,date:T.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("search")}),t.jsxs("div",{className:"relative",children:[t.jsx(Aa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx("input",{type:"text",value:o.search,onChange:T=>c(_=>({..._,search:T.target.value})),placeholder:d("searchvisitorsrentersrooms"),className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]})]})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("visitorDetails")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("visiting")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("checkinTime")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("checkoutTime")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("status")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("purpose")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:M.length>0?M.map(T=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/20 rounded-full flex items-center justify-center",children:t.jsx(fl,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:T.visitor_name}),t.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:D(T.createdAt)}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:T.visitor_phone}),T.vehicle_number&&t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[d("vehicle"),": ",T.vehicle_number]}),s("manage")&&t.jsxs("div",{className:"flex space-x-2 pt-2",children:[s("edit")&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>y(T),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(It,{className:"h-3 w-3"})}),!T.check_out_time&&t.jsx("button",{onClick:()=>k(T.id),className:"text-green-600 hover:text-green-900 dark:text-green-400 dark:hover:text-green-300 px-2 py-1 rounded bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/40 transition-colors",children:t.jsx(vt,{className:"h-3 w-3"})})]}),s("delete")&&t.jsx("button",{onClick:()=>N(T.id),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(ye,{className:"h-3 w-3"})}),t.jsx("button",{onClick:()=>f(T),className:"text-indigo-600 hover:text-indigo-900 dark:text-indigo-400 dark:hover:text-indigo-300 px-2 py-1 rounded transition-colors",children:t.jsx(nt,{className:"h-3 w-3"})})]})]})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[t.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:T.visiting_renter_name}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:T.building.name})]}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:D(T.check_in_time)}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:D(T.check_out_time)}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[h(T)==="checked_in"?t.jsx(dt,{className:"h-4 w-4 text-green-600 mr-2"}):t.jsx(vt,{className:"h-4 w-4 text-gray-600 mr-2"}),t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${w(h(T))}`,children:h(T)==="checked_in"?"Inside":"Checked Out"})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:T.purpose})]},T.id)):t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-6 py-24 text-center",children:t.jsxs("div",{className:"flex flex-col items-center justify-center space-y-3",children:[t.jsx(Jt,{className:"h-12 w-12 text-gray-400 dark:text-gray-500"}),t.jsx("div",{className:"text-lg font-medium text-gray-500 dark:text-gray-400",children:"No Data Available"})]})})})})]})})}),P>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>F(T=>Math.max(T-1,1)),disabled:R===1,className:`px-3 py-1 rounded ${R===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let T=Math.max(1,R-1),_=Math.min(P,T+2);_-T<2&&(T=Math.max(1,_-2));const H=[];for(let B=T;B<=_;B++)H.push(t.jsx("button",{onClick:()=>F(B),className:`px-3 py-1 rounded ${R===B?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:B},B));return H})(),t.jsx("button",{onClick:()=>F(T=>Math.min(T+1,P)),disabled:R===P,className:`px-3 py-1 rounded ${R===P?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})}),n&&t.jsx(tN,{visitor:i,onClose:x}),m&&t.jsx(rN,{visitor:j,onClose:g})]})},sN=()=>{const{isDarkMode:e,toggleTheme:r}=$g(),{language:a,setLanguage:s,t:n}=te(),{user:l}=ie(),{updateUser:i}=ie(),{applicationUpdate:u,settings:o}=ae(),c=[{code:"en",name:"English"},{code:"bn",name:"বাংলা"},{code:"ar",name:"العربية"}],[d,m]=b.useState({name:"",email:"",password:""}),[p,j]=b.useState(null),[v,y]=b.useState(null),[f,k]=b.useState({}),x=U=>{j(U)},g=U=>V=>{k(J=>({...J,[U]:V}))};b.useEffect(()=>{l&&m({name:l.name||"",email:l.email||"",password:""})},[l]);const h=U=>{U.preventDefault();const V=new FormData;V.append("name",d.name),V.append("email",d.email),d.password&&V.append("password",d.password),p&&V.append("avatar",p),i(l.id,V)},[w,S]=b.useState({logo:null,favicon:null,loginbg:null,name:""}),[C,N]=b.useState({symbol:"",code:"",country:""}),[D,R]=b.useState({smtpHost:"",smtpPort:"",smtpUsername:"",smtpPassword:"",fromEmail:""}),[F,A]=b.useState(""),P=U=>{const{name:V,value:J}=U.target;V==="name"&&S(X=>({...X,name:J}))},M=U=>V=>{S(J=>({...J,[U.toLowerCase()]:V}))},T=U=>{const V=new FormData;w.name&&V.append("application_name",w.name),w.logo&&V.append("logo",w.logo),w.favicon&&V.append("favicon",w.favicon),w.loginbg&&V.append("loginbg",w.loginbg),F&&V.append("currency",F),C&&V.append("country",JSON.stringify(C)),D&&V.append("smtp",JSON.stringify(D)),u(V)};b.useEffect(()=>{F&&T()},[F]),b.useEffect(()=>{const U=o==null?void 0:o.find(z=>z.name==="application_name"),V=o==null?void 0:o.find(z=>z.name=="currency"),J=o==null?void 0:o.find(z=>z.name=="country"),X=o==null?void 0:o.find(z=>z.name=="smtp");if(V&&A(V.value),J){const z=JSON.parse(J.value);N(z)}if(X){const z=JSON.parse(X.value);R(z)}U&&S(z=>({...z,name:U.value}))},[o]);const _=U=>{const{name:V,value:J}=U.target;m(X=>({...X,[V]:J}))},H=U=>{const{name:V,value:J}=U.target;N(X=>({...X,[V]:J}))},B=U=>{const{name:V,value:J}=U.target;R(X=>({...X,[V]:J}))};return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:n("settings")})}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:[t.jsxs("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[t.jsx(Po,{className:"h-5 w-5 mr-2"}),n("themeSettings")]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:n("darkMode")}),t.jsx("button",{onClick:r,className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${e?"bg-blue-600":"bg-gray-200"}`,children:t.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${e?"translate-x-6":"translate-x-1"}`})})]}),t.jsxs("div",{className:"flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400",children:[e?t.jsx(Po,{className:"h-4 w-4"}):t.jsx(Yg,{className:"h-4 w-4"}),t.jsxs("span",{children:[n("currenttheme"),": ",n(e?"dark":"light")]})]})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:[t.jsxs("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[t.jsx(Hg,{className:"h-5 w-5 mr-2"}),n("languageSettings")]}),t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:n("selectlanguage")}),t.jsx("select",{value:a,onChange:U=>s(U.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:c.map(U=>t.jsx("option",{value:U.code,children:U.name},U.code))})]})})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:[t.jsxs("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[t.jsx(qe,{className:"h-5 w-5 mr-2"}),n("profileSettings")]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex flex-col items-center space-y-4 md:flex-row md:space-x-4 md:space-y-0 md:items-center",children:[t.jsx("div",{className:"w-16 h-16 bg-blue-100 dark:bg-blue-900/20 rounded-full flex items-center justify-center",children:l!=null&&l.avatar?t.jsx("img",{src:l.avatar,alt:"User Avatar",className:"w-16 h-16 rounded-full object-cover"}):t.jsx(qe,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:l==null?void 0:l.name}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l==null?void 0:l.email}),t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 capitalize",children:l==null?void 0:l.role})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("fullName")}),t.jsx(pe,{type:"text",name:"name",value:d.name,onChange:_,onValidationError:g("name"),fieldName:"Full Name",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),f.name&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.name})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("email")}),t.jsx("input",{type:"email",name:"email",value:d.email,onChange:_,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("password")}),t.jsx("input",{type:"password",name:"password",value:d.password,onChange:_,placeholder:"******",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("avatar")}),t.jsx(fa,{onChange:x,onValidationError:g("avatar"),maxSizeMB:5,allowedExtensions:["jpg","jpeg","png","gif"],checkSignature:!0,accept:"image/*",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),f.avatar&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.avatar})]})]}),t.jsx("div",{className:"pt-4 flex justify-end",children:t.jsx("button",{onClick:h,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm px-3 py-1.5 rounded-lg transition",children:n("updateProfile")})})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:[t.jsxs("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[t.jsx(bt,{className:"h-5 w-5 mr-2"}),n("currencySettings")]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("currencySymbol")}),t.jsx("input",{type:"text",name:"symbol",value:C.symbol,onChange:H,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("countryCode")}),t.jsx("input",{type:"text",name:"code",value:C.code,onChange:H,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("countryName")}),t.jsx("input",{type:"text",name:"country",value:C.country,onChange:H,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsx("div",{className:"pt-4 flex justify-end",children:t.jsx("button",{onClick:T,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm px-3 py-1.5 rounded-lg transition",children:n("update")})})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:[t.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[t.jsx(bt,{className:"h-5 w-5 mr-2"}),n("applicationSettings")]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("applicationName")}),t.jsx(pe,{type:"text",name:"name",value:w.name,onChange:P,onValidationError:g("appName"),fieldName:"Application Name",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),f.appName&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.appName})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("logo")}),t.jsx(fa,{onChange:M("logo"),onValidationError:g("logo"),maxSizeMB:5,allowedExtensions:["jpg","jpeg","png","svg"],checkSignature:!0,accept:"image/*",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),f.logo&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.logo})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("favicon")}),t.jsx(fa,{onChange:M("favicon"),onValidationError:g("favicon"),maxSizeMB:1,allowedExtensions:["ico","png"],checkSignature:!0,accept:".ico,.png",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),f.favicon&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.favicon})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("loginbackground")}),t.jsx(fa,{onChange:M("loginbg"),onValidationError:g("loginbg"),maxSizeMB:5,allowedExtensions:["jpg","jpeg","png"],checkSignature:!0,accept:"image/*",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"}),f.loginbg&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:f.loginbg})]})]}),t.jsx("div",{className:"pt-4 flex justify-end",children:t.jsx("button",{onClick:T,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm px-3 py-1.5 rounded-lg transition",children:n("update")})})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:[t.jsxs("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[t.jsx(ql,{className:"h-5 w-5 mr-2"}),n("smtp")]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("smtpHost")}),t.jsx("input",{type:"text",name:"smtpHost",value:D.smtpHost,onChange:B,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("smtpPort")}),t.jsx("input",{type:"text",name:"smtpPort",value:D.smtpPort,onChange:B,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("smtpUsername")}),t.jsx("input",{type:"text",name:"smtpUsername",value:D.smtpUsername,onChange:B,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("smtpPassword")}),t.jsx("input",{type:"password",name:"smtpPassword",value:D.smtpPassword,onChange:B,placeholder:"******",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:n("fromEmail")}),t.jsx("input",{type:"text",name:"fromEmail",value:D.fromEmail,onChange:B,placeholder:"",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]}),t.jsx("div",{className:"pt-4 flex justify-end",children:t.jsx("button",{onClick:T,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm px-3 py-1.5 rounded-lg transition",children:n("update")})})]})]})]})]})},nN=({category:e,onClose:r})=>{const{t:a}=te(),{addCategory:s,updateCategory:n}=ae(),[l,i]=b.useState({name:"",status:"active"}),[u,o]=b.useState({}),c=p=>j=>{o(v=>({...v,[p]:j}))};b.useEffect(()=>{e&&i({name:e.name,status:e.status})},[e]);const d=p=>{const{name:j,value:v}=p.target;i(y=>({...y,[j]:v}))},m=p=>{p.preventDefault(),e?n(e.id,l):s(l),r()};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:e?"Edit Category":"Add Category"}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:m,className:"p-6 space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Name"}),t.jsx(pe,{type:"text",name:"name",value:l.name,onChange:d,onValidationError:c("name"),fieldName:"Category Name",required:!0,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-700 dark:text-white"}),u.name&&t.jsx("p",{className:"text-red-500 text-sm mt-1",children:u.name})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:"Status"}),t.jsxs("select",{name:"status",value:l.status,onChange:d,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"active",children:"Active"}),t.jsx("option",{value:"inactive",children:"Inactive"})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg",children:a("cancel")}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg",children:a("save")})]})]})]})})},lN=()=>{const[e,r]=b.useState("home"),[a,s]=b.useState(!1),{applicationUpdate:n,settings:l,category:i,deleteCategory:u}=ae(),[o,c]=b.useState("frontend"),[d,m]=b.useState(null),p=E=>{m(E),s(!0)},j={number:"",text:""},v={text:"",description:""},y={text:""},[f,k]=b.useState({block1:{title:"",description:"",image:null,facilities:[j]},block2:{title:"",description:"",facilities:[v]},block3:{title:"",description:""},block4:{title:"",description:"",subtitle:"",subtitleDescription:"",facilities:[y]}}),[x,g]=b.useState({block1:{title:"",description:""},block2:{title:"",description:""}}),[h,w]=b.useState({block1:{title:"",description:""},block2:{title:"",description:"",subtitle:"",subtitleDescription:""},block3:{title:"",description:"",facilities:[v]},block4:{title:"",description:"",facilities:[j]},block5:{title:"",description:""},block6:{title:"",description:""}}),[S,C]=b.useState({block1:{title:"",description:""},block2:{title:"",description:"",facilities:[v]},block3:{title:"",description:"",facilities:[v]},block4:{title:"",description:"",facilities:[v]},block5:{title:"",description:""}}),[N,D]=b.useState({block1:{title:"",description:""},block2:{title:"",description:""},block3:{title:"",description:""}}),R=(E,$,Q)=>{k(re=>({...re,[E]:{...re[E],[$]:Q}}))},F=(E,$,Q)=>{g(re=>({...re,[E]:{...re[E],[$]:Q}}))},A=(E,$,Q)=>{w(re=>({...re,[E]:{...re[E],[$]:Q}}))},P=E=>{const $=E.target.files[0];k(Q=>({...Q,block1:{...Q.block1,image:$}}))},M=(E,$,Q,re)=>{k(de=>{const G=[...de[E].facilities||[]];return G[$]={...G[$],[Q]:re},{...de,[E]:{...de[E],facilities:G}}})},T=E=>{k($=>{const Q=$[E].facilities||[],re={block1:4,block2:3,block5:3,block4:9999};if(Q.length>=(re[E]||9999))return $;let de;return E==="block1"?de=j:E==="block4"?de=y:de=v,{...$,[E]:{...$[E],facilities:[...Q,de]}}})},_=E=>{var Q;const $=new FormData;if(E=="home"){const re={...f};((Q=re.block1)==null?void 0:Q.image)instanceof File&&($.append("homeBannerimage",re.block1.image),re.block1.image=""),$.append("homeTemple",JSON.stringify(re))}else E=="buildings"?$.append("buildingsTemple",JSON.stringify(x)):E=="about"?$.append("aboutTemple",JSON.stringify(h)):E=="renter"?$.append("renterTemple",JSON.stringify(S)):E=="blog"&&$.append("blogTemple",JSON.stringify(N));n($)},H=(E,$,Q)=>{C(re=>({...re,[E]:{...re[E],[$]:Q}}))},B=(E,$,Q,re)=>{C(de=>{const G=[...de[E].facilities||[]];return G[$]={...G[$],[Q]:re},{...de,[E]:{...de[E],facilities:G}}})},U=E=>{C($=>{const Q=$[E].facilities||[];return{...$,[E]:{...$[E],facilities:[...Q,{text:"",description:""}]}}})},V=(E,$,Q,re)=>{w(de=>{const G=[...de[E].facilities||[]];return G[$]={...G[$],[Q]:re},{...de,[E]:{...de[E],facilities:G}}})},J=E=>{w($=>{const Q=$[E].facilities||[];return Q.length>=4?$:{...$,[E]:{...$[E],facilities:[...Q,{text:"",description:""}]}}})},X=(E,$,Q)=>{D(re=>({...re,[E]:{...re[E],[$]:Q}}))};b.useEffect(()=>{const E=l==null?void 0:l.find(G=>G.name==="homeTemple"),$=l==null?void 0:l.find(G=>G.name==="buildingsTemple"),Q=l==null?void 0:l.find(G=>G.name==="aboutTemple"),re=l==null?void 0:l.find(G=>G.name==="renterTemple"),de=l==null?void 0:l.find(G=>G.name==="blogTemple");if(E&&E.value)try{k(JSON.parse(E.value))}catch(G){console.error("Failed to parse homeTemple JSON:",G)}if($&&$.value)try{g(JSON.parse($.value))}catch(G){console.error("Failed to parse buildingsTemple JSON:",G)}if(Q&&Q.value)try{w(JSON.parse(Q.value))}catch(G){console.error("Failed to parse aboutTemple JSON:",G)}if(re&&re.value)try{C(JSON.parse(re.value))}catch(G){console.error("Failed to parse renterTemple JSON:",G)}if(de&&de.value)try{D(JSON.parse(de.value))}catch(G){console.error("Failed to parse blogTemple JSON:",G)}},[l]);const z=E=>{window.confirm("Are you sure you want to delete this Category?")&&u(E)};return t.jsxs("div",{className:"min-h-screen bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-white",children:[t.jsx("header",{className:"bg-white dark:bg-gray-800 shadow-md",children:t.jsx("nav",{className:"max-w-5xl mx-auto px-4 py-4 flex space-x-8",children:["home","buildings","about","renter","blog"].map(E=>t.jsx("button",{onClick:()=>r(E),className:`capitalize px-3 py-2 rounded-md font-semibold focus:outline-none ${e===E?"bg-blue-600 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:E},E))})}),t.jsxs("main",{className:"max-w-5xl mx-auto px-4 py-8",children:[e==="home"&&t.jsxs("section",{children:[t.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Home - Dynamic Form"}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 1"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:f.block1.title,onChange:E=>R("block1","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:f.block1.description,onChange:E=>R("block1","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Image"}),t.jsx("input",{type:"file",accept:"image/*",onChange:P,className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold mb-2",children:"Facilities (Number & Text) - max 4"}),f.block1.facilities.map((E,$)=>t.jsxs("div",{className:"flex space-x-2 mb-2",children:[t.jsx("input",{type:"text",placeholder:"Number",value:E.number,onChange:Q=>M("block1",$,"number",Q.target.value),className:"w-20 p-2 border rounded dark:bg-gray-700 dark:border-gray-600"}),t.jsx("input",{type:"text",placeholder:"Text",value:E.text,onChange:Q=>M("block1",$,"text",Q.target.value),className:"flex-grow p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]},$)),f.block1.facilities.length<4&&t.jsx("button",{type:"button",onClick:()=>T("block1"),className:"mt-2 px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Add Facility"})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 2"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:f.block2.title,onChange:E=>R("block2","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:f.block2.description,onChange:E=>R("block2","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold mb-2",children:"Facilities (Text & Description) - max 3"}),f.block2.facilities.map((E,$)=>t.jsxs("div",{className:"space-y-1 mb-3",children:[t.jsx("input",{type:"text",placeholder:"Facility Title",value:E.text,onChange:Q=>M("block2",$,"text",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600 mb-1"}),t.jsx("textarea",{placeholder:"Facility Description",value:E.description,onChange:Q=>M("block2",$,"description",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:2})]},$)),f.block2.facilities.length<3&&t.jsx("button",{type:"button",onClick:()=>T("block2"),className:"mt-2 px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Add Facility"})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 3"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:f.block3.title,onChange:E=>R("block3","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:f.block3.description,onChange:E=>R("block3","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 4"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:f.block4.title,onChange:E=>R("block4","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:f.block4.description,onChange:E=>R("block4","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Subtitle"}),t.jsx("input",{type:"text",value:f.block4.subtitle||"",onChange:E=>R("block4","subtitle",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Subtitle Description"}),t.jsx("textarea",{value:f.block4.subtitleDescription||"",onChange:E=>R("block4","subtitleDescription",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold mb-2",children:"Facilities (Text only)"}),f.block4.facilities.map((E,$)=>t.jsx("input",{type:"text",placeholder:"Facility Text",value:E.text,onChange:Q=>M("block4",$,"text",Q.target.value),className:"w-full p-2 mb-2 border rounded dark:bg-gray-700 dark:border-gray-600"},$)),t.jsx("button",{type:"button",onClick:()=>T("block4"),className:"mt-2 px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Add Facility"})]})]}),t.jsx("div",{className:"flex justify-end",children:t.jsx("button",{type:"button",onClick:()=>_(e),className:"btn btn-sm bg-blue-600 hover:bg-blue-700 text-white rounded px-4 py-2",children:"Submit"})})]}),e==="buildings"&&t.jsxs("section",{children:[t.jsx("h1",{className:"text-3xl font-bold mb-4",children:"Buildings - Dynamic Form"}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 1"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:x.block1.title,onChange:E=>F("block1","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:x.block1.description,onChange:E=>F("block1","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 2"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:x.block2.title,onChange:E=>F("block2","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:x.block2.description,onChange:E=>F("block2","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsx("div",{className:"flex justify-end",children:t.jsx("button",{type:"button",onClick:()=>_(e),className:"btn btn-sm bg-blue-600 hover:bg-blue-700 text-white rounded px-4 py-2",children:"Submit"})})]}),e==="about"&&t.jsxs("section",{children:[t.jsx("h1",{className:"text-3xl font-bold mb-4",children:"About - Dynamic Form"}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 1"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:h.block1.title,onChange:E=>A("block1","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:h.block1.description,onChange:E=>A("block1","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 2"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:h.block2.title,onChange:E=>A("block2","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:h.block2.description,onChange:E=>A("block2","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Subtitle"}),t.jsx("input",{type:"text",value:h.block2.subtitle||"",onChange:E=>A("block2","subtitle",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Subtitle Description"}),t.jsx("textarea",{value:h.block2.subtitleDescription||"",onChange:E=>A("block2","subtitleDescription",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 3"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:h.block3.title,onChange:E=>A("block3","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:h.block3.description,onChange:E=>A("block3","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold mb-2",children:"Facilities (Text & Description) - max 3"}),h.block3.facilities.map((E,$)=>t.jsxs("div",{className:"space-y-1 mb-3",children:[t.jsx("input",{type:"text",placeholder:"Facility Title",value:E.text,onChange:Q=>V("block3",$,"text",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600 mb-1"}),t.jsx("textarea",{placeholder:"Facility Description",value:E.description,onChange:Q=>V("block3",$,"description",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:2})]},$)),h.block3.facilities.length<3&&t.jsx("button",{type:"button",onClick:()=>J("block3"),className:"mt-2 px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Add Facility"})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 4"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:h.block4.title,onChange:E=>A("block4","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:h.block4.description,onChange:E=>A("block4","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold mb-2",children:"Facilities (Number & Text) - max 4"}),h.block4.facilities.map((E,$)=>t.jsxs("div",{className:"flex space-x-2 mb-2",children:[t.jsx("input",{type:"text",placeholder:"Number",value:E.number,onChange:Q=>V("block4",$,"number",Q.target.value),className:"w-20 p-2 border rounded dark:bg-gray-700 dark:border-gray-600"}),t.jsx("input",{type:"text",placeholder:"Text",value:E.text,onChange:Q=>V("block4",$,"text",Q.target.value),className:"flex-grow p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]},$)),h.block4.facilities.length<4&&t.jsx("button",{type:"button",onClick:()=>J("block4"),className:"mt-2 px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Add Facility"})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 5"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:h.block5.title,onChange:E=>A("block5","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:h.block5.description,onChange:E=>A("block5","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 6"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:h.block6.title,onChange:E=>A("block6","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:h.block6.description,onChange:E=>A("block6","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsx("div",{className:"flex justify-end",children:t.jsx("button",{type:"button",onClick:()=>_(e),className:"btn btn-sm bg-blue-600 hover:bg-blue-700 text-white rounded px-4 py-2",children:"Submit"})})]}),e==="renter"&&t.jsxs("section",{children:[t.jsx("h1",{className:"text-3xl font-bold mb-6",children:"Renter - Dynamic Form"}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 1"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:S.block1.title,onChange:E=>H("block1","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:S.block1.description,onChange:E=>H("block1","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 2"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:S.block2.title,onChange:E=>H("block2","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:S.block2.description,onChange:E=>H("block2","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold mb-2",children:"Facilities (Text & Description) - max 4"}),S.block2.facilities.map((E,$)=>t.jsxs("div",{className:"space-y-1 mb-3",children:[t.jsx("input",{type:"text",placeholder:"Facility Title",value:E.text,onChange:Q=>B("block2",$,"text",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600 mb-1"}),t.jsx("textarea",{placeholder:"Facility Description",value:E.description,onChange:Q=>B("block2",$,"description",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:2})]},$)),S.block2.facilities.length<4&&t.jsx("button",{type:"button",onClick:()=>U("block2"),className:"mt-2 px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Add Facility"})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 3"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:S.block3.title,onChange:E=>H("block3","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:S.block3.description,onChange:E=>H("block3","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),S.block3.facilities&&t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold mb-2",children:"Facilities (Text & Description) - max 4"}),S.block3.facilities.map((E,$)=>t.jsxs("div",{className:"space-y-1 mb-3",children:[t.jsx("input",{type:"text",placeholder:"Facility Title",value:E.text,onChange:Q=>B("block3",$,"text",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600 mb-1"}),t.jsx("textarea",{placeholder:"Facility Description",value:E.description,onChange:Q=>B("block3",$,"description",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:2})]},$)),S.block3.facilities.length<4&&t.jsx("button",{type:"button",onClick:()=>U("block3"),className:"mt-2 px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Add Facility"})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 4"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:S.block4.title,onChange:E=>H("block4","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:S.block4.description,onChange:E=>H("block4","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]}),S.block4.facilities&&t.jsxs("div",{children:[t.jsx("h3",{className:"font-semibold mb-2",children:"Facilities (Text & Description)"}),S.block4.facilities.map((E,$)=>t.jsxs("div",{className:"space-y-1 mb-3",children:[t.jsx("input",{type:"text",placeholder:"Facility Title",value:E.text,onChange:Q=>B("block4",$,"text",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600 mb-1"}),t.jsx("textarea",{placeholder:"Facility Description",value:E.description,onChange:Q=>B("block4",$,"description",Q.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:2})]},$)),t.jsx("button",{type:"button",onClick:()=>U("block4"),className:"mt-2 px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700",children:"+ Add Facility"})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 5"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:S.block5.title,onChange:E=>H("block5","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:S.block5.description,onChange:E=>H("block5","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsx("div",{className:"flex justify-end",children:t.jsx("button",{type:"button",onClick:()=>_(e),className:"btn btn-sm bg-blue-600 hover:bg-blue-700 text-white rounded px-4 py-2",children:"Submit"})})]}),e==="blog"&&t.jsxs("section",{children:[t.jsx("h1",{className:"text-3xl font-bold mb-4",children:"Blog Management"}),t.jsx("div",{className:"flex space-x-4 border-b mb-6",children:["list","category","frontend"].map(E=>t.jsxs("button",{onClick:()=>c(E),className:`py-2 px-4 font-medium ${o===E?"border-b-2 border-blue-600 text-blue-600":"text-gray-600 hover:text-blue-600"}`,children:[E==="list"&&"Blog List",E==="category"&&"Category",E==="frontend"&&"Frontend"]},E))}),o==="frontend"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 1"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:N.block1.title,onChange:E=>X("block1","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:N.block1.description,onChange:E=>X("block1","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 2"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:N.block2.title,onChange:E=>X("block2","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:N.block2.description,onChange:E=>X("block2","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsxs("div",{className:"mb-8 p-4 bg-white dark:bg-gray-800 rounded-lg shadow",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Block 3"}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Title"}),t.jsx("input",{type:"text",value:N.block3.title,onChange:E=>X("block3","title",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600"})]}),t.jsxs("div",{className:"mb-4",children:[t.jsx("label",{className:"block font-medium mb-1",children:"Description"}),t.jsx("textarea",{value:N.block3.description,onChange:E=>X("block3","description",E.target.value),className:"w-full p-2 border rounded dark:bg-gray-700 dark:border-gray-600",rows:3})]})]}),t.jsx("div",{className:"flex justify-end",children:t.jsx("button",{type:"button",onClick:()=>_(e),className:"btn btn-sm bg-blue-600 hover:bg-blue-700 text-white rounded px-4 py-2",children:"Submit"})})]}),o==="list"&&t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Blog List"}),t.jsx("p",{children:"Show your blog list here..."})]}),o==="category"&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-4",children:[t.jsx("h2",{className:"text-2xl font-bold mb-4",children:"Blog Categories"}),t.jsx("button",{className:"btn btn-sm bg-green-600 hover:bg-green-700 text-white px-3 py-1 rounded",onClick:()=>s(!0),children:"+ Create"})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Name"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Status"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Created At"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Actions"})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:i.map(E=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white",children:E.name}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900 dark:text-white",children:t.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-semibold ${E.status==="active"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"}`,children:E.status})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-700 dark:text-gray-300",children:new Date(E.createdAt).toLocaleDateString()}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:t.jsxs("div",{className:"flex space-x-2",children:[t.jsx("button",{onClick:()=>p(E),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300 px-2 py-1 rounded bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors",children:"Edit"}),t.jsx("button",{onClick:()=>z(E.id),className:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300 px-2 py-1 rounded bg-red-50 dark:bg-red-900/20 hover:bg-red-100 dark:hover:bg-red-900/40 transition-colors",children:"Delete"})]})})]},E.id))})]})})}),a&&t.jsx(nN,{category:d,onClose:()=>{s(!1),m(null)}})]})]})]})]})},iN=()=>{const{t:e}=te(),{user:r,hasPermission:a}=ie(),{updateUser:s}=ie(),[n,l]=b.useState({name:"",email:"",password:""}),[i,u]=b.useState({oldPassword:"",newPassword:"",confirmPassword:""}),[o,c]=b.useState(null),d=y=>{const f=y.target.files[0];f&&c(f)};b.useEffect(()=>{r&&l({name:r.name||"",email:r.email||"",password:""})},[r]);const m=y=>{y.preventDefault();const f=new FormData;f.append("name",n.name),f.append("email",n.email),n.password&&f.append("password",n.password),o&&f.append("avatar",o),s(r.id,f)},p=y=>{const{name:f,value:k,files:x}=y.target;x&&x[0]&&setFiles(g=>({...g,[f.toLowerCase()]:x[0]})),l(g=>({...g,[f]:k}))},j=y=>{const{name:f,value:k}=y.target;u(x=>({...x,[f]:k}))};if(!a("renter"))return t.jsxs("div",{className:"text-center py-12",children:[t.jsx(ea,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"You don't have permission to this page."})]});const v=y=>{if(y.preventDefault(),i.newPassword===i.oldPassword){q.error("You cannot use the old password");return}if(i.newPassword!==i.confirmPassword){q.error("Passwords do not match");return}const f=new FormData;i.confirmPassword&&f.append("password",i.confirmPassword),s(r.id,f),u({oldPassword:"",newPassword:"",confirmPassword:""})};return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:e("settings")})}),t.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:[t.jsxs("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[t.jsx(qe,{className:"h-5 w-5 mr-2"}),e("profileSettings")]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex flex-col items-center space-y-4 md:flex-row md:space-x-4 md:space-y-0 md:items-center",children:[t.jsx("div",{className:"w-16 h-16 bg-blue-100 dark:bg-blue-900/20 rounded-full flex items-center justify-center",children:r!=null&&r.avatar?t.jsx("img",{src:r.avatar,alt:"User Avatar",className:"w-16 h-16 rounded-full object-cover"}):t.jsx(qe,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:r==null?void 0:r.name}),t.jsx("p",{className:"text-sm text-sm text-gray-500 dark:text-gray-400",children:r==null?void 0:r.email})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("fullName")}),t.jsx("input",{type:"text",name:"name",value:n.name,onChange:p,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("email")}),t.jsx("input",{type:"email",name:"email",value:n.email,onChange:p,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("avatar")}),t.jsx("input",{type:"file",name:"avatar",onChange:d,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]}),t.jsx("div",{className:"pt-4 flex justify-end",children:t.jsx("button",{onClick:m,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm px-3 py-1.5 rounded-lg transition",children:e("updateProfile")})})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:[t.jsxs("h3",{className:"text-md sm:text-lg font-semibold text-gray-900 dark:text-white mb-4 flex items-center",children:[t.jsx(Hk,{className:"h-5 w-5 mr-2"}),e("changePassword")]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("oldPassword")}),t.jsx("input",{type:"password",name:"oldPassword",value:i.oldPassword,onChange:j,placeholder:"******",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("newPassword")}),t.jsx("input",{type:"password",name:"newPassword",value:i.newPassword,onChange:j,placeholder:"******",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("confirmPassword")}),t.jsx("input",{type:"password",name:"confirmPassword",value:i.confirmPassword,onChange:j,placeholder:"******",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsx("div",{className:"pt-4 flex justify-end",children:t.jsx("button",{onClick:v,className:"bg-blue-600 hover:bg-blue-700 text-white text-sm px-3 py-1.5 rounded-lg transition",children:e("update")})})]})]})]})]})},gx=({payment:e,onClose:r})=>{const{t:a}=te(),s=ge();return e?t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:a("paymentDetails")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("div",{className:"p-6 space-y-4",children:[t.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-lg",children:t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900/20 rounded-full flex items-center justify-center",children:t.jsx(qe,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:e.renterName}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[a("room")," ",e.renter.room.room_number]})]})]})}),t.jsxs("div",{className:"space-y-2 text-sm text-gray-700 dark:text-gray-300",children:[t.jsxs("p",{children:[t.jsxs("strong",{children:[a("amount"),":"]})," ",s," ",e.amount]}),t.jsxs("p",{children:[t.jsxs("strong",{children:[a("date"),":"]})," ",new Date(e.due_date).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})]}),t.jsxs("p",{children:[t.jsxs("strong",{children:[a("month"),":"]})," ",e.month]}),t.jsxs("p",{children:[t.jsxs("strong",{children:[a("year"),":"]})," ",e.year]}),t.jsxs("p",{children:[t.jsxs("strong",{children:[a("status"),":"]})," ",e.status]}),e.status==="paid"&&t.jsxs(t.Fragment,{children:[t.jsxs("p",{children:[t.jsxs("strong",{children:[a("payment_method"),":"]})," ",e.payment_method]}),t.jsxs("p",{children:[t.jsxs("strong",{children:[a("transactionId"),":"]})," ",e.transaction_id||"N/A"]})]})]}),t.jsx("div",{className:"flex justify-end pt-4",children:t.jsx("button",{onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:a("close")})})]})]})}):null},oN=()=>{const{rentPayments:e=[]}=ae()??{},{user:r,hasPermission:a}=ie(),{t:s}=te(),[n,l]=b.useState(!1),[i,u]=b.useState(null),o=e.filter(x=>x.user_id===(r==null?void 0:r.id)),c=ge(),d=x=>{u(x),l(!0)},m=x=>{switch(x){case"paid":return t.jsx(vt,{className:"h-5 w-5 text-green-600"});case"pending":return t.jsx(dt,{className:"h-5 w-5 text-yellow-600"});case"overdue":return t.jsx(Er,{className:"h-5 w-5 text-red-600"});default:return t.jsx(dt,{className:"h-5 w-5 text-gray-600"})}},p=x=>{switch(x){case"paid":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"pending":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";case"overdue":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},[j,v]=b.useState(1),y=3,f=Math.ceil(o.length/y),k=o.slice((j-1)*y,j*y);return a("renter")?t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:s("rent")})}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 gap-4",children:[t.jsx("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 sm:p-6 rounded-xl border border-green-200 dark:border-green-800",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-green-600 dark:text-green-400",children:s("paidPayment")}),t.jsx("p",{className:"text-xl sm:text-2xl font-bold text-green-900 dark:text-green-100",children:o.filter(x=>x.status==="paid").length})]}),t.jsx(vt,{className:"h-8 w-8 text-green-600 hidden sm:inline"})]})}),t.jsx("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 sm:p-6 rounded-xl border border-yellow-200 dark:border-yellow-800",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-yellow-600 dark:text-yellow-400",children:s("pendingPayment")}),t.jsx("p",{className:"text-xl sm:text-2xl font-bold text-yellow-900 dark:text-yellow-100",children:o.filter(x=>x.status==="pending").length})]}),t.jsx(dt,{className:"h-8 w-8 text-yellow-600 hidden sm:inline"})]})}),t.jsx("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 sm:p-6 rounded-xl border border-red-200 dark:border-red-800",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs sm:text-sm font-medium text-red-600 dark:text-red-400",children:s("overduePayment")}),t.jsx("p",{className:"text-xl sm:text-2xl font-bold text-red-900 dark:text-red-100",children:o.filter(x=>x.status==="overdue").length})]}),t.jsx(Er,{className:"h-8 w-8 text-red-600 hidden sm:inline"})]})})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("amount")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("date")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("status")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:s("period")}),a("renter")&&t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Actions"})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:k.map(x=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[c," ",x.amount.toLocaleString()]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[t.jsx(ut,{className:"h-4 w-4 mr-1 text-gray-400"}),new Date(x.due_date).toLocaleDateString()]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[m(x.status),t.jsx("span",{className:`ml-2 px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${p(x.status)}`,children:x.status})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[x.month," ",x.year]}),a("renter")&&t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:t.jsx("div",{className:"flex space-x-2",children:t.jsx("button",{onClick:()=>d(x),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300 px-2 py-1 rounded bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors",children:"View Details"})})})]},x.id))})]})})}),f>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>v(x=>Math.max(x-1,1)),disabled:j===1,className:`px-3 py-1 rounded ${j===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let x=Math.max(1,j-1),g=Math.min(f,x+2);g-x<2&&(x=Math.max(1,g-2));const h=[];for(let w=x;w<=g;w++)h.push(t.jsx("button",{onClick:()=>v(w),className:`px-3 py-1 rounded ${j===w?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:w},w));return h})(),t.jsx("button",{onClick:()=>v(x=>Math.min(x+1,f)),disabled:j===f,className:`px-3 py-1 rounded ${j===f?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})}),n&&t.jsx(gx,{payment:i,onClose:()=>{l(!1),u(null)}})]}):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(ea,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"You don't have permission to this page."})]})},dN=()=>{const{rentPayments:e=[],maintenance:r}=ae()??{},{user:a,hasPermission:s}=ie(),{t:n}=te(),[l,i]=b.useState(!1),[u,o]=b.useState(null),c=e.filter(f=>f.user_id===(a==null?void 0:a.id)&&f.status=="paid"),d=r.filter(f=>f.user_id===(a==null?void 0:a.id)),m=ge(),p=f=>{o(f),i(!0)},j=f=>{switch(f){case"paid":return t.jsx(vt,{className:"h-5 w-5 text-green-600"});case"pending":return t.jsx(dt,{className:"h-5 w-5 text-yellow-600"});case"overdue":return t.jsx(Er,{className:"h-5 w-5 text-red-600"});default:return t.jsx(dt,{className:"h-5 w-5 text-gray-600"})}},v=f=>{switch(f){case"paid":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"pending":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";case"overdue":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}};if(!s("renter"))return t.jsxs("div",{className:"text-center py-12",children:[t.jsx(ea,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"You don't have permission to this page."})]});const y=f=>new Date(f).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit"});return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex flex-col space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:n("dashboard")})}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-md rounded-xl p-6 hover:shadow-lg transition-shadow duration-300",children:[t.jsxs("p",{className:"text-lg text-gray-700 dark:text-gray-200",children:["Hi! ",t.jsx("span",{className:"font-semibold",children:a.name})]}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:[n("joinedAt"),": ",t.jsx("span",{className:"font-medium",children:y(a.createdAt)})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-md rounded-xl p-6 hover:shadow-lg transition-shadow duration-300 text-center",children:[t.jsx("p",{className:"text-lg text-gray-700 dark:text-gray-200",children:n("totalPayments")}),t.jsxs("p",{className:"mt-2 text-2xl font-bold text-blue-600 dark:text-blue-400",children:[m,c.reduce((f,k)=>f+Number(k.amount),0).toFixed(2)]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-md rounded-xl p-6 hover:shadow-lg transition-shadow duration-300 text-center",children:[t.jsx("p",{className:"text-lg text-gray-700 dark:text-gray-200",children:n("totalMaintenance")}),t.jsx("p",{className:"mt-2 text-2xl font-bold text-green-600 dark:text-green-400",children:d.length})]})]})]}),t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-gray-200 mt-5",children:n("Recent Payments")})}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Amount"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Due Date"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Status"}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Period"}),s("renter")&&t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:"Actions"})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:c.slice(0,10).map(f=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[m," ",f.amount.toLocaleString()]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center text-sm text-gray-900 dark:text-white",children:[t.jsx(ut,{className:"h-4 w-4 mr-1 text-gray-400"}),new Date(f.due_date).toLocaleDateString()]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[j(f.status),t.jsx("span",{className:`ml-2 px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${v(f.status)}`,children:f.status})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[f.month," ",f.year]}),s("renter")&&t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:t.jsx("div",{className:"flex space-x-2",children:t.jsx("button",{onClick:()=>p(f),className:"text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300 px-2 py-1 rounded bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors",children:"View Details"})})})]},f.id))})]})})}),l&&t.jsx(gx,{payment:u,onClose:()=>{i(!1),o(null)}})]})},cN=({maintenance:e,onClose:r})=>{const{buildings:a,renters:s,rooms:n,addMaintenance:l,updateMaintenance:i}=ae(),{user:u}=ie(),[o,c]=b.useState({user_id:u.id,scheduled_date:new Date().toISOString().split("T")[0],building_id:"",room_id:null,bed_id:null,type:"repair",description:"",priority:"medium",notes:""}),{t:d}=te(),[m,p]=b.useState([]),[j,v]=b.useState([]);b.useEffect(()=>{e&&c({building_id:e.building_id,room_id:e.room_id||null,bed_id:e.bed_id||null,type:e.type,description:e.description,priority:e.priority,status:e.status,notes:e.notes||"",user_id:e.user_id||null,scheduled_date:e.scheduled_date})},[e]),b.useEffect(()=>{if(u&&s.length&&a.length&&n.length){const x=s.find(g=>g.user_id===u.id);if(x&&x.room&&x.room.floor){const g=x.room.floor.building_id,h=x.room.id,w=a.filter(C=>C.id===g),S=n.filter(C=>C.id===h);v(w),p(S),e||c(C=>({...C,building_id:g,room_id:h}))}else v([]),p([])}},[u,s,a,n,e]);const y=x=>{x.preventDefault(),e?i(e.id,o):l(o),r()},f=x=>{const{name:g,value:h}=x.target;c(w=>({...w,[g]:g==="cost"?parseInt(h)||0:h}))},k=x=>{const g=x.target.value;c(h=>({...h,building_id:g,room_id:null,bed_id:null}))};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:d(e?"editMaintenanceRequest":"addMaintenanceRequest")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:y,className:"p-6 space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("building")}),t.jsx("select",{name:"building_id",value:o.building_id,onChange:k,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,disabled:!0,children:j.map(x=>t.jsx("option",{value:x.id,children:x.name},x.id))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("room")}),t.jsx("select",{name:"room_id",value:o.room_id,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,disabled:!0,children:m.map(x=>t.jsxs("option",{value:x.id,children:[d("room")," ",x.room_number," (",d("floor")," ",x.floor.floor_number,")"]},x.id))})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("type")}),t.jsxs("select",{name:"type",value:o.type,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"cleaning",children:d("cleaning")}),t.jsx("option",{value:"repair",children:d("repair")}),t.jsx("option",{value:"inspection",children:d("inspection")}),t.jsx("option",{value:"upgrade",children:d("upgrade")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("priority")}),t.jsxs("select",{name:"priority",value:o.priority,onChange:f,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0,children:[t.jsx("option",{value:"low",children:d("low")}),t.jsx("option",{value:"medium",children:d("medium")}),t.jsx("option",{value:"high",children:d("high")}),t.jsx("option",{value:"urgent",children:d("urgent")})]})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("description")}),t.jsx("textarea",{name:"description",value:o.description,onChange:f,rows:3,placeholder:d("describethemaintenanceissuetask"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",required:!0})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("notes")}),t.jsx("textarea",{name:"notes",value:o.notes,onChange:f,rows:2,placeholder:d("additionalnotescomments"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:d("cancel")}),t.jsxs("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:[d(e?"update":"create")," ",d("request")]})]})]})]})})},uN=()=>{const{maintenance:e=[],updateMaintenance:r=()=>{}}=ae()??{},{user:a,hasPermission:s}=ie(),[n,l]=b.useState(!1),[i,u]=b.useState(null),[o,c]=b.useState({status:"",priority:"",type:""}),{t:d}=te(),m=e.filter(N=>N.user_id===(a==null?void 0:a.id)),p=()=>{l(!1),u(null)},j=(N,D)=>{r(N,{status:D,completed_date:D==="completed"?new Date().toISOString().split("T")[0]:void 0})},v=N=>{switch(N){case"urgent":return t.jsx(Qt,{className:"h-4 w-4 text-red-600"});case"high":return t.jsx(Qt,{className:"h-4 w-4 text-orange-600"});case"medium":return t.jsx(dt,{className:"h-4 w-4 text-yellow-600"});default:return t.jsx(Jt,{className:"h-4 w-4 text-blue-600"})}},y=N=>{switch(N){case"completed":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"in_progress":return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400";case"pending":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";case"cancelled":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},f=N=>{switch(N){case"urgent":return"bg-red-100 text-red-800 dark:bg-red-900/20 dark:text-red-400";case"high":return"bg-orange-100 text-orange-800 dark:bg-orange-900/20 dark:text-orange-400";case"medium":return"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/20 dark:text-yellow-400";default:return"bg-blue-100 text-blue-800 dark:bg-blue-900/20 dark:text-blue-400"}},k=m.filter(N=>!(o.status&&N.status!==o.status||o.priority&&N.priority!==o.priority||o.type&&N.type!==o.type)),x={total:m.length,pending:m.filter(N=>N.status==="pending").length,inProgress:m.filter(N=>N.status==="in_progress").length,completed:m.filter(N=>N.status==="completed").length,urgent:m.filter(N=>N.priority==="urgent").length},[g,h]=b.useState(1),w=3,S=Math.ceil(k.length/w),C=k.slice((g-1)*w,g*w);return s("renter")?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:d("maintenanceManagement")}),t.jsx("p",{className:"text-[10px] sm:text-sm text-gray-600 dark:text-gray-400 mt-1",children:d("maintenanceManagementdes")})]}),s("renter")&&t.jsxs("button",{onClick:()=>l(!0),className:`bg-blue-600 hover:bg-blue-700 text-white \r
px-2 py-1 sm:px-4 sm:py-2 rounded-lg \r
flex items-center space-x-1 sm:space-x-2 \r
text-sm sm:text-base transition-colors`,children:[t.jsx(Ye,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:d("addMaintenanceRequest")})]})]}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:x.total}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:d("totalRequests")})]}),t.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 sm:p-4 rounded-lg border border-yellow-200 dark:border-yellow-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-yellow-900 dark:text-yellow-100",children:x.pending}),t.jsx("div",{className:"text-xs sm:text-sm text-yellow-600 dark:text-yellow-400",children:d("pending")})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 sm:p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-900 dark:text-blue-100",children:x.inProgress}),t.jsx("div",{className:"text-xs sm:text-sm text-blue-600 dark:text-blue-400",children:d("inProgress")})]}),t.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 sm:p-4 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-900 dark:text-green-100",children:x.completed}),t.jsx("div",{className:"text-xs sm:text-sm text-green-600 dark:text-green-400",children:d("completed")})]}),t.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 sm:p-4 rounded-lg border border-red-200 dark:border-red-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-red-900 dark:text-red-100",children:x.urgent}),t.jsx("div",{className:"text-xs sm:text-sm text-red-600 dark:text-red-400",children:d("urgent")})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-4 sm:p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:d("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("status")}),t.jsxs("select",{value:o.status,onChange:N=>c(D=>({...D,status:N.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allStatus")}),t.jsx("option",{value:"pending",children:d("pending")}),t.jsx("option",{value:"in_progress",children:d("inProgress")}),t.jsx("option",{value:"completed",children:d("completed")}),t.jsx("option",{value:"cancelled",children:d("cancelled")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("priority")}),t.jsxs("select",{value:o.priority,onChange:N=>c(D=>({...D,priority:N.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allpriority")}),t.jsx("option",{value:"low",children:d("low")}),t.jsx("option",{value:"medium",children:d("medium")}),t.jsx("option",{value:"high",children:d("high")}),t.jsx("option",{value:"urgent",children:d("urgent")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:d("type")}),t.jsxs("select",{value:o.type,onChange:N=>c(D=>({...D,type:N.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:d("allTypes")}),t.jsx("option",{value:"cleaning",children:d("cleaning")}),t.jsx("option",{value:"repair",children:d("repair")}),t.jsx("option",{value:"inspection",children:d("inspection")}),t.jsx("option",{value:"upgrade",children:d("upgrade")})]})]})]})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("requestDetails")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("location")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("priority")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("status")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("scheduledDate")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:d("cost")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:C.map(N=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4",children:t.jsxs("div",{className:"flex items-start space-x-3",children:[t.jsx("div",{className:"flex-shrink-0 mt-1",children:v(N.priority)}),t.jsxs("div",{children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:N.description}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400 capitalize",children:N.type}),N.assigned_to&&t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Assigned to: ",N.assigned_to]})]})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[t.jsxs("div",{className:"text-sm text-gray-900 dark:text-white",children:["Building ",N.building.name]}),N.room_id&&t.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:["Room ",N.room.room_number," from ( Floor ",N.room.floor.floor_number," )"]})]}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full capitalize ${f(N.priority)}`,children:N.priority})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full capitalize ${y(N.status)}`,children:N.status.replace("_"," ")}),s("manage")&&N.status!=="completed"&&t.jsxs("select",{value:N.status,onChange:D=>j(N.id,D.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"pending",children:"Pending"}),t.jsx("option",{value:"in_progress",children:"In Progress"}),t.jsx("option",{value:"completed",children:"Completed"}),t.jsx("option",{value:"cancelled",children:"Cancelled"})]})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:new Date(N.scheduled_date).toLocaleDateString()}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-900 dark:text-white",children:N.cost?`${currencySymbol} ${N.cost.toLocaleString()}`:"TBD"})]},N.id))})]})})}),S>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>h(N=>Math.max(N-1,1)),disabled:g===1,className:`px-3 py-1 rounded ${g===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let N=Math.max(1,g-1),D=Math.min(S,N+2);D-N<2&&(N=Math.max(1,D-2));const R=[];for(let F=N;F<=D;F++)R.push(t.jsx("button",{onClick:()=>h(F),className:`px-3 py-1 rounded ${g===F?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:F},F));return R})(),t.jsx("button",{onClick:()=>h(N=>Math.min(N+1,S)),disabled:g===S,className:`px-3 py-1 rounded ${g===S?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})}),n&&t.jsx(cN,{maintenance:i,onClose:p})]}):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(ea,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"You don't have permission to this page."})]})},mN=()=>{const{visitors:e=[],deleteVisitor:r,checkoutVisitor:a}=ae()??{},{user:s,hasPermission:n}=ie(),[l,i]=b.useState(null),[u,o]=b.useState({status:"",date:"",search:""}),{t:c}=te(),d=e.filter(w=>w.user_id===(s==null?void 0:s.id)),m=w=>w.check_out_time?"checked_out":"checked_in",p=w=>{switch(w){case"checked_in":return"bg-green-100 text-green-800 dark:bg-green-900/20 dark:text-green-400";case"checked_out":return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900/20 dark:text-gray-400"}},j=d.filter(w=>{const S=m(w);if(u.status&&S!==u.status||u.date&&w.check_in_time.split("T")[0]!==u.date)return!1;if(u.search){const C=u.search.toLowerCase();return w.visitor_name.toLowerCase().includes(C)||w.visiting_renter_name.toLowerCase().includes(C)||w.room_number.toLowerCase().includes(C)}return!0}),v={total:d.length,checkedIn:d.filter(w=>!w.check_out_time).length,checkedOut:d.filter(w=>w.check_out_time).length,today:d.filter(w=>w.check_in_time.startsWith(new Date().toISOString().split("T")[0])).length},y=w=>new Date(w).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit",hour:"numeric",minute:"2-digit",hour12:!0}),[f,k]=b.useState(1),x=3,g=Math.ceil(j.length/x),h=j.slice((f-1)*x,f*x);return n("renter")?t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg sm:text-3xl font-bold text-gray-900 dark:text-white",children:c("visitorManagement")}),t.jsx("p",{className:"text-[10px] sm:text-sm text-gray-600 dark:text-gray-400 mt-1",children:c("visitorManagementdes")})]})}),t.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"bg-white dark:bg-gray-800 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-700",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-white",children:v.total}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:c("totalVisitors")})]}),t.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 sm:p-4 rounded-lg border border-green-200 dark:border-green-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-green-900 dark:text-green-100",children:v.checkedIn}),t.jsx("div",{className:"text-xs sm:text-sm text-green-600 dark:text-green-400",children:c("currentlyInside")})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/20 p-3 sm:p-4 rounded-lg border border-gray-200 dark:border-gray-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-gray-900 dark:text-gray-100",children:v.checkedOut}),t.jsx("div",{className:"text-xs sm:text-sm text-gray-600 dark:text-gray-400",children:c("checkedOut")})]}),t.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 sm:p-4 rounded-lg border border-blue-200 dark:border-blue-800",children:[t.jsx("div",{className:"text-xl sm:text-2xl font-bold text-blue-900 dark:text-blue-100",children:v.today}),t.jsx("div",{className:"text-xs sm:text-sm text-blue-600 dark:text-blue-400",children:c("todayVisitors")})]})]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6",children:[t.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[t.jsx(_t,{className:"h-5 w-5 text-gray-500"}),t.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white",children:c("filters")})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("status")}),t.jsxs("select",{value:u.status,onChange:w=>o(S=>({...S,status:w.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:[t.jsx("option",{value:"",children:c("allStatus")}),t.jsx("option",{value:"checked_in",children:c("checkedIn")}),t.jsx("option",{value:"checked_out",children:c("checkedOut")})]})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("date")}),t.jsx("input",{type:"date",value:u.date,onChange:w=>o(S=>({...S,date:w.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:c("search")}),t.jsxs("div",{className:"relative",children:[t.jsx(Aa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx("input",{type:"text",value:u.search,onChange:w=>o(S=>({...S,search:w.target.value})),placeholder:c("searchvisitorsrentersrooms"),className:"w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]})]})]})]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm overflow-hidden",children:t.jsx("div",{className:"overflow-x-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:c("visitorDetails")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:c("visiting")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:c("checkinTime")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:c("checkoutTime")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:c("status")}),t.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider",children:c("purpose")})]})}),t.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:h.map(w=>t.jsxs("tr",{className:"hover:bg-gray-50 dark:hover:bg-gray-700",children:[t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/20 rounded-full flex items-center justify-center",children:t.jsx(fl,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})}),t.jsxs("div",{className:"ml-4",children:[t.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:w.visitor_name}),t.jsx("p",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:y(w.createdAt)}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:w.visitor_phone}),w.vehicle_number&&t.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[c("vehicle"),": ",w.vehicle_number]})]})]})}),t.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[t.jsx("div",{className:"text-sm text-gray-900 dark:text-white",children:w.visiting_renter_name}),t.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:w.building.name})]}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:y(w.check_in_time)}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:y(w.check_out_time)}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.jsxs("div",{className:"flex items-center",children:[m(w)==="checked_in"?t.jsx(dt,{className:"h-4 w-4 text-green-600 mr-2"}):t.jsx(vt,{className:"h-4 w-4 text-gray-600 mr-2"}),t.jsx("span",{className:`px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full ${p(m(w))}`,children:m(w)==="checked_in"?"Inside":"Checked Out"})]})}),t.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400",children:w.purpose})]},w.id))})]})})}),g>1&&t.jsx("div",{className:"flex justify-end items-center mt-4",children:t.jsxs("div",{className:"space-x-1 flex items-center",children:[t.jsx("button",{onClick:()=>k(w=>Math.max(w-1,1)),disabled:f===1,className:`px-3 py-1 rounded ${f===1?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Prev"}),(()=>{let w=Math.max(1,f-1),S=Math.min(g,w+2);S-w<2&&(w=Math.max(1,S-2));const C=[];for(let N=w;N<=S;N++)C.push(t.jsx("button",{onClick:()=>k(N),className:`px-3 py-1 rounded ${f===N?"bg-blue-600 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:N},N));return C})(),t.jsx("button",{onClick:()=>k(w=>Math.min(w+1,g)),disabled:f===g,className:`px-3 py-1 rounded ${f===g?"bg-gray-300 dark:bg-gray-600 text-gray-400 cursor-not-allowed":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600"}`,children:"Next"})]})})]}):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(ea,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"You don't have permission to this page."})]})},gN=()=>{const{t:e}=te(),{user:r,hasPermission:a}=ie(),{updateUser:s}=ie(),[n,l]=b.useState(!1),{renters:i,uploadRenterDocument:u,deleteDocument:o}=ae(),c=[{value:"nid",label:"Emirates ID"},{value:"passport",label:"Passport"},{value:"contract",label:"Rental Contract"},{value:"photo",label:"Profile Photo"},{value:"income_proof",label:"Income Proof"},{value:"reference",label:"Reference Letter"},{value:"other",label:"Other Document"}],[d,m]=b.useState({name:"",email:"",password:"",phone:"",alternate_phone:"",nid:"",building_id:"",floor_id:"",room_id:"",room_number:"",floor_number:0,rent_amount:0,security_deposit:0,check_in_date:"",lease_start_date:"",lease_end_date:"",status:"active",emergency_contact:"",emergency_relation:"",occupation:"",company:"",monthlyIncome:0,previous_address:"",references:"",notice_period:30,preferences:{foodType:"both",smokingAllowed:!1,petAllowed:!1,guestPolicy:"restricted"},documents:[]});if(b.useEffect(()=>{if(r&&i.length>0){const y=i.find(f=>f.user_id===r.id);m(y||null)}},[r,i]),!a("renter"))return t.jsxs("div",{className:"text-center py-12",children:[t.jsx(ea,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"You don't have permission to this page."})]});const p=async y=>{var w;const f=(w=y.target.files)==null?void 0:w[0];if(!f)return;l(!0);const k=URL.createObjectURL(f),x=document.getElementById("documentType").value,g=document.getElementById("documentDescription").value,h={type:x,file_name:f.name,file_url:k,description:g||`${x} document`};d?(u(d.id,h),m(S=>({...S,documents:[...S.documents,{...h,id:Date.now().toString(),updated_at:new Date().toISOString().split("T")[0]}]}))):m(S=>({...S,documents:[...S.documents,{...h,id:Date.now().toString(),updated_at:new Date().toISOString().split("T")[0]}]})),l(!1),y.target.value="",document.getElementById("documentDescription").value=""},j=y=>{d?(o(y),m(f=>({...f,documents:f.documents.filter(k=>k.id!==y)}))):m(f=>({...f,documents:f.documents.filter(k=>k.id!==y)}))},v=y=>{var f;return((f=c.find(k=>k.value===y))==null?void 0:f.label)||y};return t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:e("documents")})}),t.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-1 gap-6",children:t.jsx("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-sm p-3 sm:p-6",children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e("documentsType")}),t.jsx("select",{id:"documentType",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:c.map(y=>t.jsx("option",{value:y.value,children:y.label},y.value))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e("description")}),t.jsx("input",{type:"text",id:"documentDescription",placeholder:"Optional description",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:e("uploadFile")}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:"file",onChange:p,accept:".pdf,.jpg,.jpeg,.png,.doc,.docx",className:"hidden",id:"fileUpload",disabled:n}),t.jsxs("label",{htmlFor:"fileUpload",className:`flex items-center justify-center w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors ${n?"opacity-50 cursor-not-allowed":""}`,children:[t.jsx(Xg,{className:"h-4 w-4 mr-2"}),n?"Uploading...":"Choose File"]})]})]})]}),d.documents.length>0&&t.jsxs("div",{className:"space-y-2 pt-4",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:e("uploadedDocuments")}),d.documents.map(y=>t.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-lg",children:[t.jsxs("div",{className:"flex items-center space-x-3",children:[t.jsx(Ue,{className:"h-5 w-5 text-blue-600"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-white",children:v(y.type)}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[y.file_name," • ",y.updated_at]}),y.description&&t.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:y.description})]})]}),t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("button",{type:"button",onClick:()=>window.open(y.file_url,"_blank"),className:"p-1 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",children:t.jsx(nt,{className:"h-4 w-4"})}),t.jsx("button",{type:"button",onClick:()=>j(y.id),className:"p-1 text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(Ar,{className:"h-4 w-4"})})]})]},y.id))]})]})})})]})},xN=({payment:e,onClose:r})=>{const{updateRentPayment:a}=ae(),{t:s}=te(),n=ge(),[l,i]=b.useState({amount:0,due_date:"",paid_date:"",status:"paid",month:"",year:"",payment_method:"Cash",transaction_id:""}),u=["Cash","Bank Transfer","Mobile Banking","Check"];b.useEffect(()=>{if(e){const d=m=>m?m.split("T")[0]:"";i({amount:e.amount,due_date:d(e.due_date),paid_date:d(e.paid_date),status:"paid",month:e.month,year:e.year,payment_method:e.payment_method||"Cash",transaction_id:e.transaction_id||""})}},[e]);const o=d=>{const{name:m,value:p}=d.target;i(j=>({...j,[m]:m==="amount"||m==="year"?parseInt(p)||0:p}))},c=d=>{d.preventDefault(),a(e.id,l),r()};return t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50",style:{margin:0},children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-xl shadow-xl max-w-md w-full max-h-[90vh] overflow-y-auto",children:[t.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:s("markasPaid")}),t.jsx("button",{onClick:r,className:"p-2 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:t.jsx(ye,{className:"h-5 w-5 text-gray-500"})})]}),t.jsxs("form",{onSubmit:c,className:"p-6 space-y-4",children:[t.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-lg flex-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("p",{className:"font-medium text-gray-900 dark:text-white",children:[s("name")," : "]}),t.jsx("p",{className:"font-medium text-gray-900 dark:text-white",children:e.renterName})]})}),t.jsxs("div",{className:"p-4 border border-gray-300 dark:border-gray-600 rounded-lg dark:bg-gray-700 dark:text-white flex-1 space-y-3",children:[t.jsxs("div",{style:{marginTop:0},className:"flex items-center justify-between",children:[t.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("amount")," : "]}),t.jsxs("span",{className:"text-sm",children:[l.amount," (",n,")"]})]}),t.jsxs("div",{style:{marginTop:0},className:"flex items-center justify-between",children:[t.jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[s("date")," : "]}),t.jsx("span",{className:"text-sm",children:l.due_date})]})]}),l.status==="paid"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Payment Method"}),t.jsx("select",{name:"payment_method",value:l.payment_method,onChange:o,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",children:u.map(d=>t.jsx("option",{value:d,children:d},d))})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:"Transaction ID"}),t.jsx("input",{type:"text",name:"transaction_id",value:l.transaction_id,onChange:o,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:bg-gray-700 dark:text-white",placeholder:"Optional"})]})]}),t.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[t.jsx("button",{type:"button",onClick:r,className:"px-4 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg transition-colors",children:s("cancel")}),t.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors",children:s("save")})]})]})]})})},hN=()=>{var p,j,v,y,f,k,x;const{id:e}=vy(),{getRoomsById:r}=ae()??{},a=ge(),s=$a(),[n,l]=b.useState(null),{hasPermission:i}=ie(),[u,o]=b.useState(!1),[c,d]=b.useState(null);b.useEffect(()=>{(async()=>{var h,w,S;if(e)try{const C=await r(e);l(C)}catch(C){((h=C.response)==null?void 0:h.status)===401&&((S=(w=C.response)==null?void 0:w.data)==null?void 0:S.message)==="No token, authorization denied"?s("/authorization"):l(null)}})()},[e,r,s]);const m=g=>{d(g),o(!0)};return n?t.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-950 py-10 px-4",children:t.jsxs("div",{className:"max-w-4xl mx-auto",children:[t.jsxs("div",{className:"bg-gradient-to-r from-purple-600 to-indigo-600 text-white rounded-2xl shadow-xl p-6 mb-8 relative overflow-hidden",children:[t.jsx("div",{className:"absolute inset-0 opacity-20 bg-[url('/patterns/graph-paper.svg')]"}),t.jsxs("div",{className:"relative flex items-center gap-4",children:[t.jsx("div",{className:"bg-white/20 p-4 rounded-xl",children:t.jsx(Ts,{className:"h-10 w-10"})}),t.jsxs("div",{children:[t.jsxs("h1",{className:"text-2xl font-bold",children:["Room ",n.room_number]}),t.jsxs("p",{className:"text-sm text-purple-100",children:["Created at ",new Date(n.createdAt).toLocaleDateString()]})]})]})]}),t.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[t.jsx("div",{className:"p-5 bg-white dark:bg-gray-900 rounded-xl shadow-md",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{className:"flex items-center gap-2 text-gray-700 dark:text-gray-300",children:[t.jsx(bt,{className:"h-5 w-5 text-purple-500"})," Building"]}),t.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:(p=n.building)==null?void 0:p.name})]})}),t.jsx("div",{className:"p-5 bg-white dark:bg-gray-900 rounded-xl shadow-md",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{className:"flex items-center gap-2 text-gray-700 dark:text-gray-300",children:[t.jsx(qg,{className:"h-5 w-5 text-indigo-500"})," Floor"]}),t.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:(j=n.floor)==null?void 0:j.floor_number})]})}),t.jsx("div",{className:"p-5 bg-white dark:bg-gray-900 rounded-xl shadow-md",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:"Rent"}),t.jsxs("span",{className:"text-lg font-bold text-purple-600 dark:text-purple-400",children:[a," ",n.rent_per_bed]})]})}),t.jsx("div",{className:"p-5 bg-white dark:bg-gray-900 rounded-xl shadow-md",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-gray-700 dark:text-gray-300",children:"Status"}),t.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium shadow-sm
${n.status==="available"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":n.status==="occupied"?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400":n.status==="maintenance"?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300"}`,children:n.status})]})})]}),n.status==="occupied"&&n.renters&&t.jsxs("div",{className:"mt-8 p-6 bg-white dark:bg-gray-900 rounded-xl shadow-md",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Renter Details"}),t.jsxs("div",{className:"border-b border-gray-200 dark:border-gray-700 pb-4 mb-4 last:border-b-0 last:mb-0",children:[t.jsxs("div",{className:"flex justify-between mb-2",children:[t.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:"Name:"}),t.jsx("span",{className:"text-gray-900 dark:text-gray-100",children:n.renters.name})]}),t.jsxs("div",{className:"flex justify-between mb-2",children:[t.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:"Email:"}),t.jsx("span",{className:"text-gray-900 dark:text-gray-100",children:n.renters.email})]}),t.jsxs("div",{className:"flex justify-between mb-2",children:[t.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:"Phone:"}),t.jsx("span",{className:"text-gray-900 dark:text-gray-100",children:n.renters.phone})]}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:"Company:"}),t.jsx("span",{className:"text-gray-900 dark:text-gray-100",children:n.renters.company})]})]})]}),n.status==="occupied"&&n.renters&&((v=n.renters)==null?void 0:v.payments)&&((f=(y=n.renters)==null?void 0:y.payments)==null?void 0:f.length)>0&&t.jsxs("div",{className:"mt-8 p-6 bg-white dark:bg-gray-900 rounded-xl shadow-md",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Pending Rents"}),t.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 pb-4 mb-4 last:border-b-0 last:mb-0",children:((x=(k=n.renters)==null?void 0:k.payments)==null?void 0:x.length)>0&&t.jsx(t.Fragment,{children:n.renters.payments.filter(g=>g.status=="pending").map((g,h)=>t.jsxs("div",{className:"flex items-center justify-between mt-3 p-4 rounded-2xl shadow-md bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 hover:shadow-lg transition",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-lg font-bold text-purple-600 dark:text-purple-400",children:[a," ",Number(g.amount).toLocaleString()]}),t.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Date: ",new Date(g.due_date).toLocaleDateString()]})]}),t.jsx("div",{className:"text-right",children:i("manage")&&t.jsx(t.Fragment,{children:t.jsx("div",{className:"flex space-x-2 pt-2",children:g.status!=="paid"&&t.jsx("button",{onClick:()=>m(g),className:"bg-green-100 hover:bg-green-200 dark:bg-green-900/20 dark:hover:bg-green-800 text-green-600 dark:text-green-400 px-2 py-1 rounded transition-colors text-sm font-medium",children:"Mark as Paid"})})})})]},h))})})]}),t.jsxs("div",{className:"mt-8 p-6 bg-white dark:bg-gray-900 rounded-xl shadow-md",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-4",children:"Facilities"}),t.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{let g=[];try{const h=JSON.parse(n.facilities);g=typeof h=="string"?JSON.parse(h):h,Array.isArray(g)||(g=[])}catch{g=[]}return g.length>0?g.map((h,w)=>t.jsx("span",{className:"px-3 py-1 rounded-full bg-purple-50 text-purple-700 text-xs font-medium shadow-sm dark:bg-purple-900/30 dark:text-purple-300",children:h},w)):t.jsx("span",{className:"text-xs italic text-gray-500",children:"No facilities available"})})()})]}),u&&t.jsx(xN,{payment:c,onClose:()=>{o(!1),d(null)}})]})}):t.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900 px-4",children:t.jsxs("div",{className:"text-center bg-white dark:bg-gray-800 rounded-2xl shadow-xl p-10 max-w-sm w-full",children:[t.jsx("div",{className:"flex items-center justify-center mb-4",children:t.jsx("svg",{className:"w-16 h-16 text-red-500",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:"Room Not Found"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-6",children:"The room you are looking for does not exist or may have been removed."})]})})},pN=()=>{const{t:e}=te(),r=$a();return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900 text-center px-4",children:[t.jsx("h1",{className:"text-[10rem] sm:text-[15rem] font-extrabold text-red-500 leading-none select-none",children:"404"}),t.jsx("h2",{className:"text-3xl sm:text-5xl font-semibold text-gray-900 dark:text-white mb-4",children:e("accessRestricted")}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-8 max-w-xl",children:e("accessRestrictedDes")}),t.jsx("button",{onClick:()=>r("/login"),className:"px-6 py-3 bg-red-500 hover:bg-red-600 text-white font-semibold rounded-2xl shadow-lg transition-all",children:e("loginNow")})]})},fN=()=>{const{t:e}=te();return t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen bg-gray-50 dark:bg-gray-900 text-center px-4",children:[t.jsx("h1",{className:"text-[10rem] sm:text-[15rem] font-extrabold text-red-500 leading-none select-none",children:"404"}),t.jsx("h2",{className:"text-3xl sm:text-5xl font-semibold text-gray-900 dark:text-white mb-4",children:e("accessRestricted")}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-8 max-w-xl",children:e("accessRestrictedPermissionDes")})]})},Re=({permission:e,children:r})=>{const{hasPermission:a,loading:s}=ie();return a(e)===!1&&!s?t.jsx(Td,{to:"/has-no-Permission",replace:!0}):t.jsx(t.Fragment,{children:r})},yN=()=>{const{user:e}=ie(),{t:r}=te(),a=s=>new Date(s).toLocaleString("en-US",{year:"numeric",month:"short",day:"2-digit"});return t.jsx("div",{className:"space-y-6",children:t.jsxs("div",{className:"flex flex-col space-y-6",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx("h1",{className:"text-3xl font-bold text-gray-900 dark:text-white",children:r("dashboard")})}),t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 shadow-md rounded-xl p-6 hover:shadow-lg transition-shadow duration-300",children:[t.jsxs("p",{className:"text-lg text-gray-700 dark:text-gray-200",children:["Hi! ",t.jsx("span",{className:"font-semibold",children:e.name})]}),t.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:[r("joinedAt"),": ",t.jsx("span",{className:"font-medium",children:a(e.createdAt)})]})]})})]})})};function bN(){return t.jsxs(Fk,{children:[t.jsx(Mk,{position:"top-right"}),t.jsx(Lk,{children:t.jsx(Ak,{children:t.jsx(Ok,{children:t.jsx(nb,{children:t.jsx("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900 transition-colors duration-200",children:t.jsxs(Ly,{children:[t.jsx(ce,{path:"/login",element:t.jsx(rj,{})}),t.jsx(ce,{path:"/authorization",element:t.jsx(pN,{})}),t.jsx(ce,{path:"/has-no-Permission",element:t.jsx(fN,{})}),t.jsx(ce,{path:"/room/:id",element:t.jsx(hN,{})}),t.jsx(ce,{path:"/",element:t.jsx(Td,{to:"/dashboard",replace:!0})}),t.jsxs(ce,{element:t.jsx(lj,{children:t.jsx(nj,{})}),children:[t.jsx(ce,{path:"/staff/dashboard",element:t.jsx(yN,{})}),t.jsx(ce,{path:"/dashboard",element:t.jsx(Re,{permission:"view",children:t.jsx(dw,{})})}),t.jsx(ce,{path:"/buildings",element:t.jsx(Re,{permission:"view_buildings",children:t.jsx(yw,{})})}),t.jsx(ce,{path:"/floors",element:t.jsx(Re,{permission:"view_floors",children:t.jsx(vw,{})})}),t.jsx(ce,{path:"/rooms",element:t.jsx(Re,{permission:"view_rooms",children:t.jsx(Mw,{})})}),t.jsx(ce,{path:"/beds",element:t.jsx(Re,{permission:"view_rooms",children:t.jsx(Fw,{})})}),t.jsx(ce,{path:"/renters",element:t.jsx(Re,{permission:"view_customer",children:t.jsx(Ow,{})})}),t.jsx(ce,{path:"/rent",element:t.jsx(Re,{permission:"view_rents",children:t.jsx($w,{})})}),t.jsx(ce,{path:"/pending-rent",element:t.jsx(Re,{permission:"view_rents",children:t.jsx(Uw,{})})}),t.jsx(ce,{path:"/maintenance",element:t.jsx(Re,{permission:"view_maintenance",children:t.jsx(qw,{})})}),t.jsx(ce,{path:"/expenses",element:t.jsx(Re,{permission:"view_expenses",children:t.jsx(Jw,{})})}),t.jsx(ce,{path:"/reports",element:t.jsx(Re,{permission:"reports",children:t.jsx(Yw,{})})}),t.jsx(ce,{path:"/staff",element:t.jsx(Re,{permission:"user_management",children:t.jsx(Gw,{})})}),t.jsx(ce,{path:"/notices",element:t.jsx(eN,{})}),t.jsx(ce,{path:"/visitors",element:t.jsx(Re,{permission:"view_visitors",children:t.jsx(aN,{})})}),t.jsx(ce,{path:"/settings",element:t.jsx(Re,{permission:"settings",children:t.jsx(sN,{})})}),t.jsx(ce,{path:"/template",element:t.jsx(lN,{})}),t.jsx(ce,{path:"/user/settings",element:t.jsx(Re,{permission:"renter",children:t.jsx(iN,{})})}),t.jsx(ce,{path:"/user/rents",element:t.jsx(Re,{permission:"renter",children:t.jsx(oN,{})})}),t.jsx(ce,{path:"/user/dashboard",element:t.jsx(Re,{permission:"renter",children:t.jsx(dN,{})})}),t.jsx(ce,{path:"/user/maintenance",element:t.jsx(Re,{permission:"renter",children:t.jsx(uN,{})})}),t.jsx(ce,{path:"/user/visitors",element:t.jsx(Re,{permission:"renter",children:t.jsx(mN,{})})}),t.jsx(ce,{path:"/user/documents",element:t.jsx(Re,{permission:"renter",children:t.jsx(gN,{})})})]}),t.jsx(ce,{path:"*",element:t.jsx(ij,{})})]})})})})})})]})}H0(document.getElementById("root")).render(t.jsx(b.StrictMode,{children:t.jsx(bN,{})}));
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0258 ]-- |