var YK=Object.defineProperty;var gN=e=>{throw TypeError(e)};var XK=(e,t,n)=>t in e?YK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oc=(e,t,n)=>XK(e,typeof t!="symbol"?t+"":t,n),jw=(e,t,n)=>t.has(e)||gN("Cannot "+n);var ue=(e,t,n)=>(jw(e,t,"read from private field"),n?n.call(e):t.get(e)),Ft=(e,t,n)=>t.has(e)?gN("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),bt=(e,t,n,r)=>(jw(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),mn=(e,t,n)=>(jw(e,t,"access private method"),n);var Cv=(e,t,n,r)=>({set _(i){bt(e,t,i,n)},get _(){return ue(e,t,r)}});function QK(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var Xp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function In(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ow={exports:{}},Lp={},Tw={exports:{}},wn={};/** * @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 vN;function JK(){if(vN)return wn;vN=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.iterator;function y(ie){return ie===null||typeof ie!="object"?null:(ie=m&&ie[m]||ie["@@iterator"],typeof ie=="function"?ie:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},P=Object.assign,x={};function w(ie,de,He){this.props=ie,this.context=de,this.refs=x,this.updater=He||b}w.prototype.isReactComponent={},w.prototype.setState=function(ie,de){if(typeof ie!="object"&&typeof ie!="function"&&ie!=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,ie,de,"setState")},w.prototype.forceUpdate=function(ie){this.updater.enqueueForceUpdate(this,ie,"forceUpdate")};function T(){}T.prototype=w.prototype;function E(ie,de,He){this.props=ie,this.context=de,this.refs=x,this.updater=He||b}var k=E.prototype=new T;k.constructor=E,P(k,w.prototype),k.isPureReactComponent=!0;var D=Array.isArray,I=Object.prototype.hasOwnProperty,R={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function V(ie,de,He){var je,$e={},We=null,Ye=null;if(de!=null)for(je in de.ref!==void 0&&(Ye=de.ref),de.key!==void 0&&(We=""+de.key),de)I.call(de,je)&&!$.hasOwnProperty(je)&&($e[je]=de[je]);var rt=arguments.length-2;if(rt===1)$e.children=He;else if(1>>1,de=re[ie];if(0>>1;iei($e,ae))Wei(Ye,$e)?(re[ie]=Ye,re[We]=ae,ie=We):(re[ie]=$e,re[je]=ae,ie=je);else if(Wei(Ye,ae))re[ie]=Ye,re[We]=ae,ie=We;else break e}}return Ce}function i(re,Ce){var ae=re.sortIndex-Ce.sortIndex;return ae!==0?ae:re.id-Ce.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],d=[],p=1,m=null,y=3,b=!1,P=!1,x=!1,w=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(re){for(var Ce=n(d);Ce!==null;){if(Ce.callback===null)r(d);else if(Ce.startTime<=re)r(d),Ce.sortIndex=Ce.expirationTime,t(c,Ce);else break;Ce=n(d)}}function D(re){if(x=!1,k(re),!P)if(n(c)!==null)P=!0,fe(I);else{var Ce=n(d);Ce!==null&&Oe(D,Ce.startTime-re)}}function I(re,Ce){P=!1,x&&(x=!1,T(V),V=-1),b=!0;var ae=y;try{for(k(Ce),m=n(c);m!==null&&(!(m.expirationTime>Ce)||re&&!ee());){var ie=m.callback;if(typeof ie=="function"){m.callback=null,y=m.priorityLevel;var de=ie(m.expirationTime<=Ce);Ce=e.unstable_now(),typeof de=="function"?m.callback=de:m===n(c)&&r(c),k(Ce)}else r(c);m=n(c)}if(m!==null)var He=!0;else{var je=n(d);je!==null&&Oe(D,je.startTime-Ce),He=!1}return He}finally{m=null,y=ae,b=!1}}var R=!1,$=null,V=-1,K=5,Z=-1;function ee(){return!(e.unstable_now()-Zre||125ie?(re.sortIndex=ae,t(d,re),n(c)===null&&re===n(d)&&(x?(T(V),V=-1):x=!0,Oe(D,ae-ie))):(re.sortIndex=de,t(c,re),P||b||(P=!0,fe(I))),re},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(re){var Ce=y;return function(){var ae=y;y=Ce;try{return re.apply(this,arguments)}finally{y=ae}}}})(kw)),kw}var _N;function rH(){return _N||(_N=1,Aw.exports=nH()),Aw.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 SN;function iH(){if(SN)return yo;SN=1;var e=QT(),t=rH();function n(l){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+l,v=1;v"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,d=/^[: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]*$/,p={},m={};function y(l){return c.call(m,l)?!0:c.call(p,l)?!1:d.test(l)?m[l]=!0:(p[l]=!0,!1)}function b(l,f,v,j){if(v!==null&&v.type===0)return!1;switch(typeof f){case"function":case"symbol":return!0;case"boolean":return j?!1:v!==null?!v.acceptsBooleans:(l=l.toLowerCase().slice(0,5),l!=="data-"&&l!=="aria-");default:return!1}}function P(l,f,v,j){if(f===null||typeof f>"u"||b(l,f,v,j))return!0;if(j)return!1;if(v!==null)switch(v.type){case 3:return!f;case 4:return f===!1;case 5:return isNaN(f);case 6:return isNaN(f)||1>f}return!1}function x(l,f,v,j,N,F,Y){this.acceptsBooleans=f===2||f===3||f===4,this.attributeName=j,this.attributeNamespace=N,this.mustUseProperty=v,this.propertyName=l,this.type=f,this.sanitizeURL=F,this.removeEmptyString=Y}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(l){w[l]=new x(l,0,!1,l,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(l){var f=l[0];w[f]=new x(f,1,!1,l[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(l){w[l]=new x(l,2,!1,l.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(l){w[l]=new x(l,2,!1,l,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(l){w[l]=new x(l,3,!1,l.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(l){w[l]=new x(l,3,!0,l,null,!1,!1)}),["capture","download"].forEach(function(l){w[l]=new x(l,4,!1,l,null,!1,!1)}),["cols","rows","size","span"].forEach(function(l){w[l]=new x(l,6,!1,l,null,!1,!1)}),["rowSpan","start"].forEach(function(l){w[l]=new x(l,5,!1,l.toLowerCase(),null,!1,!1)});var T=/[\-:]([a-z])/g;function E(l){return l[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(l){var f=l.replace(T,E);w[f]=new x(f,1,!1,l,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(l){var f=l.replace(T,E);w[f]=new x(f,1,!1,l,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(l){var f=l.replace(T,E);w[f]=new x(f,1,!1,l,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(l){w[l]=new x(l,1,!1,l.toLowerCase(),null,!1,!1)}),w.xlinkHref=new x("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(l){w[l]=new x(l,1,!1,l.toLowerCase(),null,!0,!0)});function k(l,f,v,j){var N=w.hasOwnProperty(f)?w[f]:null;(N!==null?N.type!==0:j||!(2se||N[Y]!==F[se]){var ge=` `+N[Y].replace(" at new "," at ");return l.displayName&&ge.includes("")&&(ge=ge.replace("",l.displayName)),ge}while(1<=Y&&0<=se);break}}}finally{He=!1,Error.prepareStackTrace=v}return(l=l?l.displayName||l.name:"")?de(l):""}function $e(l){switch(l.tag){case 5:return de(l.type);case 16:return de("Lazy");case 13:return de("Suspense");case 19:return de("SuspenseList");case 0:case 2:case 15:return l=je(l.type,!1),l;case 11:return l=je(l.type.render,!1),l;case 1:return l=je(l.type,!0),l;default:return""}}function We(l){if(l==null)return null;if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case $:return"Fragment";case R:return"Portal";case K:return"Profiler";case V:return"StrictMode";case oe:return"Suspense";case he:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case ee:return(l.displayName||"Context")+".Consumer";case Z:return(l._context.displayName||"Context")+".Provider";case ne:var f=l.render;return l=l.displayName,l||(l=f.displayName||f.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Se:return f=l.displayName||null,f!==null?f:We(l.type)||"Memo";case fe:f=l._payload,l=l._init;try{return We(l(f))}catch{}}return null}function Ye(l){var f=l.type;switch(l.tag){case 24:return"Cache";case 9:return(f.displayName||"Context")+".Consumer";case 10:return(f._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return l=f.render,l=l.displayName||l.name||"",f.displayName||(l!==""?"ForwardRef("+l+")":"ForwardRef");case 7:return"Fragment";case 5:return f;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return We(f);case 8:return f===V?"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 f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f}return null}function rt(l){switch(typeof l){case"boolean":case"number":case"string":case"undefined":return l;case"object":return l;default:return""}}function ze(l){var f=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function Fe(l){var f=ze(l)?"checked":"value",v=Object.getOwnPropertyDescriptor(l.constructor.prototype,f),j=""+l[f];if(!l.hasOwnProperty(f)&&typeof v<"u"&&typeof v.get=="function"&&typeof v.set=="function"){var N=v.get,F=v.set;return Object.defineProperty(l,f,{configurable:!0,get:function(){return N.call(this)},set:function(Y){j=""+Y,F.call(this,Y)}}),Object.defineProperty(l,f,{enumerable:v.enumerable}),{getValue:function(){return j},setValue:function(Y){j=""+Y},stopTracking:function(){l._valueTracker=null,delete l[f]}}}}function st(l){l._valueTracker||(l._valueTracker=Fe(l))}function Te(l){if(!l)return!1;var f=l._valueTracker;if(!f)return!0;var v=f.getValue(),j="";return l&&(j=ze(l)?l.checked?"true":"false":l.value),l=j,l!==v?(f.setValue(l),!0):!1}function Dt(l){if(l=l||(typeof document<"u"?document:void 0),typeof l>"u")return null;try{return l.activeElement||l.body}catch{return l.body}}function Lt(l,f){var v=f.checked;return ae({},f,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:v??l._wrapperState.initialChecked})}function dn(l,f){var v=f.defaultValue==null?"":f.defaultValue,j=f.checked!=null?f.checked:f.defaultChecked;v=rt(f.value!=null?f.value:v),l._wrapperState={initialChecked:j,initialValue:v,controlled:f.type==="checkbox"||f.type==="radio"?f.checked!=null:f.value!=null}}function xn(l,f){f=f.checked,f!=null&&k(l,"checked",f,!1)}function qn(l,f){xn(l,f);var v=rt(f.value),j=f.type;if(v!=null)j==="number"?(v===0&&l.value===""||l.value!=v)&&(l.value=""+v):l.value!==""+v&&(l.value=""+v);else if(j==="submit"||j==="reset"){l.removeAttribute("value");return}f.hasOwnProperty("value")?Zr(l,f.type,v):f.hasOwnProperty("defaultValue")&&Zr(l,f.type,rt(f.defaultValue)),f.checked==null&&f.defaultChecked!=null&&(l.defaultChecked=!!f.defaultChecked)}function Ar(l,f,v){if(f.hasOwnProperty("value")||f.hasOwnProperty("defaultValue")){var j=f.type;if(!(j!=="submit"&&j!=="reset"||f.value!==void 0&&f.value!==null))return;f=""+l._wrapperState.initialValue,v||f===l.value||(l.value=f),l.defaultValue=f}v=l.name,v!==""&&(l.name=""),l.defaultChecked=!!l._wrapperState.initialChecked,v!==""&&(l.name=v)}function Zr(l,f,v){(f!=="number"||Dt(l.ownerDocument)!==l)&&(v==null?l.defaultValue=""+l._wrapperState.initialValue:l.defaultValue!==""+v&&(l.defaultValue=""+v))}var $r=Array.isArray;function Bn(l,f,v,j){if(l=l.options,f){f={};for(var N=0;N"+f.valueOf().toString()+"",f=Eo.firstChild;l.firstChild;)l.removeChild(l.firstChild);for(;f.firstChild;)l.appendChild(f.firstChild)}});function Na(l,f){if(f){var v=l.firstChild;if(v&&v===l.lastChild&&v.nodeType===3){v.nodeValue=f;return}}l.textContent=f}var Wi={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},Ja=["Webkit","ms","Moz","O"];Object.keys(Wi).forEach(function(l){Ja.forEach(function(f){f=f+l.charAt(0).toUpperCase()+l.substring(1),Wi[f]=Wi[l]})});function Ki(l,f,v){return f==null||typeof f=="boolean"||f===""?"":v||typeof f!="number"||f===0||Wi.hasOwnProperty(l)&&Wi[l]?(""+f).trim():f+"px"}function Ho(l,f){l=l.style;for(var v in f)if(f.hasOwnProperty(v)){var j=v.indexOf("--")===0,N=Ki(v,f[v],j);v==="float"&&(v="cssFloat"),j?l.setProperty(v,N):l[v]=N}}var qr=ae({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 Pt(l,f){if(f){if(qr[l]&&(f.children!=null||f.dangerouslySetInnerHTML!=null))throw Error(n(137,l));if(f.dangerouslySetInnerHTML!=null){if(f.children!=null)throw Error(n(60));if(typeof f.dangerouslySetInnerHTML!="object"||!("__html"in f.dangerouslySetInnerHTML))throw Error(n(61))}if(f.style!=null&&typeof f.style!="object")throw Error(n(62))}}function Ci(l,f){if(l.indexOf("-")===-1)return typeof f.is=="string";switch(l){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 fa=null;function lt(l){return l=l.target||l.srcElement||window,l.correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var ht=null,Ma=null,vr=null;function Go(l){if(l=nu(l)){if(typeof ht!="function")throw Error(n(280));var f=l.stateNode;f&&(f=yd(f),ht(l.stateNode,l.type,f))}}function Cs(l){Ma?vr?vr.push(l):vr=[l]:Ma=l}function Zo(){if(Ma){var l=Ma,f=vr;if(vr=Ma=null,Go(l),f)for(l=0;l>>=0,l===0?32:31-($n(l)/no|0)|0}var mi=64,No=4194304;function qt(l){switch(l&-l){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 l&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return l&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return l}}function zn(l,f){var v=l.pendingLanes;if(v===0)return 0;var j=0,N=l.suspendedLanes,F=l.pingedLanes,Y=v&268435455;if(Y!==0){var se=Y&~N;se!==0?j=qt(se):(F&=Y,F!==0&&(j=qt(F)))}else Y=v&~N,Y!==0?j=qt(Y):F!==0&&(j=qt(F));if(j===0)return 0;if(f!==0&&f!==j&&(f&N)===0&&(N=j&-j,F=f&-f,N>=F||N===16&&(F&4194240)!==0))return f;if((j&4)!==0&&(j|=v&16),f=l.entangledLanes,f!==0)for(l=l.entanglements,f&=j;0v;v++)f.push(l);return f}function gi(l,f,v){l.pendingLanes|=f,f!==536870912&&(l.suspendedLanes=0,l.pingedLanes=0),l=l.eventTimes,f=31-ft(f),l[f]=v}function Un(l,f){var v=l.pendingLanes&~f;l.pendingLanes=f,l.suspendedLanes=0,l.pingedLanes=0,l.expiredLanes&=f,l.mutableReadLanes&=f,l.entangledLanes&=f,f=l.entanglements;var j=l.eventTimes;for(l=l.expirationTimes;0=ai),fo=" ",vd=!1;function bl(l,f){switch(l){case"keyup":return Gn.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ef(l){return l=l.detail,typeof l=="object"&&"data"in l?l.data:null}var ya=!1;function Ro(l,f){switch(l){case"compositionend":return ef(f);case"keypress":return f.which!==32?null:(vd=!0,fo);case"textInput":return l=f.data,l===fo&&vd?null:l;default:return null}}function Vn(l,f){if(ya)return l==="compositionend"||!Mr&&bl(l,f)?(l=yl(),so=ii=ga=null,ya=!1,l):null;switch(l){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1=f)return{node:v,offset:f-l};l=j}e:{for(;v;){if(v.nextSibling){v=v.nextSibling;break e}v=v.parentNode}v=void 0}v=me(v)}}function _e(l,f){return l&&f?l===f?!0:l&&l.nodeType===3?!1:f&&f.nodeType===3?_e(l,f.parentNode):"contains"in l?l.contains(f):l.compareDocumentPosition?!!(l.compareDocumentPosition(f)&16):!1:!1}function ye(){for(var l=window,f=Dt();f instanceof l.HTMLIFrameElement;){try{var v=typeof f.contentWindow.location.href=="string"}catch{v=!1}if(v)l=f.contentWindow;else break;f=Dt(l.document)}return f}function ve(l){var f=l&&l.nodeName&&l.nodeName.toLowerCase();return f&&(f==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||f==="textarea"||l.contentEditable==="true")}function ke(l){var f=ye(),v=l.focusedElem,j=l.selectionRange;if(f!==v&&v&&v.ownerDocument&&_e(v.ownerDocument.documentElement,v)){if(j!==null&&ve(v)){if(f=j.start,l=j.end,l===void 0&&(l=f),"selectionStart"in v)v.selectionStart=f,v.selectionEnd=Math.min(l,v.value.length);else if(l=(f=v.ownerDocument||document)&&f.defaultView||window,l.getSelection){l=l.getSelection();var N=v.textContent.length,F=Math.min(j.start,N);j=j.end===void 0?F:Math.min(j.end,N),!l.extend&&F>j&&(N=j,j=F,F=N),N=we(v,F);var Y=we(v,j);N&&Y&&(l.rangeCount!==1||l.anchorNode!==N.node||l.anchorOffset!==N.offset||l.focusNode!==Y.node||l.focusOffset!==Y.offset)&&(f=f.createRange(),f.setStart(N.node,N.offset),l.removeAllRanges(),F>j?(l.addRange(f),l.extend(Y.node,Y.offset)):(f.setEnd(Y.node,Y.offset),l.addRange(f)))}}for(f=[],l=v;l=l.parentNode;)l.nodeType===1&&f.push({element:l,left:l.scrollLeft,top:l.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v=document.documentMode,Ae=null,Ve=null,Je=null,at=!1;function ut(l,f,v){var j=v.window===v?v.document:v.nodeType===9?v:v.ownerDocument;at||Ae==null||Ae!==Dt(j)||(j=Ae,"selectionStart"in j&&ve(j)?j={start:j.selectionStart,end:j.selectionEnd}:(j=(j.ownerDocument&&j.ownerDocument.defaultView||window).getSelection(),j={anchorNode:j.anchorNode,anchorOffset:j.anchorOffset,focusNode:j.focusNode,focusOffset:j.focusOffset}),Je&&pe(Je,j)||(Je=j,j=S(Ve,"onSelect"),0bd||(l.current=_x[bd],_x[bd]=null,bd--)}function hr(l,f){bd++,_x[bd]=l.current,l.current=f}var Zu={},xa=Gu(Zu),ho=Gu(!1),nf=Zu;function xd(l,f){var v=l.type.contextTypes;if(!v)return Zu;var j=l.stateNode;if(j&&j.__reactInternalMemoizedUnmaskedChildContext===f)return j.__reactInternalMemoizedMaskedChildContext;var N={},F;for(F in v)N[F]=f[F];return j&&(l=l.stateNode,l.__reactInternalMemoizedUnmaskedChildContext=f,l.__reactInternalMemoizedMaskedChildContext=N),N}function po(l){return l=l.childContextTypes,l!=null}function Hg(){br(ho),br(xa)}function Bk(l,f,v){if(xa.current!==Zu)throw Error(n(168));hr(xa,f),hr(ho,v)}function $k(l,f,v){var j=l.stateNode;if(f=f.childContextTypes,typeof j.getChildContext!="function")return v;j=j.getChildContext();for(var N in j)if(!(N in f))throw Error(n(108,Ye(l)||"Unknown",N));return ae({},v,j)}function Gg(l){return l=(l=l.stateNode)&&l.__reactInternalMemoizedMergedChildContext||Zu,nf=xa.current,hr(xa,l),hr(ho,ho.current),!0}function Fk(l,f,v){var j=l.stateNode;if(!j)throw Error(n(169));v?(l=$k(l,f,nf),j.__reactInternalMemoizedMergedChildContext=l,br(ho),br(xa),hr(xa,l)):br(ho),hr(ho,v)}var iu=null,Zg=!1,Sx=!1;function qk(l){iu===null?iu=[l]:iu.push(l)}function mK(l){Zg=!0,qk(l)}function Yu(){if(!Sx&&iu!==null){Sx=!0;var l=0,f=un;try{var v=iu;for(un=1;l>=Y,N-=Y,au=1<<32-ft(f)+N|v<en?(Fi=Gt,Gt=null):Fi=Gt.sibling;var Kn=et(Re,Gt,De[en],ot);if(Kn===null){Gt===null&&(Gt=Fi);break}l&&Gt&&Kn.alternate===null&&f(Re,Gt),Pe=F(Kn,Pe,en),Ht===null?It=Kn:Ht.sibling=Kn,Ht=Kn,Gt=Fi}if(en===De.length)return v(Re,Gt),jr&&af(Re,en),It;if(Gt===null){for(;enen?(Fi=Gt,Gt=null):Fi=Gt.sibling;var ac=et(Re,Gt,Kn.value,ot);if(ac===null){Gt===null&&(Gt=Fi);break}l&&Gt&&ac.alternate===null&&f(Re,Gt),Pe=F(ac,Pe,en),Ht===null?It=ac:Ht.sibling=ac,Ht=ac,Gt=Fi}if(Kn.done)return v(Re,Gt),jr&&af(Re,en),It;if(Gt===null){for(;!Kn.done;en++,Kn=De.next())Kn=nt(Re,Kn.value,ot),Kn!==null&&(Pe=F(Kn,Pe,en),Ht===null?It=Kn:Ht.sibling=Kn,Ht=Kn);return jr&&af(Re,en),It}for(Gt=j(Re,Gt);!Kn.done;en++,Kn=De.next())Kn=wt(Gt,Re,en,Kn.value,ot),Kn!==null&&(l&&Kn.alternate!==null&&Gt.delete(Kn.key===null?en:Kn.key),Pe=F(Kn,Pe,en),Ht===null?It=Kn:Ht.sibling=Kn,Ht=Kn);return l&&Gt.forEach(function(ZK){return f(Re,ZK)}),jr&&af(Re,en),It}function Qr(Re,Pe,De,ot){if(typeof De=="object"&&De!==null&&De.type===$&&De.key===null&&(De=De.props.children),typeof De=="object"&&De!==null){switch(De.$$typeof){case I:e:{for(var It=De.key,Ht=Pe;Ht!==null;){if(Ht.key===It){if(It=De.type,It===$){if(Ht.tag===7){v(Re,Ht.sibling),Pe=N(Ht,De.props.children),Pe.return=Re,Re=Pe;break e}}else if(Ht.elementType===It||typeof It=="object"&&It!==null&&It.$$typeof===fe&&Hk(It)===Ht.type){v(Re,Ht.sibling),Pe=N(Ht,De.props),Pe.ref=wp(Re,Ht,De),Pe.return=Re,Re=Pe;break e}v(Re,Ht);break}else f(Re,Ht);Ht=Ht.sibling}De.type===$?(Pe=hf(De.props.children,Re.mode,ot,De.key),Pe.return=Re,Re=Pe):(ot=Sv(De.type,De.key,De.props,null,Re.mode,ot),ot.ref=wp(Re,Pe,De),ot.return=Re,Re=ot)}return Y(Re);case R:e:{for(Ht=De.key;Pe!==null;){if(Pe.key===Ht)if(Pe.tag===4&&Pe.stateNode.containerInfo===De.containerInfo&&Pe.stateNode.implementation===De.implementation){v(Re,Pe.sibling),Pe=N(Pe,De.children||[]),Pe.return=Re,Re=Pe;break e}else{v(Re,Pe);break}else f(Re,Pe);Pe=Pe.sibling}Pe=xw(De,Re.mode,ot),Pe.return=Re,Re=Pe}return Y(Re);case fe:return Ht=De._init,Qr(Re,Pe,Ht(De._payload),ot)}if($r(De))return At(Re,Pe,De,ot);if(Ce(De))return Nt(Re,Pe,De,ot);Jg(Re,De)}return typeof De=="string"&&De!==""||typeof De=="number"?(De=""+De,Pe!==null&&Pe.tag===6?(v(Re,Pe.sibling),Pe=N(Pe,De),Pe.return=Re,Re=Pe):(v(Re,Pe),Pe=bw(De,Re.mode,ot),Pe.return=Re,Re=Pe),Y(Re)):v(Re,Pe)}return Qr}var Pd=Gk(!0),Zk=Gk(!1),ev=Gu(null),tv=null,jd=null,Ax=null;function kx(){Ax=jd=tv=null}function Cx(l){var f=ev.current;br(ev),l._currentValue=f}function Nx(l,f,v){for(;l!==null;){var j=l.alternate;if((l.childLanes&f)!==f?(l.childLanes|=f,j!==null&&(j.childLanes|=f)):j!==null&&(j.childLanes&f)!==f&&(j.childLanes|=f),l===v)break;l=l.return}}function Od(l,f){tv=l,Ax=jd=null,l=l.dependencies,l!==null&&l.firstContext!==null&&((l.lanes&f)!==0&&(mo=!0),l.firstContext=null)}function ls(l){var f=l._currentValue;if(Ax!==l)if(l={context:l,memoizedValue:f,next:null},jd===null){if(tv===null)throw Error(n(308));jd=l,tv.dependencies={lanes:0,firstContext:l}}else jd=jd.next=l;return f}var of=null;function Mx(l){of===null?of=[l]:of.push(l)}function Yk(l,f,v,j){var N=f.interleaved;return N===null?(v.next=v,Mx(f)):(v.next=N.next,N.next=v),f.interleaved=v,su(l,j)}function su(l,f){l.lanes|=f;var v=l.alternate;for(v!==null&&(v.lanes|=f),v=l,l=l.return;l!==null;)l.childLanes|=f,v=l.alternate,v!==null&&(v.childLanes|=f),v=l,l=l.return;return v.tag===3?v.stateNode:null}var Xu=!1;function Rx(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xk(l,f){l=l.updateQueue,f.updateQueue===l&&(f.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,effects:l.effects})}function lu(l,f){return{eventTime:l,lane:f,tag:0,payload:null,callback:null,next:null}}function Qu(l,f,v){var j=l.updateQueue;if(j===null)return null;if(j=j.shared,(Fn&2)!==0){var N=j.pending;return N===null?f.next=f:(f.next=N.next,N.next=f),j.pending=f,su(l,v)}return N=j.interleaved,N===null?(f.next=f,Mx(j)):(f.next=N.next,N.next=f),j.interleaved=f,su(l,v)}function nv(l,f,v){if(f=f.updateQueue,f!==null&&(f=f.shared,(v&4194240)!==0)){var j=f.lanes;j&=l.pendingLanes,v|=j,f.lanes=v,zr(l,v)}}function Qk(l,f){var v=l.updateQueue,j=l.alternate;if(j!==null&&(j=j.updateQueue,v===j)){var N=null,F=null;if(v=v.firstBaseUpdate,v!==null){do{var Y={eventTime:v.eventTime,lane:v.lane,tag:v.tag,payload:v.payload,callback:v.callback,next:null};F===null?N=F=Y:F=F.next=Y,v=v.next}while(v!==null);F===null?N=F=f:F=F.next=f}else N=F=f;v={baseState:j.baseState,firstBaseUpdate:N,lastBaseUpdate:F,shared:j.shared,effects:j.effects},l.updateQueue=v;return}l=v.lastBaseUpdate,l===null?v.firstBaseUpdate=f:l.next=f,v.lastBaseUpdate=f}function rv(l,f,v,j){var N=l.updateQueue;Xu=!1;var F=N.firstBaseUpdate,Y=N.lastBaseUpdate,se=N.shared.pending;if(se!==null){N.shared.pending=null;var ge=se,qe=ge.next;ge.next=null,Y===null?F=qe:Y.next=qe,Y=ge;var tt=l.alternate;tt!==null&&(tt=tt.updateQueue,se=tt.lastBaseUpdate,se!==Y&&(se===null?tt.firstBaseUpdate=qe:se.next=qe,tt.lastBaseUpdate=ge))}if(F!==null){var nt=N.baseState;Y=0,tt=qe=ge=null,se=F;do{var et=se.lane,wt=se.eventTime;if((j&et)===et){tt!==null&&(tt=tt.next={eventTime:wt,lane:0,tag:se.tag,payload:se.payload,callback:se.callback,next:null});e:{var At=l,Nt=se;switch(et=f,wt=v,Nt.tag){case 1:if(At=Nt.payload,typeof At=="function"){nt=At.call(wt,nt,et);break e}nt=At;break e;case 3:At.flags=At.flags&-65537|128;case 0:if(At=Nt.payload,et=typeof At=="function"?At.call(wt,nt,et):At,et==null)break e;nt=ae({},nt,et);break e;case 2:Xu=!0}}se.callback!==null&&se.lane!==0&&(l.flags|=64,et=N.effects,et===null?N.effects=[se]:et.push(se))}else wt={eventTime:wt,lane:et,tag:se.tag,payload:se.payload,callback:se.callback,next:null},tt===null?(qe=tt=wt,ge=nt):tt=tt.next=wt,Y|=et;if(se=se.next,se===null){if(se=N.shared.pending,se===null)break;et=se,se=et.next,et.next=null,N.lastBaseUpdate=et,N.shared.pending=null}}while(!0);if(tt===null&&(ge=nt),N.baseState=ge,N.firstBaseUpdate=qe,N.lastBaseUpdate=tt,f=N.shared.interleaved,f!==null){N=f;do Y|=N.lane,N=N.next;while(N!==f)}else F===null&&(N.shared.lanes=0);uf|=Y,l.lanes=Y,l.memoizedState=nt}}function Jk(l,f,v){if(l=f.effects,f.effects=null,l!==null)for(f=0;fv?v:4,l(!0);var j=$x.transition;$x.transition={};try{l(!1),f()}finally{un=v,$x.transition=j}}function yC(){return us().memoizedState}function bK(l,f,v){var j=nc(l);if(v={lane:j,action:v,hasEagerState:!1,eagerState:null,next:null},bC(l))xC(f,v);else if(v=Yk(l,f,v,j),v!==null){var N=Ka();Ys(v,l,j,N),wC(v,f,j)}}function xK(l,f,v){var j=nc(l),N={lane:j,action:v,hasEagerState:!1,eagerState:null,next:null};if(bC(l))xC(f,N);else{var F=l.alternate;if(l.lanes===0&&(F===null||F.lanes===0)&&(F=f.lastRenderedReducer,F!==null))try{var Y=f.lastRenderedState,se=F(Y,v);if(N.hasEagerState=!0,N.eagerState=se,Ee(se,Y)){var ge=f.interleaved;ge===null?(N.next=N,Mx(f)):(N.next=ge.next,ge.next=N),f.interleaved=N;return}}catch{}finally{}v=Yk(l,f,N,j),v!==null&&(N=Ka(),Ys(v,l,j,N),wC(v,f,j))}}function bC(l){var f=l.alternate;return l===Lr||f!==null&&f===Lr}function xC(l,f){jp=ov=!0;var v=l.pending;v===null?f.next=f:(f.next=v.next,v.next=f),l.pending=f}function wC(l,f,v){if((v&4194240)!==0){var j=f.lanes;j&=l.pendingLanes,v|=j,f.lanes=v,zr(l,v)}}var uv={readContext:ls,useCallback:wa,useContext:wa,useEffect:wa,useImperativeHandle:wa,useInsertionEffect:wa,useLayoutEffect:wa,useMemo:wa,useReducer:wa,useRef:wa,useState:wa,useDebugValue:wa,useDeferredValue:wa,useTransition:wa,useMutableSource:wa,useSyncExternalStore:wa,useId:wa,unstable_isNewReconciler:!1},wK={readContext:ls,useCallback:function(l,f){return Pl().memoizedState=[l,f===void 0?null:f],l},useContext:ls,useEffect:cC,useImperativeHandle:function(l,f,v){return v=v!=null?v.concat([l]):null,sv(4194308,4,hC.bind(null,f,l),v)},useLayoutEffect:function(l,f){return sv(4194308,4,l,f)},useInsertionEffect:function(l,f){return sv(4,2,l,f)},useMemo:function(l,f){var v=Pl();return f=f===void 0?null:f,l=l(),v.memoizedState=[l,f],l},useReducer:function(l,f,v){var j=Pl();return f=v!==void 0?v(f):f,j.memoizedState=j.baseState=f,l={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:f},j.queue=l,l=l.dispatch=bK.bind(null,Lr,l),[j.memoizedState,l]},useRef:function(l){var f=Pl();return l={current:l},f.memoizedState=l},useState:lC,useDebugValue:Kx,useDeferredValue:function(l){return Pl().memoizedState=l},useTransition:function(){var l=lC(!1),f=l[0];return l=yK.bind(null,l[1]),Pl().memoizedState=l,[f,l]},useMutableSource:function(){},useSyncExternalStore:function(l,f,v){var j=Lr,N=Pl();if(jr){if(v===void 0)throw Error(n(407));v=v()}else{if(v=f(),$i===null)throw Error(n(349));(lf&30)!==0||rC(j,f,v)}N.memoizedState=v;var F={value:v,getSnapshot:f};return N.queue=F,cC(aC.bind(null,j,F,l),[l]),j.flags|=2048,Ep(9,iC.bind(null,j,F,v,f),void 0,null),v},useId:function(){var l=Pl(),f=$i.identifierPrefix;if(jr){var v=ou,j=au;v=(j&~(1<<32-ft(j)-1)).toString(32)+v,f=":"+f+"R"+v,v=Op++,0<\/script>",l=l.removeChild(l.firstChild)):typeof j.is=="string"?l=Y.createElement(v,{is:j.is}):(l=Y.createElement(v),v==="select"&&(Y=l,j.multiple?Y.multiple=!0:j.size&&(Y.size=j.size))):l=Y.createElementNS(l,v),l[as]=f,l[Ku]=j,qC(l,f,!1,!1),f.stateNode=l;e:{switch(Y=Ci(v,j),v){case"dialog":rr("cancel",l),rr("close",l),N=j;break;case"iframe":case"object":case"embed":rr("load",l),N=j;break;case"video":case"audio":for(N=0;NCd&&(f.flags|=128,j=!0,Ap(F,!1),f.lanes=4194304)}else{if(!j)if(l=iv(Y),l!==null){if(f.flags|=128,j=!0,v=l.updateQueue,v!==null&&(f.updateQueue=v,f.flags|=4),Ap(F,!0),F.tail===null&&F.tailMode==="hidden"&&!Y.alternate&&!jr)return _a(f),null}else 2*jn()-F.renderingStartTime>Cd&&v!==1073741824&&(f.flags|=128,j=!0,Ap(F,!1),f.lanes=4194304);F.isBackwards?(Y.sibling=f.child,f.child=Y):(v=F.last,v!==null?v.sibling=Y:f.child=Y,F.last=Y)}return F.tail!==null?(f=F.tail,F.rendering=f,F.tail=f.sibling,F.renderingStartTime=jn(),f.sibling=null,v=Rr.current,hr(Rr,j?v&1|2:v&1),f):(_a(f),null);case 22:case 23:return gw(),j=f.memoizedState!==null,l!==null&&l.memoizedState!==null!==j&&(f.flags|=8192),j&&(f.mode&1)!==0?(Do&1073741824)!==0&&(_a(f),f.subtreeFlags&6&&(f.flags|=8192)):_a(f),null;case 24:return null;case 25:return null}throw Error(n(156,f.tag))}function AK(l,f){switch(jx(f),f.tag){case 1:return po(f.type)&&Hg(),l=f.flags,l&65536?(f.flags=l&-65537|128,f):null;case 3:return Td(),br(ho),br(xa),Bx(),l=f.flags,(l&65536)!==0&&(l&128)===0?(f.flags=l&-65537|128,f):null;case 5:return Ix(f),null;case 13:if(br(Rr),l=f.memoizedState,l!==null&&l.dehydrated!==null){if(f.alternate===null)throw Error(n(340));Sd()}return l=f.flags,l&65536?(f.flags=l&-65537|128,f):null;case 19:return br(Rr),null;case 4:return Td(),null;case 10:return Cx(f.type._context),null;case 22:case 23:return gw(),null;case 24:return null;default:return null}}var hv=!1,Sa=!1,kK=typeof WeakSet=="function"?WeakSet:Set,Ot=null;function Ad(l,f){var v=l.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(j){Ur(l,f,j)}else v.current=null}function iw(l,f,v){try{v()}catch(j){Ur(l,f,j)}}var VC=!1;function CK(l,f){if(yt=Ge,l=ye(),ve(l)){if("selectionStart"in l)var v={start:l.selectionStart,end:l.selectionEnd};else e:{v=(v=l.ownerDocument)&&v.defaultView||window;var j=v.getSelection&&v.getSelection();if(j&&j.rangeCount!==0){v=j.anchorNode;var N=j.anchorOffset,F=j.focusNode;j=j.focusOffset;try{v.nodeType,F.nodeType}catch{v=null;break e}var Y=0,se=-1,ge=-1,qe=0,tt=0,nt=l,et=null;t:for(;;){for(var wt;nt!==v||N!==0&&nt.nodeType!==3||(se=Y+N),nt!==F||j!==0&&nt.nodeType!==3||(ge=Y+j),nt.nodeType===3&&(Y+=nt.nodeValue.length),(wt=nt.firstChild)!==null;)et=nt,nt=wt;for(;;){if(nt===l)break t;if(et===v&&++qe===N&&(se=Y),et===F&&++tt===j&&(ge=Y),(wt=nt.nextSibling)!==null)break;nt=et,et=nt.parentNode}nt=wt}v=se===-1||ge===-1?null:{start:se,end:ge}}else v=null}v=v||{start:0,end:0}}else v=null;for(Wt={focusedElem:l,selectionRange:v},Ge=!1,Ot=f;Ot!==null;)if(f=Ot,l=f.child,(f.subtreeFlags&1028)!==0&&l!==null)l.return=f,Ot=l;else for(;Ot!==null;){f=Ot;try{var At=f.alternate;if((f.flags&1024)!==0)switch(f.tag){case 0:case 11:case 15:break;case 1:if(At!==null){var Nt=At.memoizedProps,Qr=At.memoizedState,Re=f.stateNode,Pe=Re.getSnapshotBeforeUpdate(f.elementType===f.type?Nt:Hs(f.type,Nt),Qr);Re.__reactInternalSnapshotBeforeUpdate=Pe}break;case 3:var De=f.stateNode.containerInfo;De.nodeType===1?De.textContent="":De.nodeType===9&&De.documentElement&&De.removeChild(De.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ot){Ur(f,f.return,ot)}if(l=f.sibling,l!==null){l.return=f.return,Ot=l;break}Ot=f.return}return At=VC,VC=!1,At}function kp(l,f,v){var j=f.updateQueue;if(j=j!==null?j.lastEffect:null,j!==null){var N=j=j.next;do{if((N.tag&l)===l){var F=N.destroy;N.destroy=void 0,F!==void 0&&iw(f,v,F)}N=N.next}while(N!==j)}}function pv(l,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&l)===l){var j=v.create;v.destroy=j()}v=v.next}while(v!==f)}}function aw(l){var f=l.ref;if(f!==null){var v=l.stateNode;switch(l.tag){case 5:l=v;break;default:l=v}typeof f=="function"?f(l):f.current=l}}function WC(l){var f=l.alternate;f!==null&&(l.alternate=null,WC(f)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(f=l.stateNode,f!==null&&(delete f[as],delete f[Ku],delete f[Hu],delete f[xx],delete f[wx])),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}function KC(l){return l.tag===5||l.tag===3||l.tag===4}function HC(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||KC(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function ow(l,f,v){var j=l.tag;if(j===5||j===6)l=l.stateNode,f?v.nodeType===8?v.parentNode.insertBefore(l,f):v.insertBefore(l,f):(v.nodeType===8?(f=v.parentNode,f.insertBefore(l,v)):(f=v,f.appendChild(l)),v=v._reactRootContainer,v!=null||f.onclick!==null||(f.onclick=Xe));else if(j!==4&&(l=l.child,l!==null))for(ow(l,f,v),l=l.sibling;l!==null;)ow(l,f,v),l=l.sibling}function sw(l,f,v){var j=l.tag;if(j===5||j===6)l=l.stateNode,f?v.insertBefore(l,f):v.appendChild(l);else if(j!==4&&(l=l.child,l!==null))for(sw(l,f,v),l=l.sibling;l!==null;)sw(l,f,v),l=l.sibling}var na=null,Gs=!1;function Ju(l,f,v){for(v=v.child;v!==null;)GC(l,f,v),v=v.sibling}function GC(l,f,v){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(pi,v)}catch{}switch(v.tag){case 5:Sa||Ad(v,f);case 6:var j=na,N=Gs;na=null,Ju(l,f,v),na=j,Gs=N,na!==null&&(Gs?(l=na,v=v.stateNode,l.nodeType===8?l.parentNode.removeChild(v):l.removeChild(v)):na.removeChild(v.stateNode));break;case 18:na!==null&&(Gs?(l=na,v=v.stateNode,l.nodeType===8?xp(l.parentNode,v):l.nodeType===1&&xp(l,v),xe(l)):xp(na,v.stateNode));break;case 4:j=na,N=Gs,na=v.stateNode.containerInfo,Gs=!0,Ju(l,f,v),na=j,Gs=N;break;case 0:case 11:case 14:case 15:if(!Sa&&(j=v.updateQueue,j!==null&&(j=j.lastEffect,j!==null))){N=j=j.next;do{var F=N,Y=F.destroy;F=F.tag,Y!==void 0&&((F&2)!==0||(F&4)!==0)&&iw(v,f,Y),N=N.next}while(N!==j)}Ju(l,f,v);break;case 1:if(!Sa&&(Ad(v,f),j=v.stateNode,typeof j.componentWillUnmount=="function"))try{j.props=v.memoizedProps,j.state=v.memoizedState,j.componentWillUnmount()}catch(se){Ur(v,f,se)}Ju(l,f,v);break;case 21:Ju(l,f,v);break;case 22:v.mode&1?(Sa=(j=Sa)||v.memoizedState!==null,Ju(l,f,v),Sa=j):Ju(l,f,v);break;default:Ju(l,f,v)}}function ZC(l){var f=l.updateQueue;if(f!==null){l.updateQueue=null;var v=l.stateNode;v===null&&(v=l.stateNode=new kK),f.forEach(function(j){var N=FK.bind(null,l,j);v.has(j)||(v.add(j),j.then(N,N))})}}function Zs(l,f){var v=f.deletions;if(v!==null)for(var j=0;jN&&(N=Y),j&=~F}if(j=N,j=jn()-j,j=(120>j?120:480>j?480:1080>j?1080:1920>j?1920:3e3>j?3e3:4320>j?4320:1960*MK(j/1960))-j,10l?16:l,tc===null)var j=!1;else{if(l=tc,tc=null,bv=0,(Fn&6)!==0)throw Error(n(331));var N=Fn;for(Fn|=4,Ot=l.current;Ot!==null;){var F=Ot,Y=F.child;if((Ot.flags&16)!==0){var se=F.deletions;if(se!==null){for(var ge=0;gejn()-cw?ff(l,0):uw|=v),vo(l,f)}function lN(l,f){f===0&&((l.mode&1)===0?f=1:(f=No,No<<=1,(No&130023424)===0&&(No=4194304)));var v=Ka();l=su(l,f),l!==null&&(gi(l,f,v),vo(l,v))}function $K(l){var f=l.memoizedState,v=0;f!==null&&(v=f.retryLane),lN(l,v)}function FK(l,f){var v=0;switch(l.tag){case 13:var j=l.stateNode,N=l.memoizedState;N!==null&&(v=N.retryLane);break;case 19:j=l.stateNode;break;default:throw Error(n(314))}j!==null&&j.delete(f),lN(l,v)}var uN;uN=function(l,f,v){if(l!==null)if(l.memoizedProps!==f.pendingProps||ho.current)mo=!0;else{if((l.lanes&v)===0&&(f.flags&128)===0)return mo=!1,TK(l,f,v);mo=(l.flags&131072)!==0}else mo=!1,jr&&(f.flags&1048576)!==0&&zk(f,Xg,f.index);switch(f.lanes=0,f.tag){case 2:var j=f.type;dv(l,f),l=f.pendingProps;var N=xd(f,xa.current);Od(f,v),N=qx(null,f,j,l,N,v);var F=zx();return f.flags|=1,typeof N=="object"&&N!==null&&typeof N.render=="function"&&N.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,po(j)?(F=!0,Gg(f)):F=!1,f.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,Rx(f),N.updater=cv,f.stateNode=N,N._reactInternals=f,Gx(f,j,l,v),f=Qx(null,f,j,!0,F,v)):(f.tag=0,jr&&F&&Px(f),Wa(null,f,N,v),f=f.child),f;case 16:j=f.elementType;e:{switch(dv(l,f),l=f.pendingProps,N=j._init,j=N(j._payload),f.type=j,N=f.tag=zK(j),l=Hs(j,l),N){case 0:f=Xx(null,f,j,l,v);break e;case 1:f=LC(null,f,j,l,v);break e;case 11:f=kC(null,f,j,l,v);break e;case 14:f=CC(null,f,j,Hs(j.type,l),v);break e}throw Error(n(306,j,""))}return f;case 0:return j=f.type,N=f.pendingProps,N=f.elementType===j?N:Hs(j,N),Xx(l,f,j,N,v);case 1:return j=f.type,N=f.pendingProps,N=f.elementType===j?N:Hs(j,N),LC(l,f,j,N,v);case 3:e:{if(IC(f),l===null)throw Error(n(387));j=f.pendingProps,F=f.memoizedState,N=F.element,Xk(l,f),rv(f,j,null,v);var Y=f.memoizedState;if(j=Y.element,F.isDehydrated)if(F={element:j,isDehydrated:!1,cache:Y.cache,pendingSuspenseBoundaries:Y.pendingSuspenseBoundaries,transitions:Y.transitions},f.updateQueue.baseState=F,f.memoizedState=F,f.flags&256){N=Ed(Error(n(423)),f),f=DC(l,f,j,v,N);break e}else if(j!==N){N=Ed(Error(n(424)),f),f=DC(l,f,j,v,N);break e}else for(Io=_l(f.stateNode.containerInfo.firstChild),Lo=f,jr=!0,Ks=null,v=Zk(f,null,j,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(Sd(),j===N){f=uu(l,f,v);break e}Wa(l,f,j,v)}f=f.child}return f;case 5:return eC(f),l===null&&Tx(f),j=f.type,N=f.pendingProps,F=l!==null?l.memoizedProps:null,Y=N.children,hn(j,N)?Y=null:F!==null&&hn(j,F)&&(f.flags|=32),RC(l,f),Wa(l,f,Y,v),f.child;case 6:return l===null&&Tx(f),null;case 13:return BC(l,f,v);case 4:return Lx(f,f.stateNode.containerInfo),j=f.pendingProps,l===null?f.child=Pd(f,null,j,v):Wa(l,f,j,v),f.child;case 11:return j=f.type,N=f.pendingProps,N=f.elementType===j?N:Hs(j,N),kC(l,f,j,N,v);case 7:return Wa(l,f,f.pendingProps,v),f.child;case 8:return Wa(l,f,f.pendingProps.children,v),f.child;case 12:return Wa(l,f,f.pendingProps.children,v),f.child;case 10:e:{if(j=f.type._context,N=f.pendingProps,F=f.memoizedProps,Y=N.value,hr(ev,j._currentValue),j._currentValue=Y,F!==null)if(Ee(F.value,Y)){if(F.children===N.children&&!ho.current){f=uu(l,f,v);break e}}else for(F=f.child,F!==null&&(F.return=f);F!==null;){var se=F.dependencies;if(se!==null){Y=F.child;for(var ge=se.firstContext;ge!==null;){if(ge.context===j){if(F.tag===1){ge=lu(-1,v&-v),ge.tag=2;var qe=F.updateQueue;if(qe!==null){qe=qe.shared;var tt=qe.pending;tt===null?ge.next=ge:(ge.next=tt.next,tt.next=ge),qe.pending=ge}}F.lanes|=v,ge=F.alternate,ge!==null&&(ge.lanes|=v),Nx(F.return,v,f),se.lanes|=v;break}ge=ge.next}}else if(F.tag===10)Y=F.type===f.type?null:F.child;else if(F.tag===18){if(Y=F.return,Y===null)throw Error(n(341));Y.lanes|=v,se=Y.alternate,se!==null&&(se.lanes|=v),Nx(Y,v,f),Y=F.sibling}else Y=F.child;if(Y!==null)Y.return=F;else for(Y=F;Y!==null;){if(Y===f){Y=null;break}if(F=Y.sibling,F!==null){F.return=Y.return,Y=F;break}Y=Y.return}F=Y}Wa(l,f,N.children,v),f=f.child}return f;case 9:return N=f.type,j=f.pendingProps.children,Od(f,v),N=ls(N),j=j(N),f.flags|=1,Wa(l,f,j,v),f.child;case 14:return j=f.type,N=Hs(j,f.pendingProps),N=Hs(j.type,N),CC(l,f,j,N,v);case 15:return NC(l,f,f.type,f.pendingProps,v);case 17:return j=f.type,N=f.pendingProps,N=f.elementType===j?N:Hs(j,N),dv(l,f),f.tag=1,po(j)?(l=!0,Gg(f)):l=!1,Od(f,v),SC(f,j,N),Gx(f,j,N,v),Qx(null,f,j,!0,l,v);case 19:return FC(l,f,v);case 22:return MC(l,f,v)}throw Error(n(156,f.tag))};function cN(l,f){return vl(l,f)}function qK(l,f,v,j){this.tag=l,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=j,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fs(l,f,v,j){return new qK(l,f,v,j)}function yw(l){return l=l.prototype,!(!l||!l.isReactComponent)}function zK(l){if(typeof l=="function")return yw(l)?1:0;if(l!=null){if(l=l.$$typeof,l===ne)return 11;if(l===Se)return 14}return 2}function ic(l,f){var v=l.alternate;return v===null?(v=fs(l.tag,f,l.key,l.mode),v.elementType=l.elementType,v.type=l.type,v.stateNode=l.stateNode,v.alternate=l,l.alternate=v):(v.pendingProps=f,v.type=l.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=l.flags&14680064,v.childLanes=l.childLanes,v.lanes=l.lanes,v.child=l.child,v.memoizedProps=l.memoizedProps,v.memoizedState=l.memoizedState,v.updateQueue=l.updateQueue,f=l.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=l.sibling,v.index=l.index,v.ref=l.ref,v}function Sv(l,f,v,j,N,F){var Y=2;if(j=l,typeof l=="function")yw(l)&&(Y=1);else if(typeof l=="string")Y=5;else e:switch(l){case $:return hf(v.children,N,F,f);case V:Y=8,N|=8;break;case K:return l=fs(12,v,f,N|2),l.elementType=K,l.lanes=F,l;case oe:return l=fs(13,v,f,N),l.elementType=oe,l.lanes=F,l;case he:return l=fs(19,v,f,N),l.elementType=he,l.lanes=F,l;case Oe:return Pv(v,N,F,f);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Z:Y=10;break e;case ee:Y=9;break e;case ne:Y=11;break e;case Se:Y=14;break e;case fe:Y=16,j=null;break e}throw Error(n(130,l==null?l:typeof l,""))}return f=fs(Y,v,f,N),f.elementType=l,f.type=j,f.lanes=F,f}function hf(l,f,v,j){return l=fs(7,l,j,f),l.lanes=v,l}function Pv(l,f,v,j){return l=fs(22,l,j,f),l.elementType=Oe,l.lanes=v,l.stateNode={isHidden:!1},l}function bw(l,f,v){return l=fs(6,l,null,f),l.lanes=v,l}function xw(l,f,v){return f=fs(4,l.children!==null?l.children:[],l.key,f),f.lanes=v,f.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},f}function UK(l,f,v,j,N){this.tag=f,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ma(0),this.expirationTimes=ma(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ma(0),this.identifierPrefix=j,this.onRecoverableError=N,this.mutableSourceEagerHydrationData=null}function ww(l,f,v,j,N,F,Y,se,ge){return l=new UK(l,f,v,se,ge),f===1?(f=1,F===!0&&(f|=8)):f=0,F=fs(3,null,null,f),l.current=F,F.stateNode=l,F.memoizedState={element:j,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},Rx(F),l}function VK(l,f,v){var j=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ew.exports=iH(),Ew.exports}var jN;function aH(){if(jN)return Nv;jN=1;var e=W$();return Nv.createRoot=e.createRoot,Nv.hydrateRoot=e.hydrateRoot,Nv}var oH=aH();const sH=In(oH),lH=20,uH=1e6,bu={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Cw=0;function cH(){return Cw=(Cw+1)%Number.MAX_VALUE,Cw.toString()}const Nw=new Map,ON=e=>{if(Nw.has(e))return;const t=setTimeout(()=>{Nw.delete(e),fm({type:bu.REMOVE_TOAST,toastId:e})},uH);Nw.set(e,t)},fH=(e,t)=>{switch(t.type){case bu.ADD_TOAST:return{...e,toasts:[t.toast,...e.toasts].slice(0,lH)};case bu.UPDATE_TOAST:return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case bu.DISMISS_TOAST:{const{toastId:n}=t;return n?ON(n):e.toasts.forEach(r=>{ON(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case bu.REMOVE_TOAST:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},uy=[];let cy={toasts:[]};function fm(e){cy=fH(cy,e),uy.forEach(t=>{t(cy)})}function dH({...e}){const t=cH(),n=i=>fm({type:bu.UPDATE_TOAST,toast:{...i,id:t}}),r=()=>fm({type:bu.DISMISS_TOAST,toastId:t});return fm({type:bu.ADD_TOAST,toast:{...e,id:t,open:!0,onOpenChange:i=>{i||r()}}}),{id:t,dismiss:r,update:n}}function hH(){const[e,t]=M.useState(cy);return M.useEffect(()=>(uy.push(t),()=>{const n=uy.indexOf(t);n>-1&&uy.splice(n,1)}),[e]),{...e,toast:dH,dismiss:n=>fm({type:bu.DISMISS_TOAST,toastId:n})}}function K$(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,EN=pn,Q0=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return EN(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:a}=t,o=Object.keys(i).map(d=>{const p=n==null?void 0:n[d],m=a==null?void 0:a[d];if(p===null)return null;const y=TN(p)||TN(m);return i[d][y]}),s=n&&Object.entries(n).reduce((d,p)=>{let[m,y]=p;return y===void 0||(d[m]=y),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,p)=>{let{class:m,className:y,...b}=p;return Object.entries(b).every(P=>{let[x,w]=P;return Array.isArray(w)?w.includes({...a,...s}[x]):{...a,...s}[x]===w})?[...d,m,y]:d},[]);return EN(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H$=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var mH={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.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gH=M.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:a,iconNode:o,...s},c)=>M.createElement("svg",{ref:c,...mH,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:H$("lucide",i),...s},[...o.map(([d,p])=>M.createElement(d,p)),...Array.isArray(a)?a:[a]]));/** * @license lucide-react v0.475.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=(e,t)=>{const n=M.forwardRef(({className:r,...i},a)=>M.createElement(gH,{ref:a,iconNode:t,className:H$(`lucide-${pH(e)}`,r),...i}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vH=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],G$=Ut("ArrowDown",vH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yH=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],J0=Ut("ArrowLeft",yH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bH=[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]],eb=Ut("Bug",bH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xH=[["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"}]],Z$=Ut("Calendar",xH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wH=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],_j=Ut("ChartColumn",wH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _H=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Y$=Ut("Check",_H);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SH=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],X$=Ut("ChevronDown",SH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PH=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],tb=Ut("ChevronRight",PH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jH=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],OH=Ut("ChevronUp",jH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TH=[["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"}]],EH=Ut("CircleAlert",TH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AH=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],la=Ut("CircleCheckBig",AH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kH=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],ph=Ut("CircleX",kH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CH=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],NH=Ut("ClipboardCheck",CH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MH=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],RH=Ut("ClipboardList",MH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LH=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],Hf=Ut("Clock",LH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IH=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]],Q$=Ut("CloudOff",IH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DH=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],JT=Ut("Cloud",DH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BH=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],$H=Ut("CreditCard",BH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FH=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],J$=Ut("Droplets",FH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qH=[["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:"m9 15 2 2 4-4",key:"1grp1n"}]],AN=Ut("FileCheck",qH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zH=[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]],eE=Ut("Filter",zH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UH=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],kN=Ut("LayoutDashboard",UH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VH=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],WH=Ut("LayoutGrid",VH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KH=[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]],ky=Ut("Leaf",KH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HH=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ti=Ut("LoaderCircle",HH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GH=[["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"}]],mh=Ut("LogOut",GH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZH=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],So=Ut("MapPin",ZH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YH=[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]],XH=Ut("MapPinned",YH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QH=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],js=Ut("Map",QH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JH=[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],eF=Ut("Maximize2",JH);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e9=[["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"}]],t9=Ut("Menu",e9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n9=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],r9=Ut("Navigation",n9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i9=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Tc=Ut("Package",i9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a9=[["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"}]],Yh=Ut("Phone",a9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o9=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Dc=Ut("Plus",o9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s9=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],tF=Ut("RefreshCw",s9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l9=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],u9=Ut("RotateCcw",l9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c9=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],nF=Ut("Save",c9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f9=[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]],rF=Ut("Scale",f9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d9=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],tE=Ut("Search",d9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h9=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],iF=Ut("Send",h9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p9=[["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"}]],gh=Ut("Shield",p9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m9=[["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.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aF=Ut("SquarePen",m9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g9=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Mv=Ut("Star",g9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v9=[["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"}]],nb=Ut("Trash2",v9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y9=[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]],sa=Ut("TreePine",y9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b9=[["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"}]],oF=Ut("TrendingUp",b9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x9=[["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-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ul=Ut("TriangleAlert",x9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w9=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],fy=Ut("Truck",w9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _9=[["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"}]],S9=Ut("UserPlus",_9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P9=[["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"}]],zf=Ut("User",P9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j9=[["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"}]],ll=Ut("Users",j9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O9=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Sj=Ut("WifiOff",O9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T9=[["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"}]],Pj=Ut("Wifi",T9);/** * @license lucide-react v0.475.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E9=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],rb=Ut("X",E9),A9=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r({classGroupId:e,validator:t}),sF=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Cy="-",CN=[],C9="arbitrary..",N9=e=>{const t=R9(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return M9(o);const s=o.split(Cy),c=s[0]===""&&s.length>1?1:0;return lF(s,c,t)},getConflictingClassGroupIds:(o,s)=>{if(s){const c=r[o],d=n[o];return c?d?A9(d,c):c:d||CN}return n[o]||CN}}},lF=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const i=e[t],a=n.nextPart.get(i);if(a){const d=lF(e,t+1,a);if(d)return d}const o=n.validators;if(o===null)return;const s=t===0?e.join(Cy):e.slice(t).join(Cy),c=o.length;for(let d=0;de.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?C9+r:void 0})(),R9=e=>{const{theme:t,classGroups:n}=e;return L9(n,t)},L9=(e,t)=>{const n=sF();for(const r in e){const i=e[r];nE(i,n,r,t)}return n},nE=(e,t,n,r)=>{const i=e.length;for(let a=0;a{if(typeof e=="string"){D9(e,t,n);return}if(typeof e=="function"){B9(e,t,n,r);return}$9(e,t,n,r)},D9=(e,t,n)=>{const r=e===""?t:uF(t,e);r.classGroupId=n},B9=(e,t,n,r)=>{if(F9(e)){nE(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(k9(n,e))},$9=(e,t,n,r)=>{const i=Object.entries(e),a=i.length;for(let o=0;o{let n=e;const r=t.split(Cy),i=r.length;for(let a=0;a"isThemeGetter"in e&&e.isThemeGetter===!0,q9=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const i=(a,o)=>{n[a]=o,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let o=n[a];if(o!==void 0)return o;if((o=r[a])!==void 0)return i(a,o),o},set(a,o){a in n?n[a]=o:i(a,o)}}},jj="!",NN=":",z9=[],MN=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),U9=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=i=>{const a=[];let o=0,s=0,c=0,d;const p=i.length;for(let x=0;xc?d-c:void 0;return MN(a,b,y,P)};if(t){const i=t+NN,a=r;r=o=>o.startsWith(i)?a(o.slice(i.length)):MN(z9,!1,o,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},V9=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},W9=e=>({cache:q9(e.cacheSize),parseClassName:U9(e),sortModifiers:V9(e),...N9(e)}),K9=/\s+/,H9=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(K9);let c="";for(let d=s.length-1;d>=0;d-=1){const p=s[d],{isExternal:m,modifiers:y,hasImportantModifier:b,baseClassName:P,maybePostfixModifierPosition:x}=n(p);if(m){c=p+(c.length>0?" "+c:c);continue}let w=!!x,T=r(w?P.substring(0,x):P);if(!T){if(!w){c=p+(c.length>0?" "+c:c);continue}if(T=r(P),!T){c=p+(c.length>0?" "+c:c);continue}w=!1}const E=y.length===0?"":y.length===1?y[0]:a(y).join(":"),k=b?E+jj:E,D=k+T;if(o.indexOf(D)>-1)continue;o.push(D);const I=i(T,w);for(let R=0;R0?" "+c:c)}return c},G9=(...e)=>{let t=0,n,r,i="";for(;t{if(typeof e=="string")return e;let t,n="";for(let r=0;r{let n,r,i,a;const o=c=>{const d=t.reduce((p,m)=>m(p),e());return n=W9(d),r=n.cache.get,i=n.cache.set,a=s,s(c)},s=c=>{const d=r(c);if(d)return d;const p=H9(c,n);return i(c,p),p};return a=o,(...c)=>a(G9(...c))},Y9=[],Si=e=>{const t=n=>n[e]||Y9;return t.isThemeGetter=!0,t},fF=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dF=/^\((?:(\w[\w-]*):)?(.+)\)$/i,X9=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Q9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,J9=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,e7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,t7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,sc=e=>X9.test(e),yn=e=>!!e&&!Number.isNaN(Number(e)),lc=e=>!!e&&Number.isInteger(Number(e)),Mw=e=>e.endsWith("%")&&yn(e.slice(0,-1)),fu=e=>Q9.test(e),hF=()=>!0,r7=e=>J9.test(e)&&!e7.test(e),rE=()=>!1,i7=e=>t7.test(e),a7=e=>n7.test(e),o7=e=>!kt(e)&&!Ct(e),s7=e=>Vc(e,gF,rE),kt=e=>fF.test(e),pf=e=>Vc(e,vF,r7),RN=e=>Vc(e,m7,yn),l7=e=>Vc(e,bF,hF),u7=e=>Vc(e,yF,rE),LN=e=>Vc(e,pF,rE),c7=e=>Vc(e,mF,a7),Rv=e=>Vc(e,xF,i7),Ct=e=>dF.test(e),Ip=e=>ld(e,vF),f7=e=>ld(e,yF),IN=e=>ld(e,pF),d7=e=>ld(e,gF),h7=e=>ld(e,mF),Lv=e=>ld(e,xF,!0),p7=e=>ld(e,bF,!0),Vc=(e,t,n)=>{const r=fF.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},ld=(e,t,n=!1)=>{const r=dF.exec(e);return r?r[1]?t(r[1]):n:!1},pF=e=>e==="position"||e==="percentage",mF=e=>e==="image"||e==="url",gF=e=>e==="length"||e==="size"||e==="bg-size",vF=e=>e==="length",m7=e=>e==="number",yF=e=>e==="family-name",bF=e=>e==="number"||e==="weight",xF=e=>e==="shadow",g7=()=>{const e=Si("color"),t=Si("font"),n=Si("text"),r=Si("font-weight"),i=Si("tracking"),a=Si("leading"),o=Si("breakpoint"),s=Si("container"),c=Si("spacing"),d=Si("radius"),p=Si("shadow"),m=Si("inset-shadow"),y=Si("text-shadow"),b=Si("drop-shadow"),P=Si("blur"),x=Si("perspective"),w=Si("aspect"),T=Si("ease"),E=Si("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...D(),Ct,kt],R=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],V=()=>[Ct,kt,c],K=()=>[sc,"full","auto",...V()],Z=()=>[lc,"none","subgrid",Ct,kt],ee=()=>["auto",{span:["full",lc,Ct,kt]},lc,Ct,kt],ne=()=>[lc,"auto",Ct,kt],oe=()=>["auto","min","max","fr",Ct,kt],he=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Se=()=>["start","end","center","stretch","center-safe","end-safe"],fe=()=>["auto",...V()],Oe=()=>[sc,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],re=()=>[sc,"screen","full","dvw","lvw","svw","min","max","fit",...V()],Ce=()=>[sc,"screen","full","lh","dvh","lvh","svh","min","max","fit",...V()],ae=()=>[e,Ct,kt],ie=()=>[...D(),IN,LN,{position:[Ct,kt]}],de=()=>["no-repeat",{repeat:["","x","y","space","round"]}],He=()=>["auto","cover","contain",d7,s7,{size:[Ct,kt]}],je=()=>[Mw,Ip,pf],$e=()=>["","none","full",d,Ct,kt],We=()=>["",yn,Ip,pf],Ye=()=>["solid","dashed","dotted","double"],rt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ze=()=>[yn,Mw,IN,LN],Fe=()=>["","none",P,Ct,kt],st=()=>["none",yn,Ct,kt],Te=()=>["none",yn,Ct,kt],Dt=()=>[yn,Ct,kt],Lt=()=>[sc,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[fu],breakpoint:[fu],color:[hF],container:[fu],"drop-shadow":[fu],ease:["in","out","in-out"],font:[o7],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[fu],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[fu],shadow:[fu],spacing:["px",yn],text:[fu],"text-shadow":[fu],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",sc,kt,Ct,w]}],container:["container"],columns:[{columns:[yn,kt,Ct,s]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[lc,"auto",Ct,kt]}],basis:[{basis:[sc,"full","auto",s,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[yn,sc,"auto","initial","none",kt]}],grow:[{grow:["",yn,Ct,kt]}],shrink:[{shrink:["",yn,Ct,kt]}],order:[{order:[lc,"first","last","none",Ct,kt]}],"grid-cols":[{"grid-cols":Z()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":Z()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":oe()}],"auto-rows":[{"auto-rows":oe()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...he(),"normal"]}],"justify-items":[{"justify-items":[...Se(),"normal"]}],"justify-self":[{"justify-self":["auto",...Se()]}],"align-content":[{content:["normal",...he()]}],"align-items":[{items:[...Se(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Se(),{baseline:["","last"]}]}],"place-content":[{"place-content":he()}],"place-items":[{"place-items":[...Se(),"baseline"]}],"place-self":[{"place-self":["auto",...Se()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pbs:[{pbs:V()}],pbe:[{pbe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:fe()}],mx:[{mx:fe()}],my:[{my:fe()}],ms:[{ms:fe()}],me:[{me:fe()}],mbs:[{mbs:fe()}],mbe:[{mbe:fe()}],mt:[{mt:fe()}],mr:[{mr:fe()}],mb:[{mb:fe()}],ml:[{ml:fe()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:Oe()}],"inline-size":[{inline:["auto",...re()]}],"min-inline-size":[{"min-inline":["auto",...re()]}],"max-inline-size":[{"max-inline":["none",...re()]}],"block-size":[{block:["auto",...Ce()]}],"min-block-size":[{"min-block":["auto",...Ce()]}],"max-block-size":[{"max-block":["none",...Ce()]}],w:[{w:[s,"screen",...Oe()]}],"min-w":[{"min-w":[s,"screen","none",...Oe()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[o]},...Oe()]}],h:[{h:["screen","lh",...Oe()]}],"min-h":[{"min-h":["screen","lh","none",...Oe()]}],"max-h":[{"max-h":["screen","lh",...Oe()]}],"font-size":[{text:["base",n,Ip,pf]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,p7,l7]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Mw,kt]}],"font-family":[{font:[f7,u7,t]}],"font-features":[{"font-features":[kt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Ct,kt]}],"line-clamp":[{"line-clamp":[yn,"none",Ct,RN]}],leading:[{leading:[a,...V()]}],"list-image":[{"list-image":["none",Ct,kt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ct,kt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:ae()}],"text-color":[{text:ae()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[yn,"from-font","auto",Ct,pf]}],"text-decoration-color":[{decoration:ae()}],"underline-offset":[{"underline-offset":[yn,"auto",Ct,kt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ct,kt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ct,kt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ie()}],"bg-repeat":[{bg:de()}],"bg-size":[{bg:He()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},lc,Ct,kt],radial:["",Ct,kt],conic:[lc,Ct,kt]},h7,c7]}],"bg-color":[{bg:ae()}],"gradient-from-pos":[{from:je()}],"gradient-via-pos":[{via:je()}],"gradient-to-pos":[{to:je()}],"gradient-from":[{from:ae()}],"gradient-via":[{via:ae()}],"gradient-to":[{to:ae()}],rounded:[{rounded:$e()}],"rounded-s":[{"rounded-s":$e()}],"rounded-e":[{"rounded-e":$e()}],"rounded-t":[{"rounded-t":$e()}],"rounded-r":[{"rounded-r":$e()}],"rounded-b":[{"rounded-b":$e()}],"rounded-l":[{"rounded-l":$e()}],"rounded-ss":[{"rounded-ss":$e()}],"rounded-se":[{"rounded-se":$e()}],"rounded-ee":[{"rounded-ee":$e()}],"rounded-es":[{"rounded-es":$e()}],"rounded-tl":[{"rounded-tl":$e()}],"rounded-tr":[{"rounded-tr":$e()}],"rounded-br":[{"rounded-br":$e()}],"rounded-bl":[{"rounded-bl":$e()}],"border-w":[{border:We()}],"border-w-x":[{"border-x":We()}],"border-w-y":[{"border-y":We()}],"border-w-s":[{"border-s":We()}],"border-w-e":[{"border-e":We()}],"border-w-bs":[{"border-bs":We()}],"border-w-be":[{"border-be":We()}],"border-w-t":[{"border-t":We()}],"border-w-r":[{"border-r":We()}],"border-w-b":[{"border-b":We()}],"border-w-l":[{"border-l":We()}],"divide-x":[{"divide-x":We()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":We()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ye(),"hidden","none"]}],"divide-style":[{divide:[...Ye(),"hidden","none"]}],"border-color":[{border:ae()}],"border-color-x":[{"border-x":ae()}],"border-color-y":[{"border-y":ae()}],"border-color-s":[{"border-s":ae()}],"border-color-e":[{"border-e":ae()}],"border-color-bs":[{"border-bs":ae()}],"border-color-be":[{"border-be":ae()}],"border-color-t":[{"border-t":ae()}],"border-color-r":[{"border-r":ae()}],"border-color-b":[{"border-b":ae()}],"border-color-l":[{"border-l":ae()}],"divide-color":[{divide:ae()}],"outline-style":[{outline:[...Ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[yn,Ct,kt]}],"outline-w":[{outline:["",yn,Ip,pf]}],"outline-color":[{outline:ae()}],shadow:[{shadow:["","none",p,Lv,Rv]}],"shadow-color":[{shadow:ae()}],"inset-shadow":[{"inset-shadow":["none",m,Lv,Rv]}],"inset-shadow-color":[{"inset-shadow":ae()}],"ring-w":[{ring:We()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:ae()}],"ring-offset-w":[{"ring-offset":[yn,pf]}],"ring-offset-color":[{"ring-offset":ae()}],"inset-ring-w":[{"inset-ring":We()}],"inset-ring-color":[{"inset-ring":ae()}],"text-shadow":[{"text-shadow":["none",y,Lv,Rv]}],"text-shadow-color":[{"text-shadow":ae()}],opacity:[{opacity:[yn,Ct,kt]}],"mix-blend":[{"mix-blend":[...rt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":rt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[yn]}],"mask-image-linear-from-pos":[{"mask-linear-from":ze()}],"mask-image-linear-to-pos":[{"mask-linear-to":ze()}],"mask-image-linear-from-color":[{"mask-linear-from":ae()}],"mask-image-linear-to-color":[{"mask-linear-to":ae()}],"mask-image-t-from-pos":[{"mask-t-from":ze()}],"mask-image-t-to-pos":[{"mask-t-to":ze()}],"mask-image-t-from-color":[{"mask-t-from":ae()}],"mask-image-t-to-color":[{"mask-t-to":ae()}],"mask-image-r-from-pos":[{"mask-r-from":ze()}],"mask-image-r-to-pos":[{"mask-r-to":ze()}],"mask-image-r-from-color":[{"mask-r-from":ae()}],"mask-image-r-to-color":[{"mask-r-to":ae()}],"mask-image-b-from-pos":[{"mask-b-from":ze()}],"mask-image-b-to-pos":[{"mask-b-to":ze()}],"mask-image-b-from-color":[{"mask-b-from":ae()}],"mask-image-b-to-color":[{"mask-b-to":ae()}],"mask-image-l-from-pos":[{"mask-l-from":ze()}],"mask-image-l-to-pos":[{"mask-l-to":ze()}],"mask-image-l-from-color":[{"mask-l-from":ae()}],"mask-image-l-to-color":[{"mask-l-to":ae()}],"mask-image-x-from-pos":[{"mask-x-from":ze()}],"mask-image-x-to-pos":[{"mask-x-to":ze()}],"mask-image-x-from-color":[{"mask-x-from":ae()}],"mask-image-x-to-color":[{"mask-x-to":ae()}],"mask-image-y-from-pos":[{"mask-y-from":ze()}],"mask-image-y-to-pos":[{"mask-y-to":ze()}],"mask-image-y-from-color":[{"mask-y-from":ae()}],"mask-image-y-to-color":[{"mask-y-to":ae()}],"mask-image-radial":[{"mask-radial":[Ct,kt]}],"mask-image-radial-from-pos":[{"mask-radial-from":ze()}],"mask-image-radial-to-pos":[{"mask-radial-to":ze()}],"mask-image-radial-from-color":[{"mask-radial-from":ae()}],"mask-image-radial-to-color":[{"mask-radial-to":ae()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":D()}],"mask-image-conic-pos":[{"mask-conic":[yn]}],"mask-image-conic-from-pos":[{"mask-conic-from":ze()}],"mask-image-conic-to-pos":[{"mask-conic-to":ze()}],"mask-image-conic-from-color":[{"mask-conic-from":ae()}],"mask-image-conic-to-color":[{"mask-conic-to":ae()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ie()}],"mask-repeat":[{mask:de()}],"mask-size":[{mask:He()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ct,kt]}],filter:[{filter:["","none",Ct,kt]}],blur:[{blur:Fe()}],brightness:[{brightness:[yn,Ct,kt]}],contrast:[{contrast:[yn,Ct,kt]}],"drop-shadow":[{"drop-shadow":["","none",b,Lv,Rv]}],"drop-shadow-color":[{"drop-shadow":ae()}],grayscale:[{grayscale:["",yn,Ct,kt]}],"hue-rotate":[{"hue-rotate":[yn,Ct,kt]}],invert:[{invert:["",yn,Ct,kt]}],saturate:[{saturate:[yn,Ct,kt]}],sepia:[{sepia:["",yn,Ct,kt]}],"backdrop-filter":[{"backdrop-filter":["","none",Ct,kt]}],"backdrop-blur":[{"backdrop-blur":Fe()}],"backdrop-brightness":[{"backdrop-brightness":[yn,Ct,kt]}],"backdrop-contrast":[{"backdrop-contrast":[yn,Ct,kt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",yn,Ct,kt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[yn,Ct,kt]}],"backdrop-invert":[{"backdrop-invert":["",yn,Ct,kt]}],"backdrop-opacity":[{"backdrop-opacity":[yn,Ct,kt]}],"backdrop-saturate":[{"backdrop-saturate":[yn,Ct,kt]}],"backdrop-sepia":[{"backdrop-sepia":["",yn,Ct,kt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ct,kt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[yn,"initial",Ct,kt]}],ease:[{ease:["linear","initial",T,Ct,kt]}],delay:[{delay:[yn,Ct,kt]}],animate:[{animate:["none",E,Ct,kt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,Ct,kt]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:st()}],"rotate-x":[{"rotate-x":st()}],"rotate-y":[{"rotate-y":st()}],"rotate-z":[{"rotate-z":st()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Dt()}],"skew-x":[{"skew-x":Dt()}],"skew-y":[{"skew-y":Dt()}],transform:[{transform:[Ct,kt,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Lt()}],"translate-x":[{"translate-x":Lt()}],"translate-y":[{"translate-y":Lt()}],"translate-z":[{"translate-z":Lt()}],"translate-none":["translate-none"],accent:[{accent:ae()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:ae()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ct,kt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mbs":[{"scroll-mbs":V()}],"scroll-mbe":[{"scroll-mbe":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pbs":[{"scroll-pbs":V()}],"scroll-pbe":[{"scroll-pbe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ct,kt]}],fill:[{fill:["none",...ae()]}],"stroke-w":[{stroke:[yn,Ip,pf,RN]}],stroke:[{stroke:["none",...ae()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},v7=Z9(g7);function fn(...e){return v7(pn(e))}const wF=M.forwardRef(({...e},t)=>h.jsx("div",{ref:t,className:"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",...e}));wF.displayName="ToastProvider";const _F=M.forwardRef(({...e},t)=>h.jsx("div",{ref:t,className:"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",...e}));_F.displayName="ToastViewport";const y7=Q0("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),SF=M.forwardRef(({className:e,variant:t,...n},r)=>h.jsx("div",{ref:r,className:fn(y7({variant:t}),e),...n}));SF.displayName="Toast";const b7=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));b7.displayName="ToastAction";const PF=M.forwardRef(({className:e,...t},n)=>h.jsx("button",{ref:n,className:fn("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:h.jsx(rb,{className:"h-4 w-4"})}));PF.displayName="ToastClose";const jF=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("text-sm font-semibold",e),...t}));jF.displayName="ToastTitle";const OF=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("text-sm opacity-90",e),...t}));OF.displayName="ToastDescription";function x7(){const{toasts:e}=hH();return h.jsxs(wF,{children:[e.map(function({id:t,title:n,description:r,action:i,...a}){return h.jsxs(SF,{...a,children:[h.jsxs("div",{className:"grid gap-1",children:[n&&h.jsx(jF,{children:n}),r&&h.jsx(OF,{children:r})]}),i,h.jsx(PF,{})]},t)}),h.jsx(_F,{})]})}var Xh=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},w7={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},gc,XT,R$,_7=(R$=class{constructor(){Ft(this,gc,w7);Ft(this,XT,!1)}setTimeoutProvider(e){bt(this,gc,e)}setTimeout(e,t){return ue(this,gc).setTimeout(e,t)}clearTimeout(e){ue(this,gc).clearTimeout(e)}setInterval(e,t){return ue(this,gc).setInterval(e,t)}clearInterval(e){ue(this,gc).clearInterval(e)}},gc=new WeakMap,XT=new WeakMap,R$),Of=new _7;function S7(e){setTimeout(e,0)}var Gf=typeof window>"u"||"Deno"in globalThis;function Ga(){}function P7(e,t){return typeof e=="function"?e(t):e}function Oj(e){return typeof e=="number"&&e>=0&&e!==1/0}function TF(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ec(e,t){return typeof e=="function"?e(t):e}function xs(e,t){return typeof e=="function"?e(t):e}function DN(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==iE(o,t.options))return!1}else if(!Pm(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function BN(e,t){const{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Zf(t.options.mutationKey)!==Zf(a))return!1}else if(!Pm(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function iE(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zf)(e)}function Zf(e){return JSON.stringify(e,(t,n)=>Tj(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Pm(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Pm(e[n],t[n])):!1}var j7=Object.prototype.hasOwnProperty;function EF(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=$N(e)&&$N(t);if(!r&&!(Tj(e)&&Tj(t)))return t;const a=(r?e:Object.keys(e)).length,o=r?t:Object.keys(t),s=o.length,c=r?new Array(s):{};let d=0;for(let p=0;p{Of.setTimeout(t,e)})}function Ej(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?EF(e,t):t}function T7(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function E7(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var aE=Symbol();function AF(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===aE?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function oE(e,t){return typeof e=="function"?e(...t):!!e}function A7(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),e}var Mf,vc,nh,L$,k7=(L$=class extends Xh{constructor(){super();Ft(this,Mf);Ft(this,vc);Ft(this,nh);bt(this,nh,t=>{if(!Gf&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ue(this,vc)||this.setEventListener(ue(this,nh))}onUnsubscribe(){var t;this.hasListeners()||((t=ue(this,vc))==null||t.call(this),bt(this,vc,void 0))}setEventListener(t){var n;bt(this,nh,t),(n=ue(this,vc))==null||n.call(this),bt(this,vc,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){ue(this,Mf)!==t&&(bt(this,Mf,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof ue(this,Mf)=="boolean"?ue(this,Mf):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Mf=new WeakMap,vc=new WeakMap,nh=new WeakMap,L$),sE=new k7;function Aj(){let e,t;const n=new Promise((i,a)=>{e=i,t=a});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}var C7=S7;function N7(){let e=[],t=0,n=s=>{s()},r=s=>{s()},i=C7;const a=s=>{t?e.push(s):i(()=>{n(s)})},o=()=>{const s=e;e=[],s.length&&i(()=>{r(()=>{s.forEach(c=>{n(c)})})})};return{batch:s=>{let c;t++;try{c=s()}finally{t--,t||o()}return c},batchCalls:s=>(...c)=>{a(()=>{s(...c)})},schedule:a,setNotifyFunction:s=>{n=s},setBatchNotifyFunction:s=>{r=s},setScheduler:s=>{i=s}}}var Oi=N7(),rh,yc,ih,I$,M7=(I$=class extends Xh{constructor(){super();Ft(this,rh,!0);Ft(this,yc);Ft(this,ih);bt(this,ih,t=>{if(!Gf&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ue(this,yc)||this.setEventListener(ue(this,ih))}onUnsubscribe(){var t;this.hasListeners()||((t=ue(this,yc))==null||t.call(this),bt(this,yc,void 0))}setEventListener(t){var n;bt(this,ih,t),(n=ue(this,yc))==null||n.call(this),bt(this,yc,t(this.setOnline.bind(this)))}setOnline(t){ue(this,rh)!==t&&(bt(this,rh,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return ue(this,rh)}},rh=new WeakMap,yc=new WeakMap,ih=new WeakMap,I$),My=new M7;function R7(e){return Math.min(1e3*2**e,3e4)}function kF(e){return(e??"online")==="online"?My.isOnline():!0}var kj=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function CF(e){let t=!1,n=0,r;const i=Aj(),a=()=>i.status!=="pending",o=x=>{var w;if(!a()){const T=new kj(x);y(T),(w=e.onCancel)==null||w.call(e,T)}},s=()=>{t=!0},c=()=>{t=!1},d=()=>sE.isFocused()&&(e.networkMode==="always"||My.isOnline())&&e.canRun(),p=()=>kF(e.networkMode)&&e.canRun(),m=x=>{a()||(r==null||r(),i.resolve(x))},y=x=>{a()||(r==null||r(),i.reject(x))},b=()=>new Promise(x=>{var w;r=T=>{(a()||d())&&x(T)},(w=e.onPause)==null||w.call(e)}).then(()=>{var x;r=void 0,a()||(x=e.onContinue)==null||x.call(e)}),P=()=>{if(a())return;let x;const w=n===0?e.initialPromise:void 0;try{x=w??e.fn()}catch(T){x=Promise.reject(T)}Promise.resolve(x).then(m).catch(T=>{var R;if(a())return;const E=e.retry??(Gf?0:3),k=e.retryDelay??R7,D=typeof k=="function"?k(n,T):k,I=E===!0||typeof E=="number"&&nd()?void 0:b()).then(()=>{t?y(T):P()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:s,continueRetry:c,canStart:p,start:()=>(p()?P():b().then(P),i)}}var Rf,D$,NF=(D$=class{constructor(){Ft(this,Rf)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Oj(this.gcTime)&&bt(this,Rf,Of.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Gf?1/0:300*1e3))}clearGcTimeout(){ue(this,Rf)&&(Of.clearTimeout(ue(this,Rf)),bt(this,Rf,void 0))}},Rf=new WeakMap,D$),Lf,ah,bs,If,qi,vg,Df,el,hu,B$,L7=(B$=class extends NF{constructor(t){super();Ft(this,el);Ft(this,Lf);Ft(this,ah);Ft(this,bs);Ft(this,If);Ft(this,qi);Ft(this,vg);Ft(this,Df);bt(this,Df,!1),bt(this,vg,t.defaultOptions),this.setOptions(t.options),this.observers=[],bt(this,If,t.client),bt(this,bs,ue(this,If).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,bt(this,Lf,zN(this.options)),this.state=t.state??ue(this,Lf),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=ue(this,qi))==null?void 0:t.promise}setOptions(t){if(this.options={...ue(this,vg),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=zN(this.options);n.data!==void 0&&(this.setState(qN(n.data,n.dataUpdatedAt)),bt(this,Lf,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ue(this,bs).remove(this)}setData(t,n){const r=Ej(this.state.data,t,this.options);return mn(this,el,hu).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){mn(this,el,hu).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=ue(this,qi))==null?void 0:r.promise;return(i=ue(this,qi))==null||i.cancel(t),n?n.then(Ga).catch(Ga):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ue(this,Lf))}isActive(){return this.observers.some(t=>xs(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===aE||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ec(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!TF(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=ue(this,qi))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=ue(this,qi))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),ue(this,bs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(ue(this,qi)&&(ue(this,Df)?ue(this,qi).cancel({revert:!0}):ue(this,qi).cancelRetry()),this.scheduleGc()),ue(this,bs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||mn(this,el,hu).call(this,{type:"invalidate"})}async fetch(t,n){var c,d,p,m,y,b,P,x,w,T,E,k;if(this.state.fetchStatus!=="idle"&&((c=ue(this,qi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ue(this,qi))return ue(this,qi).continueRetry(),ue(this,qi).promise}if(t&&this.setOptions(t),!this.options.queryFn){const D=this.observers.find(I=>I.options.queryFn);D&&this.setOptions(D.options)}const r=new AbortController,i=D=>{Object.defineProperty(D,"signal",{enumerable:!0,get:()=>(bt(this,Df,!0),r.signal)})},a=()=>{const D=AF(this.options,n),R=(()=>{const $={client:ue(this,If),queryKey:this.queryKey,meta:this.meta};return i($),$})();return bt(this,Df,!1),this.options.persister?this.options.persister(D,R,this):D(R)},s=(()=>{const D={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ue(this,If),state:this.state,fetchFn:a};return i(D),D})();(d=this.options.behavior)==null||d.onFetch(s,this),bt(this,ah,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=s.fetchOptions)==null?void 0:p.meta))&&mn(this,el,hu).call(this,{type:"fetch",meta:(m=s.fetchOptions)==null?void 0:m.meta}),bt(this,qi,CF({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,onCancel:D=>{D instanceof kj&&D.revert&&this.setState({...ue(this,ah),fetchStatus:"idle"}),r.abort()},onFail:(D,I)=>{mn(this,el,hu).call(this,{type:"failed",failureCount:D,error:I})},onPause:()=>{mn(this,el,hu).call(this,{type:"pause"})},onContinue:()=>{mn(this,el,hu).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}));try{const D=await ue(this,qi).start();if(D===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(D),(b=(y=ue(this,bs).config).onSuccess)==null||b.call(y,D,this),(x=(P=ue(this,bs).config).onSettled)==null||x.call(P,D,this.state.error,this),D}catch(D){if(D instanceof kj){if(D.silent)return ue(this,qi).promise;if(D.revert){if(this.state.data===void 0)throw D;return this.state.data}}throw mn(this,el,hu).call(this,{type:"error",error:D}),(T=(w=ue(this,bs).config).onError)==null||T.call(w,D,this),(k=(E=ue(this,bs).config).onSettled)==null||k.call(E,this.state.data,D,this),D}finally{this.scheduleGc()}}},Lf=new WeakMap,ah=new WeakMap,bs=new WeakMap,If=new WeakMap,qi=new WeakMap,vg=new WeakMap,Df=new WeakMap,el=new WeakSet,hu=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...MF(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...qN(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return bt(this,ah,t.manual?i:void 0),i;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Oi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ue(this,bs).notify({query:this,type:"updated",action:t})})},B$);function MF(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:kF(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function qN(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function zN(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var bo,Cn,yg,Ha,Bf,oh,mu,bc,bg,sh,lh,$f,Ff,xc,uh,Qn,Qp,Cj,Nj,Mj,Rj,Lj,Ij,Dj,RF,$$,I7=($$=class extends Xh{constructor(t,n){super();Ft(this,Qn);Ft(this,bo);Ft(this,Cn);Ft(this,yg);Ft(this,Ha);Ft(this,Bf);Ft(this,oh);Ft(this,mu);Ft(this,bc);Ft(this,bg);Ft(this,sh);Ft(this,lh);Ft(this,$f);Ft(this,Ff);Ft(this,xc);Ft(this,uh,new Set);this.options=n,bt(this,bo,t),bt(this,bc,null),bt(this,mu,Aj()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ue(this,Cn).addObserver(this),UN(ue(this,Cn),this.options)?mn(this,Qn,Qp).call(this):this.updateResult(),mn(this,Qn,Rj).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bj(ue(this,Cn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bj(ue(this,Cn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,mn(this,Qn,Lj).call(this),mn(this,Qn,Ij).call(this),ue(this,Cn).removeObserver(this)}setOptions(t){const n=this.options,r=ue(this,Cn);if(this.options=ue(this,bo).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xs(this.options.enabled,ue(this,Cn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");mn(this,Qn,Dj).call(this),ue(this,Cn).setOptions(this.options),n._defaulted&&!Ny(this.options,n)&&ue(this,bo).getQueryCache().notify({type:"observerOptionsUpdated",query:ue(this,Cn),observer:this});const i=this.hasListeners();i&&VN(ue(this,Cn),r,this.options,n)&&mn(this,Qn,Qp).call(this),this.updateResult(),i&&(ue(this,Cn)!==r||xs(this.options.enabled,ue(this,Cn))!==xs(n.enabled,ue(this,Cn))||Ec(this.options.staleTime,ue(this,Cn))!==Ec(n.staleTime,ue(this,Cn)))&&mn(this,Qn,Cj).call(this);const a=mn(this,Qn,Nj).call(this);i&&(ue(this,Cn)!==r||xs(this.options.enabled,ue(this,Cn))!==xs(n.enabled,ue(this,Cn))||a!==ue(this,xc))&&mn(this,Qn,Mj).call(this,a)}getOptimisticResult(t){const n=ue(this,bo).getQueryCache().build(ue(this,bo),t),r=this.createResult(n,t);return B7(this,r)&&(bt(this,Ha,r),bt(this,oh,this.options),bt(this,Bf,ue(this,Cn).state)),r}getCurrentResult(){return ue(this,Ha)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&ue(this,mu).status==="pending"&&ue(this,mu).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){ue(this,uh).add(t)}getCurrentQuery(){return ue(this,Cn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=ue(this,bo).defaultQueryOptions(t),r=ue(this,bo).getQueryCache().build(ue(this,bo),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return mn(this,Qn,Qp).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),ue(this,Ha)))}createResult(t,n){var K;const r=ue(this,Cn),i=this.options,a=ue(this,Ha),o=ue(this,Bf),s=ue(this,oh),d=t!==r?t.state:ue(this,yg),{state:p}=t;let m={...p},y=!1,b;if(n._optimisticResults){const Z=this.hasListeners(),ee=!Z&&UN(t,n),ne=Z&&VN(t,r,n,i);(ee||ne)&&(m={...m,...MF(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:P,errorUpdatedAt:x,status:w}=m;b=m.data;let T=!1;if(n.placeholderData!==void 0&&b===void 0&&w==="pending"){let Z;a!=null&&a.isPlaceholderData&&n.placeholderData===(s==null?void 0:s.placeholderData)?(Z=a.data,T=!0):Z=typeof n.placeholderData=="function"?n.placeholderData((K=ue(this,lh))==null?void 0:K.state.data,ue(this,lh)):n.placeholderData,Z!==void 0&&(w="success",b=Ej(a==null?void 0:a.data,Z,n),y=!0)}if(n.select&&b!==void 0&&!T)if(a&&b===(o==null?void 0:o.data)&&n.select===ue(this,bg))b=ue(this,sh);else try{bt(this,bg,n.select),b=n.select(b),b=Ej(a==null?void 0:a.data,b,n),bt(this,sh,b),bt(this,bc,null)}catch(Z){bt(this,bc,Z)}ue(this,bc)&&(P=ue(this,bc),b=ue(this,sh),x=Date.now(),w="error");const E=m.fetchStatus==="fetching",k=w==="pending",D=w==="error",I=k&&E,R=b!==void 0,V={status:w,fetchStatus:m.fetchStatus,isPending:k,isSuccess:w==="success",isError:D,isInitialLoading:I,isLoading:I,data:b,dataUpdatedAt:m.dataUpdatedAt,error:P,errorUpdatedAt:x,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:E,isRefetching:E&&!k,isLoadingError:D&&!R,isPaused:m.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:D&&R,isStale:lE(t,n),refetch:this.refetch,promise:ue(this,mu),isEnabled:xs(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const Z=V.data!==void 0,ee=V.status==="error"&&!Z,ne=Se=>{ee?Se.reject(V.error):Z&&Se.resolve(V.data)},oe=()=>{const Se=bt(this,mu,V.promise=Aj());ne(Se)},he=ue(this,mu);switch(he.status){case"pending":t.queryHash===r.queryHash&&ne(he);break;case"fulfilled":(ee||V.data!==he.value)&&oe();break;case"rejected":(!ee||V.error!==he.reason)&&oe();break}}return V}updateResult(){const t=ue(this,Ha),n=this.createResult(ue(this,Cn),this.options);if(bt(this,Bf,ue(this,Cn).state),bt(this,oh,this.options),ue(this,Bf).data!==void 0&&bt(this,lh,ue(this,Cn)),Ny(n,t))return;bt(this,Ha,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,a=typeof i=="function"?i():i;if(a==="all"||!a&&!ue(this,uh).size)return!0;const o=new Set(a??ue(this,uh));return this.options.throwOnError&&o.add("error"),Object.keys(ue(this,Ha)).some(s=>{const c=s;return ue(this,Ha)[c]!==t[c]&&o.has(c)})};mn(this,Qn,RF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&mn(this,Qn,Rj).call(this)}},bo=new WeakMap,Cn=new WeakMap,yg=new WeakMap,Ha=new WeakMap,Bf=new WeakMap,oh=new WeakMap,mu=new WeakMap,bc=new WeakMap,bg=new WeakMap,sh=new WeakMap,lh=new WeakMap,$f=new WeakMap,Ff=new WeakMap,xc=new WeakMap,uh=new WeakMap,Qn=new WeakSet,Qp=function(t){mn(this,Qn,Dj).call(this);let n=ue(this,Cn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ga)),n},Cj=function(){mn(this,Qn,Lj).call(this);const t=Ec(this.options.staleTime,ue(this,Cn));if(Gf||ue(this,Ha).isStale||!Oj(t))return;const r=TF(ue(this,Ha).dataUpdatedAt,t)+1;bt(this,$f,Of.setTimeout(()=>{ue(this,Ha).isStale||this.updateResult()},r))},Nj=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ue(this,Cn)):this.options.refetchInterval)??!1},Mj=function(t){mn(this,Qn,Ij).call(this),bt(this,xc,t),!(Gf||xs(this.options.enabled,ue(this,Cn))===!1||!Oj(ue(this,xc))||ue(this,xc)===0)&&bt(this,Ff,Of.setInterval(()=>{(this.options.refetchIntervalInBackground||sE.isFocused())&&mn(this,Qn,Qp).call(this)},ue(this,xc)))},Rj=function(){mn(this,Qn,Cj).call(this),mn(this,Qn,Mj).call(this,mn(this,Qn,Nj).call(this))},Lj=function(){ue(this,$f)&&(Of.clearTimeout(ue(this,$f)),bt(this,$f,void 0))},Ij=function(){ue(this,Ff)&&(Of.clearInterval(ue(this,Ff)),bt(this,Ff,void 0))},Dj=function(){const t=ue(this,bo).getQueryCache().build(ue(this,bo),this.options);if(t===ue(this,Cn))return;const n=ue(this,Cn);bt(this,Cn,t),bt(this,yg,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},RF=function(t){Oi.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(ue(this,Ha))}),ue(this,bo).getQueryCache().notify({query:ue(this,Cn),type:"observerResultsUpdated"})})},$$);function D7(e,t){return xs(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function UN(e,t){return D7(e,t)||e.state.data!==void 0&&Bj(e,t,t.refetchOnMount)}function Bj(e,t,n){if(xs(t.enabled,e)!==!1&&Ec(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&lE(e,t)}return!1}function VN(e,t,n,r){return(e!==t||xs(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&lE(e,n)}function lE(e,t){return xs(t.enabled,e)!==!1&&e.isStaleByTime(Ec(t.staleTime,e))}function B7(e,t){return!Ny(e.getCurrentResult(),t)}function WN(e){return{onFetch:(t,n)=>{var p,m,y,b,P;const r=t.options,i=(y=(m=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:m.fetchMore)==null?void 0:y.direction,a=((b=t.state.data)==null?void 0:b.pages)||[],o=((P=t.state.data)==null?void 0:P.pageParams)||[];let s={pages:[],pageParams:[]},c=0;const d=async()=>{let x=!1;const w=k=>{A7(k,()=>t.signal,()=>x=!0)},T=AF(t.options,t.fetchOptions),E=async(k,D,I)=>{if(x)return Promise.reject();if(D==null&&k.pages.length)return Promise.resolve(k);const $=(()=>{const ee={client:t.client,queryKey:t.queryKey,pageParam:D,direction:I?"backward":"forward",meta:t.options.meta};return w(ee),ee})(),V=await T($),{maxPages:K}=t.options,Z=I?E7:T7;return{pages:Z(k.pages,V,K),pageParams:Z(k.pageParams,D,K)}};if(i&&a.length){const k=i==="backward",D=k?$7:KN,I={pages:a,pageParams:o},R=D(r,I);s=await E(I,R,k)}else{const k=e??a.length;do{const D=c===0?o[0]??r.initialPageParam:KN(r,s);if(c>0&&D==null)break;s=await E(s,D),c++}while(c{var x,w;return(w=(x=t.options).persister)==null?void 0:w.call(x,d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function KN(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function $7(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var xg,Tl,Pa,qf,El,cc,F$,F7=(F$=class extends NF{constructor(t){super();Ft(this,El);Ft(this,xg);Ft(this,Tl);Ft(this,Pa);Ft(this,qf);bt(this,xg,t.client),this.mutationId=t.mutationId,bt(this,Pa,t.mutationCache),bt(this,Tl,[]),this.state=t.state||LF(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){ue(this,Tl).includes(t)||(ue(this,Tl).push(t),this.clearGcTimeout(),ue(this,Pa).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){bt(this,Tl,ue(this,Tl).filter(n=>n!==t)),this.scheduleGc(),ue(this,Pa).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){ue(this,Tl).length||(this.state.status==="pending"?this.scheduleGc():ue(this,Pa).remove(this))}continue(){var t;return((t=ue(this,qf))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,s,c,d,p,m,y,b,P,x,w,T,E,k,D,I,R,$;const n=()=>{mn(this,El,cc).call(this,{type:"continue"})},r={client:ue(this,xg),meta:this.options.meta,mutationKey:this.options.mutationKey};bt(this,qf,CF({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(V,K)=>{mn(this,El,cc).call(this,{type:"failed",failureCount:V,error:K})},onPause:()=>{mn(this,El,cc).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ue(this,Pa).canRun(this)}));const i=this.state.status==="pending",a=!ue(this,qf).canStart();try{if(i)n();else{mn(this,El,cc).call(this,{type:"pending",variables:t,isPaused:a}),ue(this,Pa).config.onMutate&&await ue(this,Pa).config.onMutate(t,this,r);const K=await((s=(o=this.options).onMutate)==null?void 0:s.call(o,t,r));K!==this.state.context&&mn(this,El,cc).call(this,{type:"pending",context:K,variables:t,isPaused:a})}const V=await ue(this,qf).start();return await((d=(c=ue(this,Pa).config).onSuccess)==null?void 0:d.call(c,V,t,this.state.context,this,r)),await((m=(p=this.options).onSuccess)==null?void 0:m.call(p,V,t,this.state.context,r)),await((b=(y=ue(this,Pa).config).onSettled)==null?void 0:b.call(y,V,null,this.state.variables,this.state.context,this,r)),await((x=(P=this.options).onSettled)==null?void 0:x.call(P,V,null,t,this.state.context,r)),mn(this,El,cc).call(this,{type:"success",data:V}),V}catch(V){try{await((T=(w=ue(this,Pa).config).onError)==null?void 0:T.call(w,V,t,this.state.context,this,r))}catch(K){Promise.reject(K)}try{await((k=(E=this.options).onError)==null?void 0:k.call(E,V,t,this.state.context,r))}catch(K){Promise.reject(K)}try{await((I=(D=ue(this,Pa).config).onSettled)==null?void 0:I.call(D,void 0,V,this.state.variables,this.state.context,this,r))}catch(K){Promise.reject(K)}try{await(($=(R=this.options).onSettled)==null?void 0:$.call(R,void 0,V,t,this.state.context,r))}catch(K){Promise.reject(K)}throw mn(this,El,cc).call(this,{type:"error",error:V}),V}finally{ue(this,Pa).runNext(this)}}},xg=new WeakMap,Tl=new WeakMap,Pa=new WeakMap,qf=new WeakMap,El=new WeakSet,cc=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Oi.batch(()=>{ue(this,Tl).forEach(r=>{r.onMutationUpdate(t)}),ue(this,Pa).notify({mutation:this,type:"updated",action:t})})},F$);function LF(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var gu,tl,wg,q$,q7=(q$=class extends Xh{constructor(t={}){super();Ft(this,gu);Ft(this,tl);Ft(this,wg);this.config=t,bt(this,gu,new Set),bt(this,tl,new Map),bt(this,wg,0)}build(t,n,r){const i=new F7({client:t,mutationCache:this,mutationId:++Cv(this,wg)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){ue(this,gu).add(t);const n=Iv(t);if(typeof n=="string"){const r=ue(this,tl).get(n);r?r.push(t):ue(this,tl).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(ue(this,gu).delete(t)){const n=Iv(t);if(typeof n=="string"){const r=ue(this,tl).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&ue(this,tl).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Iv(t);if(typeof n=="string"){const r=ue(this,tl).get(n),i=r==null?void 0:r.find(a=>a.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Iv(t);if(typeof n=="string"){const i=(r=ue(this,tl).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Oi.batch(()=>{ue(this,gu).forEach(t=>{this.notify({type:"removed",mutation:t})}),ue(this,gu).clear(),ue(this,tl).clear()})}getAll(){return Array.from(ue(this,gu))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>BN(n,r))}findAll(t={}){return this.getAll().filter(n=>BN(t,n))}notify(t){Oi.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Oi.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ga))))}},gu=new WeakMap,tl=new WeakMap,wg=new WeakMap,q$);function Iv(e){var t;return(t=e.options.scope)==null?void 0:t.id}var vu,wc,xo,yu,Tu,dy,$j,z$,z7=(z$=class extends Xh{constructor(n,r){super();Ft(this,Tu);Ft(this,vu);Ft(this,wc);Ft(this,xo);Ft(this,yu);bt(this,vu,n),this.setOptions(r),this.bindMethods(),mn(this,Tu,dy).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=ue(this,vu).defaultMutationOptions(n),Ny(this.options,r)||ue(this,vu).getMutationCache().notify({type:"observerOptionsUpdated",mutation:ue(this,xo),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Zf(r.mutationKey)!==Zf(this.options.mutationKey)?this.reset():((i=ue(this,xo))==null?void 0:i.state.status)==="pending"&&ue(this,xo).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=ue(this,xo))==null||n.removeObserver(this)}onMutationUpdate(n){mn(this,Tu,dy).call(this),mn(this,Tu,$j).call(this,n)}getCurrentResult(){return ue(this,wc)}reset(){var n;(n=ue(this,xo))==null||n.removeObserver(this),bt(this,xo,void 0),mn(this,Tu,dy).call(this),mn(this,Tu,$j).call(this)}mutate(n,r){var i;return bt(this,yu,r),(i=ue(this,xo))==null||i.removeObserver(this),bt(this,xo,ue(this,vu).getMutationCache().build(ue(this,vu),this.options)),ue(this,xo).addObserver(this),ue(this,xo).execute(n)}},vu=new WeakMap,wc=new WeakMap,xo=new WeakMap,yu=new WeakMap,Tu=new WeakSet,dy=function(){var r;const n=((r=ue(this,xo))==null?void 0:r.state)??LF();bt(this,wc,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},$j=function(n){Oi.batch(()=>{var r,i,a,o,s,c,d,p;if(ue(this,yu)&&this.hasListeners()){const m=ue(this,wc).variables,y=ue(this,wc).context,b={client:ue(this,vu),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(r=ue(this,yu)).onSuccess)==null||i.call(r,n.data,m,y,b)}catch(P){Promise.reject(P)}try{(o=(a=ue(this,yu)).onSettled)==null||o.call(a,n.data,null,m,y,b)}catch(P){Promise.reject(P)}}else if((n==null?void 0:n.type)==="error"){try{(c=(s=ue(this,yu)).onError)==null||c.call(s,n.error,m,y,b)}catch(P){Promise.reject(P)}try{(p=(d=ue(this,yu)).onSettled)==null||p.call(d,void 0,n.error,m,y,b)}catch(P){Promise.reject(P)}}}this.listeners.forEach(m=>{m(ue(this,wc))})})},z$),Al,U$,U7=(U$=class extends Xh{constructor(t={}){super();Ft(this,Al);this.config=t,bt(this,Al,new Map)}build(t,n,r){const i=n.queryKey,a=n.queryHash??iE(i,n);let o=this.get(a);return o||(o=new L7({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){ue(this,Al).has(t.queryHash)||(ue(this,Al).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=ue(this,Al).get(t.queryHash);n&&(t.destroy(),n===t&&ue(this,Al).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Oi.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return ue(this,Al).get(t)}getAll(){return[...ue(this,Al).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>DN(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>DN(t,r)):n}notify(t){Oi.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Oi.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Oi.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Al=new WeakMap,U$),Vr,_c,Sc,ch,fh,Pc,dh,hh,V$,V7=(V$=class{constructor(e={}){Ft(this,Vr);Ft(this,_c);Ft(this,Sc);Ft(this,ch);Ft(this,fh);Ft(this,Pc);Ft(this,dh);Ft(this,hh);bt(this,Vr,e.queryCache||new U7),bt(this,_c,e.mutationCache||new q7),bt(this,Sc,e.defaultOptions||{}),bt(this,ch,new Map),bt(this,fh,new Map),bt(this,Pc,0)}mount(){Cv(this,Pc)._++,ue(this,Pc)===1&&(bt(this,dh,sE.subscribe(async e=>{e&&(await this.resumePausedMutations(),ue(this,Vr).onFocus())})),bt(this,hh,My.subscribe(async e=>{e&&(await this.resumePausedMutations(),ue(this,Vr).onOnline())})))}unmount(){var e,t;Cv(this,Pc)._--,ue(this,Pc)===0&&((e=ue(this,dh))==null||e.call(this),bt(this,dh,void 0),(t=ue(this,hh))==null||t.call(this),bt(this,hh,void 0))}isFetching(e){return ue(this,Vr).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return ue(this,_c).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ue(this,Vr).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=ue(this,Vr).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ec(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return ue(this,Vr).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=ue(this,Vr).get(r.queryHash),a=i==null?void 0:i.state.data,o=P7(t,a);if(o!==void 0)return ue(this,Vr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Oi.batch(()=>ue(this,Vr).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ue(this,Vr).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=ue(this,Vr);Oi.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=ue(this,Vr);return Oi.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Oi.batch(()=>ue(this,Vr).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Ga).catch(Ga)}invalidateQueries(e,t={}){return Oi.batch(()=>(ue(this,Vr).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=Oi.batch(()=>ue(this,Vr).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let a=i.fetch(void 0,n);return n.throwOnError||(a=a.catch(Ga)),i.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Ga)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=ue(this,Vr).build(this,t);return n.isStaleByTime(Ec(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ga).catch(Ga)}fetchInfiniteQuery(e){return e.behavior=WN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ga).catch(Ga)}ensureInfiniteQueryData(e){return e.behavior=WN(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return My.isOnline()?ue(this,_c).resumePausedMutations():Promise.resolve()}getQueryCache(){return ue(this,Vr)}getMutationCache(){return ue(this,_c)}getDefaultOptions(){return ue(this,Sc)}setDefaultOptions(e){bt(this,Sc,e)}setQueryDefaults(e,t){ue(this,ch).set(Zf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...ue(this,ch).values()],n={};return t.forEach(r=>{Pm(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){ue(this,fh).set(Zf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...ue(this,fh).values()],n={};return t.forEach(r=>{Pm(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...ue(this,Sc).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=iE(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===aE&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...ue(this,Sc).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){ue(this,Vr).clear(),ue(this,_c).clear()}},Vr=new WeakMap,_c=new WeakMap,Sc=new WeakMap,ch=new WeakMap,fh=new WeakMap,Pc=new WeakMap,dh=new WeakMap,hh=new WeakMap,V$),IF=M.createContext(void 0),As=e=>{const t=M.useContext(IF);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},W7=({client:e,children:t})=>(M.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),h.jsx(IF.Provider,{value:e,children:t})),DF=M.createContext(!1),K7=()=>M.useContext(DF);DF.Provider;function H7(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var G7=M.createContext(H7()),Z7=()=>M.useContext(G7),Y7=(e,t,n)=>{const r=n!=null&&n.state.error&&typeof e.throwOnError=="function"?oE(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},X7=e=>{M.useEffect(()=>{e.clearReset()},[e])},Q7=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||oE(n,[e.error,r])),J7=e=>{if(e.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},eG=(e,t)=>e.isLoading&&e.isFetching&&!t,tG=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,HN=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function nG(e,t,n){var y,b,P,x;const r=K7(),i=Z7(),a=As(),o=a.defaultQueryOptions(e);(b=(y=a.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,o);const s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",J7(o),Y7(o,i,s),X7(i);const c=!a.getQueryCache().get(o.queryHash),[d]=M.useState(()=>new t(a,o)),p=d.getOptimisticResult(o),m=!r&&e.subscribed!==!1;if(M.useSyncExternalStore(M.useCallback(w=>{const T=m?d.subscribe(Oi.batchCalls(w)):Ga;return d.updateResult(),T},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),M.useEffect(()=>{d.setOptions(o)},[o,d]),tG(o,p))throw HN(o,d,i);if(Q7({result:p,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw p.error;if((x=(P=a.getDefaultOptions().queries)==null?void 0:P._experimental_afterQuery)==null||x.call(P,o,p),o.experimental_prefetchInRender&&!Gf&&eG(p,r)){const w=c?HN(o,d,i):s==null?void 0:s.promise;w==null||w.catch(Ga).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?p:d.trackResult(p)}function bn(e,t){return nG(e,I7)}function ci(e,t){const n=As(),[r]=M.useState(()=>new z7(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);const i=M.useSyncExternalStore(M.useCallback(o=>r.subscribe(Oi.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=M.useCallback((o,s)=>{r.mutate(o,s).catch(Ga)},[r]);if(i.error&&oE(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}const rG=new V7({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});var Qh=W$();const iG=In(Qh);/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function jm(){return jm=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function uE(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function oG(){return Math.random().toString(36).substr(2,8)}function ZN(e,t){return{usr:e.state,key:e.key,idx:t}}function Fj(e,t,n,r){return n===void 0&&(n=null),jm({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Jh(t):t,{state:n,key:t&&t.key||r||oG()})}function Ry(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Jh(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function sG(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=jc.Pop,c=null,d=p();d==null&&(d=0,o.replaceState(jm({},o.state,{idx:d}),""));function p(){return(o.state||{idx:null}).idx}function m(){s=jc.Pop;let w=p(),T=w==null?null:w-d;d=w,c&&c({action:s,location:x.location,delta:T})}function y(w,T){s=jc.Push;let E=Fj(x.location,w,T);d=p()+1;let k=ZN(E,d),D=x.createHref(E);try{o.pushState(k,"",D)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(D)}a&&c&&c({action:s,location:x.location,delta:1})}function b(w,T){s=jc.Replace;let E=Fj(x.location,w,T);d=p();let k=ZN(E,d),D=x.createHref(E);o.replaceState(k,"",D),a&&c&&c({action:s,location:x.location,delta:0})}function P(w){let T=i.location.origin!=="null"?i.location.origin:i.location.href,E=typeof w=="string"?w:Ry(w);return E=E.replace(/ $/,"%20"),fi(T,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,T)}let x={get action(){return s},get location(){return e(i,o)},listen(w){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(GN,m),c=w,()=>{i.removeEventListener(GN,m),c=null}},createHref(w){return t(i,w)},createURL:P,encodeLocation(w){let T=P(w);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:y,replace:b,go(w){return o.go(w)}};return x}var YN;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(YN||(YN={}));function lG(e,t,n){return n===void 0&&(n="/"),uG(e,t,n)}function uG(e,t,n,r){let i=typeof t=="string"?Jh(t):t,a=cE(i.pathname||"/",n);if(a==null)return null;let o=BF(e);cG(o);let s=null;for(let c=0;s==null&&c{let c={relativePath:s===void 0?a.path||"":s,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(fi(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let d=Ac([r,c.relativePath]),p=n.concat(c);a.children&&a.children.length>0&&(fi(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),BF(a.children,t,p,d)),!(a.path==null&&!a.index)&&t.push({path:d,score:vG(d,a.index),routesMeta:p})};return e.forEach((a,o)=>{var s;if(a.path===""||!((s=a.path)!=null&&s.includes("?")))i(a,o);else for(let c of $F(a.path))i(a,o,c)}),t}function $F(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return i?[a,""]:[a];let o=$F(r.join("/")),s=[];return s.push(...o.map(c=>c===""?a:[a,c].join("/"))),i&&s.push(...o),s.map(c=>e.startsWith("/")&&c===""?"/":c)}function cG(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:yG(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const fG=/^:[\w-]+$/,dG=3,hG=2,pG=1,mG=10,gG=-2,XN=e=>e==="*";function vG(e,t){let n=e.split("/"),r=n.length;return n.some(XN)&&(r+=gG),t&&(r+=hG),n.filter(i=>!XN(i)).reduce((i,a)=>i+(fG.test(a)?dG:a===""?pG:mG),r)}function yG(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function bG(e,t,n){let{routesMeta:r}=e,i={},a="/",o=[];for(let s=0;s{let{paramName:y,isOptional:b}=p;if(y==="*"){let x=s[m]||"";o=a.slice(0,a.length-x.length).replace(/(.)\/+$/,"$1")}const P=s[m];return b&&!P?d[y]=void 0:d[y]=(P||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:o,pattern:e}}function wG(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),uE(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,c)=>(r.push({paramName:s,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function _G(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return uE(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function cE(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const SG=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,PG=e=>SG.test(e);function jG(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Jh(e):e,a;if(n)if(PG(n))a=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),uE(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?a=QN(n.substring(1),"/"):a=QN(n,t)}else a=t;return{pathname:a,search:EG(r),hash:AG(i)}}function QN(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Rw(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function OG(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function FF(e,t){let n=OG(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function qF(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Jh(e):(i=jm({},e),fi(!i.pathname||!i.pathname.includes("?"),Rw("?","pathname","search",i)),fi(!i.pathname||!i.pathname.includes("#"),Rw("#","pathname","hash",i)),fi(!i.search||!i.search.includes("#"),Rw("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,s;if(o==null)s=n;else{let m=t.length-1;if(!r&&o.startsWith("..")){let y=o.split("/");for(;y[0]==="..";)y.shift(),m-=1;i.pathname=y.join("/")}s=m>=0?t[m]:"/"}let c=jG(i,s),d=o&&o!=="/"&&o.endsWith("/"),p=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||p)&&(c.pathname+="/"),c}const Ac=e=>e.join("/").replace(/\/\/+/g,"/"),TG=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),EG=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,AG=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function kG(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const zF=["post","put","patch","delete"];new Set(zF);const CG=["get",...zF];new Set(CG);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Om(){return Om=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),M.useCallback(function(d,p){if(p===void 0&&(p={}),!s.current)return;if(typeof d=="number"){r.go(d);return}let m=qF(d,JSON.parse(o),a,p.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Ac([t,m.pathname])),(p.replace?r.replace:r.push)(m,p.state,p)},[t,r,o,a,e])}function WF(){let{matches:e}=M.useContext(Wc),t=e[e.length-1];return t?t.params:{}}function KF(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=M.useContext(ud),{matches:i}=M.useContext(Wc),{pathname:a}=cd(),o=JSON.stringify(FF(i,r.v7_relativeSplatPath));return M.useMemo(()=>qF(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function LG(e,t){return IG(e,t)}function IG(e,t,n,r){_g()||fi(!1);let{navigator:i}=M.useContext(ud),{matches:a}=M.useContext(Wc),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=cd(),p;if(t){var m;let w=typeof t=="string"?Jh(t):t;c==="/"||(m=w.pathname)!=null&&m.startsWith(c)||fi(!1),p=w}else p=d;let y=p.pathname||"/",b=y;if(c!=="/"){let w=c.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(w.length).join("/")}let P=lG(e,{pathname:b}),x=qG(P&&P.map(w=>Object.assign({},w,{params:Object.assign({},s,w.params),pathname:Ac([c,i.encodeLocation?i.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?c:Ac([c,i.encodeLocation?i.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),a,n,r);return t&&x?M.createElement(ib.Provider,{value:{location:Om({pathname:"/",search:"",hash:"",state:null,key:"default"},p),navigationType:jc.Pop}},x):x}function DG(){let e=WG(),t=kG(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return M.createElement(M.Fragment,null,M.createElement("h2",null,"Unexpected Application Error!"),M.createElement("h3",{style:{fontStyle:"italic"}},t),n?M.createElement("pre",{style:i},n):null,null)}const BG=M.createElement(DG,null);class $G extends M.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?M.createElement(Wc.Provider,{value:this.props.routeContext},M.createElement(UF.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function FG(e){let{routeContext:t,match:n,children:r}=e,i=M.useContext(fE);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),M.createElement(Wc.Provider,{value:t},r)}function qG(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,s=(i=n)==null?void 0:i.errors;if(s!=null){let p=o.findIndex(m=>m.route.id&&(s==null?void 0:s[m.route.id])!==void 0);p>=0||fi(!1),o=o.slice(0,Math.min(o.length,p+1))}let c=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let p=0;p=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((p,m,y)=>{let b,P=!1,x=null,w=null;n&&(b=s&&m.route.id?s[m.route.id]:void 0,x=m.route.errorElement||BG,c&&(d<0&&y===0?(HG("route-fallback"),P=!0,w=null):d===y&&(P=!0,w=m.route.hydrateFallbackElement||null)));let T=t.concat(o.slice(0,y+1)),E=()=>{let k;return b?k=x:P?k=w:m.route.Component?k=M.createElement(m.route.Component,null):m.route.element?k=m.route.element:k=p,M.createElement(FG,{match:m,routeContext:{outlet:p,matches:T,isDataRoute:n!=null},children:k})};return n&&(m.route.ErrorBoundary||m.route.errorElement||y===0)?M.createElement($G,{location:n.location,revalidation:n.revalidation,component:x,error:b,children:E(),routeContext:{outlet:null,matches:T,isDataRoute:!0}}):E()},null)}var HF=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(HF||{}),GF=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(GF||{});function zG(e){let t=M.useContext(fE);return t||fi(!1),t}function UG(e){let t=M.useContext(NG);return t||fi(!1),t}function VG(e){let t=M.useContext(Wc);return t||fi(!1),t}function ZF(e){let t=VG(),n=t.matches[t.matches.length-1];return n.route.id||fi(!1),n.route.id}function WG(){var e;let t=M.useContext(UF),n=UG(),r=ZF();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function KG(){let{router:e}=zG(HF.UseNavigateStable),t=ZF(GF.UseNavigateStable),n=M.useRef(!1);return VF(()=>{n.current=!0}),M.useCallback(function(i,a){a===void 0&&(a={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Om({fromRouteId:t},a)))},[e,t])}const JN={};function HG(e,t,n){JN[e]||(JN[e]=!0)}function GG(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function hy(e){fi(!1)}function ZG(e){let{basename:t="/",children:n=null,location:r,navigationType:i=jc.Pop,navigator:a,static:o=!1,future:s}=e;_g()&&fi(!1);let c=t.replace(/^\/*/,"/"),d=M.useMemo(()=>({basename:c,navigator:a,static:o,future:Om({v7_relativeSplatPath:!1},s)}),[c,s,a,o]);typeof r=="string"&&(r=Jh(r));let{pathname:p="/",search:m="",hash:y="",state:b=null,key:P="default"}=r,x=M.useMemo(()=>{let w=cE(p,c);return w==null?null:{location:{pathname:w,search:m,hash:y,state:b,key:P},navigationType:i}},[c,p,m,y,b,P,i]);return x==null?null:M.createElement(ud.Provider,{value:d},M.createElement(ib.Provider,{children:n,value:x}))}function YG(e){let{children:t,location:n}=e;return LG(qj(t),n)}new Promise(()=>{});function qj(e,t){t===void 0&&(t=[]);let n=[];return M.Children.forEach(e,(r,i)=>{if(!M.isValidElement(r))return;let a=[...t,i];if(r.type===M.Fragment){n.push.apply(n,qj(r.props.children,a));return}r.type!==hy&&fi(!1),!r.props.index||!r.props.children||fi(!1);let o={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=qj(r.props.children,a)),n.push(o)}),n}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function zj(){return zj=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function QG(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function JG(e,t){return e.button===0&&(!t||t==="_self")&&!QG(e)}const eZ=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],tZ="6";try{window.__reactRouterVersion=tZ}catch{}const nZ="startTransition",e2=X0[nZ];function rZ(e){let{basename:t,children:n,future:r,window:i}=e,a=M.useRef();a.current==null&&(a.current=aG({window:i,v5Compat:!0}));let o=a.current,[s,c]=M.useState({action:o.action,location:o.location}),{v7_startTransition:d}=r||{},p=M.useCallback(m=>{d&&e2?e2(()=>c(m)):c(m)},[c,d]);return M.useLayoutEffect(()=>o.listen(p),[o,p]),M.useEffect(()=>GG(r),[r]),M.createElement(ZG,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o,future:r})}const iZ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",aZ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zo=M.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:a,replace:o,state:s,target:c,to:d,preventScrollReset:p,viewTransition:m}=t,y=XG(t,eZ),{basename:b}=M.useContext(ud),P,x=!1;if(typeof d=="string"&&aZ.test(d)&&(P=d,iZ))try{let k=new URL(window.location.href),D=d.startsWith("//")?new URL(k.protocol+d):new URL(d),I=cE(D.pathname,b);D.origin===k.origin&&I!=null?d=I+D.search+D.hash:x=!0}catch{}let w=MG(d,{relative:i}),T=oZ(d,{replace:o,state:s,target:c,preventScrollReset:p,relative:i,viewTransition:m});function E(k){r&&r(k),k.defaultPrevented||T(k)}return M.createElement("a",zj({},y,{href:P||w,onClick:x||a?r:E,ref:n,target:c}))});var t2;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(t2||(t2={}));var n2;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(n2||(n2={}));function oZ(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:s}=t===void 0?{}:t,c=dE(),d=cd(),p=KF(e,{relative:o});return M.useCallback(m=>{if(JG(m,n)){m.preventDefault();let y=r!==void 0?r:Ry(d)===Ry(p);c(e,{replace:y,state:i,preventScrollReset:a,relative:o,viewTransition:s})}},[d,c,p,r,i,n,e,a,o,s])}function YF(e,t){return function(){return e.apply(t,arguments)}}const{toString:sZ}=Object.prototype,{getPrototypeOf:hE}=Object,{iterator:ab,toStringTag:XF}=Symbol,ob=(e=>t=>{const n=sZ.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),hl=e=>(e=e.toLowerCase(),t=>ob(t)===e),sb=e=>t=>typeof t===e,{isArray:ep}=Array,vh=sb("undefined");function Sg(e){return e!==null&&!vh(e)&&e.constructor!==null&&!vh(e.constructor)&&Po(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const QF=hl("ArrayBuffer");function lZ(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&QF(e.buffer),t}const uZ=sb("string"),Po=sb("function"),JF=sb("number"),Pg=e=>e!==null&&typeof e=="object",cZ=e=>e===!0||e===!1,py=e=>{if(ob(e)!=="object")return!1;const t=hE(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(XF in e)&&!(ab in e)},fZ=e=>{if(!Pg(e)||Sg(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},dZ=hl("Date"),hZ=hl("File"),pZ=hl("Blob"),mZ=hl("FileList"),gZ=e=>Pg(e)&&Po(e.pipe),vZ=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Po(e.append)&&((t=ob(e))==="formdata"||t==="object"&&Po(e.toString)&&e.toString()==="[object FormData]"))},yZ=hl("URLSearchParams"),[bZ,xZ,wZ,_Z]=["ReadableStream","Request","Response","Headers"].map(hl),SZ=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jg(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),ep(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const Tf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,t5=e=>!vh(e)&&e!==Tf;function Uj(){const{caseless:e,skipUndefined:t}=t5(this)&&this||{},n={},r=(i,a)=>{if(a==="__proto__"||a==="constructor"||a==="prototype")return;const o=e&&e5(n,a)||a;py(n[o])&&py(i)?n[o]=Uj(n[o],i):py(i)?n[o]=Uj({},i):ep(i)?n[o]=i.slice():(!t||!vh(i))&&(n[o]=i)};for(let i=0,a=arguments.length;i(jg(t,(i,a)=>{n&&Po(i)?Object.defineProperty(e,a,{value:YF(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,a,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),jZ=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),OZ=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},TZ=(e,t,n,r)=>{let i,a,o;const s={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&hE(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},EZ=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},AZ=e=>{if(!e)return null;if(ep(e))return e;let t=e.length;if(!JF(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},kZ=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&hE(Uint8Array)),CZ=(e,t)=>{const r=(e&&e[ab]).call(e);let i;for(;(i=r.next())&&!i.done;){const a=i.value;t.call(e,a[0],a[1])}},NZ=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},MZ=hl("HTMLFormElement"),RZ=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),r2=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),LZ=hl("RegExp"),n5=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};jg(n,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(r[a]=o||i)}),Object.defineProperties(e,r)},IZ=e=>{n5(e,(t,n)=>{if(Po(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Po(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},DZ=(e,t)=>{const n={},r=i=>{i.forEach(a=>{n[a]=!0})};return ep(e)?r(e):r(String(e).split(t)),n},BZ=()=>{},$Z=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function FZ(e){return!!(e&&Po(e.append)&&e[XF]==="FormData"&&e[ab])}const qZ=e=>{const t=new Array(10),n=(r,i)=>{if(Pg(r)){if(t.indexOf(r)>=0)return;if(Sg(r))return r;if(!("toJSON"in r)){t[i]=r;const a=ep(r)?[]:{};return jg(r,(o,s)=>{const c=n(o,i+1);!vh(c)&&(a[s]=c)}),t[i]=void 0,a}}return r};return n(e,0)},zZ=hl("AsyncFunction"),UZ=e=>e&&(Pg(e)||Po(e))&&Po(e.then)&&Po(e.catch),r5=((e,t)=>e?setImmediate:t?((n,r)=>(Tf.addEventListener("message",({source:i,data:a})=>{i===Tf&&a===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Tf.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Po(Tf.postMessage)),VZ=typeof queueMicrotask<"u"?queueMicrotask.bind(Tf):typeof process<"u"&&process.nextTick||r5,WZ=e=>e!=null&&Po(e[ab]),Ue={isArray:ep,isArrayBuffer:QF,isBuffer:Sg,isFormData:vZ,isArrayBufferView:lZ,isString:uZ,isNumber:JF,isBoolean:cZ,isObject:Pg,isPlainObject:py,isEmptyObject:fZ,isReadableStream:bZ,isRequest:xZ,isResponse:wZ,isHeaders:_Z,isUndefined:vh,isDate:dZ,isFile:hZ,isBlob:pZ,isRegExp:LZ,isFunction:Po,isStream:gZ,isURLSearchParams:yZ,isTypedArray:kZ,isFileList:mZ,forEach:jg,merge:Uj,extend:PZ,trim:SZ,stripBOM:jZ,inherits:OZ,toFlatObject:TZ,kindOf:ob,kindOfTest:hl,endsWith:EZ,toArray:AZ,forEachEntry:CZ,matchAll:NZ,isHTMLForm:MZ,hasOwnProperty:r2,hasOwnProp:r2,reduceDescriptors:n5,freezeMethods:IZ,toObjectSet:DZ,toCamelCase:RZ,noop:BZ,toFiniteNumber:$Z,findKey:e5,global:Tf,isContextDefined:t5,isSpecCompliantForm:FZ,toJSONObject:qZ,isAsyncFn:zZ,isThenable:UZ,setImmediate:r5,asap:VZ,isIterable:WZ};let Qt=class i5 extends Error{static from(t,n,r,i,a,o){const s=new i5(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,o&&Object.assign(s,o),s}constructor(t,n,r,i,a){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),i&&(this.request=i),a&&(this.response=a,this.status=a.status)}toJSON(){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:Ue.toJSONObject(this.config),code:this.code,status:this.status}}};Qt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Qt.ERR_BAD_OPTION="ERR_BAD_OPTION";Qt.ECONNABORTED="ECONNABORTED";Qt.ETIMEDOUT="ETIMEDOUT";Qt.ERR_NETWORK="ERR_NETWORK";Qt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Qt.ERR_DEPRECATED="ERR_DEPRECATED";Qt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Qt.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Qt.ERR_CANCELED="ERR_CANCELED";Qt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Qt.ERR_INVALID_URL="ERR_INVALID_URL";const KZ=null;function Vj(e){return Ue.isPlainObject(e)||Ue.isArray(e)}function a5(e){return Ue.endsWith(e,"[]")?e.slice(0,-2):e}function i2(e,t,n){return e?e.concat(t).map(function(i,a){return i=a5(i),!n&&a?"["+i+"]":i}).join(n?".":""):t}function HZ(e){return Ue.isArray(e)&&!e.some(Vj)}const GZ=Ue.toFlatObject(Ue,{},null,function(t){return/^is[A-Z]/.test(t)});function lb(e,t,n){if(!Ue.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=Ue.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,w){return!Ue.isUndefined(w[x])});const r=n.metaTokens,i=n.visitor||p,a=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&Ue.isSpecCompliantForm(t);if(!Ue.isFunction(i))throw new TypeError("visitor must be a function");function d(P){if(P===null)return"";if(Ue.isDate(P))return P.toISOString();if(Ue.isBoolean(P))return P.toString();if(!c&&Ue.isBlob(P))throw new Qt("Blob is not supported. Use a Buffer instead.");return Ue.isArrayBuffer(P)||Ue.isTypedArray(P)?c&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function p(P,x,w){let T=P;if(P&&!w&&typeof P=="object"){if(Ue.endsWith(x,"{}"))x=r?x:x.slice(0,-2),P=JSON.stringify(P);else if(Ue.isArray(P)&&HZ(P)||(Ue.isFileList(P)||Ue.endsWith(x,"[]"))&&(T=Ue.toArray(P)))return x=a5(x),T.forEach(function(k,D){!(Ue.isUndefined(k)||k===null)&&t.append(o===!0?i2([x],D,a):o===null?x:x+"[]",d(k))}),!1}return Vj(P)?!0:(t.append(i2(w,x,a),d(P)),!1)}const m=[],y=Object.assign(GZ,{defaultVisitor:p,convertValue:d,isVisitable:Vj});function b(P,x){if(!Ue.isUndefined(P)){if(m.indexOf(P)!==-1)throw Error("Circular reference detected in "+x.join("."));m.push(P),Ue.forEach(P,function(T,E){(!(Ue.isUndefined(T)||T===null)&&i.call(t,T,Ue.isString(E)?E.trim():E,x,y))===!0&&b(T,x?x.concat(E):[E])}),m.pop()}}if(!Ue.isObject(e))throw new TypeError("data must be an object");return b(e),t}function a2(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function pE(e,t){this._pairs=[],e&&lb(e,this,t)}const o5=pE.prototype;o5.append=function(t,n){this._pairs.push([t,n])};o5.toString=function(t){const n=t?function(r){return t.call(this,r,a2)}:a2;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function ZZ(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function s5(e,t,n){if(!t)return e;const r=n&&n.encode||ZZ,i=Ue.isFunction(n)?{serialize:n}:n,a=i&&i.serialize;let o;if(a?o=a(t,i):o=Ue.isURLSearchParams(t)?t.toString():new pE(t,i).toString(r),o){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class o2{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Ue.forEach(this.handlers,function(r){r!==null&&t(r)})}}const mE={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},YZ=typeof URLSearchParams<"u"?URLSearchParams:pE,XZ=typeof FormData<"u"?FormData:null,QZ=typeof Blob<"u"?Blob:null,JZ={isBrowser:!0,classes:{URLSearchParams:YZ,FormData:XZ,Blob:QZ},protocols:["http","https","file","blob","url","data"]},gE=typeof window<"u"&&typeof document<"u",Wj=typeof navigator=="object"&&navigator||void 0,eY=gE&&(!Wj||["ReactNative","NativeScript","NS"].indexOf(Wj.product)<0),tY=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",nY=gE&&window.location.href||"http://localhost",rY=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:gE,hasStandardBrowserEnv:eY,hasStandardBrowserWebWorkerEnv:tY,navigator:Wj,origin:nY},Symbol.toStringTag,{value:"Module"})),Ea={...rY,...JZ};function iY(e,t){return lb(e,new Ea.classes.URLSearchParams,{visitor:function(n,r,i,a){return Ea.isNode&&Ue.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function aY(e){return Ue.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function oY(e){const t={},n=Object.keys(e);let r;const i=n.length;let a;for(r=0;r=n.length;return o=!o&&Ue.isArray(i)?i.length:o,c?(Ue.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s):((!i[o]||!Ue.isObject(i[o]))&&(i[o]=[]),t(n,r,i[o],a)&&Ue.isArray(i[o])&&(i[o]=oY(i[o])),!s)}if(Ue.isFormData(e)&&Ue.isFunction(e.entries)){const n={};return Ue.forEachEntry(e,(r,i)=>{t(aY(r),i,n,0)}),n}return null}function sY(e,t,n){if(Ue.isString(e))try{return(t||JSON.parse)(e),Ue.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Og={transitional:mE,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,a=Ue.isObject(t);if(a&&Ue.isHTMLForm(t)&&(t=new FormData(t)),Ue.isFormData(t))return i?JSON.stringify(l5(t)):t;if(Ue.isArrayBuffer(t)||Ue.isBuffer(t)||Ue.isStream(t)||Ue.isFile(t)||Ue.isBlob(t)||Ue.isReadableStream(t))return t;if(Ue.isArrayBufferView(t))return t.buffer;if(Ue.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return iY(t,this.formSerializer).toString();if((s=Ue.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return lb(s?{"files[]":t}:t,c&&new c,this.formSerializer)}}return a||i?(n.setContentType("application/json",!1),sY(t)):t}],transformResponse:[function(t){const n=this.transitional||Og.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(Ue.isResponse(t)||Ue.isReadableStream(t))return t;if(t&&Ue.isString(t)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(s){if(o)throw s.name==="SyntaxError"?Qt.from(s,Qt.ERR_BAD_RESPONSE,this,null,this.response):s}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ea.classes.FormData,Blob:Ea.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ue.forEach(["delete","get","head","post","put","patch"],e=>{Og.headers[e]={}});const lY=Ue.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"]),uY=e=>{const t={};let n,r,i;return e&&e.split(` `).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||t[n]&&lY[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},s2=Symbol("internals");function Dp(e){return e&&String(e).trim().toLowerCase()}function my(e){return e===!1||e==null?e:Ue.isArray(e)?e.map(my):String(e)}function cY(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const fY=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Lw(e,t,n,r,i){if(Ue.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!Ue.isString(t)){if(Ue.isString(r))return t.indexOf(r)!==-1;if(Ue.isRegExp(r))return r.test(t)}}function dY(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function hY(e,t){const n=Ue.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,a,o){return this[r].call(this,t,i,a,o)},configurable:!0})})}let jo=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function a(s,c,d){const p=Dp(c);if(!p)throw new Error("header name must be a non-empty string");const m=Ue.findKey(i,p);(!m||i[m]===void 0||d===!0||d===void 0&&i[m]!==!1)&&(i[m||c]=my(s))}const o=(s,c)=>Ue.forEach(s,(d,p)=>a(d,p,c));if(Ue.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(Ue.isString(t)&&(t=t.trim())&&!fY(t))o(uY(t),n);else if(Ue.isObject(t)&&Ue.isIterable(t)){let s={},c,d;for(const p of t){if(!Ue.isArray(p))throw TypeError("Object iterator must return a key-value pair");s[d=p[0]]=(c=s[d])?Ue.isArray(c)?[...c,p[1]]:[c,p[1]]:p[1]}o(s,n)}else t!=null&&a(n,t,r);return this}get(t,n){if(t=Dp(t),t){const r=Ue.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return cY(i);if(Ue.isFunction(n))return n.call(this,i,r);if(Ue.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Dp(t),t){const r=Ue.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Lw(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function a(o){if(o=Dp(o),o){const s=Ue.findKey(r,o);s&&(!n||Lw(r,r[s],s,n))&&(delete r[s],i=!0)}}return Ue.isArray(t)?t.forEach(a):a(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const a=n[r];(!t||Lw(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){const n=this,r={};return Ue.forEach(this,(i,a)=>{const o=Ue.findKey(r,a);if(o){n[o]=my(i),delete n[a];return}const s=t?dY(a):String(a).trim();s!==a&&delete n[a],n[s]=my(i),r[s]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return Ue.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&Ue.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[s2]=this[s2]={accessors:{}}).accessors,i=this.prototype;function a(o){const s=Dp(o);r[s]||(hY(i,o),r[s]=!0)}return Ue.isArray(t)?t.forEach(a):a(t),this}};jo.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ue.reduceDescriptors(jo.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});Ue.freezeMethods(jo);function Iw(e,t){const n=this||Og,r=t||n,i=jo.from(r.headers);let a=r.data;return Ue.forEach(e,function(s){a=s.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function u5(e){return!!(e&&e.__CANCEL__)}let Tg=class extends Qt{constructor(t,n,r){super(t??"canceled",Qt.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function c5(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Qt("Request failed with status code "+n.status,[Qt.ERR_BAD_REQUEST,Qt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function pY(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function mY(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,a=0,o;return t=t!==void 0?t:1e3,function(c){const d=Date.now(),p=r[a];o||(o=d),n[i]=c,r[i]=d;let m=a,y=0;for(;m!==i;)y+=n[m++],m=m%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),d-o{n=p,i=null,a&&(clearTimeout(a),a=null),e(...d)};return[(...d)=>{const p=Date.now(),m=p-n;m>=r?o(d,p):(i=d,a||(a=setTimeout(()=>{a=null,o(i)},r-m)))},()=>i&&o(i)]}const Ly=(e,t,n=3)=>{let r=0;const i=mY(50,250);return gY(a=>{const o=a.loaded,s=a.lengthComputable?a.total:void 0,c=o-r,d=i(c),p=o<=s;r=o;const m={loaded:o,total:s,progress:s?o/s:void 0,bytes:c,rate:d||void 0,estimated:d&&s&&p?(s-o)/d:void 0,event:a,lengthComputable:s!=null,[t?"download":"upload"]:!0};e(m)},n)},l2=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},u2=e=>(...t)=>Ue.asap(()=>e(...t)),vY=Ea.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Ea.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Ea.origin),Ea.navigator&&/(msie|trident)/i.test(Ea.navigator.userAgent)):()=>!0,yY=Ea.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>"u")return;const s=[`${e}=${encodeURIComponent(t)}`];Ue.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),Ue.isString(r)&&s.push(`path=${r}`),Ue.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push("secure"),Ue.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function bY(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function xY(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function f5(e,t,n){let r=!bY(t);return e&&(r||n==!1)?xY(e,t):t}const c2=e=>e instanceof jo?{...e}:e;function Yf(e,t){t=t||{};const n={};function r(d,p,m,y){return Ue.isPlainObject(d)&&Ue.isPlainObject(p)?Ue.merge.call({caseless:y},d,p):Ue.isPlainObject(p)?Ue.merge({},p):Ue.isArray(p)?p.slice():p}function i(d,p,m,y){if(Ue.isUndefined(p)){if(!Ue.isUndefined(d))return r(void 0,d,m,y)}else return r(d,p,m,y)}function a(d,p){if(!Ue.isUndefined(p))return r(void 0,p)}function o(d,p){if(Ue.isUndefined(p)){if(!Ue.isUndefined(d))return r(void 0,d)}else return r(void 0,p)}function s(d,p,m){if(m in t)return r(d,p);if(m in e)return r(void 0,d)}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:(d,p,m)=>i(c2(d),c2(p),m,!0)};return Ue.forEach(Object.keys({...e,...t}),function(p){if(p==="__proto__"||p==="constructor"||p==="prototype")return;const m=Ue.hasOwnProp(c,p)?c[p]:i,y=m(e[p],t[p],p);Ue.isUndefined(y)&&m!==s||(n[p]=y)}),n}const d5=e=>{const t=Yf({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:s}=t;if(t.headers=o=jo.from(o),t.url=s5(f5(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&o.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),Ue.isFormData(n)){if(Ea.hasStandardBrowserEnv||Ea.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Ue.isFunction(n.getHeaders)){const c=n.getHeaders(),d=["content-type","content-length"];Object.entries(c).forEach(([p,m])=>{d.includes(p.toLowerCase())&&o.set(p,m)})}}if(Ea.hasStandardBrowserEnv&&(r&&Ue.isFunction(r)&&(r=r(t)),r||r!==!1&&vY(t.url))){const c=i&&a&&yY.read(a);c&&o.set(i,c)}return t},wY=typeof XMLHttpRequest<"u",_Y=wY&&function(e){return new Promise(function(n,r){const i=d5(e);let a=i.data;const o=jo.from(i.headers).normalize();let{responseType:s,onUploadProgress:c,onDownloadProgress:d}=i,p,m,y,b,P;function x(){b&&b(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(p),i.signal&&i.signal.removeEventListener("abort",p)}let w=new XMLHttpRequest;w.open(i.method.toUpperCase(),i.url,!0),w.timeout=i.timeout;function T(){if(!w)return;const k=jo.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),I={data:!s||s==="text"||s==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:k,config:e,request:w};c5(function($){n($),x()},function($){r($),x()},I),w=null}"onloadend"in w?w.onloadend=T:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(T)},w.onabort=function(){w&&(r(new Qt("Request aborted",Qt.ECONNABORTED,e,w)),w=null)},w.onerror=function(D){const I=D&&D.message?D.message:"Network Error",R=new Qt(I,Qt.ERR_NETWORK,e,w);R.event=D||null,r(R),w=null},w.ontimeout=function(){let D=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const I=i.transitional||mE;i.timeoutErrorMessage&&(D=i.timeoutErrorMessage),r(new Qt(D,I.clarifyTimeoutError?Qt.ETIMEDOUT:Qt.ECONNABORTED,e,w)),w=null},a===void 0&&o.setContentType(null),"setRequestHeader"in w&&Ue.forEach(o.toJSON(),function(D,I){w.setRequestHeader(I,D)}),Ue.isUndefined(i.withCredentials)||(w.withCredentials=!!i.withCredentials),s&&s!=="json"&&(w.responseType=i.responseType),d&&([y,P]=Ly(d,!0),w.addEventListener("progress",y)),c&&w.upload&&([m,b]=Ly(c),w.upload.addEventListener("progress",m),w.upload.addEventListener("loadend",b)),(i.cancelToken||i.signal)&&(p=k=>{w&&(r(!k||k.type?new Tg(null,e,w):k),w.abort(),w=null)},i.cancelToken&&i.cancelToken.subscribe(p),i.signal&&(i.signal.aborted?p():i.signal.addEventListener("abort",p)));const E=pY(i.url);if(E&&Ea.protocols.indexOf(E)===-1){r(new Qt("Unsupported protocol "+E+":",Qt.ERR_BAD_REQUEST,e));return}w.send(a||null)})},SY=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const a=function(d){if(!i){i=!0,s();const p=d instanceof Error?d:this.reason;r.abort(p instanceof Qt?p:new Tg(p instanceof Error?p.message:p))}};let o=t&&setTimeout(()=>{o=null,a(new Qt(`timeout of ${t}ms exceeded`,Qt.ETIMEDOUT))},t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(d=>{d.unsubscribe?d.unsubscribe(a):d.removeEventListener("abort",a)}),e=null)};e.forEach(d=>d.addEventListener("abort",a));const{signal:c}=r;return c.unsubscribe=()=>Ue.asap(s),c}},PY=function*(e,t){let n=e.byteLength;if(n{const i=jY(e,t);let a=0,o,s=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:d,value:p}=await i.next();if(d){s(),c.close();return}let m=p.byteLength;if(n){let y=a+=m;n(y)}c.enqueue(new Uint8Array(p))}catch(d){throw s(d),d}},cancel(c){return s(c),i.return()}},{highWaterMark:2})},d2=64*1024,{isFunction:Dv}=Ue,TY=(({Request:e,Response:t})=>({Request:e,Response:t}))(Ue.global),{ReadableStream:h2,TextEncoder:p2}=Ue.global,m2=(e,...t)=>{try{return!!e(...t)}catch{return!1}},EY=e=>{e=Ue.merge.call({skipUndefined:!0},TY,e);const{fetch:t,Request:n,Response:r}=e,i=t?Dv(t):typeof fetch=="function",a=Dv(n),o=Dv(r);if(!i)return!1;const s=i&&Dv(h2),c=i&&(typeof p2=="function"?(P=>x=>P.encode(x))(new p2):async P=>new Uint8Array(await new n(P).arrayBuffer())),d=a&&s&&m2(()=>{let P=!1;const x=new n(Ea.origin,{body:new h2,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!x}),p=o&&s&&m2(()=>Ue.isReadableStream(new r("").body)),m={stream:p&&(P=>P.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!m[P]&&(m[P]=(x,w)=>{let T=x&&x[P];if(T)return T.call(x);throw new Qt(`Response type '${P}' is not supported`,Qt.ERR_NOT_SUPPORT,w)})});const y=async P=>{if(P==null)return 0;if(Ue.isBlob(P))return P.size;if(Ue.isSpecCompliantForm(P))return(await new n(Ea.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(Ue.isArrayBufferView(P)||Ue.isArrayBuffer(P))return P.byteLength;if(Ue.isURLSearchParams(P)&&(P=P+""),Ue.isString(P))return(await c(P)).byteLength},b=async(P,x)=>{const w=Ue.toFiniteNumber(P.getContentLength());return w??y(x)};return async P=>{let{url:x,method:w,data:T,signal:E,cancelToken:k,timeout:D,onDownloadProgress:I,onUploadProgress:R,responseType:$,headers:V,withCredentials:K="same-origin",fetchOptions:Z}=d5(P),ee=t||fetch;$=$?($+"").toLowerCase():"text";let ne=SY([E,k&&k.toAbortSignal()],D),oe=null;const he=ne&&ne.unsubscribe&&(()=>{ne.unsubscribe()});let Se;try{if(R&&d&&w!=="get"&&w!=="head"&&(Se=await b(V,T))!==0){let ie=new n(x,{method:"POST",body:T,duplex:"half"}),de;if(Ue.isFormData(T)&&(de=ie.headers.get("content-type"))&&V.setContentType(de),ie.body){const[He,je]=l2(Se,Ly(u2(R)));T=f2(ie.body,d2,He,je)}}Ue.isString(K)||(K=K?"include":"omit");const fe=a&&"credentials"in n.prototype,Oe={...Z,signal:ne,method:w.toUpperCase(),headers:V.normalize().toJSON(),body:T,duplex:"half",credentials:fe?K:void 0};oe=a&&new n(x,Oe);let re=await(a?ee(oe,Z):ee(x,Oe));const Ce=p&&($==="stream"||$==="response");if(p&&(I||Ce&&he)){const ie={};["status","statusText","headers"].forEach($e=>{ie[$e]=re[$e]});const de=Ue.toFiniteNumber(re.headers.get("content-length")),[He,je]=I&&l2(de,Ly(u2(I),!0))||[];re=new r(f2(re.body,d2,He,()=>{je&&je(),he&&he()}),ie)}$=$||"text";let ae=await m[Ue.findKey(m,$)||"text"](re,P);return!Ce&&he&&he(),await new Promise((ie,de)=>{c5(ie,de,{data:ae,headers:jo.from(re.headers),status:re.status,statusText:re.statusText,config:P,request:oe})})}catch(fe){throw he&&he(),fe&&fe.name==="TypeError"&&/Load failed|fetch/i.test(fe.message)?Object.assign(new Qt("Network Error",Qt.ERR_NETWORK,P,oe,fe&&fe.response),{cause:fe.cause||fe}):Qt.from(fe,fe&&fe.code,P,oe,fe&&fe.response)}}},AY=new Map,h5=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,a=[r,i,n];let o=a.length,s=o,c,d,p=AY;for(;s--;)c=a[s],d=p.get(c),d===void 0&&p.set(c,d=s?new Map:EY(t)),p=d;return d};h5();const vE={http:KZ,xhr:_Y,fetch:{get:h5}};Ue.forEach(vE,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const g2=e=>`- ${e}`,kY=e=>Ue.isFunction(e)||e===null||e===!1;function CY(e,t){e=Ue.isArray(e)?e:[e];const{length:n}=e;let r,i;const a={};for(let o=0;o`adapter ${c} `+(d===!1?"is not supported by the environment":"is not available in the build"));let s=n?o.length>1?`since : `+o.map(g2).join(` `):" "+g2(o[0]):"as no adapter specified";throw new Qt("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return i}const p5={getAdapter:CY,adapters:vE};function Dw(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Tg(null,e)}function v2(e){return Dw(e),e.headers=jo.from(e.headers),e.data=Iw.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),p5.getAdapter(e.adapter||Og.adapter,e)(e).then(function(r){return Dw(e),r.data=Iw.call(e,e.transformResponse,r),r.headers=jo.from(r.headers),r},function(r){return u5(r)||(Dw(e),r&&r.response&&(r.response.data=Iw.call(e,e.transformResponse,r.response),r.response.headers=jo.from(r.response.headers))),Promise.reject(r)})}const m5="1.13.5",ub={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ub[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const y2={};ub.transitional=function(t,n,r){function i(a,o){return"[Axios v"+m5+"] Transitional option '"+a+"'"+o+(r?". "+r:"")}return(a,o,s)=>{if(t===!1)throw new Qt(i(o," has been removed"+(n?" in "+n:"")),Qt.ERR_DEPRECATED);return n&&!y2[o]&&(y2[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,o,s):!0}};ub.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function NY(e,t,n){if(typeof e!="object")throw new Qt("options must be an object",Qt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const a=r[i],o=t[a];if(o){const s=e[a],c=s===void 0||o(s,a,e);if(c!==!0)throw new Qt("option "+a+" must be "+c,Qt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Qt("Unknown option "+a,Qt.ERR_BAD_OPTION)}}const gy={assertOptions:NY,validators:ub},ds=gy.validators;let Uf=class{constructor(t){this.defaults=t||{},this.interceptors={request:new o2,response:new o2}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const a=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=` `+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Yf(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:a}=n;r!==void 0&&gy.assertOptions(r,{silentJSONParsing:ds.transitional(ds.boolean),forcedJSONParsing:ds.transitional(ds.boolean),clarifyTimeoutError:ds.transitional(ds.boolean),legacyInterceptorReqResOrdering:ds.transitional(ds.boolean)},!1),i!=null&&(Ue.isFunction(i)?n.paramsSerializer={serialize:i}:gy.assertOptions(i,{encode:ds.function,serialize:ds.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),gy.assertOptions(n,{baseUrl:ds.spelling("baseURL"),withXsrfToken:ds.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=a&&Ue.merge(a.common,a[n.method]);a&&Ue.forEach(["delete","get","head","post","put","patch","common"],P=>{delete a[P]}),n.headers=jo.concat(o,a);const s=[];let c=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(n)===!1)return;c=c&&x.synchronous;const w=n.transitional||mE;w&&w.legacyInterceptorReqResOrdering?s.unshift(x.fulfilled,x.rejected):s.push(x.fulfilled,x.rejected)});const d=[];this.interceptors.response.forEach(function(x){d.push(x.fulfilled,x.rejected)});let p,m=0,y;if(!c){const P=[v2.bind(this),void 0];for(P.unshift(...s),P.push(...d),y=P.length,p=Promise.resolve(n);m{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](i);r._listeners=null}),this.promise.then=i=>{let a;const o=new Promise(s=>{r.subscribe(s),a=s}).then(i);return o.cancel=function(){r.unsubscribe(a)},o},t(function(a,o,s){r.reason||(r.reason=new Tg(a,o,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new g5(function(i){t=i}),cancel:t}}};function RY(e){return function(n){return e.apply(null,n)}}function LY(e){return Ue.isObject(e)&&e.isAxiosError===!0}const Kj={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(Kj).forEach(([e,t])=>{Kj[t]=e});function v5(e){const t=new Uf(e),n=YF(Uf.prototype.request,t);return Ue.extend(n,Uf.prototype,t,{allOwnKeys:!0}),Ue.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return v5(Yf(e,i))},n}const ni=v5(Og);ni.Axios=Uf;ni.CanceledError=Tg;ni.CancelToken=MY;ni.isCancel=u5;ni.VERSION=m5;ni.toFormData=lb;ni.AxiosError=Qt;ni.Cancel=ni.CanceledError;ni.all=function(t){return Promise.all(t)};ni.spread=RY;ni.isAxiosError=LY;ni.mergeConfig=Yf;ni.AxiosHeaders=jo;ni.formToJSON=e=>l5(Ue.isHTMLForm(e)?new FormData(e):e);ni.getAdapter=p5.getAdapter;ni.HttpStatusCode=Kj;ni.default=ni;const{Axios:POe,AxiosError:jOe,CanceledError:OOe,isCancel:TOe,CancelToken:EOe,VERSION:AOe,all:kOe,Cancel:COe,isAxiosError:NOe,spread:MOe,toFormData:ROe,AxiosHeaders:LOe,HttpStatusCode:IOe,formToJSON:DOe,getAdapter:BOe,mergeConfig:$Oe}=ni,IY=typeof window>"u",b2=!IY&&window.self!==window.top,Bw=()=>Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),ia=[];for(let e=0;e<256;++e)ia.push((e+256).toString(16).slice(1));function DY(e,t=0){return(ia[e[t+0]]+ia[e[t+1]]+ia[e[t+2]]+ia[e[t+3]]+"-"+ia[e[t+4]]+ia[e[t+5]]+"-"+ia[e[t+6]]+ia[e[t+7]]+"-"+ia[e[t+8]]+ia[e[t+9]]+"-"+ia[e[t+10]]+ia[e[t+11]]+ia[e[t+12]]+ia[e[t+13]]+ia[e[t+14]]+ia[e[t+15]]).toLowerCase()}let $w;const BY=new Uint8Array(16);function $Y(){if(!$w){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");$w=crypto.getRandomValues.bind(crypto)}return $w(BY)}const FY=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),x2={randomUUID:FY};function qY(e,t,n){var i;e=e||{};const r=e.random??((i=e.rng)==null?void 0:i.call(e))??$Y();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,DY(r)}function zY(e,t,n){return x2.randomUUID&&!e?x2.randomUUID():qY(e)}class UY extends Error{constructor(t,n,r,i,a){super(t),this.name="Base44Error",this.status=n,this.code=r,this.data=i,this.originalError=a}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code,data:this.data}}}function Jp({baseURL:e,headers:t={},token:n,interceptResponses:r=!0,onError:i}){const a=ni.create({baseURL:e,headers:{"Content-Type":"application/json",Accept:"application/json",...t}});return n&&(a.defaults.headers.common.Authorization=`Bearer ${n}`),a.interceptors.request.use(o=>{typeof window<"u"&&o.headers.set("X-Origin-URL",window.location.href);const s=zY();if(o.requestId=s,b2)try{window.parent.postMessage({type:"api-request-start",requestId:s,data:{url:e+o.url,method:o.method,body:o.data instanceof FormData?"[FormData object]":o.data}},"*")}catch{}return o}),r&&a.interceptors.response.use(o=>{var s;const c=(s=o.config)===null||s===void 0?void 0:s.requestId;try{b2&&c&&window.parent.postMessage({type:"api-request-end",requestId:c,data:{statusCode:o.status,response:o.data}},"*")}catch{}return o.data},o=>{var s,c,d,p,m,y,b,P;const x=((c=(s=o.response)===null||s===void 0?void 0:s.data)===null||c===void 0?void 0:c.message)||((p=(d=o.response)===null||d===void 0?void 0:d.data)===null||p===void 0?void 0:p.detail)||o.message,w=new UY(x,(m=o.response)===null||m===void 0?void 0:m.status,(b=(y=o.response)===null||y===void 0?void 0:y.data)===null||b===void 0?void 0:b.code,(P=o.response)===null||P===void 0?void 0:P.data,o);return i==null||i(w),Promise.reject(w)}),a}function w2(e){const{axios:t,appId:n,getSocket:r}=e;return new Proxy({},{get(i,a){if(!(typeof a!="string"||a==="then"||a.startsWith("_")))return WY(t,n,a,r)}})}function VY(e){var t;try{const n=JSON.parse(e);return{type:n.type,data:n.data,id:n.id||((t=n.data)===null||t===void 0?void 0:t.id),timestamp:n.timestamp||new Date().toISOString()}}catch(n){return console.warn("[Base44 SDK] Failed to parse realtime message:",n),null}}function WY(e,t,n,r){const i=`/apps/${t}/entities/${n}`;return{async list(a,o,s,c){const d={};return a&&(d.sort=a),o&&(d.limit=o),s&&(d.skip=s),c&&(d.fields=Array.isArray(c)?c.join(","):c),e.get(i,{params:d})},async filter(a,o,s,c,d){const p={q:JSON.stringify(a)};return o&&(p.sort=o),s&&(p.limit=s),c&&(p.skip=c),d&&(p.fields=Array.isArray(d)?d.join(","):d),e.get(i,{params:p})},async get(a){return e.get(`${i}/${a}`)},async create(a){return e.post(i,a)},async update(a,o){return e.put(`${i}/${a}`,o)},async delete(a){return e.delete(`${i}/${a}`)},async deleteMany(a){return e.delete(i,{data:a})},async bulkCreate(a){return e.post(`${i}/bulk`,a)},async importEntities(a){const o=new FormData;return o.append("file",a,a.name),e.post(`${i}/import`,o,{headers:{"Content-Type":"multipart/form-data"}})},subscribe(a){const o=`entities:${t}:${n}`;return r().subscribeToRoom(o,{update_model:d=>{const p=VY(d.data);if(p)try{a(p)}catch(m){console.error("[Base44 SDK] Subscription callback error:",m)}}})}}}function KY(e,t){return{async call(n,r,i){if(!(n!=null&&n.trim()))throw new Error("Integration slug is required and cannot be empty");if(!(r!=null&&r.trim()))throw new Error("Operation ID is required and cannot be empty");const{pathParams:a,queryParams:o,...s}=i??{},c={...s,...a&&{path_params:a},...o&&{query_params:o}};return await e.post(`/apps/${t}/integrations/custom/${n}/${r}`,c)}}}function _2(e,t){const n=KY(e,t);return new Proxy({},{get(r,i){if(!(typeof i!="string"||i==="then"||i.startsWith("_")))return i==="custom"?n:new Proxy({},{get(a,o){if(!(typeof o!="string"||o==="then"||o.startsWith("_")))return async s=>{if(typeof s=="string")throw new Error(`Integration ${o} must receive an object with named parameters, received: ${s}`);let c,d;return s instanceof FormData||s&&Object.values(s).some(p=>p instanceof File)?(c=new FormData,Object.keys(s).forEach(p=>{s[p]instanceof File?c.append(p,s[p],s[p].name):typeof s[p]=="object"&&s[p]!==null?c.append(p,JSON.stringify(s[p])):c.append(p,s[p])}),d="multipart/form-data"):(c=s,d="application/json"),i==="Core"?e.post(`/apps/${t}/integration-endpoints/Core/${o}`,c||s,{headers:{"Content-Type":d}}):e.post(`/apps/${t}/integration-endpoints/installable/${i}/integration-endpoints/${o}`,c||s,{headers:{"Content-Type":d}})}}})}})}function HY(e,t,n,r){return{async me(){return e.get(`/apps/${n}/entities/User/me`)},async updateMe(i){return e.put(`/apps/${n}/entities/User/me`,i)},redirectToLogin(i){if(typeof window>"u")throw new Error("Login method can only be used in a browser environment");const a=i?new URL(i,window.location.origin).toString():window.location.href,o=`${r.appBaseUrl}/login?from_url=${encodeURIComponent(a)}`;window.location.href=o},loginWithProvider(i,a="/"){const o=new URL(a,window.location.origin).toString(),s=i==="google"?"":`/${i}`,c=`${r.appBaseUrl}/api/apps/auth${s}/login?app_id=${n}&from_url=${encodeURIComponent(o)}`;window.location.href=c},logout(i){if(delete e.defaults.headers.common.Authorization,typeof window<"u"){if(window.localStorage)try{window.localStorage.removeItem("base44_access_token"),window.localStorage.removeItem("token")}catch(s){console.error("Failed to remove token from localStorage:",s)}const a=i||window.location.href,o=`${r.appBaseUrl}/api/apps/auth/logout?from_url=${encodeURIComponent(a)}`;window.location.href=o}},setToken(i,a=!0){if(i&&(e.defaults.headers.common.Authorization=`Bearer ${i}`,t.defaults.headers.common.Authorization=`Bearer ${i}`,a&&typeof window<"u"&&window.localStorage))try{window.localStorage.setItem("base44_access_token",i),window.localStorage.setItem("token",i)}catch(o){console.error("Failed to save token to localStorage:",o)}},async loginViaEmailPassword(i,a,o){var s;try{const c=await e.post(`/apps/${n}/auth/login`,{email:i,password:a,...o&&{turnstile_token:o}}),{access_token:d,user:p}=c;return d&&this.setToken(d),{access_token:d,user:p}}catch(c){throw((s=c.response)===null||s===void 0?void 0:s.status)===401&&await this.logout(),c}},async isAuthenticated(){try{return await this.me(),!0}catch{return!1}},inviteUser(i,a){return e.post(`/apps/${n}/users/invite-user`,{user_email:i,role:a})},register(i){return e.post(`/apps/${n}/auth/register`,i)},verifyOtp({email:i,otpCode:a}){return e.post(`/apps/${n}/auth/verify-otp`,{email:i,otp_code:a})},resendOtp(i){return e.post(`/apps/${n}/auth/resend-otp`,{email:i})},resetPasswordRequest(i){return e.post(`/apps/${n}/auth/reset-password-request`,{email:i})},resetPassword({resetToken:i,newPassword:a}){return e.post(`/apps/${n}/auth/reset-password`,{reset_token:i,new_password:a})},changePassword({userId:i,currentPassword:a,newPassword:o}){return e.post(`/apps/${n}/auth/change-password`,{user_id:i,current_password:a,new_password:o})}}}function GY(e,t,n){return{async getAccessToken(r){const i=`/apps/${t}/auth/sso/accesstoken/${r}`,a={};return n&&(a["on-behalf-of"]=`Bearer ${n}`),e.get(i,{headers:a})}}}function ZY(e,t){return{async getAccessToken(n){if(!n||typeof n!="string")throw new Error("Integration type is required and must be a string");return(await e.get(`/apps/${t}/external-auth/tokens/${n}`)).access_token}}}function yE(e={}){const{storageKey:t="base44_access_token",paramName:n="access_token",saveToStorage:r=!0,removeFromUrl:i=!0}=e;let a=null;if(typeof window<"u"&&window.location)try{const o=new URLSearchParams(window.location.search);if(a=o.get(n),a){if(r&&YY(a,{storageKey:t}),i){o.delete(n);const s=`${window.location.pathname}${o.toString()?`?${o.toString()}`:""}${window.location.hash}`;window.history.replaceState({},document.title,s)}return a}}catch(o){console.error("Error retrieving token from URL:",o)}if(typeof window<"u"&&window.localStorage)try{return a=window.localStorage.getItem(t),a}catch(o){console.error("Error retrieving token from local storage:",o)}return null}function YY(e,t){const{storageKey:n="base44_access_token"}=t;if(typeof window>"u"||!window.localStorage||!e)return!1;try{return window.localStorage.setItem(n,e),window.localStorage.setItem("token",e),!0}catch(r){return console.error("Error saving token to local storage:",r),!1}}function S2(e,t){return{async invoke(n,r){if(typeof r=="string")throw new Error(`Function ${n} must receive an object with named parameters, received: ${r}`);let i,a;return r instanceof FormData||r&&Object.values(r).some(o=>o instanceof File)?(i=new FormData,Object.keys(r).forEach(o=>{r[o]instanceof File?i.append(o,r[o],r[o].name):typeof r[o]=="object"&&r[o]!==null?i.append(o,JSON.stringify(r[o])):i.append(o,r[o])}),a="multipart/form-data"):(i=r,a="application/json"),e.post(`/apps/${t}/functions/${n}`,i||r,{headers:{"Content-Type":a}})}}}function P2({axios:e,getSocket:t,appId:n,serverUrl:r,token:i}){const a=`/apps/${n}/agents`,o={},s=()=>e.get(`${a}/conversations`),c=P=>e.get(`${a}/conversations/${P}`);return{getConversations:s,getConversation:c,listConversations:P=>e.get(`${a}/conversations`,{params:P}),createConversation:P=>e.post(`${a}/conversations`,P),addMessage:async(P,x)=>e.post(`${a}/conversations/v2/${P.id}/messages`,x),subscribeToConversation:(P,x)=>{const w=`/agent-conversations/${P}`,T=t(),E=c(P).then(k=>(o[P]=k,k));return T.subscribeToRoom(w,{connect:()=>{},update_model:async({data:k})=>{const D=JSON.parse(k);if(D._message){await E;const I=D._message,R=o[P];if(R){const $=R.messages||[],V=$.findIndex(Z=>Z.id===I.id),K=V!==-1?$.map((Z,ee)=>ee===V?I:Z):[...$,I];o[P]={...R,messages:K},x==null||x(o[P])}}}})},getWhatsAppConnectURL:P=>{const x=`${r}/api/apps/${n}/agents/${encodeURIComponent(P)}/whatsapp`,w=i??yE();return w?`${x}?token=${w}`:x}}}function j2(e,t){const n=`/app-logs/${t}`;return{async logUserInApp(r){await e.post(`${n}/log-user-in-app/${r}`)},async fetchLogs(r={}){return await e.get(n,{params:r})},async getStats(r={}){return await e.get(`${n}/stats`,{params:r})}}}function XY(e,t){return{async inviteUser(n,r){if(r!=="user"&&r!=="admin")throw new Error(`Invalid role: "${r}". Role must be either "user" or "admin".`);return await e.post(`/apps/${t}/runtime/users/invite-user`,{user_email:n,role:r})}}}const Ul=Object.create(null);Ul.open="0";Ul.close="1";Ul.ping="2";Ul.pong="3";Ul.message="4";Ul.upgrade="5";Ul.noop="6";const vy=Object.create(null);Object.keys(Ul).forEach(e=>{vy[Ul[e]]=e});const Hj={type:"error",data:"parser error"},y5=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",b5=typeof ArrayBuffer=="function",x5=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,bE=({type:e,data:t},n,r)=>y5&&t instanceof Blob?n?r(t):O2(t,r):b5&&(t instanceof ArrayBuffer||x5(t))?n?r(t):O2(new Blob([t]),r):r(Ul[e]+(t||"")),O2=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function T2(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Fw;function QY(e,t){if(y5&&e.data instanceof Blob)return e.data.arrayBuffer().then(T2).then(t);if(b5&&(e.data instanceof ArrayBuffer||x5(e.data)))return t(T2(e.data));bE(e,!1,n=>{Fw||(Fw=new TextEncoder),t(Fw.encode(n))})}const E2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",em=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(r=0;r>4,p[i++]=(o&15)<<4|s>>2,p[i++]=(s&3)<<6|c&63;return d},eX=typeof ArrayBuffer=="function",xE=(e,t)=>{if(typeof e!="string")return{type:"message",data:w5(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:tX(e.substring(1),t)}:vy[n]?e.length>1?{type:vy[n],data:e.substring(1)}:{type:vy[n]}:Hj},tX=(e,t)=>{if(eX){const n=JY(e);return w5(n,t)}else return{base64:!0,data:e}},w5=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},_5="",nX=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((a,o)=>{bE(a,!1,s=>{r[o]=s,++i===n&&t(r.join(_5))})})},rX=(e,t)=>{const n=e.split(_5),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let qw;function Bv(e){return e.reduce((t,n)=>t+n.length,0)}function $v(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,21)-1){s.enqueue(Hj);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(Bv(n)e){s.enqueue(Hj);break}}}})}const S5=4;function ui(e){if(e)return oX(e)}function oX(e){for(var t in ui.prototype)e[t]=ui.prototype[t];return e}ui.prototype.on=ui.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};ui.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};ui.prototype.off=ui.prototype.removeListener=ui.prototype.removeAllListeners=ui.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;iPromise.resolve().then(t):(t,n)=>n(t,0),ws=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),sX="arraybuffer";function P5(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const lX=ws.setTimeout,uX=ws.clearTimeout;function fb(e,t){t.useNativeTimers?(e.setTimeoutFn=lX.bind(ws),e.clearTimeoutFn=uX.bind(ws)):(e.setTimeoutFn=ws.setTimeout.bind(ws),e.clearTimeoutFn=ws.clearTimeout.bind(ws))}const cX=1.33;function fX(e){return typeof e=="string"?dX(e):Math.ceil((e.byteLength||e.size)*cX)}function dX(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function j5(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function hX(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function pX(e){let t={},n=e.split("&");for(let r=0,i=n.length;r{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};rX(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,nX(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=j5()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let O5=!1;try{O5=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const vX=O5;function yX(){}class bX extends gX{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Ll extends ui{constructor(t,n,r){super(),this.createRequest=t,fb(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=P5(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=Ll.requestsCount++,Ll.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=yX,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ll.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Ll.requestsCount=0;Ll.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",A2);else if(typeof addEventListener=="function"){const e="onpagehide"in ws?"pagehide":"unload";addEventListener(e,A2,!1)}}function A2(){for(let e in Ll.requests)Ll.requests.hasOwnProperty(e)&&Ll.requests[e].abort()}const xX=(function(){const e=T5({xdomain:!1});return e&&e.responseType!==null})();class wX extends bX{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=xX&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Ll(T5,this.uri(),t)}}function T5(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||vX))return new XMLHttpRequest}catch{}if(!t)try{return new ws[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const E5=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class _X extends wE{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=E5?{}:P5(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{try{this.doWrite(r,a)}catch{}i&&cb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=j5()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const zw=ws.WebSocket||ws.MozWebSocket;class SX extends _X{createSocket(t,n,r){return E5?new zw(t,n,r):n?new zw(t,n):new zw(t)}doWrite(t,n){this.ws.send(n)}}class PX extends wE{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=aX(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=iX();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const a=()=>{r.read().then(({done:s,value:c})=>{s||(this.onPacket(c),a())}).catch(s=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n{i&&cb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const jX={websocket:SX,webtransport:PX,polling:wX},OX=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,TX=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Gj(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=OX.exec(e||""),a={},o=14;for(;o--;)a[TX[o]]=i[o]||"";return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=EX(a,a.path),a.queryKey=AX(a,a.query),a}function EX(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function AX(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}const Zj=typeof addEventListener=="function"&&typeof removeEventListener=="function",yy=[];Zj&&addEventListener("offline",()=>{yy.forEach(e=>e())},!1);class kc extends ui{constructor(t,n){if(super(),this.binaryType=sX,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=Gj(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=Gj(n.host).host);fb(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=pX(this.opts.query)),Zj&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},yy.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=S5,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&kc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",kc.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,cb(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:t,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(kc.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Zj&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=yy.indexOf(this._offlineEventListener);r!==-1&&yy.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}kc.protocol=S5;class kX extends kc{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!r)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;kc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const y=new Error("probe error");y.transport=n.name,this.emitReserved("upgradeError",y)}}))};function a(){r||(r=!0,p(),n.close(),n=null)}const o=m=>{const y=new Error("probe error: "+m);y.transport=n.name,a(),this.emitReserved("upgradeError",y)};function s(){o("transport closed")}function c(){o("socket closed")}function d(m){n&&m.name!==n.name&&a()}const p=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",s),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",o),n.once("close",s),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;rjX[i]).filter(i=>!!i)),super(t,r)}};function NX(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=Gj(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const a=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(n&&n.port===r.port?"":":"+r.port),r}const MX=typeof ArrayBuffer=="function",RX=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,A5=Object.prototype.toString,LX=typeof Blob=="function"||typeof Blob<"u"&&A5.call(Blob)==="[object BlobConstructor]",IX=typeof File=="function"||typeof File<"u"&&A5.call(File)==="[object FileConstructor]";function _E(e){return MX&&(e instanceof ArrayBuffer||RX(e))||LX&&e instanceof Blob||IX&&e instanceof File}function by(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let s=0;s{this.io.clearTimeoutFn(a),n.apply(this,s)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,i)=>{const a=(o,s)=>o?i(o):r(s);a.withError=!0,n.push(a),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...a)=>(this._queue[0],i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Nn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Nn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Nn.EVENT:case Nn.BINARY_EVENT:this.onevent(t);break;case Nn.ACK:case Nn.BINARY_ACK:this.onack(t);break;case Nn.DISCONNECT:this.ondisconnect();break;case Nn.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Nn.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Nn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}tp.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0};tp.prototype.reset=function(){this.attempts=0};tp.prototype.setMin=function(e){this.ms=e};tp.prototype.setMax=function(e){this.max=e};tp.prototype.setJitter=function(e){this.jitter=e};class Qj extends ui{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,fb(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new tp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||zX;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new CX(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=nl(n,"open",function(){r.onopen(),t&&t()}),a=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},o=nl(n,"error",a);if(this._timeout!==!1){const s=this._timeout,c=this.setTimeoutFn(()=>{i(),a(new Error("timeout")),n.close()},s);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(nl(t,"ping",this.onping.bind(this)),nl(t,"data",this.ondata.bind(this)),nl(t,"error",this.onerror.bind(this)),nl(t,"close",this.onclose.bind(this)),nl(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){cb(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new k5(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Bp={};function xy(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=NX(e,t.path||"/socket.io"),r=n.source,i=n.id,a=n.path,o=Bp[i]&&a in Bp[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||o;let c;return s?c=new Qj(r,t):(Bp[i]||(Bp[i]=new Qj(r,t)),c=Bp[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(xy,{Manager:Qj,Socket:k5,io:xy,connect:xy});function C2(e,t){var n;const r=xy(e.serverUrl,{path:e.mountPath,transports:e.transports,query:{app_id:e.appId,token:(n=e.token)!==null&&n!==void 0?n:yE()}});return r.on("connect",async()=>{var i;return console.log("connect",r.id),(i=t.connect)===null||i===void 0?void 0:i.call(t)}),r.on("update_model",async i=>{var a;return(a=t.update_model)===null||a===void 0?void 0:a.call(t,i)}),r.on("error",async i=>{var a;return(a=t.error)===null||a===void 0?void 0:a.call(t,i)}),r.on("connect_error",async i=>{var a;return console.error("connect_error",i),(a=t.error)===null||a===void 0?void 0:a.call(t,i)}),r}function VX({config:e}){let t={...e};const n={},r={connect:async()=>{const b=[];Object.keys(n).forEach(P=>{c(P);const x=m(P);x==null||x.forEach(({connect:w})=>{const T=async()=>w==null?void 0:w();b.push(T())})}),await Promise.all(b)},update_model:async b=>{const x=m(b.room).map(w=>{var T;return(T=w.update_model)===null||T===void 0?void 0:T.call(w,b)});await Promise.all(x)},error:async b=>{console.error("error",b);const P=Object.values(n).flat().map(x=>{var w;return(w=x.error)===null||w===void 0?void 0:w.call(x,b)});await Promise.all(P)}};let i=C2(e,r);function a(){o()}function o(){i&&i.disconnect()}function s(b){a(),t={...t,...b},i=C2(t,r)}function c(b){i.emit("join",b)}function d(b){i.emit("leave",b)}async function p(b,P){var x;const w=JSON.stringify(P);return(x=r.update_model)===null||x===void 0?void 0:x.call(r,{room:b,data:w})}function m(b){return n[b]}return{socket:i,subscribeToRoom:(b,P)=>(n[b]||(c(b),n[b]=[]),n[b].push(P),()=>{var x,w;n[b]=(w=(x=n[b])===null||x===void 0?void 0:x.filter(T=>T!==P))!==null&&w!==void 0?w:[],n[b].length===0&&d(b)}),updateConfig:s,updateModel:p,disconnect:o}}const $p=typeof window<"u"?window:{base44SharedInstances:{}};function WX(e,t){return $p.base44SharedInstances||($p.base44SharedInstances={}),$p.base44SharedInstances[e]||($p.base44SharedInstances[e]={instance:t()}),$p.base44SharedInstances[e].instance}const KX="__user_heartbeat_event__",HX="__initialization_event__",GX="__session_duration_event__",N2="analytics-enable",M2="base44_analytics_session_id",ZX={enabled:!0,maxQueueSize:1e3,throttleTime:1e3,batchSize:30,heartBeatInterval:60*1e3},YX="analytics",lr=WX(YX,()=>({requestsQueue:[],isProcessing:!1,isHeartBeatProcessing:!1,wasInitializationTracked:!1,sessionContext:null,sessionStartTime:null,config:{...ZX,...iQ()}})),XX=({axiosClient:e,serverUrl:t,appId:n,userAuthModule:r})=>{var i;const{maxQueueSize:a,throttleTime:o,batchSize:s}=lr.config;if(!(!((i=lr.config)===null||i===void 0)&&i.enabled))return{track:()=>{},cleanup:()=>{}};let c;const d=`${t}/api/apps/${n}/analytics/track/batch`,p=async k=>{await e.request({method:"POST",url:`/apps/${n}/analytics/track/batch`,data:{events:k}})},m=k=>{try{const D=JSON.stringify({events:k}),I=new Blob([D],{type:"application/json"});return typeof navigator>"u"||D.length>6e4||!navigator.sendBeacon(d,I)}catch{return!1}},y=async(k,D={})=>{if(k.length===0)return;const I=await rQ(r),R=k.map(nQ(I));try{(!D.isBeacon||!m(R))&&await p(R)}catch{}},b=()=>{L2(y,{throttleTime:o,batchSize:s})},P=k=>{if(lr.requestsQueue.length>=a)return;const D=tQ();lr.requestsQueue.push({...k,...D}),b()},x=()=>{L2(y,{throttleTime:o,batchSize:s}),c=I2(P),JX()},w=()=>{R2(),c==null||c(),eQ(P);const k=lr.requestsQueue.splice(0);y(k,{isBeacon:!0})},T=()=>{typeof window>"u"||(document.visibilityState==="hidden"?w():document.visibilityState==="visible"&&x())},E=()=>{R2(),c==null||c(),typeof window<"u"&&window.removeEventListener("visibilitychange",T)};return b(),c=I2(P),QX(P),typeof window<"u"&&window.addEventListener("visibilitychange",T),{track:P,cleanup:E}};function R2(){lr.isProcessing=!1}async function L2(e,t){if(lr.isProcessing)return;lr.isProcessing=!0;const{throttleTime:n=1e3,batchSize:r=30}=t??{};for(;lr.isProcessing&&lr.requestsQueue.length>0;){const i=lr.requestsQueue.splice(0,r);i.length&&await e(i),await new Promise(a=>setTimeout(a,n))}lr.isProcessing=!1}function I2(e){var t;if(lr.isHeartBeatProcessing||((t=lr.config.heartBeatInterval)!==null&&t!==void 0?t:0)<10)return()=>{};lr.isHeartBeatProcessing=!0;const n=setInterval(()=>{e({eventName:KX})},lr.config.heartBeatInterval);return()=>{clearInterval(n),lr.isHeartBeatProcessing=!1}}function QX(e){typeof window>"u"||lr.wasInitializationTracked||(lr.wasInitializationTracked=!0,e({eventName:HX,properties:{referrer:document==null?void 0:document.referrer}}))}function JX(){typeof window>"u"||lr.sessionStartTime!==null||(lr.sessionStartTime=new Date().toISOString())}function eQ(e){if(typeof window>"u"||lr.sessionStartTime===null)return;const t=new Date().getTime()-new Date(lr.sessionStartTime).getTime();lr.sessionStartTime=null,e({eventName:GX,properties:{sessionDuration:t}})}function tQ(){return{timestamp:new Date().toISOString(),pageUrl:typeof window<"u"?window.location.pathname:null}}function nQ(e){return t=>({event_name:t.eventName,properties:t.properties,timestamp:t.timestamp,page_url:t.pageUrl,...e})}let Uw=null;async function rQ(e){if(!lr.sessionContext){if(!Uw){const t=aQ();Uw=e.me().then(n=>({user_id:n.id,session_id:t})).catch(()=>({user_id:null,session_id:t}))}lr.sessionContext=await Uw}return lr.sessionContext}function iQ(){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search).get(N2);if(t==null||!t.length)return;const n=new URLSearchParams(window.location.search);n.delete(N2);const r=window.location.pathname+(n.toString()?"?"+n.toString():"");return window.history.replaceState({},"",r),{enabled:t==="true"}}function aQ(){if(typeof window>"u")return Bw();try{const e=localStorage.getItem(M2);if(!e){const t=Bw();return localStorage.setItem(M2,t),t}return e}catch{return Bw()}}function oQ(e){const{serverUrl:t="https://base44.app",appId:n,token:r,serviceToken:i,requiresAuth:a=!1,appBaseUrl:o,options:s,functionsVersion:c,headers:d}=e,p=typeof o=="string"?o:"",m={serverUrl:t,mountPath:"/ws-user-apps/socket.io/",transports:["websocket"],appId:n,token:r};let y=null;const b=()=>(y||(y=VX({config:m})),y),P={...d,"X-App-Id":String(n)},x=c?{...P,"Base44-Functions-Version":c}:P,w=Jp({baseURL:`${t}/api`,headers:P,token:r,onError:s==null?void 0:s.onError}),T=Jp({baseURL:`${t}/api`,headers:x,token:r,interceptResponses:!1,onError:s==null?void 0:s.onError}),E=Jp({baseURL:`${t}/api`,headers:P,token:i,onError:s==null?void 0:s.onError}),k=Jp({baseURL:`${t}/api`,headers:x,token:i,interceptResponses:!1}),D=HY(w,T,n,{appBaseUrl:p}),I={entities:w2({axios:w,appId:n,getSocket:b}),integrations:_2(w,n),auth:D,functions:S2(T,n),agents:P2({axios:w,getSocket:b,appId:n,serverUrl:t,token:r}),appLogs:j2(w,n),users:XY(w,n),analytics:XX({axiosClient:w,serverUrl:t,appId:n,userAuthModule:D}),cleanup:()=>{I.analytics.cleanup(),y&&y.disconnect()}},R={entities:w2({axios:E,appId:n,getSocket:b}),integrations:_2(E,n),sso:GY(E,n,r),connectors:ZY(E,n),functions:S2(k,n),agents:P2({axios:E,getSocket:b,appId:n,serverUrl:t,token:r}),appLogs:j2(E,n),cleanup:()=>{y&&y.disconnect()}};if(typeof window<"u"){const V=r||yE();V&&I.auth.setToken(V)}return a&&typeof window<"u"&&setTimeout(async()=>{try{await I.auth.isAuthenticated()||I.auth.redirectToLogin(window.location.href)}catch(V){console.error("Authentication check failed:",V),I.auth.redirectToLogin(window.location.href)}},0),{...I,setToken(V){I.auth.setToken(V),y&&y.updateConfig({token:V}),m.token=V},getConfig(){return{serverUrl:t,appId:n,requiresAuth:a}},get asServiceRole(){if(!i)throw new Error("Service token is required to use asServiceRole. Please provide a serviceToken when creating the client.");return R}}}const C5=typeof window>"u",sQ=C5?{localStorage:new Map}:window,dm=sQ.localStorage,lQ=e=>e.replace(/([A-Z])/g,"_$1").toLowerCase(),mf=(e,{defaultValue:t=void 0,removeFromUrl:n=!1}={})=>{if(C5)return t;const r=`base44_${lQ(e)}`,i=new URLSearchParams(window.location.search),a=i.get(e);if(console.log("App Param:",e,a),n){i.delete(e);const s=`${window.location.pathname}${i.toString()?`?${i.toString()}`:""}${window.location.hash}`;window.history.replaceState({},document.title,s)}if(a)return console.log("Search Param:",a),dm.setItem(r,a),a;if(t)return dm.setItem(r,t),t;const o=dm.getItem(r);return o||null},uQ=()=>(mf("clear_access_token")==="true"&&(dm.removeItem("base44_access_token"),dm.removeItem("token")),console.log("Current App Params:",mf("app_id",{defaultValue:"probindo.com"})),{appId:mf("app_id",{defaultValue:"probindo.com"}),token:mf("access_token",{removeFromUrl:!0}),fromUrl:mf("from_url",{defaultValue:window.location.href}),functionsVersion:mf("functions_version",{defaultValue:"v1"}),appBaseUrl:mf("app_base_url",{defaultValue:""})}),tm={...uQ()},{appId:cQ,token:fQ,functionsVersion:dQ}=tm,mt=oQ({appId:cQ,token:fQ,functionsVersion:dQ,serverUrl:"",requiresAuth:!1,appBaseUrl:"/api"}),N5=M.createContext(),hQ=({children:e})=>{const[t,n]=M.useState(null),[r,i]=M.useState(!1),[a,o]=M.useState(!0),[s,c]=M.useState(!0),[d,p]=M.useState(null),[m,y]=M.useState(null);M.useEffect(()=>{b()},[]);const b=async()=>{var T,E;try{c(!0),p(null);const k=Jp({baseURL:"http://10.0.2.2:5173/api/apps/public",headers:{"X-App-Id":tm.appId},token:tm.token,interceptResponses:!0});try{const D=await k.get(`/prod/public-settings/by-id/${tm.appId}`);y(D),tm.token?await P():(o(!1),i(!1)),c(!1)}catch(D){if(console.error("App state check failed:",D),D.status===403&&((E=(T=D.data)==null?void 0:T.extra_data)!=null&&E.reason)){const I=D.data.extra_data.reason;p(I==="auth_required"?{type:"auth_required",message:"Authentication required"}:I==="user_not_registered"?{type:"user_not_registered",message:"User not registered for this app"}:{type:I,message:D.message})}else p({type:"unknown",message:D.message||"Failed to load app"});c(!1),o(!1)}}catch(k){console.error("Unexpected error:",k),p({type:"unknown",message:k.message||"An unexpected error occurred"}),c(!1),o(!1)}},P=async()=>{try{o(!0);const T=await mt.auth.me();n(T),i(!0),o(!1)}catch(T){console.error("User auth check failed:",T),o(!1),i(!1),(T.status===401||T.status===403)&&p({type:"auth_required",message:"Authentication required"})}},x=(T=!0)=>{n(null),i(!1),T?mt.auth.logout(window.location.href):mt.auth.logout()},w=()=>{mt.auth.redirectToLogin(window.location.href)};return h.jsx(N5.Provider,{value:{user:t,isAuthenticated:r,isLoadingAuth:a,isLoadingPublicSettings:s,authError:d,appPublicSettings:m,logout:x,navigateToLogin:w,checkAppState:b},children:e})},PE=()=>{const e=M.useContext(N5);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},Tt=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Tt.displayName="Card";const Ti=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("flex flex-col space-y-1.5 p-6",e),...t}));Ti.displayName="CardHeader";const Ei=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("font-semibold leading-none tracking-tight",e),...t}));Ei.displayName="CardTitle";const pQ=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("text-sm text-muted-foreground",e),...t}));pQ.displayName="CardDescription";const Pn=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("p-6 pt-0",e),...t}));Pn.displayName="CardContent";const mQ=M.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:fn("flex items-center p-6 pt-0",e),...t}));mQ.displayName="CardFooter";function Fv({title:e,value:t,subtitle:n,icon:r,trend:i,trendUp:a,className:o}){return h.jsxs(Tt,{className:fn("relative overflow-hidden p-6 bg-white border-0 shadow-sm hover:shadow-md transition-shadow",o),children:[h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"text-sm font-medium text-slate-500 tracking-wide uppercase",children:e}),h.jsx("p",{className:"text-3xl font-bold text-slate-900",children:t}),n&&h.jsx("p",{className:"text-sm text-slate-500",children:n}),i&&h.jsxs("div",{className:fn("flex items-center gap-1 text-sm font-medium",a?"text-emerald-600":"text-rose-600"),children:[h.jsx("span",{children:a?"↑":"↓"}),h.jsx("span",{children:i})]})]}),r&&h.jsx("div",{className:"p-3 rounded-xl bg-emerald-50",children:h.jsx(r,{className:"w-6 h-6 text-emerald-600"})})]}),h.jsx("div",{className:"absolute -bottom-4 -right-4 w-24 h-24 rounded-full bg-gradient-to-br from-emerald-50 to-transparent opacity-60"})]})}var Vw,D2;function Oo(){if(D2)return Vw;D2=1;var e=Array.isArray;return Vw=e,Vw}var Ww,B2;function M5(){if(B2)return Ww;B2=1;var e=typeof Xp=="object"&&Xp&&Xp.Object===Object&&Xp;return Ww=e,Ww}var Kw,$2;function Kl(){if($2)return Kw;$2=1;var e=M5(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Kw=n,Kw}var Hw,F2;function Eg(){if(F2)return Hw;F2=1;var e=Kl(),t=e.Symbol;return Hw=t,Hw}var Gw,q2;function gQ(){if(q2)return Gw;q2=1;var e=Eg(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=n.call(o,i),c=o[i];try{o[i]=void 0;var d=!0}catch{}var p=r.call(o);return d&&(s?o[i]=c:delete o[i]),p}return Gw=a,Gw}var Zw,z2;function vQ(){if(z2)return Zw;z2=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Zw=n,Zw}var Yw,U2;function Iu(){if(U2)return Yw;U2=1;var e=Eg(),t=gQ(),n=vQ(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:r:a&&a in Object(s)?t(s):n(s)}return Yw=o,Yw}var Xw,V2;function Du(){if(V2)return Xw;V2=1;function e(t){return t!=null&&typeof t=="object"}return Xw=e,Xw}var Qw,W2;function np(){if(W2)return Qw;W2=1;var e=Iu(),t=Du(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Qw=r,Qw}var Jw,K2;function jE(){if(K2)return Jw;K2=1;var e=Oo(),t=np(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||o!=null&&a in Object(o)}return Jw=i,Jw}var e_,H2;function Kc(){if(H2)return e_;H2=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return e_=e,e_}var t_,G2;function OE(){if(G2)return t_;G2=1;var e=Iu(),t=Kc(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var c=e(s);return c==r||c==i||c==n||c==a}return t_=o,t_}var n_,Z2;function yQ(){if(Z2)return n_;Z2=1;var e=Kl(),t=e["__core-js_shared__"];return n_=t,n_}var r_,Y2;function bQ(){if(Y2)return r_;Y2=1;var e=yQ(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return r_=n,r_}var i_,X2;function R5(){if(X2)return i_;X2=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return i_=n,i_}var a_,Q2;function xQ(){if(Q2)return a_;Q2=1;var e=OE(),t=bQ(),n=Kc(),r=R5(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,c=o.toString,d=s.hasOwnProperty,p=RegExp("^"+c.call(d).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(y){if(!n(y)||t(y))return!1;var b=e(y)?p:a;return b.test(r(y))}return a_=m,a_}var o_,J2;function wQ(){if(J2)return o_;J2=1;function e(t,n){return t==null?void 0:t[n]}return o_=e,o_}var s_,eM;function fd(){if(eM)return s_;eM=1;var e=xQ(),t=wQ();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return s_=n,s_}var l_,tM;function db(){if(tM)return l_;tM=1;var e=fd(),t=e(Object,"create");return l_=t,l_}var u_,nM;function _Q(){if(nM)return u_;nM=1;var e=db();function t(){this.__data__=e?e(null):{},this.size=0}return u_=t,u_}var c_,rM;function SQ(){if(rM)return c_;rM=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return c_=e,c_}var f_,iM;function PQ(){if(iM)return f_;iM=1;var e=db(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return r.call(o,a)?o[a]:void 0}return f_=i,f_}var d_,aM;function jQ(){if(aM)return d_;aM=1;var e=db(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return d_=r,d_}var h_,oM;function OQ(){if(oM)return h_;oM=1;var e=db(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return h_=n,h_}var p_,sM;function TQ(){if(sM)return p_;sM=1;var e=_Q(),t=SQ(),n=PQ(),r=jQ(),i=OQ();function a(o){var s=-1,c=o==null?0:o.length;for(this.clear();++s-1}return x_=t,x_}var w_,pM;function NQ(){if(pM)return w_;pM=1;var e=hb();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return w_=t,w_}var __,mM;function pb(){if(mM)return __;mM=1;var e=EQ(),t=AQ(),n=kQ(),r=CQ(),i=NQ();function a(o){var s=-1,c=o==null?0:o.length;for(this.clear();++s0?1:-1},Ef=function(t){return Xf(t)&&t.indexOf("%")===t.length-1},ct=function(t){return tJ(t)&&!Ag(t)},nJ=function(t){return _n(t)},Ai=function(t){return ct(t)||Xf(t)},rJ=0,kg=function(t){var n=++rJ;return"".concat(t||"").concat(n)},Ya=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ct(t)&&!Xf(t))return r;var a;if(Ef(t)){var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return Ag(a)&&(a=r),i&&a>n&&(a=n),a},mc=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},iJ=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fJ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var UM={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Su=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},VM=null,G_=null,ME=function e(t){if(t===VM&&Array.isArray(G_))return G_;var n=[];return M.Children.forEach(t,function(r){_n(r)||(XQ.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),G_=n,VM=t,n};function Os(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return Su(i)}):r=[Su(t)],ME(e).forEach(function(i){var a=Uo(i,"type.displayName")||Uo(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}function $o(e,t){var n=Os(e,t);return n&&n[0]}var WM=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!ct(r)||r<=0||!ct(i)||i<=0)},dJ=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],hJ=function(t){return t&&t.type&&Xf(t.type)&&dJ.indexOf(t.type)>=0},pJ=function(t,n,r,i){var a,o=(a=H_==null?void 0:H_[i])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!tn(t)&&(i&&o.includes(n)||sJ.includes(n))||r&&NE.includes(n)},Jt=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(M.isValidElement(t)&&(i=t.props),!rp(i))return null;var a={};return Object.keys(i).forEach(function(o){var s;pJ((s=i)===null||s===void 0?void 0:s[o],o,n,r)&&(a[o]=i[o])}),a},tO=function e(t,n){if(t===n)return!0;var r=M.Children.count(t);if(r!==M.Children.count(n))return!1;if(r===0)return!0;if(r===1)return KM(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bJ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function rO(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,d=yJ(e,vJ),p=i||{width:n,height:r,x:0,y:0},m=pn("recharts-surface",a);return ce.createElement("svg",nO({},Jt(d,!0,"svg"),{className:m,width:n,height:r,style:o,viewBox:"".concat(p.x," ").concat(p.y," ").concat(p.width," ").concat(p.height)}),ce.createElement("title",null,s),ce.createElement("desc",null,c),t)}var xJ=["children","className"];function iO(){return iO=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _J(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var tr=ce.forwardRef(function(e,t){var n=e.children,r=e.className,i=wJ(e,xJ),a=pn("recharts-layer",r);return ce.createElement("g",iO({className:a},Jt(i,!0),{ref:t}),n)}),cl=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;aa?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var o=Array(a);++i=a?n:e(n,r,i)}return Y_=t,Y_}var X_,YM;function F5(){if(YM)return X_;YM=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+e+i+a+"]");function c(d){return s.test(d)}return X_=c,X_}var Q_,XM;function jJ(){if(XM)return Q_;XM=1;function e(t){return t.split("")}return Q_=e,Q_}var J_,QM;function OJ(){if(QM)return J_;QM=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",o="["+e+"]",s="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",d="(?:"+s+"|"+c+")",p="[^"+e+"]",m="(?:\\ud83c[\\udde6-\\uddff]){2}",y="[\\ud800-\\udbff][\\udc00-\\udfff]",b="\\u200d",P=d+"?",x="["+a+"]?",w="(?:"+b+"(?:"+[p,m,y].join("|")+")"+x+P+")*",T=x+P+w,E="(?:"+[p+s+"?",s,m,y,o].join("|")+")",k=RegExp(c+"(?="+c+")|"+E+T,"g");function D(I){return I.match(k)||[]}return J_=D,J_}var e1,JM;function TJ(){if(JM)return e1;JM=1;var e=jJ(),t=F5(),n=OJ();function r(i){return t(i)?n(i):e(i)}return e1=r,e1}var t1,eR;function EJ(){if(eR)return t1;eR=1;var e=PJ(),t=F5(),n=TJ(),r=I5();function i(a){return function(o){o=r(o);var s=t(o)?n(o):void 0,c=s?s[0]:o.charAt(0),d=s?e(s,1).join(""):o.slice(1);return c[a]()+d}}return t1=i,t1}var n1,tR;function AJ(){if(tR)return n1;tR=1;var e=EJ(),t=e("toUpperCase");return n1=t,n1}var kJ=AJ();const vb=In(kJ);function mr(e){return function(){return e}}const q5=Math.cos,Dy=Math.sin,pl=Math.sqrt,By=Math.PI,yb=2*By,aO=Math.PI,oO=2*aO,xf=1e-6,CJ=oO-xf;function z5(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return z5;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;ixf)if(!(Math.abs(m*c-d*p)>xf)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let b=r-o,P=i-s,x=c*c+d*d,w=b*b+P*P,T=Math.sqrt(x),E=Math.sqrt(y),k=a*Math.tan((aO-Math.acos((x+y-w)/(2*T*E)))/2),D=k/E,I=k/T;Math.abs(D-1)>xf&&this._append`L${t+D*p},${n+D*m}`,this._append`A${a},${a},0,0,${+(m*b>p*P)},${this._x1=t+I*c},${this._y1=n+I*d}`}}arc(t,n,r,i,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(i),c=r*Math.sin(i),d=t+s,p=n+c,m=1^o,y=o?i-a:a-i;this._x1===null?this._append`M${d},${p}`:(Math.abs(this._x1-d)>xf||Math.abs(this._y1-p)>xf)&&this._append`L${d},${p}`,r&&(y<0&&(y=y%oO+oO),y>CJ?this._append`A${r},${r},0,1,${m},${t-s},${n-c}A${r},${r},0,1,${m},${this._x1=d},${this._y1=p}`:y>xf&&this._append`A${r},${r},0,${+(y>=aO)},${m},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function RE(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new MJ(t)}function LE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function U5(e){this._context=e}U5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function bb(e){return new U5(e)}function V5(e){return e[0]}function W5(e){return e[1]}function K5(e,t){var n=mr(!0),r=null,i=bb,a=null,o=RE(s);e=typeof e=="function"?e:e===void 0?V5:mr(e),t=typeof t=="function"?t:t===void 0?W5:mr(t);function s(c){var d,p=(c=LE(c)).length,m,y=!1,b;for(r==null&&(a=i(b=o())),d=0;d<=p;++d)!(d=b;--P)s.point(k[P],D[P]);s.lineEnd(),s.areaEnd()}T&&(k[y]=+e(w,y,m),D[y]=+t(w,y,m),s.point(r?+r(w,y,m):k[y],n?+n(w,y,m):D[y]))}if(E)return s=null,E+""||null}function p(){return K5().defined(i).curve(o).context(a)}return d.x=function(m){return arguments.length?(e=typeof m=="function"?m:mr(+m),r=null,d):e},d.x0=function(m){return arguments.length?(e=typeof m=="function"?m:mr(+m),d):e},d.x1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:mr(+m),d):r},d.y=function(m){return arguments.length?(t=typeof m=="function"?m:mr(+m),n=null,d):t},d.y0=function(m){return arguments.length?(t=typeof m=="function"?m:mr(+m),d):t},d.y1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:mr(+m),d):n},d.lineX0=d.lineY0=function(){return p().x(e).y(t)},d.lineY1=function(){return p().x(e).y(n)},d.lineX1=function(){return p().x(r).y(t)},d.defined=function(m){return arguments.length?(i=typeof m=="function"?m:mr(!!m),d):i},d.curve=function(m){return arguments.length?(o=m,a!=null&&(s=o(a)),d):o},d.context=function(m){return arguments.length?(m==null?a=s=null:s=o(a=m),d):a},d}class H5{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function RJ(e){return new H5(e,!0)}function LJ(e){return new H5(e,!1)}const IE={draw(e,t){const n=pl(t/By);e.moveTo(n,0),e.arc(0,0,n,0,yb)}},IJ={draw(e,t){const n=pl(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},G5=pl(1/3),DJ=G5*2,BJ={draw(e,t){const n=pl(t/DJ),r=n*G5;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},$J={draw(e,t){const n=pl(t),r=-n/2;e.rect(r,r,n,n)}},FJ=.8908130915292852,Z5=Dy(By/10)/Dy(7*By/10),qJ=Dy(yb/10)*Z5,zJ=-q5(yb/10)*Z5,UJ={draw(e,t){const n=pl(t*FJ),r=qJ*n,i=zJ*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const o=yb*a/5,s=q5(o),c=Dy(o);e.lineTo(c*n,-s*n),e.lineTo(s*r-c*i,c*r+s*i)}e.closePath()}},r1=pl(3),VJ={draw(e,t){const n=-pl(t/(r1*3));e.moveTo(0,n*2),e.lineTo(-r1*n,-n),e.lineTo(r1*n,-n),e.closePath()}},hs=-.5,ps=pl(3)/2,sO=1/pl(12),WJ=(sO/2+1)*3,KJ={draw(e,t){const n=pl(t/WJ),r=n/2,i=n*sO,a=r,o=n*sO+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(hs*r-ps*i,ps*r+hs*i),e.lineTo(hs*a-ps*o,ps*a+hs*o),e.lineTo(hs*s-ps*c,ps*s+hs*c),e.lineTo(hs*r+ps*i,hs*i-ps*r),e.lineTo(hs*a+ps*o,hs*o-ps*a),e.lineTo(hs*s+ps*c,hs*c-ps*s),e.closePath()}};function HJ(e,t){let n=null,r=RE(i);e=typeof e=="function"?e:mr(e||IE),t=typeof t=="function"?t:mr(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:mr(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:mr(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function $y(){}function Fy(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Y5(e){this._context=e}Y5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Fy(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Fy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function GJ(e){return new Y5(e)}function X5(e){this._context=e}X5.prototype={areaStart:$y,areaEnd:$y,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Fy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function ZJ(e){return new X5(e)}function Q5(e){this._context=e}Q5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Fy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function YJ(e){return new Q5(e)}function J5(e){this._context=e}J5.prototype={areaStart:$y,areaEnd:$y,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function XJ(e){return new J5(e)}function nR(e){return e<0?-1:1}function rR(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(nR(a)+nR(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function iR(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function i1(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function qy(e){this._context=e}qy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:i1(this,this._t0,iR(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,i1(this,iR(this,n=rR(this,e,t)),n);break;default:i1(this,this._t0,n=rR(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function eq(e){this._context=new tq(e)}(eq.prototype=Object.create(qy.prototype)).point=function(e,t){qy.prototype.point.call(this,t,e)};function tq(e){this._context=e}tq.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function QJ(e){return new qy(e)}function JJ(e){return new eq(e)}function nq(e){this._context=e}nq.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=aR(e),i=aR(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function tee(e){return new xb(e,.5)}function nee(e){return new xb(e,0)}function ree(e){return new xb(e,1)}function yh(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function iee(e,t){return e[t]}function aee(e){const t=[];return t.key=e,t}function oee(){var e=mr([]),t=lO,n=yh,r=iee;function i(a){var o=Array.from(e.apply(this,arguments),aee),s,c=o.length,d=-1,p;for(const m of a)for(s=0,++d;s0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mee(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var rq={symbolCircle:IE,symbolCross:IJ,symbolDiamond:BJ,symbolSquare:$J,symbolStar:UJ,symbolTriangle:VJ,symbolWye:KJ},gee=Math.PI/180,vee=function(t){var n="symbol".concat(vb(t));return rq[n]||IE},yee=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*gee;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},bee=function(t,n){rq["symbol".concat(vb(t))]=n},DE=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,a=i===void 0?64:i,o=t.sizeType,s=o===void 0?"area":o,c=pee(t,cee),d=sR(sR({},c),{},{type:r,size:a,sizeType:s}),p=function(){var w=vee(r),T=HJ().type(w).size(yee(a,s,r));return T()},m=d.className,y=d.cx,b=d.cy,P=Jt(d,!0);return y===+y&&b===+b&&a===+a?ce.createElement("path",uO({},P,{className:pn("recharts-symbols",m),transform:"translate(".concat(y,", ").concat(b,")"),d:p()})):null};DE.registerSymbol=bee;function bh(e){"@babel/helpers - typeof";return bh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bh(e)}function cO(){return cO=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var E=b.inactive?d:b.color;return ce.createElement("li",cO({className:w,style:m,key:"legend-item-".concat(P)},Qf(r.props,b,P)),ce.createElement(rO,{width:o,height:o,viewBox:p,style:y},r.renderIcon(b)),ce.createElement("span",{className:"recharts-legend-item-text",style:{color:E}},x?x(T,b,P):T))})}},{key:"render",value:function(){var r=this.props,i=r.payload,a=r.layout,o=r.align;if(!i||!i.length)return null;var s={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return ce.createElement("ul",{className:"recharts-default-legend",style:s},this.renderItems())}}])})(M.PureComponent);Em(BE,"displayName","Legend");Em(BE,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var a1,uR;function Aee(){if(uR)return a1;uR=1;var e=pb();function t(){this.__data__=new e,this.size=0}return a1=t,a1}var o1,cR;function kee(){if(cR)return o1;cR=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return o1=e,o1}var s1,fR;function Cee(){if(fR)return s1;fR=1;function e(t){return this.__data__.get(t)}return s1=e,s1}var l1,dR;function Nee(){if(dR)return l1;dR=1;function e(t){return this.__data__.has(t)}return l1=e,l1}var u1,hR;function Mee(){if(hR)return u1;hR=1;var e=pb(),t=EE(),n=AE(),r=200;function i(a,o){var s=this.__data__;if(s instanceof e){var c=s.__data__;if(!t||c.lengthb))return!1;var x=m.get(o),w=m.get(s);if(x&&w)return x==s&&w==o;var T=-1,E=!0,k=c&i?new e:void 0;for(m.set(o,s),m.set(s,o);++T-1&&r%1==0&&r-1&&n%1==0&&n<=e}return C1=t,C1}var N1,DR;function Kee(){if(DR)return N1;DR=1;var e=Iu(),t=zE(),n=Du(),r="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",s="[object Error]",c="[object Function]",d="[object Map]",p="[object Number]",m="[object Object]",y="[object RegExp]",b="[object Set]",P="[object String]",x="[object WeakMap]",w="[object ArrayBuffer]",T="[object DataView]",E="[object Float32Array]",k="[object Float64Array]",D="[object Int8Array]",I="[object Int16Array]",R="[object Int32Array]",$="[object Uint8Array]",V="[object Uint8ClampedArray]",K="[object Uint16Array]",Z="[object Uint32Array]",ee={};ee[E]=ee[k]=ee[D]=ee[I]=ee[R]=ee[$]=ee[V]=ee[K]=ee[Z]=!0,ee[r]=ee[i]=ee[w]=ee[a]=ee[T]=ee[o]=ee[s]=ee[c]=ee[d]=ee[p]=ee[m]=ee[y]=ee[b]=ee[P]=ee[x]=!1;function ne(oe){return n(oe)&&t(oe.length)&&!!ee[e(oe)]}return N1=ne,N1}var M1,BR;function hq(){if(BR)return M1;BR=1;function e(t){return function(n){return t(n)}}return M1=e,M1}var rm={exports:{}};rm.exports;var $R;function Hee(){return $R||($R=1,(function(e,t){var n=M5(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===r,o=a&&n.process,s=(function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=s})(rm,rm.exports)),rm.exports}var R1,FR;function pq(){if(FR)return R1;FR=1;var e=Kee(),t=hq(),n=Hee(),r=n&&n.isTypedArray,i=r?t(r):e;return R1=i,R1}var L1,qR;function Gee(){if(qR)return L1;qR=1;var e=Uee(),t=FE(),n=Oo(),r=dq(),i=qE(),a=pq(),o=Object.prototype,s=o.hasOwnProperty;function c(d,p){var m=n(d),y=!m&&t(d),b=!m&&!y&&r(d),P=!m&&!y&&!b&&a(d),x=m||y||b||P,w=x?e(d.length,String):[],T=w.length;for(var E in d)(p||s.call(d,E))&&!(x&&(E=="length"||b&&(E=="offset"||E=="parent")||P&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||i(E,T)))&&w.push(E);return w}return L1=c,L1}var I1,zR;function Zee(){if(zR)return I1;zR=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||e;return n===i}return I1=t,I1}var D1,UR;function mq(){if(UR)return D1;UR=1;function e(t,n){return function(r){return t(n(r))}}return D1=e,D1}var B1,VR;function Yee(){if(VR)return B1;VR=1;var e=mq(),t=e(Object.keys,Object);return B1=t,B1}var $1,WR;function Xee(){if(WR)return $1;WR=1;var e=Zee(),t=Yee(),n=Object.prototype,r=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var s in Object(a))r.call(a,s)&&s!="constructor"&&o.push(s);return o}return $1=i,$1}var F1,KR;function Cg(){if(KR)return F1;KR=1;var e=OE(),t=zE();function n(r){return r!=null&&t(r.length)&&!e(r)}return F1=n,F1}var q1,HR;function wb(){if(HR)return q1;HR=1;var e=Gee(),t=Xee(),n=Cg();function r(i){return n(i)?e(i):t(i)}return q1=r,q1}var z1,GR;function Qee(){if(GR)return z1;GR=1;var e=$ee(),t=zee(),n=wb();function r(i){return e(i,n,t)}return z1=r,z1}var U1,ZR;function Jee(){if(ZR)return U1;ZR=1;var e=Qee(),t=1,n=Object.prototype,r=n.hasOwnProperty;function i(a,o,s,c,d,p){var m=s&t,y=e(a),b=y.length,P=e(o),x=P.length;if(b!=x&&!m)return!1;for(var w=b;w--;){var T=y[w];if(!(m?T in o:r.call(o,T)))return!1}var E=p.get(a),k=p.get(o);if(E&&k)return E==o&&k==a;var D=!0;p.set(a,o),p.set(o,a);for(var I=m;++w-1}return mS=t,mS}var gS,_L;function bte(){if(_L)return gS;_L=1;function e(t,n,r){for(var i=-1,a=t==null?0:t.length;++i=o){var T=d?null:i(c);if(T)return a(T);P=!1,y=r,w=new e}else w=d?[]:x;e:for(;++m=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Rte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Lte(e){return e.value}function Ite(e,t){if(ce.isValidElement(e))return ce.cloneElement(e,t);if(typeof e=="function")return ce.createElement(e,t);t.ref;var n=Mte(t,jte);return ce.createElement(BE,n)}var kL=1,Cc=(function(e){function t(){var n;Ote(this,t);for(var r=arguments.length,i=new Array(r),a=0;akL||Math.abs(i.height-this.lastBoundingBox.height)>kL)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?du({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,a=i.layout,o=i.align,s=i.verticalAlign,c=i.margin,d=i.chartWidth,p=i.chartHeight,m,y;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&a==="vertical"){var b=this.getBBoxSnapshot();m={left:((d||0)-b.width)/2}}else m=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(s==="middle"){var P=this.getBBoxSnapshot();y={top:((p||0)-P.height)/2}}else y=s==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return du(du({},m),y)}},{key:"render",value:function(){var r=this,i=this.props,a=i.content,o=i.width,s=i.height,c=i.wrapperStyle,d=i.payloadUniqBy,p=i.payload,m=du(du({position:"absolute",width:o||"auto",height:s||"auto"},this.getDefaultPosition(c)),c);return ce.createElement("div",{className:"recharts-legend-wrapper",style:m,ref:function(b){r.wrapperNode=b}},Ite(a,du(du({},this.props),{},{payload:xq(p,d,Lte)})))}}],[{key:"getWithHeight",value:function(r,i){var a=du(du({},this.defaultProps),r.props),o=a.layout;return o==="vertical"&&ct(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||i}:null}}])})(M.PureComponent);_b(Cc,"displayName","Legend");_b(Cc,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var wS,CL;function Dte(){if(CL)return wS;CL=1;var e=Eg(),t=FE(),n=Oo(),r=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(r&&a&&a[r])}return wS=i,wS}var _S,NL;function Sq(){if(NL)return _S;NL=1;var e=fq(),t=Dte();function n(r,i,a,o,s){var c=-1,d=r.length;for(a||(a=t),s||(s=[]);++c0&&a(p)?i>1?n(p,i-1,a,o,s):e(s,p):o||(s[s.length]=p)}return s}return _S=n,_S}var SS,ML;function Bte(){if(ML)return SS;ML=1;function e(t){return function(n,r,i){for(var a=-1,o=Object(n),s=i(n),c=s.length;c--;){var d=s[t?c:++a];if(r(o[d],d,o)===!1)break}return n}}return SS=e,SS}var PS,RL;function $te(){if(RL)return PS;RL=1;var e=Bte(),t=e();return PS=t,PS}var jS,LL;function Pq(){if(LL)return jS;LL=1;var e=$te(),t=wb();function n(r,i){return r&&e(r,i,t)}return jS=n,jS}var OS,IL;function Fte(){if(IL)return OS;IL=1;var e=Cg();function t(n,r){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var o=i.length,s=r?o:-1,c=Object(i);(r?s--:++sr||s&&c&&p&&!d&&!m||a&&c&&p||!i&&p||!o)return 1;if(!a&&!s&&!m&&n=d)return p;var m=i[a];return p*(m=="desc"?-1:1)}}return n.index-r.index}return CS=t,CS}var NS,zL;function Vte(){if(zL)return NS;zL=1;var e=kE(),t=CE(),n=Hl(),r=jq(),i=qte(),a=hq(),o=Ute(),s=ip(),c=Oo();function d(p,m,y){m.length?m=e(m,function(x){return c(x)?function(w){return t(w,x.length===1?x[0]:x)}:x}):m=[s];var b=-1;m=e(m,a(n));var P=r(p,function(x,w,T){var E=e(m,function(k){return k(x)});return{criteria:E,index:++b,value:x}});return i(P,function(x,w){return o(x,w,y)})}return NS=d,NS}var MS,UL;function Wte(){if(UL)return MS;UL=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return MS=e,MS}var RS,VL;function Kte(){if(VL)return RS;VL=1;var e=Wte(),t=Math.max;function n(r,i,a){return i=t(i===void 0?r.length-1:i,0),function(){for(var o=arguments,s=-1,c=t(o.length-i,0),d=Array(c);++s0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return BS=r,BS}var $S,ZL;function Yte(){if(ZL)return $S;ZL=1;var e=Gte(),t=Zte(),n=t(e);return $S=n,$S}var FS,YL;function Xte(){if(YL)return FS;YL=1;var e=ip(),t=Kte(),n=Yte();function r(i,a){return n(t(i,a,e),i+"")}return FS=r,FS}var qS,XL;function Sb(){if(XL)return qS;XL=1;var e=TE(),t=Cg(),n=qE(),r=Kc();function i(a,o,s){if(!r(s))return!1;var c=typeof o;return(c=="number"?t(s)&&n(o,s.length):c=="string"&&o in s)?e(s[o],a):!1}return qS=i,qS}var zS,QL;function Qte(){if(QL)return zS;QL=1;var e=Sq(),t=Vte(),n=Xte(),r=Sb(),i=n(function(a,o){if(a==null)return[];var s=o.length;return s>1&&r(a,o[0],o[1])?o=[]:s>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return zS=i,zS}var Jte=Qte();const WE=In(Jte);function Am(e){"@babel/helpers - typeof";return Am=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Am(e)}function hO(){return hO=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat(Fp,"-left"),ct(n)&&t&&ct(t.x)&&n=t.y),"".concat(Fp,"-top"),ct(r)&&t&&ct(t.y)&&rx?Math.max(p,c[r]):Math.max(m,c[r])}function pne(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function mne(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,s=e.useTranslate3d,c=e.viewBox,d,p,m;return o.height>0&&o.width>0&&n?(p=tI({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),m=tI({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=pne({translateX:p,translateY:m,useTranslate3d:s})):d=dne,{cssProperties:d,cssClasses:hne({translateX:p,translateY:m,coordinate:n})}}function wh(e){"@babel/helpers - typeof";return wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wh(e)}function nI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rI(e){for(var t=1;tiI||Math.abs(r.height-this.state.lastBoundingBox.height)>iI)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,a=i.active,o=i.allowEscapeViewBox,s=i.animationDuration,c=i.animationEasing,d=i.children,p=i.coordinate,m=i.hasPayload,y=i.isAnimationActive,b=i.offset,P=i.position,x=i.reverseDirection,w=i.useTranslate3d,T=i.viewBox,E=i.wrapperStyle,k=mne({allowEscapeViewBox:o,coordinate:p,offsetTopLeft:b,position:P,reverseDirection:x,tooltipBox:this.state.lastBoundingBox,useTranslate3d:w,viewBox:T}),D=k.cssClasses,I=k.cssProperties,R=rI(rI({transition:y&&a?"transform ".concat(s,"ms ").concat(c):void 0},I),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&m?"visible":"hidden",position:"absolute",top:0,left:0},E);return ce.createElement("div",{tabIndex:-1,className:D,style:R,ref:function(V){r.wrapperNode=V}},d)}}])})(M.PureComponent),jne=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ap={isSsr:jne()};function _h(e){"@babel/helpers - typeof";return _h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_h(e)}function aI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function oI(e){for(var t=1;t0;return ce.createElement(Pne,{allowEscapeViewBox:o,animationDuration:s,animationEasing:c,isAnimationActive:y,active:a,coordinate:p,hasPayload:R,offset:b,position:w,reverseDirection:T,useTranslate3d:E,viewBox:k,wrapperStyle:D},Lne(d,oI(oI({},this.props),{},{payload:I})))}}])})(M.PureComponent);KE(wo,"displayName","Tooltip");KE(wo,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ap.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var VS,sI;function Ine(){if(sI)return VS;sI=1;var e=Kl(),t=function(){return e.Date.now()};return VS=t,VS}var WS,lI;function Dne(){if(lI)return WS;lI=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return WS=t,WS}var KS,uI;function Bne(){if(uI)return KS;uI=1;var e=Dne(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return KS=n,KS}var HS,cI;function Cq(){if(cI)return HS;cI=1;var e=Bne(),t=Kc(),n=np(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function c(d){if(typeof d=="number")return d;if(n(d))return r;if(t(d)){var p=typeof d.valueOf=="function"?d.valueOf():d;d=t(p)?p+"":p}if(typeof d!="string")return d===0?d:+d;d=e(d);var m=a.test(d);return m||o.test(d)?s(d.slice(2),m?2:8):i.test(d)?r:+d}return HS=c,HS}var GS,fI;function $ne(){if(fI)return GS;fI=1;var e=Kc(),t=Ine(),n=Cq(),r="Expected a function",i=Math.max,a=Math.min;function o(s,c,d){var p,m,y,b,P,x,w=0,T=!1,E=!1,k=!0;if(typeof s!="function")throw new TypeError(r);c=n(c)||0,e(d)&&(T=!!d.leading,E="maxWait"in d,y=E?i(n(d.maxWait)||0,c):y,k="trailing"in d?!!d.trailing:k);function D(oe){var he=p,Se=m;return p=m=void 0,w=oe,b=s.apply(Se,he),b}function I(oe){return w=oe,P=setTimeout(V,c),T?D(oe):b}function R(oe){var he=oe-x,Se=oe-w,fe=c-he;return E?a(fe,y-Se):fe}function $(oe){var he=oe-x,Se=oe-w;return x===void 0||he>=c||he<0||E&&Se>=y}function V(){var oe=t();if($(oe))return K(oe);P=setTimeout(V,R(oe))}function K(oe){return P=void 0,k&&p?D(oe):(p=m=void 0,b)}function Z(){P!==void 0&&clearTimeout(P),w=0,p=x=m=P=void 0}function ee(){return P===void 0?b:K(t())}function ne(){var oe=t(),he=$(oe);if(p=arguments,m=this,x=oe,he){if(P===void 0)return I(x);if(E)return clearTimeout(P),P=setTimeout(V,c),D(x)}return P===void 0&&(P=setTimeout(V,c)),b}return ne.cancel=Z,ne.flush=ee,ne}return GS=o,GS}var ZS,dI;function Fne(){if(dI)return ZS;dI=1;var e=$ne(),t=Kc(),n="Expected a function";function r(i,a,o){var s=!0,c=!0;if(typeof i!="function")throw new TypeError(n);return t(o)&&(s="leading"in o?!!o.leading:s,c="trailing"in o?!!o.trailing:c),e(i,a,{leading:s,maxWait:a,trailing:c})}return ZS=r,ZS}var qne=Fne();const Nq=In(qne);function Cm(e){"@babel/helpers - typeof";return Cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cm(e)}function hI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Uv(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(oe=Nq(oe,x,{trailing:!0,leading:!1}));var he=new ResizeObserver(oe),Se=I.current.getBoundingClientRect(),fe=Se.width,Oe=Se.height;return ee(fe,Oe),he.observe(I.current),function(){he.disconnect()}},[ee,x]);var ne=M.useMemo(function(){var oe=K.containerWidth,he=K.containerHeight;if(oe<0||he<0)return null;cl(Ef(o)||Ef(c),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,o,c),cl(!n||n>0,"The aspect(%s) must be greater than zero.",n);var Se=Ef(o)?oe:o,fe=Ef(c)?he:c;n&&n>0&&(Se?fe=Se/n:fe&&(Se=fe*n),y&&fe>y&&(fe=y)),cl(Se>0||fe>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,Se,fe,o,c,p,m,n);var Oe=!Array.isArray(b)&&Su(b.type).endsWith("Chart");return ce.Children.map(b,function(re){return ce.isValidElement(re)?M.cloneElement(re,Uv({width:Se,height:fe},Oe?{style:Uv({height:"100%",width:"100%",maxHeight:fe,maxWidth:Se},re.props.style)}:{})):re})},[n,b,c,y,m,p,K,o]);return ce.createElement("div",{id:w?"".concat(w):void 0,className:pn("recharts-responsive-container",T),style:Uv(Uv({},D),{},{width:o,height:c,minWidth:p,minHeight:m,maxHeight:y}),ref:I},ne)}),Sh=function(t){return null};Sh.displayName="Cell";function Nm(e){"@babel/helpers - typeof";return Nm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nm(e)}function mI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vO(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ap.isSsr)return{width:0,height:0};var r=tre(n),i=JSON.stringify({text:t,copyStyle:r});if(Md.widthCache[i])return Md.widthCache[i];try{var a=document.getElementById(gI);a||(a=document.createElement("span"),a.setAttribute("id",gI),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=vO(vO({},ere),r);Object.assign(a.style,o),a.textContent="".concat(t);var s=a.getBoundingClientRect(),c={width:s.width,height:s.height};return Md.widthCache[i]=c,++Md.cacheCount>Jne&&(Md.cacheCount=0,Md.widthCache={}),c}catch{return{width:0,height:0}}},nre=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Mm(e){"@babel/helpers - typeof";return Mm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mm(e)}function Ky(e,t){return ore(e)||are(e,t)||ire(e,t)||rre()}function rre(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ire(e,t){if(e){if(typeof e=="string")return vI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vI(e,t)}}function vI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function SI(e,t){return Pre(e)||Sre(e,t)||_re(e,t)||wre()}function wre(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _re(e,t){if(e){if(typeof e=="string")return PI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return PI(e,t)}}function PI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return Se.reduce(function(fe,Oe){var re=Oe.word,Ce=Oe.width,ae=fe[fe.length-1];if(ae&&(i==null||a||ae.width+Ce+rOe.width?fe:Oe})};if(!p)return b;for(var x="…",w=function(Se){var fe=m.slice(0,Se),Oe=Iq({breakAll:d,style:c,children:fe+x}).wordsWithComputedWidth,re=y(Oe),Ce=re.length>o||P(re).width>Number(i);return[Ce,re]},T=0,E=m.length-1,k=0,D;T<=E&&k<=m.length-1;){var I=Math.floor((T+E)/2),R=I-1,$=w(R),V=SI($,2),K=V[0],Z=V[1],ee=w(I),ne=SI(ee,1),oe=ne[0];if(!K&&!oe&&(T=I+1),K&&oe&&(E=I-1),!K&&oe){D=Z;break}k++}return D||b},jI=function(t){var n=_n(t)?[]:t.toString().split(Lq);return[{words:n}]},Ore=function(t){var n=t.width,r=t.scaleToFit,i=t.children,a=t.style,o=t.breakAll,s=t.maxLines;if((n||r)&&!ap.isSsr){var c,d,p=Iq({breakAll:o,children:i,style:a});if(p){var m=p.wordsWithComputedWidth,y=p.spaceWidth;c=m,d=y}else return jI(i);return jre({breakAll:o,children:i,maxLines:s,style:a},c,d,n,r)}return jI(i)},OI="#808080",Jf=function(t){var n=t.x,r=n===void 0?0:n,i=t.y,a=i===void 0?0:i,o=t.lineHeight,s=o===void 0?"1em":o,c=t.capHeight,d=c===void 0?"0.71em":c,p=t.scaleToFit,m=p===void 0?!1:p,y=t.textAnchor,b=y===void 0?"start":y,P=t.verticalAnchor,x=P===void 0?"end":P,w=t.fill,T=w===void 0?OI:w,E=_I(t,yre),k=M.useMemo(function(){return Ore({breakAll:E.breakAll,children:E.children,maxLines:E.maxLines,scaleToFit:m,style:E.style,width:E.width})},[E.breakAll,E.children,E.maxLines,m,E.style,E.width]),D=E.dx,I=E.dy,R=E.angle,$=E.className,V=E.breakAll,K=_I(E,bre);if(!Ai(r)||!Ai(a))return null;var Z=r+(ct(D)?D:0),ee=a+(ct(I)?I:0),ne;switch(x){case"start":ne=YS("calc(".concat(d,")"));break;case"middle":ne=YS("calc(".concat((k.length-1)/2," * -").concat(s," + (").concat(d," / 2))"));break;default:ne=YS("calc(".concat(k.length-1," * -").concat(s,")"));break}var oe=[];if(m){var he=k[0].width,Se=E.width;oe.push("scale(".concat((ct(Se)?Se/he:1)/he,")"))}return R&&oe.push("rotate(".concat(R,", ").concat(Z,", ").concat(ee,")")),oe.length&&(K.transform=oe.join(" ")),ce.createElement("text",yO({},Jt(K,!0),{x:Z,y:ee,className:pn("recharts-text",$),textAnchor:b,fill:T.includes("url")?OI:T}),k.map(function(fe,Oe){var re=fe.words.join(V?"":" ");return ce.createElement("tspan",{x:Z,dy:Oe===0?ne:s,key:"".concat(re,"-").concat(Oe)},re)}))};function Nc(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Tre(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function HE(e){let t,n,r;e.length!==2?(t=Nc,n=(s,c)=>Nc(e(s),c),r=(s,c)=>e(s)-c):(t=e===Nc||e===Tre?e:Ere,n=e,r=e);function i(s,c,d=0,p=s.length){if(d>>1;n(s[m],c)<0?d=m+1:p=m}while(d>>1;n(s[m],c)<=0?d=m+1:p=m}while(dd&&r(s[m-1],c)>-r(s[m],c)?m-1:m}return{left:i,center:o,right:a}}function Ere(){return 0}function Dq(e){return e===null?NaN:+e}function*Are(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const kre=HE(Nc),Ng=kre.right;HE(Dq).center;class TI extends Map{constructor(t,n=Mre){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(EI(this,t))}has(t){return super.has(EI(this,t))}set(t,n){return super.set(Cre(this,t),n)}delete(t){return super.delete(Nre(this,t))}}function EI({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Cre({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Nre({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Mre(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Rre(e=Nc){if(e===Nc)return Bq;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Bq(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const Lre=Math.sqrt(50),Ire=Math.sqrt(10),Dre=Math.sqrt(2);function Hy(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),o=a>=Lre?10:a>=Ire?5:a>=Dre?2:1;let s,c,d;return i<0?(d=Math.pow(10,-i)/o,s=Math.round(e*d),c=Math.round(t*d),s/dt&&--c,d=-d):(d=Math.pow(10,i)*o,s=Math.round(e/d),c=Math.round(t/d),s*dt&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const s=a-i+1,c=new Array(s);if(r)if(o<0)for(let d=0;d=r)&&(n=r);return n}function kI(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function $q(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Bq:Rre(i);r>n;){if(r-n>600){const c=r-n+1,d=t-n+1,p=Math.log(c),m=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*m*(c-m)/c)*(d-c/2<0?-1:1),b=Math.max(n,Math.floor(t-d*m/c+y)),P=Math.min(r,Math.floor(t+(c-d)*m/c+y));$q(e,t,b,P,i)}const a=e[t];let o=n,s=r;for(qp(e,n,t),i(e[r],a)>0&&qp(e,n,r);o0;)--s}i(e[n],a)===0?qp(e,n,s):(++s,qp(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function qp(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Bre(e,t,n){if(e=Float64Array.from(Are(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return kI(e);if(t>=1)return AI(e);var r,i=(r-1)*t,a=Math.floor(i),o=AI($q(e,a).subarray(0,a+1)),s=kI(e.subarray(a+1));return o+(s-o)*(i-a)}}function $re(e,t,n=Dq){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e),s=+n(e[a+1],a+1,e);return o+(s-o)*(i-a)}}function Fre(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Wv(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Wv(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=zre.exec(e))?new _o(t[1],t[2],t[3],1):(t=Ure.exec(e))?new _o(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Vre.exec(e))?Wv(t[1],t[2],t[3],t[4]):(t=Wre.exec(e))?Wv(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Kre.exec(e))?DI(t[1],t[2]/100,t[3]/100,1):(t=Hre.exec(e))?DI(t[1],t[2]/100,t[3]/100,t[4]):CI.hasOwnProperty(e)?RI(CI[e]):e==="transparent"?new _o(NaN,NaN,NaN,0):null}function RI(e){return new _o(e>>16&255,e>>8&255,e&255,1)}function Wv(e,t,n,r){return r<=0&&(e=t=n=NaN),new _o(e,t,n,r)}function Yre(e){return e instanceof Mg||(e=Dm(e)),e?(e=e.rgb(),new _o(e.r,e.g,e.b,e.opacity)):new _o}function SO(e,t,n,r){return arguments.length===1?Yre(e):new _o(e,t,n,r??1)}function _o(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ZE(_o,SO,qq(Mg,{brighter(e){return e=e==null?Gy:Math.pow(Gy,e),new _o(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Lm:Math.pow(Lm,e),new _o(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _o(Vf(this.r),Vf(this.g),Vf(this.b),Zy(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:LI,formatHex:LI,formatHex8:Xre,formatRgb:II,toString:II}));function LI(){return`#${Af(this.r)}${Af(this.g)}${Af(this.b)}`}function Xre(){return`#${Af(this.r)}${Af(this.g)}${Af(this.b)}${Af((isNaN(this.opacity)?1:this.opacity)*255)}`}function II(){const e=Zy(this.opacity);return`${e===1?"rgb(":"rgba("}${Vf(this.r)}, ${Vf(this.g)}, ${Vf(this.b)}${e===1?")":`, ${e})`}`}function Zy(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Vf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Af(e){return e=Vf(e),(e<16?"0":"")+e.toString(16)}function DI(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new il(e,t,n,r)}function zq(e){if(e instanceof il)return new il(e.h,e.s,e.l,e.opacity);if(e instanceof Mg||(e=Dm(e)),!e)return new il;if(e instanceof il)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(t===a?o=(n-r)/s+(n0&&c<1?0:o,new il(o,s,c,e.opacity)}function Qre(e,t,n,r){return arguments.length===1?zq(e):new il(e,t,n,r??1)}function il(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ZE(il,Qre,qq(Mg,{brighter(e){return e=e==null?Gy:Math.pow(Gy,e),new il(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Lm:Math.pow(Lm,e),new il(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new _o(XS(e>=240?e-240:e+120,i,r),XS(e,i,r),XS(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new il(BI(this.h),Kv(this.s),Kv(this.l),Zy(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Zy(this.opacity);return`${e===1?"hsl(":"hsla("}${BI(this.h)}, ${Kv(this.s)*100}%, ${Kv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function BI(e){return e=(e||0)%360,e<0?e+360:e}function Kv(e){return Math.max(0,Math.min(1,e||0))}function XS(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const YE=e=>()=>e;function Jre(e,t){return function(n){return e+n*t}}function eie(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function tie(e){return(e=+e)==1?Uq:function(t,n){return n-t?eie(t,n,e):YE(isNaN(t)?n:t)}}function Uq(e,t){var n=t-e;return n?Jre(e,n):YE(isNaN(e)?t:e)}const $I=(function e(t){var n=tie(t);function r(i,a){var o=n((i=SO(i)).r,(a=SO(a)).r),s=n(i.g,a.g),c=n(i.b,a.b),d=Uq(i.opacity,a.opacity);return function(p){return i.r=o(p),i.g=s(p),i.b=c(p),i.opacity=d(p),i+""}}return r.gamma=e,r})(1);function nie(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Yy(r,i)})),n=QS.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function hie(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?pie:hie,c=d=null,m}function m(y){return y==null||isNaN(y=+y)?a:(c||(c=s(e.map(r),t,n)))(r(o(y)))}return m.invert=function(y){return o(i((d||(d=s(t,e.map(r),Yy)))(y)))},m.domain=function(y){return arguments.length?(e=Array.from(y,Xy),p()):e.slice()},m.range=function(y){return arguments.length?(t=Array.from(y),p()):t.slice()},m.rangeRound=function(y){return t=Array.from(y),n=XE,p()},m.clamp=function(y){return arguments.length?(o=y?!0:Xa,p()):o!==Xa},m.interpolate=function(y){return arguments.length?(n=y,p()):n},m.unknown=function(y){return arguments.length?(a=y,m):a},function(y,b){return r=y,i=b,p()}}function QE(){return Pb()(Xa,Xa)}function mie(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Qy(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ph(e){return e=Qy(Math.abs(e)),e?e[1]:NaN}function gie(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function vie(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var yie=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Bm(e){if(!(t=yie.exec(e)))throw new Error("invalid format: "+e);var t;return new JE({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Bm.prototype=JE.prototype;function JE(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}JE.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function bie(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Jy;function xie(e,t){var n=Qy(e,t);if(!n)return Jy=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Jy=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Qy(e,Math.max(0,t+a-1))[0]}function qI(e,t){var n=Qy(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const zI={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:mie,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>qI(e*100,t),r:qI,s:xie,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function UI(e){return e}var VI=Array.prototype.map,WI=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function wie(e){var t=e.grouping===void 0||e.thousands===void 0?UI:gie(VI.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?UI:vie(VI.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function d(m,y){m=Bm(m);var b=m.fill,P=m.align,x=m.sign,w=m.symbol,T=m.zero,E=m.width,k=m.comma,D=m.precision,I=m.trim,R=m.type;R==="n"?(k=!0,R="g"):zI[R]||(D===void 0&&(D=12),I=!0,R="g"),(T||b==="0"&&P==="=")&&(T=!0,b="0",P="=");var $=(y&&y.prefix!==void 0?y.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(R)?"0"+R.toLowerCase():""),V=(w==="$"?r:/[%p]/.test(R)?o:"")+(y&&y.suffix!==void 0?y.suffix:""),K=zI[R],Z=/[defgprs%]/.test(R);D=D===void 0?6:/[gprs]/.test(R)?Math.max(1,Math.min(21,D)):Math.max(0,Math.min(20,D));function ee(ne){var oe=$,he=V,Se,fe,Oe;if(R==="c")he=K(ne)+he,ne="";else{ne=+ne;var re=ne<0||1/ne<0;if(ne=isNaN(ne)?c:K(Math.abs(ne),D),I&&(ne=bie(ne)),re&&+ne==0&&x!=="+"&&(re=!1),oe=(re?x==="("?x:s:x==="-"||x==="("?"":x)+oe,he=(R==="s"&&!isNaN(ne)&&Jy!==void 0?WI[8+Jy/3]:"")+he+(re&&x==="("?")":""),Z){for(Se=-1,fe=ne.length;++SeOe||Oe>57){he=(Oe===46?i+ne.slice(Se+1):ne.slice(Se))+he,ne=ne.slice(0,Se);break}}}k&&!T&&(ne=t(ne,1/0));var Ce=oe.length+ne.length+he.length,ae=Ce>1)+oe+ne+he+ae.slice(Ce);break;default:ne=ae+oe+ne+he;break}return a(ne)}return ee.toString=function(){return m+""},ee}function p(m,y){var b=Math.max(-8,Math.min(8,Math.floor(Ph(y)/3)))*3,P=Math.pow(10,-b),x=d((m=Bm(m),m.type="f",m),{suffix:WI[8+b/3]});return function(w){return x(P*w)}}return{format:d,formatPrefix:p}}var Hv,eA,Vq;_ie({thousands:",",grouping:[3],currency:["$",""]});function _ie(e){return Hv=wie(e),eA=Hv.format,Vq=Hv.formatPrefix,Hv}function Sie(e){return Math.max(0,-Ph(Math.abs(e)))}function Pie(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ph(t)/3)))*3-Ph(Math.abs(e)))}function jie(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ph(t)-Ph(e))+1}function Wq(e,t,n,r){var i=wO(e,t,n),a;switch(r=Bm(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Pie(i,o))&&(r.precision=a),Vq(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=jie(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=Sie(i))&&(r.precision=a-(r.type==="%")*2);break}}return eA(r)}function Hc(e){var t=e.domain;return e.ticks=function(n){var r=t();return bO(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return Wq(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,d,p=10;for(s0;){if(d=xO(o,s,n),d===c)return r[i]=o,r[a]=s,t(r);if(d>0)o=Math.floor(o/d)*d,s=Math.ceil(s/d)*d;else if(d<0)o=Math.ceil(o*d)/d,s=Math.floor(s*d)/d;else break;c=d}return e},e}function e0(){var e=QE();return e.copy=function(){return Rg(e,e0())},ks.apply(e,arguments),Hc(e)}function Kq(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Xy),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Kq(e).unknown(t)},e=arguments.length?Array.from(e,Xy):[0,1],Hc(n)}function Hq(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return aMath.pow(e,t)}function kie(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function GI(e){return(t,n)=>-e(-t,n)}function tA(e){const t=e(KI,HI),n=t.domain;let r=10,i,a;function o(){return i=kie(r),a=Aie(r),n()[0]<0?(i=GI(i),a=GI(a),e(Oie,Tie)):e(KI,HI),t}return t.base=function(s){return arguments.length?(r=+s,o()):r},t.domain=function(s){return arguments.length?(n(s),o()):n()},t.ticks=s=>{const c=n();let d=c[0],p=c[c.length-1];const m=p0){for(;y<=b;++y)for(P=1;Pp)break;T.push(x)}}else for(;y<=b;++y)for(P=r-1;P>=1;--P)if(x=y>0?P/a(-y):P*a(y),!(xp)break;T.push(x)}T.length*2{if(s==null&&(s=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Bm(c)).precision==null&&(c.trim=!0),c=eA(c)),s===1/0)return c;const d=Math.max(1,r*s/t.ticks().length);return p=>{let m=p/a(Math.round(i(p)));return m*rn(Hq(n(),{floor:s=>a(Math.floor(i(s))),ceil:s=>a(Math.ceil(i(s)))})),t}function Gq(){const e=tA(Pb()).domain([1,10]);return e.copy=()=>Rg(e,Gq()).base(e.base()),ks.apply(e,arguments),e}function ZI(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function YI(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function nA(e){var t=1,n=e(ZI(t),YI(t));return n.constant=function(r){return arguments.length?e(ZI(t=+r),YI(t)):t},Hc(n)}function Zq(){var e=nA(Pb());return e.copy=function(){return Rg(e,Zq()).constant(e.constant())},ks.apply(e,arguments)}function XI(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Cie(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Nie(e){return e<0?-e*e:e*e}function rA(e){var t=e(Xa,Xa),n=1;function r(){return n===1?e(Xa,Xa):n===.5?e(Cie,Nie):e(XI(n),XI(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Hc(t)}function iA(){var e=rA(Pb());return e.copy=function(){return Rg(e,iA()).exponent(e.exponent())},ks.apply(e,arguments),e}function Mie(){return iA.apply(null,arguments).exponent(.5)}function QI(e){return Math.sign(e)*e*e}function Rie(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Yq(){var e=QE(),t=[0,1],n=!1,r;function i(a){var o=Rie(e(a));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(a){return e.invert(QI(a))},i.domain=function(a){return arguments.length?(e.domain(a),i):e.domain()},i.range=function(a){return arguments.length?(e.range((t=Array.from(a,Xy)).map(QI)),i):t.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(n=!!a,i):n},i.clamp=function(a){return arguments.length?(e.clamp(a),i):e.clamp()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return Yq(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},ks.apply(i,arguments),Hc(i)}function Xq(){var e=[],t=[],n=[],r;function i(){var o=0,s=Math.max(1,t.length);for(n=new Array(s-1);++o0?n[s-1]:e[0],s=n?[r[n-1],t]:[r[d-1],r[d]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Qq().domain([e,t]).range(i).unknown(a)},ks.apply(Hc(o),arguments)}function Jq(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[Ng(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return Jq().domain(e).range(t).unknown(n)},ks.apply(i,arguments)}const JS=new Date,eP=new Date;function ki(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const o=i(a),s=i.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),i.range=(a,o,s)=>{const c=[];if(a=i.ceil(a),s=s==null?1:Math.floor(s),!(a0))return c;let d;do c.push(d=new Date(+a)),t(a,s),e(a);while(dki(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,s)=>{if(o>=o)if(s<0)for(;++s<=0;)for(;t(o,-1),!a(o););else for(;--s>=0;)for(;t(o,1),!a(o););}),n&&(i.count=(a,o)=>(JS.setTime(+a),eP.setTime(+o),e(JS),e(eP),Math.floor(n(JS,eP))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?o=>r(o)%a===0:o=>i.count(0,o)%a===0):i)),i}const t0=ki(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);t0.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ki(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):t0);t0.range;const xu=1e3,Ps=xu*60,wu=Ps*60,Eu=wu*24,aA=Eu*7,JI=Eu*30,tP=Eu*365,kf=ki(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*xu)},(e,t)=>(t-e)/xu,e=>e.getUTCSeconds());kf.range;const oA=ki(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*xu)},(e,t)=>{e.setTime(+e+t*Ps)},(e,t)=>(t-e)/Ps,e=>e.getMinutes());oA.range;const sA=ki(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ps)},(e,t)=>(t-e)/Ps,e=>e.getUTCMinutes());sA.range;const lA=ki(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*xu-e.getMinutes()*Ps)},(e,t)=>{e.setTime(+e+t*wu)},(e,t)=>(t-e)/wu,e=>e.getHours());lA.range;const uA=ki(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*wu)},(e,t)=>(t-e)/wu,e=>e.getUTCHours());uA.range;const Lg=ki(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ps)/Eu,e=>e.getDate()-1);Lg.range;const jb=ki(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Eu,e=>e.getUTCDate()-1);jb.range;const ez=ki(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Eu,e=>Math.floor(e/Eu));ez.range;function dd(e){return ki(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ps)/aA)}const Ob=dd(0),n0=dd(1),Lie=dd(2),Iie=dd(3),jh=dd(4),Die=dd(5),Bie=dd(6);Ob.range;n0.range;Lie.range;Iie.range;jh.range;Die.range;Bie.range;function hd(e){return ki(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/aA)}const Tb=hd(0),r0=hd(1),$ie=hd(2),Fie=hd(3),Oh=hd(4),qie=hd(5),zie=hd(6);Tb.range;r0.range;$ie.range;Fie.range;Oh.range;qie.range;zie.range;const cA=ki(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());cA.range;const fA=ki(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());fA.range;const Au=ki(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Au.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ki(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Au.range;const ku=ki(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ku.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ki(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});ku.range;function tz(e,t,n,r,i,a){const o=[[kf,1,xu],[kf,5,5*xu],[kf,15,15*xu],[kf,30,30*xu],[a,1,Ps],[a,5,5*Ps],[a,15,15*Ps],[a,30,30*Ps],[i,1,wu],[i,3,3*wu],[i,6,6*wu],[i,12,12*wu],[r,1,Eu],[r,2,2*Eu],[n,1,aA],[t,1,JI],[t,3,3*JI],[e,1,tP]];function s(d,p,m){const y=pw).right(o,y);if(b===o.length)return e.every(wO(d/tP,p/tP,m));if(b===0)return t0.every(Math.max(wO(d,p,m),1));const[P,x]=o[y/o[b-1][2]53)return null;"w"in Te||(Te.w=1),"Z"in Te?(Lt=rP(zp(Te.y,0,1)),dn=Lt.getUTCDay(),Lt=dn>4||dn===0?r0.ceil(Lt):r0(Lt),Lt=jb.offset(Lt,(Te.V-1)*7),Te.y=Lt.getUTCFullYear(),Te.m=Lt.getUTCMonth(),Te.d=Lt.getUTCDate()+(Te.w+6)%7):(Lt=nP(zp(Te.y,0,1)),dn=Lt.getDay(),Lt=dn>4||dn===0?n0.ceil(Lt):n0(Lt),Lt=Lg.offset(Lt,(Te.V-1)*7),Te.y=Lt.getFullYear(),Te.m=Lt.getMonth(),Te.d=Lt.getDate()+(Te.w+6)%7)}else("W"in Te||"U"in Te)&&("w"in Te||(Te.w="u"in Te?Te.u%7:"W"in Te?1:0),dn="Z"in Te?rP(zp(Te.y,0,1)).getUTCDay():nP(zp(Te.y,0,1)).getDay(),Te.m=0,Te.d="W"in Te?(Te.w+6)%7+Te.W*7-(dn+5)%7:Te.w+Te.U*7-(dn+6)%7);return"Z"in Te?(Te.H+=Te.Z/100|0,Te.M+=Te.Z%100,rP(Te)):nP(Te)}}function V(ze,Fe,st,Te){for(var Dt=0,Lt=Fe.length,dn=st.length,xn,qn;Dt=dn)return-1;if(xn=Fe.charCodeAt(Dt++),xn===37){if(xn=Fe.charAt(Dt++),qn=I[xn in eD?Fe.charAt(Dt++):xn],!qn||(Te=qn(ze,st,Te))<0)return-1}else if(xn!=st.charCodeAt(Te++))return-1}return Te}function K(ze,Fe,st){var Te=d.exec(Fe.slice(st));return Te?(ze.p=p.get(Te[0].toLowerCase()),st+Te[0].length):-1}function Z(ze,Fe,st){var Te=b.exec(Fe.slice(st));return Te?(ze.w=P.get(Te[0].toLowerCase()),st+Te[0].length):-1}function ee(ze,Fe,st){var Te=m.exec(Fe.slice(st));return Te?(ze.w=y.get(Te[0].toLowerCase()),st+Te[0].length):-1}function ne(ze,Fe,st){var Te=T.exec(Fe.slice(st));return Te?(ze.m=E.get(Te[0].toLowerCase()),st+Te[0].length):-1}function oe(ze,Fe,st){var Te=x.exec(Fe.slice(st));return Te?(ze.m=w.get(Te[0].toLowerCase()),st+Te[0].length):-1}function he(ze,Fe,st){return V(ze,t,Fe,st)}function Se(ze,Fe,st){return V(ze,n,Fe,st)}function fe(ze,Fe,st){return V(ze,r,Fe,st)}function Oe(ze){return o[ze.getDay()]}function re(ze){return a[ze.getDay()]}function Ce(ze){return c[ze.getMonth()]}function ae(ze){return s[ze.getMonth()]}function ie(ze){return i[+(ze.getHours()>=12)]}function de(ze){return 1+~~(ze.getMonth()/3)}function He(ze){return o[ze.getUTCDay()]}function je(ze){return a[ze.getUTCDay()]}function $e(ze){return c[ze.getUTCMonth()]}function We(ze){return s[ze.getUTCMonth()]}function Ye(ze){return i[+(ze.getUTCHours()>=12)]}function rt(ze){return 1+~~(ze.getUTCMonth()/3)}return{format:function(ze){var Fe=R(ze+="",k);return Fe.toString=function(){return ze},Fe},parse:function(ze){var Fe=$(ze+="",!1);return Fe.toString=function(){return ze},Fe},utcFormat:function(ze){var Fe=R(ze+="",D);return Fe.toString=function(){return ze},Fe},utcParse:function(ze){var Fe=$(ze+="",!0);return Fe.toString=function(){return ze},Fe}}}var eD={"-":"",_:" ",0:"0"},Vi=/^\s*\d+/,Gie=/^%/,Zie=/[\\^$*+?|[\]().{}]/g;function Hn(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a[t.toLowerCase(),n]))}function Xie(e,t,n){var r=Vi.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Qie(e,t,n){var r=Vi.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Jie(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function eae(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function tae(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function tD(e,t,n){var r=Vi.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function nD(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function nae(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function rae(e,t,n){var r=Vi.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function iae(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function rD(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function aae(e,t,n){var r=Vi.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function iD(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function oae(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function sae(e,t,n){var r=Vi.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function lae(e,t,n){var r=Vi.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function uae(e,t,n){var r=Vi.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function cae(e,t,n){var r=Gie.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function fae(e,t,n){var r=Vi.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function dae(e,t,n){var r=Vi.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function aD(e,t){return Hn(e.getDate(),t,2)}function hae(e,t){return Hn(e.getHours(),t,2)}function pae(e,t){return Hn(e.getHours()%12||12,t,2)}function mae(e,t){return Hn(1+Lg.count(Au(e),e),t,3)}function nz(e,t){return Hn(e.getMilliseconds(),t,3)}function gae(e,t){return nz(e,t)+"000"}function vae(e,t){return Hn(e.getMonth()+1,t,2)}function yae(e,t){return Hn(e.getMinutes(),t,2)}function bae(e,t){return Hn(e.getSeconds(),t,2)}function xae(e){var t=e.getDay();return t===0?7:t}function wae(e,t){return Hn(Ob.count(Au(e)-1,e),t,2)}function rz(e){var t=e.getDay();return t>=4||t===0?jh(e):jh.ceil(e)}function _ae(e,t){return e=rz(e),Hn(jh.count(Au(e),e)+(Au(e).getDay()===4),t,2)}function Sae(e){return e.getDay()}function Pae(e,t){return Hn(n0.count(Au(e)-1,e),t,2)}function jae(e,t){return Hn(e.getFullYear()%100,t,2)}function Oae(e,t){return e=rz(e),Hn(e.getFullYear()%100,t,2)}function Tae(e,t){return Hn(e.getFullYear()%1e4,t,4)}function Eae(e,t){var n=e.getDay();return e=n>=4||n===0?jh(e):jh.ceil(e),Hn(e.getFullYear()%1e4,t,4)}function Aae(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Hn(t/60|0,"0",2)+Hn(t%60,"0",2)}function oD(e,t){return Hn(e.getUTCDate(),t,2)}function kae(e,t){return Hn(e.getUTCHours(),t,2)}function Cae(e,t){return Hn(e.getUTCHours()%12||12,t,2)}function Nae(e,t){return Hn(1+jb.count(ku(e),e),t,3)}function iz(e,t){return Hn(e.getUTCMilliseconds(),t,3)}function Mae(e,t){return iz(e,t)+"000"}function Rae(e,t){return Hn(e.getUTCMonth()+1,t,2)}function Lae(e,t){return Hn(e.getUTCMinutes(),t,2)}function Iae(e,t){return Hn(e.getUTCSeconds(),t,2)}function Dae(e){var t=e.getUTCDay();return t===0?7:t}function Bae(e,t){return Hn(Tb.count(ku(e)-1,e),t,2)}function az(e){var t=e.getUTCDay();return t>=4||t===0?Oh(e):Oh.ceil(e)}function $ae(e,t){return e=az(e),Hn(Oh.count(ku(e),e)+(ku(e).getUTCDay()===4),t,2)}function Fae(e){return e.getUTCDay()}function qae(e,t){return Hn(r0.count(ku(e)-1,e),t,2)}function zae(e,t){return Hn(e.getUTCFullYear()%100,t,2)}function Uae(e,t){return e=az(e),Hn(e.getUTCFullYear()%100,t,2)}function Vae(e,t){return Hn(e.getUTCFullYear()%1e4,t,4)}function Wae(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Oh(e):Oh.ceil(e),Hn(e.getUTCFullYear()%1e4,t,4)}function Kae(){return"+0000"}function sD(){return"%"}function lD(e){return+e}function uD(e){return Math.floor(+e/1e3)}var Rd,oz,sz;Hae({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Hae(e){return Rd=Hie(e),oz=Rd.format,Rd.parse,sz=Rd.utcFormat,Rd.utcParse,Rd}function Gae(e){return new Date(e)}function Zae(e){return e instanceof Date?+e:+new Date(+e)}function dA(e,t,n,r,i,a,o,s,c,d){var p=QE(),m=p.invert,y=p.domain,b=d(".%L"),P=d(":%S"),x=d("%I:%M"),w=d("%I %p"),T=d("%a %d"),E=d("%b %d"),k=d("%B"),D=d("%Y");function I(R){return(c(R)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,a)=>Bre(e,a/r))},n.copy=function(){return fz(t).domain(e)},Bu.apply(n,arguments)}function Ab(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,d=Xa,p,m=!1,y;function b(x){return isNaN(x=+x)?y:(x=.5+((x=+p(x))-a)*(r*xn}return aP=e,aP}var oP,hD;function eoe(){if(hD)return oP;hD=1;var e=kb(),t=mz(),n=ip();function r(i){return i&&i.length?e(i,n,t):void 0}return oP=r,oP}var toe=eoe();const Cb=In(toe);var sP,pD;function gz(){if(pD)return sP;pD=1;function e(t,n){return te.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1};Et.decimalPlaces=Et.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*xr;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Et.dividedBy=Et.div=function(e){return Pu(this,new this.constructor(e))};Et.dividedToIntegerBy=Et.idiv=function(e){var t=this,n=t.constructor;return cr(Pu(t,new n(e),0,1),n.precision)};Et.equals=Et.eq=function(e){return!this.cmp(e)};Et.exponent=function(){return di(this)};Et.greaterThan=Et.gt=function(e){return this.cmp(e)>0};Et.greaterThanOrEqualTo=Et.gte=function(e){return this.cmp(e)>=0};Et.isInteger=Et.isint=function(){return this.e>this.d.length-2};Et.isNegative=Et.isneg=function(){return this.s<0};Et.isPositive=Et.ispos=function(){return this.s>0};Et.isZero=function(){return this.s===0};Et.lessThan=Et.lt=function(e){return this.cmp(e)<0};Et.lessThanOrEqualTo=Et.lte=function(e){return this.cmp(e)<1};Et.logarithm=Et.log=function(e){var t,n=this,r=n.constructor,i=r.precision,a=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(qo))throw Error(Ts+"NaN");if(n.s<1)throw Error(Ts+(n.s?"NaN":"-Infinity"));return n.eq(qo)?new r(0):(Or=!1,t=Pu($m(n,a),$m(e,a),a),Or=!0,cr(t,i))};Et.minus=Et.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?xz(t,e):yz(t,(e.s=-e.s,e))};Et.modulo=Et.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Ts+"NaN");return n.s?(Or=!1,t=Pu(n,e,0,1).times(e),Or=!0,n.minus(t)):cr(new r(n),i)};Et.naturalExponential=Et.exp=function(){return bz(this)};Et.naturalLogarithm=Et.ln=function(){return $m(this)};Et.negated=Et.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Et.plus=Et.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?yz(t,e):xz(t,(e.s=-e.s,e))};Et.precision=Et.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Wf+e);if(t=di(i)+1,r=i.d.length-1,n=r*xr+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Et.squareRoot=Et.sqrt=function(){var e,t,n,r,i,a,o,s=this,c=s.constructor;if(s.s<1){if(!s.s)return new c(0);throw Error(Ts+"NaN")}for(e=di(s),Or=!1,i=Math.sqrt(+s),i==0||i==1/0?(t=Ml(s.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=lp((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(a=r,r=a.plus(Pu(s,a,o+2)).times(.5),Ml(a.d).slice(0,o)===(t=Ml(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(cr(a,n+1,0),a.times(a).eq(s)){r=a;break}}else if(t!="9999")break;o+=4}return Or=!0,cr(r,n)};Et.times=Et.mul=function(e){var t,n,r,i,a,o,s,c,d,p=this,m=p.constructor,y=p.d,b=(e=new m(e)).d;if(!p.s||!e.s)return new m(0);for(e.s*=p.s,n=p.e+e.e,c=y.length,d=b.length,c=0;){for(t=0,i=c+r;i>r;)s=a[i]+b[r]*y[i-r-1]+t,a[i--]=s%zi|0,t=s/zi|0;a[i]=(a[i]+t)%zi|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,Or?cr(e,m.precision):e};Et.toDecimalPlaces=Et.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Vl(e,0,sp),t===void 0?t=r.rounding:Vl(t,0,8),cr(n,e+di(n)+1,t))};Et.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=ed(r,!0):(Vl(e,0,sp),t===void 0?t=i.rounding:Vl(t,0,8),r=cr(new i(r),e+1,t),n=ed(r,!0,e+1)),n};Et.toFixed=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?ed(i):(Vl(e,0,sp),t===void 0?t=a.rounding:Vl(t,0,8),r=cr(new a(i),e+di(i)+1,t),n=ed(r.abs(),!1,e+di(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Et.toInteger=Et.toint=function(){var e=this,t=e.constructor;return cr(new t(e),di(e)+1,t.rounding)};Et.toNumber=function(){return+this};Et.toPower=Et.pow=function(e){var t,n,r,i,a,o,s=this,c=s.constructor,d=12,p=+(e=new c(e));if(!e.s)return new c(qo);if(s=new c(s),!s.s){if(e.s<1)throw Error(Ts+"Infinity");return s}if(s.eq(qo))return s;if(r=c.precision,e.eq(qo))return cr(s,r);if(t=e.e,n=e.d.length-1,o=t>=n,a=s.s,o){if((n=p<0?-p:p)<=vz){for(i=new c(qo),t=Math.ceil(r/xr+4),Or=!1;n%2&&(i=i.times(s),xD(i.d,t)),n=lp(n/2),n!==0;)s=s.times(s),xD(s.d,t);return Or=!0,e.s<0?new c(qo).div(i):cr(i,r)}}else if(a<0)throw Error(Ts+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,s.s=1,Or=!1,i=e.times($m(s,r+d)),Or=!0,i=bz(i),i.s=a,i};Et.toPrecision=function(e,t){var n,r,i=this,a=i.constructor;return e===void 0?(n=di(i),r=ed(i,n<=a.toExpNeg||n>=a.toExpPos)):(Vl(e,1,sp),t===void 0?t=a.rounding:Vl(t,0,8),i=cr(new a(i),e,t),n=di(i),r=ed(i,e<=n||n<=a.toExpNeg,e)),r};Et.toSignificantDigits=Et.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Vl(e,1,sp),t===void 0?t=r.rounding:Vl(t,0,8)),cr(new r(n),e,t)};Et.toString=Et.valueOf=Et.val=Et.toJSON=Et[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=di(e),n=e.constructor;return ed(e,t<=n.toExpNeg||t>=n.toExpPos)};function yz(e,t){var n,r,i,a,o,s,c,d,p=e.constructor,m=p.precision;if(!e.s||!t.s)return t.s||(t=new p(e)),Or?cr(t,m):t;if(c=e.d,d=t.d,o=e.e,i=t.e,c=c.slice(),a=o-i,a){for(a<0?(r=c,a=-a,s=d.length):(r=d,i=o,s=c.length),o=Math.ceil(m/xr),s=o>s?o+1:s+1,a>s&&(a=s,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(s=c.length,a=d.length,s-a<0&&(a=s,r=d,d=c,c=r),n=0;a;)n=(c[--a]=c[a]+d[a]+n)/zi|0,c[a]%=zi;for(n&&(c.unshift(n),++i),s=c.length;c[--s]==0;)c.pop();return t.d=c,t.e=i,Or?cr(t,m):t}function Vl(e,t,n){if(e!==~~e||en)throw Error(Wf+e)}function Ml(e){var t,n,r,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;to?1:-1;else for(s=c=0;si[s]?1:-1;break}return c}function n(r,i,a){for(var o=0;a--;)r[a]-=o,o=r[a]1;)r.shift()}return function(r,i,a,o){var s,c,d,p,m,y,b,P,x,w,T,E,k,D,I,R,$,V,K=r.constructor,Z=r.s==i.s?1:-1,ee=r.d,ne=i.d;if(!r.s)return new K(r);if(!i.s)throw Error(Ts+"Division by zero");for(c=r.e-i.e,$=ne.length,I=ee.length,b=new K(Z),P=b.d=[],d=0;ne[d]==(ee[d]||0);)++d;if(ne[d]>(ee[d]||0)&&--c,a==null?E=a=K.precision:o?E=a+(di(r)-di(i))+1:E=a,E<0)return new K(0);if(E=E/xr+2|0,d=0,$==1)for(p=0,ne=ne[0],E++;(d1&&(ne=e(ne,p),ee=e(ee,p),$=ne.length,I=ee.length),D=$,x=ee.slice(0,$),w=x.length;w<$;)x[w++]=0;V=ne.slice(),V.unshift(0),R=ne[0],ne[1]>=zi/2&&++R;do p=0,s=t(ne,x,$,w),s<0?(T=x[0],$!=w&&(T=T*zi+(x[1]||0)),p=T/R|0,p>1?(p>=zi&&(p=zi-1),m=e(ne,p),y=m.length,w=x.length,s=t(m,x,y,w),s==1&&(p--,n(m,$16)throw Error(mA+di(e));if(!e.s)return new p(qo);for(Or=!1,s=m,o=new p(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(r=Math.log(wf(2,d))/Math.LN10*2+5|0,s+=r,n=i=a=new p(qo),p.precision=s;;){if(i=cr(i.times(e),s),n=n.times(++c),o=a.plus(Pu(i,n,s)),Ml(o.d).slice(0,s)===Ml(a.d).slice(0,s)){for(;d--;)a=cr(a.times(a),s);return p.precision=m,t==null?(Or=!0,cr(a,m)):a}a=o}}function di(e){for(var t=e.e*xr,n=e.d[0];n>=10;n/=10)t++;return t}function dP(e,t,n){if(t>e.LN10.sd())throw Or=!0,n&&(e.precision=n),Error(Ts+"LN10 precision limit exceeded");return cr(new e(e.LN10),t)}function pc(e){for(var t="";e--;)t+="0";return t}function $m(e,t){var n,r,i,a,o,s,c,d,p,m=1,y=10,b=e,P=b.d,x=b.constructor,w=x.precision;if(b.s<1)throw Error(Ts+(b.s?"NaN":"-Infinity"));if(b.eq(qo))return new x(0);if(t==null?(Or=!1,d=w):d=t,b.eq(10))return t==null&&(Or=!0),dP(x,d);if(d+=y,x.precision=d,n=Ml(P),r=n.charAt(0),a=di(b),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)b=b.times(e),n=Ml(b.d),r=n.charAt(0),m++;a=di(b),r>1?(b=new x("0."+n),a++):b=new x(r+"."+n.slice(1))}else return c=dP(x,d+2,w).times(a+""),b=$m(new x(r+"."+n.slice(1)),d-y).plus(c),x.precision=w,t==null?(Or=!0,cr(b,w)):b;for(s=o=b=Pu(b.minus(qo),b.plus(qo),d),p=cr(b.times(b),d),i=3;;){if(o=cr(o.times(p),d),c=s.plus(Pu(o,new x(i),d)),Ml(c.d).slice(0,d)===Ml(s.d).slice(0,d))return s=s.times(2),a!==0&&(s=s.plus(dP(x,d+2,w).times(a+""))),s=Pu(s,new x(m),d),x.precision=w,t==null?(Or=!0,cr(s,w)):s;s=c,i+=2}}function bD(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=lp(n/xr),e.d=[],r=(n+1)%xr,n<0&&(r+=xr),ri0||e.e<-i0))throw Error(mA+n)}else e.s=0,e.e=0,e.d=[0];return e}function cr(e,t,n){var r,i,a,o,s,c,d,p,m=e.d;for(o=1,a=m[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=xr,i=t,d=m[p=0];else{if(p=Math.ceil((r+1)/xr),a=m.length,p>=a)return e;for(d=a=m[p],o=1;a>=10;a/=10)o++;r%=xr,i=r-xr+o}if(n!==void 0&&(a=wf(10,o-i-1),s=d/a%10|0,c=t<0||m[p+1]!==void 0||d%a,c=n<4?(s||c)&&(n==0||n==(e.s<0?3:2)):s>5||s==5&&(n==4||c||n==6&&(r>0?i>0?d/wf(10,o-i):0:m[p-1])%10&1||n==(e.s<0?8:7))),t<1||!m[0])return c?(a=di(e),m.length=1,t=t-a-1,m[0]=wf(10,(xr-t%xr)%xr),e.e=lp(-t/xr)||0):(m.length=1,m[0]=e.e=e.s=0),e;if(r==0?(m.length=p,a=1,p--):(m.length=p+1,a=wf(10,xr-r),m[p]=i>0?(d/wf(10,o-i)%wf(10,i)|0)*a:0),c)for(;;)if(p==0){(m[0]+=a)==zi&&(m[0]=1,++e.e);break}else{if(m[p]+=a,m[p]!=zi)break;m[p--]=0,a=1}for(r=m.length;m[--r]===0;)m.pop();if(Or&&(e.e>i0||e.e<-i0))throw Error(mA+di(e));return e}function xz(e,t){var n,r,i,a,o,s,c,d,p,m,y=e.constructor,b=y.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new y(e),Or?cr(t,b):t;if(c=e.d,m=t.d,r=t.e,d=e.e,c=c.slice(),o=d-r,o){for(p=o<0,p?(n=c,o=-o,s=m.length):(n=m,r=d,s=c.length),i=Math.max(Math.ceil(b/xr),s)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,s=m.length,p=i0;--i)c[s++]=0;for(i=m.length;i>o;){if(c[--i]0?a=a.charAt(0)+"."+a.slice(1)+pc(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(i<0?"e":"e+")+i):i<0?(a="0."+pc(-i-1)+a,n&&(r=n-o)>0&&(a+=pc(r))):i>=o?(a+=pc(i+1-o),n&&(r=n-i-1)>0&&(a=a+"."+pc(r))):((r=i+1)0&&(i+1===o&&(a+="."),a+=pc(r))),e.s<0?"-"+a:a}function xD(e,t){if(e.length>t)return e.length=t,!0}function wz(e){var t,n,r;function i(a){var o=this;if(!(o instanceof i))return new i(a);if(o.constructor=i,a instanceof i){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Wf+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return bD(o,a.toString())}else if(typeof a!="string")throw Error(Wf+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,foe.test(a))bD(o,a);else throw Error(Wf+a)}if(i.prototype=Et,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=wz,i.config=i.set=doe,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(Wf+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Wf+n+": "+r);return this}var gA=wz(coe);qo=new gA(1);const ir=gA;function hoe(e){return voe(e)||goe(e)||moe(e)||poe()}function poe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function moe(e,t){if(e){if(typeof e=="string")return OO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return OO(e,t)}}function goe(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function voe(e){if(Array.isArray(e))return OO(e)}function OO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,i):e(t-o,wD(function(){for(var s=arguments.length,c=new Array(s),d=0;de.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(c){i=!0,a=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function Noe(e){if(Array.isArray(e))return e}function Oz(e){var t=Fm(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function Tz(e,t,n){if(e.lte(0))return new ir(0);var r=Lb.getDigitCount(e.toNumber()),i=new ir(10).pow(r),a=e.div(i),o=r!==1?.05:.1,s=new ir(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=s.mul(i);return t?c:new ir(Math.ceil(c))}function Moe(e,t,n){var r=1,i=new ir(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new ir(10).pow(Lb.getDigitCount(e)-1),i=new ir(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new ir(Math.floor(e)))}else e===0?i=new ir(Math.floor((t-1)/2)):n||(i=new ir(Math.floor(e)));var o=Math.floor((t-1)/2),s=woe(xoe(function(c){return i.add(new ir(c-o).mul(r)).toNumber()}),TO);return s(0,t)}function Ez(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new ir(0),tickMin:new ir(0),tickMax:new ir(0)};var a=Tz(new ir(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new ir(0):(o=new ir(e).add(t).div(2),o=o.sub(new ir(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new ir(t).sub(o).div(a).toNumber()),d=s+c+1;return d>n?Ez(e,t,n,r,i+1):(d0?c+(n-d):c,s=t>0?s:s+(n-d)),{step:a,tickMin:o.sub(new ir(s).mul(a)),tickMax:o.add(new ir(c).mul(a))})}function Roe(e){var t=Fm(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=Oz([n,r]),c=Fm(s,2),d=c[0],p=c[1];if(d===-1/0||p===1/0){var m=p===1/0?[d].concat(AO(TO(0,i-1).map(function(){return 1/0}))):[].concat(AO(TO(0,i-1).map(function(){return-1/0})),[p]);return n>r?EO(m):m}if(d===p)return Moe(d,i,a);var y=Ez(d,p,o,a),b=y.step,P=y.tickMin,x=y.tickMax,w=Lb.rangeStep(P,x.add(new ir(.1).mul(b)),b);return n>r?EO(w):w}function Loe(e,t){var n=Fm(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Oz([r,i]),s=Fm(o,2),c=s[0],d=s[1];if(c===-1/0||d===1/0)return[r,i];if(c===d)return[c];var p=Math.max(t,2),m=Tz(new ir(d).sub(c).div(p-1),a,0),y=[].concat(AO(Lb.rangeStep(new ir(c),new ir(d).sub(new ir(.99).mul(m)),m)),[d]);return r>i?EO(y):y}var Ioe=Pz(Roe),Doe=Pz(Loe),Boe="Invariant failed";function td(e,t){throw new Error(Boe)}var $oe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Th(e){"@babel/helpers - typeof";return Th=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Th(e)}function a0(){return a0=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Koe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Hoe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Goe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,s=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(s<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,d=0;d0?i[d-1].coordinate:i[s-1].coordinate,m=i[d].coordinate,y=d>=s-1?i[0].coordinate:i[d+1].coordinate,b=void 0;if(Za(m-p)!==Za(y-m)){var P=[];if(Za(y-m)===Za(c[1]-c[0])){b=y;var x=m+c[1]-c[0];P[0]=Math.min(x,(x+p)/2),P[1]=Math.max(x,(x+p)/2)}else{b=p;var w=y+c[1]-c[0];P[0]=Math.min(m,(w+m)/2),P[1]=Math.max(m,(w+m)/2)}var T=[Math.min(m,(b+m)/2),Math.max(m,(b+m)/2)];if(t>T[0]&&t<=T[1]||t>=P[0]&&t<=P[1]){o=i[d].index;break}}else{var E=Math.min(p,y),k=Math.max(p,y);if(t>(E+m)/2&&t<=(k+m)/2){o=i[d].index;break}}}else for(var D=0;D0&&D(r[D].coordinate+r[D-1].coordinate)/2&&t<=(r[D].coordinate+r[D+1].coordinate)/2||D===s-1&&t>(r[D].coordinate+r[D-1].coordinate)/2){o=r[D].index;break}return o},vA=function(t){var n,r=t,i=r.type.displayName,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Kr(Kr({},t.type.defaultProps),t.props):t.props,o=a.stroke,s=a.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:s;break;default:c=s;break}return c},fse=function(t){var n=t.barSize,r=t.totalSize,i=t.stackGroups,a=i===void 0?{}:i;if(!a)return{};for(var o={},s=Object.keys(a),c=0,d=s.length;c=0});if(T&&T.length){var E=T[0].type.defaultProps,k=E!==void 0?Kr(Kr({},E),T[0].props):T[0].props,D=k.barSize,I=k[w];o[I]||(o[I]=[]);var R=_n(D)?n:D;o[I].push({item:T[0],stackList:T.slice(1),barSize:_n(R)?void 0:Ya(R,r,0)})}}return o},dse=function(t){var n=t.barGap,r=t.barCategoryGap,i=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,s=t.maxBarSize,c=o.length;if(c<1)return null;var d=Ya(n,i,0,!0),p,m=[];if(o[0].barSize===+o[0].barSize){var y=!1,b=i/c,P=o.reduce(function(D,I){return D+I.barSize||0},0);P+=(c-1)*d,P>=i&&(P-=(c-1)*d,d=0),P>=i&&b>0&&(y=!0,b*=.9,P=c*b);var x=(i-P)/2>>0,w={offset:x-d,size:0};p=o.reduce(function(D,I){var R={item:I.item,position:{offset:w.offset+w.size+d,size:y?b:I.barSize}},$=[].concat(PD(D),[R]);return w=$[$.length-1].position,I.stackList&&I.stackList.length&&I.stackList.forEach(function(V){$.push({item:V,position:w})}),$},m)}else{var T=Ya(r,i,0,!0);i-2*T-(c-1)*d<=0&&(d=0);var E=(i-2*T-(c-1)*d)/c;E>1&&(E>>=0);var k=s===+s?Math.min(E,s):E;p=o.reduce(function(D,I,R){var $=[].concat(PD(D),[{item:I.item,position:{offset:T+(E+d)*R+(E-k)/2,size:k}}]);return I.stackList&&I.stackList.length&&I.stackList.forEach(function(V){$.push({item:V,position:$[$.length-1].position})}),$},m)}return p},hse=function(t,n,r,i){var a=r.children,o=r.width,s=r.margin,c=o-(s.left||0)-(s.right||0),d=Nz({children:a,legendWidth:c});if(d){var p=i||{},m=p.width,y=p.height,b=d.align,P=d.verticalAlign,x=d.layout;if((x==="vertical"||x==="horizontal"&&P==="middle")&&b!=="center"&&ct(t[b]))return Kr(Kr({},t),{},Qd({},b,t[b]+(m||0)));if((x==="horizontal"||x==="vertical"&&b==="center")&&P!=="middle"&&ct(t[P]))return Kr(Kr({},t),{},Qd({},P,t[P]+(y||0)))}return t},pse=function(t,n,r){return _n(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},Mz=function(t,n,r,i,a){var o=n.props.children,s=Os(o,Ib).filter(function(d){return pse(i,a,d.props.direction)});if(s&&s.length){var c=s.map(function(d){return d.props.dataKey});return t.reduce(function(d,p){var m=Aa(p,r);if(_n(m))return d;var y=Array.isArray(m)?[Nb(m),Cb(m)]:[m,m],b=c.reduce(function(P,x){var w=Aa(p,x,0),T=y[0]-Math.abs(Array.isArray(w)?w[0]:w),E=y[1]+Math.abs(Array.isArray(w)?w[1]:w);return[Math.min(T,P[0]),Math.max(E,P[1])]},[1/0,-1/0]);return[Math.min(b[0],d[0]),Math.max(b[1],d[1])]},[1/0,-1/0])}return null},mse=function(t,n,r,i,a){var o=n.map(function(s){return Mz(t,s,r,a,i)}).filter(function(s){return!_n(s)});return o&&o.length?o.reduce(function(s,c){return[Math.min(s[0],c[0]),Math.max(s[1],c[1])]},[1/0,-1/0]):null},Rz=function(t,n,r,i,a){var o=n.map(function(c){var d=c.props.dataKey;return r==="number"&&d&&Mz(t,c,d,i)||gm(t,d,r,a)});if(r==="number")return o.reduce(function(c,d){return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);var s={};return o.reduce(function(c,d){for(var p=0,m=d.length;p=2?Za(s[0]-s[1])*2*d:d,n&&(t.ticks||t.niceTicks)){var p=(t.ticks||t.niceTicks).map(function(m){var y=a?a.indexOf(m):m;return{coordinate:i(y)+d,value:m,offset:d}});return p.filter(function(m){return!Ag(m.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(m,y){return{coordinate:i(m)+d,value:m,index:y,offset:d}}):i.ticks&&!r?i.ticks(t.tickCount).map(function(m){return{coordinate:i(m)+d,value:m,offset:d}}):i.domain().map(function(m,y){return{coordinate:i(m)+d,value:a?a[m]:m,index:y,offset:d}})},hP=new WeakMap,Gv=function(t,n){if(typeof n!="function")return t;hP.has(t)||hP.set(t,new WeakMap);var r=hP.get(t);if(r.has(n))return r.get(n);var i=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},Dz=function(t,n,r){var i=t.scale,a=t.type,o=t.layout,s=t.axisType;if(i==="auto")return o==="radial"&&s==="radiusAxis"?{scale:Rm(),realScaleType:"band"}:o==="radial"&&s==="angleAxis"?{scale:e0(),realScaleType:"linear"}:a==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:mm(),realScaleType:"point"}:a==="category"?{scale:Rm(),realScaleType:"band"}:{scale:e0(),realScaleType:"linear"};if(Xf(i)){var c="scale".concat(vb(i));return{scale:(cD[c]||mm)(),realScaleType:cD[c]?c:"point"}}return tn(i)?{scale:i}:{scale:mm(),realScaleType:"point"}},OD=1e-4,Bz=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,i=t.range(),a=Math.min(i[0],i[1])-OD,o=Math.max(i[0],i[1])+OD,s=t(n[0]),c=t(n[r-1]);(so||co)&&t.domain([n[0],n[r-1]])}},gse=function(t,n){if(!t)return null;for(var r=0,i=t.length;ri)&&(a[1]=i),a[0]>i&&(a[0]=i),a[1]=0?(t[s][r][0]=a,t[s][r][1]=a+c,a=t[s][r][1]):(t[s][r][0]=o,t[s][r][1]=o+c,o=t[s][r][1])}},bse=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r=0?(t[o][r][0]=a,t[o][r][1]=a+s,a=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},xse={sign:yse,expand:see,none:yh,silhouette:lee,wiggle:uee,positive:bse},wse=function(t,n,r){var i=n.map(function(s){return s.props.dataKey}),a=xse[r],o=oee().keys(i).value(function(s,c){return+Aa(s,c,0)}).order(lO).offset(a);return o(t)},_se=function(t,n,r,i,a,o){if(!t)return null;var s=o?n.reverse():n,c={},d=s.reduce(function(m,y){var b,P=(b=y.type)!==null&&b!==void 0&&b.defaultProps?Kr(Kr({},y.type.defaultProps),y.props):y.props,x=P.stackId,w=P.hide;if(w)return m;var T=P[r],E=m[T]||{hasStack:!1,stackGroups:{}};if(Ai(x)){var k=E.stackGroups[x]||{numericAxisId:r,cateAxisId:i,items:[]};k.items.push(y),E.hasStack=!0,E.stackGroups[x]=k}else E.stackGroups[kg("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[y]};return Kr(Kr({},m),{},Qd({},T,E))},c),p={};return Object.keys(d).reduce(function(m,y){var b=d[y];if(b.hasStack){var P={};b.stackGroups=Object.keys(b.stackGroups).reduce(function(x,w){var T=b.stackGroups[w];return Kr(Kr({},x),{},Qd({},w,{numericAxisId:r,cateAxisId:i,items:T.items,stackedData:wse(t,T.items,a)}))},P)}return Kr(Kr({},m),{},Qd({},y,b))},p)},$z=function(t,n){var r=n.realScaleType,i=n.type,a=n.tickCount,o=n.originalDomain,s=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var d=t.domain();if(!d.length)return null;var p=Ioe(d,a,s);return t.domain([Nb(p),Cb(p)]),{niceTicks:p}}if(a&&i==="number"){var m=t.domain(),y=Doe(m,a,s);return{niceTicks:y}}return null},TD=function(t){var n=t.axis,r=t.ticks,i=t.offset,a=t.bandSize,o=t.entry,s=t.index;if(n.type==="category")return r[s]?r[s].coordinate+i:null;var c=Aa(o,n.dataKey,n.domain[s]);return _n(c)?null:n.scale(c)-a/2+i},Sse=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return i<=0&&a>=0?0:a<0?a:i}return r[0]},Pse=function(t,n){var r,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Kr(Kr({},t.type.defaultProps),t.props):t.props,a=i.stackId;if(Ai(a)){var o=n[a];if(o){var s=o.items.indexOf(t);return s>=0?o.stackedData[s]:null}}return null},jse=function(t){return t.reduce(function(n,r){return[Nb(r.concat([n[0]]).filter(ct)),Cb(r.concat([n[1]]).filter(ct))]},[1/0,-1/0])},Fz=function(t,n,r){return Object.keys(t).reduce(function(i,a){var o=t[a],s=o.stackedData,c=s.reduce(function(d,p){var m=jse(p.slice(n,r+1));return[Math.min(d[0],m[0]),Math.max(d[1],m[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},ED=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,AD=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,MO=function(t,n,r){if(tn(t))return t(n,r);if(!Array.isArray(t))return n;var i=[];if(ct(t[0]))i[0]=r?t[0]:Math.min(t[0],n[0]);else if(ED.test(t[0])){var a=+ED.exec(t[0])[1];i[0]=n[0]-a}else tn(t[0])?i[0]=t[0](n[0]):i[0]=n[0];if(ct(t[1]))i[1]=r?t[1]:Math.max(t[1],n[1]);else if(AD.test(t[1])){var o=+AD.exec(t[1])[1];i[1]=n[1]+o}else tn(t[1])?i[1]=t[1](n[1]):i[1]=n[1];return i},s0=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!r||i>0)return i}if(t&&n&&n.length>=2){for(var a=WE(n,function(m){return m.coordinate}),o=1/0,s=1,c=a.length;se.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},Rse=function(t,n,r,i,a){var o=t.width,s=t.height,c=t.startAngle,d=t.endAngle,p=Ya(t.cx,o,o/2),m=Ya(t.cy,s,s/2),y=Uz(o,s,r),b=Ya(t.innerRadius,y,0),P=Ya(t.outerRadius,y,y*.8),x=Object.keys(n);return x.reduce(function(w,T){var E=n[T],k=E.domain,D=E.reversed,I;if(_n(E.range))i==="angleAxis"?I=[c,d]:i==="radiusAxis"&&(I=[b,P]),D&&(I=[I[1],I[0]]);else{I=E.range;var R=I,$=Ese(R,2);c=$[0],d=$[1]}var V=Dz(E,a),K=V.realScaleType,Z=V.scale;Z.domain(k).range(I),Bz(Z);var ee=$z(Z,pu(pu({},E),{},{realScaleType:K})),ne=pu(pu(pu({},E),ee),{},{range:I,radius:P,realScaleType:K,scale:Z,cx:p,cy:m,innerRadius:b,outerRadius:P,startAngle:c,endAngle:d});return pu(pu({},w),{},zz({},T,ne))},{})},Lse=function(t,n){var r=t.x,i=t.y,a=n.x,o=n.y;return Math.sqrt(Math.pow(r-a,2)+Math.pow(i-o,2))},Ise=function(t,n){var r=t.x,i=t.y,a=n.cx,o=n.cy,s=Lse({x:r,y:i},{x:a,y:o});if(s<=0)return{radius:s};var c=(r-a)/s,d=Math.acos(c);return i>o&&(d=2*Math.PI-d),{radius:s,angle:Mse(d),angleInRadian:d}},Dse=function(t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(i,a);return{startAngle:n-o*360,endAngle:r-o*360}},Bse=function(t,n){var r=n.startAngle,i=n.endAngle,a=Math.floor(r/360),o=Math.floor(i/360),s=Math.min(a,o);return t+s*360},MD=function(t,n){var r=t.x,i=t.y,a=Ise({x:r,y:i},n),o=a.radius,s=a.angle,c=n.innerRadius,d=n.outerRadius;if(od)return!1;if(o===0)return!0;var p=Dse(n),m=p.startAngle,y=p.endAngle,b=s,P;if(m<=y){for(;b>y;)b-=360;for(;b=m&&b<=y}else{for(;b>m;)b-=360;for(;b=y&&b<=m}return P?pu(pu({},n),{},{radius:o,angle:Bse(b,n)}):null},Vz=function(t){return!M.isValidElement(t)&&!tn(t)&&typeof t!="boolean"?t.className:""};function Vm(e){"@babel/helpers - typeof";return Vm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vm(e)}var $se=["offset"];function Fse(e){return Vse(e)||Use(e)||zse(e)||qse()}function qse(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zse(e,t){if(e){if(typeof e=="string")return RO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return RO(e,t)}}function Use(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Vse(e){if(Array.isArray(e))return RO(e)}function RO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kse(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function RD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ji(e){for(var t=1;t=0?1:-1,k,D;i==="insideStart"?(k=b+E*o,D=x):i==="insideEnd"?(k=P-E*o,D=!x):i==="end"&&(k=P+E*o,D=x),D=T<=0?D:!D;var I=gr(d,p,w,k),R=gr(d,p,w,k+(D?1:-1)*359),$="M".concat(I.x,",").concat(I.y,` A`).concat(w,",").concat(w,",0,1,").concat(D?0:1,`, `).concat(R.x,",").concat(R.y),V=_n(t.id)?kg("recharts-radial-line-"):t.id;return ce.createElement("text",Wm({},r,{dominantBaseline:"central",className:pn("recharts-radial-bar-label",s)}),ce.createElement("defs",null,ce.createElement("path",{id:V,d:$})),ce.createElement("textPath",{xlinkHref:"#".concat(V)},n))},Jse=function(t){var n=t.viewBox,r=t.offset,i=t.position,a=n,o=a.cx,s=a.cy,c=a.innerRadius,d=a.outerRadius,p=a.startAngle,m=a.endAngle,y=(p+m)/2;if(i==="outside"){var b=gr(o,s,d+r,y),P=b.x,x=b.y;return{x:P,y:x,textAnchor:P>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:s,textAnchor:"middle",verticalAnchor:"end"};var w=(c+d)/2,T=gr(o,s,w,y),E=T.x,k=T.y;return{x:E,y:k,textAnchor:"middle",verticalAnchor:"middle"}},ele=function(t){var n=t.viewBox,r=t.parentViewBox,i=t.offset,a=t.position,o=n,s=o.x,c=o.y,d=o.width,p=o.height,m=p>=0?1:-1,y=m*i,b=m>0?"end":"start",P=m>0?"start":"end",x=d>=0?1:-1,w=x*i,T=x>0?"end":"start",E=x>0?"start":"end";if(a==="top"){var k={x:s+d/2,y:c-m*i,textAnchor:"middle",verticalAnchor:b};return ji(ji({},k),r?{height:Math.max(c-r.y,0),width:d}:{})}if(a==="bottom"){var D={x:s+d/2,y:c+p+y,textAnchor:"middle",verticalAnchor:P};return ji(ji({},D),r?{height:Math.max(r.y+r.height-(c+p),0),width:d}:{})}if(a==="left"){var I={x:s-w,y:c+p/2,textAnchor:T,verticalAnchor:"middle"};return ji(ji({},I),r?{width:Math.max(I.x-r.x,0),height:p}:{})}if(a==="right"){var R={x:s+d+w,y:c+p/2,textAnchor:E,verticalAnchor:"middle"};return ji(ji({},R),r?{width:Math.max(r.x+r.width-R.x,0),height:p}:{})}var $=r?{width:d,height:p}:{};return a==="insideLeft"?ji({x:s+w,y:c+p/2,textAnchor:E,verticalAnchor:"middle"},$):a==="insideRight"?ji({x:s+d-w,y:c+p/2,textAnchor:T,verticalAnchor:"middle"},$):a==="insideTop"?ji({x:s+d/2,y:c+y,textAnchor:"middle",verticalAnchor:P},$):a==="insideBottom"?ji({x:s+d/2,y:c+p-y,textAnchor:"middle",verticalAnchor:b},$):a==="insideTopLeft"?ji({x:s+w,y:c+y,textAnchor:E,verticalAnchor:P},$):a==="insideTopRight"?ji({x:s+d-w,y:c+y,textAnchor:T,verticalAnchor:P},$):a==="insideBottomLeft"?ji({x:s+w,y:c+p-y,textAnchor:E,verticalAnchor:b},$):a==="insideBottomRight"?ji({x:s+d-w,y:c+p-y,textAnchor:T,verticalAnchor:b},$):rp(a)&&(ct(a.x)||Ef(a.x))&&(ct(a.y)||Ef(a.y))?ji({x:s+Ya(a.x,d),y:c+Ya(a.y,p),textAnchor:"end",verticalAnchor:"end"},$):ji({x:s+d/2,y:c+p/2,textAnchor:"middle",verticalAnchor:"middle"},$)},tle=function(t){return"cx"in t&&ct(t.cx)};function Ui(e){var t=e.offset,n=t===void 0?5:t,r=Wse(e,$se),i=ji({offset:n},r),a=i.viewBox,o=i.position,s=i.value,c=i.children,d=i.content,p=i.className,m=p===void 0?"":p,y=i.textBreakAll;if(!a||_n(s)&&_n(c)&&!M.isValidElement(d)&&!tn(d))return null;if(M.isValidElement(d))return M.cloneElement(d,i);var b;if(tn(d)){if(b=M.createElement(d,i),M.isValidElement(b))return b}else b=Yse(i);var P=tle(a),x=Jt(i,!0);if(P&&(o==="insideStart"||o==="insideEnd"||o==="end"))return Qse(i,b,x);var w=P?Jse(i):ele(i);return ce.createElement(Jf,Wm({className:pn("recharts-label",m)},x,w,{breakAll:y}),b)}Ui.displayName="Label";var Wz=function(t){var n=t.cx,r=t.cy,i=t.angle,a=t.startAngle,o=t.endAngle,s=t.r,c=t.radius,d=t.innerRadius,p=t.outerRadius,m=t.x,y=t.y,b=t.top,P=t.left,x=t.width,w=t.height,T=t.clockWise,E=t.labelViewBox;if(E)return E;if(ct(x)&&ct(w)){if(ct(m)&&ct(y))return{x:m,y,width:x,height:w};if(ct(b)&&ct(P))return{x:b,y:P,width:x,height:w}}return ct(m)&&ct(y)?{x:m,y,width:0,height:0}:ct(n)&&ct(r)?{cx:n,cy:r,startAngle:a||i||0,endAngle:o||i||0,innerRadius:d||0,outerRadius:p||c||s||0,clockWise:T}:t.viewBox?t.viewBox:{}},nle=function(t,n){return t?t===!0?ce.createElement(Ui,{key:"label-implicit",viewBox:n}):Ai(t)?ce.createElement(Ui,{key:"label-implicit",viewBox:n,value:t}):M.isValidElement(t)?t.type===Ui?M.cloneElement(t,{key:"label-implicit",viewBox:n}):ce.createElement(Ui,{key:"label-implicit",content:t,viewBox:n}):tn(t)?ce.createElement(Ui,{key:"label-implicit",content:t,viewBox:n}):rp(t)?ce.createElement(Ui,Wm({viewBox:n},t,{key:"label-implicit"})):null:null},rle=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var i=t.children,a=Wz(t),o=Os(i,Ui).map(function(c,d){return M.cloneElement(c,{viewBox:n||a,key:"label-".concat(d)})});if(!r)return o;var s=nle(t.label,n||a);return[s].concat(Fse(o))};Ui.parseViewBox=Wz;Ui.renderCallByParent=rle;var pP,LD;function ile(){if(LD)return pP;LD=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return pP=e,pP}var ale=ile();const ole=In(ale);function Km(e){"@babel/helpers - typeof";return Km=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Km(e)}var sle=["valueAccessor"],lle=["data","dataKey","clockWise","id","textBreakAll"];function ule(e){return hle(e)||dle(e)||fle(e)||cle()}function cle(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fle(e,t){if(e){if(typeof e=="string")return LO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return LO(e,t)}}function dle(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hle(e){if(Array.isArray(e))return LO(e)}function LO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function vle(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var yle=function(t){return Array.isArray(t.value)?ole(t.value):t.value};function Mc(e){var t=e.valueAccessor,n=t===void 0?yle:t,r=BD(e,sle),i=r.data,a=r.dataKey,o=r.clockWise,s=r.id,c=r.textBreakAll,d=BD(r,lle);return!i||!i.length?null:ce.createElement(tr,{className:"recharts-label-list"},i.map(function(p,m){var y=_n(a)?n(p,m):Aa(p&&p.payload,a),b=_n(s)?{}:{id:"".concat(s,"-").concat(m)};return ce.createElement(Ui,u0({},Jt(p,!0),d,b,{parentViewBox:p.parentViewBox,value:y,textBreakAll:c,viewBox:Ui.parseViewBox(_n(o)?p:DD(DD({},p),{},{clockWise:o})),key:"label-".concat(m),index:m}))}))}Mc.displayName="LabelList";function ble(e,t){return e?e===!0?ce.createElement(Mc,{key:"labelList-implicit",data:t}):ce.isValidElement(e)||tn(e)?ce.createElement(Mc,{key:"labelList-implicit",data:t,content:e}):rp(e)?ce.createElement(Mc,u0({data:t},e,{key:"labelList-implicit"})):null:null}function xle(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=Os(r,Mc).map(function(o,s){return M.cloneElement(o,{data:t,key:"labelList-".concat(s)})});if(!n)return i;var a=ble(e.label,t);return[a].concat(ule(i))}Mc.renderCallByParent=xle;function Hm(e){"@babel/helpers - typeof";return Hm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hm(e)}function IO(){return IO=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>d),`, `).concat(m.x,",").concat(m.y,` `);if(i>0){var b=gr(n,r,i,o),P=gr(n,r,i,d);y+="L ".concat(P.x,",").concat(P.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(c)>180),",").concat(+(o<=d),`, `).concat(b.x,",").concat(b.y," Z")}else y+="L ".concat(n,",").concat(r," Z");return y},jle=function(t){var n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,d=t.startAngle,p=t.endAngle,m=Za(p-d),y=Zv({cx:n,cy:r,radius:a,angle:d,sign:m,cornerRadius:o,cornerIsExternal:c}),b=y.circleTangency,P=y.lineTangency,x=y.theta,w=Zv({cx:n,cy:r,radius:a,angle:p,sign:-m,cornerRadius:o,cornerIsExternal:c}),T=w.circleTangency,E=w.lineTangency,k=w.theta,D=c?Math.abs(d-p):Math.abs(d-p)-x-k;if(D<0)return s?"M ".concat(P.x,",").concat(P.y,` a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 `):Kz({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:d,endAngle:p});var I="M ".concat(P.x,",").concat(P.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(b.x,",").concat(b.y,` A`).concat(a,",").concat(a,",0,").concat(+(D>180),",").concat(+(m<0),",").concat(T.x,",").concat(T.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(E.x,",").concat(E.y,` `);if(i>0){var R=Zv({cx:n,cy:r,radius:i,angle:d,sign:m,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),$=R.circleTangency,V=R.lineTangency,K=R.theta,Z=Zv({cx:n,cy:r,radius:i,angle:p,sign:-m,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),ee=Z.circleTangency,ne=Z.lineTangency,oe=Z.theta,he=c?Math.abs(d-p):Math.abs(d-p)-K-oe;if(he<0&&o===0)return"".concat(I,"L").concat(n,",").concat(r,"Z");I+="L".concat(ne.x,",").concat(ne.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(ee.x,",").concat(ee.y,` A`).concat(i,",").concat(i,",0,").concat(+(he>180),",").concat(+(m>0),",").concat($.x,",").concat($.y,` A`).concat(o,",").concat(o,",0,0,").concat(+(m<0),",").concat(V.x,",").concat(V.y,"Z")}else I+="L".concat(n,",").concat(r,"Z");return I},Ole={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Hz=function(t){var n=FD(FD({},Ole),t),r=n.cx,i=n.cy,a=n.innerRadius,o=n.outerRadius,s=n.cornerRadius,c=n.forceCornerRadius,d=n.cornerIsExternal,p=n.startAngle,m=n.endAngle,y=n.className;if(o0&&Math.abs(p-m)<360?w=jle({cx:r,cy:i,innerRadius:a,outerRadius:o,cornerRadius:Math.min(x,P/2),forceCornerRadius:c,cornerIsExternal:d,startAngle:p,endAngle:m}):w=Kz({cx:r,cy:i,innerRadius:a,outerRadius:o,startAngle:p,endAngle:m}),ce.createElement("path",IO({},Jt(n,!0),{className:b,d:w,role:"img"}))};function Gm(e){"@babel/helpers - typeof";return Gm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gm(e)}function DO(){return DO=Object.assign?Object.assign.bind():function(e){for(var t=1;tBle.call(e,t));function pd(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const qle="__v",zle="__o",Ule="_owner",{getOwnPropertyDescriptor:GD,keys:ZD}=Object;function Vle(e,t){return e.byteLength===t.byteLength&&c0(new Uint8Array(e),new Uint8Array(t))}function Wle(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Kle(e,t){return e.byteLength===t.byteLength&&c0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Hle(e,t){return pd(e.getTime(),t.getTime())}function Gle(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Zle(e,t){return e===t}function YD(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),a=e.entries();let o,s,c=0;for(;(o=a.next())&&!o.done;){const d=t.entries();let p=!1,m=0;for(;(s=d.next())&&!s.done;){if(i[m]){m++;continue}const y=o.value,b=s.value;if(n.equals(y[0],b[0],c,m,e,t,n)&&n.equals(y[1],b[1],y[0],b[0],e,t,n)){p=i[m]=!0;break}m++}if(!p)return!1;c++}return!0}const Yle=pd;function Xle(e,t,n){const r=ZD(e);let i=r.length;if(ZD(t).length!==i)return!1;for(;i-- >0;)if(!Gz(e,t,n,r[i]))return!1;return!0}function Hp(e,t,n){const r=HD(e);let i=r.length;if(HD(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Gz(e,t,n,a)||(o=GD(e,a),s=GD(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Qle(e,t){return pd(e.valueOf(),t.valueOf())}function Jle(e,t){return e.source===t.source&&e.flags===t.flags}function XD(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),a=e.values();let o,s;for(;(o=a.next())&&!o.done;){const c=t.values();let d=!1,p=0;for(;(s=c.next())&&!s.done;){if(!i[p]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){d=i[p]=!0;break}p++}if(!d)return!1}return!0}function c0(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function eue(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Gz(e,t,n,r){return(r===Ule||r===zle||r===qle)&&(e.$$typeof||t.$$typeof)?!0:Fle(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const tue="[object ArrayBuffer]",nue="[object Arguments]",rue="[object Boolean]",iue="[object DataView]",aue="[object Date]",oue="[object Error]",sue="[object Map]",lue="[object Number]",uue="[object Object]",cue="[object RegExp]",fue="[object Set]",due="[object String]",hue={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},pue="[object URL]",mue=Object.prototype.toString;function gue({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:d,areRegExpsEqual:p,areSetsEqual:m,areTypedArraysEqual:y,areUrlsEqual:b,unknownTagComparators:P}){return function(w,T,E){if(w===T)return!0;if(w==null||T==null)return!1;const k=typeof w;if(k!==typeof T)return!1;if(k!=="object")return k==="number"?s(w,T,E):k==="function"?a(w,T,E):!1;const D=w.constructor;if(D!==T.constructor)return!1;if(D===Object)return c(w,T,E);if(Array.isArray(w))return t(w,T,E);if(D===Date)return r(w,T,E);if(D===RegExp)return p(w,T,E);if(D===Map)return o(w,T,E);if(D===Set)return m(w,T,E);const I=mue.call(w);if(I===aue)return r(w,T,E);if(I===cue)return p(w,T,E);if(I===sue)return o(w,T,E);if(I===fue)return m(w,T,E);if(I===uue)return typeof w.then!="function"&&typeof T.then!="function"&&c(w,T,E);if(I===pue)return b(w,T,E);if(I===oue)return i(w,T,E);if(I===nue)return c(w,T,E);if(hue[I])return y(w,T,E);if(I===tue)return e(w,T,E);if(I===iue)return n(w,T,E);if(I===rue||I===lue||I===due)return d(w,T,E);if(P){let R=P[I];if(!R){const $=$le(w);$&&(R=P[$])}if(R)return R(w,T,E)}return!1}}function vue({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Vle,areArraysEqual:n?Hp:Wle,areDataViewsEqual:Kle,areDatesEqual:Hle,areErrorsEqual:Gle,areFunctionsEqual:Zle,areMapsEqual:n?yP(YD,Hp):YD,areNumbersEqual:Yle,areObjectsEqual:n?Hp:Xle,arePrimitiveWrappersEqual:Qle,areRegExpsEqual:Jle,areSetsEqual:n?yP(XD,Hp):XD,areTypedArraysEqual:n?yP(c0,Hp):c0,areUrlsEqual:eue,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const i=Xv(r.areArraysEqual),a=Xv(r.areMapsEqual),o=Xv(r.areObjectsEqual),s=Xv(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:s})}return r}function yue(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function bue({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(s,c){const{cache:d=e?new WeakMap:void 0,meta:p}=n();return t(s,c,{cache:d,equals:r,meta:p,strict:i})};if(e)return function(s,c){return t(s,c,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const a={cache:void 0,equals:r,meta:void 0,strict:i};return function(s,c){return t(s,c,a)}}const xue=Zc();Zc({strict:!0});Zc({circular:!0});Zc({circular:!0,strict:!0});Zc({createInternalComparator:()=>pd});Zc({strict:!0,createInternalComparator:()=>pd});Zc({circular:!0,createInternalComparator:()=>pd});Zc({circular:!0,createInternalComparator:()=>pd,strict:!0});function Zc(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=vue(e),o=gue(a),s=n?n(o):yue(o);return bue({circular:t,comparator:o,createState:r,equals:s,strict:i})}function wue(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function QD(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(a){n<0&&(n=a),a-n>t?(e(a),n=-1):wue(i)};requestAnimationFrame(r)}function $O(e){"@babel/helpers - typeof";return $O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$O(e)}function _ue(e){return Oue(e)||jue(e)||Pue(e)||Sue()}function Sue(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pue(e,t){if(e){if(typeof e=="string")return JD(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return JD(e,t)}}function JD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:T<0?0:T},x=function(T){for(var E=T>1?1:T,k=E,D=0;D<8;++D){var I=m(k)-E,R=b(k);if(Math.abs(I-E)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,i=t.damping,a=i===void 0?8:i,o=t.dt,s=o===void 0?17:o,c=function(p,m,y){var b=-(p-m)*r,P=y*a,x=y+(b-P)*s/1e3,w=y*s/1e3+p;return Math.abs(w-m)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rce(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}function bP(e){return sce(e)||oce(e)||ace(e)||ice()}function ice(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ace(e,t){if(e){if(typeof e=="string")return VO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VO(e,t)}}function oce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function sce(e){if(Array.isArray(e))return VO(e)}function VO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function h0(e){return h0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},h0(e)}var Cu=(function(e){dce(n,e);var t=hce(n);function n(r,i){var a;lce(this,n),a=t.call(this,r,i);var o=a.props,s=o.isActive,c=o.attributeName,d=o.from,p=o.to,m=o.steps,y=o.children,b=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(HO(a)),a.changeStyle=a.changeStyle.bind(HO(a)),!s||b<=0)return a.state={style:{}},typeof y=="function"&&(a.state={style:p}),KO(a);if(m&&m.length)a.state={style:m[0].style};else if(d){if(typeof y=="function")return a.state={style:d},KO(a);a.state={style:c?im({},c,d):d}}else a.state={style:{}};return a}return cce(n,[{key:"componentDidMount",value:function(){var i=this.props,a=i.isActive,o=i.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var a=this.props,o=a.isActive,s=a.canBegin,c=a.attributeName,d=a.shouldReAnimate,p=a.to,m=a.from,y=this.state.style;if(s){if(!o){var b={style:c?im({},c,p):p};this.state&&y&&(c&&y[c]!==p||!c&&y!==p)&&this.setState(b);return}if(!(xue(i.to,p)&&i.canBegin&&i.isActive)){var P=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var x=P||d?m:i.to;if(this.state&&y){var w={style:c?im({},c,x):x};(c&&y[c]!==x||!c&&y!==x)&&this.setState(w)}this.runAnimation(Xs(Xs({},this.props),{},{from:x,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var a=this,o=i.from,s=i.to,c=i.duration,d=i.easing,p=i.begin,m=i.onAnimationEnd,y=i.onAnimationStart,b=ece(o,s,Uue(d),c,this.changeStyle),P=function(){a.stopJSAnimation=b()};this.manager.start([y,p,P,c,m])}},{key:"runStepAnimation",value:function(i){var a=this,o=i.steps,s=i.begin,c=i.onAnimationStart,d=o[0],p=d.style,m=d.duration,y=m===void 0?0:m,b=function(x,w,T){if(T===0)return x;var E=w.duration,k=w.easing,D=k===void 0?"ease":k,I=w.style,R=w.properties,$=w.onAnimationEnd,V=T>0?o[T-1]:w,K=R||Object.keys(I);if(typeof D=="function"||D==="spring")return[].concat(bP(x),[a.runJSAnimation.bind(a,{from:V.style,to:I,duration:E,easing:D}),E]);var Z=nB(K,E,D),ee=Xs(Xs(Xs({},V.style),I),{},{transition:Z});return[].concat(bP(x),[ee,E,$]).filter(Cue)};return this.manager.start([c].concat(bP(o.reduce(b,[p,Math.max(y,s)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=Tue());var a=i.begin,o=i.duration,s=i.attributeName,c=i.to,d=i.easing,p=i.onAnimationStart,m=i.onAnimationEnd,y=i.steps,b=i.children,P=this.manager;if(this.unSubscribe=P.subscribe(this.handleStyleChange),typeof d=="function"||typeof b=="function"||d==="spring"){this.runJSAnimation(i);return}if(y.length>1){this.runStepAnimation(i);return}var x=s?im({},s,c):c,w=nB(Object.keys(x),o,d);P.start([p,a,Xs(Xs({},x),{},{transition:w}),o,m])}},{key:"render",value:function(){var i=this.props,a=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var s=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=nce(i,tce),d=M.Children.count(a),p=this.state.style;if(typeof a=="function")return a(p);if(!s||d===0||o<=0)return a;var m=function(b){var P=b.props,x=P.style,w=x===void 0?{}:x,T=P.className,E=M.cloneElement(b,Xs(Xs({},c),{},{style:Xs(Xs({},w),p),className:T}));return E};return d===1?m(M.Children.only(a)):ce.createElement("div",null,M.Children.map(a,function(y){return m(y)}))}}]),n})(M.PureComponent);Cu.displayName="Animate";Cu.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Cu.propTypes={from:Xn.oneOfType([Xn.object,Xn.string]),to:Xn.oneOfType([Xn.object,Xn.string]),attributeName:Xn.string,duration:Xn.number,begin:Xn.number,easing:Xn.oneOfType([Xn.string,Xn.func]),steps:Xn.arrayOf(Xn.shape({duration:Xn.number.isRequired,style:Xn.object.isRequired,easing:Xn.oneOfType([Xn.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Xn.func]),properties:Xn.arrayOf("string"),onAnimationEnd:Xn.func})),children:Xn.oneOfType([Xn.node,Xn.func]),isActive:Xn.bool,canBegin:Xn.bool,onAnimationEnd:Xn.func,shouldReAnimate:Xn.bool,onAnimationStart:Xn.func,onAnimationReStart:Xn.func};function Xm(e){"@babel/helpers - typeof";return Xm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xm(e)}function p0(){return p0=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,c=r>=0?1:-1,d=i>=0&&r>=0||i<0&&r<0?1:0,p;if(o>0&&a instanceof Array){for(var m=[0,0,0,0],y=0,b=4;yo?o:a[y];p="M".concat(t,",").concat(n+s*m[0]),m[0]>0&&(p+="A ".concat(m[0],",").concat(m[0],",0,0,").concat(d,",").concat(t+c*m[0],",").concat(n)),p+="L ".concat(t+r-c*m[1],",").concat(n),m[1]>0&&(p+="A ".concat(m[1],",").concat(m[1],",0,0,").concat(d,`, `).concat(t+r,",").concat(n+s*m[1])),p+="L ".concat(t+r,",").concat(n+i-s*m[2]),m[2]>0&&(p+="A ".concat(m[2],",").concat(m[2],",0,0,").concat(d,`, `).concat(t+r-c*m[2],",").concat(n+i)),p+="L ".concat(t+c*m[3],",").concat(n+i),m[3]>0&&(p+="A ".concat(m[3],",").concat(m[3],",0,0,").concat(d,`, `).concat(t,",").concat(n+i-s*m[3])),p+="Z"}else if(o>0&&a===+a&&a>0){var P=Math.min(o,a);p="M ".concat(t,",").concat(n+s*P,` A `).concat(P,",").concat(P,",0,0,").concat(d,",").concat(t+c*P,",").concat(n,` L `).concat(t+r-c*P,",").concat(n,` A `).concat(P,",").concat(P,",0,0,").concat(d,",").concat(t+r,",").concat(n+s*P,` L `).concat(t+r,",").concat(n+i-s*P,` A `).concat(P,",").concat(P,",0,0,").concat(d,",").concat(t+r-c*P,",").concat(n+i,` L `).concat(t+c*P,",").concat(n+i,` A `).concat(P,",").concat(P,",0,0,").concat(d,",").concat(t,",").concat(n+i-s*P," Z")}else p="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return p},Sce=function(t,n){if(!t||!n)return!1;var r=t.x,i=t.y,a=n.x,o=n.y,s=n.width,c=n.height;if(Math.abs(s)>0&&Math.abs(c)>0){var d=Math.min(a,a+s),p=Math.max(a,a+s),m=Math.min(o,o+c),y=Math.max(o,o+c);return r>=d&&r<=p&&i>=m&&i<=y}return!1},Pce={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},yA=function(t){var n=cB(cB({},Pce),t),r=M.useRef(),i=M.useState(-1),a=mce(i,2),o=a[0],s=a[1];M.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var D=r.current.getTotalLength();D&&s(D)}catch{}},[]);var c=n.x,d=n.y,p=n.width,m=n.height,y=n.radius,b=n.className,P=n.animationEasing,x=n.animationDuration,w=n.animationBegin,T=n.isAnimationActive,E=n.isUpdateAnimationActive;if(c!==+c||d!==+d||p!==+p||m!==+m||p===0||m===0)return null;var k=pn("recharts-rectangle",b);return E?ce.createElement(Cu,{canBegin:o>0,from:{width:p,height:m,x:c,y:d},to:{width:p,height:m,x:c,y:d},duration:x,animationEasing:P,isActive:E},function(D){var I=D.width,R=D.height,$=D.x,V=D.y;return ce.createElement(Cu,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:x,isActive:T,easing:P},ce.createElement("path",p0({},Jt(n,!0),{className:k,d:fB($,V,I,R,y),ref:r})))}):ce.createElement("path",p0({},Jt(n,!0),{className:k,d:fB(c,d,p,m,y)}))},jce=["points","className","baseLinePoints","connectNulls"];function qd(){return qd=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Tce(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function dB(e){return Cce(e)||kce(e)||Ace(e)||Ece()}function Ece(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ace(e,t){if(e){if(typeof e=="string")return GO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return GO(e,t)}}function kce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Cce(e){if(Array.isArray(e))return GO(e)}function GO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){hB(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),hB(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},ym=function(t,n){var r=Nce(t);n&&(r=[r.reduce(function(a,o){return[].concat(dB(a),dB(o))},[])]);var i=r.map(function(a){return a.reduce(function(o,s,c){return"".concat(o).concat(c===0?"M":"L").concat(s.x,",").concat(s.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},Mce=function(t,n,r){var i=ym(t,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(ym(n.reverse(),r).slice(1))},Rce=function(t){var n=t.points,r=t.className,i=t.baseLinePoints,a=t.connectNulls,o=Oce(t,jce);if(!n||!n.length)return null;var s=pn("recharts-polygon",r);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",d=Mce(n,i,a);return ce.createElement("g",{className:s},ce.createElement("path",qd({},Jt(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",stroke:"none",d})),c?ce.createElement("path",qd({},Jt(o,!0),{fill:"none",d:ym(n,a)})):null,c?ce.createElement("path",qd({},Jt(o,!0),{fill:"none",d:ym(i,a)})):null)}var p=ym(n,a);return ce.createElement("path",qd({},Jt(o,!0),{fill:p.slice(-1)==="Z"?o.fill:"none",className:s,d:p}))};function ZO(){return ZO=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qce(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var zce=function(t,n,r,i,a,o){return"M".concat(t,",").concat(a,"v").concat(i,"M").concat(o,",").concat(n,"h").concat(r)},Uce=function(t){var n=t.x,r=n===void 0?0:n,i=t.y,a=i===void 0?0:i,o=t.top,s=o===void 0?0:o,c=t.left,d=c===void 0?0:c,p=t.width,m=p===void 0?0:p,y=t.height,b=y===void 0?0:y,P=t.className,x=Fce(t,Lce),w=Ice({x:r,y:a,top:s,left:d,width:m,height:b},x);return!ct(r)||!ct(a)||!ct(m)||!ct(b)||!ct(s)||!ct(d)?null:ce.createElement("path",YO({},Jt(w,!0),{className:pn("recharts-cross",P),d:zce(r,a,m,b,s,d)}))},xP,mB;function Vce(){if(mB)return xP;mB=1;var e=kb(),t=mz(),n=Hl();function r(i,a){return i&&i.length?e(i,n(a,2),t):void 0}return xP=r,xP}var Wce=Vce();const Kce=In(Wce);var wP,gB;function Hce(){if(gB)return wP;gB=1;var e=kb(),t=Hl(),n=gz();function r(i,a){return i&&i.length?e(i,t(a,2),n):void 0}return wP=r,wP}var Gce=Hce();const Zce=In(Gce);var Yce=["cx","cy","angle","ticks","axisLine"],Xce=["ticks","tick","angle","tickFormatter","stroke"];function Ah(e){"@babel/helpers - typeof";return Ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ah(e)}function bm(){return bm=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Qce(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Jce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bB(e,t){for(var n=0;n_B?o=i==="outer"?"start":"end":a<-_B?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,a=r.cy,o=r.radius,s=r.axisLine,c=r.axisLineType,d=yf(yf({},Jt(this.props,!1)),{},{fill:"none"},Jt(s,!1));if(c==="circle")return ce.createElement(bA,jf({className:"recharts-polar-angle-axis-line"},d,{cx:i,cy:a,r:o}));var p=this.props.ticks,m=p.map(function(y){return gr(i,a,o,y.coordinate)});return ce.createElement(Rce,jf({className:"recharts-polar-angle-axis-line"},d,{points:m}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,a=i.ticks,o=i.tick,s=i.tickLine,c=i.tickFormatter,d=i.stroke,p=Jt(this.props,!1),m=Jt(o,!1),y=yf(yf({},p),{},{fill:"none"},Jt(s,!1)),b=a.map(function(P,x){var w=r.getTickLineCoord(P),T=r.getTickTextAnchor(P),E=yf(yf(yf({textAnchor:T},p),{},{stroke:"none",fill:d},m),{},{index:x,payload:P,x:w.x2,y:w.y2});return ce.createElement(tr,jf({className:pn("recharts-polar-angle-axis-tick",Vz(o)),key:"tick-".concat(P.coordinate)},Qf(r.props,P,x)),s&&ce.createElement("line",jf({className:"recharts-polar-angle-axis-tick-line"},y,w)),o&&t.renderTickItem(o,E,c?c(P.value,x):P.value))});return ce.createElement(tr,{className:"recharts-polar-angle-axis-ticks"},b)}},{key:"render",value:function(){var r=this.props,i=r.ticks,a=r.radius,o=r.axisLine;return a<=0||!i||!i.length?null:ce.createElement(tr,{className:pn("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,a){var o;return ce.isValidElement(r)?o=ce.cloneElement(r,i):tn(r)?o=r(i):o=ce.createElement(Jf,jf({},i,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])})(M.PureComponent);$b(Fb,"displayName","PolarAngleAxis");$b(Fb,"axisType","angleAxis");$b(Fb,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var _P,SB;function pfe(){if(SB)return _P;SB=1;var e=mq(),t=e(Object.getPrototypeOf,Object);return _P=t,_P}var SP,PB;function mfe(){if(PB)return SP;PB=1;var e=Iu(),t=pfe(),n=Du(),r="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,c=o.call(Object);function d(p){if(!n(p)||e(p)!=r)return!1;var m=t(p);if(m===null)return!0;var y=s.call(m,"constructor")&&m.constructor;return typeof y=="function"&&y instanceof y&&o.call(y)==c}return SP=d,SP}var gfe=mfe();const vfe=In(gfe);var PP,jB;function yfe(){if(jB)return PP;jB=1;var e=Iu(),t=Du(),n="[object Boolean]";function r(i){return i===!0||i===!1||t(i)&&e(i)==n}return PP=r,PP}var bfe=yfe();const xfe=In(bfe);function Jm(e){"@babel/helpers - typeof";return Jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jm(e)}function v0(){return v0=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:y,x:c,y:d},to:{upperWidth:p,lowerWidth:m,height:y,x:c,y:d},duration:x,animationEasing:P,isActive:T},function(k){var D=k.upperWidth,I=k.lowerWidth,R=k.height,$=k.x,V=k.y;return ce.createElement(Cu,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:w,duration:x,easing:P},ce.createElement("path",v0({},Jt(n,!0),{className:E,d:AB($,V,D,I,R),ref:r})))}):ce.createElement("g",null,ce.createElement("path",v0({},Jt(n,!0),{className:E,d:AB(c,d,p,m,y)})))},Cfe=["option","shapeType","propTransformer","activeClassName","isActive"];function eg(e){"@babel/helpers - typeof";return eg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},eg(e)}function Nfe(e,t){if(e==null)return{};var n=Mfe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Mfe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function kB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function y0(e){for(var t=1;t0?Uo(k,"paddingAngle",0):0;if(I){var $=hc(I.endAngle-I.startAngle,k.endAngle-k.startAngle),V=pr(pr({},k),{},{startAngle:E+R,endAngle:E+$(x)+R});w.push(V),E=V.endAngle}else{var K=k.endAngle,Z=k.startAngle,ee=hc(0,K-Z),ne=ee(x),oe=pr(pr({},k),{},{startAngle:E+R,endAngle:E+ne+R});w.push(oe),E=oe.endAngle}}),ce.createElement(tr,null,r.renderSectorsStatically(w))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var s=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,i=r.sectors,a=r.isAnimationActive,o=this.state.prevSectors;return a&&i&&i.length&&(!o||!Mb(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,i=this.props,a=i.hide,o=i.sectors,s=i.className,c=i.label,d=i.cx,p=i.cy,m=i.innerRadius,y=i.outerRadius,b=i.isAnimationActive,P=this.state.isAnimationFinished;if(a||!o||!o.length||!ct(d)||!ct(p)||!ct(m)||!ct(y))return null;var x=pn("recharts-pie",s);return ce.createElement(tr,{tabIndex:this.props.rootTabIndex,className:x,ref:function(T){r.pieRef=T}},this.renderSectors(),c&&this.renderLabels(o),Ui.renderCallByParent(this.props,null,!1),(!b||P)&&Mc.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return i.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:r.sectors!==i.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,i){return r>i?"start":r=360?E:E-1)*c,D=w-E*b-k,I=i.reduce(function(V,K){var Z=Aa(K,T,0);return V+(ct(Z)?Z:0)},0),R;if(I>0){var $;R=i.map(function(V,K){var Z=Aa(V,T,0),ee=Aa(V,p,K),ne=(ct(Z)?Z:0)/I,oe;K?oe=$.endAngle+Za(x)*c*(Z!==0?1:0):oe=o;var he=oe+Za(x)*((Z!==0?b:0)+ne*D),Se=(oe+he)/2,fe=(P.innerRadius+P.outerRadius)/2,Oe=[{name:ee,value:Z,payload:V,dataKey:T,type:y}],re=gr(P.cx,P.cy,fe,Se);return $=pr(pr(pr({percent:ne,cornerRadius:a,name:ee,tooltipPayload:Oe,midAngle:Se,middleRadius:fe,tooltipPosition:re},V),P),{},{value:Aa(V,T),startAngle:oe,endAngle:he,payload:V,paddingAngle:Za(x)*c}),$})}return pr(pr({},P),{},{sectors:R,data:i})});var jP,RB;function ede(){if(RB)return jP;RB=1;var e=Math.ceil,t=Math.max;function n(r,i,a,o){for(var s=-1,c=t(e((i-r)/(a||1)),0),d=Array(c);c--;)d[o?c:++s]=r,r+=a;return d}return jP=n,jP}var OP,LB;function l6(){if(LB)return OP;LB=1;var e=Cq(),t=1/0,n=17976931348623157e292;function r(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*n}return i===i?i:0}return OP=r,OP}var TP,IB;function tde(){if(IB)return TP;IB=1;var e=ede(),t=Sb(),n=l6();function r(i){return function(a,o,s){return s&&typeof s!="number"&&t(a,o,s)&&(o=s=void 0),a=n(a),o===void 0?(o=a,a=0):o=n(o),s=s===void 0?a0&&r.handleDrag(i.changedTouches[0])}),Bo(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,a=i.endIndex,o=i.onDragEnd,s=i.startIndex;o==null||o({endIndex:a,startIndex:s})}),r.detachDragEndListener()}),Bo(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Bo(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Bo(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Bo(r,"handleSlideDragStart",function(i){var a=zB(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return hde(t,e),ude(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,a=r.endX,o=this.state.scaleValues,s=this.props,c=s.gap,d=s.data,p=d.length-1,m=Math.min(i,a),y=Math.max(i,a),b=t.getIndexInRange(o,m),P=t.getIndexInRange(o,y);return{startIndex:b-b%c,endIndex:P===p?p:P-P%c}}},{key:"getTextOfTick",value:function(r){var i=this.props,a=i.data,o=i.tickFormatter,s=i.dataKey,c=Aa(a[r],s,r);return tn(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,a=i.slideMoveStartX,o=i.startX,s=i.endX,c=this.props,d=c.x,p=c.width,m=c.travellerWidth,y=c.startIndex,b=c.endIndex,P=c.onChange,x=r.pageX-a;x>0?x=Math.min(x,d+p-m-s,d+p-m-o):x<0&&(x=Math.max(x,d-o,d-s));var w=this.getIndex({startX:o+x,endX:s+x});(w.startIndex!==y||w.endIndex!==b)&&P&&P(w),this.setState({startX:o+x,endX:s+x,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var a=zB(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,a=i.brushMoveStartX,o=i.movingTravellerId,s=i.endX,c=i.startX,d=this.state[o],p=this.props,m=p.x,y=p.width,b=p.travellerWidth,P=p.onChange,x=p.gap,w=p.data,T={startX:this.state.startX,endX:this.state.endX},E=r.pageX-a;E>0?E=Math.min(E,m+y-b-d):E<0&&(E=Math.max(E,m-d)),T[o]=d+E;var k=this.getIndex(T),D=k.startIndex,I=k.endIndex,R=function(){var V=w.length-1;return o==="startX"&&(s>c?D%x===0:I%x===0)||sc?I%x===0:D%x===0)||s>c&&I===V};this.setState(Bo(Bo({},o,d+E),"brushMoveStartX",r.pageX),function(){P&&R()&&P(k)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var a=this,o=this.state,s=o.scaleValues,c=o.startX,d=o.endX,p=this.state[i],m=s.indexOf(p);if(m!==-1){var y=m+r;if(!(y===-1||y>=s.length)){var b=s[y];i==="startX"&&b>=d||i==="endX"&&b<=c||this.setState(Bo({},i,b),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,a=r.y,o=r.width,s=r.height,c=r.fill,d=r.stroke;return ce.createElement("rect",{stroke:d,fill:c,x:i,y:a,width:o,height:s})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,a=r.y,o=r.width,s=r.height,c=r.data,d=r.children,p=r.padding,m=M.Children.only(d);return m?ce.cloneElement(m,{x:i,y:a,width:o,height:s,margin:p,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,i){var a,o,s=this,c=this.props,d=c.y,p=c.travellerWidth,m=c.height,y=c.traveller,b=c.ariaLabel,P=c.data,x=c.startIndex,w=c.endIndex,T=Math.max(r,this.props.x),E=AP(AP({},Jt(this.props,!1)),{},{x:T,y:d,width:p,height:m}),k=b||"Min value: ".concat((a=P[x])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=P[w])===null||o===void 0?void 0:o.name);return ce.createElement(tr,{tabIndex:0,role:"slider","aria-label":k,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(I){["ArrowLeft","ArrowRight"].includes(I.key)&&(I.preventDefault(),I.stopPropagation(),s.handleTravellerMoveKeyboard(I.key==="ArrowRight"?1:-1,i))},onFocus:function(){s.setState({isTravellerFocused:!0})},onBlur:function(){s.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(y,E))}},{key:"renderSlide",value:function(r,i){var a=this.props,o=a.y,s=a.height,c=a.stroke,d=a.travellerWidth,p=Math.min(r,i)+d,m=Math.max(Math.abs(i-r)-d,0);return ce.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:p,y:o,width:m,height:s})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,a=r.endIndex,o=r.y,s=r.height,c=r.travellerWidth,d=r.stroke,p=this.state,m=p.startX,y=p.endX,b=5,P={pointerEvents:"none",fill:d};return ce.createElement(tr,{className:"recharts-brush-texts"},ce.createElement(Jf,w0({textAnchor:"end",verticalAnchor:"middle",x:Math.min(m,y)-b,y:o+s/2},P),this.getTextOfTick(i)),ce.createElement(Jf,w0({textAnchor:"start",verticalAnchor:"middle",x:Math.max(m,y)+c+b,y:o+s/2},P),this.getTextOfTick(a)))}},{key:"render",value:function(){var r=this.props,i=r.data,a=r.className,o=r.children,s=r.x,c=r.y,d=r.width,p=r.height,m=r.alwaysShowText,y=this.state,b=y.startX,P=y.endX,x=y.isTextActive,w=y.isSlideMoving,T=y.isTravellerMoving,E=y.isTravellerFocused;if(!i||!i.length||!ct(s)||!ct(c)||!ct(d)||!ct(p)||d<=0||p<=0)return null;var k=pn("recharts-brush",a),D=ce.Children.count(o)===1,I=sde("userSelect","none");return ce.createElement(tr,{className:k,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:I},this.renderBackground(),D&&this.renderPanorama(),this.renderSlide(b,P),this.renderTravellerLayer(b,"startX"),this.renderTravellerLayer(P,"endX"),(x||w||T||E||m)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,a=r.y,o=r.width,s=r.height,c=r.stroke,d=Math.floor(a+s/2)-1;return ce.createElement(ce.Fragment,null,ce.createElement("rect",{x:i,y:a,width:o,height:s,fill:c,stroke:"none"}),ce.createElement("line",{x1:i+1,y1:d,x2:i+o-1,y2:d,fill:"none",stroke:"#fff"}),ce.createElement("line",{x1:i+1,y1:d+2,x2:i+o-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var a;return ce.isValidElement(r)?a=ce.cloneElement(r,i):tn(r)?a=r(i):a=t.renderDefaultTraveller(i),a}},{key:"getDerivedStateFromProps",value:function(r,i){var a=r.data,o=r.width,s=r.x,c=r.travellerWidth,d=r.updateId,p=r.startIndex,m=r.endIndex;if(a!==i.prevData||d!==i.prevUpdateId)return AP({prevData:a,prevTravellerWidth:c,prevUpdateId:d,prevX:s,prevWidth:o},a&&a.length?mde({data:a,width:o,x:s,travellerWidth:c,startIndex:p,endIndex:m}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||s!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([s,s+o-c]);var y=i.scale.domain().map(function(b){return i.scale(b)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:d,prevX:s,prevWidth:o,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:y}}return null}},{key:"getIndexInRange",value:function(r,i){for(var a=r.length,o=0,s=a-1;s-o>1;){var c=Math.floor((o+s)/2);r[c]>i?s=c:o=c}return i>=r[s]?s:o}}])})(M.PureComponent);Bo(Mh,"displayName","Brush");Bo(Mh,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var kP,UB;function gde(){if(UB)return kP;UB=1;var e=VE();function t(n,r){var i;return e(n,function(a,o,s){return i=r(a,o,s),!i}),!!i}return kP=t,kP}var CP,VB;function vde(){if(VB)return CP;VB=1;var e=lq(),t=Hl(),n=gde(),r=Oo(),i=Sb();function a(o,s,c){var d=r(o)?e:n;return c&&i(o,s,c)&&(s=void 0),d(o,t(s,3))}return CP=a,CP}var yde=vde();const bde=In(yde);var Dl=function(t,n){var r=t.alwaysShow,i=t.ifOverflow;return r&&(i="extendDomain"),i===n},NP,WB;function xde(){if(WB)return NP;WB=1;var e=Oq();function t(n,r,i){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[r]=i}return NP=t,NP}var MP,KB;function wde(){if(KB)return MP;KB=1;var e=xde(),t=Pq(),n=Hl();function r(i,a){var o={};return a=n(a,3),t(i,function(s,c,d){e(o,c,a(s,c,d))}),o}return MP=r,MP}var _de=wde();const Sde=In(_de);var RP,HB;function Pde(){if(HB)return RP;HB=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Mde(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Rde(e,t){var n=e.x,r=e.y,i=Nde(e,Ede),a="".concat(n),o=parseInt(a,10),s="".concat(r),c=parseInt(s,10),d="".concat(t.height||i.height),p=parseInt(d,10),m="".concat(t.width||i.width),y=parseInt(m,10);return Gp(Gp(Gp(Gp(Gp({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:p,width:y,name:t.name,radius:t.radius})}function XB(e){return ce.createElement(a6,tT({shapeType:"rectangle",propTransformer:Rde,activeClassName:"recharts-active-bar"},e))}var Lde=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof t=="number")return t;var a=ct(r)||nJ(r);return a?t(r,i):(a||td(),n)}},Ide=["value","background"],h6;function Rh(e){"@babel/helpers - typeof";return Rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rh(e)}function Dde(e,t){if(e==null)return{};var n=Bde(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Bde(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function S0(){return S0=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(Se)0&&Math.abs(he)0&&(oe=Math.min((je||0)-(he[$e-1]||0),oe))}),Number.isFinite(oe)){var Se=oe/ne,fe=x.layout==="vertical"?r.height:r.width;if(x.padding==="gap"&&($=Se*fe/2),x.padding==="no-gap"){var Oe=Ya(t.barCategoryGap,Se*fe),re=Se*fe/2;$=re-Oe-(re-Oe)/fe*Oe}}}i==="xAxis"?V=[r.left+(k.left||0)+($||0),r.left+r.width-(k.right||0)-($||0)]:i==="yAxis"?V=c==="horizontal"?[r.top+r.height-(k.bottom||0),r.top+(k.top||0)]:[r.top+(k.top||0)+($||0),r.top+r.height-(k.bottom||0)-($||0)]:V=x.range,I&&(V=[V[1],V[0]]);var Ce=Dz(x,a,y),ae=Ce.scale,ie=Ce.realScaleType;ae.domain(T).range(V),Bz(ae);var de=$z(ae,rl(rl({},x),{},{realScaleType:ie}));i==="xAxis"?(ee=w==="top"&&!D||w==="bottom"&&D,K=r.left,Z=m[R]-ee*x.height):i==="yAxis"&&(ee=w==="left"&&!D||w==="right"&&D,K=m[R]-ee*x.width,Z=r.top);var He=rl(rl(rl({},x),de),{},{realScaleType:ie,x:K,y:Z,scale:ae,width:i==="xAxis"?r.width:x.width,height:i==="yAxis"?r.height:x.height});return He.bandSize=s0(He,de),!x.hide&&i==="xAxis"?m[R]+=(ee?-1:1)*He.height:x.hide||(m[R]+=(ee?-1:1)*He.width),rl(rl({},b),{},Ub({},P,He))},{})},v6=function(t,n){var r=t.x,i=t.y,a=n.x,o=n.y;return{x:Math.min(r,a),y:Math.min(i,o),width:Math.abs(a-r),height:Math.abs(o-i)}},Yde=function(t){var n=t.x1,r=t.y1,i=t.x2,a=t.y2;return v6({x:n,y:r},{x:i,y:a})},y6=(function(){function e(t){Kde(this,e),this.scale=t}return Hde(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,a=r.position;if(n!==void 0){if(a)switch(a){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var s=this.bandwidth?this.bandwidth():0;return this.scale(n)+s}default:return this.scale(n)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],a=r[r.length-1];return i<=a?n>=i&&n<=a:n>=a&&n<=i}}],[{key:"create",value:function(n){return new e(n)}}])})();Ub(y6,"EPS",1e-4);var xA=function(t){var n=Object.keys(t).reduce(function(r,i){return rl(rl({},r),{},Ub({},i,y6.create(t[i])))},{});return rl(rl({},n),{},{apply:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,s=a.position;return Sde(i,function(c,d){return n[d].apply(c,{bandAware:o,position:s})})},isInRange:function(i){return d6(i,function(a,o){return n[o].isInRange(a)})}})};function Xde(e){return(e%180+180)%180}var Qde=function(t){var n=t.width,r=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Xde(i),o=a*Math.PI/180,s=Math.atan(r/n),c=o>s&&o-1?c[d?a[p]:p]:void 0}}return DP=r,DP}var BP,r4;function ehe(){if(r4)return BP;r4=1;var e=l6();function t(n){var r=e(n),i=r%1;return r===r?i?r-i:r:0}return BP=t,BP}var $P,i4;function the(){if(i4)return $P;i4=1;var e=bq(),t=Hl(),n=ehe(),r=Math.max;function i(a,o,s){var c=a==null?0:a.length;if(!c)return-1;var d=s==null?0:n(s);return d<0&&(d=r(c+d,0)),e(a,t(o,3),d)}return $P=i,$P}var FP,a4;function nhe(){if(a4)return FP;a4=1;var e=Jde(),t=the(),n=e(t);return FP=n,FP}var rhe=nhe();const ihe=In(rhe);var ahe=L5();const ohe=In(ahe);var she=ohe(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),wA=M.createContext(void 0),_A=M.createContext(void 0),b6=M.createContext(void 0),x6=M.createContext({}),w6=M.createContext(void 0),_6=M.createContext(0),S6=M.createContext(0),o4=function(t){var n=t.state,r=n.xAxisMap,i=n.yAxisMap,a=n.offset,o=t.clipPathId,s=t.children,c=t.width,d=t.height,p=she(a);return ce.createElement(wA.Provider,{value:r},ce.createElement(_A.Provider,{value:i},ce.createElement(x6.Provider,{value:a},ce.createElement(b6.Provider,{value:p},ce.createElement(w6.Provider,{value:o},ce.createElement(_6.Provider,{value:d},ce.createElement(S6.Provider,{value:c},s)))))))},lhe=function(){return M.useContext(w6)},P6=function(t){var n=M.useContext(wA);n==null&&td();var r=n[t];return r==null&&td(),r},uhe=function(){var t=M.useContext(wA);return mc(t)},che=function(){var t=M.useContext(_A),n=ihe(t,function(r){return d6(r.domain,Number.isFinite)});return n||mc(t)},j6=function(t){var n=M.useContext(_A);n==null&&td();var r=n[t];return r==null&&td(),r},fhe=function(){var t=M.useContext(b6);return t},dhe=function(){return M.useContext(x6)},SA=function(){return M.useContext(S6)},PA=function(){return M.useContext(_6)};function Lh(e){"@babel/helpers - typeof";return Lh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lh(e)}function hhe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function phe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Zhe(e,t){return N6(e,t+1)}function Yhe(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,d=1,p=o,m=function(){var P=r==null?void 0:r[c];if(P===void 0)return{v:N6(r,d)};var x=c,w,T=function(){return w===void 0&&(w=n(P,x)),w},E=P.coordinate,k=c===0||E0(e,E,T,p,s);k||(c=0,p=o,d+=1),k&&(p=E+e*(T()/2+i),c+=d)},y;d<=a.length;)if(y=m(),y)return y.v;return[]}function ag(e){"@babel/helpers - typeof";return ag=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ag(e)}function p4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ja(e){for(var t=1;t0?b.coordinate-w*e:b.coordinate})}else a[y]=b=ja(ja({},b),{},{tickCoord:b.coordinate});var T=E0(e,b.tickCoord,x,s,c);T&&(c=b.tickCoord-e*(x()/2+i),a[y]=ja(ja({},b),{},{isShow:!0}))},p=o-1;p>=0;p--)d(p);return a}function tpe(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,d=t.end;if(a){var p=r[s-1],m=n(p,s-1),y=e*(p.coordinate+e*m/2-d);o[s-1]=p=ja(ja({},p),{},{tickCoord:y>0?p.coordinate-y*e:p.coordinate});var b=E0(e,p.tickCoord,function(){return m},c,d);b&&(d=p.tickCoord-e*(m/2+i),o[s-1]=ja(ja({},p),{},{isShow:!0}))}for(var P=a?s-1:s,x=function(E){var k=o[E],D,I=function(){return D===void 0&&(D=n(k,E)),D};if(E===0){var R=e*(k.coordinate-e*I()/2-c);o[E]=k=ja(ja({},k),{},{tickCoord:R<0?k.coordinate-R*e:k.coordinate})}else o[E]=k=ja(ja({},k),{},{tickCoord:k.coordinate});var $=E0(e,k.tickCoord,I,c,d);$&&(c=k.tickCoord+e*(I()/2+i),o[E]=ja(ja({},k),{},{isShow:!0}))},w=0;w=2?Za(i[1].coordinate-i[0].coordinate):1,T=Ghe(a,w,b);return c==="equidistantPreserveStart"?Yhe(w,T,x,i,o):(c==="preserveStart"||c==="preserveStartEnd"?y=tpe(w,T,x,i,o,c==="preserveStartEnd"):y=epe(w,T,x,i,o),y.filter(function(E){return E.isShow}))}var npe=["viewBox"],rpe=["viewBox"],ipe=["ticks"];function Bh(e){"@babel/helpers - typeof";return Bh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bh(e)}function Ud(){return Ud=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ape(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ope(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g4(e,t){for(var n=0;n0?c(this.props):c(b)),o<=0||s<=0||!P||!P.length?null:ce.createElement(tr,{className:pn("recharts-cartesian-axis",d),ref:function(w){r.layerReference=w}},a&&this.renderAxisLine(),this.renderTicks(P,this.state.fontSize,this.state.letterSpacing),Ui.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,a){var o,s=pn(i.className,"recharts-cartesian-axis-tick-value");return ce.isValidElement(r)?o=ce.cloneElement(r,Pi(Pi({},i),{},{className:s})):tn(r)?o=r(Pi(Pi({},i),{},{className:s})):o=ce.createElement(Jf,Ud({},i,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])})(M.Component);EA(up,"displayName","CartesianAxis");EA(up,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var hpe=["x1","y1","x2","y2","key"],ppe=["offset"];function nd(e){"@babel/helpers - typeof";return nd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nd(e)}function v4(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ta(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ype(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var bpe=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,i=t.x,a=t.y,o=t.width,s=t.height,c=t.ry;return ce.createElement("rect",{x:i,y:a,ry:c,width:o,height:s,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function L6(e,t){var n;if(ce.isValidElement(e))n=ce.cloneElement(e,t);else if(tn(e))n=e(t);else{var r=t.x1,i=t.y1,a=t.x2,o=t.y2,s=t.key,c=y4(t,hpe),d=Jt(c,!1);d.offset;var p=y4(d,ppe);n=ce.createElement("line",Cf({},p,{x1:r,y1:i,x2:a,y2:o,fill:"none",key:s}))}return n}function xpe(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0?!0:r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(s,c){var d=Ta(Ta({},e),{},{x1:t,y1:s,x2:t+n,y2:s,key:"line-".concat(c),index:c});return L6(i,d)});return ce.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function wpe(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0?!0:r,a=e.verticalPoints;if(!i||!a||!a.length)return null;var o=a.map(function(s,c){var d=Ta(Ta({},e),{},{x1:s,y1:t,x2:s,y2:t+n,key:"line-".concat(c),index:c});return L6(i,d)});return ce.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function _pe(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.horizontalPoints,c=e.horizontal,d=c===void 0?!0:c;if(!d||!t||!t.length)return null;var p=s.map(function(y){return Math.round(y+i-i)}).sort(function(y,b){return y-b});i!==p[0]&&p.unshift(0);var m=p.map(function(y,b){var P=!p[b+1],x=P?i+o-y:p[b+1]-y;if(x<=0)return null;var w=b%t.length;return ce.createElement("rect",{key:"react-".concat(b),y,x:r,height:x,width:a,stroke:"none",fill:t[w],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return ce.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function Spe(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,s=e.width,c=e.height,d=e.verticalPoints;if(!n||!r||!r.length)return null;var p=d.map(function(y){return Math.round(y+a-a)}).sort(function(y,b){return y-b});a!==p[0]&&p.unshift(0);var m=p.map(function(y,b){var P=!p[b+1],x=P?a+s-y:p[b+1]-y;if(x<=0)return null;var w=b%r.length;return ce.createElement("rect",{key:"react-".concat(b),x:y,y:o,width:x,height:c,stroke:"none",fill:r[w],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return ce.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var Ppe=function(t,n){var r=t.xAxis,i=t.width,a=t.height,o=t.offset;return Iz(TA(Ta(Ta(Ta({},up.defaultProps),r),{},{ticks:_u(r,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.left,o.left+o.width,n)},jpe=function(t,n){var r=t.yAxis,i=t.width,a=t.height,o=t.offset;return Iz(TA(Ta(Ta(Ta({},up.defaultProps),r),{},{ticks:_u(r,!0),viewBox:{x:0,y:0,width:i,height:a}})),o.top,o.top+o.height,n)},Ld={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function k0(e){var t,n,r,i,a,o,s=SA(),c=PA(),d=dhe(),p=Ta(Ta({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Ld.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:Ld.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:Ld.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:Ld.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:Ld.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:Ld.verticalFill,x:ct(e.x)?e.x:d.left,y:ct(e.y)?e.y:d.top,width:ct(e.width)?e.width:d.width,height:ct(e.height)?e.height:d.height}),m=p.x,y=p.y,b=p.width,P=p.height,x=p.syncWithTicks,w=p.horizontalValues,T=p.verticalValues,E=uhe(),k=che();if(!ct(b)||b<=0||!ct(P)||P<=0||!ct(m)||m!==+m||!ct(y)||y!==+y)return null;var D=p.verticalCoordinatesGenerator||Ppe,I=p.horizontalCoordinatesGenerator||jpe,R=p.horizontalPoints,$=p.verticalPoints;if((!R||!R.length)&&tn(I)){var V=w&&w.length,K=I({yAxis:k?Ta(Ta({},k),{},{ticks:V?w:k.ticks}):void 0,width:s,height:c,offset:d},V?!0:x);cl(Array.isArray(K),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(nd(K),"]")),Array.isArray(K)&&(R=K)}if((!$||!$.length)&&tn(D)){var Z=T&&T.length,ee=D({xAxis:E?Ta(Ta({},E),{},{ticks:Z?T:E.ticks}):void 0,width:s,height:c,offset:d},Z?!0:x);cl(Array.isArray(ee),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(nd(ee),"]")),Array.isArray(ee)&&($=ee)}return ce.createElement("g",{className:"recharts-cartesian-grid"},ce.createElement(bpe,{fill:p.fill,fillOpacity:p.fillOpacity,x:p.x,y:p.y,width:p.width,height:p.height,ry:p.ry}),ce.createElement(xpe,Cf({},p,{offset:d,horizontalPoints:R,xAxis:E,yAxis:k})),ce.createElement(wpe,Cf({},p,{offset:d,verticalPoints:$,xAxis:E,yAxis:k})),ce.createElement(_pe,Cf({},p,{horizontalPoints:R})),ce.createElement(Spe,Cf({},p,{verticalPoints:$})))}k0.displayName="CartesianGrid";function $h(e){"@babel/helpers - typeof";return $h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$h(e)}function Ope(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tpe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pme(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function mme(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function gme(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?o:t&&t.length&&ct(i)&&ct(a)?t.slice(i,a+1):[]};function G6(e){return e==="number"?[0,"auto"]:void 0}var yT=function(t,n,r,i){var a=t.graphicalItems,o=t.tooltipAxis,s=Gb(n,t);return r<0||!a||!a.length||r>=s.length?null:a.reduce(function(c,d){var p,m=(p=d.props.data)!==null&&p!==void 0?p:n;m&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(m=m.slice(t.dataStartIndex,t.dataEndIndex+1));var y;if(o.dataKey&&!o.allowDuplicatedCategory){var b=m===void 0?s:m;y=Jj(b,o.dataKey,i)}else y=m&&m[r]||s[r];return y?[].concat(Vh(c),[qz(d,y)]):c},[])},j4=function(t,n,r,i){var a=i||{x:t.chartX,y:t.chartY},o=Eme(a,r),s=t.orderedTooltipTicks,c=t.tooltipAxis,d=t.tooltipTicks,p=cse(o,s,d,c);if(p>=0&&d){var m=d[p]&&d[p].value,y=yT(t,n,p,m),b=Ame(r,s,p,a);return{activeTooltipIndex:p,activeLabel:m,activePayload:y,activeCoordinate:b}}return null},kme=function(t,n){var r=n.axes,i=n.graphicalItems,a=n.axisType,o=n.axisIdKey,s=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,p=t.layout,m=t.children,y=t.stackOffset,b=Lz(p,a);return r.reduce(function(P,x){var w,T=x.type.defaultProps!==void 0?Ke(Ke({},x.type.defaultProps),x.props):x.props,E=T.type,k=T.dataKey,D=T.allowDataOverflow,I=T.allowDuplicatedCategory,R=T.scale,$=T.ticks,V=T.includeHidden,K=T[o];if(P[K])return P;var Z=Gb(t.data,{graphicalItems:i.filter(function(de){var He,je=o in de.props?de.props[o]:(He=de.type.defaultProps)===null||He===void 0?void 0:He[o];return je===K}),dataStartIndex:c,dataEndIndex:d}),ee=Z.length,ne,oe,he;nme(T.domain,D,E)&&(ne=MO(T.domain,null,D),b&&(E==="number"||R!=="auto")&&(he=gm(Z,k,"category")));var Se=G6(E);if(!ne||ne.length===0){var fe,Oe=(fe=T.domain)!==null&&fe!==void 0?fe:Se;if(k){if(ne=gm(Z,k,E),E==="category"&&b){var re=iJ(ne);I&&re?(oe=ne,ne=x0(0,ee)):I||(ne=kD(Oe,ne,x).reduce(function(de,He){return de.indexOf(He)>=0?de:[].concat(Vh(de),[He])},[]))}else if(E==="category")I?ne=ne.filter(function(de){return de!==""&&!_n(de)}):ne=kD(Oe,ne,x).reduce(function(de,He){return de.indexOf(He)>=0||He===""||_n(He)?de:[].concat(Vh(de),[He])},[]);else if(E==="number"){var Ce=mse(Z,i.filter(function(de){var He,je,$e=o in de.props?de.props[o]:(He=de.type.defaultProps)===null||He===void 0?void 0:He[o],We="hide"in de.props?de.props.hide:(je=de.type.defaultProps)===null||je===void 0?void 0:je.hide;return $e===K&&(V||!We)}),k,a,p);Ce&&(ne=Ce)}b&&(E==="number"||R!=="auto")&&(he=gm(Z,k,"category"))}else b?ne=x0(0,ee):s&&s[K]&&s[K].hasStack&&E==="number"?ne=y==="expand"?[0,1]:Fz(s[K].stackGroups,c,d):ne=Rz(Z,i.filter(function(de){var He=o in de.props?de.props[o]:de.type.defaultProps[o],je="hide"in de.props?de.props.hide:de.type.defaultProps.hide;return He===K&&(V||!je)}),E,p,!0);if(E==="number")ne=mT(m,ne,K,a,$),Oe&&(ne=MO(Oe,ne,D));else if(E==="category"&&Oe){var ae=Oe,ie=ne.every(function(de){return ae.indexOf(de)>=0});ie&&(ne=ae)}}return Ke(Ke({},P),{},Yt({},K,Ke(Ke({},T),{},{axisType:a,domain:ne,categoricalDomain:he,duplicateDomain:oe,originalDomain:(w=T.domain)!==null&&w!==void 0?w:Se,isCategorical:b,layout:p})))},{})},Cme=function(t,n){var r=n.graphicalItems,i=n.Axis,a=n.axisType,o=n.axisIdKey,s=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,p=t.layout,m=t.children,y=Gb(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:d}),b=y.length,P=Lz(p,a),x=-1;return r.reduce(function(w,T){var E=T.type.defaultProps!==void 0?Ke(Ke({},T.type.defaultProps),T.props):T.props,k=E[o],D=G6("number");if(!w[k]){x++;var I;return P?I=x0(0,b):s&&s[k]&&s[k].hasStack?(I=Fz(s[k].stackGroups,c,d),I=mT(m,I,k,a)):(I=MO(D,Rz(y,r.filter(function(R){var $,V,K=o in R.props?R.props[o]:($=R.type.defaultProps)===null||$===void 0?void 0:$[o],Z="hide"in R.props?R.props.hide:(V=R.type.defaultProps)===null||V===void 0?void 0:V.hide;return K===k&&!Z}),"number",p),i.defaultProps.allowDataOverflow),I=mT(m,I,k,a)),Ke(Ke({},w),{},Yt({},k,Ke(Ke({axisType:a},i.defaultProps),{},{hide:!0,orientation:Uo(Ome,"".concat(a,".").concat(x%2),null),domain:I,originalDomain:D,isCategorical:P,layout:p})))}return w},{})},Nme=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,a=n.AxisComp,o=n.graphicalItems,s=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,p=t.children,m="".concat(i,"Id"),y=Os(p,a),b={};return y&&y.length?b=kme(t,{axes:y,graphicalItems:o,axisType:i,axisIdKey:m,stackGroups:s,dataStartIndex:c,dataEndIndex:d}):o&&o.length&&(b=Cme(t,{Axis:a,graphicalItems:o,axisType:i,axisIdKey:m,stackGroups:s,dataStartIndex:c,dataEndIndex:d})),b},Mme=function(t){var n=mc(t),r=_u(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:WE(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:s0(n,r)}},O4=function(t){var n=t.children,r=t.defaultShowTooltip,i=$o(n,Mh),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(a=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},Rme=function(t){return!t||!t.length?!1:t.some(function(n){var r=Su(n&&n.type);return r&&r.indexOf("Bar")>=0})},T4=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Lme=function(t,n){var r=t.props,i=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,s=t.yAxisMap,c=s===void 0?{}:s,d=r.width,p=r.height,m=r.children,y=r.margin||{},b=$o(m,Mh),P=$o(m,Cc),x=Object.keys(c).reduce(function(I,R){var $=c[R],V=$.orientation;return!$.mirror&&!$.hide?Ke(Ke({},I),{},Yt({},V,I[V]+$.width)):I},{left:y.left||0,right:y.right||0}),w=Object.keys(o).reduce(function(I,R){var $=o[R],V=$.orientation;return!$.mirror&&!$.hide?Ke(Ke({},I),{},Yt({},V,Uo(I,"".concat(V))+$.height)):I},{top:y.top||0,bottom:y.bottom||0}),T=Ke(Ke({},w),x),E=T.bottom;b&&(T.bottom+=b.props.height||Mh.defaultProps.height),P&&n&&(T=hse(T,i,r,n));var k=d-T.left-T.right,D=p-T.top-T.bottom;return Ke(Ke({brushBottom:E},T),{},{width:Math.max(k,0),height:Math.max(D,0)})},Ime=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},Z6=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,a=i===void 0?"axis":i,o=t.validateTooltipEventTypes,s=o===void 0?["axis"]:o,c=t.axisComponents,d=t.legendContent,p=t.formatAxisMap,m=t.defaultProps,y=function(T,E){var k=E.graphicalItems,D=E.stackGroups,I=E.offset,R=E.updateId,$=E.dataStartIndex,V=E.dataEndIndex,K=T.barSize,Z=T.layout,ee=T.barGap,ne=T.barCategoryGap,oe=T.maxBarSize,he=T4(Z),Se=he.numericAxisName,fe=he.cateAxisName,Oe=Rme(k),re=[];return k.forEach(function(Ce,ae){var ie=Gb(T.data,{graphicalItems:[Ce],dataStartIndex:$,dataEndIndex:V}),de=Ce.type.defaultProps!==void 0?Ke(Ke({},Ce.type.defaultProps),Ce.props):Ce.props,He=de.dataKey,je=de.maxBarSize,$e=de["".concat(Se,"Id")],We=de["".concat(fe,"Id")],Ye={},rt=c.reduce(function(Bn,_r){var fr=E["".concat(_r.axisType,"Map")],To=de["".concat(_r.axisType,"Id")];fr&&fr[To]||_r.axisType==="zAxis"||td();var ua=fr[To];return Ke(Ke({},Bn),{},Yt(Yt({},_r.axisType,ua),"".concat(_r.axisType,"Ticks"),_u(ua)))},Ye),ze=rt[fe],Fe=rt["".concat(fe,"Ticks")],st=D&&D[$e]&&D[$e].hasStack&&Pse(Ce,D[$e].stackGroups),Te=Su(Ce.type).indexOf("Bar")>=0,Dt=s0(ze,Fe),Lt=[],dn=Oe&&fse({barSize:K,stackGroups:D,totalSize:Ime(rt,fe)});if(Te){var xn,qn,Ar=_n(je)?oe:je,Zr=(xn=(qn=s0(ze,Fe,!0))!==null&&qn!==void 0?qn:Ar)!==null&&xn!==void 0?xn:0;Lt=dse({barGap:ee,barCategoryGap:ne,bandSize:Zr!==Dt?Zr:Dt,sizeList:dn[We],maxBarSize:Ar}),Zr!==Dt&&(Lt=Lt.map(function(Bn){return Ke(Ke({},Bn),{},{position:Ke(Ke({},Bn.position),{},{offset:Bn.position.offset-Zr/2})})}))}var $r=Ce&&Ce.type&&Ce.type.getComposedData;$r&&re.push({props:Ke(Ke({},$r(Ke(Ke({},rt),{},{displayedData:ie,props:T,dataKey:He,item:Ce,bandSize:Dt,barPosition:Lt,offset:I,stackedData:st,layout:Z,dataStartIndex:$,dataEndIndex:V}))),{},Yt(Yt(Yt({key:Ce.key||"item-".concat(ae)},Se,rt[Se]),fe,rt[fe]),"animationId",R)),childIndex:gJ(Ce,T.children),item:Ce})}),re},b=function(T,E){var k=T.props,D=T.dataStartIndex,I=T.dataEndIndex,R=T.updateId;if(!WM({props:k}))return null;var $=k.children,V=k.layout,K=k.stackOffset,Z=k.data,ee=k.reverseStackOrder,ne=T4(V),oe=ne.numericAxisName,he=ne.cateAxisName,Se=Os($,r),fe=_se(Z,Se,"".concat(oe,"Id"),"".concat(he,"Id"),K,ee),Oe=c.reduce(function(de,He){var je="".concat(He.axisType,"Map");return Ke(Ke({},de),{},Yt({},je,Nme(k,Ke(Ke({},He),{},{graphicalItems:Se,stackGroups:He.axisType===oe&&fe,dataStartIndex:D,dataEndIndex:I}))))},{}),re=Lme(Ke(Ke({},Oe),{},{props:k,graphicalItems:Se}),E==null?void 0:E.legendBBox);Object.keys(Oe).forEach(function(de){Oe[de]=p(k,Oe[de],re,de.replace("Map",""),n)});var Ce=Oe["".concat(he,"Map")],ae=Mme(Ce),ie=y(k,Ke(Ke({},Oe),{},{dataStartIndex:D,dataEndIndex:I,updateId:R,graphicalItems:Se,stackGroups:fe,offset:re}));return Ke(Ke({formattedGraphicalItems:ie,graphicalItems:Se,offset:re,stackGroups:fe},ae),Oe)},P=(function(w){function T(E){var k,D,I;return mme(this,T),I=yme(this,T,[E]),Yt(I,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Yt(I,"accessibilityManager",new tme),Yt(I,"handleLegendBBoxUpdate",function(R){if(R){var $=I.state,V=$.dataStartIndex,K=$.dataEndIndex,Z=$.updateId;I.setState(Ke({legendBBox:R},b({props:I.props,dataStartIndex:V,dataEndIndex:K,updateId:Z},Ke(Ke({},I.state),{},{legendBBox:R}))))}}),Yt(I,"handleReceiveSyncEvent",function(R,$,V){if(I.props.syncId===R){if(V===I.eventEmitterSymbol&&typeof I.props.syncMethod!="function")return;I.applySyncEvent($)}}),Yt(I,"handleBrushChange",function(R){var $=R.startIndex,V=R.endIndex;if($!==I.state.dataStartIndex||V!==I.state.dataEndIndex){var K=I.state.updateId;I.setState(function(){return Ke({dataStartIndex:$,dataEndIndex:V},b({props:I.props,dataStartIndex:$,dataEndIndex:V,updateId:K},I.state))}),I.triggerSyncEvent({dataStartIndex:$,dataEndIndex:V})}}),Yt(I,"handleMouseEnter",function(R){var $=I.getMouseInfo(R);if($){var V=Ke(Ke({},$),{},{isTooltipActive:!0});I.setState(V),I.triggerSyncEvent(V);var K=I.props.onMouseEnter;tn(K)&&K(V,R)}}),Yt(I,"triggeredAfterMouseMove",function(R){var $=I.getMouseInfo(R),V=$?Ke(Ke({},$),{},{isTooltipActive:!0}):{isTooltipActive:!1};I.setState(V),I.triggerSyncEvent(V);var K=I.props.onMouseMove;tn(K)&&K(V,R)}),Yt(I,"handleItemMouseEnter",function(R){I.setState(function(){return{isTooltipActive:!0,activeItem:R,activePayload:R.tooltipPayload,activeCoordinate:R.tooltipPosition||{x:R.cx,y:R.cy}}})}),Yt(I,"handleItemMouseLeave",function(){I.setState(function(){return{isTooltipActive:!1}})}),Yt(I,"handleMouseMove",function(R){R.persist(),I.throttleTriggeredAfterMouseMove(R)}),Yt(I,"handleMouseLeave",function(R){I.throttleTriggeredAfterMouseMove.cancel();var $={isTooltipActive:!1};I.setState($),I.triggerSyncEvent($);var V=I.props.onMouseLeave;tn(V)&&V($,R)}),Yt(I,"handleOuterEvent",function(R){var $=mJ(R),V=Uo(I.props,"".concat($));if($&&tn(V)){var K,Z;/.*touch.*/i.test($)?Z=I.getMouseInfo(R.changedTouches[0]):Z=I.getMouseInfo(R),V((K=Z)!==null&&K!==void 0?K:{},R)}}),Yt(I,"handleClick",function(R){var $=I.getMouseInfo(R);if($){var V=Ke(Ke({},$),{},{isTooltipActive:!0});I.setState(V),I.triggerSyncEvent(V);var K=I.props.onClick;tn(K)&&K(V,R)}}),Yt(I,"handleMouseDown",function(R){var $=I.props.onMouseDown;if(tn($)){var V=I.getMouseInfo(R);$(V,R)}}),Yt(I,"handleMouseUp",function(R){var $=I.props.onMouseUp;if(tn($)){var V=I.getMouseInfo(R);$(V,R)}}),Yt(I,"handleTouchMove",function(R){R.changedTouches!=null&&R.changedTouches.length>0&&I.throttleTriggeredAfterMouseMove(R.changedTouches[0])}),Yt(I,"handleTouchStart",function(R){R.changedTouches!=null&&R.changedTouches.length>0&&I.handleMouseDown(R.changedTouches[0])}),Yt(I,"handleTouchEnd",function(R){R.changedTouches!=null&&R.changedTouches.length>0&&I.handleMouseUp(R.changedTouches[0])}),Yt(I,"handleDoubleClick",function(R){var $=I.props.onDoubleClick;if(tn($)){var V=I.getMouseInfo(R);$(V,R)}}),Yt(I,"handleContextMenu",function(R){var $=I.props.onContextMenu;if(tn($)){var V=I.getMouseInfo(R);$(V,R)}}),Yt(I,"triggerSyncEvent",function(R){I.props.syncId!==void 0&&UP.emit(VP,I.props.syncId,R,I.eventEmitterSymbol)}),Yt(I,"applySyncEvent",function(R){var $=I.props,V=$.layout,K=$.syncMethod,Z=I.state.updateId,ee=R.dataStartIndex,ne=R.dataEndIndex;if(R.dataStartIndex!==void 0||R.dataEndIndex!==void 0)I.setState(Ke({dataStartIndex:ee,dataEndIndex:ne},b({props:I.props,dataStartIndex:ee,dataEndIndex:ne,updateId:Z},I.state)));else if(R.activeTooltipIndex!==void 0){var oe=R.chartX,he=R.chartY,Se=R.activeTooltipIndex,fe=I.state,Oe=fe.offset,re=fe.tooltipTicks;if(!Oe)return;if(typeof K=="function")Se=K(re,R);else if(K==="value"){Se=-1;for(var Ce=0;Ce=0){var st,Te;if(oe.dataKey&&!oe.allowDuplicatedCategory){var Dt=typeof oe.dataKey=="function"?Fe:"payload.".concat(oe.dataKey.toString());st=Jj(Ce,Dt,Se),Te=ae&&ie&&Jj(ie,Dt,Se)}else st=Ce==null?void 0:Ce[he],Te=ae&&ie&&ie[he];if(We||$e){var Lt=R.props.activeIndex!==void 0?R.props.activeIndex:he;return[M.cloneElement(R,Ke(Ke(Ke({},K.props),rt),{},{activeIndex:Lt})),null,null]}if(!_n(st))return[ze].concat(Vh(I.renderActivePoints({item:K,activePoint:st,basePoint:Te,childIndex:he,isRange:ae})))}else{var dn,xn=(dn=I.getItemByXY(I.state.activeCoordinate))!==null&&dn!==void 0?dn:{graphicalItem:ze},qn=xn.graphicalItem,Ar=qn.item,Zr=Ar===void 0?R:Ar,$r=qn.childIndex,Bn=Ke(Ke(Ke({},K.props),rt),{},{activeIndex:$r});return[M.cloneElement(Zr,Bn),null,null]}return ae?[ze,null,null]:[ze,null]}),Yt(I,"renderCustomized",function(R,$,V){return M.cloneElement(R,Ke(Ke({key:"recharts-customized-".concat(V)},I.props),I.state))}),Yt(I,"renderMap",{CartesianGrid:{handler:Jv,once:!0},ReferenceArea:{handler:I.renderReferenceElement},ReferenceLine:{handler:Jv},ReferenceDot:{handler:I.renderReferenceElement},XAxis:{handler:Jv},YAxis:{handler:Jv},Brush:{handler:I.renderBrush,once:!0},Bar:{handler:I.renderGraphicChild},Line:{handler:I.renderGraphicChild},Area:{handler:I.renderGraphicChild},Radar:{handler:I.renderGraphicChild},RadialBar:{handler:I.renderGraphicChild},Scatter:{handler:I.renderGraphicChild},Pie:{handler:I.renderGraphicChild},Funnel:{handler:I.renderGraphicChild},Tooltip:{handler:I.renderCursor,once:!0},PolarGrid:{handler:I.renderPolarGrid,once:!0},PolarAngleAxis:{handler:I.renderPolarAxis},PolarRadiusAxis:{handler:I.renderPolarAxis},Customized:{handler:I.renderCustomized}}),I.clipPathId="".concat((k=E.id)!==null&&k!==void 0?k:kg("recharts"),"-clip"),I.throttleTriggeredAfterMouseMove=Nq(I.triggeredAfterMouseMove,(D=E.throttleDelay)!==null&&D!==void 0?D:1e3/60),I.state={},I}return wme(T,w),vme(T,[{key:"componentDidMount",value:function(){var k,D;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(k=this.props.margin.left)!==null&&k!==void 0?k:0,top:(D=this.props.margin.top)!==null&&D!==void 0?D:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var k=this.props,D=k.children,I=k.data,R=k.height,$=k.layout,V=$o(D,wo);if(V){var K=V.props.defaultIndex;if(!(typeof K!="number"||K<0||K>this.state.tooltipTicks.length-1)){var Z=this.state.tooltipTicks[K]&&this.state.tooltipTicks[K].value,ee=yT(this.state,I,K,Z),ne=this.state.tooltipTicks[K].coordinate,oe=(this.state.offset.top+R)/2,he=$==="horizontal",Se=he?{x:ne,y:oe}:{y:ne,x:oe},fe=this.state.formattedGraphicalItems.find(function(re){var Ce=re.item;return Ce.type.name==="Scatter"});fe&&(Se=Ke(Ke({},Se),fe.props.points[K].tooltipPosition),ee=fe.props.points[K].tooltipPayload);var Oe={activeTooltipIndex:K,isTooltipActive:!0,activeLabel:Z,activePayload:ee,activeCoordinate:Se};this.setState(Oe),this.renderCursor(V),this.accessibilityManager.setIndex(K)}}}},{key:"getSnapshotBeforeUpdate",value:function(k,D){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==D.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==k.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==k.margin){var I,R;this.accessibilityManager.setDetails({offset:{left:(I=this.props.margin.left)!==null&&I!==void 0?I:0,top:(R=this.props.margin.top)!==null&&R!==void 0?R:0}})}return null}},{key:"componentDidUpdate",value:function(k){tO([$o(k.children,wo)],[$o(this.props.children,wo)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var k=$o(this.props.children,wo);if(k&&typeof k.props.shared=="boolean"){var D=k.props.shared?"axis":"item";return s.indexOf(D)>=0?D:a}return a}},{key:"getMouseInfo",value:function(k){if(!this.container)return null;var D=this.container,I=D.getBoundingClientRect(),R=nre(I),$={chartX:Math.round(k.pageX-R.left),chartY:Math.round(k.pageY-R.top)},V=I.width/D.offsetWidth||1,K=this.inRange($.chartX,$.chartY,V);if(!K)return null;var Z=this.state,ee=Z.xAxisMap,ne=Z.yAxisMap,oe=this.getTooltipEventType(),he=j4(this.state,this.props.data,this.props.layout,K);if(oe!=="axis"&&ee&&ne){var Se=mc(ee).scale,fe=mc(ne).scale,Oe=Se&&Se.invert?Se.invert($.chartX):null,re=fe&&fe.invert?fe.invert($.chartY):null;return Ke(Ke({},$),{},{xValue:Oe,yValue:re},he)}return he?Ke(Ke({},$),he):null}},{key:"inRange",value:function(k,D){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,R=this.props.layout,$=k/I,V=D/I;if(R==="horizontal"||R==="vertical"){var K=this.state.offset,Z=$>=K.left&&$<=K.left+K.width&&V>=K.top&&V<=K.top+K.height;return Z?{x:$,y:V}:null}var ee=this.state,ne=ee.angleAxisMap,oe=ee.radiusAxisMap;if(ne&&oe){var he=mc(ne);return MD({x:$,y:V},he)}return null}},{key:"parseEventsOfWrapper",value:function(){var k=this.props.children,D=this.getTooltipEventType(),I=$o(k,wo),R={};I&&D==="axis"&&(I.props.trigger==="click"?R={onClick:this.handleClick}:R={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var $=Iy(this.props,this.handleOuterEvent);return Ke(Ke({},$),R)}},{key:"addListener",value:function(){UP.on(VP,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){UP.removeListener(VP,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(k,D,I){for(var R=this.state.formattedGraphicalItems,$=0,V=R.length;$h.jsx(Sh,{fill:E4[r%E4.length]},`cell-${r}`))}),h.jsx(wo,{contentStyle:{backgroundColor:"white",border:"none",borderRadius:"12px",boxShadow:"0 4px 20px rgba(0,0,0,0.1)"}}),h.jsx(Cc,{verticalAlign:"bottom",height:36,formatter:n=>h.jsx("span",{className:"text-sm text-slate-600",children:n})})]})})})})]})}const X6=M.createContext({});function $me(e){const t=M.useRef(null);return t.current===null&&(t.current=e()),t.current}const AA=M.createContext(null),Q6=M.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function Fme(e=!0){const t=M.useContext(AA);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,a=M.useId();M.useEffect(()=>{e&&i(a)},[e]);const o=M.useCallback(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}const kA=typeof window<"u",qme=kA?M.useLayoutEffect:M.useEffect,Vo=e=>e;let J6=Vo;function CA(e){let t;return()=>(t===void 0&&(t=e()),t)}const Wh=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},ju=e=>e*1e3,Ou=e=>e/1e3,zme={useManualTiming:!1};function Ume(e){let t=new Set,n=new Set,r=!1,i=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function s(d){a.has(d)&&(c.schedule(d),e()),d(o)}const c={schedule:(d,p=!1,m=!1)=>{const b=m&&r?t:n;return p&&a.add(d),b.has(d)||b.add(d),d},cancel:d=>{n.delete(d),a.delete(d)},process:d=>{if(o=d,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(d))}};return c}const ey=["read","resolveKeyframes","update","preRender","render","postRender"],Vme=40;function eU(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=ey.reduce((T,E)=>(T[E]=Ume(a),T),{}),{read:s,resolveKeyframes:c,update:d,preRender:p,render:m,postRender:y}=o,b=()=>{const T=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(T-i.timestamp,Vme),1),i.timestamp=T,i.isProcessing=!0,s.process(i),c.process(i),d.process(i),p.process(i),m.process(i),y.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(b))},P=()=>{n=!0,r=!0,i.isProcessing||e(b)};return{schedule:ey.reduce((T,E)=>{const k=o[E];return T[E]=(D,I=!1,R=!1)=>(n||P(),k.schedule(D,I,R)),T},{}),cancel:T=>{for(let E=0;EA4[e].some(n=>!!t[n])};function Wme(e){for(const t in e)Kh[t]={...Kh[t],...e[t]}}const Kme=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function R0(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Kme.has(e)}let nU=e=>!R0(e);function Hme(e){e&&(nU=t=>t.startsWith("on")?!R0(t):e(t))}try{Hme(require("@emotion/is-prop-valid").default)}catch{}function Gme(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(nU(i)||n===!0&&R0(i)||!t&&!R0(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function Zme(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const Zb=M.createContext({});function lg(e){return typeof e=="string"||Array.isArray(e)}function Yb(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const NA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],MA=["initial",...NA];function Xb(e){return Yb(e.animate)||MA.some(t=>lg(e[t]))}function rU(e){return!!(Xb(e)||e.variants)}function Yme(e,t){if(Xb(e)){const{initial:n,animate:r}=e;return{initial:n===!1||lg(n)?n:void 0,animate:lg(r)?r:void 0}}return e.inherit!==!1?t:{}}function Xme(e){const{initial:t,animate:n}=Yme(e,M.useContext(Zb));return M.useMemo(()=>({initial:t,animate:n}),[k4(t),k4(n)])}function k4(e){return Array.isArray(e)?e.join(" "):e}const Qme=Symbol.for("motionComponentSymbol");function Wd(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Jme(e,t,n){return M.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Wd(n)&&(n.current=r))},[t])}const RA=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ege="framerAppearId",iU="data-"+RA(ege),{schedule:LA}=eU(queueMicrotask,!1),aU=M.createContext({});function tge(e,t,n,r,i){var a,o;const{visualElement:s}=M.useContext(Zb),c=M.useContext(tU),d=M.useContext(AA),p=M.useContext(Q6).reducedMotion,m=M.useRef(null);r=r||c.renderer,!m.current&&r&&(m.current=r(e,{visualState:t,parent:s,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:p}));const y=m.current,b=M.useContext(aU);y&&!y.projection&&i&&(y.type==="html"||y.type==="svg")&&nge(m.current,n,i,b);const P=M.useRef(!1);M.useInsertionEffect(()=>{y&&P.current&&y.update(n,d)});const x=n[iU],w=M.useRef(!!x&&!(!((a=window.MotionHandoffIsComplete)===null||a===void 0)&&a.call(window,x))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,x)));return qme(()=>{y&&(P.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),LA.render(y.render),w.current&&y.animationState&&y.animationState.animateChanges())}),M.useEffect(()=>{y&&(!w.current&&y.animationState&&y.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,x)}),w.current=!1))}),y}function nge(e,t,n,r){const{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:d}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:oU(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&Wd(s),visualElement:e,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:d})}function oU(e){if(e)return e.options.allowProjection!==!1?e.projection:oU(e.parent)}function rge({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){var a,o;e&&Wme(e);function s(d,p){let m;const y={...M.useContext(Q6),...d,layoutId:ige(d)},{isStatic:b}=y,P=Xme(d),x=r(d,b);if(!b&&kA){age();const w=oge(y);m=w.MeasureLayout,P.visualElement=tge(i,x,y,t,w.ProjectionNode)}return h.jsxs(Zb.Provider,{value:P,children:[m&&P.visualElement?h.jsx(m,{visualElement:P.visualElement,...y}):null,n(i,d,Jme(x,P.visualElement,p),x,b,P.visualElement)]})}s.displayName=`motion.${typeof i=="string"?i:`create(${(o=(a=i.displayName)!==null&&a!==void 0?a:i.name)!==null&&o!==void 0?o:""})`}`;const c=M.forwardRef(s);return c[Qme]=i,c}function ige({layoutId:e}){const t=M.useContext(X6).id;return t&&e!==void 0?t+"-"+e:e}function age(e,t){M.useContext(tU).strict}function oge(e){const{drag:t,layout:n}=Kh;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const sge=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function IA(e){return typeof e!="string"||e.includes("-")?!1:!!(sge.indexOf(e)>-1||/[A-Z]/u.test(e))}function C4(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function DA(e,t,n,r){if(typeof t=="function"){const[i,a]=C4(r);t=t(n!==void 0?n:e.custom,i,a)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,a]=C4(r);t=t(n!==void 0?n:e.custom,i,a)}return t}const xT=e=>Array.isArray(e),lge=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),uge=e=>xT(e)?e[e.length-1]||0:e,ka=e=>!!(e&&e.getVelocity);function _y(e){const t=ka(e)?e.get():e;return lge(t)?t.toValue():t}function cge({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,a){const o={latestValues:fge(r,i,a,e),renderState:t()};return n&&(o.onMount=s=>n({props:r,current:s,...o}),o.onUpdate=s=>n(s)),o}const sU=e=>(t,n)=>{const r=M.useContext(Zb),i=M.useContext(AA),a=()=>cge(e,t,r,i);return n?a():$me(a)};function fge(e,t,n,r){const i={},a=r(e,{});for(const y in a)i[y]=_y(a[y]);let{initial:o,animate:s}=e;const c=Xb(e),d=rU(e);t&&d&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let p=n?n.initial===!1:!1;p=p||o===!1;const m=p?s:o;if(m&&typeof m!="boolean"&&!Yb(m)){const y=Array.isArray(m)?m:[m];for(let b=0;bt=>typeof t=="string"&&t.startsWith(e),uU=lU("--"),dge=lU("var(--"),BA=e=>dge(e)?hge.test(e.split("/*")[0].trim()):!1,hge=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,cU=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Mu=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},ug={...fp,transform:e=>Mu(0,1,e)},ty={...fp,default:1},Ig=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),fc=Ig("deg"),Bl=Ig("%"),Xt=Ig("px"),pge=Ig("vh"),mge=Ig("vw"),N4={...Bl,parse:e=>Bl.parse(e)/100,transform:e=>Bl.transform(e*100)},gge={borderWidth:Xt,borderTopWidth:Xt,borderRightWidth:Xt,borderBottomWidth:Xt,borderLeftWidth:Xt,borderRadius:Xt,radius:Xt,borderTopLeftRadius:Xt,borderTopRightRadius:Xt,borderBottomRightRadius:Xt,borderBottomLeftRadius:Xt,width:Xt,maxWidth:Xt,height:Xt,maxHeight:Xt,top:Xt,right:Xt,bottom:Xt,left:Xt,padding:Xt,paddingTop:Xt,paddingRight:Xt,paddingBottom:Xt,paddingLeft:Xt,margin:Xt,marginTop:Xt,marginRight:Xt,marginBottom:Xt,marginLeft:Xt,backgroundPositionX:Xt,backgroundPositionY:Xt},vge={rotate:fc,rotateX:fc,rotateY:fc,rotateZ:fc,scale:ty,scaleX:ty,scaleY:ty,scaleZ:ty,skew:fc,skewX:fc,skewY:fc,distance:Xt,translateX:Xt,translateY:Xt,translateZ:Xt,x:Xt,y:Xt,z:Xt,perspective:Xt,transformPerspective:Xt,opacity:ug,originX:N4,originY:N4,originZ:Xt},M4={...fp,transform:Math.round},$A={...gge,...vge,zIndex:M4,size:Xt,fillOpacity:ug,strokeOpacity:ug,numOctaves:M4},yge={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},bge=cp.length;function xge(e,t,n){let r="",i=!0;for(let a=0;a({style:{},transform:{},transformOrigin:{},vars:{}}),fU=()=>({...zA(),attrs:{}}),UA=e=>typeof e=="string"&&e.toLowerCase()==="svg";function dU(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const a in n)e.style.setProperty(a,n[a])}const hU=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function pU(e,t,n,r){dU(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(hU.has(i)?i:RA(i),t.attrs[i])}const L0={};function jge(e){Object.assign(L0,e)}function mU(e,{layout:t,layoutId:n}){return md.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!L0[e]||e==="opacity")}function VA(e,t,n){var r;const{style:i}=e,a={};for(const o in i)(ka(i[o])||t.style&&ka(t.style[o])||mU(o,e)||((r=n==null?void 0:n.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(a[o]=i[o]);return a}function gU(e,t,n){const r=VA(e,t,n);for(const i in e)if(ka(e[i])||ka(t[i])){const a=cp.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[a]=e[i]}return r}function Oge(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const L4=["x","y","width","height","cx","cy","r"],Tge={useVisualState:sU({scrapeMotionValuesFromProps:gU,createRenderState:fU,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let a=!!e.drag;if(!a){for(const s in i)if(md.has(s)){a=!0;break}}if(!a)return;let o=!t;if(t)for(let s=0;s{Oge(n,r),wr.render(()=>{qA(r,i,UA(n.tagName),e.transformTemplate),pU(n,r)})})}})},Ege={useVisualState:sU({scrapeMotionValuesFromProps:VA,createRenderState:zA})};function vU(e,t,n){for(const r in t)!ka(t[r])&&!mU(r,n)&&(e[r]=t[r])}function Age({transformTemplate:e},t){return M.useMemo(()=>{const n=zA();return FA(n,t,e),Object.assign({},n.vars,n.style)},[t])}function kge(e,t){const n=e.style||{},r={};return vU(r,n,e),Object.assign(r,Age(e,t)),r}function Cge(e,t){const n={},r=kge(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function Nge(e,t,n,r){const i=M.useMemo(()=>{const a=fU();return qA(a,t,UA(r),e.transformTemplate),{...a.attrs,style:{...a.style}}},[t]);if(e.style){const a={};vU(a,e.style,e),i.style={...a,...i.style}}return i}function Mge(e=!1){return(n,r,i,{latestValues:a},o)=>{const c=(IA(n)?Nge:Cge)(r,a,o,n),d=Gme(r,typeof n=="string",e),p=n!==M.Fragment?{...d,...c,ref:i}:{},{children:m}=r,y=M.useMemo(()=>ka(m)?m.get():m,[m]);return M.createElement(n,{...p,children:y})}}function Rge(e,t){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const o={...IA(r)?Tge:Ege,preloadedFeatures:e,useRender:Mge(i),createVisualElement:t,Component:r};return rge(o)}}function yU(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rwindow.ScrollTimeline!==void 0);class Ige{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(Lge()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{r.forEach((i,a)=>{i&&i(),this.animations[a].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class Dge extends Ige{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}function WA(e,t){return e?e[t]||e.default||e:void 0}const wT=2e4;function bU(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=wT?1/0:t}function KA(e){return typeof e=="function"}function I4(e,t){e.timeline=t,e.onfinish=null}const HA=e=>Array.isArray(e)&&typeof e[0]=="number",Bge={linearEasing:void 0};function $ge(e,t){const n=CA(e);return()=>{var r;return(r=Bge[t])!==null&&r!==void 0?r:n()}}const I0=$ge(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),xU=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let a=0;a`cubic-bezier(${e}, ${t}, ${n}, ${r})`,_T={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:am([0,.65,.55,1]),circOut:am([.55,0,1,.45]),backIn:am([.31,.01,.66,-.59]),backOut:am([.33,1.53,.69,.99])};function _U(e,t){if(e)return typeof e=="function"&&I0()?xU(e,t):HA(e)?am(e):Array.isArray(e)?e.map(n=>_U(n,t)||_T.easeOut):_T[e]}const Qs={x:!1,y:!1};function SU(){return Qs.x||Qs.y}function Fge(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const a=(r=void 0)!==null&&r!==void 0?r:i.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}function PU(e,t){const n=Fge(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function D4(e){return t=>{t.pointerType==="touch"||SU()||e(t)}}function qge(e,t,n={}){const[r,i,a]=PU(e,n),o=D4(s=>{const{target:c}=s,d=t(s);if(typeof d!="function"||!c)return;const p=D4(m=>{d(m),c.removeEventListener("pointerleave",p)});c.addEventListener("pointerleave",p,i)});return r.forEach(s=>{s.addEventListener("pointerenter",o,i)}),a}const jU=(e,t)=>t?e===t?!0:jU(e,t.parentElement):!1,GA=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,zge=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Uge(e){return zge.has(e.tagName)||e.tabIndex!==-1}const om=new WeakSet;function B4(e){return t=>{t.key==="Enter"&&e(t)}}function HP(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Vge=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=B4(()=>{if(om.has(n))return;HP(n,"down");const i=B4(()=>{HP(n,"up")}),a=()=>HP(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",a,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function $4(e){return GA(e)&&!SU()}function Wge(e,t,n={}){const[r,i,a]=PU(e,n),o=s=>{const c=s.currentTarget;if(!$4(s)||om.has(c))return;om.add(c);const d=t(s),p=(b,P)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",y),!(!$4(b)||!om.has(c))&&(om.delete(c),typeof d=="function"&&d(b,{success:P}))},m=b=>{p(b,n.useGlobalTarget||jU(c,b.target))},y=b=>{p(b,!1)};window.addEventListener("pointerup",m,i),window.addEventListener("pointercancel",y,i)};return r.forEach(s=>{!Uge(s)&&s.getAttribute("tabindex")===null&&(s.tabIndex=0),(n.useGlobalTarget?window:s).addEventListener("pointerdown",o,i),s.addEventListener("focus",d=>Vge(d,i),i)}),a}function Kge(e){return e==="x"||e==="y"?Qs[e]?null:(Qs[e]=!0,()=>{Qs[e]=!1}):Qs.x||Qs.y?null:(Qs.x=Qs.y=!0,()=>{Qs.x=Qs.y=!1})}const OU=new Set(["width","height","top","left","right","bottom",...cp]);let Sy;function Hge(){Sy=void 0}const $l={now:()=>(Sy===void 0&&$l.set(oa.isProcessing||zme.useManualTiming?oa.timestamp:performance.now()),Sy),set:e=>{Sy=e,queueMicrotask(Hge)}};function ZA(e,t){e.indexOf(t)===-1&&e.push(t)}function YA(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class XA{constructor(){this.subscriptions=[]}add(t){return ZA(this.subscriptions,t),()=>YA(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let a=0;a!isNaN(parseFloat(e));class Zge{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const a=$l.now();this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=$l.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Gge(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new XA);const r=this.events[t].add(n);return t==="change"?()=>{r(),wr.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=$l.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>F4)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,F4);return TU(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function cg(e,t){return new Zge(e,t)}function Yge(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,cg(n))}function Xge(e,t){const n=Qb(e,t);let{transitionEnd:r={},transition:i={},...a}=n||{};a={...a,...r};for(const o in a){const s=uge(a[o]);Yge(e,o,s)}}function Qge(e){return!!(ka(e)&&e.add)}function ST(e,t){const n=e.getValue("willChange");if(Qge(n))return n.add(t)}function EU(e){return e.props[iU]}const AU=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Jge=1e-7,eve=12;function tve(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=AU(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Jge&&++stve(a,0,1,e,n);return a=>a===0||a===1?a:AU(i(a),t,r)}const kU=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,CU=e=>t=>1-e(1-t),NU=Dg(.33,1.53,.69,.99),QA=CU(NU),MU=kU(QA),RU=e=>(e*=2)<1?.5*QA(e):.5*(2-Math.pow(2,-10*(e-1))),JA=e=>1-Math.sin(Math.acos(e)),LU=CU(JA),IU=kU(JA),DU=e=>/^0[^.\s]+$/u.test(e);function nve(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||DU(e):!0}const xm=e=>Math.round(e*1e5)/1e5,ek=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function rve(e){return e==null}const ive=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,tk=(e,t)=>n=>!!(typeof n=="string"&&ive.test(n)&&n.startsWith(e)||t&&!rve(n)&&Object.prototype.hasOwnProperty.call(n,t)),BU=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,a,o,s]=r.match(ek);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s!==void 0?parseFloat(s):1}},ave=e=>Mu(0,255,e),GP={...fp,transform:e=>Math.round(ave(e))},Nf={test:tk("rgb","red"),parse:BU("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+GP.transform(e)+", "+GP.transform(t)+", "+GP.transform(n)+", "+xm(ug.transform(r))+")"};function ove(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const PT={test:tk("#"),parse:ove,transform:Nf.transform},Kd={test:tk("hsl","hue"),parse:BU("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Bl.transform(xm(t))+", "+Bl.transform(xm(n))+", "+xm(ug.transform(r))+")"},Oa={test:e=>Nf.test(e)||PT.test(e)||Kd.test(e),parse:e=>Nf.test(e)?Nf.parse(e):Kd.test(e)?Kd.parse(e):PT.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Nf.transform(e):Kd.transform(e)},sve=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function lve(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(ek))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(sve))===null||n===void 0?void 0:n.length)||0)>0}const $U="number",FU="color",uve="var",cve="var(",q4="${}",fve=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function fg(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let a=0;const s=t.replace(fve,c=>(Oa.test(c)?(r.color.push(a),i.push(FU),n.push(Oa.parse(c))):c.startsWith(cve)?(r.var.push(a),i.push(uve),n.push(c)):(r.number.push(a),i.push($U),n.push(parseFloat(c))),++a,q4)).split(q4);return{values:n,split:s,indexes:r,types:i}}function qU(e){return fg(e).values}function zU(e){const{split:t,types:n}=fg(e),r=t.length;return i=>{let a="";for(let o=0;otypeof e=="number"?0:e;function hve(e){const t=qU(e);return zU(e)(t.map(dve))}const $c={test:lve,parse:qU,createTransformer:zU,getAnimatableNone:hve},pve=new Set(["brightness","contrast","saturate","opacity"]);function mve(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(ek)||[];if(!r)return e;const i=n.replace(r,"");let a=pve.has(t)?1:0;return r!==n&&(a*=100),t+"("+a+i+")"}const gve=/\b([a-z-]*)\(.*?\)/gu,jT={...$c,getAnimatableNone:e=>{const t=e.match(gve);return t?t.map(mve).join(" "):e}},vve={...$A,color:Oa,backgroundColor:Oa,outlineColor:Oa,fill:Oa,stroke:Oa,borderColor:Oa,borderTopColor:Oa,borderRightColor:Oa,borderBottomColor:Oa,borderLeftColor:Oa,filter:jT,WebkitFilter:jT},nk=e=>vve[e];function UU(e,t){let n=nk(e);return n!==jT&&(n=$c),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const yve=new Set(["auto","none","0"]);function bve(e,t,n){let r=0,i;for(;re===fp||e===Xt,U4=(e,t)=>parseFloat(e.split(", ")[t]),V4=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return U4(i[1],t);{const a=r.match(/^matrix\((.+)\)$/u);return a?U4(a[1],e):0}},xve=new Set(["x","y","z"]),wve=cp.filter(e=>!xve.has(e));function _ve(e){const t=[];return wve.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Hh={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:V4(4,13),y:V4(5,14)};Hh.translateX=Hh.x;Hh.translateY=Hh.y;const Kf=new Set;let OT=!1,TT=!1;function VU(){if(TT){const e=Array.from(Kf).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=_ve(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([a,o])=>{var s;(s=r.getValue(a))===null||s===void 0||s.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}TT=!1,OT=!1,Kf.forEach(e=>e.complete()),Kf.clear()}function WU(){Kf.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(TT=!0)})}function Sve(){WU(),VU()}class rk{constructor(t,n,r,i,a,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=a,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Kf.add(this),OT||(OT=!0,wr.read(WU),wr.resolveKeyframes(VU))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;for(let a=0;a/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Pve=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function jve(e){const t=Pve.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function HU(e,t,n=1){const[r,i]=jve(e);if(!r)return;const a=window.getComputedStyle(t).getPropertyValue(r);if(a){const o=a.trim();return KU(o)?parseFloat(o):o}return BA(i)?HU(i,t,n+1):i}const GU=e=>t=>t.test(e),Ove={test:e=>e==="auto",parse:e=>e},ZU=[fp,Xt,Bl,fc,mge,pge,Ove],W4=e=>ZU.find(GU(e));class YU extends rk{constructor(t,n,r,i,a){super(t,n,r,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(d)}),this.resolveNoneKeyframes()}}const K4=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&($c.test(e)||e==="0")&&!e.startsWith("url("));function Tve(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Jb(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(Ave),a=t&&n!=="loop"&&t%2===1?0:i.length-1;return!a||r===void 0?i[a]:r}const kve=40;class XU{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:o="loop",...s}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=$l.now(),this.options={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:a,repeatType:o,...s},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>kve?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Sve(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=$l.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:a,delay:o,onComplete:s,onUpdate:c,isGenerator:d}=this.options;if(!d&&!Eve(t,r,i,a))if(o)this.options.duration=0;else{c&&c(Jb(t,this.options,n)),s&&s(),this.resolveFinishedPromise();return}const p=this.initPlayback(t,n);p!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...p},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Ir=(e,t,n)=>e+(t-e)*n;function ZP(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Cve({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{const s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;i=ZP(c,s,e+1/3),a=ZP(c,s,e),o=ZP(c,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function D0(e,t){return n=>n>0?t:e}const YP=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Nve=[PT,Nf,Kd],Mve=e=>Nve.find(t=>t.test(e));function H4(e){const t=Mve(e);if(!t)return!1;let n=t.parse(e);return t===Kd&&(n=Cve(n)),n}const G4=(e,t)=>{const n=H4(e),r=H4(t);if(!n||!r)return D0(e,t);const i={...n};return a=>(i.red=YP(n.red,r.red,a),i.green=YP(n.green,r.green,a),i.blue=YP(n.blue,r.blue,a),i.alpha=Ir(n.alpha,r.alpha,a),Nf.transform(i))},Rve=(e,t)=>n=>t(e(n)),Bg=(...e)=>e.reduce(Rve),ET=new Set(["none","hidden"]);function Lve(e,t){return ET.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Ive(e,t){return n=>Ir(e,t,n)}function ik(e){return typeof e=="number"?Ive:typeof e=="string"?BA(e)?D0:Oa.test(e)?G4:$ve:Array.isArray(e)?QU:typeof e=="object"?Oa.test(e)?G4:Dve:D0}function QU(e,t){const n=[...e],r=n.length,i=e.map((a,o)=>ik(a)(a,t[o]));return a=>{for(let o=0;o{for(const a in r)n[a]=r[a](i);return n}}function Bve(e,t){var n;const r=[],i={color:0,var:0,number:0};for(let a=0;a{const n=$c.createTransformer(t),r=fg(e),i=fg(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?ET.has(e)&&!i.values.length||ET.has(t)&&!r.values.length?Lve(e,t):Bg(QU(Bve(r,i),i.values),n):D0(e,t)};function JU(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Ir(e,t,n):ik(e)(e,t)}const Fve=5;function eV(e,t,n){const r=Math.max(t-Fve,0);return TU(n-e(r),t-r)}const Wr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},XP=.001;function qve({duration:e=Wr.duration,bounce:t=Wr.bounce,velocity:n=Wr.velocity,mass:r=Wr.mass}){let i,a,o=1-t;o=Mu(Wr.minDamping,Wr.maxDamping,o),e=Mu(Wr.minDuration,Wr.maxDuration,Ou(e)),o<1?(i=d=>{const p=d*o,m=p*e,y=p-n,b=AT(d,o),P=Math.exp(-m);return XP-y/b*P},a=d=>{const m=d*o*e,y=m*n+n,b=Math.pow(o,2)*Math.pow(d,2)*e,P=Math.exp(-m),x=AT(Math.pow(d,2),o);return(-i(d)+XP>0?-1:1)*((y-b)*P)/x}):(i=d=>{const p=Math.exp(-d*e),m=(d-n)*e+1;return-XP+p*m},a=d=>{const p=Math.exp(-d*e),m=(n-d)*(e*e);return p*m});const s=5/e,c=Uve(i,a,s);if(e=ju(e),isNaN(c))return{stiffness:Wr.stiffness,damping:Wr.damping,duration:e};{const d=Math.pow(c,2)*r;return{stiffness:d,damping:o*2*Math.sqrt(r*d),duration:e}}}const zve=12;function Uve(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function Kve(e){let t={velocity:Wr.velocity,stiffness:Wr.stiffness,damping:Wr.damping,mass:Wr.mass,isResolvedFromDuration:!1,...e};if(!Z4(e,Wve)&&Z4(e,Vve))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Mu(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Wr.mass,stiffness:i,damping:a}}else{const n=qve(e);t={...t,...n,mass:Wr.mass},t.isResolvedFromDuration=!0}return t}function tV(e=Wr.visualDuration,t=Wr.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:d,mass:p,duration:m,velocity:y,isResolvedFromDuration:b}=Kve({...n,velocity:-Ou(n.velocity||0)}),P=y||0,x=d/(2*Math.sqrt(c*p)),w=o-a,T=Ou(Math.sqrt(c/p)),E=Math.abs(w)<5;r||(r=E?Wr.restSpeed.granular:Wr.restSpeed.default),i||(i=E?Wr.restDelta.granular:Wr.restDelta.default);let k;if(x<1){const I=AT(T,x);k=R=>{const $=Math.exp(-x*T*R);return o-$*((P+x*T*w)/I*Math.sin(I*R)+w*Math.cos(I*R))}}else if(x===1)k=I=>o-Math.exp(-T*I)*(w+(P+T*w)*I);else{const I=T*Math.sqrt(x*x-1);k=R=>{const $=Math.exp(-x*T*R),V=Math.min(I*R,300);return o-$*((P+x*T*w)*Math.sinh(V)+I*w*Math.cosh(V))/I}}const D={calculatedDuration:b&&m||null,next:I=>{const R=k(I);if(b)s.done=I>=m;else{let $=0;x<1&&($=I===0?ju(P):eV(k,I,R));const V=Math.abs($)<=r,K=Math.abs(o-R)<=i;s.done=V&&K}return s.value=s.done?o:R,s},toString:()=>{const I=Math.min(bU(D),wT),R=xU($=>D.next(I*$).value,I,30);return I+"ms "+R}};return D}function Y4({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:d=.5,restSpeed:p}){const m=e[0],y={done:!1,value:m},b=V=>s!==void 0&&Vc,P=V=>s===void 0?c:c===void 0||Math.abs(s-V)-x*Math.exp(-V/r),k=V=>T+E(V),D=V=>{const K=E(V),Z=k(V);y.done=Math.abs(K)<=d,y.value=y.done?T:Z};let I,R;const $=V=>{b(y.value)&&(I=V,R=tV({keyframes:[y.value,P(y.value)],velocity:eV(k,V,y.value),damping:i,stiffness:a,restDelta:d,restSpeed:p}))};return $(0),{calculatedDuration:null,next:V=>{let K=!1;return!R&&I===void 0&&(K=!0,D(V),$(V)),I!==void 0&&V>=I?R.next(V-I):(!K&&D(V),y)}}}const Hve=Dg(.42,0,1,1),Gve=Dg(0,0,.58,1),nV=Dg(.42,0,.58,1),Zve=e=>Array.isArray(e)&&typeof e[0]!="number",Yve={linear:Vo,easeIn:Hve,easeInOut:nV,easeOut:Gve,circIn:JA,circInOut:IU,circOut:LU,backIn:QA,backInOut:MU,backOut:NU,anticipate:RU},X4=e=>{if(HA(e)){J6(e.length===4);const[t,n,r,i]=e;return Dg(t,n,r,i)}else if(typeof e=="string")return Yve[e];return e};function Xve(e,t,n){const r=[],i=n||JU,a=e.length-1;for(let o=0;ot[0];if(a===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());const s=Xve(t,r,i),c=s.length,d=p=>{if(o&&p1)for(;md(Mu(e[0],e[a-1],p)):d}function Jve(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Wh(0,t,r);e.push(Ir(n,1,i))}}function eye(e){const t=[0];return Jve(t,e.length-1),t}function tye(e,t){return e.map(n=>n*t)}function nye(e,t){return e.map(()=>t||nV).splice(0,e.length-1)}function B0({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=Zve(r)?r.map(X4):X4(r),a={done:!1,value:t[0]},o=tye(n&&n.length===t.length?n:eye(t),e),s=Qve(o,t,{ease:Array.isArray(i)?i:nye(t,i)});return{calculatedDuration:e,next:c=>(a.value=s(c),a.done=c>=e,a)}}const rye=e=>{const t=({timestamp:n})=>e(n);return{start:()=>wr.update(t,!0),stop:()=>Bc(t),now:()=>oa.isProcessing?oa.timestamp:$l.now()}},iye={decay:Y4,inertia:Y4,tween:B0,keyframes:B0,spring:tV},aye=e=>e/100;class ak extends XU{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:i,keyframes:a}=this.options,o=(i==null?void 0:i.KeyframeResolver)||rk,s=(c,d)=>this.onKeyframesResolved(c,d);this.resolver=new o(a,s,n,r,i),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:a,velocity:o=0}=this.options,s=KA(n)?n:iye[n]||B0;let c,d;s!==B0&&typeof t[0]!="number"&&(c=Bg(aye,JU(t[0],t[1])),t=[0,100]);const p=s({...this.options,keyframes:t});a==="mirror"&&(d=s({...this.options,keyframes:[...t].reverse(),velocity:-o})),p.calculatedDuration===null&&(p.calculatedDuration=bU(p));const{calculatedDuration:m}=p,y=m+i,b=y*(r+1)-i;return{generator:p,mirroredGenerator:d,mapPercentToKeyframes:c,calculatedDuration:m,resolvedDuration:y,totalDuration:b}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:V}=this.options;return{done:!0,value:V[V.length-1]}}const{finalKeyframe:i,generator:a,mirroredGenerator:o,mapPercentToKeyframes:s,keyframes:c,calculatedDuration:d,totalDuration:p,resolvedDuration:m}=r;if(this.startTime===null)return a.next(0);const{delay:y,repeat:b,repeatType:P,repeatDelay:x,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-p/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const T=this.currentTime-y*(this.speed>=0?1:-1),E=this.speed>=0?T<0:T>p;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=p);let k=this.currentTime,D=a;if(b){const V=Math.min(this.currentTime,p)/m;let K=Math.floor(V),Z=V%1;!Z&&V>=1&&(Z=1),Z===1&&K--,K=Math.min(K,b+1),!!(K%2)&&(P==="reverse"?(Z=1-Z,x&&(Z-=x/m)):P==="mirror"&&(D=o)),k=Mu(0,1,Z)*m}const I=E?{done:!1,value:c[0]}:D.next(k);s&&(I.value=s(I.value));let{done:R}=I;!E&&d!==null&&(R=this.speed>=0?this.currentTime>=p:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return $&&i!==void 0&&(I.value=Jb(c,this.options,i)),w&&w(I.value),$&&this.finish(),I}get duration(){const{resolved:t}=this;return t?Ou(t.calculatedDuration):0}get time(){return Ou(this.currentTime)}set time(t){t=ju(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Ou(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=rye,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(a=>this.tick(a))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const oye=new Set(["opacity","clipPath","filter","transform"]);function sye(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o="loop",ease:s="easeInOut",times:c}={}){const d={[t]:n};c&&(d.offset=c);const p=_U(s,i);return Array.isArray(p)&&(d.easing=p),e.animate(d,{delay:r,duration:i,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:a+1,direction:o==="reverse"?"alternate":"normal"})}const lye=CA(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),$0=10,uye=2e4;function cye(e){return KA(e.type)||e.type==="spring"||!wU(e.ease)}function fye(e,t){const n=new ak({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const i=[];let a=0;for(;!r.done&&athis.onKeyframesResolved(o,s),n,r,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:i,ease:a,type:o,motionValue:s,name:c,startTime:d}=this.options;if(!s.owner||!s.owner.current)return!1;if(typeof a=="string"&&I0()&&dye(a)&&(a=rV[a]),cye(this.options)){const{onComplete:m,onUpdate:y,motionValue:b,element:P,...x}=this.options,w=fye(t,x);t=w.keyframes,t.length===1&&(t[1]=t[0]),r=w.duration,i=w.times,a=w.ease,o="keyframes"}const p=sye(s.owner.current,c,t,{...this.options,duration:r,times:i,ease:a});return p.startTime=d??this.calcStartTime(),this.pendingTimeline?(I4(p,this.pendingTimeline),this.pendingTimeline=void 0):p.onfinish=()=>{const{onComplete:m}=this.options;s.set(Jb(t,this.options,n)),m&&m(),this.cancel(),this.resolveFinishedPromise()},{animation:p,duration:r,times:i,type:o,ease:a,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Ou(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Ou(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=ju(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return Vo;const{animation:r}=n;I4(r,t)}return Vo}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:i,type:a,ease:o,times:s}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:d,onUpdate:p,onComplete:m,element:y,...b}=this.options,P=new ak({...b,keyframes:r,duration:i,type:a,ease:o,times:s,isGenerator:!0}),x=ju(this.time);d.setWithVelocity(P.sample(x-$0).value,P.sample(x).value,$0)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:i,repeatType:a,damping:o,type:s}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=n.owner.getProps();return lye()&&r&&oye.has(r)&&!c&&!d&&!i&&a!=="mirror"&&o!==0&&s!=="inertia"}}const hye={type:"spring",stiffness:500,damping:25,restSpeed:10},pye=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),mye={type:"keyframes",duration:.8},gye={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vye=(e,{keyframes:t})=>t.length>2?mye:md.has(e)?e.startsWith("scale")?pye(t[1]):hye:gye;function yye({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:d,...p}){return!!Object.keys(p).length}const ok=(e,t,n,r={},i,a)=>o=>{const s=WA(r,e)||{},c=s.delay||r.delay||0;let{elapsed:d=0}=r;d=d-ju(c);let p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...s,delay:-d,onUpdate:y=>{t.set(y),s.onUpdate&&s.onUpdate(y)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};yye(s)||(p={...p,...vye(e,p)}),p.duration&&(p.duration=ju(p.duration)),p.repeatDelay&&(p.repeatDelay=ju(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let m=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(p.duration=0,p.delay===0&&(m=!0)),m&&!a&&t.get()!==void 0){const y=Jb(p.keyframes,s);if(y!==void 0)return wr.update(()=>{p.onUpdate(y),p.onComplete()}),new Dge([])}return!a&&Q4.supports(p)?new Q4(p):new ak(p)};function bye({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function iV(e,t,{delay:n=0,transitionOverride:r,type:i}={}){var a;let{transition:o=e.getDefaultTransition(),transitionEnd:s,...c}=t;r&&(o=r);const d=[],p=i&&e.animationState&&e.animationState.getState()[i];for(const m in c){const y=e.getValue(m,(a=e.latestValues[m])!==null&&a!==void 0?a:null),b=c[m];if(b===void 0||p&&bye(p,m))continue;const P={delay:n,...WA(o||{},m)};let x=!1;if(window.MotionHandoffAnimation){const T=EU(e);if(T){const E=window.MotionHandoffAnimation(T,m,wr);E!==null&&(P.startTime=E,x=!0)}}ST(e,m),y.start(ok(m,y,b,e.shouldReduceMotion&&OU.has(m)?{type:!1}:P,e,x));const w=y.animation;w&&d.push(w)}return s&&Promise.all(d).then(()=>{wr.update(()=>{s&&Xge(e,s)})}),d}function kT(e,t,n={}){var r;const i=Qb(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(a=n.transitionOverride);const o=i?()=>Promise.all(iV(e,i,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(d=0)=>{const{delayChildren:p=0,staggerChildren:m,staggerDirection:y}=a;return xye(e,t,p+d,m,y,n)}:()=>Promise.resolve(),{when:c}=a;if(c){const[d,p]=c==="beforeChildren"?[o,s]:[s,o];return d().then(()=>p())}else return Promise.all([o(),s(n.delay)])}function xye(e,t,n=0,r=0,i=1,a){const o=[],s=(e.variantChildren.size-1)*r,c=i===1?(d=0)=>d*r:(d=0)=>s-d*r;return Array.from(e.variantChildren).sort(wye).forEach((d,p)=>{d.notify("AnimationStart",t),o.push(kT(d,t,{...a,delay:n+c(p)}).then(()=>d.notify("AnimationComplete",t)))}),Promise.all(o)}function wye(e,t){return e.sortNodePosition(t)}function _ye(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(a=>kT(e,a,n));r=Promise.all(i)}else if(typeof t=="string")r=kT(e,t,n);else{const i=typeof t=="function"?Qb(e,t,n.custom):t;r=Promise.all(iV(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const Sye=MA.length;function aV(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?aV(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>_ye(e,n,r)))}function Tye(e){let t=Oye(e),n=J4(),r=!0;const i=c=>(d,p)=>{var m;const y=Qb(e,p,c==="exit"?(m=e.presenceContext)===null||m===void 0?void 0:m.custom:void 0);if(y){const{transition:b,transitionEnd:P,...x}=y;d={...d,...x,...P}}return d};function a(c){t=c(e)}function o(c){const{props:d}=e,p=aV(e.parent)||{},m=[],y=new Set;let b={},P=1/0;for(let w=0;wP&&D,K=!1;const Z=Array.isArray(k)?k:[k];let ee=Z.reduce(i(T),{});I===!1&&(ee={});const{prevResolvedValues:ne={}}=E,oe={...ne,...ee},he=Oe=>{V=!0,y.has(Oe)&&(K=!0,y.delete(Oe)),E.needsAnimating[Oe]=!0;const re=e.getValue(Oe);re&&(re.liveStyle=!1)};for(const Oe in oe){const re=ee[Oe],Ce=ne[Oe];if(b.hasOwnProperty(Oe))continue;let ae=!1;xT(re)&&xT(Ce)?ae=!yU(re,Ce):ae=re!==Ce,ae?re!=null?he(Oe):y.add(Oe):re!==void 0&&y.has(Oe)?he(Oe):E.protectedKeys[Oe]=!0}E.prevProp=k,E.prevResolvedValues=ee,E.isActive&&(b={...b,...ee}),r&&e.blockInitialAnimation&&(V=!1),V&&(!(R&&$)||K)&&m.push(...Z.map(Oe=>({animation:Oe,options:{type:T}})))}if(y.size){const w={};y.forEach(T=>{const E=e.getBaseTarget(T),k=e.getValue(T);k&&(k.liveStyle=!0),w[T]=E??null}),m.push({animation:w})}let x=!!m.length;return r&&(d.initial===!1||d.initial===d.animate)&&!e.manuallyAnimateOnMount&&(x=!1),r=!1,x?t(m):Promise.resolve()}function s(c,d){var p;if(n[c].isActive===d)return Promise.resolve();(p=e.variantChildren)===null||p===void 0||p.forEach(y=>{var b;return(b=y.animationState)===null||b===void 0?void 0:b.setActive(c,d)}),n[c].isActive=d;const m=o(c);for(const y in n)n[y].protectedKeys={};return m}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n,reset:()=>{n=J4(),r=!0}}}function Eye(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!yU(t,e):!1}function bf(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function J4(){return{animate:bf(!0),whileInView:bf(),whileHover:bf(),whileTap:bf(),whileDrag:bf(),whileFocus:bf(),exit:bf()}}class Yc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class Aye extends Yc{constructor(t){super(t),t.animationState||(t.animationState=Tye(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Yb(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let kye=0;class Cye extends Yc{constructor(){super(...arguments),this.id=kye++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const Nye={animation:{Feature:Aye},exit:{Feature:Cye}};function dg(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function $g(e){return{point:{x:e.pageX,y:e.pageY}}}const Mye=e=>t=>GA(t)&&e(t,$g(t));function wm(e,t,n,r){return dg(e,t,Mye(n),r)}const e3=(e,t)=>Math.abs(e-t);function Rye(e,t){const n=e3(e.x,t.x),r=e3(e.y,t.y);return Math.sqrt(n**2+r**2)}class oV{constructor(t,n,{transformPagePoint:r,contextWindow:i,dragSnapToOrigin:a=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=JP(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,b=Rye(m.offset,{x:0,y:0})>=3;if(!y&&!b)return;const{point:P}=m,{timestamp:x}=oa;this.history.push({...P,timestamp:x});const{onStart:w,onMove:T}=this.handlers;y||(w&&w(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,m)},this.handlePointerMove=(m,y)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=QP(y,this.transformPagePoint),wr.update(this.updatePoint,!0)},this.handlePointerUp=(m,y)=>{this.end();const{onEnd:b,onSessionEnd:P,resumeAnimation:x}=this.handlers;if(this.dragSnapToOrigin&&x&&x(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=JP(m.type==="pointercancel"?this.lastMoveEventInfo:QP(y,this.transformPagePoint),this.history);this.startEvent&&b&&b(m,w),P&&P(m,w)},!GA(t))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const o=$g(t),s=QP(o,this.transformPagePoint),{point:c}=s,{timestamp:d}=oa;this.history=[{...c,timestamp:d}];const{onSessionStart:p}=n;p&&p(t,JP(s,this.history)),this.removeListeners=Bg(wm(this.contextWindow,"pointermove",this.handlePointerMove),wm(this.contextWindow,"pointerup",this.handlePointerUp),wm(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Bc(this.updatePoint)}}function QP(e,t){return t?{point:t(e.point)}:e}function t3(e,t){return{x:e.x-t.x,y:e.y-t.y}}function JP({point:e},t){return{point:e,delta:t3(e,sV(t)),offset:t3(e,Lye(t)),velocity:Iye(t,.1)}}function Lye(e){return e[0]}function sV(e){return e[e.length-1]}function Iye(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=sV(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>ju(t)));)n--;if(!r)return{x:0,y:0};const a=Ou(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const lV=1e-4,Dye=1-lV,Bye=1+lV,uV=.01,$ye=0-uV,Fye=0+uV;function Ko(e){return e.max-e.min}function qye(e,t,n){return Math.abs(e-t)<=n}function n3(e,t,n,r=.5){e.origin=r,e.originPoint=Ir(t.min,t.max,e.origin),e.scale=Ko(n)/Ko(t),e.translate=Ir(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Dye&&e.scale<=Bye||isNaN(e.scale))&&(e.scale=1),(e.translate>=$ye&&e.translate<=Fye||isNaN(e.translate))&&(e.translate=0)}function _m(e,t,n,r){n3(e.x,t.x,n.x,r?r.originX:void 0),n3(e.y,t.y,n.y,r?r.originY:void 0)}function r3(e,t,n){e.min=n.min+t.min,e.max=e.min+Ko(t)}function zye(e,t,n){r3(e.x,t.x,n.x),r3(e.y,t.y,n.y)}function i3(e,t,n){e.min=t.min-n.min,e.max=e.min+Ko(t)}function Sm(e,t,n){i3(e.x,t.x,n.x),i3(e.y,t.y,n.y)}function Uye(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Ir(n,e,r.max):Math.min(e,n)),e}function a3(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Vye(e,{top:t,left:n,bottom:r,right:i}){return{x:a3(e.x,n,i),y:a3(e.y,t,r)}}function o3(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Wh(t.min,t.max-r,e.min):r>i&&(n=Wh(e.min,e.max-i,t.min)),Mu(0,1,n)}function Hye(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const CT=.35;function Gye(e=CT){return e===!1?e=0:e===!0&&(e=CT),{x:s3(e,"left","right"),y:s3(e,"top","bottom")}}function s3(e,t,n){return{min:l3(e,t),max:l3(e,n)}}function l3(e,t){return typeof e=="number"?e:e[t]||0}const u3=()=>({translate:0,scale:1,origin:0,originPoint:0}),Hd=()=>({x:u3(),y:u3()}),c3=()=>({min:0,max:0}),Jr=()=>({x:c3(),y:c3()});function vs(e){return[e("x"),e("y")]}function cV({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Zye({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Yye(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function ej(e){return e===void 0||e===1}function NT({scale:e,scaleX:t,scaleY:n}){return!ej(e)||!ej(t)||!ej(n)}function _f(e){return NT(e)||fV(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function fV(e){return f3(e.x)||f3(e.y)}function f3(e){return e&&e!=="0%"}function F0(e,t,n){const r=e-n,i=t*r;return n+i}function d3(e,t,n,r,i){return i!==void 0&&(e=F0(e,i,r)),F0(e,n,r)+t}function MT(e,t=0,n=1,r,i){e.min=d3(e.min,t,n,r,i),e.max=d3(e.max,t,n,r,i)}function dV(e,{x:t,y:n}){MT(e.x,t.translate,t.scale,t.originPoint),MT(e.y,n.translate,n.scale,n.originPoint)}const h3=.999999999999,p3=1.0000000000001;function Xye(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;sh3&&(t.x=1),t.yh3&&(t.y=1)}function Gd(e,t){e.min=e.min+t,e.max=e.max+t}function m3(e,t,n,r,i=.5){const a=Ir(e.min,e.max,i);MT(e,t,n,a,r)}function Zd(e,t){m3(e.x,t.x,t.scaleX,t.scale,t.originX),m3(e.y,t.y,t.scaleY,t.scale,t.originY)}function hV(e,t){return cV(Yye(e.getBoundingClientRect(),t))}function Qye(e,t,n){const r=hV(e,n),{scroll:i}=t;return i&&(Gd(r.x,i.offset.x),Gd(r.y,i.offset.y)),r}const pV=({current:e})=>e?e.ownerDocument.defaultView:null,Jye=new WeakMap;class e0e{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Jr(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=p=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor($g(p).point)},a=(p,m)=>{const{drag:y,dragPropagation:b,onDragStart:P}=this.getProps();if(y&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Kge(y),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),vs(w=>{let T=this.getAxisMotionValue(w).get()||0;if(Bl.test(T)){const{projection:E}=this.visualElement;if(E&&E.layout){const k=E.layout.layoutBox[w];k&&(T=Ko(k)*(parseFloat(T)/100))}}this.originPoint[w]=T}),P&&wr.postRender(()=>P(p,m)),ST(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},o=(p,m)=>{const{dragPropagation:y,dragDirectionLock:b,onDirectionLock:P,onDrag:x}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:w}=m;if(b&&this.currentDirection===null){this.currentDirection=t0e(w),this.currentDirection!==null&&P&&P(this.currentDirection);return}this.updateAxis("x",m.point,w),this.updateAxis("y",m.point,w),this.visualElement.render(),x&&x(p,m)},s=(p,m)=>this.stop(p,m),c=()=>vs(p=>{var m;return this.getAnimationState(p)==="paused"&&((m=this.getAxisMotionValue(p).animation)===null||m===void 0?void 0:m.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new oV(t,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,contextWindow:pV(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:a}=this.getProps();a&&wr.postRender(()=>a(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!ny(t,i,this.currentDirection))return;const a=this.getAxisMotionValue(t);let o=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(o=Uye(o,this.constraints[t],this.elastic[t])),a.set(o)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,a=this.constraints;n&&Wd(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=Vye(i.layoutBox,n):this.constraints=!1,this.elastic=Gye(r),a!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&vs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Hye(i.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Wd(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=Qye(r,i.root,this.visualElement.getTransformPagePoint());let o=Wye(i.layout.layoutBox,a);if(n){const s=n(Zye(o));this.hasMutatedConstraints=!!s,s&&(o=cV(s))}return o}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:o,onDragTransitionEnd:s}=this.getProps(),c=this.constraints||{},d=vs(p=>{if(!ny(p,n,this.currentDirection))return;let m=c&&c[p]||{};o&&(m={min:0,max:0});const y=i?200:1e6,b=i?40:1e7,P={type:"inertia",velocity:r?t[p]:0,bounceStiffness:y,bounceDamping:b,timeConstant:750,restDelta:1,restSpeed:10,...a,...m};return this.startAxisValueAnimation(p,P)});return Promise.all(d).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return ST(this.visualElement,t),r.start(ok(t,r,0,n,this.visualElement,!1))}stopAnimation(){vs(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){vs(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){vs(n=>{const{drag:r}=this.getProps();if(!ny(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:s}=i.layout.layoutBox[n];a.set(t[n]-Ir(o,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Wd(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};vs(o=>{const s=this.getAxisMotionValue(o);if(s&&this.constraints!==!1){const c=s.get();i[o]=Kye({min:c,max:c},this.constraints[o])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),vs(o=>{if(!ny(o,t,null))return;const s=this.getAxisMotionValue(o),{min:c,max:d}=this.constraints[o];s.set(Ir(c,d,i[o]))})}addListeners(){if(!this.visualElement.current)return;Jye.set(this.visualElement,this);const t=this.visualElement.current,n=wm(t,"pointerdown",c=>{const{drag:d,dragListener:p=!0}=this.getProps();d&&p&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Wd(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,a=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),wr.read(r);const o=dg(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(vs(p=>{const m=this.getAxisMotionValue(p);m&&(this.originPoint[p]+=c[p].translate,m.set(m.get()+c[p].translate))}),this.visualElement.render())}));return()=>{o(),n(),a(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:o=CT,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:a,dragElastic:o,dragMomentum:s}}}function ny(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function t0e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class n0e extends Yc{constructor(t){super(t),this.removeGroupControls=Vo,this.removeListeners=Vo,this.controls=new e0e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Vo}unmount(){this.removeGroupControls(),this.removeListeners()}}const g3=e=>(t,n)=>{e&&wr.postRender(()=>e(t,n))};class r0e extends Yc{constructor(){super(...arguments),this.removePointerDownListener=Vo}onPointerDown(t){this.session=new oV(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:pV(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:g3(t),onStart:g3(n),onMove:r,onEnd:(a,o)=>{delete this.session,i&&wr.postRender(()=>i(a,o))}}}mount(){this.removePointerDownListener=wm(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Py={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function v3(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Zp={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Xt.test(e))e=parseFloat(e);else return e;const n=v3(e,t.target.x),r=v3(e,t.target.y);return`${n}% ${r}%`}},i0e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=$c.parse(e);if(i.length>5)return r;const a=$c.createTransformer(e),o=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;const d=Ir(s,c,.5);return typeof i[2+o]=="number"&&(i[2+o]/=d),typeof i[3+o]=="number"&&(i[3+o]/=d),a(i)}};class a0e extends M.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:a}=t;jge(o0e),a&&(n.group&&n.group.add(a),r&&r.register&&i&&r.register(a),a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),Py.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:a}=this.props,o=r.projection;return o&&(o.isPresent=a,i||t.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),t.isPresent!==a&&(a?o.promote():o.relegate()||wr.postRender(()=>{const s=o.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),LA.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function mV(e){const[t,n]=Fme(),r=M.useContext(X6);return h.jsx(a0e,{...e,layoutGroup:r,switchLayoutGroup:M.useContext(aU),isPresent:t,safeToRemove:n})}const o0e={borderRadius:{...Zp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Zp,borderTopRightRadius:Zp,borderBottomLeftRadius:Zp,borderBottomRightRadius:Zp,boxShadow:i0e};function s0e(e,t,n){const r=ka(e)?e:cg(e);return r.start(ok("",r,t,n)),r.animation}function l0e(e){return e instanceof SVGElement&&e.tagName!=="svg"}const u0e=(e,t)=>e.depth-t.depth;class c0e{constructor(){this.children=[],this.isDirty=!1}add(t){ZA(this.children,t),this.isDirty=!0}remove(t){YA(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(u0e),this.isDirty=!1,this.children.forEach(t)}}function f0e(e,t){const n=$l.now(),r=({timestamp:i})=>{const a=i-n;a>=t&&(Bc(r),e(a-t))};return wr.read(r,!0),()=>Bc(r)}const gV=["TopLeft","TopRight","BottomLeft","BottomRight"],d0e=gV.length,y3=e=>typeof e=="string"?parseFloat(e):e,b3=e=>typeof e=="number"||Xt.test(e);function h0e(e,t,n,r,i,a){i?(e.opacity=Ir(0,n.opacity!==void 0?n.opacity:1,p0e(r)),e.opacityExit=Ir(t.opacity!==void 0?t.opacity:1,0,m0e(r))):a&&(e.opacity=Ir(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let o=0;ort?1:n(Wh(e,t,r))}function w3(e,t){e.min=t.min,e.max=t.max}function gs(e,t){w3(e.x,t.x),w3(e.y,t.y)}function _3(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function S3(e,t,n,r,i){return e-=t,e=F0(e,1/n,r),i!==void 0&&(e=F0(e,1/i,r)),e}function g0e(e,t=0,n=1,r=.5,i,a=e,o=e){if(Bl.test(t)&&(t=parseFloat(t),t=Ir(o.min,o.max,t/100)-o.min),typeof t!="number")return;let s=Ir(a.min,a.max,r);e===a&&(s-=t),e.min=S3(e.min,t,n,s,i),e.max=S3(e.max,t,n,s,i)}function P3(e,t,[n,r,i],a,o){g0e(e,t[n],t[r],t[i],t.scale,a,o)}const v0e=["x","scaleX","originX"],y0e=["y","scaleY","originY"];function j3(e,t,n,r){P3(e.x,t,v0e,n?n.x:void 0,r?r.x:void 0),P3(e.y,t,y0e,n?n.y:void 0,r?r.y:void 0)}function O3(e){return e.translate===0&&e.scale===1}function yV(e){return O3(e.x)&&O3(e.y)}function T3(e,t){return e.min===t.min&&e.max===t.max}function b0e(e,t){return T3(e.x,t.x)&&T3(e.y,t.y)}function E3(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function bV(e,t){return E3(e.x,t.x)&&E3(e.y,t.y)}function A3(e){return Ko(e.x)/Ko(e.y)}function k3(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class x0e{constructor(){this.members=[]}add(t){ZA(this.members,t),t.scheduleRender()}remove(t){if(YA(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const a=this.members[i];if(a.isPresent!==!1){r=a;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function w0e(e,t,n){let r="";const i=e.x.translate/t.x,a=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:d,rotate:p,rotateX:m,rotateY:y,skewX:b,skewY:P}=n;d&&(r=`perspective(${d}px) ${r}`),p&&(r+=`rotate(${p}deg) `),m&&(r+=`rotateX(${m}deg) `),y&&(r+=`rotateY(${y}deg) `),b&&(r+=`skewX(${b}deg) `),P&&(r+=`skewY(${P}deg) `)}const s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||"none"}const Sf={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},sm=typeof window<"u"&&window.MotionDebug!==void 0,tj=["","X","Y","Z"],_0e={visibility:"hidden"},C3=1e3;let S0e=0;function nj(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function xV(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=EU(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:a}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",wr,!(i||a))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&xV(r)}function wV({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},s=t==null?void 0:t()){this.id=S0e++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,sm&&(Sf.totalNodes=Sf.resolvedTargetDeltas=Sf.recalculatedProjection=0),this.nodes.forEach(O0e),this.nodes.forEach(C0e),this.nodes.forEach(N0e),this.nodes.forEach(T0e),sm&&window.MotionDebug.record(Sf)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(o,()=>{this.root.updateBlockedByResize=!0,m&&m(),m=f0e(y,250),Py.hasAnimatedSinceResize&&(Py.hasAnimatedSinceResize=!1,this.nodes.forEach(M3))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&p&&(c||d)&&this.addEventListener("didUpdate",({delta:m,hasLayoutChanged:y,hasRelativeTargetChanged:b,layout:P})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||p.getDefaultTransition()||D0e,{onLayoutAnimationStart:w,onLayoutAnimationComplete:T}=p.getProps(),E=!this.targetLayout||!bV(this.targetLayout,P)||b,k=!y&&b;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||k||y&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(m,k);const D={...WA(x,"layout"),onPlay:w,onComplete:T};(p.shouldReduceMotion||this.options.layoutRoot)&&(D.delay=0,D.type=!1),this.startAnimation(D)}else y||M3(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=P})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Bc(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(M0e),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&xV(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const I=D/1e3;R3(m.x,o.x,I),R3(m.y,o.y,I),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Sm(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),L0e(this.relativeTarget,this.relativeTargetOrigin,y,I),k&&b0e(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=Jr()),gs(k,this.relativeTarget)),x&&(this.animationValues=p,h0e(p,d,this.latestValues,I,E,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Bc(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wr.update(()=>{Py.hasAnimatedSinceResize=!0,this.currentAnimation=s0e(0,C3,{...o,onUpdate:s=>{this.mixTargetDelta(s),o.onUpdate&&o.onUpdate(s)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(C3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:s,target:c,layout:d,latestValues:p}=o;if(!(!s||!c||!d)){if(this!==o&&this.layout&&d&&_V(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||Jr();const m=Ko(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+m;const y=Ko(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+y}gs(s,c),Zd(s,p),_m(this.projectionDeltaWithTransform,this.layoutCorrected,s,p)}}registerSharedNode(o,s){this.sharedNodes.has(o)||this.sharedNodes.set(o,new x0e),this.sharedNodes.get(o).add(s);const d=s.options.initialPromotionConfig;s.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(s):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:s}=this.options;return s?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:s}=this.options;return s?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:s,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let s=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(s=!0),!s)return;const d={};c.z&&nj("z",o,d,this.animationValues);for(let p=0;p{var s;return(s=o.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(N3),this.root.sharedNodes.clear()}}}function P0e(e){e.updateLayout()}function j0e(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:a}=e.options,o=n.source!==e.layout.source;a==="size"?vs(m=>{const y=o?n.measuredBox[m]:n.layoutBox[m],b=Ko(y);y.min=r[m].min,y.max=y.min+b}):_V(a,n.layoutBox,r)&&vs(m=>{const y=o?n.measuredBox[m]:n.layoutBox[m],b=Ko(r[m]);y.max=y.min+b,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[m].max=e.relativeTarget[m].min+b)});const s=Hd();_m(s,r,n.layoutBox);const c=Hd();o?_m(c,e.applyTransform(i,!0),n.measuredBox):_m(c,r,n.layoutBox);const d=!yV(s);let p=!1;if(!e.resumeFrom){const m=e.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:y,layout:b}=m;if(y&&b){const P=Jr();Sm(P,n.layoutBox,y.layoutBox);const x=Jr();Sm(x,r,b.layoutBox),bV(P,x)||(p=!0),m.options.layoutRoot&&(e.relativeTarget=x,e.relativeTargetOrigin=P,e.relativeParent=m)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:s,hasLayoutChanged:d,hasRelativeTargetChanged:p})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function O0e(e){sm&&Sf.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function T0e(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function E0e(e){e.clearSnapshot()}function N3(e){e.clearMeasurements()}function A0e(e){e.isLayoutDirty=!1}function k0e(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function M3(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function C0e(e){e.resolveTargetDelta()}function N0e(e){e.calcProjection()}function M0e(e){e.resetSkewAndRotation()}function R0e(e){e.removeLeadSnapshot()}function R3(e,t,n){e.translate=Ir(t.translate,0,n),e.scale=Ir(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function L3(e,t,n,r){e.min=Ir(t.min,n.min,r),e.max=Ir(t.max,n.max,r)}function L0e(e,t,n,r){L3(e.x,t.x,n.x,r),L3(e.y,t.y,n.y,r)}function I0e(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const D0e={duration:.45,ease:[.4,0,.1,1]},I3=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),D3=I3("applewebkit/")&&!I3("chrome/")?Math.round:Vo;function B3(e){e.min=D3(e.min),e.max=D3(e.max)}function B0e(e){B3(e.x),B3(e.y)}function _V(e,t,n){return e==="position"||e==="preserve-aspect"&&!qye(A3(t),A3(n),.2)}function $0e(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const F0e=wV({attachResizeListener:(e,t)=>dg(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rj={current:void 0},SV=wV({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!rj.current){const e=new F0e({});e.mount(window),e.setOptions({layoutScroll:!0}),rj.current=e}return rj.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),q0e={pan:{Feature:r0e},drag:{Feature:n0e,ProjectionNode:SV,MeasureLayout:mV}};function $3(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,a=r[i];a&&wr.postRender(()=>a(t,$g(t)))}class z0e extends Yc{mount(){const{current:t}=this.node;t&&(this.unmount=qge(t,n=>($3(this.node,n,"Start"),r=>$3(this.node,r,"End"))))}unmount(){}}class U0e extends Yc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Bg(dg(this.node.current,"focus",()=>this.onFocus()),dg(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function F3(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),a=r[i];a&&wr.postRender(()=>a(t,$g(t)))}class V0e extends Yc{mount(){const{current:t}=this.node;t&&(this.unmount=Wge(t,n=>(F3(this.node,n,"Start"),(r,{success:i})=>F3(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const RT=new WeakMap,ij=new WeakMap,W0e=e=>{const t=RT.get(e.target);t&&t(e)},K0e=e=>{e.forEach(W0e)};function H0e({root:e,...t}){const n=e||document;ij.has(n)||ij.set(n,{});const r=ij.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(K0e,{root:e,...t})),r[i]}function G0e(e,t,n){const r=H0e(t);return RT.set(e,n),r.observe(e),()=>{RT.delete(e),r.unobserve(e)}}const Z0e={some:0,all:1};class Y0e extends Yc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:a}=t,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:Z0e[i]},s=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,a&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:p,onViewportLeave:m}=this.node.getProps(),y=d?p:m;y&&y(c)};return G0e(this.node.current,o,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(X0e(t,n))&&this.startObserver()}unmount(){}}function X0e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Q0e={inView:{Feature:Y0e},tap:{Feature:V0e},focus:{Feature:U0e},hover:{Feature:z0e}},J0e={layout:{ProjectionNode:SV,MeasureLayout:mV}},LT={current:null},PV={current:!1};function ebe(){if(PV.current=!0,!!kA)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>LT.current=e.matches;e.addListener(t),t()}else LT.current=!1}const tbe=[...ZU,Oa,$c],nbe=e=>tbe.find(GU(e)),q3=new WeakMap;function rbe(e,t,n){for(const r in t){const i=t[r],a=n[r];if(ka(i))e.addValue(r,i);else if(ka(a))e.addValue(r,cg(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(r);e.addValue(r,cg(o!==void 0?o:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const z3=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class ibe{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=rk,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=$l.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),PV.current||ebe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:LT.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){q3.delete(this.current),this.projection&&this.projection.unmount(),Bc(this.notifyUpdate),Bc(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=md.has(t),i=n.on("change",s=>{this.latestValues[t]=s,this.props.onUpdate&&wr.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),a=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),a(),o&&o(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Kh){const n=Kh[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const a=this.features[t];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Jr()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=cg(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let i=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return i!=null&&(typeof i=="string"&&(KU(i)||DU(i))?i=parseFloat(i):!nbe(i)&&$c.test(n)&&(i=UU(t,n)),this.setBaseTarget(t,ka(i)?i.get():i)),ka(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const o=DA(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(i=o[t])}if(r&&i!==void 0)return i;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!ka(a)?a:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new XA),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class jV extends ibe{constructor(){super(...arguments),this.KeyframeResolver=YU}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ka(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function abe(e){return window.getComputedStyle(e)}class obe extends jV{constructor(){super(...arguments),this.type="html",this.renderInstance=dU}readValueFromInstance(t,n){if(md.has(n)){const r=nk(n);return r&&r.default||0}else{const r=abe(t),i=(uU(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return hV(t,n)}build(t,n,r){FA(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return VA(t,n,r)}}class sbe extends jV{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Jr}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(md.has(n)){const r=nk(n);return r&&r.default||0}return n=hU.has(n)?n:RA(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return gU(t,n,r)}build(t,n,r){qA(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,i){pU(t,n,r,i)}mount(t){this.isSVGTag=UA(t.tagName),super.mount(t)}}const lbe=(e,t)=>IA(e)?new sbe(t):new obe(t,{allowProjection:e!==M.Fragment}),ube=Rge({...Nye,...Q0e,...q0e,...J0e},lbe),Rt=Zme(ube),cbe=[{id:1,full_name:"Petani Lokal A",village:"Desa Sukamaju",verification_status:"verified"},{id:2,full_name:"Petani Lokal B",village:"Desa Sukamurni",verification_status:"pending"}],fbe=[{id:1,area_hectares:2.5,regency:"Kabupaten Bogor",validation_status:"valid"},{id:2,area_hectares:1.2,regency:"Kabupaten Cianjur",validation_status:"pending"}],dbe=[{id:1,commodity_name:"Padi",status:"alive"},{id:2,commodity_name:"Jagung",status:"sick"}];function hbe(){const{data:e=[]}=bn({queryKey:["farmers"],queryFn:()=>mt.entities.Farmer.list(),retry:!1}),{data:t=[]}=bn({queryKey:["lands"],queryFn:()=>mt.entities.Land.list(),retry:!1}),{data:n=[]}=bn({queryKey:["plants"],queryFn:()=>mt.entities.Plant.list(),retry:!1}),r=Array.isArray(e)&&e.length>0?e:cbe||[],i=Array.isArray(t)&&t.length>0?t:fbe||[],a=Array.isArray(n)&&n.length>0?n:dbe||[],o=Array.isArray(r)?r:[],s=Array.isArray(i)?i:[],c=Array.isArray(i)?i.filter(T=>T.validation_status==="valid").length:0,d=Array.isArray(a)?a.filter(T=>T.status==="alive").length:0,p=s.reduce((T,E)=>T+(Number(E.area_hectares)||0),0),m=o.filter(T=>T.verification_status==="verified").length,y=s.reduce((T,E)=>{const k=E.regency||"Tidak Diketahui",D=T.find(I=>I.name===k);return D?D.value+=Number(E.area_hectares)||0:T.push({name:k,value:Number(E.area_hectares)||0}),T},[]).sort((T,E)=>E.value-T.value).slice(0,5),b=a.reduce((T,E)=>{const k=E.commodity_name||"Lainnya",D=T.find(I=>I.name===k);return D?D.value+=1:T.push({name:k,value:1}),T},[]).sort((T,E)=>E.value-T.value).slice(0,6),P=i.filter(T=>T.validation_status==="pending"||T.validation_status==="need_review").length,x=r.filter(T=>T.verification_status==="pending").length,w=a.filter(T=>T.status==="sick"||T.productivity_status==="less_productive"||T.productivity_status==="not_productive").length;return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-8",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"space-y-1",children:[h.jsx("h1",{className:"text-3xl font-bold text-slate-900",children:"Dashboard Monev"}),h.jsx("p",{className:"text-slate-500",children:"Monitoring & Evaluasi Pertanian Wilayah"})]}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-5",children:[h.jsx(Fv,{title:"Total Petani",value:r.length,subtitle:`${m} terverifikasi`,icon:ll,trend:m>0?`${Math.round(m/r.length*100)}% verified`:void 0,trendUp:!0}),h.jsx(Fv,{title:"Total Lahan",value:i.length,subtitle:`${c} tervalidasi`,icon:js}),h.jsx(Fv,{title:"Luas Total",value:`${p.toFixed(1)} Ha`,subtitle:"Area terdata",icon:_j}),h.jsx(Fv,{title:"Jumlah Tanaman",value:a.length,subtitle:`${d} hidup`,icon:sa})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[h.jsx(Rt.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.2},children:h.jsx(Dme,{data:y,title:"Luas Lahan per Wilayah (Ha)"})}),h.jsx(Rt.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{delay:.2},children:h.jsx(Bme,{data:b,title:"Distribusi Komoditas"})})]}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{className:"pb-4",children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(ul,{className:"w-5 h-5 text-amber-500"}),"Perlu Perhatian"]})}),h.jsx(Pn,{children:h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[h.jsxs("div",{className:"p-4 rounded-xl bg-amber-50 border border-amber-100",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-sm font-medium text-amber-800",children:"Lahan Pending"}),h.jsx("span",{className:"text-2xl font-bold text-amber-600",children:P})]}),h.jsx("p",{className:"text-xs text-amber-600",children:"Perlu validasi wilayah"})]}),h.jsxs("div",{className:"p-4 rounded-xl bg-blue-50 border border-blue-100",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-sm font-medium text-blue-800",children:"Petani Pending"}),h.jsx("span",{className:"text-2xl font-bold text-blue-600",children:x})]}),h.jsx("p",{className:"text-xs text-blue-600",children:"Menunggu verifikasi"})]}),h.jsxs("div",{className:"p-4 rounded-xl bg-rose-50 border border-rose-100",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-sm font-medium text-rose-800",children:"Tanaman Sakit"}),h.jsx("span",{className:"text-2xl font-bold text-rose-600",children:w})]}),h.jsx("p",{className:"text-xs text-rose-600",children:"Perlu inspeksi lapangan"})]})]})})]})}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{className:"pb-4",children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(oF,{className:"w-5 h-5 text-emerald-600"}),"Aktivitas Terkini"]})}),h.jsx(Pn,{children:h.jsxs("div",{className:"space-y-3",children:[r.slice(0,5).map((T,E)=>{var k,D;return h.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg hover:bg-slate-50 transition-colors",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-emerald-100 to-emerald-200 flex items-center justify-center",children:h.jsx("span",{className:"text-sm font-bold text-emerald-700",children:(D=(k=T.full_name)==null?void 0:k.charAt(0))==null?void 0:D.toUpperCase()})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:"font-medium text-slate-900 truncate",children:T.full_name}),h.jsxs("p",{className:"text-sm text-slate-500",children:[T.village,", ",T.district]})]}),h.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${T.verification_status==="verified"?"bg-emerald-100 text-emerald-700":"bg-amber-100 text-amber-700"}`,children:T.verification_status==="verified"?"Terverifikasi":"Pending"})]},T.id)}),r.length===0&&h.jsx("p",{className:"text-center text-slate-500 py-8",children:"Belum ada data petani"})]})})]})})]})})}function ei(e){return"/"+e.replace(/ /g,"-")}const pbe=Q0("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ur({className:e,variant:t,...n}){return h.jsx("div",{className:fn(pbe({variant:t}),e),...n})}function U3(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dp(...e){return t=>{let n=!1;const r=e.map(i=>{const a=U3(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i{let{children:a,...o}=r;OV(a)&&typeof q0=="function"&&(a=q0(a._payload));const s=M.Children.toArray(a),c=s.find(xbe);if(c){const d=c.props.children,p=s.map(m=>m===c?M.Children.count(d)>1?M.Children.only(null):M.isValidElement(d)?d.props.children:null:m);return h.jsx(t,{...o,ref:i,children:M.isValidElement(d)?M.cloneElement(d,void 0,p):null})}return h.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}var vbe=sk("Slot");function ybe(e){const t=M.forwardRef((n,r)=>{let{children:i,...a}=n;if(OV(i)&&typeof q0=="function"&&(i=q0(i._payload)),M.isValidElement(i)){const o=_be(i),s=wbe(a,i.props);return i.type!==M.Fragment&&(s.ref=r?dp(r,o):o),M.cloneElement(i,s)}return M.Children.count(i)>1?M.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bbe=Symbol("radix.slottable");function xbe(e){return M.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bbe}function wbe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{const c=a(...s);return i(...s),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function _be(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Sbe=Q0("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),pt=M.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>{const o=r?vbe:"button";return h.jsx(o,{className:fn(Sbe({variant:t,size:n,className:e})),ref:a,...i})});pt.displayName="Button";const Pbe={pending:"bg-amber-100 text-amber-700 border-amber-200",verified:"bg-emerald-100 text-emerald-700 border-emerald-200",rejected:"bg-rose-100 text-rose-700 border-rose-200"},jbe={pending:"Menunggu Verifikasi",verified:"Terverifikasi",rejected:"Ditolak"};function Obe({farmer:e}){var t,n;return h.jsx(Tt,{className:"border-0 shadow-sm hover:shadow-md transition-all p-5 bg-white group",children:h.jsxs("div",{className:"flex items-start gap-4",children:[h.jsx("div",{className:"w-14 h-14 rounded-full bg-gradient-to-br from-emerald-100 to-emerald-200 flex items-center justify-center flex-shrink-0",children:e.photo_url?h.jsx("img",{src:e.photo_url,alt:e.full_name,className:"w-full h-full rounded-full object-cover"}):h.jsx("span",{className:"text-xl font-bold text-emerald-700",children:((n=(t=e.full_name)==null?void 0:t.charAt(0))==null?void 0:n.toUpperCase())||"P"})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"font-semibold text-slate-900 truncate",children:e.full_name}),h.jsxs("p",{className:"text-sm text-slate-500",children:["NIK: ",e.nik]})]}),h.jsx(ur,{className:`${Pbe[e.verification_status]} border font-medium text-xs`,children:jbe[e.verification_status]})]}),h.jsxs("div",{className:"space-y-1.5 text-sm text-slate-600",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(So,{className:"w-4 h-4 text-slate-400"}),h.jsxs("span",{className:"truncate",children:[e.village,", ",e.district]})]}),e.farmer_group&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ll,{className:"w-4 h-4 text-slate-400"}),h.jsx("span",{className:"truncate",children:e.farmer_group})]}),e.phone&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Yh,{className:"w-4 h-4 text-slate-400"}),h.jsx("span",{children:e.phone})]})]})]}),h.jsx(zo,{to:ei("FarmerDetail")+`?id=${e.id}`,children:h.jsx(pt,{variant:"ghost",size:"icon",className:"opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx(tb,{className:"w-5 h-5 text-slate-400"})})})]})})}function Qa({icon:e,title:t,description:n,action:r,actionLabel:i,className:a}){return h.jsxs("div",{className:fn("flex flex-col items-center justify-center py-16 px-6 text-center",a),children:[e&&h.jsx("div",{className:"w-16 h-16 rounded-full bg-slate-100 flex items-center justify-center mb-4",children:h.jsx(e,{className:"w-8 h-8 text-slate-400"})}),h.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:t}),n&&h.jsx("p",{className:"text-sm text-slate-500 max-w-sm mb-6",children:n}),r&&i&&h.jsx(pt,{onClick:r,className:"bg-emerald-600 hover:bg-emerald-700",children:i})]})}const nn=M.forwardRef(({className:e,type:t,...n},r)=>h.jsx("input",{type:t,className:fn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));nn.displayName="Input";function V3(e,[t,n]){return Math.min(n,Math.max(t,e))}function Mn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Tbe(e,t){const n=M.createContext(t),r=a=>{const{children:o,...s}=a,c=M.useMemo(()=>s,Object.values(s));return h.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function i(a){const o=M.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,i]}function gd(e,t=[]){let n=[];function r(a,o){const s=M.createContext(o),c=n.length;n=[...n,o];const d=m=>{var T;const{scope:y,children:b,...P}=m,x=((T=y==null?void 0:y[e])==null?void 0:T[c])||s,w=M.useMemo(()=>P,Object.values(P));return h.jsx(x.Provider,{value:w,children:b})};d.displayName=a+"Provider";function p(m,y){var x;const b=((x=y==null?void 0:y[e])==null?void 0:x[c])||s,P=M.useContext(b);if(P)return P;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[d,p]}const i=()=>{const a=n.map(o=>M.createContext(o));return function(s){const c=(s==null?void 0:s[e])||a;return M.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return i.scopeName=e,[r,Ebe(i,...t)]}function Ebe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((s,{useScope:c,scopeName:d})=>{const m=c(a)[`__scope${d}`];return{...s,...m}},{});return M.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function W3(e){const t=Abe(e),n=M.forwardRef((r,i)=>{const{children:a,...o}=r,s=M.Children.toArray(a),c=s.find(Cbe);if(c){const d=c.props.children,p=s.map(m=>m===c?M.Children.count(d)>1?M.Children.only(null):M.isValidElement(d)?d.props.children:null:m);return h.jsx(t,{...o,ref:i,children:M.isValidElement(d)?M.cloneElement(d,void 0,p):null})}return h.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function Abe(e){const t=M.forwardRef((n,r)=>{const{children:i,...a}=n;if(M.isValidElement(i)){const o=Mbe(i),s=Nbe(a,i.props);return i.type!==M.Fragment&&(s.ref=r?dp(r,o):o),M.cloneElement(i,s)}return M.Children.count(i)>1?M.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kbe=Symbol("radix.slottable");function Cbe(e){return M.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kbe}function Nbe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{const c=a(...s);return i(...s),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function Mbe(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function TV(e){const t=e+"CollectionProvider",[n,r]=gd(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:T}=x,E=ce.useRef(null),k=ce.useRef(new Map).current;return h.jsx(i,{scope:w,itemMap:k,collectionRef:E,children:T})};o.displayName=t;const s=e+"CollectionSlot",c=W3(s),d=ce.forwardRef((x,w)=>{const{scope:T,children:E}=x,k=a(s,T),D=Er(w,k.collectionRef);return h.jsx(c,{ref:D,children:E})});d.displayName=s;const p=e+"CollectionItemSlot",m="data-radix-collection-item",y=W3(p),b=ce.forwardRef((x,w)=>{const{scope:T,children:E,...k}=x,D=ce.useRef(null),I=Er(w,D),R=a(p,T);return ce.useEffect(()=>(R.itemMap.set(D,{ref:D,...k}),()=>void R.itemMap.delete(D))),h.jsx(y,{[m]:"",ref:I,children:E})});b.displayName=p;function P(x){const w=a(e+"CollectionConsumer",x);return ce.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const k=Array.from(E.querySelectorAll(`[${m}]`));return Array.from(w.itemMap.values()).sort((R,$)=>k.indexOf(R.ref.current)-k.indexOf($.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:b},P,r]}var Rbe=M.createContext(void 0);function lk(e){const t=M.useContext(Rbe);return e||t||"ltr"}function Lbe(e){const t=Ibe(e),n=M.forwardRef((r,i)=>{const{children:a,...o}=r,s=M.Children.toArray(a),c=s.find(Bbe);if(c){const d=c.props.children,p=s.map(m=>m===c?M.Children.count(d)>1?M.Children.only(null):M.isValidElement(d)?d.props.children:null:m);return h.jsx(t,{...o,ref:i,children:M.isValidElement(d)?M.cloneElement(d,void 0,p):null})}return h.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function Ibe(e){const t=M.forwardRef((n,r)=>{const{children:i,...a}=n;if(M.isValidElement(i)){const o=Fbe(i),s=$be(a,i.props);return i.type!==M.Fragment&&(s.ref=r?dp(r,o):o),M.cloneElement(i,s)}return M.Children.count(i)>1?M.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Dbe=Symbol("radix.slottable");function Bbe(e){return M.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Dbe}function $be(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{const c=a(...s);return i(...s),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function Fbe(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var qbe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Dn=qbe.reduce((e,t)=>{const n=Lbe(`Primitive.${t}`),r=M.forwardRef((i,a)=>{const{asChild:o,...s}=i,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(c,{...s,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function zbe(e,t){e&&Qh.flushSync(()=>e.dispatchEvent(t))}function Fc(e){const t=M.useRef(e);return M.useEffect(()=>{t.current=e}),M.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Ube(e,t=globalThis==null?void 0:globalThis.document){const n=Fc(e);M.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Vbe="DismissableLayer",IT="dismissableLayer.update",Wbe="dismissableLayer.pointerDownOutside",Kbe="dismissableLayer.focusOutside",K3,EV=M.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),uk=M.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,d=M.useContext(EV),[p,m]=M.useState(null),y=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=M.useState({}),P=Er(t,$=>m($)),x=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),T=x.indexOf(w),E=p?x.indexOf(p):-1,k=d.layersWithOutsidePointerEventsDisabled.size>0,D=E>=T,I=Zbe($=>{const V=$.target,K=[...d.branches].some(Z=>Z.contains(V));!D||K||(i==null||i($),o==null||o($),$.defaultPrevented||s==null||s())},y),R=Ybe($=>{const V=$.target;[...d.branches].some(Z=>Z.contains(V))||(a==null||a($),o==null||o($),$.defaultPrevented||s==null||s())},y);return Ube($=>{E===d.layers.size-1&&(r==null||r($),!$.defaultPrevented&&s&&($.preventDefault(),s()))},y),M.useEffect(()=>{if(p)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(K3=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),H3(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=K3)}},[p,y,n,d]),M.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),H3())},[p,d]),M.useEffect(()=>{const $=()=>b({});return document.addEventListener(IT,$),()=>document.removeEventListener(IT,$)},[]),h.jsx(Dn.div,{...c,ref:P,style:{pointerEvents:k?D?"auto":"none":void 0,...e.style},onFocusCapture:Mn(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Mn(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Mn(e.onPointerDownCapture,I.onPointerDownCapture)})});uk.displayName=Vbe;var Hbe="DismissableLayerBranch",Gbe=M.forwardRef((e,t)=>{const n=M.useContext(EV),r=M.useRef(null),i=Er(t,r);return M.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),h.jsx(Dn.div,{...e,ref:i})});Gbe.displayName=Hbe;function Zbe(e,t=globalThis==null?void 0:globalThis.document){const n=Fc(e),r=M.useRef(!1),i=M.useRef(()=>{});return M.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let c=function(){AV(Wbe,n,d,{discrete:!0})};const d={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Ybe(e,t=globalThis==null?void 0:globalThis.document){const n=Fc(e),r=M.useRef(!1);return M.useEffect(()=>{const i=a=>{a.target&&!r.current&&AV(Kbe,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function H3(){const e=new CustomEvent(IT);document.dispatchEvent(e)}function AV(e,t,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?zbe(i,a):i.dispatchEvent(a)}var aj=0;function kV(){M.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??G3()),document.body.insertAdjacentElement("beforeend",e[1]??G3()),aj++,()=>{aj===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),aj--}},[])}function G3(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var oj="focusScope.autoFocusOnMount",sj="focusScope.autoFocusOnUnmount",Z3={bubbles:!1,cancelable:!0},Xbe="FocusScope",ck=M.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=M.useState(null),d=Fc(i),p=Fc(a),m=M.useRef(null),y=Er(t,x=>c(x)),b=M.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;M.useEffect(()=>{if(r){let x=function(k){if(b.paused||!s)return;const D=k.target;s.contains(D)?m.current=D:dc(m.current,{select:!0})},w=function(k){if(b.paused||!s)return;const D=k.relatedTarget;D!==null&&(s.contains(D)||dc(m.current,{select:!0}))},T=function(k){if(document.activeElement===document.body)for(const I of k)I.removedNodes.length>0&&dc(s)};document.addEventListener("focusin",x),document.addEventListener("focusout",w);const E=new MutationObserver(T);return s&&E.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",w),E.disconnect()}}},[r,s,b.paused]),M.useEffect(()=>{if(s){X3.add(b);const x=document.activeElement;if(!s.contains(x)){const T=new CustomEvent(oj,Z3);s.addEventListener(oj,d),s.dispatchEvent(T),T.defaultPrevented||(Qbe(rxe(CV(s)),{select:!0}),document.activeElement===x&&dc(s))}return()=>{s.removeEventListener(oj,d),setTimeout(()=>{const T=new CustomEvent(sj,Z3);s.addEventListener(sj,p),s.dispatchEvent(T),T.defaultPrevented||dc(x??document.body,{select:!0}),s.removeEventListener(sj,p),X3.remove(b)},0)}}},[s,d,p,b]);const P=M.useCallback(x=>{if(!n&&!r||b.paused)return;const w=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,T=document.activeElement;if(w&&T){const E=x.currentTarget,[k,D]=Jbe(E);k&&D?!x.shiftKey&&T===D?(x.preventDefault(),n&&dc(k,{select:!0})):x.shiftKey&&T===k&&(x.preventDefault(),n&&dc(D,{select:!0})):T===E&&x.preventDefault()}},[n,r,b.paused]);return h.jsx(Dn.div,{tabIndex:-1,...o,ref:y,onKeyDown:P})});ck.displayName=Xbe;function Qbe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(dc(r,{select:t}),document.activeElement!==n)return}function Jbe(e){const t=CV(e),n=Y3(t,e),r=Y3(t.reverse(),e);return[n,r]}function CV(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Y3(e,t){for(const n of e)if(!exe(n,{upTo:t}))return n}function exe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function txe(e){return e instanceof HTMLInputElement&&"select"in e}function dc(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&txe(e)&&t&&e.select()}}var X3=nxe();function nxe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Q3(e,t),e.unshift(t)},remove(t){var n;e=Q3(e,t),(n=e[0])==null||n.resume()}}}function Q3(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function rxe(e){return e.filter(t=>t.tagName!=="A")}var Ca=globalThis!=null&&globalThis.document?M.useLayoutEffect:()=>{},ixe=X0[" useId ".trim().toString()]||(()=>{}),axe=0;function Rc(e){const[t,n]=M.useState(ixe());return Ca(()=>{n(r=>r??String(axe++))},[e]),t?`radix-${t}`:""}const oxe=["top","right","bottom","left"],qc=Math.min,Fo=Math.max,z0=Math.round,ry=Math.floor,Fl=e=>({x:e,y:e}),sxe={left:"right",right:"left",bottom:"top",top:"bottom"},lxe={start:"end",end:"start"};function DT(e,t,n){return Fo(e,qc(t,n))}function Ru(e,t){return typeof e=="function"?e(t):e}function Lu(e){return e.split("-")[0]}function hp(e){return e.split("-")[1]}function fk(e){return e==="x"?"y":"x"}function dk(e){return e==="y"?"height":"width"}const uxe=new Set(["top","bottom"]);function Rl(e){return uxe.has(Lu(e))?"y":"x"}function hk(e){return fk(Rl(e))}function cxe(e,t,n){n===void 0&&(n=!1);const r=hp(e),i=hk(e),a=dk(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=U0(o)),[o,U0(o)]}function fxe(e){const t=U0(e);return[BT(e),t,BT(t)]}function BT(e){return e.replace(/start|end/g,t=>lxe[t])}const J3=["left","right"],e$=["right","left"],dxe=["top","bottom"],hxe=["bottom","top"];function pxe(e,t,n){switch(e){case"top":case"bottom":return n?t?e$:J3:t?J3:e$;case"left":case"right":return t?dxe:hxe;default:return[]}}function mxe(e,t,n,r){const i=hp(e);let a=pxe(Lu(e),n==="start",r);return i&&(a=a.map(o=>o+"-"+i),t&&(a=a.concat(a.map(BT)))),a}function U0(e){return e.replace(/left|right|bottom|top/g,t=>sxe[t])}function gxe(e){return{top:0,right:0,bottom:0,left:0,...e}}function NV(e){return typeof e!="number"?gxe(e):{top:e,right:e,bottom:e,left:e}}function V0(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function t$(e,t,n){let{reference:r,floating:i}=e;const a=Rl(t),o=hk(t),s=dk(o),c=Lu(t),d=a==="y",p=r.x+r.width/2-i.width/2,m=r.y+r.height/2-i.height/2,y=r[s]/2-i[s]/2;let b;switch(c){case"top":b={x:p,y:r.y-i.height};break;case"bottom":b={x:p,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:m};break;case"left":b={x:r.x-i.width,y:m};break;default:b={x:r.x,y:r.y}}switch(hp(t)){case"start":b[o]-=y*(n&&d?-1:1);break;case"end":b[o]+=y*(n&&d?-1:1);break}return b}async function vxe(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:y=!1,padding:b=0}=Ru(t,e),P=NV(b),w=s[y?m==="floating"?"reference":"floating":m],T=V0(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(w)))==null||n?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:d,rootBoundary:p,strategy:c})),E=m==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),D=await(a.isElement==null?void 0:a.isElement(k))?await(a.getScale==null?void 0:a.getScale(k))||{x:1,y:1}:{x:1,y:1},I=V0(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:E,offsetParent:k,strategy:c}):E);return{top:(T.top-I.top+P.top)/D.y,bottom:(I.bottom-T.bottom+P.bottom)/D.y,left:(T.left-I.left+P.left)/D.x,right:(I.right-T.right+P.right)/D.x}}const yxe=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:p,y:m}=t$(d,r,c),y=r,b={},P=0;for(let w=0;w({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:d,padding:p=0}=Ru(e,t)||{};if(d==null)return{};const m=NV(p),y={x:n,y:r},b=hk(i),P=dk(b),x=await o.getDimensions(d),w=b==="y",T=w?"top":"left",E=w?"bottom":"right",k=w?"clientHeight":"clientWidth",D=a.reference[P]+a.reference[b]-y[b]-a.floating[P],I=y[b]-a.reference[b],R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let $=R?R[k]:0;(!$||!await(o.isElement==null?void 0:o.isElement(R)))&&($=s.floating[k]||a.floating[P]);const V=D/2-I/2,K=$/2-x[P]/2-1,Z=qc(m[T],K),ee=qc(m[E],K),ne=Z,oe=$-x[P]-ee,he=$/2-x[P]/2+V,Se=DT(ne,he,oe),fe=!c.arrow&&hp(i)!=null&&he!==Se&&a.reference[P]/2-(hehe<=0)){var ee,ne;const he=(((ee=a.flip)==null?void 0:ee.index)||0)+1,Se=$[he];if(Se&&(!(m==="alignment"?E!==Rl(Se):!1)||Z.every(re=>Rl(re.placement)===E?re.overflows[0]>0:!0)))return{data:{index:he,overflows:Z},reset:{placement:Se}};let fe=(ne=Z.filter(Oe=>Oe.overflows[0]<=0).sort((Oe,re)=>Oe.overflows[1]-re.overflows[1])[0])==null?void 0:ne.placement;if(!fe)switch(b){case"bestFit":{var oe;const Oe=(oe=Z.filter(re=>{if(R){const Ce=Rl(re.placement);return Ce===E||Ce==="y"}return!0}).map(re=>[re.placement,re.overflows.filter(Ce=>Ce>0).reduce((Ce,ae)=>Ce+ae,0)]).sort((re,Ce)=>re[1]-Ce[1])[0])==null?void 0:oe[0];Oe&&(fe=Oe);break}case"initialPlacement":fe=s;break}if(i!==fe)return{reset:{placement:fe}}}return{}}}};function n$(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function r$(e){return oxe.some(t=>e[t]>=0)}const wxe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...a}=Ru(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...a,elementContext:"reference"}),s=n$(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:r$(s)}}}case"escaped":{const o=await r.detectOverflow(t,{...a,altBoundary:!0}),s=n$(o,n.floating);return{data:{escapedOffsets:s,escaped:r$(s)}}}default:return{}}}}},MV=new Set(["left","top"]);async function _xe(e,t){const{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Lu(n),s=hp(n),c=Rl(n)==="y",d=MV.has(o)?-1:1,p=a&&c?-1:1,m=Ru(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:P}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return s&&typeof P=="number"&&(b=s==="end"?P*-1:P),c?{x:b*p,y:y*d}:{x:y*d,y:b*p}}const Sxe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:a,placement:o,middlewareData:s}=t,c=await _xe(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:{...c,placement:o}}}}},Pxe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:T=>{let{x:E,y:k}=T;return{x:E,y:k}}},...d}=Ru(e,t),p={x:n,y:r},m=await a.detectOverflow(t,d),y=Rl(Lu(i)),b=fk(y);let P=p[b],x=p[y];if(o){const T=b==="y"?"top":"left",E=b==="y"?"bottom":"right",k=P+m[T],D=P-m[E];P=DT(k,P,D)}if(s){const T=y==="y"?"top":"left",E=y==="y"?"bottom":"right",k=x+m[T],D=x-m[E];x=DT(k,x,D)}const w=c.fn({...t,[b]:P,[y]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[b]:o,[y]:s}}}}}},jxe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:d=!0}=Ru(e,t),p={x:n,y:r},m=Rl(i),y=fk(m);let b=p[y],P=p[m];const x=Ru(s,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(c){const k=y==="y"?"height":"width",D=a.reference[y]-a.floating[k]+w.mainAxis,I=a.reference[y]+a.reference[k]-w.mainAxis;bI&&(b=I)}if(d){var T,E;const k=y==="y"?"width":"height",D=MV.has(Lu(i)),I=a.reference[m]-a.floating[k]+(D&&((T=o.offset)==null?void 0:T[m])||0)+(D?0:w.crossAxis),R=a.reference[m]+a.reference[k]+(D?0:((E=o.offset)==null?void 0:E[m])||0)-(D?w.crossAxis:0);PR&&(P=R)}return{[y]:b,[m]:P}}}},Oxe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...d}=Ru(e,t),p=await o.detectOverflow(t,d),m=Lu(i),y=hp(i),b=Rl(i)==="y",{width:P,height:x}=a.floating;let w,T;m==="top"||m==="bottom"?(w=m,T=y===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(T=m,w=y==="end"?"top":"bottom");const E=x-p.top-p.bottom,k=P-p.left-p.right,D=qc(x-p[w],E),I=qc(P-p[T],k),R=!t.middlewareData.shift;let $=D,V=I;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(V=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&($=E),R&&!y){const Z=Fo(p.left,0),ee=Fo(p.right,0),ne=Fo(p.top,0),oe=Fo(p.bottom,0);b?V=P-2*(Z!==0||ee!==0?Z+ee:Fo(p.left,p.right)):$=x-2*(ne!==0||oe!==0?ne+oe:Fo(p.top,p.bottom))}await c({...t,availableWidth:V,availableHeight:$});const K=await o.getDimensions(s.floating);return P!==K.width||x!==K.height?{reset:{rects:!0}}:{}}}};function ex(){return typeof window<"u"}function pp(e){return RV(e)?(e.nodeName||"").toLowerCase():"#document"}function Wo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Zl(e){var t;return(t=(RV(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function RV(e){return ex()?e instanceof Node||e instanceof Wo(e).Node:!1}function fl(e){return ex()?e instanceof Element||e instanceof Wo(e).Element:!1}function Wl(e){return ex()?e instanceof HTMLElement||e instanceof Wo(e).HTMLElement:!1}function i$(e){return!ex()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wo(e).ShadowRoot}const Txe=new Set(["inline","contents"]);function Fg(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=dl(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Txe.has(i)}const Exe=new Set(["table","td","th"]);function Axe(e){return Exe.has(pp(e))}const kxe=[":popover-open",":modal"];function tx(e){return kxe.some(t=>{try{return e.matches(t)}catch{return!1}})}const Cxe=["transform","translate","scale","rotate","perspective"],Nxe=["transform","translate","scale","rotate","perspective","filter"],Mxe=["paint","layout","strict","content"];function pk(e){const t=mk(),n=fl(e)?dl(e):e;return Cxe.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Nxe.some(r=>(n.willChange||"").includes(r))||Mxe.some(r=>(n.contain||"").includes(r))}function Rxe(e){let t=zc(e);for(;Wl(t)&&!Gh(t);){if(pk(t))return t;if(tx(t))return null;t=zc(t)}return null}function mk(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Lxe=new Set(["html","body","#document"]);function Gh(e){return Lxe.has(pp(e))}function dl(e){return Wo(e).getComputedStyle(e)}function nx(e){return fl(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zc(e){if(pp(e)==="html")return e;const t=e.assignedSlot||e.parentNode||i$(e)&&e.host||Zl(e);return i$(t)?t.host:t}function LV(e){const t=zc(e);return Gh(t)?e.ownerDocument?e.ownerDocument.body:e.body:Wl(t)&&Fg(t)?t:LV(t)}function hg(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=LV(e),a=i===((r=e.ownerDocument)==null?void 0:r.body),o=Wo(i);if(a){const s=$T(o);return t.concat(o,o.visualViewport||[],Fg(i)?i:[],s&&n?hg(s):[])}return t.concat(i,hg(i,[],n))}function $T(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function IV(e){const t=dl(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Wl(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=z0(n)!==a||z0(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function gk(e){return fl(e)?e:e.contextElement}function Jd(e){const t=gk(e);if(!Wl(t))return Fl(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:a}=IV(t);let o=(a?z0(n.width):n.width)/r,s=(a?z0(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}const Ixe=Fl(0);function DV(e){const t=Wo(e);return!mk()||!t.visualViewport?Ixe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Dxe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Wo(e)?!1:t}function rd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),a=gk(e);let o=Fl(1);t&&(r?fl(r)&&(o=Jd(r)):o=Jd(e));const s=Dxe(a,n,r)?DV(a):Fl(0);let c=(i.left+s.x)/o.x,d=(i.top+s.y)/o.y,p=i.width/o.x,m=i.height/o.y;if(a){const y=Wo(a),b=r&&fl(r)?Wo(r):r;let P=y,x=$T(P);for(;x&&r&&b!==P;){const w=Jd(x),T=x.getBoundingClientRect(),E=dl(x),k=T.left+(x.clientLeft+parseFloat(E.paddingLeft))*w.x,D=T.top+(x.clientTop+parseFloat(E.paddingTop))*w.y;c*=w.x,d*=w.y,p*=w.x,m*=w.y,c+=k,d+=D,P=Wo(x),x=$T(P)}}return V0({width:p,height:m,x:c,y:d})}function rx(e,t){const n=nx(e).scrollLeft;return t?t.left+n:rd(Zl(e)).left+n}function BV(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-rx(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Bxe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const a=i==="fixed",o=Zl(r),s=t?tx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},d=Fl(1);const p=Fl(0),m=Wl(r);if((m||!m&&!a)&&((pp(r)!=="body"||Fg(o))&&(c=nx(r)),Wl(r))){const b=rd(r);d=Jd(r),p.x=b.x+r.clientLeft,p.y=b.y+r.clientTop}const y=o&&!m&&!a?BV(o,c):Fl(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+p.x+y.x,y:n.y*d.y-c.scrollTop*d.y+p.y+y.y}}function $xe(e){return Array.from(e.getClientRects())}function Fxe(e){const t=Zl(e),n=nx(e),r=e.ownerDocument.body,i=Fo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Fo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+rx(e);const s=-n.scrollTop;return dl(r).direction==="rtl"&&(o+=Fo(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}const a$=25;function qxe(e,t){const n=Wo(e),r=Zl(e),i=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;const p=mk();(!p||p&&t==="fixed")&&(s=i.offsetLeft,c=i.offsetTop)}const d=rx(r);if(d<=0){const p=r.ownerDocument,m=p.body,y=getComputedStyle(m),b=p.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,P=Math.abs(r.clientWidth-m.clientWidth-b);P<=a$&&(a-=P)}else d<=a$&&(a+=d);return{width:a,height:o,x:s,y:c}}const zxe=new Set(["absolute","fixed"]);function Uxe(e,t){const n=rd(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Wl(e)?Jd(e):Fl(1),o=e.clientWidth*a.x,s=e.clientHeight*a.y,c=i*a.x,d=r*a.y;return{width:o,height:s,x:c,y:d}}function o$(e,t,n){let r;if(t==="viewport")r=qxe(e,n);else if(t==="document")r=Fxe(Zl(e));else if(fl(t))r=Uxe(t,n);else{const i=DV(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return V0(r)}function $V(e,t){const n=zc(e);return n===t||!fl(n)||Gh(n)?!1:dl(n).position==="fixed"||$V(n,t)}function Vxe(e,t){const n=t.get(e);if(n)return n;let r=hg(e,[],!1).filter(s=>fl(s)&&pp(s)!=="body"),i=null;const a=dl(e).position==="fixed";let o=a?zc(e):e;for(;fl(o)&&!Gh(o);){const s=dl(o),c=pk(o);!c&&s.position==="fixed"&&(i=null),(a?!c&&!i:!c&&s.position==="static"&&!!i&&zxe.has(i.position)||Fg(o)&&!c&&$V(e,o))?r=r.filter(p=>p!==o):i=s,o=zc(o)}return t.set(e,r),r}function Wxe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?tx(t)?[]:Vxe(t,this._c):[].concat(n),r],s=o[0],c=o.reduce((d,p)=>{const m=o$(t,p,i);return d.top=Fo(m.top,d.top),d.right=qc(m.right,d.right),d.bottom=qc(m.bottom,d.bottom),d.left=Fo(m.left,d.left),d},o$(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Kxe(e){const{width:t,height:n}=IV(e);return{width:t,height:n}}function Hxe(e,t,n){const r=Wl(t),i=Zl(t),a=n==="fixed",o=rd(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const c=Fl(0);function d(){c.x=rx(i)}if(r||!r&&!a)if((pp(t)!=="body"||Fg(i))&&(s=nx(t)),r){const b=rd(t,!0,a,t);c.x=b.x+t.clientLeft,c.y=b.y+t.clientTop}else i&&d();a&&!r&&i&&d();const p=i&&!r&&!a?BV(i,s):Fl(0),m=o.left+s.scrollLeft-c.x-p.x,y=o.top+s.scrollTop-c.y-p.y;return{x:m,y,width:o.width,height:o.height}}function lj(e){return dl(e).position==="static"}function s$(e,t){if(!Wl(e)||dl(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Zl(e)===n&&(n=n.ownerDocument.body),n}function FV(e,t){const n=Wo(e);if(tx(e))return n;if(!Wl(e)){let i=zc(e);for(;i&&!Gh(i);){if(fl(i)&&!lj(i))return i;i=zc(i)}return n}let r=s$(e,t);for(;r&&Axe(r)&&lj(r);)r=s$(r,t);return r&&Gh(r)&&lj(r)&&!pk(r)?n:r||Rxe(e)||n}const Gxe=async function(e){const t=this.getOffsetParent||FV,n=this.getDimensions,r=await n(e.floating);return{reference:Hxe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zxe(e){return dl(e).direction==="rtl"}const Yxe={convertOffsetParentRelativeRectToViewportRelativeRect:Bxe,getDocumentElement:Zl,getClippingRect:Wxe,getOffsetParent:FV,getElementRects:Gxe,getClientRects:$xe,getDimensions:Kxe,getScale:Jd,isElement:fl,isRTL:Zxe};function qV(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xxe(e,t){let n=null,r;const i=Zl(e);function a(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();const d=e.getBoundingClientRect(),{left:p,top:m,width:y,height:b}=d;if(s||t(),!y||!b)return;const P=ry(m),x=ry(i.clientWidth-(p+y)),w=ry(i.clientHeight-(m+b)),T=ry(p),k={rootMargin:-P+"px "+-x+"px "+-w+"px "+-T+"px",threshold:Fo(0,qc(1,c))||1};let D=!0;function I(R){const $=R[0].intersectionRatio;if($!==c){if(!D)return o();$?o(!1,$):r=setTimeout(()=>{o(!1,1e-7)},1e3)}$===1&&!qV(d,e.getBoundingClientRect())&&o(),D=!1}try{n=new IntersectionObserver(I,{...k,root:i.ownerDocument})}catch{n=new IntersectionObserver(I,k)}n.observe(e)}return o(!0),a}function Qxe(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=gk(e),p=i||a?[...d?hg(d):[],...hg(t)]:[];p.forEach(T=>{i&&T.addEventListener("scroll",n,{passive:!0}),a&&T.addEventListener("resize",n)});const m=d&&s?Xxe(d,n):null;let y=-1,b=null;o&&(b=new ResizeObserver(T=>{let[E]=T;E&&E.target===d&&b&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var k;(k=b)==null||k.observe(t)})),n()}),d&&!c&&b.observe(d),b.observe(t));let P,x=c?rd(e):null;c&&w();function w(){const T=rd(e);x&&!qV(x,T)&&n(),x=T,P=requestAnimationFrame(w)}return n(),()=>{var T;p.forEach(E=>{i&&E.removeEventListener("scroll",n),a&&E.removeEventListener("resize",n)}),m==null||m(),(T=b)==null||T.disconnect(),b=null,c&&cancelAnimationFrame(P)}}const Jxe=Sxe,ewe=Pxe,twe=xxe,nwe=Oxe,rwe=wxe,l$=bxe,iwe=jxe,awe=(e,t,n)=>{const r=new Map,i={platform:Yxe,...n},a={...i.platform,_c:r};return yxe(e,t,{...i,platform:a})};var owe=typeof document<"u",swe=function(){},jy=owe?M.useLayoutEffect:swe;function W0(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!W0(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!(a==="_owner"&&e.$$typeof)&&!W0(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function zV(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function u$(e,t){const n=zV(e);return Math.round(t*n)/n}function uj(e){const t=M.useRef(e);return jy(()=>{t.current=e}),t}function lwe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:d}=e,[p,m]=M.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=M.useState(r);W0(y,r)||b(r);const[P,x]=M.useState(null),[w,T]=M.useState(null),E=M.useCallback(re=>{re!==R.current&&(R.current=re,x(re))},[]),k=M.useCallback(re=>{re!==$.current&&($.current=re,T(re))},[]),D=a||P,I=o||w,R=M.useRef(null),$=M.useRef(null),V=M.useRef(p),K=c!=null,Z=uj(c),ee=uj(i),ne=uj(d),oe=M.useCallback(()=>{if(!R.current||!$.current)return;const re={placement:t,strategy:n,middleware:y};ee.current&&(re.platform=ee.current),awe(R.current,$.current,re).then(Ce=>{const ae={...Ce,isPositioned:ne.current!==!1};he.current&&!W0(V.current,ae)&&(V.current=ae,Qh.flushSync(()=>{m(ae)}))})},[y,t,n,ee,ne]);jy(()=>{d===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,m(re=>({...re,isPositioned:!1})))},[d]);const he=M.useRef(!1);jy(()=>(he.current=!0,()=>{he.current=!1}),[]),jy(()=>{if(D&&(R.current=D),I&&($.current=I),D&&I){if(Z.current)return Z.current(D,I,oe);oe()}},[D,I,oe,Z,K]);const Se=M.useMemo(()=>({reference:R,floating:$,setReference:E,setFloating:k}),[E,k]),fe=M.useMemo(()=>({reference:D,floating:I}),[D,I]),Oe=M.useMemo(()=>{const re={position:n,left:0,top:0};if(!fe.floating)return re;const Ce=u$(fe.floating,p.x),ae=u$(fe.floating,p.y);return s?{...re,transform:"translate("+Ce+"px, "+ae+"px)",...zV(fe.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Ce,top:ae}},[n,s,fe.floating,p.x,p.y]);return M.useMemo(()=>({...p,update:oe,refs:Se,elements:fe,floatingStyles:Oe}),[p,oe,Se,fe,Oe])}const uwe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?l$({element:r.current,padding:i}).fn(n):{}:r?l$({element:r,padding:i}).fn(n):{}}}},cwe=(e,t)=>({...Jxe(e),options:[e,t]}),fwe=(e,t)=>({...ewe(e),options:[e,t]}),dwe=(e,t)=>({...iwe(e),options:[e,t]}),hwe=(e,t)=>({...twe(e),options:[e,t]}),pwe=(e,t)=>({...nwe(e),options:[e,t]}),mwe=(e,t)=>({...rwe(e),options:[e,t]}),gwe=(e,t)=>({...uwe(e),options:[e,t]});var vwe="Arrow",UV=M.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...a}=e;return h.jsx(Dn.svg,{...a,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});UV.displayName=vwe;var ywe=UV;function VV(e){const[t,n]=M.useState(void 0);return Ca(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const a=i[0];let o,s;if("borderBoxSize"in a){const c=a.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,s=d.blockSize}else o=e.offsetWidth,s=e.offsetHeight;n({width:o,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var vk="Popper",[WV,KV]=gd(vk),[bwe,HV]=WV(vk),GV=e=>{const{__scopePopper:t,children:n}=e,[r,i]=M.useState(null);return h.jsx(bwe,{scope:t,anchor:r,onAnchorChange:i,children:n})};GV.displayName=vk;var ZV="PopperAnchor",YV=M.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,a=HV(ZV,n),o=M.useRef(null),s=Er(t,o),c=M.useRef(null);return M.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||o.current,d!==c.current&&a.onAnchorChange(c.current)}),r?null:h.jsx(Dn.div,{...i,ref:s})});YV.displayName=ZV;var yk="PopperContent",[xwe,wwe]=WV(yk),XV=M.forwardRef((e,t)=>{var Ye,rt,ze,Fe,st,Te;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:a="center",alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:P,...x}=e,w=HV(yk,n),[T,E]=M.useState(null),k=Er(t,Dt=>E(Dt)),[D,I]=M.useState(null),R=VV(D),$=(R==null?void 0:R.width)??0,V=(R==null?void 0:R.height)??0,K=r+(a!=="center"?"-"+a:""),Z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},ee=Array.isArray(d)?d:[d],ne=ee.length>0,oe={padding:Z,boundary:ee.filter(Swe),altBoundary:ne},{refs:he,floatingStyles:Se,placement:fe,isPositioned:Oe,middlewareData:re}=lwe({strategy:"fixed",placement:K,whileElementsMounted:(...Dt)=>Qxe(...Dt,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[cwe({mainAxis:i+V,alignmentAxis:o}),c&&fwe({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?dwe():void 0,...oe}),c&&hwe({...oe}),pwe({...oe,apply:({elements:Dt,rects:Lt,availableWidth:dn,availableHeight:xn})=>{const{width:qn,height:Ar}=Lt.reference,Zr=Dt.floating.style;Zr.setProperty("--radix-popper-available-width",`${dn}px`),Zr.setProperty("--radix-popper-available-height",`${xn}px`),Zr.setProperty("--radix-popper-anchor-width",`${qn}px`),Zr.setProperty("--radix-popper-anchor-height",`${Ar}px`)}}),D&&gwe({element:D,padding:s}),Pwe({arrowWidth:$,arrowHeight:V}),y&&mwe({strategy:"referenceHidden",...oe})]}),[Ce,ae]=e8(fe),ie=Fc(P);Ca(()=>{Oe&&(ie==null||ie())},[Oe,ie]);const de=(Ye=re.arrow)==null?void 0:Ye.x,He=(rt=re.arrow)==null?void 0:rt.y,je=((ze=re.arrow)==null?void 0:ze.centerOffset)!==0,[$e,We]=M.useState();return Ca(()=>{T&&We(window.getComputedStyle(T).zIndex)},[T]),h.jsx("div",{ref:he.setFloating,"data-radix-popper-content-wrapper":"",style:{...Se,transform:Oe?Se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:$e,"--radix-popper-transform-origin":[(Fe=re.transformOrigin)==null?void 0:Fe.x,(st=re.transformOrigin)==null?void 0:st.y].join(" "),...((Te=re.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(xwe,{scope:n,placedSide:Ce,onArrowChange:I,arrowX:de,arrowY:He,shouldHideArrow:je,children:h.jsx(Dn.div,{"data-side":Ce,"data-align":ae,...x,ref:k,style:{...x.style,animation:Oe?void 0:"none"}})})})});XV.displayName=yk;var QV="PopperArrow",_we={top:"bottom",right:"left",bottom:"top",left:"right"},JV=M.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,a=wwe(QV,r),o=_we[a.placedSide];return h.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:h.jsx(ywe,{...i,ref:n,style:{...i.style,display:"block"}})})});JV.displayName=QV;function Swe(e){return e!==null}var Pwe=e=>({name:"transformOrigin",options:e,fn(t){var w,T,E;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,s=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[d,p]=e8(n),m={start:"0%",center:"50%",end:"100%"}[p],y=(((T=i.arrow)==null?void 0:T.x)??0)+s/2,b=(((E=i.arrow)==null?void 0:E.y)??0)+c/2;let P="",x="";return d==="bottom"?(P=o?m:`${y}px`,x=`${-c}px`):d==="top"?(P=o?m:`${y}px`,x=`${r.floating.height+c}px`):d==="right"?(P=`${-c}px`,x=o?m:`${b}px`):d==="left"&&(P=`${r.floating.width+c}px`,x=o?m:`${b}px`),{data:{x:P,y:x}}}});function e8(e){const[t,n="center"]=e.split("-");return[t,n]}var jwe=GV,Owe=YV,Twe=XV,Ewe=JV,Awe="Portal",bk=M.forwardRef((e,t)=>{var s;const{container:n,...r}=e,[i,a]=M.useState(!1);Ca(()=>a(!0),[]);const o=n||i&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return o?iG.createPortal(h.jsx(Dn.div,{...r,ref:t}),o):null});bk.displayName=Awe;function kwe(e){const t=Cwe(e),n=M.forwardRef((r,i)=>{const{children:a,...o}=r,s=M.Children.toArray(a),c=s.find(Mwe);if(c){const d=c.props.children,p=s.map(m=>m===c?M.Children.count(d)>1?M.Children.only(null):M.isValidElement(d)?d.props.children:null:m);return h.jsx(t,{...o,ref:i,children:M.isValidElement(d)?M.cloneElement(d,void 0,p):null})}return h.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function Cwe(e){const t=M.forwardRef((n,r)=>{const{children:i,...a}=n;if(M.isValidElement(i)){const o=Lwe(i),s=Rwe(a,i.props);return i.type!==M.Fragment&&(s.ref=r?dp(r,o):o),M.cloneElement(i,s)}return M.Children.count(i)>1?M.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nwe=Symbol("radix.slottable");function Mwe(e){return M.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Nwe}function Rwe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{const c=a(...s);return i(...s),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function Lwe(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Iwe=X0[" useInsertionEffect ".trim().toString()]||Ca;function Zh({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,a,o]=Dwe({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{const p=M.useRef(e!==void 0);M.useEffect(()=>{const m=p.current;m!==s&&console.warn(`${r} is changing from ${m?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=s},[s,r])}const d=M.useCallback(p=>{var m;if(s){const y=Bwe(p)?p(e):p;y!==e&&((m=o.current)==null||m.call(o,y))}else a(p)},[s,e,a,o]);return[c,d]}function Dwe({defaultProp:e,onChange:t}){const[n,r]=M.useState(e),i=M.useRef(n),a=M.useRef(t);return Iwe(()=>{a.current=t},[t]),M.useEffect(()=>{var o;i.current!==n&&((o=a.current)==null||o.call(a,n),i.current=n)},[n,i]),[n,r,a]}function Bwe(e){return typeof e=="function"}function t8(e){const t=M.useRef({value:e,previous:e});return M.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var n8=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),$we="VisuallyHidden",Fwe=M.forwardRef((e,t)=>h.jsx(Dn.span,{...e,ref:t,style:{...n8,...e.style}}));Fwe.displayName=$we;var qwe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Id=new WeakMap,iy=new WeakMap,ay={},cj=0,r8=function(e){return e&&(e.host||r8(e.parentNode))},zwe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=r8(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Uwe=function(e,t,n,r){var i=zwe(t,Array.isArray(e)?e:[e]);ay[n]||(ay[n]=new WeakMap);var a=ay[n],o=[],s=new Set,c=new Set(i),d=function(m){!m||s.has(m)||(s.add(m),d(m.parentNode))};i.forEach(d);var p=function(m){!m||c.has(m)||Array.prototype.forEach.call(m.children,function(y){if(s.has(y))p(y);else try{var b=y.getAttribute(r),P=b!==null&&b!=="false",x=(Id.get(y)||0)+1,w=(a.get(y)||0)+1;Id.set(y,x),a.set(y,w),o.push(y),x===1&&P&&iy.set(y,!0),w===1&&y.setAttribute(n,"true"),P||y.setAttribute(r,"true")}catch(T){console.error("aria-hidden: cannot operate on ",y,T)}})};return p(t),s.clear(),cj++,function(){o.forEach(function(m){var y=Id.get(m)-1,b=a.get(m)-1;Id.set(m,y),a.set(m,b),y||(iy.has(m)||m.removeAttribute(r),iy.delete(m)),b||m.removeAttribute(n)}),cj--,cj||(Id=new WeakMap,Id=new WeakMap,iy=new WeakMap,ay={})}},i8=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=qwe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Uwe(r,i,n,"aria-hidden")):function(){return null}},kl=function(){return kl=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return o_e;var t=s_e(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},u_e=l8(),eh="data-scroll-locked",c_e=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n="margin"),` .`.concat(Wwe,` { overflow: hidden `).concat(r,`; padding-right: `).concat(s,"px ").concat(r,`; } body[`).concat(eh,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` padding-left: `.concat(i,`px; padding-top: `).concat(a,`px; padding-right: `).concat(o,`px; margin-left:0; margin-top:0; margin-right: `).concat(s,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(Oy,` { right: `).concat(s,"px ").concat(r,`; } .`).concat(Ty,` { margin-right: `).concat(s,"px ").concat(r,`; } .`).concat(Oy," .").concat(Oy,` { right: 0 `).concat(r,`; } .`).concat(Ty," .").concat(Ty,` { margin-right: 0 `).concat(r,`; } body[`).concat(eh,`] { `).concat(Kwe,": ").concat(s,`px; } `)},f$=function(){var e=parseInt(document.body.getAttribute(eh)||"0",10);return isFinite(e)?e:0},f_e=function(){M.useEffect(function(){return document.body.setAttribute(eh,(f$()+1).toString()),function(){var e=f$()-1;e<=0?document.body.removeAttribute(eh):document.body.setAttribute(eh,e.toString())}},[])},d_e=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;f_e();var a=M.useMemo(function(){return l_e(i)},[i]);return M.createElement(u_e,{styles:c_e(a,!t,i,n?"":"!important")})},FT=!1;if(typeof window<"u")try{var oy=Object.defineProperty({},"passive",{get:function(){return FT=!0,!0}});window.addEventListener("test",oy,oy),window.removeEventListener("test",oy,oy)}catch{FT=!1}var Dd=FT?{passive:!1}:!1,h_e=function(e){return e.tagName==="TEXTAREA"},u8=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!h_e(e)&&n[t]==="visible")},p_e=function(e){return u8(e,"overflowY")},m_e=function(e){return u8(e,"overflowX")},d$=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=c8(e,r);if(i){var a=f8(e,r),o=a[1],s=a[2];if(o>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},g_e=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},v_e=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},c8=function(e,t){return e==="v"?p_e(t):m_e(t)},f8=function(e,t){return e==="v"?g_e(t):v_e(t)},y_e=function(e,t){return e==="h"&&t==="rtl"?-1:1},b_e=function(e,t,n,r,i){var a=y_e(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),d=!1,p=o>0,m=0,y=0;do{if(!s)break;var b=f8(e,s),P=b[0],x=b[1],w=b[2],T=x-w-a*P;(P||T)&&c8(e,s)&&(m+=T,y+=P);var E=s.parentNode;s=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(p&&Math.abs(m)<1||!p&&Math.abs(y)<1)&&(d=!0),d},sy=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},h$=function(e){return[e.deltaX,e.deltaY]},p$=function(e){return e&&"current"in e?e.current:e},x_e=function(e,t){return e[0]===t[0]&&e[1]===t[1]},w_e=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},__e=0,Bd=[];function S_e(e){var t=M.useRef([]),n=M.useRef([0,0]),r=M.useRef(),i=M.useState(__e++)[0],a=M.useState(l8)[0],o=M.useRef(e);M.useEffect(function(){o.current=e},[e]),M.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var x=Vwe([e.lockRef.current],(e.shards||[]).map(p$),!0).filter(Boolean);return x.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),x.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var s=M.useCallback(function(x,w){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!o.current.allowPinchZoom;var T=sy(x),E=n.current,k="deltaX"in x?x.deltaX:E[0]-T[0],D="deltaY"in x?x.deltaY:E[1]-T[1],I,R=x.target,$=Math.abs(k)>Math.abs(D)?"h":"v";if("touches"in x&&$==="h"&&R.type==="range")return!1;var V=window.getSelection(),K=V&&V.anchorNode,Z=K?K===R||K.contains(R):!1;if(Z)return!1;var ee=d$($,R);if(!ee)return!0;if(ee?I=$:(I=$==="v"?"h":"v",ee=d$($,R)),!ee)return!1;if(!r.current&&"changedTouches"in x&&(k||D)&&(r.current=I),!I)return!0;var ne=r.current||I;return b_e(ne,w,x,ne==="h"?k:D)},[]),c=M.useCallback(function(x){var w=x;if(!(!Bd.length||Bd[Bd.length-1]!==a)){var T="deltaY"in w?h$(w):sy(w),E=t.current.filter(function(I){return I.name===w.type&&(I.target===w.target||w.target===I.shadowParent)&&x_e(I.delta,T)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var k=(o.current.shards||[]).map(p$).filter(Boolean).filter(function(I){return I.contains(w.target)}),D=k.length>0?s(w,k[0]):!o.current.noIsolation;D&&w.cancelable&&w.preventDefault()}}},[]),d=M.useCallback(function(x,w,T,E){var k={name:x,delta:w,target:T,should:E,shadowParent:P_e(T)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(D){return D!==k})},1)},[]),p=M.useCallback(function(x){n.current=sy(x),r.current=void 0},[]),m=M.useCallback(function(x){d(x.type,h$(x),x.target,s(x,e.lockRef.current))},[]),y=M.useCallback(function(x){d(x.type,sy(x),x.target,s(x,e.lockRef.current))},[]);M.useEffect(function(){return Bd.push(a),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:y}),document.addEventListener("wheel",c,Dd),document.addEventListener("touchmove",c,Dd),document.addEventListener("touchstart",p,Dd),function(){Bd=Bd.filter(function(x){return x!==a}),document.removeEventListener("wheel",c,Dd),document.removeEventListener("touchmove",c,Dd),document.removeEventListener("touchstart",p,Dd)}},[]);var b=e.removeScrollBar,P=e.inert;return M.createElement(M.Fragment,null,P?M.createElement(a,{styles:w_e(i)}):null,b?M.createElement(d_e,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function P_e(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const j_e=Jwe(s8,S_e);var xk=M.forwardRef(function(e,t){return M.createElement(ix,kl({},e,{ref:t,sideCar:j_e}))});xk.classNames=ix.classNames;var O_e=[" ","Enter","ArrowUp","ArrowDown"],T_e=[" ","Enter"],id="Select",[ax,ox,E_e]=TV(id),[mp]=gd(id,[E_e,KV]),sx=KV(),[A_e,Xc]=mp(id),[k_e,C_e]=mp(id),d8=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:d,name:p,autoComplete:m,disabled:y,required:b,form:P}=e,x=sx(t),[w,T]=M.useState(null),[E,k]=M.useState(null),[D,I]=M.useState(!1),R=lk(d),[$,V]=Zh({prop:r,defaultProp:i??!1,onChange:a,caller:id}),[K,Z]=Zh({prop:o,defaultProp:s,onChange:c,caller:id}),ee=M.useRef(null),ne=w?P||!!w.closest("form"):!0,[oe,he]=M.useState(new Set),Se=Array.from(oe).map(fe=>fe.props.value).join(";");return h.jsx(jwe,{...x,children:h.jsxs(A_e,{required:b,scope:t,trigger:w,onTriggerChange:T,valueNode:E,onValueNodeChange:k,valueNodeHasChildren:D,onValueNodeHasChildrenChange:I,contentId:Rc(),value:K,onValueChange:Z,open:$,onOpenChange:V,dir:R,triggerPointerDownPosRef:ee,disabled:y,children:[h.jsx(ax.Provider,{scope:t,children:h.jsx(k_e,{scope:e.__scopeSelect,onNativeOptionAdd:M.useCallback(fe=>{he(Oe=>new Set(Oe).add(fe))},[]),onNativeOptionRemove:M.useCallback(fe=>{he(Oe=>{const re=new Set(Oe);return re.delete(fe),re})},[]),children:n})}),ne?h.jsxs(I8,{"aria-hidden":!0,required:b,tabIndex:-1,name:p,autoComplete:m,value:K,onChange:fe=>Z(fe.target.value),disabled:y,form:P,children:[K===void 0?h.jsx("option",{value:""}):null,Array.from(oe)]},Se):null]})})};d8.displayName=id;var h8="SelectTrigger",p8=M.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,a=sx(n),o=Xc(h8,n),s=o.disabled||r,c=Er(t,o.onTriggerChange),d=ox(n),p=M.useRef("touch"),[m,y,b]=B8(x=>{const w=d().filter(k=>!k.disabled),T=w.find(k=>k.value===o.value),E=$8(w,x,T);E!==void 0&&o.onValueChange(E.value)}),P=x=>{s||(o.onOpenChange(!0),b()),x&&(o.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return h.jsx(Owe,{asChild:!0,...a,children:h.jsx(Dn.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":D8(o.value)?"":void 0,...i,ref:c,onClick:Mn(i.onClick,x=>{x.currentTarget.focus(),p.current!=="mouse"&&P(x)}),onPointerDown:Mn(i.onPointerDown,x=>{p.current=x.pointerType;const w=x.target;w.hasPointerCapture(x.pointerId)&&w.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(P(x),x.preventDefault())}),onKeyDown:Mn(i.onKeyDown,x=>{const w=m.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&y(x.key),!(w&&x.key===" ")&&O_e.includes(x.key)&&(P(),x.preventDefault())})})})});p8.displayName=h8;var m8="SelectValue",g8=M.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...s}=e,c=Xc(m8,n),{onValueNodeHasChildrenChange:d}=c,p=a!==void 0,m=Er(t,c.onValueNodeChange);return Ca(()=>{d(p)},[d,p]),h.jsx(Dn.span,{...s,ref:m,style:{pointerEvents:"none"},children:D8(c.value)?h.jsx(h.Fragment,{children:o}):a})});g8.displayName=m8;var N_e="SelectIcon",v8=M.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return h.jsx(Dn.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});v8.displayName=N_e;var M_e="SelectPortal",y8=e=>h.jsx(bk,{asChild:!0,...e});y8.displayName=M_e;var ad="SelectContent",b8=M.forwardRef((e,t)=>{const n=Xc(ad,e.__scopeSelect),[r,i]=M.useState();if(Ca(()=>{i(new DocumentFragment)},[]),!n.open){const a=r;return a?Qh.createPortal(h.jsx(x8,{scope:e.__scopeSelect,children:h.jsx(ax.Slot,{scope:e.__scopeSelect,children:h.jsx("div",{children:e.children})})}),a):null}return h.jsx(w8,{...e,ref:t})});b8.displayName=ad;var Js=10,[x8,Qc]=mp(ad),R_e="SelectContentImpl",L_e=kwe("SelectContent.RemoveScroll"),w8=M.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:d,alignOffset:p,arrowPadding:m,collisionBoundary:y,collisionPadding:b,sticky:P,hideWhenDetached:x,avoidCollisions:w,...T}=e,E=Xc(ad,n),[k,D]=M.useState(null),[I,R]=M.useState(null),$=Er(t,Ye=>D(Ye)),[V,K]=M.useState(null),[Z,ee]=M.useState(null),ne=ox(n),[oe,he]=M.useState(!1),Se=M.useRef(!1);M.useEffect(()=>{if(k)return i8(k)},[k]),kV();const fe=M.useCallback(Ye=>{const[rt,...ze]=ne().map(Te=>Te.ref.current),[Fe]=ze.slice(-1),st=document.activeElement;for(const Te of Ye)if(Te===st||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===rt&&I&&(I.scrollTop=0),Te===Fe&&I&&(I.scrollTop=I.scrollHeight),Te==null||Te.focus(),document.activeElement!==st))return},[ne,I]),Oe=M.useCallback(()=>fe([V,k]),[fe,V,k]);M.useEffect(()=>{oe&&Oe()},[oe,Oe]);const{onOpenChange:re,triggerPointerDownPosRef:Ce}=E;M.useEffect(()=>{if(k){let Ye={x:0,y:0};const rt=Fe=>{var st,Te;Ye={x:Math.abs(Math.round(Fe.pageX)-(((st=Ce.current)==null?void 0:st.x)??0)),y:Math.abs(Math.round(Fe.pageY)-(((Te=Ce.current)==null?void 0:Te.y)??0))}},ze=Fe=>{Ye.x<=10&&Ye.y<=10?Fe.preventDefault():k.contains(Fe.target)||re(!1),document.removeEventListener("pointermove",rt),Ce.current=null};return Ce.current!==null&&(document.addEventListener("pointermove",rt),document.addEventListener("pointerup",ze,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",rt),document.removeEventListener("pointerup",ze,{capture:!0})}}},[k,re,Ce]),M.useEffect(()=>{const Ye=()=>re(!1);return window.addEventListener("blur",Ye),window.addEventListener("resize",Ye),()=>{window.removeEventListener("blur",Ye),window.removeEventListener("resize",Ye)}},[re]);const[ae,ie]=B8(Ye=>{const rt=ne().filter(st=>!st.disabled),ze=rt.find(st=>st.ref.current===document.activeElement),Fe=$8(rt,Ye,ze);Fe&&setTimeout(()=>Fe.ref.current.focus())}),de=M.useCallback((Ye,rt,ze)=>{const Fe=!Se.current&&!ze;(E.value!==void 0&&E.value===rt||Fe)&&(K(Ye),Fe&&(Se.current=!0))},[E.value]),He=M.useCallback(()=>k==null?void 0:k.focus(),[k]),je=M.useCallback((Ye,rt,ze)=>{const Fe=!Se.current&&!ze;(E.value!==void 0&&E.value===rt||Fe)&&ee(Ye)},[E.value]),$e=r==="popper"?qT:_8,We=$e===qT?{side:s,sideOffset:c,align:d,alignOffset:p,arrowPadding:m,collisionBoundary:y,collisionPadding:b,sticky:P,hideWhenDetached:x,avoidCollisions:w}:{};return h.jsx(x8,{scope:n,content:k,viewport:I,onViewportChange:R,itemRefCallback:de,selectedItem:V,onItemLeave:He,itemTextRefCallback:je,focusSelectedItem:Oe,selectedItemText:Z,position:r,isPositioned:oe,searchRef:ae,children:h.jsx(xk,{as:L_e,allowPinchZoom:!0,children:h.jsx(ck,{asChild:!0,trapped:E.open,onMountAutoFocus:Ye=>{Ye.preventDefault()},onUnmountAutoFocus:Mn(i,Ye=>{var rt;(rt=E.trigger)==null||rt.focus({preventScroll:!0}),Ye.preventDefault()}),children:h.jsx(uk,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:Ye=>Ye.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:h.jsx($e,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:Ye=>Ye.preventDefault(),...T,...We,onPlaced:()=>he(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...T.style},onKeyDown:Mn(T.onKeyDown,Ye=>{const rt=Ye.ctrlKey||Ye.altKey||Ye.metaKey;if(Ye.key==="Tab"&&Ye.preventDefault(),!rt&&Ye.key.length===1&&ie(Ye.key),["ArrowUp","ArrowDown","Home","End"].includes(Ye.key)){let Fe=ne().filter(st=>!st.disabled).map(st=>st.ref.current);if(["ArrowUp","End"].includes(Ye.key)&&(Fe=Fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ye.key)){const st=Ye.target,Te=Fe.indexOf(st);Fe=Fe.slice(Te+1)}setTimeout(()=>fe(Fe)),Ye.preventDefault()}})})})})})})});w8.displayName=R_e;var I_e="SelectItemAlignedPosition",_8=M.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,a=Xc(ad,n),o=Qc(ad,n),[s,c]=M.useState(null),[d,p]=M.useState(null),m=Er(t,$=>p($)),y=ox(n),b=M.useRef(!1),P=M.useRef(!0),{viewport:x,selectedItem:w,selectedItemText:T,focusSelectedItem:E}=o,k=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&d&&x&&w&&T){const $=a.trigger.getBoundingClientRect(),V=d.getBoundingClientRect(),K=a.valueNode.getBoundingClientRect(),Z=T.getBoundingClientRect();if(a.dir!=="rtl"){const st=Z.left-V.left,Te=K.left-st,Dt=$.left-Te,Lt=$.width+Dt,dn=Math.max(Lt,V.width),xn=window.innerWidth-Js,qn=V3(Te,[Js,Math.max(Js,xn-dn)]);s.style.minWidth=Lt+"px",s.style.left=qn+"px"}else{const st=V.right-Z.right,Te=window.innerWidth-K.right-st,Dt=window.innerWidth-$.right-Te,Lt=$.width+Dt,dn=Math.max(Lt,V.width),xn=window.innerWidth-Js,qn=V3(Te,[Js,Math.max(Js,xn-dn)]);s.style.minWidth=Lt+"px",s.style.right=qn+"px"}const ee=y(),ne=window.innerHeight-Js*2,oe=x.scrollHeight,he=window.getComputedStyle(d),Se=parseInt(he.borderTopWidth,10),fe=parseInt(he.paddingTop,10),Oe=parseInt(he.borderBottomWidth,10),re=parseInt(he.paddingBottom,10),Ce=Se+fe+oe+re+Oe,ae=Math.min(w.offsetHeight*5,Ce),ie=window.getComputedStyle(x),de=parseInt(ie.paddingTop,10),He=parseInt(ie.paddingBottom,10),je=$.top+$.height/2-Js,$e=ne-je,We=w.offsetHeight/2,Ye=w.offsetTop+We,rt=Se+fe+Ye,ze=Ce-rt;if(rt<=je){const st=ee.length>0&&w===ee[ee.length-1].ref.current;s.style.bottom="0px";const Te=d.clientHeight-x.offsetTop-x.offsetHeight,Dt=Math.max($e,We+(st?He:0)+Te+Oe),Lt=rt+Dt;s.style.height=Lt+"px"}else{const st=ee.length>0&&w===ee[0].ref.current;s.style.top="0px";const Dt=Math.max(je,Se+x.offsetTop+(st?de:0)+We)+ze;s.style.height=Dt+"px",x.scrollTop=rt-je+x.offsetTop}s.style.margin=`${Js}px 0`,s.style.minHeight=ae+"px",s.style.maxHeight=ne+"px",r==null||r(),requestAnimationFrame(()=>b.current=!0)}},[y,a.trigger,a.valueNode,s,d,x,w,T,a.dir,r]);Ca(()=>k(),[k]);const[D,I]=M.useState();Ca(()=>{d&&I(window.getComputedStyle(d).zIndex)},[d]);const R=M.useCallback($=>{$&&P.current===!0&&(k(),E==null||E(),P.current=!1)},[k,E]);return h.jsx(B_e,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:b,onScrollButtonChange:R,children:h.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:D},children:h.jsx(Dn.div,{...i,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});_8.displayName=I_e;var D_e="SelectPopperPosition",qT=M.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Js,...a}=e,o=sx(n);return h.jsx(Twe,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});qT.displayName=D_e;var[B_e,wk]=mp(ad,{}),zT="SelectViewport",S8=M.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,a=Qc(zT,n),o=wk(zT,n),s=Er(t,a.onViewportChange),c=M.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(ax.Slot,{scope:n,children:h.jsx(Dn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Mn(i.onScroll,d=>{const p=d.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:y}=o;if(y!=null&&y.current&&m){const b=Math.abs(c.current-p.scrollTop);if(b>0){const P=window.innerHeight-Js*2,x=parseFloat(m.style.minHeight),w=parseFloat(m.style.height),T=Math.max(x,w);if(T0?D:0,m.style.justifyContent="flex-end")}}}c.current=p.scrollTop})})})]})});S8.displayName=zT;var P8="SelectGroup",[$_e,F_e]=mp(P8),q_e=M.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Rc();return h.jsx($_e,{scope:n,id:i,children:h.jsx(Dn.div,{role:"group","aria-labelledby":i,...r,ref:t})})});q_e.displayName=P8;var j8="SelectLabel",O8=M.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=F_e(j8,n);return h.jsx(Dn.div,{id:i.id,...r,ref:t})});O8.displayName=j8;var K0="SelectItem",[z_e,T8]=mp(K0),E8=M.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Xc(K0,n),c=Qc(K0,n),d=s.value===r,[p,m]=M.useState(a??""),[y,b]=M.useState(!1),P=Er(t,E=>{var k;return(k=c.itemRefCallback)==null?void 0:k.call(c,E,r,i)}),x=Rc(),w=M.useRef("touch"),T=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx(z_e,{scope:n,value:r,disabled:i,textId:x,isSelected:d,onItemTextChange:M.useCallback(E=>{m(k=>k||((E==null?void 0:E.textContent)??"").trim())},[]),children:h.jsx(ax.ItemSlot,{scope:n,value:r,disabled:i,textValue:p,children:h.jsx(Dn.div,{role:"option","aria-labelledby":x,"data-highlighted":y?"":void 0,"aria-selected":d&&y,"data-state":d?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:P,onFocus:Mn(o.onFocus,()=>b(!0)),onBlur:Mn(o.onBlur,()=>b(!1)),onClick:Mn(o.onClick,()=>{w.current!=="mouse"&&T()}),onPointerUp:Mn(o.onPointerUp,()=>{w.current==="mouse"&&T()}),onPointerDown:Mn(o.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:Mn(o.onPointerMove,E=>{var k;w.current=E.pointerType,i?(k=c.onItemLeave)==null||k.call(c):w.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Mn(o.onPointerLeave,E=>{var k;E.currentTarget===document.activeElement&&((k=c.onItemLeave)==null||k.call(c))}),onKeyDown:Mn(o.onKeyDown,E=>{var D;((D=c.searchRef)==null?void 0:D.current)!==""&&E.key===" "||(T_e.includes(E.key)&&T(),E.key===" "&&E.preventDefault())})})})})});E8.displayName=K0;var lm="SelectItemText",A8=M.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...a}=e,o=Xc(lm,n),s=Qc(lm,n),c=T8(lm,n),d=C_e(lm,n),[p,m]=M.useState(null),y=Er(t,T=>m(T),c.onItemTextChange,T=>{var E;return(E=s.itemTextRefCallback)==null?void 0:E.call(s,T,c.value,c.disabled)}),b=p==null?void 0:p.textContent,P=M.useMemo(()=>h.jsx("option",{value:c.value,disabled:c.disabled,children:b},c.value),[c.disabled,c.value,b]),{onNativeOptionAdd:x,onNativeOptionRemove:w}=d;return Ca(()=>(x(P),()=>w(P)),[x,w,P]),h.jsxs(h.Fragment,{children:[h.jsx(Dn.span,{id:c.textId,...a,ref:y}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Qh.createPortal(a.children,o.valueNode):null]})});A8.displayName=lm;var k8="SelectItemIndicator",C8=M.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return T8(k8,n).isSelected?h.jsx(Dn.span,{"aria-hidden":!0,...r,ref:t}):null});C8.displayName=k8;var UT="SelectScrollUpButton",N8=M.forwardRef((e,t)=>{const n=Qc(UT,e.__scopeSelect),r=wk(UT,e.__scopeSelect),[i,a]=M.useState(!1),o=Er(t,r.onScrollButtonChange);return Ca(()=>{if(n.viewport&&n.isPositioned){let s=function(){const d=c.scrollTop>0;a(d)};const c=n.viewport;return s(),c.addEventListener("scroll",s),()=>c.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),i?h.jsx(R8,{...e,ref:o,onAutoScroll:()=>{const{viewport:s,selectedItem:c}=n;s&&c&&(s.scrollTop=s.scrollTop-c.offsetHeight)}}):null});N8.displayName=UT;var VT="SelectScrollDownButton",M8=M.forwardRef((e,t)=>{const n=Qc(VT,e.__scopeSelect),r=wk(VT,e.__scopeSelect),[i,a]=M.useState(!1),o=Er(t,r.onScrollButtonChange);return Ca(()=>{if(n.viewport&&n.isPositioned){let s=function(){const d=c.scrollHeight-c.clientHeight,p=Math.ceil(c.scrollTop)c.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),i?h.jsx(R8,{...e,ref:o,onAutoScroll:()=>{const{viewport:s,selectedItem:c}=n;s&&c&&(s.scrollTop=s.scrollTop+c.offsetHeight)}}):null});M8.displayName=VT;var R8=M.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Qc("SelectScrollButton",n),o=M.useRef(null),s=ox(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),Ca(()=>{var p;const d=s().find(m=>m.ref.current===document.activeElement);(p=d==null?void 0:d.ref.current)==null||p.scrollIntoView({block:"nearest"})},[s]),h.jsx(Dn.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Mn(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Mn(i.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Mn(i.onPointerLeave,()=>{c()})})}),U_e="SelectSeparator",L8=M.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return h.jsx(Dn.div,{"aria-hidden":!0,...r,ref:t})});L8.displayName=U_e;var WT="SelectArrow",V_e=M.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=sx(n),a=Xc(WT,n),o=Qc(WT,n);return a.open&&o.position==="popper"?h.jsx(Ewe,{...i,...r,ref:t}):null});V_e.displayName=WT;var W_e="SelectBubbleInput",I8=M.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=M.useRef(null),a=Er(r,i),o=t8(t);return M.useEffect(()=>{const s=i.current;if(!s)return;const c=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==t&&p){const m=new Event("change",{bubbles:!0});p.call(s,t),s.dispatchEvent(m)}},[o,t]),h.jsx(Dn.select,{...n,style:{...n8,...n.style},ref:a,defaultValue:t})});I8.displayName=W_e;function D8(e){return e===""||e===void 0}function B8(e){const t=Fc(e),n=M.useRef(""),r=M.useRef(0),i=M.useCallback(o=>{const s=n.current+o;t(s),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(s)},[t]),a=M.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function $8(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let o=K_e(e,Math.max(a,0));i.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function K_e(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var H_e=d8,F8=p8,G_e=g8,Z_e=v8,Y_e=y8,q8=b8,X_e=S8,z8=O8,U8=E8,Q_e=A8,J_e=C8,V8=N8,W8=M8,K8=L8;const Hr=H_e,Gr=G_e,Dr=M.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(F8,{ref:r,className:fn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(Z_e,{asChild:!0,children:h.jsx(X$,{className:"h-4 w-4 opacity-50"})})]}));Dr.displayName=F8.displayName;const H8=M.forwardRef(({className:e,...t},n)=>h.jsx(V8,{ref:n,className:fn("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(OH,{className:"h-4 w-4"})}));H8.displayName=V8.displayName;const G8=M.forwardRef(({className:e,...t},n)=>h.jsx(W8,{ref:n,className:fn("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(X$,{className:"h-4 w-4"})}));G8.displayName=W8.displayName;const Br=M.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>h.jsx(Y_e,{children:h.jsxs(q8,{ref:i,className:fn("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(H8,{}),h.jsx(X_e,{className:fn("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(G8,{})]})}));Br.displayName=q8.displayName;const e1e=M.forwardRef(({className:e,...t},n)=>h.jsx(z8,{ref:n,className:fn("px-2 py-1.5 text-sm font-semibold",e),...t}));e1e.displayName=z8.displayName;const Kt=M.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(U8,{ref:r,className:fn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(J_e,{children:h.jsx(Y$,{className:"h-4 w-4"})})}),h.jsx(Q_e,{children:t})]}));Kt.displayName=U8.displayName;const t1e=M.forwardRef(({className:e,...t},n)=>h.jsx(K8,{ref:n,className:fn("-mx-1 my-1 h-px bg-muted",e),...t}));t1e.displayName=K8.displayName;var pj={exports:{}},m$;function n1e(){return m$||(m$=1,(function(e,t){var n=void 0,r=function(i){return n||(n=new Promise(function(a,o){var Xi,Rs;var s=typeof i<"u"?i:{},c=s.onAbort;s.onAbort=function(A){o(new Error(A)),c&&c(A)},s.postRun=s.postRun||[],s.postRun.push(function(){a(s)}),e=void 0;var d;d||(d=typeof s<"u"?s:{});var p=!!globalThis.window,m=!!globalThis.WorkerGlobalScope;d.onRuntimeInitialized=function(){function A(Ne,Ze){switch(typeof Ze){case"boolean":Jl(Ne,Ze?1:0);break;case"number":qa(Ne,Ze);break;case"string":rs(Ne,Ze,-1,-1);break;case"object":if(Ze===null)$s(Ne);else if(Ze.length!=null){var jt=oo(Ze.length);R.set(Ze,jt),va(Ne,jt,Ze.length,-1),sr(jt)}else Qi(Ne,"Wrong API use : tried to return a value of an unknown type ("+Ze+").",-1);break;default:$s(Ne)}}function q(Ne,Ze){for(var jt=[],$t=0;$t>>0),Ne!=null){var Ze=this.filename,jt="/",$t=Ze;if(jt&&(jt=typeof jt=="string"?jt:Go(jt),$t=Ze?Lt(jt+"/"+Ze):jt),Ze=Na(!0,!0),$t=ha($t,Ze),Ne){if(typeof Ne=="string"){jt=Array(Ne.length);for(var an=0,Tn=Ne.length;anNumber.MAX_SAFE_INTEGER)throw"rowId too big to fit inside a Number";Ne(Ze,$t,an,Number(Tn))},"viiiij"),is(this.db,this.eb,0),this):this},d.Database=xe};var y="./this.program",b=(Rs=(Xi=globalThis.document)==null?void 0:Xi.currentScript)==null?void 0:Rs.src;m&&(b=self.location.href);var P="",x,w;if(p||m){try{P=new URL(".",b).href}catch{}m&&(w=A=>{var q=new XMLHttpRequest;return q.open("GET",A,!1),q.responseType="arraybuffer",q.send(null),new Uint8Array(q.response)}),x=async A=>{if(A=await fetch(A,{credentials:"same-origin"}),A.ok)return A.arrayBuffer();throw Error(A.status+" : "+A.url)}}var T=console.log.bind(console),E=console.error.bind(console),k,D=!1,I,R,$,V,K,Z,ee,ne,oe;function he(){var A=xt.buffer;R=new Int8Array(A),V=new Int16Array(A),$=new Uint8Array(A),K=new Int32Array(A),Z=new Uint32Array(A),ee=new Float32Array(A),ne=new Float64Array(A),oe=new BigInt64Array(A),new BigUint64Array(A)}function Se(A){var q;throw(q=d.onAbort)==null||q.call(d,A),A="Aborted("+A+")",E(A),D=!0,new WebAssembly.RuntimeError(A+". Build with -sASSERTIONS for more info.")}var fe;async function Oe(A){if(!k)try{var q=await x(A);return new Uint8Array(q)}catch{}if(A==fe&&k)A=new Uint8Array(k);else if(w)A=w(A);else throw"both async and sync fetching of the wasm failed";return A}async function re(A,q){try{var H=await Oe(A);return await WebAssembly.instantiate(H,q)}catch(X){E(`failed to asynchronously prepare wasm: ${X}`),Se(X)}}async function Ce(A){var q=fe;if(!k)try{var H=fetch(q,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(H,A)}catch(X){E(`wasm streaming compile failed: ${X}`),E("falling back to ArrayBuffer instantiation")}return re(q,A)}class ae{constructor(q){oc(this,"name","ExitStatus");this.message=`Program terminated with exit(${q})`,this.status=q}}var ie=A=>{for(;0{var A=d.preRun.shift();He.push(A)},$e=0,We=null;function Ye(A,q="i8"){switch(q.endsWith("*")&&(q="*"),q){case"i1":return R[A];case"i8":return R[A];case"i16":return V[A>>1];case"i32":return K[A>>2];case"i64":return oe[A>>3];case"float":return ee[A>>2];case"double":return ne[A>>3];case"*":return Z[A>>2];default:Se(`invalid type for getValue: ${q}`)}}var rt=!0;function ze(A){var q="i32";switch(q.endsWith("*")&&(q="*"),q){case"i1":R[A]=0;break;case"i8":R[A]=0;break;case"i16":V[A>>1]=0;break;case"i32":K[A>>2]=0;break;case"i64":oe[A>>3]=BigInt(0);break;case"float":ee[A>>2]=0;break;case"double":ne[A>>3]=0;break;case"*":Z[A>>2]=0;break;default:Se(`invalid type for setValue: ${q}`)}}var Fe=new TextDecoder,st=(A,q,H,X)=>{if(H=q+H,X)return H;for(;A[q]&&!(q>=H);)++q;return q},Te=(A,q,H)=>A?Fe.decode($.subarray(A,st($,A,q,H))):"",Dt=(A,q)=>{for(var H=0,X=A.length-1;0<=X;X--){var xe=A[X];xe==="."?A.splice(X,1):xe===".."?(A.splice(X,1),H++):H&&(A.splice(X,1),H--)}if(q)for(;H;H--)A.unshift("..");return A},Lt=A=>{var q=A.charAt(0)==="/",H=A.slice(-1)==="/";return(A=Dt(A.split("/").filter(X=>!!X),!q).join("/"))||q||(A="."),A&&H&&(A+="/"),(q?"/":"")+A},dn=A=>{var q=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(A).slice(1);return A=q[0],q=q[1],!A&&!q?".":(q&&(q=q.slice(0,-1)),A+q)},xn=A=>A&&A.match(/([^\/]+|\/)\/*$/)[1],qn=()=>A=>crypto.getRandomValues(A),Ar=A=>{(Ar=qn())(A)},Zr=(...A)=>{for(var q="",H=!1,X=A.length-1;-1<=X&&!H;X--){if(H=0<=X?A[X]:"/",typeof H!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!H)return"";q=H+"/"+q,H=H.charAt(0)==="/"}return q=Dt(q.split("/").filter(xe=>!!xe),!H).join("/"),(H?"/":"")+q||"."},$r=A=>{var q=st(A,0);return Fe.decode(A.buffer?A.subarray(0,q):new Uint8Array(A.slice(0,q)))},Bn=[],_r=A=>{for(var q=0,H=0;H=X?q++:2047>=X?q+=2:55296<=X&&57343>=X?(q+=4,++H):q+=3}return q},fr=(A,q,H,X)=>{if(!(0=Ge){if(H>=X)break;q[H++]=Ge}else if(2047>=Ge){if(H+1>=X)break;q[H++]=192|Ge>>6,q[H++]=128|Ge&63}else if(65535>=Ge){if(H+2>=X)break;q[H++]=224|Ge>>12,q[H++]=128|Ge>>6&63,q[H++]=128|Ge&63}else{if(H+3>=X)break;q[H++]=240|Ge>>18,q[H++]=128|Ge>>12&63,q[H++]=128|Ge>>6&63,q[H++]=128|Ge&63,Le++}}return q[H]=0,H-xe},To=[];function ua(A,q){To[A]={input:[],output:[],jb:q},Hi(A,Fr)}var Fr={open(A){var q=To[A.node.mb];if(!q)throw new lt(43);A.Va=q,A.seekable=!1},close(A){A.Va.jb.kb(A.Va)},kb(A){A.Va.jb.kb(A.Va)},read(A,q,H,X){if(!A.Va||!A.Va.jb.Kb)throw new lt(60);for(var xe=0,Le=0;Le=A.node.Ra)return 0;if(A=Math.min(A.node.Ra-xe,X),8=Le||(Le=Math.max(Le,Ge*(1048576>Ge?2:1.125)>>>0),Ge!=0&&(Le=Math.max(Le,256)),Ge=A.Na,A.Na=new Uint8Array(Le),0q)throw new lt(28);return q},rb(A,q,H,X,xe){if((A.node.mode&61440)!==32768)throw new lt(43);if(A=A.node.Na,xe&2||!A||A.buffer!==R.buffer){xe=!0,X=65536*Math.ceil(q/65536);var Le=Ii(65536,X);if(Le&&$.fill(0,Le,Le+X),X=Le,!X)throw new lt(48);A&&((0{var H=0;return A&&(H|=365),q&&(H|=146),H},Wi=null,Ja={},Ki=[],Ho=1,qr=null,Pt=!1,Ci=!0,fa={},lt=class{constructor(A){oc(this,"name","ErrnoError");this.Pa=A}},ht=class{constructor(){oc(this,"pb",{});oc(this,"node",null)}get flags(){return this.pb.flags}set flags(A){this.pb.flags=A}get position(){return this.pb.position}set position(A){this.pb.position=A}},Ma=class{constructor(A,q,H,X){oc(this,"La",{});oc(this,"Ma",{});oc(this,"hb",null);A||(A=this),this.parent=A,this.ab=A.ab,this.id=Ho++,this.name=q,this.mode=H,this.mb=X,this.$a=this.Ua=this.Ta=Date.now()}get read(){return(this.mode&365)===365}set read(A){A?this.mode|=365:this.mode&=-366}get write(){return(this.mode&146)===146}set write(A){A?this.mode|=146:this.mode&=-147}};function vr(A,q={}){if(!A)throw new lt(44);q.Ab??(q.Ab=!0),A.charAt(0)==="/"||(A="//"+A);var H=0;e:for(;40>H;H++){A=A.split("/").filter(zt=>!!zt);for(var X=Wi,xe="/",Le=0;Le>>0)%qr.length}function Zo(A){var q=Cs(A.parent.id,A.name);if(qr[q]===A)qr[q]=A.ib;else for(q=qr[q];q;){if(q.ib===A){q.ib=A.ib;break}q=q.ib}}function eo(A,q){var H=ar(A.mode)?(H=Ni(A,"x"))?H:A.La.lb?0:2:54;if(H)throw new lt(H);for(H=qr[Cs(A.id,q)];H;H=H.ib){var X=H.name;if(H.parent.id===A.id&&X===q)return H}return A.La.lb(A,q)}function Yl(A,q,H,X){return A=new Ma(A,q,H,X),q=Cs(A.parent.id,A.name),A.ib=qr[q],qr[q]=A}function ar(A){return(A&61440)===16384}function da(A){var q=["r","w","rw"][A&3];return A&512&&(q+="w"),q}function Ni(A,q){if(Ci)return 0;if(!q.includes("r")||A.mode&292){if(q.includes("w")&&!(A.mode&146)||q.includes("x")&&!(A.mode&73))return 2}else return 2;return 0}function Ao(A,q){if(!ar(A.mode))return 54;try{return eo(A,q),20}catch{}return Ni(A,"wx")}function An(A,q,H){try{var X=eo(A,q)}catch(xe){return xe.Pa}if(A=Ni(A,"wx"))return A;if(H){if(!ar(X.mode))return 54;if(X===X.parent||Go(X)==="/")return 10}else if(ar(X.mode))return 31;return 0}function or(A){if(!A)throw new lt(63);return A}function Rn(A){if(A=Ki[A],!A)throw new lt(8);return A}function _t(A,q=-1){if(A=Object.assign(new ht,A),q==-1)e:{for(q=0;4096>=q;q++)if(!Ki[q])break e;throw new lt(33)}return A.bb=q,Ki[q]=A}function to(A,q=-1){var H,X;return A=_t(A,q),(X=(H=A.Ma)==null?void 0:H.mc)==null||X.call(H,A),A}function Ra(A,q,H){var X=A==null?void 0:A.Ma.Xa;A=X?A:q,X??(X=q.La.Xa),or(X),X(A,H)}var $u={open(A){var q,H;A.Ma=Ja[A.node.mb].Ma,(H=(q=A.Ma).open)==null||H.call(q,A)},Ya(){throw new lt(70)}};function Hi(A,q){Ja[A]={Ma:q}}function La(A,q){var H=q==="/";if(H&&Wi)throw new lt(10);if(!H&&q){var X=vr(q,{Ab:!1});if(q=X.path,X=X.node,X.hb)throw new lt(10);if(!ar(X.mode))throw new lt(54)}q={type:A,rc:{},Mb:q,ac:[]},A=A.ab(q),A.ab=q,q.root=A,H?Wi=A:X&&(X.hb=q,X.ab&&X.ab.ac.push(q))}function Sr(A,q,H){var X=vr(A,{parent:!0}).node;if(A=xn(A),!A)throw new lt(28);if(A==="."||A==="..")throw new lt(20);var xe=Ao(X,A);if(xe)throw new lt(xe);if(!X.La.qb)throw new lt(63);return X.La.qb(X,A,q,H)}function ha(A,q=438){return Sr(A,q&4095|32768,0)}function Mi(A,q=511){return Sr(A,q&1023|16384,0)}function Gi(A,q,H){typeof H>"u"&&(H=q,q=438),Sr(A,q|8192,H)}function Ns(A,q){if(!Zr(A))throw new lt(44);var H=vr(q,{parent:!0}).node;if(!H)throw new lt(44);q=xn(q);var X=Ao(H,q);if(X)throw new lt(X);if(!H.La.vb)throw new lt(63);H.La.vb(H,q,A)}function Ia(A){var q=vr(A,{parent:!0}).node;A=xn(A);var H=eo(q,A),X=An(q,A,!0);if(X)throw new lt(X);if(!q.La.ub)throw new lt(63);if(H.hb)throw new lt(10);q.La.ub(q,A),Zo(H)}function vl(A){var q=vr(A,{parent:!0}).node;if(!q)throw new lt(44);A=xn(A);var H=eo(q,A),X=An(q,A,!1);if(X)throw new lt(X);if(!q.La.wb)throw new lt(63);if(H.hb)throw new lt(10);q.La.wb(q,A),Zo(H)}function Da(A,q){return A=vr(A,{gb:!q}).node,or(A.La.Wa)(A)}function nr(A,q,H,X){Ra(A,q,{mode:H&4095|q.mode&-4096,Ta:Date.now(),Wb:X})}function hi(A,q){A=typeof A=="string"?vr(A,{gb:!0}).node:A,nr(null,A,q)}function jn(A,q,H){if(ar(q.mode))throw new lt(31);if((q.mode&61440)!==32768)throw new lt(28);var X=Ni(q,"w");if(X)throw new lt(X);Ra(A,q,{size:H,timestamp:Date.now()})}function ko(A,q,H=438){if(A==="")throw new lt(44);if(typeof q=="string"){var X={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[q];if(typeof X>"u")throw Error(`Unknown file open mode: ${q}`);q=X}if(H=q&64?H&4095|32768:0,typeof A=="object")X=A;else{var xe=A.endsWith("/");A=vr(A,{gb:!(q&131072),cc:!0}),X=A.node,A=A.path}var Le=!1;if(q&64)if(X){if(q&128)throw new lt(20)}else{if(xe)throw new lt(31);X=Sr(A,H|511,0),Le=!0}if(!X)throw new lt(44);if((X.mode&61440)===8192&&(q&=-513),q&65536&&!ar(X.mode))throw new lt(54);if(!Le&&(xe=X?(X.mode&61440)===40960?32:ar(X.mode)&&(da(q)!=="r"||q&576)?31:Ni(X,da(q)):44))throw new lt(xe);return q&512&&!Le&&(xe=X,xe=typeof xe=="string"?vr(xe,{gb:!0}).node:xe,jn(null,xe,0)),q&=-131713,xe=_t({node:X,path:Go(X),flags:q,seekable:!0,position:0,Ma:X.Ma,ec:[],error:!1}),xe.Ma.open&&xe.Ma.open(xe),Le&&hi(X,H&511),!d.logReadFiles||q&1||A in fa||(fa[A]=1),xe}function pa(A){if(A.bb===null)throw new lt(8);A.Bb&&(A.Bb=null);try{A.Ma.close&&A.Ma.close(A)}catch(q){throw q}finally{Ki[A.bb]=null}A.bb=null}function Yo(A,q,H){if(A.bb===null)throw new lt(8);if(!A.seekable||!A.Ma.Ya)throw new lt(70);if(H!=0&&H!=1&&H!=2)throw new lt(28);A.position=A.Ma.Ya(A,q,H),A.ec=[]}function Co(A,q,H,X,xe){if(0>X||0>xe)throw new lt(28);if(A.bb===null)throw new lt(8);if((A.flags&2097155)===1)throw new lt(8);if(ar(A.node.mode))throw new lt(31);if(!A.Ma.read)throw new lt(28);var Le=typeof xe<"u";if(!Le)xe=A.position;else if(!A.seekable)throw new lt(70);return q=A.Ma.read(A,q,H,X,xe),Le||(A.position+=q),q}function Xo(A,q,H,X,xe){if(0>X||0>xe)throw new lt(28);if(A.bb===null)throw new lt(8);if((A.flags&2097155)===0)throw new lt(8);if(ar(A.node.mode))throw new lt(31);if(!A.Ma.write)throw new lt(28);A.seekable&&A.flags&1024&&Yo(A,0,2);var Le=typeof xe<"u";if(!Le)xe=A.position;else if(!A.seekable)throw new lt(70);return q=A.Ma.write(A,q,H,X,xe,void 0),Le||(A.position+=q),q}function Ri(A){var q=q||0;q=ko(A,q),A=Da(A).size;var H=new Uint8Array(A);return Co(q,H,0,A,0),pa(q),H}function pi(A,q,H){A=Lt("/dev/"+A);var X=Na(!!q,!!H);pi.Lb??(pi.Lb=64);var xe=pi.Lb++<<8|0;Hi(xe,{open(Le){Le.seekable=!1},close(){var Le;(Le=H==null?void 0:H.buffer)!=null&&Le.length&&H(10)},read(Le,Ge,zt,Sn){for(var Zt=0,Ln=0;Ln>2]=q.Vb,Z[A+4>>2]=q.mode,Z[A+8>>2]=q.bc,Z[A+12>>2]=q.uid,Z[A+16>>2]=q.Zb,Z[A+20>>2]=q.mb,oe[A+24>>3]=BigInt(q.size),K[A+32>>2]=4096,K[A+36>>2]=q.Ub;var H=q.$a.getTime(),X=q.Ua.getTime(),xe=q.Ta.getTime();return oe[A+40>>3]=BigInt(Math.floor(H/1e3)),Z[A+48>>2]=H%1e3*1e6,oe[A+56>>3]=BigInt(Math.floor(X/1e3)),Z[A+64>>2]=X%1e3*1e6,oe[A+72>>3]=BigInt(Math.floor(xe/1e3)),Z[A+80>>2]=xe%1e3*1e6,oe[A+88>>3]=BigInt(q.$b),0}var $n=void 0,no=()=>{var A=K[+$n>>2];return $n+=4,A},Zi=0,mi=[0,31,60,91,121,152,182,213,244,274,305,335],No=[0,31,59,90,120,151,181,212,243,273,304,334],qt={},zn=A=>{if(!(A instanceof ae||A=="unwind"))throw A},kn=A=>{var q;throw I=A,rt||0{if(!D)try{A()}catch(q){zn(q)}finally{if(!(rt||0{var X;if(!ma){var A={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(((X=globalThis.navigator)==null?void 0:X.language)??"C").replace("-","_")+".UTF-8",_:y||"./this.program"},q;for(q in dr)dr[q]===void 0?delete A[q]:A[q]=dr[q];var H=[];for(q in A)H.push(`${q}=${A[q]}`);ma=H}return ma},ma,gi=(A,q,H,X)=>{var xe={string:Zt=>{var Ln=0;if(Zt!=null&&Zt!==0){Ln=_r(Zt)+1;var Jn=kr(Ln);fr(Zt,$,Jn,Ln),Ln=Jn}return Ln},array:Zt=>{var Ln=kr(Zt.length);return R.set(Zt,Ln),Ln}};A=d["_"+A];var Le=[],Ge=0;if(X)for(var zt=0;zt{var q=_r(A)+1,H=oo(q);return H&&fr(A,$,H,q),H},zr,un=[],ri=A=>{zr.delete(gn.get(A)),gn.set(A,null),un.push(A)},Ms=A=>{const q=A.length;return[q%128|128,q>>7,...A]},cn={i:127,p:127,j:126,f:125,d:124,e:111},Qo=A=>Ms(Array.from(A,q=>cn[q])),ao=(A,q)=>{if(!zr){zr=new WeakMap;var H=gn.length;if(zr)for(var X=0;X<0+H;X++){var xe=gn.get(X);xe&&zr.set(xe,X)}}if(H=zr.get(A)||0)return H;H=un.length?un.pop():gn.grow(1);try{gn.set(H,A)}catch(Le){if(!(Le instanceof TypeError))throw Le;q=Uint8Array.of(0,97,115,109,1,0,0,0,1,...Ms([1,96,...Qo(q.slice(1)),...Qo(q[0]==="v"?"":q[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),q=new WebAssembly.Module(q),q=new WebAssembly.Instance(q,{e:{f:A}}).exports.f,gn.set(H,q)}return zr.set(A,H),H};if(qr=Array(4096),La(Vt,"/"),Mi("/tmp"),Mi("/home"),Mi("/home/web_user"),(function(){Mi("/dev"),Hi(259,{read:()=>0,write:(X,xe,Le,Ge)=>Ge,Ya:()=>0}),Gi("/dev/null",259),ua(1280,ca),ua(1536,Eo),Gi("/dev/tty",1280),Gi("/dev/tty1",1536);var A=new Uint8Array(1024),q=0,H=()=>(q===0&&(Ar(A),q=A.byteLength),A[--q]);pi("random",H),pi("urandom",H),Mi("/dev/shm"),Mi("/dev/shm/tmp")})(),(function(){Mi("/proc");var A=Mi("/proc/self");Mi("/proc/self/fd"),La({ab(){var q=Yl(A,"fd",16895,73);return q.Ma={Ya:Vt.Ma.Ya},q.La={lb(H,X){H=+X;var xe=Rn(H);return H={parent:null,ab:{Mb:"fake"},La:{cb:()=>xe.path},id:H+1},H.parent=H},Eb(){return Array.from(Ki.entries()).filter(([,H])=>H).map(([H])=>H.toString())}},q}},"/proc/self/fd")})(),d.noExitRuntime&&(rt=d.noExitRuntime),d.print&&(T=d.print),d.printErr&&(E=d.printErr),d.wasmBinary&&(k=d.wasmBinary),d.thisProgram&&(y=d.thisProgram),d.preInit)for(typeof d.preInit=="function"&&(d.preInit=[d.preInit]);0Ba(),d.stackRestore=A=>yr(A),d.stackAlloc=A=>kr(A),d.cwrap=(A,q,H,X)=>{var xe=!H||H.every(Le=>Le==="number"||Le==="boolean");return q!=="string"&&xe&&!X?d["_"+A]:(...Le)=>gi(A,q,H,Le)},d.addFunction=ao,d.removeFunction=ri,d.UTF8ToString=Te,d.stringToNewUTF8=Un,d.writeArrayToMemory=(A,q)=>{R.set(A,q)};var oo,sr,Ii,Yr,yr,kr,Ba,xt,gn,On={a:(A,q,H,X)=>Se(`Assertion failed: ${Te(A)}, at: `+[q?Te(q):"unknown filename",H,X?Te(X):"unknown function"]),i:function(A,q){try{return A=Te(A),hi(A,q),0}catch(H){if(typeof ln>"u"||H.name!=="ErrnoError")throw H;return-H.Pa}},L:function(A,q,H){try{if(q=Te(q),q=Li(A,q),H&-8)return-28;var X=vr(q,{gb:!0}).node;return X?(A="",H&4&&(A+="r"),H&2&&(A+="w"),H&1&&(A+="x"),A&&Ni(X,A)?-2:0):-44}catch(xe){if(typeof ln>"u"||xe.name!=="ErrnoError")throw xe;return-xe.Pa}},j:function(A,q){try{var H=Rn(A);return nr(H,H.node,q,!1),0}catch(X){if(typeof ln>"u"||X.name!=="ErrnoError")throw X;return-X.Pa}},h:function(A){try{var q=Rn(A);return Ra(q,q.node,{timestamp:Date.now(),Wb:!1}),0}catch(H){if(typeof ln>"u"||H.name!=="ErrnoError")throw H;return-H.Pa}},b:function(A,q,H){$n=H;try{var X=Rn(A);switch(q){case 0:var xe=no();if(0>xe)break;for(;Ki[xe];)xe++;return to(X,xe).bb;case 1:case 2:return 0;case 3:return X.flags;case 4:return xe=no(),X.flags|=xe,0;case 12:return xe=no(),V[xe+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(Le){if(typeof ln>"u"||Le.name!=="ErrnoError")throw Le;return-Le.Pa}},g:function(A,q){try{var H=Rn(A),X=H.node,xe=H.Ma.Wa;A=xe?H:X,xe??(xe=X.La.Wa),or(xe);var Le=xe(A);return ft(q,Le)}catch(Ge){if(typeof ln>"u"||Ge.name!=="ErrnoError")throw Ge;return-Ge.Pa}},H:function(A,q){q=-9007199254740992>q||9007199254740992q||(H.flags&2097155)===0)throw new lt(28);return jn(H,H.node,q),0}catch(X){if(typeof ln>"u"||X.name!=="ErrnoError")throw X;return-X.Pa}},G:function(A,q){try{if(q===0)return-28;var H=_r("/")+1;return q"u"||X.name!=="ErrnoError")throw X;return-X.Pa}},K:function(A,q){try{return A=Te(A),ft(q,Da(A,!0))}catch(H){if(typeof ln>"u"||H.name!=="ErrnoError")throw H;return-H.Pa}},C:function(A,q,H){try{return q=Te(q),q=Li(A,q),Mi(q,H),0}catch(X){if(typeof ln>"u"||X.name!=="ErrnoError")throw X;return-X.Pa}},J:function(A,q,H,X){try{q=Te(q);var xe=X&256;return q=Li(A,q,X&4096),ft(H,xe?Da(q,!0):Da(q))}catch(Le){if(typeof ln>"u"||Le.name!=="ErrnoError")throw Le;return-Le.Pa}},x:function(A,q,H,X){$n=X;try{q=Te(q),q=Li(A,q);var xe=X?no():0;return ko(q,H,xe).bb}catch(Le){if(typeof ln>"u"||Le.name!=="ErrnoError")throw Le;return-Le.Pa}},v:function(A,q,H,X){try{if(q=Te(q),q=Li(A,q),0>=X)return-28;var xe=vr(q).node;if(!xe)throw new lt(44);if(!xe.La.cb)throw new lt(28);var Le=xe.La.cb(xe),Ge=Math.min(X,_r(Le)),zt=R[H+Ge];return fr(Le,$,H,X+1),R[H+Ge]=zt,Ge}catch(Sn){if(typeof ln>"u"||Sn.name!=="ErrnoError")throw Sn;return-Sn.Pa}},u:function(A){try{return A=Te(A),Ia(A),0}catch(q){if(typeof ln>"u"||q.name!=="ErrnoError")throw q;return-q.Pa}},f:function(A,q){try{return A=Te(A),ft(q,Da(A))}catch(H){if(typeof ln>"u"||H.name!=="ErrnoError")throw H;return-H.Pa}},r:function(A,q,H){try{if(q=Te(q),q=Li(A,q),H)if(H===512)Ia(q);else return-28;else vl(q);return 0}catch(X){if(typeof ln>"u"||X.name!=="ErrnoError")throw X;return-X.Pa}},q:function(A,q,H){try{q=Te(q),q=Li(A,q,!0);var X=Date.now(),xe,Le;if(H){var Ge=Z[H>>2]+4294967296*K[H+4>>2],zt=K[H+8>>2];zt==1073741823?xe=X:zt==1073741822?xe=null:xe=1e3*Ge+zt/1e6,H+=16,Ge=Z[H>>2]+4294967296*K[H+4>>2],zt=K[H+8>>2],zt==1073741823?Le=X:zt==1073741822?Le=null:Le=1e3*Ge+zt/1e6}else Le=xe=X;if((Le??xe)!==null){A=xe;var Sn=vr(q,{gb:!0}).node;or(Sn.La.Xa)(Sn,{$a:A,Ua:Le})}return 0}catch(Zt){if(typeof ln>"u"||Zt.name!=="ErrnoError")throw Zt;return-Zt.Pa}},m:()=>Se(""),l:()=>{rt=!1,Zi=0},A:function(A,q){A=-9007199254740992>A||9007199254740992>2]=A.getSeconds(),K[q+4>>2]=A.getMinutes(),K[q+8>>2]=A.getHours(),K[q+12>>2]=A.getDate(),K[q+16>>2]=A.getMonth(),K[q+20>>2]=A.getFullYear()-1900,K[q+24>>2]=A.getDay();var H=A.getFullYear();K[q+28>>2]=(H%4!==0||H%100===0&&H%400!==0?No:mi)[A.getMonth()]+A.getDate()-1|0,K[q+36>>2]=-(60*A.getTimezoneOffset()),H=new Date(A.getFullYear(),6,1).getTimezoneOffset();var X=new Date(A.getFullYear(),0,1).getTimezoneOffset();K[q+32>>2]=(H!=X&&A.getTimezoneOffset()==Math.min(X,H))|0},y:function(A,q,H,X,xe,Le,Ge){xe=-9007199254740992>xe||9007199254740992>2]=Sn.Ob,Z[Ge>>2]=Zt,0}catch(Ln){if(typeof ln>"u"||Ln.name!=="ErrnoError")throw Ln;return-Ln.Pa}},z:function(A,q,H,X,xe,Le){Le=-9007199254740992>Le||9007199254740992"u"||zt.name!=="ErrnoError")throw zt;return-zt.Pa}},n:(A,q)=>{if(qt[A]&&(clearTimeout(qt[A].id),delete qt[A]),!q)return 0;var H=setTimeout(()=>{delete qt[A],ro(()=>Yr(A,performance.now()))},q);return qt[A]={id:H,sc:q},0},B:(A,q,H,X)=>{var xe=new Date().getFullYear(),Le=new Date(xe,0,1).getTimezoneOffset();xe=new Date(xe,6,1).getTimezoneOffset(),Z[A>>2]=60*Math.max(Le,xe),K[q>>2]=+(Le!=xe),q=Ge=>{var zt=Math.abs(Ge);return`UTC${0<=Ge?"-":"+"}${String(Math.floor(zt/60)).padStart(2,"0")}${String(zt%60).padStart(2,"0")}`},A=q(Le),q=q(xe),xeDate.now(),s:()=>2147483648,c:()=>performance.now(),o:A=>{var q=$.length;if(A>>>=0,2147483648=H;H*=2){var X=q*(1+.2/H);X=Math.min(X,A+100663296);e:{X=(Math.min(2147483648,65536*Math.ceil(Math.max(A,X)/65536))-xt.buffer.byteLength+65535)/65536|0;try{xt.grow(X),he();var xe=1;break e}catch{}xe=void 0}if(xe)return!0}return!1},E:(A,q)=>{var H=0,X=0,xe;for(xe of io()){var Le=q+H;Z[A+X>>2]=Le,H+=fr(xe,$,Le,1/0)+1,X+=4}return 0},F:(A,q)=>{var H=io();Z[A>>2]=H.length,A=0;for(var X of H)A+=_r(X)+1;return Z[q>>2]=A,0},e:function(A){try{var q=Rn(A);return pa(q),0}catch(H){if(typeof ln>"u"||H.name!=="ErrnoError")throw H;return H.Pa}},p:function(A,q){try{var H=Rn(A);return R[q]=H.Va?2:ar(H.mode)?3:(H.mode&61440)===40960?7:4,V[q+2>>1]=0,oe[q+8>>3]=BigInt(0),oe[q+16>>3]=BigInt(0),0}catch(X){if(typeof ln>"u"||X.name!=="ErrnoError")throw X;return X.Pa}},w:function(A,q,H,X){try{e:{var xe=Rn(A);A=q;for(var Le,Ge=q=0;Ge>2],Sn=Z[A+4>>2];A+=8;var Zt=Co(xe,R,zt,Sn,Le);if(0>Zt){var Ln=-1;break e}if(q+=Zt,Zt>2]=Ln,0}catch(Jn){if(typeof ln>"u"||Jn.name!=="ErrnoError")throw Jn;return Jn.Pa}},D:function(A,q,H,X){q=-9007199254740992>q||9007199254740992>3]=BigInt(xe.position),xe.Bb&&q===0&&H===0&&(xe.Bb=null),0}catch(Le){if(typeof ln>"u"||Le.name!=="ErrnoError")throw Le;return Le.Pa}},I:function(A){var H,X;try{var q=Rn(A);return(X=(H=q.Ma)==null?void 0:H.kb)==null?void 0:X.call(H,q)}catch(xe){if(typeof ln>"u"||xe.name!=="ErrnoError")throw xe;return xe.Pa}},t:function(A,q,H,X){try{e:{var xe=Rn(A);A=q;for(var Le,Ge=q=0;Ge>2],Sn=Z[A+4>>2];A+=8;var Zt=Xo(xe,R,zt,Sn,Le);if(0>Zt){var Ln=-1;break e}if(q+=Zt,Zt>2]=Ln,0}catch(Jn){if(typeof ln>"u"||Jn.name!=="ErrnoError")throw Jn;return Jn.Pa}},k:kn};function $a(){function A(){var xe;if(d.calledRun=!0,!D){if(!d.noFSInit&&!Pt){var q,H;Pt=!0,q??(q=d.stdin),H??(H=d.stdout),X??(X=d.stderr),q?pi("stdin",q):Ns("/dev/tty","/dev/stdin"),H?pi("stdout",null,H):Ns("/dev/tty","/dev/stdout"),X?pi("stderr",null,X):Ns("/dev/tty1","/dev/stderr"),ko("/dev/stdin",0),ko("/dev/stdout",1),ko("/dev/stderr",1)}if(Yi.N(),Ci=!1,(xe=d.onRuntimeInitialized)==null||xe.call(d),d.postRun)for(typeof d.postRun=="function"&&(d.postRun=[d.postRun]);d.postRun.length;){var X=d.postRun.shift();de.push(X)}ie(de)}}if(0<$e)We=$a;else{if(d.preRun)for(typeof d.preRun=="function"&&(d.preRun=[d.preRun]);d.preRun.length;)je();ie(He),0<$e?We=$a:d.setStatus?(d.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>d.setStatus(""),1),A()},1)):A()}}var Yi;return(async function(){var H;function A(X){var xe;return X=Yi=X.exports,d._sqlite3_free=X.P,d._sqlite3_value_text=X.Q,d._sqlite3_prepare_v2=X.R,d._sqlite3_step=X.S,d._sqlite3_reset=X.T,d._sqlite3_exec=X.U,d._sqlite3_finalize=X.V,d._sqlite3_column_name=X.W,d._sqlite3_column_text=X.X,d._sqlite3_column_type=X.Y,d._sqlite3_errmsg=X.Z,d._sqlite3_clear_bindings=X._,d._sqlite3_value_blob=X.$,d._sqlite3_value_bytes=X.aa,d._sqlite3_value_double=X.ba,d._sqlite3_value_int=X.ca,d._sqlite3_value_type=X.da,d._sqlite3_result_blob=X.ea,d._sqlite3_result_double=X.fa,d._sqlite3_result_error=X.ga,d._sqlite3_result_int=X.ha,d._sqlite3_result_int64=X.ia,d._sqlite3_result_null=X.ja,d._sqlite3_result_text=X.ka,d._sqlite3_aggregate_context=X.la,d._sqlite3_column_count=X.ma,d._sqlite3_data_count=X.na,d._sqlite3_column_blob=X.oa,d._sqlite3_column_bytes=X.pa,d._sqlite3_column_double=X.qa,d._sqlite3_bind_blob=X.ra,d._sqlite3_bind_double=X.sa,d._sqlite3_bind_int=X.ta,d._sqlite3_bind_text=X.ua,d._sqlite3_bind_parameter_index=X.va,d._sqlite3_sql=X.wa,d._sqlite3_normalized_sql=X.xa,d._sqlite3_changes=X.ya,d._sqlite3_close_v2=X.za,d._sqlite3_create_function_v2=X.Aa,d._sqlite3_update_hook=X.Ba,d._sqlite3_open=X.Ca,oo=d._malloc=X.Da,sr=d._free=X.Ea,d._RegisterExtensionFunctions=X.Fa,Ii=X.Ga,Yr=X.Ha,yr=X.Ia,kr=X.Ja,Ba=X.Ka,xt=X.M,gn=X.O,he(),$e--,(xe=d.monitorRunDependencies)==null||xe.call(d,$e),$e==0&&We&&(X=We,We=null,X()),Yi}$e++,(H=d.monitorRunDependencies)==null||H.call(d,$e);var q={a:On};return d.instantiateWasm?new Promise(X=>{d.instantiateWasm(q,(xe,Le)=>{X(A(xe))})}):(fe??(fe=d.locateFile?d.locateFile("sql-wasm-browser.wasm",P):P+"sql-wasm-browser.wasm"),A((await Ce(q)).instance))})(),$a(),s}),n)};e.exports=r,e.exports.default=r})(pj)),pj.exports}var r1e=n1e();const i1e=In(r1e);let mj=!1,Ol=null;const Z8="pertanian_sqlite";let Yp=null;async function _k(){return Ol||Yp||(mj?(await new Promise(e=>setTimeout(e,100)),_k()):(mj=!0,Yp=(async()=>{try{const e=await i1e({locateFile:()=>"/sql-wasm.wasm"}),t=localStorage.getItem(Z8);let n;if(t){const i=Uint8Array.from(atob(t),a=>a.charCodeAt(0));Ol=new e.Database(i),console.log("✅ DB loaded from storage"),Ol.run("DROP TABLE IF EXISTS farmer;"),console.log("⚠️ Tabel Farmer lama dihapus untuk sinkronisasi skema")}else Ol=new e.Database,console.log("🆕 DB created");Ol.run(` CREATE TABLE IF NOT EXISTS farmer ( id TEXT PRIMARY KEY, nik TEXT, full_name TEXT NOT NULL, phone TEXT, farmer_group TEXT, -- Tambahkan kolom ini village TEXT, district TEXT, regency TEXT, province TEXT, verification_status TEXT, sync_status TEXT DEFAULT 'pending', created_date TEXT DEFAULT CURRENT_TIMESTAMP, updated_date TEXT DEFAULT CURRENT_TIMESTAMP ); `);const r=Ol.exec("PRAGMA table_info(farmer);");return console.log("🔍 KOLOM YANG TERDETEKSI DI SQLITE:",JSON.stringify(r[0].values.map(i=>i[1]))),Ol.run(` CREATE TABLE IF NOT EXISTS land ( id TEXT PRIMARY KEY, farmer_id TEXT, name TEXT, area_hectares REAL, validation_status TEXT DEFAULT 'pending', sync_status TEXT DEFAULT 'synced' ); `),Ol.run(` CREATE TABLE IF NOT EXISTS pending_sync ( id TEXT PRIMARY KEY, entity_type TEXT, operation TEXT, payload TEXT, created_at TEXT ); `),Ol}catch(e){throw Yp=null,e}finally{mj=!1}})(),Yp))}function a1e(e){const t=e.export(),n=btoa(String.fromCharCode(...t));localStorage.setItem(Z8,n)}var Ey={exports:{}},o1e=Ey.exports,g$;function s1e(){return g$||(g$=1,(function(e,t){((n,r)=>{e.exports=r()})(o1e,function(){var n=function(_,O){return(n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(B,z){B.__proto__=z}:function(B,z){for(var W in z)Object.prototype.hasOwnProperty.call(z,W)&&(B[W]=z[W])}))(_,O)},r=function(){return(r=Object.assign||function(_){for(var O,B=1,z=arguments.length;B"u"||a.Promise||(a.Promise=Promise);var d=Object.getPrototypeOf,p={}.hasOwnProperty;function m(_,O){return p.call(_,O)}function y(_,O){typeof O=="function"&&(O=O(d(_))),(typeof Reflect>"u"?o:Reflect.ownKeys)(O).forEach(function(B){P(_,B,O[B])})}var b=Object.defineProperty;function P(_,O,B,z){b(_,O,c(B&&m(B,"get")&&typeof B.get=="function"?{get:B.get,set:B.set,configurable:!0}:{value:B,configurable:!0,writable:!0},z))}function x(_){return{from:function(O){return _.prototype=Object.create(O.prototype),P(_.prototype,"constructor",_),{extend:y.bind(null,_.prototype)}}}}var w=Object.getOwnPropertyDescriptor,T=[].slice;function E(_,O,B){return T.call(_,O,B)}function k(_,O){return O(_)}function D(_){if(!_)throw new Error("Assertion Failed")}function I(_){a.setImmediate?setImmediate(_):setTimeout(_,0)}function R(_,O){if(typeof O=="string"&&m(_,O))return _[O];if(!O)return _;if(typeof O!="string"){for(var B=[],z=0,W=O.length;z"u"?[]:(Fr=Promise.resolve(),typeof crypto<"u"&&crypto.subtle?[ua=crypto.subtle.digest("SHA-512",new Uint8Array([0])),d(ua),Fr]:[Fr,d(Fr),Fr]),Fr=ua[0],zs=ua[1],zs=zs&&zs.then,ca=Fr&&Fr.constructor,Eo=!!ua[2],Vt=function(_,O){Ci.push([_,O]),Wi&&(queueMicrotask(Yl),Wi=!1)},Na=!0,Wi=!0,Ja=[],Ki=[],Ho=Dt,qr={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Te,pgp:!1,env:{},finalize:Te},Pt=qr,Ci=[],fa=0,lt=[];function ht(_){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var O=this._PSD=Pt;if(typeof _!="function"){if(_!==fr)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Go(this,this._value)}else this._state=null,this._value=null,++O.ref,(function B(z,W){try{W(function(G){if(z._state===null){if(G===z)throw new TypeError("A promise cannot be resolved with itself.");var J=z._lib&&ar();G&&typeof G.then=="function"?B(z,function(te,be){G instanceof ht?G._then(te,be):G.then(te,be)}):(z._state=!0,z._value=G,Cs(z)),J&&da()}},Go.bind(null,z))}catch(G){Go(z,G)}})(this,_)}var Ma={get:function(){var _=Pt,O=Ra;function B(z,W){var G=this,J=!_.global&&(_!==Pt||O!==Ra),te=J&&!Sr(),be=new ht(function(Ee,pe){Zo(G,new vr(vl(z,_,J,te),vl(W,_,J,te),Ee,pe,_))});return this._consoleTask&&(be._consoleTask=this._consoleTask),be}return B.prototype=fr,B},set:function(_){P(this,"then",_&&_.prototype===fr?Ma:{get:function(){return _},set:Ma.set})}};function vr(_,O,B,z,W){this.onFulfilled=typeof _=="function"?_:null,this.onRejected=typeof O=="function"?O:null,this.resolve=B,this.reject=z,this.psd=W}function Go(_,O){var B,z;Ki.push(O),_._state===null&&(B=_._lib&&ar(),O=Ho(O),_._state=!1,_._value=O,z=_,Ja.some(function(W){return W._value===z._value})||Ja.push(z),Cs(_),B)&&da()}function Cs(_){var O=_._listeners;_._listeners=[];for(var B=0,z=O.length;B{for(var J=Ja.length;J;)if(Ja[--J]._value===G._value)return Ja.splice(J,1)})(O),B.resolve(z)}catch(G){B.reject(G)}finally{--fa==0&&Ni(),--B.psd.ref||B.psd.finalize()}}function Yl(){Ia(qr,function(){ar()&&da()})}function ar(){var _=Na;return Wi=Na=!1,_}function da(){var _,O,B;do for(;0.",ko="String expected.",pa=[],Yo="__dbnames",Co="readonly",Xo="readwrite";function Ri(_,O){return _?O?function(){return _.apply(this,arguments)&&O.apply(this,arguments)}:_:O}var pi={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function ln(_){return typeof _!="string"||/\./.test(_)?function(O){return O}:function(O){return O[_]===void 0&&_ in O&&delete(O=oe(O))[_],O}}function Li(){throw Fe.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function ft(_,O){try{var B=$n(_),z=$n(O);if(B!==z)return B==="Array"?1:z==="Array"?-1:B==="binary"?1:z==="binary"?-1:B==="string"?1:z==="string"?-1:B==="Date"?1:z!=="Date"?NaN:-1;switch(B){case"number":case"Date":case"string":return O<_?1:_{var te=pe,be=J;if(typeof be!="function"&&be!==null)throw new TypeError("Class extends value "+String(be)+" is not a constructor or null");function Ee(){this.constructor=te}function pe(){return J!==null&&J.apply(this,arguments)||this}return n(te,be),te.prototype=be===null?Object.create(be):(Ee.prototype=be.prototype,new Ee),Object.defineProperty(pe.prototype,"db",{get:function(){return O},enumerable:!1,configurable:!0}),pe.prototype.table=function(){return B},pe})(_)),new Set),W=_.prototype;W;W=d(W))Object.getOwnPropertyNames(W).forEach(function(J){return z.add(J)});function G(J){if(!J)return J;var te,be=Object.create(_.prototype);for(te in J)if(!z.has(te))try{be[te]=J[te]}catch{}return be}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=G,this.hook("reading",G),_},kn.prototype.defineClass=function(){return this.mapToClass(function(_){c(this,_)})},kn.prototype.add=function(_,O){var B=this,z=this.schema.primKey,W=z.auto,G=z.keyPath,J=_;return G&&W&&(J=ln(G)(_)),this._trans("readwrite",function(te){return B.core.mutate({trans:te,type:"add",keys:O!=null?[O]:null,values:[J]})}).then(function(te){return te.numFailures?ht.reject(te.failures[0]):te.lastResult}).then(function(te){if(G)try{$(_,G,te)}catch{}return te})},kn.prototype.upsert=function(_,O){var B=this,z=this.schema.primKey.keyPath;return this._trans("readwrite",function(W){return B.core.get({trans:W,key:_}).then(function(G){var J=G??{};return qt(J,O),z&&$(J,z,_),B.core.mutate({trans:W,type:"put",values:[J],keys:[_],upsert:!0,updates:{keys:[_],changeSpecs:[O]}}).then(function(te){return te.numFailures?ht.reject(te.failures[0]):!!G})})})},kn.prototype.update=function(_,O){return typeof _!="object"||s(_)?this.where(":id").equals(_).modify(O):(_=R(_,this.schema.primKey.keyPath))===void 0?nr(new Fe.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(_).modify(O)},kn.prototype.put=function(_,O){var B=this,z=this.schema.primKey,W=z.auto,G=z.keyPath,J=_;return G&&W&&(J=ln(G)(_)),this._trans("readwrite",function(te){return B.core.mutate({trans:te,type:"put",values:[J],keys:O!=null?[O]:null})}).then(function(te){return te.numFailures?ht.reject(te.failures[0]):te.lastResult}).then(function(te){if(G)try{$(_,G,te)}catch{}return te})},kn.prototype.delete=function(_){var O=this;return this._trans("readwrite",function(B){return O.core.mutate({trans:B,type:"delete",keys:[_]}).then(function(z){return Zi(O,[_],z)}).then(function(z){return z.numFailures?ht.reject(z.failures[0]):void 0})})},kn.prototype.clear=function(){var _=this;return this._trans("readwrite",function(O){return _.core.mutate({trans:O,type:"deleteRange",range:pi}).then(function(B){return Zi(_,null,B)})}).then(function(O){return O.numFailures?ht.reject(O.failures[0]):void 0})},kn.prototype.bulkGet=function(_){var O=this;return this._trans("readonly",function(B){return O.core.getMany({keys:_,trans:B}).then(function(z){return z.map(function(W){return O.hook.reading.fire(W)})})})},kn.prototype.bulkAdd=function(_,O,B){var z=this,W=Array.isArray(O)?O:void 0,G=(B=B||(W?void 0:O))?B.allKeys:void 0;return this._trans("readwrite",function(J){var te=z.schema.primKey,Ee=te.auto,te=te.keyPath;if(te&&W)throw new Fe.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(W&&W.length!==_.length)throw new Fe.InvalidArgument("Arguments objects and keys must have the same length");var be=_.length,Ee=te&&Ee?_.map(ln(te)):_;return z.core.mutate({trans:J,type:"add",keys:W,values:Ee,wantResults:G}).then(function(pe){var me=pe.numFailures,we=pe.failures;if(me===0)return G?pe.results:pe.lastResult;throw new Ye("".concat(z.name,".bulkAdd(): ").concat(me," of ").concat(be," operations failed"),we)})})},kn.prototype.bulkPut=function(_,O,B){var z=this,W=Array.isArray(O)?O:void 0,G=(B=B||(W?void 0:O))?B.allKeys:void 0;return this._trans("readwrite",function(J){var te=z.schema.primKey,Ee=te.auto,te=te.keyPath;if(te&&W)throw new Fe.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(W&&W.length!==_.length)throw new Fe.InvalidArgument("Arguments objects and keys must have the same length");var be=_.length,Ee=te&&Ee?_.map(ln(te)):_;return z.core.mutate({trans:J,type:"put",keys:W,values:Ee,wantResults:G}).then(function(pe){var me=pe.numFailures,we=pe.failures;if(me===0)return G?pe.results:pe.lastResult;throw new Ye("".concat(z.name,".bulkPut(): ").concat(me," of ").concat(be," operations failed"),we)})})},kn.prototype.bulkUpdate=function(_){var O=this,B=this.core,z=_.map(function(J){return J.key}),W=_.map(function(J){return J.changes}),G=[];return this._trans("readwrite",function(J){return B.getMany({trans:J,keys:z,cache:"clone"}).then(function(te){var be=[],Ee=[],pe=(_.forEach(function(me,we){var _e=me.key,ye=me.changes,ve=te[we];if(ve){for(var ke=0,Ie=Object.keys(ye);keAe+Ve&&ke(Ae+Ee)})})}var Ie=io(B)&&B.limit===1/0&&(typeof _!="function"||ye)&&{index:B.index,range:B.range};return ke(0).then(function(){if(0{for(var on=Math.min(Qe.length,it.length),Bt=-1,sn=0;sn=we})).length===0?ht.resolve():(ke.forEach(function(Ae){ve.push(function(){var Ve,Je,at,ut=Ie,Qe=Ae._cfg.dbschema,gt=(es(me,ut,ye),es(me,Qe,ye),Ie=me._dbSchema=Qe,Jo(ut,Qe)),dt=(gt.add.forEach(function(it){lo(ye,it[0],it[1].primKey,it[1].indexes)}),gt.change.forEach(function(it){if(it.recreate)throw new Fe.Upgrade("Not yet support for changing primary key");var vt=ye.objectStore(it.name);it.add.forEach(function(vn){return Cr(vt,vn)}),it.change.forEach(function(vn){vt.deleteIndex(vn.name),Cr(vt,vn)}),it.del.forEach(function(vn){return vt.deleteIndex(vn)})}),Ae._cfg.contentUpgrade);if(dt&&Ae._cfg.version>we)return Jn(me,ye),_e._memoizedTables={},Ve=V(Qe),gt.del.forEach(function(it){Ve[it]=ut[it]}),ga(me,[me.Transaction.prototype]),rn(me,[me.Transaction.prototype],o(Ve),Ve),_e.schema=Ve,(Je=ie(dt))&&La(),Qe=ht.follow(function(){var it;(at=dt(_e))&&Je&&(it=Sr.bind(null,null),at.then(it,it))}),at&&typeof at.then=="function"?ht.resolve(at):Qe.then(function(){return at})}),ve.push(function(Ve){var Je,at,ut=Ae._cfg.dbschema;Je=ut,at=Ve,[].slice.call(at.db.objectStoreNames).forEach(function(Qe){return Je[Qe]==null&&at.db.deleteObjectStore(Qe)}),ga(me,[me.Transaction.prototype]),rn(me,[me.Transaction.prototype],me._storeNames,me._dbSchema),_e.schema=me._dbSchema}),ve.push(function(Ve){me.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(me.idbdb.version/10)===Ae._cfg.version?(me.idbdb.deleteObjectStore("$meta"),delete me._dbSchema.$meta,me._storeNames=me._storeNames.filter(function(Je){return Je!=="$meta"})):Ve.objectStore("$meta").put(Ae._cfg.version,"version"))})}),(function Ae(){return ve.length?ht.resolve(ve.shift()(_e.idbtrans)).then(Ae):ht.resolve()})().then(function(){Xl(Ie,ye)}))}).catch(J);var be,Ee;o(W).forEach(function(pe){lo(B,pe,W[pe].primKey,W[pe].indexes)}),Jn(_,B),ht.follow(function(){return _.on.populate.fire(G)}).catch(J)})}function yl(_,O){Xl(_._dbSchema,O),O.db.version%10!=0||O.objectStoreNames.contains("$meta")||O.db.createObjectStore("$meta").add(Math.ceil(O.db.version/10-1),"version");var B=Fa(0,_.idbdb,O);es(_,_._dbSchema,O);for(var z=0,W=Jo(B,_._dbSchema).change;z{if(J.change.length||J.recreate)return console.warn("Unable to patch indexes of table ".concat(J.name," because it has changes on the type of index or primary key.")),{value:void 0};var te=O.objectStore(J.name);J.add.forEach(function(be){Bn&&console.debug("Dexie upgrade patch: Creating missing index ".concat(J.name,".").concat(be.src)),Cr(te,be)})})(W[z]);if(typeof G=="object")return G.value}}function Jo(_,O){var B,z={del:[],add:[],change:[]};for(B in _)O[B]||z.del.push(B);for(B in O){var W=_[B],G=O[B];if(W){var J={name:B,def:G,recreate:!1,del:[],add:[],change:[]};if(""+(W.primKey.keyPath||"")!=""+(G.primKey.keyPath||"")||W.primKey.auto!==G.primKey.auto)J.recreate=!0,z.change.push(J);else{var te=W.idxByName,be=G.idxByName,Ee=void 0;for(Ee in te)be[Ee]||J.del.push(Ee);for(Ee in be){var pe=te[Ee],me=be[Ee];pe?pe.src!==me.src&&J.change.push(me):J.add.push(me)}(0Math.pow(2,62)?0:ke.oldVersion,me=Ie<1,_.idbdb=ve.result,G&&yl(_,pe),so(_,Ie/10,pe,_e))},_e),ve.onsuccess=An(function(){pe=null;var ke,Ie,Ae,Ve,Je,at,ut=_.idbdb=ve.result,Qe=E(ut.objectStoreNames);if(0"u"?ht.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(we){function _e(){return indexedDB.databases().finally(we)}be=setInterval(_e,100),_e()}).finally(function(){return clearInterval(be)}):Promise.resolve()).then(te)]).then(function(){return J(),O.onReadyBeingFired=[],ht.resolve(vi(function(){return _.on.ready.fire(_.vip)})).then(function we(){var _e;if(0O.limit?z.length=O.limit:_.length===O.limit&&z.length{if(B===void 0)return z!==void 0?-1:0;if(z===void 0)return 1;if((B=ft(B,z))===0){if(W&&G)return 0;if(W)return 1;if(G)return-1}return B})(_.lower,O.lower,_.lowerOpen,O.lowerOpen)<=0&&0<=((B,z,W,G)=>{if(B===void 0)return z!==void 0?1:0;if(z===void 0)return-1;if((B=ft(B,z))===0){if(W&&G)return 0;if(W)return-1;if(G)return 1}return B})(_.upper,O.upper,_.upperOpen,O.upperOpen)}function bl(_,O,B,z){_.subscribers.add(B),z.addEventListener("abort",function(){var W,G;_.subscribers.delete(B),_.subscribers.size===0&&(W=_,G=O,setTimeout(function(){W.subscribers.size===0&&re(G,W)},3e3))})}var ef={stack:"dbcore",level:0,name:"Cache",create:function(_){var O=_.schema.name;return r(r({},_),{transaction:function(B,z,W){var G,J,te=_.transaction(B,z,W);return z==="readwrite"&&(W=(G=new AbortController).signal,te.addEventListener("abort",(J=function(be){return function(){if(G.abort(),z==="readwrite"){for(var Ee=new Set,pe=0,me=B;pe{var Ie=qa["idb://".concat(_e,"/").concat(ye)];if(!Ie)return[];if(!(_e=Ie.queries[ve]))return[null,!1,Ie,null];var Ae=_e[(ke.query?ke.query.index.name:null)||""];if(!Ae)return[null,!1,Ie,null];switch(ve){case"query":var Ve=Ae.find(function(Je){return Je.req.limit===ke.limit&&Je.req.values===ke.values&&fo(Je.req.query.range,ke.query.range)});return Ve?[Ve,!0,Ie,Ae]:[Ae.find(function(Je){return("limit"in Je.req?Je.req.limit:1/0)>=ke.limit&&(!ke.values||Je.req.values)&&vd(Je.req.query.range,ke.query.range)}),!1,Ie,Ae];case"count":return Ve=Ae.find(function(Je){return fo(Je.req.query.range,ke.query.range)}),[Ve,!!Ve,Ie,Ae]}})(O,B,"query",G),we=me[0],Ee=me[2],pe=me[3],we&&me[1]?we.obsSet=G.obsSet:(me=z.query(G).then(function(_e){var ye=_e.result;if(we&&(we.res=ye),J){for(var ve=0,ke=ye.length;ve{var Ve=ar();try{G&&La();var Je=Hi(_,Ae);return Je=G?Je.finally(Sr):Je}finally{Ve&&da()}})(ke={subscr:ve,signal:J.signal,requery:we,querier:_,trans:null}),Promise.resolve(Ie).then(function(Ae){B=!0,O=Ae,te||ke.signal.aborted||(be={},(Ve=>{for(var Je in Ve)if(m(Ve,Je))return;return 1})(Ee=ve)||me||(Xi($a,_e),me=!0),Da(function(){return!te&&W.next&&W.next(Ae)}))},function(Ae){B=!1,["DatabaseClosedError","AbortError"].includes(Ae==null?void 0:Ae.name)||te||Da(function(){te||W.error&&W.error(Ae)})}))};return setTimeout(we,0),pe});return z.hasValue=function(){return B},z.getValue=function(){return O},z}var Vs=Ro;function Ua(_){var O=Xr;try{Xr=!0,Xi.storagemutated.fire(_),Jl(_,!0)}finally{Xr=O}}y(Vs,r(r({},de),{delete:function(_){return new Vs(_,{addons:[]}).delete()},exists:function(_){return new Vs(_,{addons:[]}).open().then(function(O){return O.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(_){try{return O=Vs.dependencies,B=O.indexedDB,O=O.IDBKeyRange,(co(B)?Promise.resolve(B.databases()).then(function(z){return z.map(function(W){return W.name}).filter(function(W){return W!==Yo})}):Ls(B,O).toCollection().primaryKeys()).then(_)}catch{return nr(new Fe.MissingAPI)}var O,B},defineClass:function(){return function(_){c(this,_)}},ignoreTransaction:function(_){return Pt.trans?Ia(Pt.transless,_):_()},vip:vi,async:function(_){return function(){try{var O=Fs(_.apply(this,arguments));return O&&typeof O.then=="function"?O:ht.resolve(O)}catch(B){return nr(B)}}},spawn:function(_,O,B){try{var z=Fs(_.apply(B,O||[]));return z&&typeof z.then=="function"?z:ht.resolve(z)}catch(W){return nr(W)}},currentTransaction:{get:function(){return Pt.trans||null}},waitFor:function(_,O){return _=ht.resolve(typeof _=="function"?Vs.ignoreTransaction(_):_).timeout(O||6e4),Pt.trans?Pt.trans.waitFor(_):_},Promise:ht,debug:{get:function(){return Bn},set:function(_){_r(_)}},derive:x,extend:c,props:y,override:k,Events:ro,on:Xi,liveQuery:Di,extendObservabilitySet:ns,getByKeyPath:R,setByKeyPath:$,delByKeyPath:function(_,O){typeof O=="string"?$(_,O,void 0):"length"in O&&[].map.call(O,function(B){$(_,B,void 0)})},shallowClone:V,deepClone:oe,getObjectDiff:Ze,cmp:ft,asap:I,minKey:-1/0,addons:[],connections:pa,errnames:rt,dependencies:qs,cache:qa,semVer:"4.3.0",version:"4.3.0".split(".").map(function(_){return parseInt(_)}).reduce(function(_,O,B){return _+O/Math.pow(10,2*B)})})),Vs.maxKey=xe(Vs.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Xi($a,function(_){Xr||(_=new CustomEvent(Yi,{detail:_}),Xr=!0,dispatchEvent(_),Xr=!1)}),addEventListener(Yi,function(_){_=_.detail,Xr||Ua(_)}));var xl,Xr=!1,Ws=function(){};return typeof BroadcastChannel<"u"&&((Ws=function(){(xl=new BroadcastChannel(Yi)).onmessage=function(_){return _.data&&Ua(_.data)}})(),typeof xl.unref=="function"&&xl.unref(),Xi($a,function(_){Xr||xl.postMessage(_)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(_){if(!Ro.disableBfCache&&_.persisted){Bn&&console.debug("Dexie: handling persisted pagehide"),xl!=null&&xl.close();for(var O=0,B=pa;Onavigator.onLine,Tr={saveEntityLocally:async(e,t)=>{const n=e.toLowerCase().endsWith("s")?e.toLowerCase():`${e.toLowerCase()}s`,r=t.id||`off_${Date.now()}`,i={...t,id:r,sync_status:"pending",created_at:new Date().toISOString()};try{return await um[n].put(i),await um.pending_sync.add({id:`q_${Date.now()}`,entity_type:e,operation:"CREATE",payload:i,created_at:new Date().toISOString()}),console.log(`✅ Dexie: Data ${e} tersimpan aman!`),r}catch(a){throw console.error("❌ Dexie Error:",a),a}},getEntities:async(e,t={})=>{try{if(!e)return[];const n=e.toLowerCase().endsWith("s")?e.toLowerCase():`${e.toLowerCase()}s`,r=um[n];return r?t&&typeof t=="object"&&Object.keys(t).length>0?(console.log(`🔍 Fetching ${n} with filter:`,t),await r.where(t).toArray()):(console.log(`🔍 Fetching all from ${n}`),await r.reverse().toArray()):(console.error(`Tabel ${n} tidak ditemukan di Dexie`),[])}catch(n){return console.error("❌ Gagal ambil data dari Dexie:",n),[]}},getPendingCount:async()=>{try{return await um.pending_sync.count()}catch(e){return console.error("Gagal hitung antrean:",e),0}}};function u1e(){const[e,t]=M.useState(""),[n,r]=M.useState("all"),[i,a]=M.useState("all"),{data:o=[],isLoading:s}=bn({queryKey:["farmers"],queryFn:async()=>{let y=[];try{y=await mt.entities.Farmer.list("-created_date")}catch{console.warn("Server unreachable, loading local data only")}const b=await Tr.getEntities("farmers"),P=new Map;return c(y).forEach(x=>P.set(x.id,x)),c(b).forEach(x=>P.set(x.id,x)),Array.from(P.values()).sort((x,w)=>new Date(w.created_date||w.created_at)-new Date(x.created_date||x.created_at))}}),c=y=>Array.isArray(y)?y:[],d=c(o),p=[...new Set(d.map(y=>y.regency).filter(Boolean))],m=d.filter(y=>{var w,T,E;const b=!e||((w=y.full_name)==null?void 0:w.toLowerCase().includes(e.toLowerCase()))||((T=y.nik)==null?void 0:T.includes(e))||((E=y.farmer_group)==null?void 0:E.toLowerCase().includes(e.toLowerCase())),P=n==="all"||y.verification_status===n,x=i==="all"||y.regency===i;return b&&P&&x});return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-3xl font-bold text-slate-900",children:"Daftar Petani"}),h.jsxs("p",{className:"text-slate-500",children:[o.length," petani terdaftar"]})]}),h.jsx(zo,{to:ei("FarmerRegister"),children:h.jsxs(pt,{className:"bg-emerald-600 hover:bg-emerald-700 h-11",children:[h.jsx(Dc,{className:"w-5 h-5 mr-2"}),"Tambah Petani"]})})]}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"flex flex-col md:flex-row gap-3",children:[h.jsxs("div",{className:"relative flex-1",children:[h.jsx(tE,{className:"w-5 h-5 absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),h.jsx(nn,{placeholder:"Cari nama, NIK, atau kelompok tani...",value:e,onChange:y=>t(y.target.value),className:"h-11 pl-11 bg-white border-0 shadow-sm"})]}),h.jsxs(Hr,{value:n,onValueChange:r,children:[h.jsxs(Dr,{className:"w-full md:w-48 h-11 bg-white border-0 shadow-sm",children:[h.jsx(eE,{className:"w-4 h-4 mr-2 text-slate-400"}),h.jsx(Gr,{placeholder:"Status"})]}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"all",children:"Semua Status"}),h.jsx(Kt,{value:"pending",children:"Pending"}),h.jsx(Kt,{value:"verified",children:"Terverifikasi"}),h.jsx(Kt,{value:"rejected",children:"Ditolak"})]})]}),h.jsxs(Hr,{value:i,onValueChange:a,children:[h.jsx(Dr,{className:"w-full md:w-48 h-11 bg-white border-0 shadow-sm",children:h.jsx(Gr,{placeholder:"Kabupaten"})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"all",children:"Semua Kabupaten"}),p.map(y=>h.jsx(Kt,{value:y,children:y},y))]})]})]}),s?h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(y=>h.jsx("div",{className:"h-48 bg-white rounded-xl animate-pulse"},y))}):m.length>0?h.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:m.map((y,b)=>h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:b*.05},children:h.jsx(Obe,{farmer:y})},y.id))}):h.jsx(Qa,{icon:ll,title:"Tidak ada petani ditemukan",description:e||n!=="all"||i!=="all"?"Coba ubah filter pencarian Anda":"Mulai dengan mendaftarkan petani baru",action:()=>window.location.href=ei("FarmerRegister"),actionLabel:"Tambah Petani Pertama"})]})})}var c1e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],f1e=c1e.reduce((e,t)=>{const n=sk(`Primitive.${t}`),r=M.forwardRef((i,a)=>{const{asChild:o,...s}=i,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(c,{...s,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),d1e="Label",Y8=M.forwardRef((e,t)=>h.jsx(f1e.label,{...e,ref:t,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Y8.displayName=d1e;var X8=Y8;const h1e=Q0("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),St=M.forwardRef(({className:e,...t},n)=>h.jsx(X8,{ref:n,className:fn(h1e(),e),...t}));St.displayName=X8.displayName;function Q8({initialData:e,onSubmit:t,isLoading:n}){const[r,i]=M.useState(e||{nik:"",full_name:"",phone:"",farmer_group:"",village:"",district:"",regency:"",province:"",verification_status:"pending",sync_status:"pending"}),{data:a}=bn({queryKey:["provinces"],queryFn:()=>mt.entities.Province.list()}),o=Array.isArray(a)?a:a!=null&&a.data&&Array.isArray(a.data)?a.data:[],s=(d,p)=>{i(m=>({...m,[d]:p}))},c=d=>{d.preventDefault(),t(r)};return M.useEffect(()=>{Array.isArray(o)&&o.length>0&&i(d=>({...d,province:o[0].name}))},[o]),h.jsxs("form",{onSubmit:c,className:"space-y-6",children:[h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{className:"pb-4",children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(zf,{className:"w-5 h-5 text-emerald-600"}),"Data Identitas"]})}),h.jsxs(Pn,{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{htmlFor:"nik",children:"NIK (Nomor Induk Kependudukan)"}),h.jsx(nn,{id:"nik",value:r.nik,onChange:d=>s("nik",d.target.value),placeholder:"16 digit NIK",maxLength:16,required:!0,className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{htmlFor:"full_name",children:"Nama Lengkap"}),h.jsx(nn,{id:"full_name",value:r.full_name,onChange:d=>s("full_name",d.target.value),placeholder:"Nama sesuai KTP",required:!0,className:"h-11"})]})]}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{htmlFor:"phone",children:"Nomor Telepon"}),h.jsxs("div",{className:"relative",children:[h.jsx(Yh,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),h.jsx(nn,{id:"phone",value:r.phone,onChange:d=>s("phone",d.target.value),placeholder:"08xxxxxxxxxx",className:"h-11 pl-10"})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{htmlFor:"farmer_group",children:"Kelompok Tani"}),h.jsxs("div",{className:"relative",children:[h.jsx(ll,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),h.jsx(nn,{id:"farmer_group",value:r.farmer_group,onChange:d=>s("farmer_group",d.target.value),placeholder:"Nama kelompok tani",className:"h-11 pl-10"})]})]})]})]})]}),h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{className:"pb-4",children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(So,{className:"w-5 h-5 text-emerald-600"}),"Alamat Domisili"]})}),h.jsxs(Pn,{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{htmlFor:"province",children:"Provinsi"}),h.jsxs(Hr,{value:r.province,onValueChange:d=>s("province",d),children:[h.jsx(Dr,{className:"h-11",children:h.jsx(Gr,{placeholder:"Pilih provinsi"})}),h.jsx(Br,{children:o.length>0?o.map((d,p)=>h.jsx(Kt,{value:d.nama||d.name,children:d.nama||d.name},d.id||p)):h.jsx(Kt,{value:"none",disabled:!0,children:"Data tidak tersedia"})})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{htmlFor:"regency",children:"Kabupaten/Kota"}),h.jsx(nn,{id:"regency",value:r.regency,onChange:d=>s("regency",d.target.value),placeholder:"Nama kabupaten/kota",required:!0,className:"h-11"})]})]}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{htmlFor:"district",children:"Kecamatan"}),h.jsx(nn,{id:"district",value:r.district,onChange:d=>s("district",d.target.value),placeholder:"Nama kecamatan",required:!0,className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{htmlFor:"village",children:"Desa/Kelurahan"}),h.jsx(nn,{id:"village",value:r.village,onChange:d=>s("village",d.target.value),placeholder:"Nama desa/kelurahan",required:!0,className:"h-11"})]})]})]})]}),h.jsx("div",{className:"flex justify-end gap-3",children:h.jsxs(pt,{type:"submit",disabled:n,className:"bg-emerald-600 hover:bg-emerald-700 h-11 px-8",children:[n&&h.jsx(ti,{className:"w-4 h-4 mr-2 animate-spin"}),e?"Simpan Perubahan":"Daftarkan Petani"]})})]})}function p1e(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}Array(12).fill(0);let HT=1;class m1e{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:r,...i}=t,a=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:HT++,o=this.toasts.find(c=>c.id===a),s=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(c=>c.id===a?(this.publish({...c,...t,id:a,title:r}),{...c,...t,id:a,dismissible:s,title:r}):c):this.addToast({title:r,...i,dismissible:s,id:a}),a},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let a=r!==void 0,o;const s=i.then(async d=>{if(o=["resolve",d],ce.isValidElement(d))a=!1,this.create({id:r,type:"default",message:d});else if(v1e(d)&&!d.ok){a=!1;const m=typeof n.error=="function"?await n.error(`HTTP error! status: ${d.status}`):n.error,y=typeof n.description=="function"?await n.description(`HTTP error! status: ${d.status}`):n.description,P=typeof m=="object"&&!ce.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:y,...P})}else if(d instanceof Error){a=!1;const m=typeof n.error=="function"?await n.error(d):n.error,y=typeof n.description=="function"?await n.description(d):n.description,P=typeof m=="object"&&!ce.isValidElement(m)?m:{message:m};this.create({id:r,type:"error",description:y,...P})}else if(n.success!==void 0){a=!1;const m=typeof n.success=="function"?await n.success(d):n.success,y=typeof n.description=="function"?await n.description(d):n.description,P=typeof m=="object"&&!ce.isValidElement(m)?m:{message:m};this.create({id:r,type:"success",description:y,...P})}}).catch(async d=>{if(o=["reject",d],n.error!==void 0){a=!1;const p=typeof n.error=="function"?await n.error(d):n.error,m=typeof n.description=="function"?await n.description(d):n.description,b=typeof p=="object"&&!ce.isValidElement(p)?p:{message:p};this.create({id:r,type:"error",description:m,...b})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((d,p)=>s.then(()=>o[0]==="reject"?p(o[1]):d(o[1])).catch(p));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(t,n)=>{const r=(n==null?void 0:n.id)||HT++;return this.create({jsx:t(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const ys=new m1e,g1e=(e,t)=>{const n=(t==null?void 0:t.id)||HT++;return ys.addToast({title:e,...t,id:n}),n},v1e=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",y1e=g1e,b1e=()=>ys.toasts,x1e=()=>ys.getActiveToasts(),Mt=Object.assign(y1e,{success:ys.success,info:ys.info,warning:ys.warning,error:ys.error,custom:ys.custom,message:ys.message,promise:ys.promise,dismiss:ys.dismiss,loading:ys.loading},{getHistory:b1e,getToasts:x1e});p1e("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function w1e(){const e=dE(),t=As(),n=ci({mutationFn:async r=>{console.log("1. Memulai proses simpan...",r);try{const i=await mt.entities.Farmer.create(r);if(typeof i=="string"&&i.includes(""))throw new Error("Menerima HTML, bukan JSON. Endpoint mungkin salah.");return console.log("2. Berhasil simpan ke server",i),i}catch(i){throw console.log("2. Gagal ke server, beralih ke offline mode",i),{type:"OFFLINE_SAVE",data:r}}},onSuccess:r=>{t.invalidateQueries({queryKey:["farmers"]}),Mt.success("Petani berhasil didaftarkan ke server!"),e(ei("Farmers"))},onError:async(r,i)=>{if(r.type==="OFFLINE_SAVE")try{const o=await Tr.saveEntityLocally("farmer",i),s={...i,id:o,sync_status:"pending"};t.setQueryData(["farmers"],c=>c?[s,...c]:[s]),Mt.info("Tersimpan secara lokal"),setTimeout(()=>{e(ei("Farmers"))},500)}catch(a){console.error("SQLite Error:",a),Mt.error("Gagal simpan lokal")}}});return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-3xl mx-auto p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center gap-4",children:[h.jsx(zo,{to:ei("Farmers"),children:h.jsx(pt,{variant:"outline",size:"icon",className:"h-10 w-10",children:h.jsx(J0,{className:"w-5 h-5"})})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Registrasi Petani Baru"}),h.jsx("p",{className:"text-slate-500",children:"Isi data identitas dan alamat petani"})]})]}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:h.jsx(Q8,{onSubmit:r=>n.mutate(r),isLoading:n.isPending})})]})})}const _1e={valid:"bg-emerald-100 text-emerald-700 border-emerald-200",invalid:"bg-rose-100 text-rose-700 border-rose-200",need_review:"bg-amber-100 text-amber-700 border-amber-200",pending:"bg-slate-100 text-slate-600 border-slate-200"},S1e={valid:"Tervalidasi",invalid:"Tidak Valid",need_review:"Perlu Review",pending:"Menunggu"},P1e={owned:"Milik Sendiri",rented:"Sewa",shared:"Bagi Hasil",government:"Tanah Negara"};function Sk({land:e,farmerName:t,plantCount:n=0}){return h.jsxs(Tt,{className:"border-0 shadow-sm hover:shadow-md transition-all p-5 bg-white group",children:[h.jsxs("div",{className:"flex items-start justify-between mb-4",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"font-semibold text-slate-900",children:e.name}),t&&h.jsx("p",{className:"text-sm text-slate-500",children:t})]}),h.jsx(ur,{className:`${_1e[e.validation_status]} border font-medium text-xs`,children:S1e[e.validation_status]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[h.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[h.jsxs("div",{className:"flex items-center gap-2 text-slate-500 text-xs mb-1",children:[h.jsx(eF,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:"Luas Lahan"})]}),h.jsx("p",{className:"font-semibold text-slate-900",children:e.area_hectares?`${e.area_hectares.toFixed(2)} Ha`:"-"})]}),h.jsxs("div",{className:"bg-slate-50 rounded-lg p-3",children:[h.jsxs("div",{className:"flex items-center gap-2 text-slate-500 text-xs mb-1",children:[h.jsx(sa,{className:"w-3.5 h-3.5"}),h.jsx("span",{children:"Jumlah Pohon"})]}),h.jsx("p",{className:"font-semibold text-slate-900",children:n})]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-500",children:[h.jsx(So,{className:"w-4 h-4"}),h.jsxs("span",{className:"truncate",children:[e.village,", ",e.district]})]}),h.jsx(zo,{to:ei("LandDetail")+`?id=${e.id}`,children:h.jsxs(pt,{variant:"ghost",size:"sm",className:"opacity-0 group-hover:opacity-100 transition-opacity text-emerald-600",children:["Detail",h.jsx(tb,{className:"w-4 h-4 ml-1"})]})})]}),e.land_status&&h.jsx("div",{className:"mt-3 pt-3 border-t border-slate-100",children:h.jsxs("span",{className:"text-xs text-slate-500",children:["Status: ",P1e[e.land_status]]})})]})}const y$={pending:{icon:Q$,label:"Belum Disinkronkan",className:"bg-amber-100 text-amber-700 border-amber-200"},syncing:{icon:ti,label:"Menyinkronkan...",className:"bg-blue-100 text-blue-700 border-blue-200"},synced:{icon:JT,label:"Tersinkronkan",className:"bg-emerald-100 text-emerald-700 border-emerald-200"},failed:{icon:EH,label:"Gagal Sinkronisasi",className:"bg-rose-100 text-rose-700 border-rose-200"}};function J8({status:e="pending",showLabel:t=!0,size:n="default"}){const r=y$[e]||y$.pending,i=r.icon;return h.jsxs(ur,{className:`${r.className} border font-medium ${n==="sm"?"text-xs px-2 py-0.5":""}`,children:[h.jsx(i,{className:`${n==="sm"?"w-3 h-3":"w-4 h-4"} ${t?"mr-1.5":""} ${e==="syncing"?"animate-spin":""}`}),t&&r.label]})}function j1e({farmerId:e,onLinked:t}){const[n,r]=M.useState(""),i=ci({mutationFn:async o=>{await mt.entities.Farmer.update(e,{user_email:o})},onSuccess:()=>{Mt.success("Akun berhasil dihubungkan!"),r(""),t==null||t()},onError:()=>{Mt.error("Gagal menghubungkan akun")}}),a=o=>{if(o.preventDefault(),!n){Mt.error("Masukkan email user");return}i.mutate(n)};return h.jsxs("form",{onSubmit:a,className:"space-y-3",children:[h.jsx(St,{className:"text-sm text-slate-600",children:"Hubungkan Akun User"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(nn,{type:"email",value:n,onChange:o=>r(o.target.value),placeholder:"Email user petani",className:"flex-1 h-9 text-sm"}),h.jsx(pt,{type:"submit",size:"sm",disabled:i.isPending,className:"bg-emerald-600 hover:bg-emerald-700",children:i.isPending?h.jsx(ti,{className:"w-4 h-4 animate-spin"}):h.jsx(S9,{className:"w-4 h-4"})})]}),h.jsx("p",{className:"text-xs text-slate-400",children:"Petani dapat login dengan email ini untuk mengelola data sendiri"})]})}function O1e(){var k,D;const t=new URLSearchParams(window.location.search).get("id"),n=As(),{id:r}=WF(),i=r||t,[a,o]=M.useState(!1),{data:s=[]}=bn({queryKey:["farmers"],queryFn:()=>mt.entities.Farmer.list("-created_date"),enabled:!0}),{data:c=[],isLoading:d}=bn({queryKey:["farmer",i],queryFn:async I=>{if(!i)return null;try{const $=await mt.entities.Farmer.get(i);if(typeof $=="string"&&$.includes(""))console.warn("API returned HTML instead of JSON. Falling back to local.");else if($&&!$.error)return $}catch{console.warn("Server unreachable, searching locally...")}const R=await Tr.getEntities("farmers",{id:i});return R&&R.length>0?{...R[0],isOffline:!0}:null},enabled:!!i,initialData:null});console.log("Farmer Detail",c);const{data:p=[]}=bn({queryKey:["lands"],queryFn:async()=>{let I=[];try{const K=await mt.entities.Land.list("-created_date");typeof K=="string"&&K.includes("")?console.warn("Server returned HTML for Land list"):Array.isArray(K)&&(I=K)}catch{console.warn("Server lands unreachable")}const R=await Tr.getEntities("lands"),$=new js;I.forEach(K=>{K.id&&$.set(K.id,K)}),R.forEach(K=>{K.id&&$.set(K.id,K)});const V=Array.from($.values());return console.log("🔍 Dexie & Server Merge:",V.length,"items"),V}}),m=M.useMemo(()=>{const I=Array.isArray(p)?p:[];return console.log("Filtering lands for farmer ID:",i),I.filter(R=>R.farmer_id==i)},[p,i]),{data:y=[]}=bn({queryKey:["plants",i],queryFn:async()=>{try{const I=await mt.entities.Plant.filter({farmer_id:i});return Array.isArray(I)?I:[]}catch{return await Tr.getEntities("plants",{farmer_id:i})}},enabled:!!i}),b=Array.isArray(y)?y:[],P=ci({mutationFn:I=>mt.entities.Farmer.update(i,{verification_status:I}),onSuccess:()=>{n.invalidateQueries({queryKey:["farmer",i]}),Mt.success("Status verifikasi diperbarui!")}}),x=ci({mutationFn:I=>mt.entities.Farmer.update(i,I),onSuccess:()=>{n.invalidateQueries({queryKey:["farmer",i]}),Mt.success("Data petani diperbarui!"),o(!1)}});if(d)return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 flex items-center justify-center",children:h.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-emerald-600 border-t-transparent rounded-full"})});if(!c)return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 p-6",children:h.jsx(Qa,{icon:ll,title:"Petani tidak ditemukan",description:"Data petani yang Anda cari tidak tersedia",action:()=>window.location.href=ei("Farmers"),actionLabel:"Kembali ke Daftar"})});const w={pending:{bg:"bg-amber-50",border:"border-amber-200",text:"text-amber-700",icon:Hf},verified:{bg:"bg-emerald-50",border:"border-emerald-200",text:"text-emerald-700",icon:la},rejected:{bg:"bg-rose-50",border:"border-rose-200",text:"text-rose-700",icon:ph}},T=w[c.verification_status]||w.pending,E=T.icon;return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-5xl mx-auto p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx(zo,{to:ei("Farmers"),children:h.jsx(pt,{variant:"outline",size:"icon",className:"h-10 w-10",children:h.jsx(J0,{className:"w-5 h-5"})})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:c.full_name}),h.jsxs("p",{className:"text-slate-500",children:["NIK: ",c.nik]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(J8,{status:c.sync_status}),h.jsxs(pt,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[h.jsx(aF,{className:"w-4 h-4 mr-2"}),"Edit"]})]})]}),a&&h.jsxs(Rt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:[h.jsx(Q8,{initialData:c,isLoading:x.isLoading,onSubmit:I=>x.mutate(I)}),h.jsx("div",{className:"flex justify-end mt-4",children:h.jsx(pt,{variant:"ghost",onClick:()=>o(!1),children:"Batal"})})]}),!a&&h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[h.jsx(Rt.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.1},className:"lg:col-span-1",children:h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsxs(Pn,{className:"p-6",children:[h.jsxs("div",{className:"flex flex-col items-center text-center mb-6",children:[h.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-emerald-100 to-emerald-200 flex items-center justify-center mb-4",children:c.photo_url?h.jsx("img",{src:c.photo_url,alt:c.full_name,className:"w-full h-full rounded-full object-cover"}):h.jsx("span",{className:"text-3xl font-bold text-emerald-700",children:(D=(k=c.full_name)==null?void 0:k.charAt(0))==null?void 0:D.toUpperCase()})}),h.jsx("h3",{className:"font-semibold text-lg text-slate-900",children:c.full_name}),h.jsxs("div",{className:`flex items-center gap-2 mt-2 px-3 py-1.5 rounded-full ${T.bg} ${T.border} border`,children:[h.jsx(E,{className:`w-4 h-4 ${T.text}`}),h.jsx("span",{className:`text-sm font-medium ${T.text}`,children:c.verification_status==="verified"?"Terverifikasi":c.verification_status==="rejected"?"Ditolak":"Menunggu Verifikasi"})]})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx($H,{className:"w-5 h-5 text-slate-400 mt-0.5"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"NIK"}),h.jsx("p",{className:"font-medium text-slate-900",children:c.nik})]})]}),c.phone&&h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx(Yh,{className:"w-5 h-5 text-slate-400 mt-0.5"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Telepon"}),h.jsx("p",{className:"font-medium text-slate-900",children:c.phone})]})]}),c.farmer_group&&h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx(ll,{className:"w-5 h-5 text-slate-400 mt-0.5"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Kelompok Tani"}),h.jsx("p",{className:"font-medium text-slate-900",children:c.farmer_group})]})]}),h.jsxs("div",{className:"flex items-start gap-3",children:[h.jsx(So,{className:"w-5 h-5 text-slate-400 mt-0.5"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Alamat"}),h.jsxs("p",{className:"font-medium text-slate-900",children:[c.village,", ",c.district,h.jsx("br",{}),c.regency,", ",c.province]})]})]})]}),c.verification_status==="pending"&&h.jsxs("div",{className:"mt-6 pt-6 border-t border-slate-100 space-y-2",children:[h.jsx("p",{className:"text-sm text-slate-500 text-center mb-3",children:"Tindakan Verifikasi"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(pt,{className:"flex-1 bg-emerald-600 hover:bg-emerald-700",onClick:()=>P.mutate("verified"),disabled:P.isPending,children:[h.jsx(la,{className:"w-4 h-4 mr-2"}),"Terima"]}),h.jsxs(pt,{variant:"destructive",className:"flex-1",onClick:()=>P.mutate("rejected"),disabled:P.isPending,children:[h.jsx(ph,{className:"w-4 h-4 mr-2"}),"Tolak"]})]})]}),!c.user_email&&h.jsx("div",{className:"mt-6 pt-6 border-t border-slate-100",children:h.jsx(j1e,{farmerId:c.id,onLinked:()=>n.invalidateQueries({queryKey:["farmer",i]})})}),c.user_email&&h.jsxs("div",{className:"mt-6 pt-6 border-t border-slate-100",children:[h.jsx("p",{className:"text-xs text-slate-500 text-center mb-2",children:"Akun Terhubung"}),h.jsx("p",{className:"text-sm font-medium text-center text-emerald-600",children:c.user_email})]})]})})}),h.jsxs(Rt.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{delay:.2},className:"lg:col-span-2 space-y-6",children:[h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsxs(Ti,{className:"flex flex-row items-center justify-between pb-4",children:[h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(js,{className:"w-5 h-5 text-emerald-600"}),"Lahan Terdaftar"]}),h.jsx(zo,{to:ei("LandRegister")+`?farmer_id=${i}`,children:h.jsxs(pt,{size:"sm",variant:"outline",children:[h.jsx(Dc,{className:"w-4 h-4 mr-2"}),"Tambah Lahan"]})})]}),h.jsx(Pn,{children:m.length>0?h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:m.map(I=>h.jsx(Sk,{land:I,plantCount:b.filter(R=>R.land_id===I.id).length},I.id))}):h.jsxs("div",{className:"text-center py-8 text-slate-500",children:[h.jsx(js,{className:"w-12 h-12 mx-auto text-slate-300 mb-3"}),h.jsx("p",{children:"Belum ada lahan terdaftar"})]})})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[h.jsxs(Tt,{className:"border-0 shadow-sm p-4",children:[h.jsx("p",{className:"text-sm text-slate-500",children:"Total Lahan"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:m.length})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4",children:[h.jsx("p",{className:"text-sm text-slate-500",children:"Total Luas"}),h.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[m.reduce((I,R)=>I+(R.area_hectares||0),0).toFixed(2)," Ha"]})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4",children:[h.jsx("p",{className:"text-sm text-slate-500",children:"Total Tanaman"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:b.length})]})]})]})]})]})})}function eW(e,t){const n=M.useRef(t);M.useEffect(function(){t!==n.current&&e.attributionControl!=null&&(n.current!=null&&e.attributionControl.removeAttribution(n.current),t!=null&&e.attributionControl.addAttribution(t)),n.current=t},[e,t])}const T1e=1;function E1e(e){return Object.freeze({__version:T1e,map:e})}function tW(e,t){return Object.freeze({...e,...t})}const nW=M.createContext(null),rW=nW.Provider;function lx(){const e=M.useContext(nW);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function iW(e){function t(n,r){const{instance:i,context:a}=e(n).current;return M.useImperativeHandle(r,()=>i),n.children==null?null:ce.createElement(rW,{value:a},n.children)}return M.forwardRef(t)}function A1e(e){function t(n,r){const[i,a]=M.useState(!1),{instance:o}=e(n,a).current;M.useImperativeHandle(r,()=>o),M.useEffect(function(){i&&o.update()},[o,i,n.children]);const s=o._contentNode;return s?Qh.createPortal(n.children,s):null}return M.forwardRef(t)}function k1e(e){function t(n,r){const{instance:i}=e(n).current;return M.useImperativeHandle(r,()=>i),null}return M.forwardRef(t)}function Pk(e,t){const n=M.useRef();M.useEffect(function(){return t!=null&&e.instance.on(t),n.current=t,function(){n.current!=null&&e.instance.off(n.current),n.current=null}},[e,t])}function ux(e,t){const n=e.pane??t.pane;return n?{...e,pane:n}:e}function C1e(e,t){return function(r,i){const a=lx(),o=e(ux(r,a),a);return eW(a.map,r.attribution),Pk(o.current,r.eventHandlers),t(o.current,a,r,i),o}}var cm={exports:{}};/* @preserve * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade */var N1e=cm.exports,b$;function M1e(){return b$||(b$=1,(function(e,t){(function(n,r){r(t)})(N1e,(function(n){var r="1.9.4";function i(u){var g,S,C,U;for(S=1,C=arguments.length;S"u"||!L||!L.Mixin)){u=k(u)?u:[u];for(var g=0;g0?Math.floor(u):Math.ceil(u)};re.prototype={clone:function(){return new re(this.x,this.y)},add:function(u){return this.clone()._add(ae(u))},_add:function(u){return this.x+=u.x,this.y+=u.y,this},subtract:function(u){return this.clone()._subtract(ae(u))},_subtract:function(u){return this.x-=u.x,this.y-=u.y,this},divideBy:function(u){return this.clone()._divideBy(u)},_divideBy:function(u){return this.x/=u,this.y/=u,this},multiplyBy:function(u){return this.clone()._multiplyBy(u)},_multiplyBy:function(u){return this.x*=u,this.y*=u,this},scaleBy:function(u){return new re(this.x*u.x,this.y*u.y)},unscaleBy:function(u){return new re(this.x/u.x,this.y/u.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=Ce(this.x),this.y=Ce(this.y),this},distanceTo:function(u){u=ae(u);var g=u.x-this.x,S=u.y-this.y;return Math.sqrt(g*g+S*S)},equals:function(u){return u=ae(u),u.x===this.x&&u.y===this.y},contains:function(u){return u=ae(u),Math.abs(u.x)<=Math.abs(this.x)&&Math.abs(u.y)<=Math.abs(this.y)},toString:function(){return"Point("+y(this.x)+", "+y(this.y)+")"}};function ae(u,g,S){return u instanceof re?u:k(u)?new re(u[0],u[1]):u==null?u:typeof u=="object"&&"x"in u&&"y"in u?new re(u.x,u.y):new re(u,g,S)}function ie(u,g){if(u)for(var S=g?[u,g]:u,C=0,U=S.length;C=this.min.x&&S.x<=this.max.x&&g.y>=this.min.y&&S.y<=this.max.y},intersects:function(u){u=de(u);var g=this.min,S=this.max,C=u.min,U=u.max,Q=U.x>=g.x&&C.x<=S.x,le=U.y>=g.y&&C.y<=S.y;return Q&&le},overlaps:function(u){u=de(u);var g=this.min,S=this.max,C=u.min,U=u.max,Q=U.x>g.x&&C.xg.y&&C.y=g.lat&&U.lat<=S.lat&&C.lng>=g.lng&&U.lng<=S.lng},intersects:function(u){u=je(u);var g=this._southWest,S=this._northEast,C=u.getSouthWest(),U=u.getNorthEast(),Q=U.lat>=g.lat&&C.lat<=S.lat,le=U.lng>=g.lng&&C.lng<=S.lng;return Q&&le},overlaps:function(u){u=je(u);var g=this._southWest,S=this._northEast,C=u.getSouthWest(),U=u.getNorthEast(),Q=U.lat>g.lat&&C.latg.lng&&C.lng1,Yl=(function(){var u=!1;try{var g=Object.defineProperty({},"passive",{get:function(){u=!0}});window.addEventListener("testPassiveEventSupport",m,g),window.removeEventListener("testPassiveEventSupport",m,g)}catch{}return u})(),ar=(function(){return!!document.createElement("canvas").getContext})(),da=!!(document.createElementNS&&dn("svg").createSVGRect),Ni=!!da&&(function(){var u=document.createElement("div");return u.innerHTML="",(u.firstChild&&u.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),Ao=!da&&(function(){try{var u=document.createElement("div");u.innerHTML='';var g=u.firstChild;return g.style.behavior="url(#default#VML)",g&&typeof g.adj=="object"}catch{return!1}})(),An=navigator.platform.indexOf("Mac")===0,or=navigator.platform.indexOf("Linux")===0;function Rn(u){return navigator.userAgent.toLowerCase().indexOf(u)>=0}var _t={ie:Ar,ielt9:Zr,edge:$r,webkit:Bn,android:_r,android23:fr,androidStock:ua,opera:Fr,chrome:ca,gecko:Eo,safari:Vt,phantom:Na,opera12:Wi,win:Ja,ie3d:Ki,webkit3d:Ho,gecko3d:qr,any3d:Pt,mobile:Ci,mobileWebkit:fa,mobileWebkit3d:lt,msPointer:ht,pointer:Ma,touch:Go,touchNative:vr,mobileOpera:Cs,mobileGecko:Zo,retina:eo,passiveEvents:Yl,canvas:ar,svg:da,vml:Ao,inlineSvg:Ni,mac:An,linux:or},to=_t.msPointer?"MSPointerDown":"pointerdown",Ra=_t.msPointer?"MSPointerMove":"pointermove",$u=_t.msPointer?"MSPointerUp":"pointerup",Hi=_t.msPointer?"MSPointerCancel":"pointercancel",La={touchstart:to,touchmove:Ra,touchend:$u,touchcancel:Hi},Sr={touchstart:jn,touchmove:hi,touchend:hi,touchcancel:hi},ha={},Mi=!1;function Gi(u,g,S){return g==="touchstart"&&nr(),Sr[g]?(S=Sr[g].bind(this,S),u.addEventListener(La[g],S,!1),S):(console.warn("wrong event specified:",g),m)}function Ns(u,g,S){if(!La[g]){console.warn("wrong event specified:",g);return}u.removeEventListener(La[g],S,!1)}function Ia(u){ha[u.pointerId]=u}function vl(u){ha[u.pointerId]&&(ha[u.pointerId]=u)}function Da(u){delete ha[u.pointerId]}function nr(){Mi||(document.addEventListener(to,Ia,!0),document.addEventListener(Ra,vl,!0),document.addEventListener($u,Da,!0),document.addEventListener(Hi,Da,!0),Mi=!0)}function hi(u,g){if(g.pointerType!==(g.MSPOINTER_TYPE_MOUSE||"mouse")){g.touches=[];for(var S in ha)g.touches.push(ha[S]);g.changedTouches=[g],u(g)}}function jn(u,g){g.MSPOINTER_TYPE_TOUCH&&g.pointerType===g.MSPOINTER_TYPE_TOUCH&&X(g),hi(u,g)}function ko(u){var g={},S,C;for(C in u)S=u[C],g[C]=S&&S.bind?S.bind(u):S;return u=g,g.type="dblclick",g.detail=2,g.isTrusted=!1,g._simulated=!0,g}var pa=200;function Yo(u,g){u.addEventListener("dblclick",g);var S=0,C;function U(Q){if(Q.detail!==1){C=Q.detail;return}if(!(Q.pointerType==="mouse"||Q.sourceCapabilities&&!Q.sourceCapabilities.firesTouchEvents)){var le=Le(Q);if(!(le.some(function(Be){return Be instanceof HTMLLabelElement&&Be.attributes.for})&&!le.some(function(Be){return Be instanceof HTMLInputElement||Be instanceof HTMLSelectElement}))){var Me=Date.now();Me-S<=pa?(C++,C===2&&g(ko(Q))):C=1,S=Me}}}return u.addEventListener("click",U),{dblclick:g,simDblclick:U}}function Co(u,g){u.removeEventListener("dblclick",g.dblclick),u.removeEventListener("click",g.simDblclick)}var Xo=ma(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Ri=ma(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),pi=Ri==="webkitTransition"||Ri==="OTransition"?Ri+"End":"transitionend";function ln(u){return typeof u=="string"?document.getElementById(u):u}function Li(u,g){var S=u.style[g]||u.currentStyle&&u.currentStyle[g];if((!S||S==="auto")&&document.defaultView){var C=document.defaultView.getComputedStyle(u,null);S=C?C[g]:null}return S==="auto"?null:S}function ft(u,g,S){var C=document.createElement(u);return C.className=g||"",S&&S.appendChild(C),C}function $n(u){var g=u.parentNode;g&&g.removeChild(u)}function no(u){for(;u.firstChild;)u.removeChild(u.firstChild)}function Zi(u){var g=u.parentNode;g&&g.lastChild!==u&&g.appendChild(u)}function mi(u){var g=u.parentNode;g&&g.firstChild!==u&&g.insertBefore(u,g.firstChild)}function No(u,g){if(u.classList!==void 0)return u.classList.contains(g);var S=ro(u);return S.length>0&&new RegExp("(^|\\s)"+g+"(\\s|$)").test(S)}function qt(u,g){if(u.classList!==void 0)for(var S=P(g),C=0,U=S.length;C0?2*window.devicePixelRatio:1;function Sn(u){return _t.edge?u.wheelDeltaY/2:u.deltaY&&u.deltaMode===0?-u.deltaY/zt:u.deltaY&&u.deltaMode===1?-u.deltaY*20:u.deltaY&&u.deltaMode===2?-u.deltaY*60:u.deltaX||u.deltaZ?0:u.wheelDelta?(u.wheelDeltaY||u.wheelDelta)/2:u.detail&&Math.abs(u.detail)<32765?-u.detail*20:u.detail?u.detail/-32765*60:0}function Zt(u,g){var S=g.relatedTarget;if(!S)return!0;try{for(;S&&S!==u;)S=S.parentNode}catch{return!1}return S!==u}var Ln={__proto__:null,on:xt,off:On,stopPropagation:A,disableScrollPropagation:q,disableClickPropagation:H,preventDefault:X,stop:xe,getPropagationPath:Le,getMousePosition:Ge,getWheelDelta:Sn,isExternalTarget:Zt,addListener:xt,removeListener:On},Jn=Oe.extend({run:function(u,g,S,C){this.stop(),this._el=u,this._inProgress=!0,this._duration=S||.25,this._easeOutPower=1/Math.max(C||.5,.2),this._startPos=zr(u),this._offset=g.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=ee(this._animate,this),this._step()},_step:function(u){var g=+new Date-this._startTime,S=this._duration*1e3;gthis.options.maxZoom)?this.setZoom(u):this},panInsideBounds:function(u,g){this._enforcingBounds=!0;var S=this.getCenter(),C=this._limitCenter(S,this._zoom,je(u));return S.equals(C)||this.panTo(C,g),this._enforcingBounds=!1,this},panInside:function(u,g){g=g||{};var S=ae(g.paddingTopLeft||g.padding||[0,0]),C=ae(g.paddingBottomRight||g.padding||[0,0]),U=this.project(this.getCenter()),Q=this.project(u),le=this.getPixelBounds(),Me=de([le.min.add(S),le.max.subtract(C)]),Be=Me.getSize();if(!Me.contains(Q)){this._enforcingBounds=!0;var Xe=Q.subtract(Me.getCenter()),yt=Me.extend(Q).getSize().subtract(Be);U.x+=Xe.x<0?-yt.x:yt.x,U.y+=Xe.y<0?-yt.y:yt.y,this.panTo(this.unproject(U),g),this._enforcingBounds=!1}return this},invalidateSize:function(u){if(!this._loaded)return this;u=i({animate:!1,pan:!0},u===!0?{animate:!0}:u);var g=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var S=this.getSize(),C=g.divideBy(2).round(),U=S.divideBy(2).round(),Q=C.subtract(U);return!Q.x&&!Q.y?this:(u.animate&&u.pan?this.panBy(Q):(u.pan&&this._rawPanBy(Q),this.fire("move"),u.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:g,newSize:S}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(u){if(u=this._locateOptions=i({timeout:1e4,watch:!1},u),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var g=o(this._handleGeolocationResponse,this),S=o(this._handleGeolocationError,this);return u.watch?this._locationWatchId=navigator.geolocation.watchPosition(g,S,u):navigator.geolocation.getCurrentPosition(g,S,u),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(u){if(this._container._leaflet_id){var g=u.code,S=u.message||(g===1?"permission denied":g===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:g,message:"Geolocation error: "+S+"."})}},_handleGeolocationResponse:function(u){if(this._container._leaflet_id){var g=u.coords.latitude,S=u.coords.longitude,C=new $e(g,S),U=C.toBounds(u.coords.accuracy*2),Q=this._locateOptions;if(Q.setView){var le=this.getBoundsZoom(U);this.setView(C,Q.maxZoom?Math.min(le,Q.maxZoom):le)}var Me={latlng:C,bounds:U,timestamp:u.timestamp};for(var Be in u.coords)typeof u.coords[Be]=="number"&&(Me[Be]=u.coords[Be]);this.fire("locationfound",Me)}},addHandler:function(u,g){if(!g)return this;var S=this[u]=new g(this);return this._handlers.push(S),this.options[u]&&S.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),$n(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(ne(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var u;for(u in this._layers)this._layers[u].remove();for(u in this._panes)$n(this._panes[u]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(u,g){var S="leaflet-pane"+(u?" leaflet-"+u.replace("Pane","")+"-pane":""),C=ft("div",S,g||this._mapPane);return u&&(this._panes[u]=C),C},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var u=this.getPixelBounds(),g=this.unproject(u.getBottomLeft()),S=this.unproject(u.getTopRight());return new He(g,S)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(u,g,S){u=je(u),S=ae(S||[0,0]);var C=this.getZoom()||0,U=this.getMinZoom(),Q=this.getMaxZoom(),le=u.getNorthWest(),Me=u.getSouthEast(),Be=this.getSize().subtract(S),Xe=de(this.project(Me,C),this.project(le,C)).getSize(),yt=_t.any3d?this.options.zoomSnap:1,Wt=Be.x/Xe.x,hn=Be.y/Xe.y,xi=g?Math.max(Wt,hn):Math.min(Wt,hn);return C=this.getScaleZoom(xi,C),yt&&(C=Math.round(C/(yt/100))*(yt/100),C=g?Math.ceil(C/yt)*yt:Math.floor(C/yt)*yt),Math.max(U,Math.min(Q,C))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new re(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(u,g){var S=this._getTopLeftPoint(u,g);return new ie(S,S.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(u){return this.options.crs.getProjectedBounds(u===void 0?this.getZoom():u)},getPane:function(u){return typeof u=="string"?this._panes[u]:u},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(u,g){var S=this.options.crs;return g=g===void 0?this._zoom:g,S.scale(u)/S.scale(g)},getScaleZoom:function(u,g){var S=this.options.crs;g=g===void 0?this._zoom:g;var C=S.zoom(u*S.scale(g));return isNaN(C)?1/0:C},project:function(u,g){return g=g===void 0?this._zoom:g,this.options.crs.latLngToPoint(We(u),g)},unproject:function(u,g){return g=g===void 0?this._zoom:g,this.options.crs.pointToLatLng(ae(u),g)},layerPointToLatLng:function(u){var g=ae(u).add(this.getPixelOrigin());return this.unproject(g)},latLngToLayerPoint:function(u){var g=this.project(We(u))._round();return g._subtract(this.getPixelOrigin())},wrapLatLng:function(u){return this.options.crs.wrapLatLng(We(u))},wrapLatLngBounds:function(u){return this.options.crs.wrapLatLngBounds(je(u))},distance:function(u,g){return this.options.crs.distance(We(u),We(g))},containerPointToLayerPoint:function(u){return ae(u).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(u){return ae(u).add(this._getMapPanePos())},containerPointToLatLng:function(u){var g=this.containerPointToLayerPoint(ae(u));return this.layerPointToLatLng(g)},latLngToContainerPoint:function(u){return this.layerPointToContainerPoint(this.latLngToLayerPoint(We(u)))},mouseEventToContainerPoint:function(u){return Ge(u,this._container)},mouseEventToLayerPoint:function(u){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(u))},mouseEventToLatLng:function(u){return this.layerPointToLatLng(this.mouseEventToLayerPoint(u))},_initContainer:function(u){var g=this._container=ln(u);if(g){if(g._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");xt(g,"scroll",this._onScroll,this),this._containerId=c(g)},_initLayout:function(){var u=this._container;this._fadeAnimated=this.options.fadeAnimation&&_t.any3d,qt(u,"leaflet-container"+(_t.touch?" leaflet-touch":"")+(_t.retina?" leaflet-retina":"")+(_t.ielt9?" leaflet-oldie":"")+(_t.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var g=Li(u,"position");g!=="absolute"&&g!=="relative"&&g!=="fixed"&&g!=="sticky"&&(u.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var u=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),Un(this._mapPane,new re(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(qt(u.markerPane,"leaflet-zoom-hide"),qt(u.shadowPane,"leaflet-zoom-hide"))},_resetView:function(u,g,S){Un(this._mapPane,new re(0,0));var C=!this._loaded;this._loaded=!0,g=this._limitZoom(g),this.fire("viewprereset");var U=this._zoom!==g;this._moveStart(U,S)._move(u,g)._moveEnd(U),this.fire("viewreset"),C&&this.fire("load")},_moveStart:function(u,g){return u&&this.fire("zoomstart"),g||this.fire("movestart"),this},_move:function(u,g,S,C){g===void 0&&(g=this._zoom);var U=this._zoom!==g;return this._zoom=g,this._lastCenter=u,this._pixelOrigin=this._getNewPixelOrigin(u),C?S&&S.pinch&&this.fire("zoom",S):((U||S&&S.pinch)&&this.fire("zoom",S),this.fire("move",S)),this},_moveEnd:function(u){return u&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return ne(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(u){Un(this._mapPane,this._getMapPanePos().subtract(u))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(u){this._targets={},this._targets[c(this._container)]=this;var g=u?On:xt;g(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&g(window,"resize",this._onResize,this),_t.any3d&&this.options.transform3DLimit&&(u?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){ne(this._resizeRequest),this._resizeRequest=ee(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var u=this._getMapPanePos();Math.max(Math.abs(u.x),Math.abs(u.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(u,g){for(var S=[],C,U=g==="mouseout"||g==="mouseover",Q=u.target||u.srcElement,le=!1;Q;){if(C=this._targets[c(Q)],C&&(g==="click"||g==="preclick")&&this._draggableMoved(C)){le=!0;break}if(C&&C.listens(g,!0)&&(U&&!Zt(Q,u)||(S.push(C),U))||Q===this._container)break;Q=Q.parentNode}return!S.length&&!le&&!U&&this.listens(g,!0)&&(S=[this]),S},_isClickDisabled:function(u){for(;u&&u!==this._container;){if(u._leaflet_disable_click)return!0;u=u.parentNode}},_handleDOMEvent:function(u){var g=u.target||u.srcElement;if(!(!this._loaded||g._leaflet_disable_events||u.type==="click"&&this._isClickDisabled(g))){var S=u.type;S==="mousedown"&&Ii(g),this._fireDOMEvent(u,S)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(u,g,S){if(u.type==="click"){var C=i({},u);C.type="preclick",this._fireDOMEvent(C,C.type,S)}var U=this._findEventTargets(u,g);if(S){for(var Q=[],le=0;le0?Math.round(u-g)/2:Math.max(0,Math.ceil(u))-Math.max(0,Math.floor(g))},_limitZoom:function(u){var g=this.getMinZoom(),S=this.getMaxZoom(),C=_t.any3d?this.options.zoomSnap:1;return C&&(u=Math.round(u/C)*C),Math.max(g,Math.min(S,u))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){zn(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(u,g){var S=this._getCenterOffset(u)._trunc();return(g&&g.animate)!==!0&&!this.getSize().contains(S)?!1:(this.panBy(S,g),!0)},_createAnimProxy:function(){var u=this._proxy=ft("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(u),this.on("zoomanim",function(g){var S=Xo,C=this._proxy.style[S];gi(this._proxy,this.project(g.center,g.zoom),this.getZoomScale(g.zoom,1)),C===this._proxy.style[S]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){$n(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var u=this.getCenter(),g=this.getZoom();gi(this._proxy,this.project(u,g),this.getZoomScale(g,1))},_catchTransitionEnd:function(u){this._animatingZoom&&u.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(u,g,S){if(this._animatingZoom)return!0;if(S=S||{},!this._zoomAnimated||S.animate===!1||this._nothingToAnimate()||Math.abs(g-this._zoom)>this.options.zoomAnimationThreshold)return!1;var C=this.getZoomScale(g),U=this._getCenterOffset(u)._divideBy(1-1/C);return S.animate!==!0&&!this.getSize().contains(U)?!1:(ee(function(){this._moveStart(!0,S.noMoveStart||!1)._animateZoom(u,g,!0)},this),!0)},_animateZoom:function(u,g,S,C){this._mapPane&&(S&&(this._animatingZoom=!0,this._animateToCenter=u,this._animateToZoom=g,qt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:u,zoom:g,noUpdate:C}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&zn(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function ga(u,g){return new rn(u,g)}var ii=he.extend({options:{position:"topright"},initialize:function(u){x(this,u)},getPosition:function(){return this.options.position},setPosition:function(u){var g=this._map;return g&&g.removeControl(this),this.options.position=u,g&&g.addControl(this),this},getContainer:function(){return this._container},addTo:function(u){this.remove(),this._map=u;var g=this._container=this.onAdd(u),S=this.getPosition(),C=u._controlCorners[S];return qt(g,"leaflet-control"),S.indexOf("bottom")!==-1?C.insertBefore(g,C.firstChild):C.appendChild(g),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?($n(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(u){this._map&&u&&u.screenX>0&&u.screenY>0&&this._map.getContainer().focus()}}),so=function(u){return new ii(u)};rn.include({addControl:function(u){return u.addTo(this),this},removeControl:function(u){return u.remove(),this},_initControlPos:function(){var u=this._controlCorners={},g="leaflet-",S=this._controlContainer=ft("div",g+"control-container",this._container);function C(U,Q){var le=g+U+" "+g+Q;u[U+Q]=ft("div",le,S)}C("top","left"),C("top","right"),C("bottom","left"),C("bottom","right")},_clearControlPos:function(){for(var u in this._controlCorners)$n(this._controlCorners[u]);$n(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var yl=ii.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(u,g,S,C){return S1,this._baseLayersList.style.display=u?"":"none"),this._separator.style.display=g&&u?"":"none",this},_onLayerChange:function(u){this._handlingClick||this._update();var g=this._getLayer(c(u.target)),S=g.overlay?u.type==="add"?"overlayadd":"overlayremove":u.type==="add"?"baselayerchange":null;S&&this._map.fire(S,g)},_createRadioElement:function(u,g){var S='",C=document.createElement("div");return C.innerHTML=S,C.firstChild},_addItem:function(u){var g=document.createElement("label"),S=this._map.hasLayer(u.layer),C;u.overlay?(C=document.createElement("input"),C.type="checkbox",C.className="leaflet-control-layers-selector",C.defaultChecked=S):C=this._createRadioElement("leaflet-base-layers_"+c(this),S),this._layerControlInputs.push(C),C.layerId=c(u.layer),xt(C,"click",this._onInputClick,this);var U=document.createElement("span");U.innerHTML=" "+u.name;var Q=document.createElement("span");g.appendChild(Q),Q.appendChild(C),Q.appendChild(U);var le=u.overlay?this._overlaysList:this._baseLayersList;return le.appendChild(g),this._checkDisabledLayers(),g},_onInputClick:function(){if(!this._preventClick){var u=this._layerControlInputs,g,S,C=[],U=[];this._handlingClick=!0;for(var Q=u.length-1;Q>=0;Q--)g=u[Q],S=this._getLayer(g.layerId).layer,g.checked?C.push(S):g.checked||U.push(S);for(Q=0;Q=0;U--)g=u[U],S=this._getLayer(g.layerId).layer,g.disabled=S.options.minZoom!==void 0&&CS.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var u=this._section;this._preventClick=!0,xt(u,"click",X),this.expand();var g=this;setTimeout(function(){On(u,"click",X),g._preventClick=!1})}}),Jo=function(u,g,S){return new yl(u,g,S)},lo=ii.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(u){var g="leaflet-control-zoom",S=ft("div",g+" leaflet-bar"),C=this.options;return this._zoomInButton=this._createButton(C.zoomInText,C.zoomInTitle,g+"-in",S,this._zoomIn),this._zoomOutButton=this._createButton(C.zoomOutText,C.zoomOutTitle,g+"-out",S,this._zoomOut),this._updateDisabled(),u.on("zoomend zoomlevelschange",this._updateDisabled,this),S},onRemove:function(u){u.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(u){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(u.shiftKey?3:1))},_createButton:function(u,g,S,C,U){var Q=ft("a",S,C);return Q.innerHTML=u,Q.href="#",Q.title=g,Q.setAttribute("role","button"),Q.setAttribute("aria-label",g),H(Q),xt(Q,"click",xe),xt(Q,"click",U,this),xt(Q,"click",this._refocusOnMap,this),Q},_updateDisabled:function(){var u=this._map,g="leaflet-disabled";zn(this._zoomInButton,g),zn(this._zoomOutButton,g),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||u._zoom===u.getMinZoom())&&(qt(this._zoomOutButton,g),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||u._zoom===u.getMaxZoom())&&(qt(this._zoomInButton,g),this._zoomInButton.setAttribute("aria-disabled","true"))}});rn.mergeOptions({zoomControl:!0}),rn.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new lo,this.addControl(this.zoomControl))});var Xl=function(u){return new lo(u)},Cr=ii.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(u){var g="leaflet-control-scale",S=ft("div",g),C=this.options;return this._addScales(C,g+"-line",S),u.on(C.updateWhenIdle?"moveend":"move",this._update,this),u.whenReady(this._update,this),S},onRemove:function(u){u.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(u,g,S){u.metric&&(this._mScale=ft("div",g,S)),u.imperial&&(this._iScale=ft("div",g,S))},_update:function(){var u=this._map,g=u.getSize().y/2,S=u.distance(u.containerPointToLatLng([0,g]),u.containerPointToLatLng([this.options.maxWidth,g]));this._updateScales(S)},_updateScales:function(u){this.options.metric&&u&&this._updateMetric(u),this.options.imperial&&u&&this._updateImperial(u)},_updateMetric:function(u){var g=this._getRoundNum(u),S=g<1e3?g+" m":g/1e3+" km";this._updateScale(this._mScale,S,g/u)},_updateImperial:function(u){var g=u*3.2808399,S,C,U;g>5280?(S=g/5280,C=this._getRoundNum(S),this._updateScale(this._iScale,C+" mi",C/S)):(U=this._getRoundNum(g),this._updateScale(this._iScale,U+" ft",U/g))},_updateScale:function(u,g,S){u.style.width=Math.round(this.options.maxWidth*S)+"px",u.innerHTML=g},_getRoundNum:function(u){var g=Math.pow(10,(Math.floor(u)+"").length-1),S=u/g;return S=S>=10?10:S>=5?5:S>=3?3:S>=2?2:1,g*S}}),Fa=function(u){return new Cr(u)},es='',uo=ii.extend({options:{position:"bottomright",prefix:''+(_t.inlineSvg?es+" ":"")+"Leaflet"},initialize:function(u){x(this,u),this._attributions={}},onAdd:function(u){u.attributionControl=this,this._container=ft("div","leaflet-control-attribution"),H(this._container);for(var g in u._layers)u._layers[g].getAttribution&&this.addAttribution(u._layers[g].getAttribution());return this._update(),u.on("layeradd",this._addAttribution,this),this._container},onRemove:function(u){u.off("layeradd",this._addAttribution,this)},_addAttribution:function(u){u.layer.getAttribution&&(this.addAttribution(u.layer.getAttribution()),u.layer.once("remove",function(){this.removeAttribution(u.layer.getAttribution())},this))},setPrefix:function(u){return this.options.prefix=u,this._update(),this},addAttribution:function(u){return u?(this._attributions[u]||(this._attributions[u]=0),this._attributions[u]++,this._update(),this):this},removeAttribution:function(u){return u?(this._attributions[u]&&(this._attributions[u]--,this._update()),this):this},_update:function(){if(this._map){var u=[];for(var g in this._attributions)this._attributions[g]&&u.push(g);var S=[];this.options.prefix&&S.push(this.options.prefix),u.length&&S.push(u.join(", ")),this._container.innerHTML=S.join(' ')}}});rn.mergeOptions({attributionControl:!0}),rn.addInitHook(function(){this.options.attributionControl&&new uo().addTo(this)});var Jc=function(u){return new uo(u)};ii.Layers=yl,ii.Zoom=lo,ii.Scale=Cr,ii.Attribution=uo,so.layers=Jo,so.zoom=Xl,so.scale=Fa,so.attribution=Jc;var Pr=he.extend({initialize:function(u){this._map=u},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Pr.addTo=function(u,g){return u.addHandler(g,this),this};var Ls={Events:fe},co=_t.touch?"touchstart mousedown":"mousedown",vi=Oe.extend({options:{clickTolerance:3},initialize:function(u,g,S,C){x(this,C),this._element=u,this._dragStartTarget=g||u,this._preventOutline=S},enable:function(){this._enabled||(xt(this._dragStartTarget,co,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(vi._dragging===this&&this.finishDrag(!0),On(this._dragStartTarget,co,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(u){if(this._enabled&&(this._moved=!1,!No(this._element,"leaflet-zoom-anim"))){if(u.touches&&u.touches.length!==1){vi._dragging===this&&this.finishDrag();return}if(!(vi._dragging||u.shiftKey||u.which!==1&&u.button!==1&&!u.touches)&&(vi._dragging=this,this._preventOutline&&Ii(this._element),Qo(),un(),!this._moving)){this.fire("down");var g=u.touches?u.touches[0]:u,S=yr(this._element);this._startPoint=new re(g.clientX,g.clientY),this._startPos=zr(this._element),this._parentScale=kr(S);var C=u.type==="mousedown";xt(document,C?"mousemove":"touchmove",this._onMove,this),xt(document,C?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(u){if(this._enabled){if(u.touches&&u.touches.length>1){this._moved=!0;return}var g=u.touches&&u.touches.length===1?u.touches[0]:u,S=new re(g.clientX,g.clientY)._subtract(this._startPoint);!S.x&&!S.y||Math.abs(S.x)+Math.abs(S.y)Q&&(le=Me,Q=Be);Q>S&&(g[le]=1,ns(u,g,S,C,le),ns(u,g,S,le,U))}function Ql(u,g){for(var S=[u[0]],C=1,U=0,Q=u.length;Cg&&(S.push(u[C]),U=C);return Ug.max.x&&(S|=2),u.yg.max.y&&(S|=8),S}function Jl(u,g){var S=g.x-u.x,C=g.y-u.y;return S*S+C*C}function Qi(u,g,S,C){var U=g.x,Q=g.y,le=S.x-U,Me=S.y-Q,Be=le*le+Me*Me,Xe;return Be>0&&(Xe=((u.x-U)*le+(u.y-Q)*Me)/Be,Xe>1?(U=S.x,Q=S.y):Xe>0&&(U+=le*Xe,Q+=Me*Xe)),le=u.x-U,Me=u.y-Q,C?le*le+Me*Me:new re(U,Q)}function yi(u){return!k(u[0])||typeof u[0][0]!="object"&&typeof u[0][0]<"u"}function Fs(u){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),yi(u)}function is(u,g){var S,C,U,Q,le,Me,Be,Xe;if(!u||u.length===0)throw new Error("latlngs not passed");yi(u)||(console.warn("latlngs are not flat! Only the first ring will be used"),u=u[0]);var yt=We([0,0]),Wt=je(u),hn=Wt.getNorthWest().distanceTo(Wt.getSouthWest())*Wt.getNorthEast().distanceTo(Wt.getNorthWest());hn<1700&&(yt=Mo(u));var xi=u.length,oi=[];for(S=0;SC){Be=(Q-C)/U,Xe=[Me.x-Be*(Me.x-le.x),Me.y-Be*(Me.y-le.y)];break}var ba=g.unproject(ae(Xe));return We([ba.lat+yt.lat,ba.lng+yt.lng])}var Ne={__proto__:null,simplify:ts,pointToSegmentDistance:Bs,closestPointOnSegment:Fu,clipSegment:$s,_getEdgeIntersection:rs,_getBitCode:va,_sqClosestPointOnSegment:Qi,isFlat:yi,_flat:Fs,polylineCenter:is},Ze={project:function(u){return new re(u.lng,u.lat)},unproject:function(u){return new $e(u.y,u.x)},bounds:new ie([-180,-90],[180,90])},jt={R:6378137,R_MINOR:6356752314245179e-9,bounds:new ie([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(u){var g=Math.PI/180,S=this.R,C=u.lat*g,U=this.R_MINOR/S,Q=Math.sqrt(1-U*U),le=Q*Math.sin(C),Me=Math.tan(Math.PI/4-C/2)/Math.pow((1-le)/(1+le),Q/2);return C=-S*Math.log(Math.max(Me,1e-10)),new re(u.lng*g*S,C)},unproject:function(u){for(var g=180/Math.PI,S=this.R,C=this.R_MINOR/S,U=Math.sqrt(1-C*C),Q=Math.exp(-u.y/S),le=Math.PI/2-2*Math.atan(Q),Me=0,Be=.1,Xe;Me<15&&Math.abs(Be)>1e-7;Me++)Xe=U*Math.sin(le),Xe=Math.pow((1-Xe)/(1+Xe),U/2),Be=Math.PI/2-2*Math.atan(Q*Xe)-le,le+=Be;return new $e(le*g,u.x*g/S)}},$t={__proto__:null,LonLat:Ze,Mercator:jt,SphericalMercator:Fe},an=i({},rt,{code:"EPSG:3395",projection:jt,transformation:(function(){var u=.5/(Math.PI*jt.R);return Te(u,.5,-u,.5)})()}),Tn=i({},rt,{code:"EPSG:4326",projection:Ze,transformation:Te(1/180,1,-1/180,.5)}),Ji=i({},Ye,{projection:Ze,transformation:Te(1,0,-1,0),scale:function(u){return Math.pow(2,u)},zoom:function(u){return Math.log(u)/Math.LN2},distance:function(u,g){var S=g.lng-u.lng,C=g.lat-u.lat;return Math.sqrt(S*S+C*C)},infinite:!0});Ye.Earth=rt,Ye.EPSG3395=an,Ye.EPSG3857=Dt,Ye.EPSG900913=Lt,Ye.EPSG4326=Tn,Ye.Simple=Ji;var Gn=Oe.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(u){return u.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(u){return u&&u.removeLayer(this),this},getPane:function(u){return this._map.getPane(u?this.options[u]||u:this.options.pane)},addInteractiveTarget:function(u){return this._map._targets[c(u)]=this,this},removeInteractiveTarget:function(u){return delete this._map._targets[c(u)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(u){var g=u.target;if(g.hasLayer(this)){if(this._map=g,this._zoomAnimated=g._zoomAnimated,this.getEvents){var S=this.getEvents();g.on(S,this),this.once("remove",function(){g.off(S,this)},this)}this.onAdd(g),this.fire("add"),g.fire("layeradd",{layer:this})}}});rn.include({addLayer:function(u){if(!u._layerAdd)throw new Error("The provided object is not a Layer.");var g=c(u);return this._layers[g]?this:(this._layers[g]=u,u._mapToAdd=this,u.beforeAdd&&u.beforeAdd(this),this.whenReady(u._layerAdd,u),this)},removeLayer:function(u){var g=c(u);return this._layers[g]?(this._loaded&&u.onRemove(this),delete this._layers[g],this._loaded&&(this.fire("layerremove",{layer:u}),u.fire("remove")),u._map=u._mapToAdd=null,this):this},hasLayer:function(u){return c(u)in this._layers},eachLayer:function(u,g){for(var S in this._layers)u.call(g,this._layers[S]);return this},_addLayers:function(u){u=u?k(u)?u:[u]:[];for(var g=0,S=u.length;gthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&g[0]instanceof $e&&g[0].equals(g[S-1])&&g.pop(),g},_setLatLngs:function(u){Di.prototype._setLatLngs.call(this,u),yi(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return yi(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var u=this._renderer._bounds,g=this.options.weight,S=new re(g,g);if(u=new ie(u.min.subtract(S),u.max.add(S)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(u))){if(this.options.noClip){this._parts=this._rings;return}for(var C=0,U=this._rings.length,Q;Cu.y!=U.y>u.y&&u.x<(U.x-C.x)*(u.y-C.y)/(U.y-C.y)+C.x&&(g=!g);return g||Di.prototype._containsPoint.call(this,u,!0)}});function xl(u,g){return new Ua(u,g)}var Xr=bi.extend({initialize:function(u,g){x(this,g),this._layers={},u&&this.addData(u)},addData:function(u){var g=k(u)?u:u.features,S,C,U;if(g){for(S=0,C=g.length;S0&&U.push(U[0].slice()),U}function G(u,g){return u.feature?i({},u.feature,{geometry:g}):J(g)}function J(u){return u.type==="Feature"||u.type==="FeatureCollection"?u:{type:"Feature",properties:{},geometry:u}}var te={toGeoJSON:function(u){return G(this,{type:"Point",coordinates:z(this.getLatLng(),u)})}};ya.include(te),zu.include(te),qs.include(te),Di.include({toGeoJSON:function(u){var g=!yi(this._latlngs),S=W(this._latlngs,g?1:0,!1,u);return G(this,{type:(g?"Multi":"")+"LineString",coordinates:S})}}),Ua.include({toGeoJSON:function(u){var g=!yi(this._latlngs),S=g&&!yi(this._latlngs[0]),C=W(this._latlngs,S?2:g?1:0,!0,u);return g||(C=[C]),G(this,{type:(S?"Multi":"")+"Polygon",coordinates:C})}}),Mr.include({toMultiPoint:function(u){var g=[];return this.eachLayer(function(S){g.push(S.toGeoJSON(u).geometry.coordinates)}),G(this,{type:"MultiPoint",coordinates:g})},toGeoJSON:function(u){var g=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(g==="MultiPoint")return this.toMultiPoint(u);var S=g==="GeometryCollection",C=[];return this.eachLayer(function(U){if(U.toGeoJSON){var Q=U.toGeoJSON(u);if(S)C.push(Q.geometry);else{var le=J(Q);le.type==="FeatureCollection"?C.push.apply(C,le.features):C.push(le)}}}),S?G(this,{geometries:C,type:"GeometryCollection"}):{type:"FeatureCollection",features:C}}});function be(u,g){return new Xr(u,g)}var Ee=be,pe=Gn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(u,g,S){this._url=u,this._bounds=je(g),x(this,S)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(qt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){$n(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(u){return this.options.opacity=u,this._image&&this._updateOpacity(),this},setStyle:function(u){return u.opacity&&this.setOpacity(u.opacity),this},bringToFront:function(){return this._map&&Zi(this._image),this},bringToBack:function(){return this._map&&mi(this._image),this},setUrl:function(u){return this._url=u,this._image&&(this._image.src=u),this},setBounds:function(u){return this._bounds=je(u),this._map&&this._reset(),this},getEvents:function(){var u={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(u.zoomanim=this._animateZoom),u},setZIndex:function(u){return this.options.zIndex=u,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var u=this._url.tagName==="IMG",g=this._image=u?this._url:ft("img");if(qt(g,"leaflet-image-layer"),this._zoomAnimated&&qt(g,"leaflet-zoom-animated"),this.options.className&&qt(g,this.options.className),g.onselectstart=m,g.onmousemove=m,g.onload=o(this.fire,this,"load"),g.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(g.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),u){this._url=g.src;return}g.src=this._url,g.alt=this.options.alt},_animateZoom:function(u){var g=this._map.getZoomScale(u.zoom),S=this._map._latLngBoundsToNewLayerBounds(this._bounds,u.zoom,u.center).min;gi(this._image,S,g)},_reset:function(){var u=this._image,g=new ie(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),S=g.getSize();Un(u,g.min),u.style.width=S.x+"px",u.style.height=S.y+"px"},_updateOpacity:function(){dr(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var u=this.options.errorOverlayUrl;u&&this._url!==u&&(this._url=u,this._image.src=u)},getCenter:function(){return this._bounds.getCenter()}}),me=function(u,g,S){return new pe(u,g,S)},we=pe.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var u=this._url.tagName==="VIDEO",g=this._image=u?this._url:ft("video");if(qt(g,"leaflet-image-layer"),this._zoomAnimated&&qt(g,"leaflet-zoom-animated"),this.options.className&&qt(g,this.options.className),g.onselectstart=m,g.onmousemove=m,g.onloadeddata=o(this.fire,this,"load"),u){for(var S=g.getElementsByTagName("source"),C=[],U=0;U0?C:[g.src];return}k(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(g.style,"objectFit")&&(g.style.objectFit="fill"),g.autoplay=!!this.options.autoplay,g.loop=!!this.options.loop,g.muted=!!this.options.muted,g.playsInline=!!this.options.playsInline;for(var Q=0;QU?(g.height=U+"px",qt(u,Q)):zn(u,Q),this._containerWidth=this._container.offsetWidth},_animateZoom:function(u){var g=this._map._latLngToNewLayerPoint(this._latlng,u.zoom,u.center),S=this._getAnchor();Un(this._container,g.add(S))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var u=this._map,g=parseInt(Li(this._container,"marginBottom"),10)||0,S=this._container.offsetHeight+g,C=this._containerWidth,U=new re(this._containerLeft,-S-this._containerBottom);U._add(zr(this._container));var Q=u.layerPointToContainerPoint(U),le=ae(this.options.autoPanPadding),Me=ae(this.options.autoPanPaddingTopLeft||le),Be=ae(this.options.autoPanPaddingBottomRight||le),Xe=u.getSize(),yt=0,Wt=0;Q.x+C+Be.x>Xe.x&&(yt=Q.x+C-Xe.x+Be.x),Q.x-yt-Me.x<0&&(yt=Q.x-Me.x),Q.y+S+Be.y>Xe.y&&(Wt=Q.y+S-Xe.y+Be.y),Q.y-Wt-Me.y<0&&(Wt=Q.y-Me.y),(yt||Wt)&&(this.options.keepInView&&(this._autopanning=!0),u.fire("autopanstart").panBy([yt,Wt]))}},_getAnchor:function(){return ae(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Ae=function(u,g){return new Ie(u,g)};rn.mergeOptions({closePopupOnClick:!0}),rn.include({openPopup:function(u,g,S){return this._initOverlay(Ie,u,g,S).openOn(this),this},closePopup:function(u){return u=arguments.length?u:this._popup,u&&u.close(),this}}),Gn.include({bindPopup:function(u,g){return this._popup=this._initOverlay(Ie,this._popup,u,g),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(u){return this._popup&&(this instanceof bi||(this._popup._source=this),this._popup._prepareOpen(u||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(u){return this._popup&&this._popup.setContent(u),this},getPopup:function(){return this._popup},_openPopup:function(u){if(!(!this._popup||!this._map)){xe(u);var g=u.layer||u.target;if(this._popup._source===g&&!(g instanceof Vn)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(u.latlng);return}this._popup._source=g,this.openPopup(u.latlng)}},_movePopup:function(u){this._popup.setLatLng(u.latlng)},_onKeyPress:function(u){u.originalEvent.keyCode===13&&this._openPopup(u)}});var Ve=ke.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(u){ke.prototype.onAdd.call(this,u),this.setOpacity(this.options.opacity),u.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(u){ke.prototype.onRemove.call(this,u),u.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var u=ke.prototype.getEvents.call(this);return this.options.permanent||(u.preclick=this.close),u},_initLayout:function(){var u="leaflet-tooltip",g=u+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ft("div",g),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+c(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(u){var g,S,C=this._map,U=this._container,Q=C.latLngToContainerPoint(C.getCenter()),le=C.layerPointToContainerPoint(u),Me=this.options.direction,Be=U.offsetWidth,Xe=U.offsetHeight,yt=ae(this.options.offset),Wt=this._getAnchor();Me==="top"?(g=Be/2,S=Xe):Me==="bottom"?(g=Be/2,S=0):Me==="center"?(g=Be/2,S=Xe/2):Me==="right"?(g=0,S=Xe/2):Me==="left"?(g=Be,S=Xe/2):le.xthis.options.maxZoom||SC?this._retainParent(U,Q,le,C):!1)},_retainChildren:function(u,g,S,C){for(var U=2*u;U<2*u+2;U++)for(var Q=2*g;Q<2*g+2;Q++){var le=new re(U,Q);le.z=S+1;var Me=this._tileCoordsToKey(le),Be=this._tiles[Me];if(Be&&Be.active){Be.retain=!0;continue}else Be&&Be.loaded&&(Be.retain=!0);S+1this.options.maxZoom||this.options.minZoom!==void 0&&U1){this._setView(u,S);return}for(var Wt=U.min.y;Wt<=U.max.y;Wt++)for(var hn=U.min.x;hn<=U.max.x;hn++){var xi=new re(hn,Wt);if(xi.z=this._tileZoom,!!this._isValidTile(xi)){var oi=this._tiles[this._tileCoordsToKey(xi)];oi?oi.current=!0:le.push(xi)}}if(le.sort(function(ba,Wu){return ba.distanceTo(Q)-Wu.distanceTo(Q)}),le.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Va=document.createDocumentFragment();for(hn=0;hnS.max.x)||!g.wrapLat&&(u.yS.max.y))return!1}if(!this.options.bounds)return!0;var C=this._tileCoordsToBounds(u);return je(this.options.bounds).overlaps(C)},_keyToBounds:function(u){return this._tileCoordsToBounds(this._keyToTileCoords(u))},_tileCoordsToNwSe:function(u){var g=this._map,S=this.getTileSize(),C=u.scaleBy(S),U=C.add(S),Q=g.unproject(C,u.z),le=g.unproject(U,u.z);return[Q,le]},_tileCoordsToBounds:function(u){var g=this._tileCoordsToNwSe(u),S=new He(g[0],g[1]);return this.options.noWrap||(S=this._map.wrapLatLngBounds(S)),S},_tileCoordsToKey:function(u){return u.x+":"+u.y+":"+u.z},_keyToTileCoords:function(u){var g=u.split(":"),S=new re(+g[0],+g[1]);return S.z=+g[2],S},_removeTile:function(u){var g=this._tiles[u];g&&($n(g.el),delete this._tiles[u],this.fire("tileunload",{tile:g.el,coords:this._keyToTileCoords(u)}))},_initTile:function(u){qt(u,"leaflet-tile");var g=this.getTileSize();u.style.width=g.x+"px",u.style.height=g.y+"px",u.onselectstart=m,u.onmousemove=m,_t.ielt9&&this.options.opacity<1&&dr(u,this.options.opacity)},_addTile:function(u,g){var S=this._getTilePos(u),C=this._tileCoordsToKey(u),U=this.createTile(this._wrapCoords(u),o(this._tileReady,this,u));this._initTile(U),this.createTile.length<2&&ee(o(this._tileReady,this,u,null,U)),Un(U,S),this._tiles[C]={el:U,coords:u,current:!0},g.appendChild(U),this.fire("tileloadstart",{tile:U,coords:u})},_tileReady:function(u,g,S){g&&this.fire("tileerror",{error:g,tile:S,coords:u});var C=this._tileCoordsToKey(u);S=this._tiles[C],S&&(S.loaded=+new Date,this._map._fadeAnimated?(dr(S.el,0),ne(this._fadeFrame),this._fadeFrame=ee(this._updateOpacity,this)):(S.active=!0,this._pruneTiles()),g||(qt(S.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:S.el,coords:u})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),_t.ielt9||!this._map._fadeAnimated?ee(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(u){return u.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(u){var g=new re(this._wrapX?p(u.x,this._wrapX):u.x,this._wrapY?p(u.y,this._wrapY):u.y);return g.z=u.z,g},_pxBoundsToTileRange:function(u){var g=this.getTileSize();return new ie(u.min.unscaleBy(g).floor(),u.max.unscaleBy(g).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var u in this._tiles)if(!this._tiles[u].loaded)return!1;return!0}});function gt(u){return new Qe(u)}var dt=Qe.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(u,g){this._url=u,g=x(this,g),g.detectRetina&&_t.retina&&g.maxZoom>0?(g.tileSize=Math.floor(g.tileSize/2),g.zoomReverse?(g.zoomOffset--,g.minZoom=Math.min(g.maxZoom,g.minZoom+1)):(g.zoomOffset++,g.maxZoom=Math.max(g.minZoom,g.maxZoom-1)),g.minZoom=Math.max(0,g.minZoom)):g.zoomReverse?g.minZoom=Math.min(g.maxZoom,g.minZoom):g.maxZoom=Math.max(g.minZoom,g.maxZoom),typeof g.subdomains=="string"&&(g.subdomains=g.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(u,g){return this._url===u&&g===void 0&&(g=!0),this._url=u,g||this.redraw(),this},createTile:function(u,g){var S=document.createElement("img");return xt(S,"load",o(this._tileOnLoad,this,g,S)),xt(S,"error",o(this._tileOnError,this,g,S)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(S.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(S.referrerPolicy=this.options.referrerPolicy),S.alt="",S.src=this.getTileUrl(u),S},getTileUrl:function(u){var g={r:_t.retina?"@2x":"",s:this._getSubdomain(u),x:u.x,y:u.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var S=this._globalTileRange.max.y-u.y;this.options.tms&&(g.y=S),g["-y"]=S}return E(this._url,i(g,this.options))},_tileOnLoad:function(u,g){_t.ielt9?setTimeout(o(u,this,null,g),0):u(null,g)},_tileOnError:function(u,g,S){var C=this.options.errorTileUrl;C&&g.getAttribute("src")!==C&&(g.src=C),u(S,g)},_onTileRemove:function(u){u.tile.onload=null},_getZoomForUrl:function(){var u=this._tileZoom,g=this.options.maxZoom,S=this.options.zoomReverse,C=this.options.zoomOffset;return S&&(u=g-u),u+C},_getSubdomain:function(u){var g=Math.abs(u.x+u.y)%this.options.subdomains.length;return this.options.subdomains[g]},_abortLoading:function(){var u,g;for(u in this._tiles)if(this._tiles[u].coords.z!==this._tileZoom&&(g=this._tiles[u].el,g.onload=m,g.onerror=m,!g.complete)){g.src=I;var S=this._tiles[u].coords;$n(g),delete this._tiles[u],this.fire("tileabort",{tile:g,coords:S})}},_removeTile:function(u){var g=this._tiles[u];if(g)return g.el.setAttribute("src",I),Qe.prototype._removeTile.call(this,u)},_tileReady:function(u,g,S){if(!(!this._map||S&&S.getAttribute("src")===I))return Qe.prototype._tileReady.call(this,u,g,S)}});function it(u,g){return new dt(u,g)}var vt=dt.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(u,g){this._url=u;var S=i({},this.defaultWmsParams);for(var C in g)C in this.options||(S[C]=g[C]);g=x(this,g);var U=g.detectRetina&&_t.retina?2:1,Q=this.getTileSize();S.width=Q.x*U,S.height=Q.y*U,this.wmsParams=S},onAdd:function(u){this._crs=this.options.crs||u.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var g=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[g]=this._crs.code,dt.prototype.onAdd.call(this,u)},getTileUrl:function(u){var g=this._tileCoordsToNwSe(u),S=this._crs,C=de(S.project(g[0]),S.project(g[1])),U=C.min,Q=C.max,le=(this._wmsVersion>=1.3&&this._crs===Tn?[U.y,U.x,Q.y,Q.x]:[U.x,U.y,Q.x,Q.y]).join(","),Me=dt.prototype.getTileUrl.call(this,u);return Me+w(this.wmsParams,Me,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+le},setParams:function(u,g){return i(this.wmsParams,u),g||this.redraw(),this}});function vn(u,g){return new vt(u,g)}dt.WMS=vt,it.wms=vn;var on=Gn.extend({options:{padding:.1},initialize:function(u){x(this,u),c(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),qt(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var u={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(u.zoomanim=this._onAnimZoom),u},_onAnimZoom:function(u){this._updateTransform(u.center,u.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(u,g){var S=this._map.getZoomScale(g,this._zoom),C=this._map.getSize().multiplyBy(.5+this.options.padding),U=this._map.project(this._center,g),Q=C.multiplyBy(-S).add(U).subtract(this._map._getNewPixelOrigin(u,g));_t.any3d?gi(this._container,Q,S):Un(this._container,Q)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var u in this._layers)this._layers[u]._reset()},_onZoomEnd:function(){for(var u in this._layers)this._layers[u]._project()},_updatePaths:function(){for(var u in this._layers)this._layers[u]._update()},_update:function(){var u=this.options.padding,g=this._map.getSize(),S=this._map.containerPointToLayerPoint(g.multiplyBy(-u)).round();this._bounds=new ie(S,S.add(g.multiplyBy(1+u*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Bt=on.extend({options:{tolerance:0},getEvents:function(){var u=on.prototype.getEvents.call(this);return u.viewprereset=this._onViewPreReset,u},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){on.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var u=this._container=document.createElement("canvas");xt(u,"mousemove",this._onMouseMove,this),xt(u,"click dblclick mousedown mouseup contextmenu",this._onClick,this),xt(u,"mouseout",this._handleMouseOut,this),u._leaflet_disable_events=!0,this._ctx=u.getContext("2d")},_destroyContainer:function(){ne(this._redrawRequest),delete this._ctx,$n(this._container),On(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var u;this._redrawBounds=null;for(var g in this._layers)u=this._layers[g],u._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){on.prototype._update.call(this);var u=this._bounds,g=this._container,S=u.getSize(),C=_t.retina?2:1;Un(g,u.min),g.width=C*S.x,g.height=C*S.y,g.style.width=S.x+"px",g.style.height=S.y+"px",_t.retina&&this._ctx.scale(2,2),this._ctx.translate(-u.min.x,-u.min.y),this.fire("update")}},_reset:function(){on.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(u){this._updateDashArray(u),this._layers[c(u)]=u;var g=u._order={layer:u,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=g),this._drawLast=g,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(u){this._requestRedraw(u)},_removePath:function(u){var g=u._order,S=g.next,C=g.prev;S?S.prev=C:this._drawLast=C,C?C.next=S:this._drawFirst=S,delete u._order,delete this._layers[c(u)],this._requestRedraw(u)},_updatePath:function(u){this._extendRedrawBounds(u),u._project(),u._update(),this._requestRedraw(u)},_updateStyle:function(u){this._updateDashArray(u),this._requestRedraw(u)},_updateDashArray:function(u){if(typeof u.options.dashArray=="string"){var g=u.options.dashArray.split(/[, ]+/),S=[],C,U;for(U=0;U')}}catch{}return function(u){return document.createElement("<"+u+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),ea={_initContainer:function(){this._container=ft("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(on.prototype._update.call(this),this.fire("update"))},_initPath:function(u){var g=u._container=Wn("shape");qt(g,"leaflet-vml-shape "+(this.options.className||"")),g.coordsize="1 1",u._path=Wn("path"),g.appendChild(u._path),this._updateStyle(u),this._layers[c(u)]=u},_addPath:function(u){var g=u._container;this._container.appendChild(g),u.options.interactive&&u.addInteractiveTarget(g)},_removePath:function(u){var g=u._container;$n(g),u.removeInteractiveTarget(g),delete this._layers[c(u)]},_updateStyle:function(u){var g=u._stroke,S=u._fill,C=u.options,U=u._container;U.stroked=!!C.stroke,U.filled=!!C.fill,C.stroke?(g||(g=u._stroke=Wn("stroke")),U.appendChild(g),g.weight=C.weight+"px",g.color=C.color,g.opacity=C.opacity,C.dashArray?g.dashStyle=k(C.dashArray)?C.dashArray.join(" "):C.dashArray.replace(/( *, *)/g," "):g.dashStyle="",g.endcap=C.lineCap.replace("butt","flat"),g.joinstyle=C.lineJoin):g&&(U.removeChild(g),u._stroke=null),C.fill?(S||(S=u._fill=Wn("fill")),U.appendChild(S),S.color=C.fillColor||C.color,S.opacity=C.fillOpacity):S&&(U.removeChild(S),u._fill=null)},_updateCircle:function(u){var g=u._point.round(),S=Math.round(u._radius),C=Math.round(u._radiusY||S);this._setPath(u,u._empty()?"M0 0":"AL "+g.x+","+g.y+" "+S+","+C+" 0,"+65535*360)},_setPath:function(u,g){u._path.v=g},_bringToFront:function(u){Zi(u._container)},_bringToBack:function(u){mi(u._container)}},En=_t.vml?Wn:dn,ta=on.extend({_initContainer:function(){this._container=En("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=En("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){$n(this._container),On(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){on.prototype._update.call(this);var u=this._bounds,g=u.getSize(),S=this._container;(!this._svgSize||!this._svgSize.equals(g))&&(this._svgSize=g,S.setAttribute("width",g.x),S.setAttribute("height",g.y)),Un(S,u.min),S.setAttribute("viewBox",[u.min.x,u.min.y,g.x,g.y].join(" ")),this.fire("update")}},_initPath:function(u){var g=u._path=En("path");u.options.className&&qt(g,u.options.className),u.options.interactive&&qt(g,"leaflet-interactive"),this._updateStyle(u),this._layers[c(u)]=u},_addPath:function(u){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(u._path),u.addInteractiveTarget(u._path)},_removePath:function(u){$n(u._path),u.removeInteractiveTarget(u._path),delete this._layers[c(u)]},_updatePath:function(u){u._project(),u._update()},_updateStyle:function(u){var g=u._path,S=u.options;g&&(S.stroke?(g.setAttribute("stroke",S.color),g.setAttribute("stroke-opacity",S.opacity),g.setAttribute("stroke-width",S.weight),g.setAttribute("stroke-linecap",S.lineCap),g.setAttribute("stroke-linejoin",S.lineJoin),S.dashArray?g.setAttribute("stroke-dasharray",S.dashArray):g.removeAttribute("stroke-dasharray"),S.dashOffset?g.setAttribute("stroke-dashoffset",S.dashOffset):g.removeAttribute("stroke-dashoffset")):g.setAttribute("stroke","none"),S.fill?(g.setAttribute("fill",S.fillColor||S.color),g.setAttribute("fill-opacity",S.fillOpacity),g.setAttribute("fill-rule",S.fillRule||"evenodd")):g.setAttribute("fill","none"))},_updatePoly:function(u,g){this._setPath(u,xn(u._parts,g))},_updateCircle:function(u){var g=u._point,S=Math.max(Math.round(u._radius),1),C=Math.max(Math.round(u._radiusY),1)||S,U="a"+S+","+C+" 0 1,0 ",Q=u._empty()?"M0 0":"M"+(g.x-S)+","+g.y+U+S*2+",0 "+U+-S*2+",0 ";this._setPath(u,Q)},_setPath:function(u,g){u._path.setAttribute("d",g)},_bringToFront:function(u){Zi(u._path)},_bringToBack:function(u){mi(u._path)}});_t.vml&&ta.include(ea);function wl(u){return _t.svg||_t.vml?new ta(u):null}rn.include({getRenderer:function(u){var g=u.options.renderer||this._getPaneRenderer(u.options.pane)||this.options.renderer||this._renderer;return g||(g=this._renderer=this._createRenderer()),this.hasLayer(g)||this.addLayer(g),g},_getPaneRenderer:function(u){if(u==="overlayPane"||u===void 0)return!1;var g=this._paneRenderers[u];return g===void 0&&(g=this._createRenderer({pane:u}),this._paneRenderers[u]=g),g},_createRenderer:function(u){return this.options.preferCanvas&&sn(u)||wl(u)}});var Ug=Ua.extend({initialize:function(u,g){Ua.prototype.initialize.call(this,this._boundsToLatLngs(u),g)},setBounds:function(u){return this.setLatLngs(this._boundsToLatLngs(u))},_boundsToLatLngs:function(u){return u=je(u),[u.getSouthWest(),u.getNorthWest(),u.getNorthEast(),u.getSouthEast()]}});function bx(u,g){return new Ug(u,g)}ta.create=En,ta.pointsToPath=xn,Xr.geometryToLayer=Ws,Xr.coordsToLatLng=O,Xr.coordsToLatLngs=B,Xr.latLngToCoords=z,Xr.latLngsToCoords=W,Xr.getFeature=G,Xr.asFeature=J,rn.mergeOptions({boxZoom:!0});var Uu=Pr.extend({initialize:function(u){this._map=u,this._container=u._container,this._pane=u._panes.overlayPane,this._resetStateTimeout=0,u.on("unload",this._destroy,this)},addHooks:function(){xt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){On(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){$n(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(u){if(!u.shiftKey||u.which!==1&&u.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),un(),Qo(),this._startPoint=this._map.mouseEventToContainerPoint(u),xt(document,{contextmenu:xe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(u){this._moved||(this._moved=!0,this._box=ft("div","leaflet-zoom-box",this._container),qt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(u);var g=new ie(this._point,this._startPoint),S=g.getSize();Un(this._box,g.min),this._box.style.width=S.x+"px",this._box.style.height=S.y+"px"},_finish:function(){this._moved&&($n(this._box),zn(this._container,"leaflet-crosshair")),ri(),ao(),On(document,{contextmenu:xe,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(u){if(!(u.which!==1&&u.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var g=new He(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(g).fire("boxzoomend",{boxZoomBounds:g})}},_onKeyDown:function(u){u.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});rn.addInitHook("addHandler","boxZoom",Uu),rn.mergeOptions({doubleClickZoom:!0});var Vg=Pr.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(u){var g=this._map,S=g.getZoom(),C=g.options.zoomDelta,U=u.originalEvent.shiftKey?S-C:S+C;g.options.doubleClickZoom==="center"?g.setZoom(U):g.setZoomAround(u.containerPoint,U)}});rn.addInitHook("addHandler","doubleClickZoom",Vg),rn.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var vp=Pr.extend({addHooks:function(){if(!this._draggable){var u=this._map;this._draggable=new vi(u._mapPane,u._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),u.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),u.on("zoomend",this._onZoomEnd,this),u.whenReady(this._onZoomEnd,this))}qt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){zn(this._map._container,"leaflet-grab"),zn(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var u=this._map;if(u._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var g=je(this._map.options.maxBounds);this._offsetLimit=de(this._map.latLngToContainerPoint(g.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(g.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;u.fire("movestart").fire("dragstart"),u.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(u){if(this._map.options.inertia){var g=this._lastTime=+new Date,S=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(S),this._times.push(g),this._prunePositions(g)}this._map.fire("move",u).fire("drag",u)},_prunePositions:function(u){for(;this._positions.length>1&&u-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var u=this._map.getSize().divideBy(2),g=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=g.subtract(u).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(u,g){return u-(u-g)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var u=this._draggable._newPos.subtract(this._draggable._startPos),g=this._offsetLimit;u.xg.max.x&&(u.x=this._viscousLimit(u.x,g.max.x)),u.y>g.max.y&&(u.y=this._viscousLimit(u.y,g.max.y)),this._draggable._newPos=this._draggable._startPos.add(u)}},_onPreDragWrap:function(){var u=this._worldWidth,g=Math.round(u/2),S=this._initialWorldOffset,C=this._draggable._newPos.x,U=(C-g+S)%u+g-S,Q=(C+g+S)%u-g-S,le=Math.abs(U+S)0?Q:-Q))-g;this._delta=0,this._startTime=null,le&&(u.options.scrollWheelZoom==="center"?u.setZoom(g+le):u.setZoomAround(this._lastMousePos,g+le))}});rn.addInitHook("addHandler","scrollWheelZoom",rr);var bp=600;rn.mergeOptions({tapHold:_t.touchNative&&_t.safari&&_t.mobile,tapTolerance:15});var tf=Pr.extend({addHooks:function(){xt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){On(this._map._container,"touchstart",this._onDown,this)},_onDown:function(u){if(clearTimeout(this._holdTimeout),u.touches.length===1){var g=u.touches[0];this._startPos=this._newPos=new re(g.clientX,g.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(xt(document,"touchend",X),xt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",g))},this),bp),xt(document,"touchend touchcancel contextmenu",this._cancel,this),xt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function u(){On(document,"touchend",X),On(document,"touchend touchcancel",u)},_cancel:function(){clearTimeout(this._holdTimeout),On(document,"touchend touchcancel contextmenu",this._cancel,this),On(document,"touchmove",this._onMove,this)},_onMove:function(u){var g=u.touches[0];this._newPos=new re(g.clientX,g.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(u,g){var S=new MouseEvent(u,{bubbles:!0,cancelable:!0,view:window,screenX:g.screenX,screenY:g.screenY,clientX:g.clientX,clientY:g.clientY});S._simulated=!0,g.target.dispatchEvent(S)}});rn.addInitHook("addHandler","tapHold",tf),rn.mergeOptions({touchZoom:_t.touch,bounceAtZoomLimits:!0});var Vu=Pr.extend({addHooks:function(){qt(this._map._container,"leaflet-touch-zoom"),xt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){zn(this._map._container,"leaflet-touch-zoom"),On(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(u){var g=this._map;if(!(!u.touches||u.touches.length!==2||g._animatingZoom||this._zooming)){var S=g.mouseEventToContainerPoint(u.touches[0]),C=g.mouseEventToContainerPoint(u.touches[1]);this._centerPoint=g.getSize()._divideBy(2),this._startLatLng=g.containerPointToLatLng(this._centerPoint),g.options.touchZoom!=="center"&&(this._pinchStartLatLng=g.containerPointToLatLng(S.add(C)._divideBy(2))),this._startDist=S.distanceTo(C),this._startZoom=g.getZoom(),this._moved=!1,this._zooming=!0,g._stop(),xt(document,"touchmove",this._onTouchMove,this),xt(document,"touchend touchcancel",this._onTouchEnd,this),X(u)}},_onTouchMove:function(u){if(!(!u.touches||u.touches.length!==2||!this._zooming)){var g=this._map,S=g.mouseEventToContainerPoint(u.touches[0]),C=g.mouseEventToContainerPoint(u.touches[1]),U=S.distanceTo(C)/this._startDist;if(this._zoom=g.getScaleZoom(U,this._startZoom),!g.options.bounceAtZoomLimits&&(this._zoomg.getMaxZoom()&&U>1)&&(this._zoom=g._limitZoom(this._zoom)),g.options.touchZoom==="center"){if(this._center=this._startLatLng,U===1)return}else{var Q=S._add(C)._divideBy(2)._subtract(this._centerPoint);if(U===1&&Q.x===0&&Q.y===0)return;this._center=g.unproject(g.project(this._pinchStartLatLng,this._zoom).subtract(Q),this._zoom)}this._moved||(g._moveStart(!0,!1),this._moved=!0),ne(this._animRequest);var le=o(g._move,g,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=ee(le,this,!0),X(u)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,ne(this._animRequest),On(document,"touchmove",this._onTouchMove,this),On(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});rn.addInitHook("addHandler","touchZoom",Vu),rn.BoxZoom=Uu,rn.DoubleClickZoom=Vg,rn.Drag=vp,rn.Keyboard=yp,rn.ScrollWheelZoom=rr,rn.TapHold=tf,rn.TouchZoom=Vu,n.Bounds=ie,n.Browser=_t,n.CRS=Ye,n.Canvas=Bt,n.Circle=zu,n.CircleMarker=qs,n.Class=he,n.Control=ii,n.DivIcon=at,n.DivOverlay=ke,n.DomEvent=Ln,n.DomUtil=Ba,n.Draggable=vi,n.Evented=Oe,n.FeatureGroup=bi,n.GeoJSON=Xr,n.GridLayer=Qe,n.Handler=Pr,n.Icon=fo,n.ImageOverlay=pe,n.LatLng=$e,n.LatLngBounds=He,n.Layer=Gn,n.LayerGroup=Mr,n.LineUtil=Ne,n.Map=rn,n.Marker=ya,n.Mixin=Ls,n.Path=Vn,n.Point=re,n.PolyUtil=Ds,n.Polygon=Ua,n.Polyline=Di,n.Popup=Ie,n.PosAnimation=Jn,n.Projection=$t,n.Rectangle=Ug,n.Renderer=on,n.SVG=ta,n.SVGOverlay=ye,n.TileLayer=dt,n.Tooltip=Ve,n.Transformation=st,n.Util=oe,n.VideoOverlay=we,n.bind=o,n.bounds=de,n.canvas=sn,n.circle=Us,n.circleMarker=zs,n.control=so,n.divIcon=ut,n.extend=i,n.featureGroup=za,n.geoJSON=be,n.geoJson=Ee,n.gridLayer=gt,n.icon=vd,n.imageOverlay=me,n.latLng=We,n.latLngBounds=je,n.layerGroup=ai,n.map=ga,n.marker=Ro,n.point=ae,n.polygon=xl,n.polyline=Vs,n.popup=Ae,n.rectangle=bx,n.setOptions=x,n.stamp=c,n.svg=wl,n.svgOverlay=ve,n.tileLayer=it,n.tooltip=Je,n.transformation=Te,n.version=r,n.videoOverlay=_e;var Wg=window.L;n.noConflict=function(){return window.L=Wg,this},window.L=n}))})(cm,cm.exports)),cm.exports}var gp=M1e();const Es=In(gp);function cx(e,t,n){return Object.freeze({instance:e,context:t,container:n})}function fx(e,t){return t==null?function(r,i){const a=M.useRef();return a.current||(a.current=e(r,i)),a}:function(r,i){const a=M.useRef();a.current||(a.current=e(r,i));const o=M.useRef(r),{instance:s}=a.current;return M.useEffect(function(){o.current!==r&&(t(s,r,o.current),o.current=r)},[s,r,i]),a}}function aW(e,t){M.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var a;(a=t.layerContainer)==null||a.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function oW(e){return function(n){const r=lx(),i=e(ux(n,r),r);return eW(r.map,n.attribution),Pk(i.current,n.eventHandlers),aW(i.current,r),i}}function R1e(e,t){const n=M.useRef();M.useEffect(function(){if(t.pathOptions!==n.current){const i=t.pathOptions??{};e.instance.setStyle(i),n.current=i}},[e,t])}function L1e(e){return function(n){const r=lx(),i=e(ux(n,r),r);return Pk(i.current,n.eventHandlers),aW(i.current,r),R1e(i.current,n),i}}function I1e(e,t){const n=fx(e,t),r=oW(n);return iW(r)}function D1e(e,t){const n=fx(e),r=C1e(n,t);return A1e(r)}function B1e(e,t){const n=fx(e,t),r=L1e(n);return iW(r)}function $1e(e,t){const n=fx(e,t),r=oW(n);return k1e(r)}function F1e(e,t,n){const{opacity:r,zIndex:i}=t;r!=null&&r!==n.opacity&&e.setOpacity(r),i!=null&&i!==n.zIndex&&e.setZIndex(i)}function dx(){return lx().map}function q1e(e){const t=dx();return M.useEffect(function(){return t.on(e),function(){t.off(e)}},[t,e]),t}function GT(){return GT=Object.assign||function(e){for(var t=1;t(b==null?void 0:b.map)??null,[b]);const x=M.useCallback(T=>{if(T!==null&&b===null){const E=new gp.Map(T,p);n!=null&&d!=null?E.setView(n,d):e!=null&&E.fitBounds(e,t),c!=null&&E.whenReady(c),P(E1e(E))}},[]);M.useEffect(()=>()=>{b==null||b.map.remove()},[b]);const w=b?ce.createElement(rW,{value:b},r):o??null;return ce.createElement("div",GT({},y,{ref:x}),w)}const jk=M.forwardRef(z1e),Lc=I1e(function({position:t,...n},r){const i=new gp.Marker(t,n);return cx(i,tW(r,{overlayContainer:i}))},function(t,n,r){n.position!==r.position&&t.setLatLng(n.position),n.icon!=null&&n.icon!==r.icon&&t.setIcon(n.icon),n.zIndexOffset!=null&&n.zIndexOffset!==r.zIndexOffset&&t.setZIndexOffset(n.zIndexOffset),n.opacity!=null&&n.opacity!==r.opacity&&t.setOpacity(n.opacity),t.dragging!=null&&n.draggable!==r.draggable&&(n.draggable===!0?t.dragging.enable():t.dragging.disable())}),hx=B1e(function({positions:t,...n},r){const i=new gp.Polygon(t,n);return cx(i,tW(r,{overlayContainer:i}))},function(t,n,r){n.positions!==r.positions&&t.setLatLngs(n.positions)}),Ay=D1e(function(t,n){const r=new gp.Popup(t,n.overlayContainer);return cx(r,n)},function(t,n,{position:r},i){M.useEffect(function(){const{instance:o}=t;function s(d){d.popup===o&&(o.update(),i(!0))}function c(d){d.popup===o&&i(!1)}return n.map.on({popupopen:s,popupclose:c}),n.overlayContainer==null?(r!=null&&o.setLatLng(r),o.openOn(n.map)):n.overlayContainer.bindPopup(o),function(){var p;n.map.off({popupopen:s,popupclose:c}),(p=n.overlayContainer)==null||p.unbindPopup(),n.map.removeLayer(o)}},[t,n,i,r])}),Ok=$1e(function({url:t,...n},r){const i=new gp.TileLayer(t,ux(n,r));return cx(i,r)},function(t,n,r){F1e(t,n,r);const{url:i}=n;i!=null&&i!==r.url&&t.setUrl(i)});delete Es.Icon.Default.prototype._getIconUrl;Es.Icon.Default.mergeOptions({iconRetinaUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon-2x.png",iconUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-shadow.png"});const gj="ABCDEFGHIJKLMNOPQRSTUVWXYZ",U1e={"Kopi Arabika":"#7c3aed",Kakao:"#b45309","Kelapa Sawit":"#15803d",Padi:"#facc15",Jagung:"#f97316"},sW=e=>e<26?gj[e]:gj[Math.floor(e/26)-1]+gj[e%26],V1e=e=>new Es.DivIcon({className:"",html:`
${e}
`,iconSize:[28,28],iconAnchor:[14,14]}),W1e=(e,t)=>{const n=U1e[e]||"#16a34a",r="#64748b",i=1;return new Es.DivIcon({className:"",html:`
`,iconSize:[22,22],iconAnchor:[11,11]})};function K1e({onLocationFound:e}){const t=dx();return M.useEffect(()=>{t.locate(),t.on("locationfound",n=>{t.flyTo(n.latlng,16),e&&e(n.latlng)})},[t,e]),null}function H1e({points:e,setPoints:t,isDrawing:n}){return q1e({click(r){n&&t(i=>[...i,[r.latlng.lat,r.latlng.lng]])}}),e.length>0?h.jsxs(h.Fragment,{children:[h.jsx(hx,{positions:e,pathOptions:{color:"#16a34a",fillColor:"#16a34a",fillOpacity:.3,weight:2}}),e.map((r,i)=>h.jsx(Lc,{position:r,children:h.jsxs(Ay,{children:["Titik ",sW(i)]})},i))]}):null}function G1e(e){if(e.length<3)return 0;let t=0;for(let o=0;oo+s[0],0)/e.length,r=111320,i=111320*Math.cos(n*Math.PI/180);return t*r*i/1e4}function Tk({center:e=[-6.2,106.8],zoom:t=20,existingPolygon:n=null,onSave:r,readOnly:i=!1,lands:a=[],plants:o=[]}){const[s,c]=M.useState(n||[]),[d,p]=M.useState(!1),[m,y]=M.useState(null),b=G1e(s),P=()=>{c([]),p(!1)},x=()=>{if(s.length>=3&&r){const w=s.reduce((E,k)=>E+k[0],0)/s.length,T=s.reduce((E,k)=>E+k[1],0)/s.length;r({polygon_coordinates:s.map(E=>[E[1],E[0]]),center_lat:w,center_lng:T,area_hectares:b})}};return h.jsxs(Tt,{className:"border-0 shadow-sm overflow-hidden",children:[!i&&h.jsxs("div",{className:"p-4 border-b flex justify-between bg-slate-50",children:[h.jsxs("div",{className:"flex gap-2",children:[h.jsx(pt,{variant:d?"default":"outline",size:"sm",onClick:()=>p(!d),children:d?"Sedang Menggambar...":"Mulai Gambar Polygon"}),h.jsxs(pt,{variant:"outline",size:"sm",onClick:P,children:[h.jsx(nb,{className:"w-4 h-4 mr-2"}),"Reset"]})]}),h.jsxs("div",{className:"flex gap-3 items-center",children:[b>0&&h.jsxs("span",{className:"text-sm",children:["Luas:"," ",h.jsxs("b",{className:"text-emerald-600",children:[b.toFixed(4)," Ha"]})]}),h.jsxs(pt,{size:"sm",onClick:x,disabled:s.length<3,children:[h.jsx(nF,{className:"w-4 h-4 mr-2"}),"Simpan"]})]})]}),h.jsx("div",{className:"h-[500px]",children:h.jsxs(jk,{center:e,zoom:t,maxZoom:22,className:"h-full w-full",children:[h.jsx(Ok,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",maxZoom:22,maxNativeZoom:19}),h.jsx(K1e,{onLocationFound:y}),!i&&h.jsx(H1e,{points:s,setPoints:c,isDrawing:d}),a.map(w=>{var k;if(!w.polygon_coordinates)return null;const E=(w.polygon_coordinates.length>1&&w.polygon_coordinates[0][0]===w.polygon_coordinates[w.polygon_coordinates.length-1][0]&&w.polygon_coordinates[0][1]===w.polygon_coordinates[w.polygon_coordinates.length-1][1]?w.polygon_coordinates.slice(0,-1):w.polygon_coordinates).map(D=>[D[1],D[0]]);return h.jsxs(h.Fragment,{children:[h.jsx(hx,{positions:E,pathOptions:{color:w.validation_status==="valid"?"#16a34a":"#f59e0b",fillOpacity:.2,weight:2},children:h.jsx(Ay,{children:h.jsxs("div",{children:[h.jsx("b",{children:w.name}),h.jsx("br",{}),(k=w.area_hectares)==null?void 0:k.toFixed(2)," Ha"]})})},w.id),E.map((D,I)=>h.jsx(Lc,{position:D,icon:V1e(sW(I))},`${w.id}-${I}`))]})}),o.map(w=>h.jsx(Lc,{position:[w.latitude,w.longitude],icon:W1e(w.status),children:h.jsxs(Ay,{children:[h.jsx("b",{children:w.commodity_name}),h.jsx("br",{}),"Status: ",w.status]})},w.id)),m&&h.jsx(Lc,{position:m,children:h.jsx(Ay,{children:"Lokasi Anda"})})]})})]})}var vj="rovingFocusGroup.onEntryFocus",Z1e={bubbles:!1,cancelable:!0},qg="RovingFocusGroup",[ZT,lW,Y1e]=TV(qg),[X1e,uW]=gd(qg,[Y1e]),[Q1e,J1e]=X1e(qg),cW=M.forwardRef((e,t)=>h.jsx(ZT.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(ZT.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(eSe,{...e,ref:t})})}));cW.displayName=qg;var eSe=M.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...m}=e,y=M.useRef(null),b=Er(t,y),P=lk(a),[x,w]=Zh({prop:o,defaultProp:s??null,onChange:c,caller:qg}),[T,E]=M.useState(!1),k=Fc(d),D=lW(n),I=M.useRef(!1),[R,$]=M.useState(0);return M.useEffect(()=>{const V=y.current;if(V)return V.addEventListener(vj,k),()=>V.removeEventListener(vj,k)},[k]),h.jsx(Q1e,{scope:n,orientation:r,dir:P,loop:i,currentTabStopId:x,onItemFocus:M.useCallback(V=>w(V),[w]),onItemShiftTab:M.useCallback(()=>E(!0),[]),onFocusableItemAdd:M.useCallback(()=>$(V=>V+1),[]),onFocusableItemRemove:M.useCallback(()=>$(V=>V-1),[]),children:h.jsx(Dn.div,{tabIndex:T||R===0?-1:0,"data-orientation":r,...m,ref:b,style:{outline:"none",...e.style},onMouseDown:Mn(e.onMouseDown,()=>{I.current=!0}),onFocus:Mn(e.onFocus,V=>{const K=!I.current;if(V.target===V.currentTarget&&K&&!T){const Z=new CustomEvent(vj,Z1e);if(V.currentTarget.dispatchEvent(Z),!Z.defaultPrevented){const ee=D().filter(fe=>fe.focusable),ne=ee.find(fe=>fe.active),oe=ee.find(fe=>fe.id===x),Se=[ne,oe,...ee].filter(Boolean).map(fe=>fe.ref.current);hW(Se,p)}}I.current=!1}),onBlur:Mn(e.onBlur,()=>E(!1))})})}),fW="RovingFocusGroupItem",dW=M.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Rc(),d=a||c,p=J1e(fW,n),m=p.currentTabStopId===d,y=lW(n),{onFocusableItemAdd:b,onFocusableItemRemove:P,currentTabStopId:x}=p;return M.useEffect(()=>{if(r)return b(),()=>P()},[r,b,P]),h.jsx(ZT.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:h.jsx(Dn.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...s,ref:t,onMouseDown:Mn(e.onMouseDown,w=>{r?p.onItemFocus(d):w.preventDefault()}),onFocus:Mn(e.onFocus,()=>p.onItemFocus(d)),onKeyDown:Mn(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){p.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const T=rSe(w,p.orientation,p.dir);if(T!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let k=y().filter(D=>D.focusable).map(D=>D.ref.current);if(T==="last")k.reverse();else if(T==="prev"||T==="next"){T==="prev"&&k.reverse();const D=k.indexOf(w.currentTarget);k=p.loop?iSe(k,D+1):k.slice(D+1)}setTimeout(()=>hW(k))}}),children:typeof o=="function"?o({isCurrentTabStop:m,hasTabStop:x!=null}):o})})});dW.displayName=fW;var tSe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nSe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function rSe(e,t,n){const r=nSe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return tSe[r]}function hW(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function iSe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var aSe=cW,oSe=dW;function sSe(e,t){return M.useReducer((n,r)=>t[n][r]??n,e)}var zg=e=>{const{present:t,children:n}=e,r=lSe(t),i=typeof n=="function"?n({present:r.isPresent}):M.Children.only(n),a=Er(r.ref,uSe(i));return typeof n=="function"||r.isPresent?M.cloneElement(i,{ref:a}):null};zg.displayName="Presence";function lSe(e){const[t,n]=M.useState(),r=M.useRef(null),i=M.useRef(e),a=M.useRef("none"),o=e?"mounted":"unmounted",[s,c]=sSe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return M.useEffect(()=>{const d=ly(r.current);a.current=s==="mounted"?d:"none"},[s]),Ca(()=>{const d=r.current,p=i.current;if(p!==e){const y=a.current,b=ly(d);e?c("MOUNT"):b==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(p&&y!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Ca(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,m=b=>{const x=ly(r.current).includes(CSS.escape(b.animationName));if(b.target===t&&x&&(c("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},y=b=>{b.target===t&&(a.current=ly(r.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:M.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function ly(e){return(e==null?void 0:e.animationName)||"none"}function uSe(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var px="Tabs",[cSe]=gd(px,[uW]),pW=uW(),[fSe,Ek]=cSe(px),mW=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:c="automatic",...d}=e,p=lk(s),[m,y]=Zh({prop:r,onChange:i,defaultProp:a??"",caller:px});return h.jsx(fSe,{scope:n,baseId:Rc(),value:m,onValueChange:y,orientation:o,dir:p,activationMode:c,children:h.jsx(Dn.div,{dir:p,"data-orientation":o,...d,ref:t})})});mW.displayName=px;var gW="TabsList",vW=M.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,a=Ek(gW,n),o=pW(n);return h.jsx(aSe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:h.jsx(Dn.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});vW.displayName=gW;var yW="TabsTrigger",bW=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Ek(yW,n),s=pW(n),c=_W(o.baseId,r),d=SW(o.baseId,r),p=r===o.value;return h.jsx(oSe,{asChild:!0,...s,focusable:!i,active:p,children:h.jsx(Dn.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":d,"data-state":p?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...a,ref:t,onMouseDown:Mn(e.onMouseDown,m=>{!i&&m.button===0&&m.ctrlKey===!1?o.onValueChange(r):m.preventDefault()}),onKeyDown:Mn(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&o.onValueChange(r)}),onFocus:Mn(e.onFocus,()=>{const m=o.activationMode!=="manual";!p&&!i&&m&&o.onValueChange(r)})})})});bW.displayName=yW;var xW="TabsContent",wW=M.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Ek(xW,n),c=_W(s.baseId,r),d=SW(s.baseId,r),p=r===s.value,m=M.useRef(p);return M.useEffect(()=>{const y=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(y)},[]),h.jsx(zg,{present:i||p,children:({present:y})=>h.jsx(Dn.div,{"data-state":p?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":c,hidden:!y,id:d,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:y&&a})})});wW.displayName=xW;function _W(e,t){return`${e}-trigger-${t}`}function SW(e,t){return`${e}-content-${t}`}var dSe=mW,PW=vW,jW=bW,OW=wW;const Ak=dSe,mx=M.forwardRef(({className:e,...t},n)=>h.jsx(PW,{ref:n,className:fn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));mx.displayName=PW.displayName;const al=M.forwardRef(({className:e,...t},n)=>h.jsx(jW,{ref:n,className:fn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));al.displayName=jW.displayName;const ol=M.forwardRef(({className:e,...t},n)=>h.jsx(OW,{ref:n,className:fn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));ol.displayName=OW.displayName;function hSe(){const[e,t]=M.useState(""),[n,r]=M.useState("all"),[i,a]=M.useState("grid"),{data:o=[],isLoading:s}=bn({queryKey:["lands"],queryFn:async()=>{let x=[];try{const k=await mt.entities.Land.list("-created_date");Array.isArray(k)&&(x=k)}catch{console.warn("Server lands offline/error")}const w=await Tr.getEntities("lands"),T=new Map;x.forEach(k=>{k.id&&T.set(k.id,k)}),w.forEach(k=>{k.id&&T.set(k.id,k)});const E=Array.from(T.values());return console.log("🔍 Total Lands Loaded (Server + Local):",E.length),E}}),{data:c=[]}=bn({queryKey:["farmers"],queryFn:async()=>{let x=[];try{const E=await mt.entities.Farmer.list();x=Array.isArray(E)?E:[]}catch{}const w=await Tr.getEntities("farmers"),T=new Map;return x.forEach(E=>T.set(E.id,E)),w.forEach(E=>T.set(E.id,E)),Array.from(T.values())}}),{data:d=[]}=bn({queryKey:["plants"],queryFn:()=>mt.entities.Plant.list()}),p=Array.isArray(o)?o:[],m=Array.isArray(c)?c:[],y=Array.isArray(d)?d:[],b=M.useMemo(()=>{const x={};return m.forEach(w=>{w!=null&&w.id&&(x[w.id]=w.full_name)}),x},[m]),P=M.useMemo(()=>Array.isArray(p)?p.filter(x=>{var $,V,K;if(!x)return!1;const w=(($=x.name)==null?void 0:$.toLowerCase())||"",T=((V=x.village)==null?void 0:V.toLowerCase())||"",E=((K=b[x.farmer_id])==null?void 0:K.toLowerCase())||"",k=e.toLowerCase(),D=!e||w.includes(k)||T.includes(k)||E.includes(k),I=n==="all"||x.validation_status===n,R=D&&I;return!R&&e===""&&console.log("Data ada tapi tidak lolos status filter:",x),R}):[],[p,e,n,b]);return M.useMemo(()=>{const x={};return y.forEach(w=>{w!=null&&w.land_id&&(x[w.land_id]=(x[w.land_id]||0)+1)}),x},[y]),h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-3xl font-bold text-slate-900",children:"Pemetaan Lahan"}),h.jsxs("p",{className:"text-slate-500",children:[p.length," lahan terdaftar"]})]}),h.jsx(zo,{to:ei("LandRegister"),children:h.jsxs(pt,{className:"bg-emerald-600 hover:bg-emerald-700 h-11",children:[h.jsx(Dc,{className:"w-5 h-5 mr-2"}),"Tambah Lahan"]})})]}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"flex flex-col md:flex-row gap-3",children:[h.jsxs("div",{className:"relative flex-1",children:[h.jsx(tE,{className:"w-5 h-5 absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),h.jsx(nn,{placeholder:"Cari nama lahan, desa, atau petani...",value:e,onChange:x=>t(x.target.value),className:"h-11 pl-11 bg-white border-0 shadow-sm"})]}),h.jsxs(Hr,{value:n,onValueChange:r,children:[h.jsxs(Dr,{className:"w-full md:w-48 h-11 bg-white border-0 shadow-sm",children:[h.jsx(eE,{className:"w-4 h-4 mr-2 text-slate-400"}),h.jsx(Gr,{placeholder:"Validasi"})]}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"all",children:"Semua Status"}),h.jsx(Kt,{value:"valid",children:"Tervalidasi"}),h.jsx(Kt,{value:"invalid",children:"Tidak Valid"}),h.jsx(Kt,{value:"need_review",children:"Perlu Review"}),h.jsx(Kt,{value:"pending",children:"Pending"})]})]}),h.jsxs("div",{className:"flex bg-white rounded-lg shadow-sm p-1",children:[h.jsx(pt,{variant:i==="grid"?"default":"ghost",size:"sm",onClick:()=>a("grid"),className:i==="grid"?"bg-emerald-600 hover:bg-emerald-700":"",children:h.jsx(WH,{className:"w-4 h-4"})}),h.jsx(pt,{variant:i==="map"?"default":"ghost",size:"sm",onClick:()=>a("map"),className:i==="map"?"bg-emerald-600 hover:bg-emerald-700":"",children:h.jsx(XH,{className:"w-4 h-4"})})]})]}),s?h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(x=>h.jsx("div",{className:"h-48 bg-white rounded-xl animate-pulse"},x))}):i==="map"?h.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:h.jsx(Tk,{lands:P,plants:y,readOnly:!0,center:p.length>0?[p[0].center_lat||-6.2,p[0].center_lng||106.8]:[-6.2,106.8],zoom:10})}):P.length>0?h.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:P.map((x,w)=>h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:w*.05},children:h.jsx(Sk,{land:x,farmerName:b[x.farmer_id],plantCount:y.filter(T=>T.land_id===x.id).length})},x.id))}):h.jsx(Qa,{icon:js,title:"Tidak ada lahan ditemukan",description:e||n!=="all"?"Coba ubah filter pencarian Anda":"Mulai dengan mendaftarkan lahan baru",action:()=>window.location.href=ei("LandRegister"),actionLabel:"Tambah Lahan Pertama"})]})})}delete Es.Icon.Default.prototype._getIconUrl;Es.Icon.Default.mergeOptions({iconRetinaUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon-2x.png",iconUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-shadow.png"});const x$=e=>{const t=["#ef4444","#f59e0b","#22c55e","#3b82f6","#8b5cf6","#ec4899","#14b8a6"];return t[e%t.length]};function pSe({center:e,zoom:t}){const n=dx();return M.useEffect(()=>{e&&n.flyTo(e,t||18)},[e,n,t]),null}function mSe(e){if(e.length<3)return 0;let t=0;for(let o=0;oo+s[0],0)/e.length,r=111320,i=111320*Math.cos(n*Math.PI/180);return t*r*i/1e4}function kk({existingPolygon:e,onSave:t,readOnly:n=!1}){const[r,i]=M.useState(e||[]),[a,o]=M.useState(null),[s,c]=M.useState(!1),[d,p]=M.useState(null),[m,y]=M.useState(null),b=mSe(r);M.useEffect(()=>{if(e&&e.length>0){const R=e.map($=>[$[1],$[0]]);i(R)}else i([])},[e]);const P=()=>{if(!navigator.geolocation){Mt.error("GPS tidak didukung di perangkat ini");return}c(!0);const R=navigator.geolocation.watchPosition($=>{const{latitude:V,longitude:K,accuracy:Z}=$.coords;o([V,K]),p(Z),c(!1)},$=>{switch(c(!1),$.code){case $.PERMISSION_DENIED:Mt.error("Izin GPS ditolak. Aktifkan GPS di pengaturan.");break;case $.POSITION_UNAVAILABLE:Mt.error("Lokasi tidak tersedia. Pastikan GPS aktif.");break;case $.TIMEOUT:Mt.error("Waktu pencarian lokasi habis. Coba lagi.");break;default:Mt.error("Gagal mendapatkan lokasi")}},{enableHighAccuracy:!0,timeout:1e4,maximumAge:0});y(R)},x=()=>{m!==null&&(navigator.geolocation.clearWatch(m),y(null))};M.useEffect(()=>(P(),()=>x()),[]);const w=()=>{if(!a){Mt.error("Tunggu GPS menemukan lokasi Anda");return}const R=[...r,a];i(R),Mt.success(`Titik ${R.length} ditandai!`)},T=()=>{if(r.length>0){const R=r.slice(0,-1);i(R),Mt.info("Titik terakhir dihapus")}},E=()=>{i([]),Mt.info("Semua titik dihapus")},k=()=>{if(r.length<3){Mt.error("Minimal 3 titik untuk membentuk lahan");return}const R=r.reduce((V,K)=>V+K[0],0)/r.length,$=r.reduce((V,K)=>V+K[1],0)/r.length;t({polygon_coordinates:r.map(V=>[V[1],V[0]]),center_lat:R,center_lng:$,area_hectares:b})},D=R=>new Es.DivIcon({className:"custom-corner-icon",html:`
${R+1}
`,iconSize:[32,32],iconAnchor:[16,16]}),I=new Es.DivIcon({className:"current-location-icon",html:`
`,iconSize:[20,20],iconAnchor:[10,10]});return h.jsxs(Tt,{className:"border-0 shadow-sm overflow-hidden",children:[h.jsxs("div",{className:"p-4 bg-slate-50 border-b border-slate-100 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:`w-3 h-3 rounded-full ${a?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm font-medium text-slate-700",children:s?"Mencari lokasi GPS...":a?"GPS Aktif":"GPS Tidak Aktif"}),d&&h.jsxs("p",{className:"text-xs text-slate-500",children:["Akurasi: ±",d.toFixed(0)," meter"]})]})]}),a&&h.jsxs(ur,{variant:"outline",className:"text-xs",children:[a[0].toFixed(6),", ",a[1].toFixed(6)]})]}),h.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((R,$)=>h.jsxs("div",{className:"px-3 py-1.5 rounded-full text-sm font-medium text-white",style:{backgroundColor:x$($)},children:["Titik ",$+1]},$))}),!n&&h.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.jsxs(pt,{onClick:w,disabled:!a||r.length>=4,className:"flex-1 bg-emerald-600 hover:bg-emerald-700 h-12 text-base",children:[h.jsx(r9,{className:"w-5 h-5 mr-2"}),"Tandai Titik ",r.length+1]}),h.jsx(pt,{variant:"outline",onClick:T,disabled:r.length===0,className:"h-12",children:h.jsx(u9,{className:"w-5 h-5"})}),h.jsx(pt,{variant:"outline",onClick:E,disabled:r.length===0,className:"h-12",children:h.jsx(nb,{className:"w-5 h-5"})})]}),r.length>=3&&h.jsx("div",{className:"p-4 bg-emerald-50 rounded-xl border border-emerald-100",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-emerald-600 font-medium",children:"Luas Lahan Terhitung"}),h.jsxs("p",{className:"text-3xl font-bold text-emerald-700",children:[b.toFixed(4)," Ha"]}),h.jsxs("p",{className:"text-xs text-emerald-500 mt-1",children:[(b*1e4).toFixed(0)," m²"]})]}),!n&&h.jsxs(pt,{onClick:k,className:"bg-emerald-600 hover:bg-emerald-700 h-12 px-6",children:[h.jsx(nF,{className:"w-5 h-5 mr-2"}),"Simpan Lahan"]})]})})]}),h.jsxs("div",{className:"h-[400px] relative",children:[h.jsxs(jk,{center:a||[-6.2,106.8],zoom:18,className:"h-full w-full z-0",scrollWheelZoom:!0,children:[h.jsx(Ok,{attribution:'© OpenStreetMap',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),a&&h.jsx(pSe,{center:a,zoom:18}),a&&h.jsx(Lc,{position:a,icon:I}),r.map((R,$)=>h.jsx(Lc,{position:R,icon:D($)},$)),r.length>=3&&h.jsx(hx,{positions:r,pathOptions:{color:"#16a34a",fillColor:"#16a34a",fillOpacity:.3,weight:3}})]}),!n&&h.jsx("div",{className:"absolute bottom-4 left-4 right-4 bg-white/95 backdrop-blur rounded-xl p-4 shadow-lg z-[1000]",children:h.jsxs("p",{className:"text-sm text-slate-700",children:[h.jsx("span",{className:"font-semibold",children:"Petunjuk:"}),"Berdiri di setiap sudut lahan lalu tekan",h.jsxs("span",{className:"font-semibold text-emerald-600",children:[" ","Tandai Titik ",r.length+1]}),".",r.length<3&&" Minimal 3 titik untuk membentuk polygon.",r.length>=3&&" Anda dapat menambahkan titik tambahan mengikuti bentuk lahan."]})})]})]})}function gSe(){const e=dE(),t=As(),r=new URLSearchParams(window.location.search).get("farmer_id"),[i,a]=M.useState({farmer_id:r||"",name:"",land_status:"owned",village:"",district:"",regency:"",polygon_coordinates:null,center_lat:null,center_lng:null,area_hectares:null,validation_status:"pending",sync_status:"pending"}),{data:o=[]}=bn({queryKey:["farmers"],queryFn:async()=>{try{const y=await mt.entities.Farmer.list(),b=Array.isArray(y)?y:[],P=await Tr.getEntities("farmers"),x=new js;return b.forEach(w=>x.set(w.id,w)),P.forEach(w=>x.set(w.id,w)),Array.from(x.values())}catch{return console.warn("Gagal ambil petani dari server, mencoba ambil lokal..."),await Tr.getEntities("farmers")}}}),s=Array.isArray(o)?o:[],c=ci({mutationFn:async y=>{try{const b=await mt.entities.Land.create(y);if(typeof b=="string"&&b.includes(""))throw new Error("Menerima HTML, bukan JSON. Endpoint mungkin salah.");return console.log("2. Berhasil simpan ke server",b),b}catch(b){throw console.log("2. Gagal ke server, beralih ke offline mode",b),{type:"OFFLINE_SAVE",data:y}}},onSuccess:y=>{t.invalidateQueries({queryKey:["lands"]}),Mt.success("Lahan berhasil didaftarkan!"),e(ei("LandDetail")+`?id=${y.id}`)},onError:async(y,b)=>{if(y.type==="OFFLINE_SAVE")try{const x=await Tr.saveEntityLocally("land",b);t.invalidateQueries({queryKey:["lands"]}),Mt.info("Tersimpan secara lokal"),setTimeout(()=>{e(ei("Lands"))},500),e(ei("Lands"))}catch(P){console.error("SQLite Error:",P),Mt.error("Gagal simpan lokal")}}}),d=(y,b)=>{a(P=>({...P,[y]:b}))},p=y=>{const b=JSON.parse(JSON.stringify(y.polygon_coordinates));a(P=>({...P,polygon_coordinates:b,center_lat:Number(y.center_lat),center_lng:Number(y.center_lng),area_hectares:Number(y.area_hectares)})),Mt.success(`Polygon disimpan! Luas: ${y.area_hectares.toFixed(4)} Ha`)},m=y=>{if(y.preventDefault(),!i.farmer_id){Mt.error("Pilih petani terlebih dahulu");return}if(!i.center_lat||!i.center_lng){Mt.error("Gambar polygon lahan di peta");return}console.log("🚀 SUBMIT formData:",i),c.mutate(i)};return Array.isArray(s)&&s.find(y=>y.id===i.farmer_id),h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-5xl mx-auto p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center gap-4",children:[h.jsx(zo,{to:ei("Lands"),children:h.jsx(pt,{variant:"outline",size:"icon",className:"h-10 w-10",children:h.jsx(J0,{className:"w-5 h-5"})})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Registrasi Lahan Baru"}),h.jsx("p",{className:"text-slate-500",children:"Gambar polygon dan isi data lahan"})]})]}),h.jsxs("form",{onSubmit:m,className:"space-y-6",children:[h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{className:"pb-4",children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(zf,{className:"w-5 h-5 text-emerald-600"}),"Pemilik Lahan"]})}),h.jsx(Pn,{children:h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Pilih Petani"}),h.jsxs(Hr,{value:i.farmer_id,onValueChange:y=>d("farmer_id",y),children:[h.jsx(Dr,{className:"h-11",children:h.jsx(Gr,{placeholder:"Cari dan pilih petani..."})}),h.jsx(Br,{children:s.map(y=>h.jsxs(Kt,{value:y.id,children:[y.full_name," - ",y.village,", ",y.district]},y.id))})]})]})})]})}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.15},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{className:"pb-4",children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(js,{className:"w-5 h-5 text-emerald-600"}),"Informasi Lahan"]})}),h.jsxs(Pn,{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Nama/Label Lahan"}),h.jsx(nn,{value:i.name,onChange:y=>d("name",y.target.value),placeholder:"Contoh: Kebun Kopi Utara",required:!0,className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Status Kepemilikan"}),h.jsxs(Hr,{value:i.land_status,onValueChange:y=>d("land_status",y),children:[h.jsx(Dr,{className:"h-11",children:h.jsx(Gr,{})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"owned",children:"Milik Sendiri"}),h.jsx(Kt,{value:"rented",children:"Sewa"}),h.jsx(Kt,{value:"shared",children:"Bagi Hasil"}),h.jsx(Kt,{value:"government",children:"Tanah Negara"})]})]})]})]}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Desa"}),h.jsx(nn,{value:i.village,onChange:y=>d("village",y.target.value),placeholder:"Nama desa",className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Kecamatan"}),h.jsx(nn,{value:i.district,onChange:y=>d("district",y.target.value),placeholder:"Nama kecamatan",className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Kabupaten"}),h.jsx(nn,{value:i.regency,onChange:y=>d("regency",y.target.value),placeholder:"Nama kabupaten",className:"h-11"})]})]}),i.area_hectares&&h.jsxs("div",{className:"p-4 bg-emerald-50 rounded-lg border border-emerald-100",children:[h.jsx("p",{className:"text-sm text-emerald-600",children:"Luas Lahan Terhitung"}),h.jsxs("p",{className:"text-2xl font-bold text-emerald-700",children:[i.area_hectares.toFixed(4)," Hektar"]})]})]})]})}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:h.jsx(kk,{onSave:p})}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.25},className:"flex justify-end",children:h.jsxs(pt,{type:"submit",disabled:c.isPending||!i.farmer_id,className:"bg-emerald-600 hover:bg-emerald-700 h-11 px-8",children:[c.isPending&&h.jsx(ti,{className:"w-4 h-4 mr-2 animate-spin"}),"Daftarkan Lahan"]})})]})]})})}function vSe(e){const t=ySe(e),n=M.forwardRef((r,i)=>{const{children:a,...o}=r,s=M.Children.toArray(a),c=s.find(xSe);if(c){const d=c.props.children,p=s.map(m=>m===c?M.Children.count(d)>1?M.Children.only(null):M.isValidElement(d)?d.props.children:null:m);return h.jsx(t,{...o,ref:i,children:M.isValidElement(d)?M.cloneElement(d,void 0,p):null})}return h.jsx(t,{...o,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function ySe(e){const t=M.forwardRef((n,r)=>{const{children:i,...a}=n;if(M.isValidElement(i)){const o=_Se(i),s=wSe(a,i.props);return i.type!==M.Fragment&&(s.ref=r?dp(r,o):o),M.cloneElement(i,s)}return M.Children.count(i)>1?M.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var bSe=Symbol("radix.slottable");function xSe(e){return M.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===bSe}function wSe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{const c=a(...s);return i(...s),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function _Se(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var gx="Dialog",[TW]=gd(gx),[SSe,ml]=TW(gx),EW=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=M.useRef(null),c=M.useRef(null),[d,p]=Zh({prop:r,defaultProp:i??!1,onChange:a,caller:gx});return h.jsx(SSe,{scope:t,triggerRef:s,contentRef:c,contentId:Rc(),titleId:Rc(),descriptionId:Rc(),open:d,onOpenChange:p,onOpenToggle:M.useCallback(()=>p(m=>!m),[p]),modal:o,children:n})};EW.displayName=gx;var AW="DialogTrigger",kW=M.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ml(AW,n),a=Er(t,i.triggerRef);return h.jsx(Dn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Mk(i.open),...r,ref:a,onClick:Mn(e.onClick,i.onOpenToggle)})});kW.displayName=AW;var Ck="DialogPortal",[PSe,CW]=TW(Ck,{forceMount:void 0}),NW=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=ml(Ck,t);return h.jsx(PSe,{scope:t,forceMount:n,children:M.Children.map(r,o=>h.jsx(zg,{present:n||a.open,children:h.jsx(bk,{asChild:!0,container:i,children:o})}))})};NW.displayName=Ck;var G0="DialogOverlay",MW=M.forwardRef((e,t)=>{const n=CW(G0,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ml(G0,e.__scopeDialog);return a.modal?h.jsx(zg,{present:r||a.open,children:h.jsx(OSe,{...i,ref:t})}):null});MW.displayName=G0;var jSe=vSe("DialogOverlay.RemoveScroll"),OSe=M.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ml(G0,n);return h.jsx(xk,{as:jSe,allowPinchZoom:!0,shards:[i.contentRef],children:h.jsx(Dn.div,{"data-state":Mk(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),od="DialogContent",RW=M.forwardRef((e,t)=>{const n=CW(od,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ml(od,e.__scopeDialog);return h.jsx(zg,{present:r||a.open,children:a.modal?h.jsx(TSe,{...i,ref:t}):h.jsx(ESe,{...i,ref:t})})});RW.displayName=od;var TSe=M.forwardRef((e,t)=>{const n=ml(od,e.__scopeDialog),r=M.useRef(null),i=Er(t,n.contentRef,r);return M.useEffect(()=>{const a=r.current;if(a)return i8(a)},[]),h.jsx(LW,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Mn(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Mn(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&a.preventDefault()}),onFocusOutside:Mn(e.onFocusOutside,a=>a.preventDefault())})}),ESe=M.forwardRef((e,t)=>{const n=ml(od,e.__scopeDialog),r=M.useRef(!1),i=M.useRef(!1);return h.jsx(LW,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,s;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(r.current||(s=n.triggerRef.current)==null||s.focus(),a.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:a=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=a.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&i.current&&a.preventDefault()}})}),LW=M.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=ml(od,n),c=M.useRef(null),d=Er(t,c);return kV(),h.jsxs(h.Fragment,{children:[h.jsx(ck,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:h.jsx(uk,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Mk(s.open),...o,ref:d,onDismiss:()=>s.onOpenChange(!1)})}),h.jsxs(h.Fragment,{children:[h.jsx(ASe,{titleId:s.titleId}),h.jsx(CSe,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Nk="DialogTitle",IW=M.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ml(Nk,n);return h.jsx(Dn.h2,{id:i.titleId,...r,ref:t})});IW.displayName=Nk;var DW="DialogDescription",BW=M.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ml(DW,n);return h.jsx(Dn.p,{id:i.descriptionId,...r,ref:t})});BW.displayName=DW;var $W="DialogClose",FW=M.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ml($W,n);return h.jsx(Dn.button,{type:"button",...r,ref:t,onClick:Mn(e.onClick,()=>i.onOpenChange(!1))})});FW.displayName=$W;function Mk(e){return e?"open":"closed"}var qW="DialogTitleWarning",[JOe,zW]=Tbe(qW,{contentName:od,titleName:Nk,docsSlug:"dialog"}),ASe=({titleId:e})=>{const t=zW(qW),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return M.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kSe="DialogDescriptionWarning",CSe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${zW(kSe).contentName}}.`;return M.useEffect(()=>{var a;const i=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},NSe=EW,MSe=kW,RSe=NW,UW=MW,VW=RW,WW=IW,KW=BW,LSe=FW;const sl=NSe,HW=MSe,ISe=RSe,GW=M.forwardRef(({className:e,...t},n)=>h.jsx(UW,{ref:n,className:fn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));GW.displayName=UW.displayName;const Ss=M.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(ISe,{children:[h.jsx(GW,{}),h.jsxs(VW,{ref:r,className:fn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,h.jsxs(LSe,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx(rb,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ss.displayName=VW.displayName;const ql=({className:e,...t})=>h.jsx("div",{className:fn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ql.displayName="DialogHeader";const zl=M.forwardRef(({className:e,...t},n)=>h.jsx(WW,{ref:n,className:fn("text-lg font-semibold leading-none tracking-tight",e),...t}));zl.displayName=WW.displayName;const DSe=M.forwardRef(({className:e,...t},n)=>h.jsx(KW,{ref:n,className:fn("text-sm text-muted-foreground",e),...t}));DSe.displayName=KW.displayName;function gl(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function sd(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const ZW=6048e5,BSe=864e5;let $Se={};function vx(){return $Se}function mg(e,t){var s,c,d,p;const n=vx(),r=(t==null?void 0:t.weekStartsOn)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((p=(d=n.locale)==null?void 0:d.options)==null?void 0:p.weekStartsOn)??0,i=gl(e),a=i.getDay(),o=(a=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function w$(e){const t=gl(e);return t.setHours(0,0,0,0),t}function _$(e){const t=gl(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function FSe(e,t){const n=w$(e),r=w$(t),i=+n-_$(n),a=+r-_$(r);return Math.round((i-a)/BSe)}function qSe(e){const t=YW(e),n=sd(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Z0(n)}function zSe(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function USe(e){if(!zSe(e)&&typeof e!="number")return!1;const t=gl(e);return!isNaN(Number(t))}function VSe(e){const t=gl(e),n=sd(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}const WSe={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"}},KSe=(e,t,n)=>{let r;const i=WSe[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function th(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const HSe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},GSe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ZSe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},YSe={date:th({formats:HSe,defaultWidth:"full"}),time:th({formats:GSe,defaultWidth:"full"}),dateTime:th({formats:ZSe,defaultWidth:"full"})},XSe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},QSe=(e,t,n,r)=>XSe[e];function Cl(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):o;i=e.formattingValues[s]||e.formattingValues[o]}else{const o=e.defaultWidth,s=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[s]||e.values[o]}const a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}const JSe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ePe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},tPe={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"]},nPe={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"]},rPe={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"}},iPe={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"}},aPe=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},oPe={ordinalNumber:aPe,era:Cl({values:JSe,defaultWidth:"wide"}),quarter:Cl({values:ePe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Cl({values:tPe,defaultWidth:"wide"}),day:Cl({values:nPe,defaultWidth:"wide"}),dayPeriod:Cl({values:rPe,defaultWidth:"wide",formattingValues:iPe,defaultFormattingWidth:"wide"})};function Nl(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;const o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?lPe(s,m=>m.test(o)):sPe(s,m=>m.test(o));let d;d=e.valueCallback?e.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const p=t.slice(o.length);return{value:d,rest:p}}}function sPe(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function lPe(e,t){for(let n=0;n{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;const s=t.slice(i.length);return{value:o,rest:s}}}const uPe=/^(\d+)(th|st|nd|rd)?/i,cPe=/\d+/i,fPe={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},dPe={any:[/^b/i,/^(a|c)/i]},hPe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},pPe={any:[/1/i,/2/i,/3/i,/4/i]},mPe={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},gPe={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]},vPe={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},yPe={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]},bPe={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},xPe={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}},wPe={ordinalNumber:XW({matchPattern:uPe,parsePattern:cPe,valueCallback:e=>parseInt(e,10)}),era:Nl({matchPatterns:fPe,defaultMatchWidth:"wide",parsePatterns:dPe,defaultParseWidth:"any"}),quarter:Nl({matchPatterns:hPe,defaultMatchWidth:"wide",parsePatterns:pPe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Nl({matchPatterns:mPe,defaultMatchWidth:"wide",parsePatterns:gPe,defaultParseWidth:"any"}),day:Nl({matchPatterns:vPe,defaultMatchWidth:"wide",parsePatterns:yPe,defaultParseWidth:"any"}),dayPeriod:Nl({matchPatterns:bPe,defaultMatchWidth:"any",parsePatterns:xPe,defaultParseWidth:"any"})},_Pe={code:"en-US",formatDistance:KSe,formatLong:YSe,formatRelative:QSe,localize:oPe,match:wPe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function SPe(e){const t=gl(e);return FSe(t,VSe(t))+1}function PPe(e){const t=gl(e),n=+Z0(t)-+qSe(t);return Math.round(n/ZW)+1}function QW(e,t){var p,m,y,b;const n=gl(e),r=n.getFullYear(),i=vx(),a=(t==null?void 0:t.firstWeekContainsDate)??((m=(p=t==null?void 0:t.locale)==null?void 0:p.options)==null?void 0:m.firstWeekContainsDate)??i.firstWeekContainsDate??((b=(y=i.locale)==null?void 0:y.options)==null?void 0:b.firstWeekContainsDate)??1,o=sd(e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);const s=mg(o,t),c=sd(e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);const d=mg(c,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function jPe(e,t){var s,c,d,p;const n=vx(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(d=n.locale)==null?void 0:d.options)==null?void 0:p.firstWeekContainsDate)??1,i=QW(e,t),a=sd(e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),mg(a,t)}function OPe(e,t){const n=gl(e),r=+mg(n,t)-+jPe(n,t);return Math.round(r/ZW)+1}function er(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const uc={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return er(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):er(n+1,2)},d(e,t){return er(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return er(e.getHours()%12||12,t.length)},H(e,t){return er(e.getHours(),t.length)},m(e,t){return er(e.getMinutes(),t.length)},s(e,t){return er(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return er(i,t.length)}},$d={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},S$={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return uc.y(e,t)},Y:function(e,t,n,r){const i=QW(e,r),a=i>0?i:1-i;if(t==="YY"){const o=a%100;return er(o,2)}return t==="Yo"?n.ordinalNumber(a,{unit:"year"}):er(a,t.length)},R:function(e,t){const n=YW(e);return er(n,t.length)},u:function(e,t){const n=e.getFullYear();return er(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return er(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return er(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return uc.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return er(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=OPe(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):er(i,t.length)},I:function(e,t,n){const r=PPe(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):er(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):uc.d(e,t)},D:function(e,t,n){const r=SPe(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):er(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return er(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return er(a,t.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return er(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=$d.noon:r===0?i=$d.midnight:i=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=$d.evening:r>=12?i=$d.afternoon:r>=4?i=$d.morning:i=$d.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return uc.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):uc.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):er(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):er(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):uc.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):uc.s(e,t)},S:function(e,t){return uc.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return j$(r);case"XXXX":case"XX":return Pf(r);case"XXXXX":case"XXX":default:return Pf(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return j$(r);case"xxxx":case"xx":return Pf(r);case"xxxxx":case"xxx":default:return Pf(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+P$(r,":");case"OOOO":default:return"GMT"+Pf(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+P$(r,":");case"zzzz":default:return"GMT"+Pf(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return er(r,t.length)},T:function(e,t,n){const r=e.getTime();return er(r,t.length)}};function P$(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+er(a,2)}function j$(e,t){return e%60===0?(e>0?"-":"+")+er(Math.abs(e)/60,2):Pf(e,t)}function Pf(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=er(Math.trunc(r/60),2),a=er(r%60,2);return n+i+t+a}const O$=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},JW=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},TPe=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return O$(e,t);let a;switch(r){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",O$(r,t)).replace("{{time}}",JW(i,t))},EPe={p:JW,P:TPe},APe=/^D+$/,kPe=/^Y+$/,CPe=["D","DD","YY","YYYY"];function NPe(e){return APe.test(e)}function MPe(e){return kPe.test(e)}function RPe(e,t,n){const r=LPe(e,t,n);if(console.warn(r),CPe.includes(e))throw new RangeError(r)}function LPe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const IPe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,DPe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,BPe=/^'([^]*?)'?$/,$Pe=/''/g,FPe=/[a-zA-Z]/;function Uc(e,t,n){var p,m,y,b,P,x,w,T;const r=vx(),i=(n==null?void 0:n.locale)??r.locale??_Pe,a=(n==null?void 0:n.firstWeekContainsDate)??((m=(p=n==null?void 0:n.locale)==null?void 0:p.options)==null?void 0:m.firstWeekContainsDate)??r.firstWeekContainsDate??((b=(y=r.locale)==null?void 0:y.options)==null?void 0:b.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((x=(P=n==null?void 0:n.locale)==null?void 0:P.options)==null?void 0:x.weekStartsOn)??r.weekStartsOn??((T=(w=r.locale)==null?void 0:w.options)==null?void 0:T.weekStartsOn)??0,s=gl(e);if(!USe(s))throw new RangeError("Invalid time value");let c=t.match(DPe).map(E=>{const k=E[0];if(k==="p"||k==="P"){const D=EPe[k];return D(E,i.formatLong)}return E}).join("").match(IPe).map(E=>{if(E==="''")return{isToken:!1,value:"'"};const k=E[0];if(k==="'")return{isToken:!1,value:qPe(E)};if(S$[k])return{isToken:!0,value:E};if(k.match(FPe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+k+"`");return{isToken:!1,value:E}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));const d={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(E=>{if(!E.isToken)return E.value;const k=E.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&MPe(k)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&NPe(k))&&RPe(k,t,String(e));const D=S$[k[0]];return D(s,k,i.localize,d)}).join("")}function qPe(e){const t=e.match(BPe);return t?t[1].replace($Pe,"'"):e}delete Es.Icon.Default.prototype._getIconUrl;Es.Icon.Default.mergeOptions({iconRetinaUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon-2x.png",iconUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-shadow.png"});const zPe=[{name:"Kopi Arabika",category:"perkebunan"},{name:"Kopi Robusta",category:"perkebunan"},{name:"Kakao",category:"perkebunan"},{name:"Kelapa Sawit",category:"perkebunan"},{name:"Karet",category:"perkebunan"},{name:"Padi",category:"pangan"},{name:"Jagung",category:"pangan"},{name:"Kedelai",category:"pangan"},{name:"Cabai",category:"hortikultura"},{name:"Tomat",category:"hortikultura"},{name:"Bawang Merah",category:"hortikultura"},{name:"Jati",category:"kehutanan"},{name:"Sengon",category:"kehutanan"}];function UPe({center:e}){const t=dx();return M.useEffect(()=>{e&&t.flyTo(e,19)},[e,t]),null}function eK({landId:e,farmerId:t,landPolygon:n,existingPlants:r=[],onTagPlant:i,isLoading:a}){const[o,s]=M.useState(null),[c,d]=M.useState(!1),[p,m]=M.useState(null),[y,b]=M.useState(null),[P,x]=M.useState(!1),[w,T]=M.useState({commodity_name:"",plant_date:Uc(new Date,"yyyy-MM-dd"),notes:""}),E=()=>{if(!navigator.geolocation){Mt.error("GPS tidak didukung di perangkat ini");return}d(!0);const K=navigator.geolocation.watchPosition(Z=>{const{latitude:ee,longitude:ne,accuracy:oe}=Z.coords;s([ee,ne]),m(oe),d(!1)},Z=>{switch(d(!1),Z.code){case Z.PERMISSION_DENIED:Mt.error("Izin GPS ditolak. Aktifkan GPS di pengaturan.");break;case Z.POSITION_UNAVAILABLE:Mt.error("Lokasi tidak tersedia. Pastikan GPS aktif.");break;case Z.TIMEOUT:Mt.error("Waktu pencarian lokasi habis. Coba lagi.");break;default:Mt.error("Gagal mendapatkan lokasi")}},{enableHighAccuracy:!0,timeout:1e4,maximumAge:0});b(K)},k=()=>{y!==null&&(navigator.geolocation.clearWatch(y),b(null))};M.useEffect(()=>(E(),()=>k()),[]);const D=()=>{if(!o){Mt.error("Tunggu GPS menemukan lokasi Anda");return}x(!0)},I=()=>{if(!w.commodity_name){Mt.error("Pilih jenis tanaman");return}i({land_id:e,farmer_id:t,commodity_name:w.commodity_name,latitude:o[0],longitude:o[1],plant_date:w.plant_date,status:"alive",notes:w.notes,sync_status:"pending"}),x(!1),T({commodity_name:"",plant_date:Uc(new Date,"yyyy-MM-dd"),notes:""})},R=new Es.DivIcon({className:"current-location-icon",html:`
`,iconSize:[24,24],iconAnchor:[12,12]}),$=new Es.DivIcon({className:"plant-icon",html:`
🌱
`,iconSize:[28,28],iconAnchor:[14,14]}),V=(n==null?void 0:n.map(K=>[K[1],K[0]]))||[];return h.jsxs(h.Fragment,{children:[h.jsxs(Tt,{className:"border-0 shadow-sm overflow-hidden",children:[h.jsxs("div",{className:"p-4 bg-slate-50 border-b border-slate-100 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:`w-3 h-3 rounded-full ${o?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm font-medium text-slate-700",children:c?"Mencari lokasi GPS...":o?"GPS Aktif":"GPS Tidak Aktif"}),p&&h.jsxs("p",{className:"text-xs text-slate-500",children:["Akurasi: ±",p.toFixed(0)," meter"]})]})]}),h.jsxs(ur,{variant:"secondary",className:"bg-emerald-100 text-emerald-700",children:[r.length," tanaman"]})]}),h.jsxs(pt,{onClick:D,disabled:!o||a,className:"w-full bg-emerald-600 hover:bg-emerald-700 h-14 text-lg",children:[a?h.jsx(ti,{className:"w-6 h-6 mr-2 animate-spin"}):h.jsx(sa,{className:"w-6 h-6 mr-2"}),"Tag Tanaman di Lokasi Ini"]}),o&&h.jsxs("p",{className:"text-xs text-slate-500 text-center",children:["Koordinat: ",o[0].toFixed(6),", ",o[1].toFixed(6)]})]}),h.jsxs("div",{className:"h-[350px] relative",children:[h.jsxs(jk,{center:o||(V.length>0?V[0]:[-6.2,106.8]),zoom:18,className:"h-full w-full z-0",scrollWheelZoom:!0,children:[h.jsx(Ok,{attribution:'© OpenStreetMap',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),o&&h.jsx(UPe,{center:o}),V.length>=3&&h.jsx(hx,{positions:V,pathOptions:{color:"#16a34a",fillColor:"#16a34a",fillOpacity:.15,weight:2,dashArray:"5, 5"}}),o&&h.jsx(Lc,{position:o,icon:R}),r.map((K,Z)=>h.jsx(Lc,{position:[K.latitude,K.longitude],icon:$},K.id||Z))]}),h.jsx("div",{className:"absolute bottom-4 left-4 right-4 bg-white/95 backdrop-blur rounded-xl p-3 shadow-lg z-[1000]",children:h.jsxs("p",{className:"text-sm text-slate-700 text-center",children:[h.jsx("span",{className:"font-semibold",children:"Petunjuk:"})," Berdiri di dekat tanaman, lalu tekan tombol",h.jsx("span",{className:"font-semibold text-emerald-600",children:' "Tag Tanaman"'})," untuk menandai posisi."]})})]})]}),h.jsx(sl,{open:P,onOpenChange:x,children:h.jsxs(Ss,{className:"max-w-sm",children:[h.jsx(ql,{children:h.jsxs(zl,{className:"flex items-center gap-2",children:[h.jsx(sa,{className:"w-5 h-5 text-emerald-600"}),"Tag Tanaman Baru"]})}),h.jsxs("div",{className:"space-y-4 pt-2",children:[o&&h.jsxs("div",{className:"p-3 bg-slate-50 rounded-lg",children:[h.jsx("p",{className:"text-xs text-slate-500 mb-1",children:"Koordinat GPS"}),h.jsxs("p",{className:"text-sm font-mono font-medium text-slate-700",children:[o[0].toFixed(6),", ",o[1].toFixed(6)]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Jenis Tanaman *"}),h.jsxs(Hr,{value:w.commodity_name,onValueChange:K=>T(Z=>({...Z,commodity_name:K})),children:[h.jsx(Dr,{className:"h-11",children:h.jsx(Gr,{placeholder:"Pilih jenis tanaman"})}),h.jsx(Br,{children:zPe.map(K=>h.jsx(Kt,{value:K.name,children:K.name},K.name))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Tanggal Tanam"}),h.jsx(nn,{type:"date",value:w.plant_date,onChange:K=>T(Z=>({...Z,plant_date:K.target.value})),className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Catatan (Opsional)"}),h.jsx(nn,{value:w.notes,onChange:K=>T(Z=>({...Z,notes:K.target.value})),placeholder:"Contoh: Bibit dari kebun sendiri",className:"h-11"})]}),h.jsxs("div",{className:"flex gap-3 pt-2",children:[h.jsx(pt,{variant:"outline",className:"flex-1",onClick:()=>x(!1),children:"Batal"}),h.jsxs(pt,{className:"flex-1 bg-emerald-600 hover:bg-emerald-700",onClick:I,disabled:!w.commodity_name||a,children:[a&&h.jsx(ti,{className:"w-4 h-4 mr-2 animate-spin"}),"Simpan Tag"]})]})]})]})})]})}const T$={valid:{bg:"bg-emerald-50",border:"border-emerald-200",text:"text-emerald-700",icon:la},invalid:{bg:"bg-rose-50",border:"border-rose-200",text:"text-rose-700",icon:ph},need_review:{bg:"bg-amber-50",border:"border-amber-200",text:"text-amber-700",icon:ul},pending:{bg:"bg-slate-50",border:"border-slate-200",text:"text-slate-600",icon:Hf}},VPe={valid:"Tervalidasi",invalid:"Tidak Valid",need_review:"Perlu Review",pending:"Menunggu Validasi"};function WPe(){const t=new URLSearchParams(window.location.search).get("id"),n=As(),[r,i]=M.useState(!1),[a,o]=M.useState(!1),{id:s}=WF(),c=s||t,[d,p]=M.useState(null),m=(Z,ee)=>{p(ne=>({...ne,[Z]:ee}))},y=Z=>{p(ee=>({...ee,...Z})),Mt.success(`Polygon disimpan! Luas: ${Z.area_hectares.toFixed(4)} Ha`)},b=ci({mutationFn:Z=>mt.entities.Land.update(c,Z),onSuccess:()=>{n.invalidateQueries({queryKey:["lands"]}),n.invalidateQueries({queryKey:["land",c]}),Mt.success("Lahan berhasil diperbarui!"),o(!1)},onError:Z=>{console.error("Update land error:",Z),Mt.error("Gagal memperbarui lahan")}}),{data:P=[],isLoading:x,isError:w}=bn({queryKey:["land",c],queryFn:async()=>{try{const ee=await mt.entities.Land.get(c);if(ee&&!ee.error)return ee}catch{console.warn("Server unreachable, searching locally...")}const Z=await Tr.getEntities("lands",{id:c});if(Z&&Z.length>0)return{...Z[0],isOffline:!0};throw new Error("Lahan tidak ditemukan")},enabled:!!c}),{data:T}=bn({queryKey:["farmer",P==null?void 0:P.farmer_id],queryFn:async()=>{if(!(P!=null&&P.farmer_id))return null;try{return await mt.entities.Farmer.get(P.farmer_id)}catch{return(await Tr.getEntities("farmers",{id:P.farmer_id}))[0]||null}},enabled:!!(P!=null&&P.farmer_id)}),{data:E=[]}=bn({queryKey:["plants",c],queryFn:async()=>{try{const Z=await mt.entities.Plant.list({q:JSON.stringify({land_id:c})});return Array.isArray(Z)?Z:[]}catch{const ee=await Tr.getEntities("plants",{land_id:c});return Array.isArray(ee)?ee:[]}}}),{data:k=[]}=bn({queryKey:["inspections",c],queryFn:async()=>{try{const Z=await mt.entities.PlantInspection.list();return Array.isArray(Z)?Z:[]}catch{const ee=await Tr.getEntities("plant_inspections");return Array.isArray(ee)?ee:[]}}});E.filter(Z=>(Z==null?void 0:Z.status)!=="harvested");const D=M.useMemo(()=>{const Z=new Map;return k.forEach(ee=>{const ne=`${ee.farmer_id}_${ee.land_id}_${ee.plant_id}`;(!Z.has(ne)||new Date(ee.created_date)>new Date(Z.get(ne).created_date))&&Z.set(ne,ee)}),E.map(ee=>{const ne=`${ee.farmer_id}_${ee.land_id}_${ee.id}`,oe=Z.get(ne),he=(oe==null?void 0:oe.productivity_status)||ee.productivity_status||"alive";return{...ee,display_status:he.toLowerCase(),last_inspection_date:(oe==null?void 0:oe.inspection_date)||ee.plant_date,has_issue:(oe==null?void 0:oe.health_status)==="mild_issue"||(oe==null?void 0:oe.health_status)==="unhealthy"||(oe==null?void 0:oe.health_status)==="sick"}})},[E,k]),I=ci({mutationFn:Z=>mt.entities.Land.update(c,{validation_status:Z}),onSuccess:()=>{n.invalidateQueries({queryKey:["land",c]}),Mt.success("Status validasi diperbarui!")}}),R=ci({mutationFn:Z=>mt.entities.Plant.create(Z),onSuccess:()=>{n.invalidateQueries({queryKey:["plants",c]}),setShowPlantForm(!1),Mt.success("Tanaman berhasil ditambahkan!")}});console.log(D);const $=M.useMemo(()=>D?D.reduce((Z,ee)=>(ee.display_status==="alive"||ee.display_status==="productive"?Z.alive++:ee.display_status==="sick"||ee.display_status==="less_productive"||ee.has_issue?Z.sick++:(ee.display_status==="dead"||ee.display_status==="unproductive")&&Z.dead++,Z),{alive:0,sick:0,dead:0}):{alive:0,sick:0,dead:0},[D]);if(M.useEffect(()=>{P&&a&&p({id:P.id,farmer_id:P.farmer_id,name:P.name,land_status:P.land_status,village:P.village,district:P.district,regency:P.regency,polygon_coordinates:P.polygon_coordinates,center_lat:P.center_lat,center_lng:P.center_lng,area_hectares:P.area_hectares,validation_status:P.validation_status,sync_status:P.sync_status})},[P,a]),x)return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 flex items-center justify-center",children:h.jsx("div",{className:"animate-spin w-8 h-8 border-4 border-emerald-600 border-t-transparent rounded-full"})});if(!P)return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 p-6",children:h.jsxs("div",{className:"max-w-5xl mx-auto text-center py-16",children:[h.jsx("p",{className:"text-slate-500",children:"Lahan tidak ditemukan"}),h.jsx(zo,{to:ei("Lands"),children:h.jsx(pt,{variant:"outline",className:"mt-4",children:"Kembali ke Daftar"})})]})});const V=T$[P.validation_status]||T$.pending,K=V.icon;return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-6xl mx-auto p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx(zo,{to:ei("Lands"),children:h.jsx(pt,{variant:"outline",size:"icon",className:"h-10 w-10",children:h.jsx(J0,{className:"w-5 h-5"})})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:P.name}),h.jsxs("p",{className:"text-slate-500",children:[P.village,", ",P.district]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(J8,{status:P.sync_status}),h.jsxs(pt,{variant:"outline",size:"sm",onClick:()=>o(!0),children:[h.jsx(aF,{className:"w-4 h-4 mr-2"}),"Edit"]})]})]}),a&&d&&h.jsxs("form",{onSubmit:Z=>{if(Z.preventDefault(),!d.center_lat||!d.center_lng){Mt.error("Polygon lahan belum digambar");return}b.mutate({...d,id:c})},className:"space-y-6",children:[h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{className:"pb-4",children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(zf,{className:"w-5 h-5 text-emerald-600"}),"Pemilik Lahan"]})}),h.jsx(Pn,{children:h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Pilih Petani"}),h.jsxs(Hr,{value:d.farmer_id,onValueChange:Z=>m("farmer_id",Z),children:[h.jsx(Dr,{className:"h-11",children:h.jsx(Gr,{placeholder:"Cari dan pilih petani..."})}),h.jsx(Br,{children:farmers.map(Z=>h.jsxs(Kt,{value:Z.id,children:[Z.full_name," - ",Z.village,", ",Z.district]},Z.id))})]})]})})]})}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.15},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{className:"pb-4",children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(So,{className:"w-5 h-5 text-emerald-600"}),"Informasi Lahan"]})}),h.jsxs(Pn,{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Nama/Label Lahan"}),h.jsx(nn,{value:d.name,onChange:Z=>m("name",Z.target.value),placeholder:"Contoh: Kebun Kopi Utara",required:!0,className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Status Kepemilikan"}),h.jsxs(Hr,{value:d.land_status,onValueChange:Z=>m("land_status",Z),children:[h.jsx(Dr,{className:"h-11",children:h.jsx(Gr,{})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"owned",children:"Milik Sendiri"}),h.jsx(Kt,{value:"rented",children:"Sewa"}),h.jsx(Kt,{value:"shared",children:"Bagi Hasil"}),h.jsx(Kt,{value:"government",children:"Tanah Negara"})]})]})]})]}),h.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Desa"}),h.jsx(nn,{value:d.village,onChange:Z=>m("village",Z.target.value),placeholder:"Nama desa",className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Kecamatan"}),h.jsx(nn,{value:d.district,onChange:Z=>m("district",Z.target.value),placeholder:"Nama kecamatan",className:"h-11"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Kabupaten"}),h.jsx(nn,{value:d.regency,onChange:Z=>m("regency",Z.target.value),placeholder:"Nama kabupaten",className:"h-11"})]})]}),d.area_hectares&&h.jsxs("div",{className:"p-4 bg-emerald-50 rounded-lg border border-emerald-100",children:[h.jsx("p",{className:"text-sm text-emerald-600",children:"Luas Lahan Terhitung"}),h.jsxs("p",{className:"text-2xl font-bold text-emerald-700",children:[d.area_hectares.toFixed(4)," Hektar"]})]})]})]})}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:h.jsx(kk,{onSave:y})}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.25},className:"flex justify-end",children:h.jsxs(pt,{type:"submit",disabled:b.isPending||!d.farmer_id,className:"bg-emerald-600 hover:bg-emerald-700 h-11 px-8",children:[b.isPending&&h.jsx(ti,{className:"w-4 h-4 mr-2 animate-spin"}),"Daftarkan Lahan"]})})]}),!a&&h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.1},className:"space-y-6",children:[h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsxs(Pn,{className:"p-6 space-y-4",children:[h.jsxs("div",{className:`flex items-center gap-3 p-3 rounded-lg ${V.bg} ${V.border} border`,children:[h.jsx(K,{className:`w-5 h-5 ${V.text}`}),h.jsx("span",{className:`font-medium ${V.text}`,children:VPe[P.validation_status]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[h.jsx(eF,{className:"w-5 h-5 text-slate-400"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Luas Lahan"}),h.jsx("p",{className:"font-semibold text-slate-900",children:P.area_hectares?`${P.area_hectares.toFixed(2)} Hektar`:"-"})]})]}),h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[h.jsx(So,{className:"w-5 h-5 text-slate-400"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Lokasi"}),h.jsxs("p",{className:"font-medium text-slate-900",children:[P.village,", ",P.district,h.jsx("br",{}),P.regency]})]})]}),T&&h.jsx(zo,{to:ei("FarmerDetail")+`?id=${T.id}`,children:h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg hover:bg-slate-100 transition-colors cursor-pointer",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-emerald-100 flex items-center justify-center",children:h.jsx(zf,{className:"w-5 h-5 text-emerald-600"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Pemilik"}),h.jsx("p",{className:"font-medium text-slate-900",children:T.full_name})]})]})})]}),(P.validation_status==="pending"||P.validation_status==="need_review")&&h.jsxs("div",{className:"pt-4 border-t border-slate-100 space-y-2",children:[h.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Tindakan Validasi"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(pt,{className:"flex-1 bg-emerald-600 hover:bg-emerald-700",size:"sm",onClick:()=>I.mutate("valid"),disabled:I.isPending,children:[h.jsx(la,{className:"w-4 h-4 mr-1"}),"Valid"]}),h.jsxs(pt,{variant:"destructive",className:"flex-1",size:"sm",onClick:()=>I.mutate("invalid"),disabled:I.isPending,children:[h.jsx(ph,{className:"w-4 h-4 mr-1"}),"Invalid"]})]})]})]})}),h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsxs(Ti,{className:"flex flex-row items-center justify-between pb-2",children:[h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(sa,{className:"w-5 h-5 text-emerald-600"}),"Tanaman"]}),h.jsxs(pt,{size:"sm",variant:"outline",onClick:()=>i(!0),children:[h.jsx(Dc,{className:"w-4 h-4 mr-1"}),"Tag via GPS"]})]}),h.jsxs(Pn,{children:[h.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[h.jsxs("div",{className:"text-center p-3 bg-emerald-50 rounded-lg",children:[h.jsx("p",{className:"text-2xl font-bold text-emerald-600",children:$.alive}),h.jsx("p",{className:"text-xs text-emerald-600",children:"Hidup"})]}),h.jsxs("div",{className:"text-center p-3 bg-amber-50 rounded-lg",children:[h.jsx("p",{className:"text-2xl font-bold text-amber-600",children:$.sick}),h.jsx("p",{className:"text-xs text-amber-600",children:"Sakit"})]}),h.jsxs("div",{className:"text-center p-3 bg-slate-100 rounded-lg",children:[h.jsx("p",{className:"text-2xl font-bold text-slate-500",children:$.dead}),h.jsx("p",{className:"text-xs text-slate-500",children:"Mati"})]})]}),D.length>0?h.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:D.map(Z=>h.jsxs("div",{className:"flex items-center justify-between p-2 bg-slate-50 rounded-lg",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:`w-2 h-2 rounded-full ${Z.productivity_status==="productive"||Z.display_status==="alive"?"bg-emerald-500":Z.display_status==="less_productive"?"bg-amber-500":"bg-rose-500"}`}),h.jsx("span",{className:"text-sm font-medium",children:Z.commodity_name})]}),h.jsx("span",{className:"text-xs text-slate-500",children:Z.plant_date})]},Z.id))}):h.jsx("p",{className:"text-center text-slate-500 text-sm py-4",children:"Belum ada tanaman"})]})]})]}),h.jsx(Rt.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{delay:.2},className:"lg:col-span-2",children:r?h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{className:"font-semibold text-slate-900",children:"Tag Tanaman dengan GPS"}),h.jsx(pt,{variant:"outline",size:"sm",onClick:()=>i(!1),children:"Tutup"})]}),h.jsx(eK,{landId:c,farmerId:P.farmer_id,landPolygon:P.polygon_coordinates,existingPlants:E,onTagPlant:R.mutate,isLoading:R.isPending})]}):h.jsx(Tk,{center:[P.center_lat||-6.2,P.center_lng||106.8],zoom:16,lands:[P],plants:E,readOnly:!0})})]})]})})}var yx="Switch",[KPe]=gd(yx),[HPe,GPe]=KPe(yx),tK=M.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c="on",onCheckedChange:d,form:p,...m}=e,[y,b]=M.useState(null),P=Er(t,k=>b(k)),x=M.useRef(!1),w=y?p||!!y.closest("form"):!0,[T,E]=Zh({prop:i,defaultProp:a??!1,onChange:d,caller:yx});return h.jsxs(HPe,{scope:n,checked:T,disabled:s,children:[h.jsx(Dn.button,{type:"button",role:"switch","aria-checked":T,"aria-required":o,"data-state":aK(T),"data-disabled":s?"":void 0,disabled:s,value:c,...m,ref:P,onClick:Mn(e.onClick,k=>{E(D=>!D),w&&(x.current=k.isPropagationStopped(),x.current||k.stopPropagation())})}),w&&h.jsx(iK,{control:y,bubbles:!x.current,name:r,value:c,checked:T,required:o,disabled:s,form:p,style:{transform:"translateX(-100%)"}})]})});tK.displayName=yx;var nK="SwitchThumb",rK=M.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=GPe(nK,n);return h.jsx(Dn.span,{"data-state":aK(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});rK.displayName=nK;var ZPe="SwitchBubbleInput",iK=M.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{const o=M.useRef(null),s=Er(o,a),c=t8(n),d=VV(t);return M.useEffect(()=>{const p=o.current;if(!p)return;const m=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&b){const P=new Event("click",{bubbles:r});b.call(p,n),p.dispatchEvent(P)}},[c,n,r]),h.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});iK.displayName=ZPe;function aK(e){return e?"checked":"unchecked"}var oK=tK,YPe=rK;const Rk=M.forwardRef(({className:e,...t},n)=>h.jsx(oK,{className:fn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:h.jsx(YPe,{className:fn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Rk.displayName=oK.displayName;const XPe={lessThanXSeconds:{one:"kurang dari 1 detik",other:"kurang dari {{count}} detik"},xSeconds:{one:"1 detik",other:"{{count}} detik"},halfAMinute:"setengah menit",lessThanXMinutes:{one:"kurang dari 1 menit",other:"kurang dari {{count}} menit"},xMinutes:{one:"1 menit",other:"{{count}} menit"},aboutXHours:{one:"sekitar 1 jam",other:"sekitar {{count}} jam"},xHours:{one:"1 jam",other:"{{count}} jam"},xDays:{one:"1 hari",other:"{{count}} hari"},aboutXWeeks:{one:"sekitar 1 minggu",other:"sekitar {{count}} minggu"},xWeeks:{one:"1 minggu",other:"{{count}} minggu"},aboutXMonths:{one:"sekitar 1 bulan",other:"sekitar {{count}} bulan"},xMonths:{one:"1 bulan",other:"{{count}} bulan"},aboutXYears:{one:"sekitar 1 tahun",other:"sekitar {{count}} tahun"},xYears:{one:"1 tahun",other:"{{count}} tahun"},overXYears:{one:"lebih dari 1 tahun",other:"lebih dari {{count}} tahun"},almostXYears:{one:"hampir 1 tahun",other:"hampir {{count}} tahun"}},QPe=(e,t,n)=>{let r;const i=XPe[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"dalam waktu "+r:r+" yang lalu":r},JPe={full:"EEEE, d MMMM yyyy",long:"d MMMM yyyy",medium:"d MMM yyyy",short:"d/M/yyyy"},eje={full:"HH.mm.ss",long:"HH.mm.ss",medium:"HH.mm",short:"HH.mm"},tje={full:"{{date}} 'pukul' {{time}}",long:"{{date}} 'pukul' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},nje={date:th({formats:JPe,defaultWidth:"full"}),time:th({formats:eje,defaultWidth:"full"}),dateTime:th({formats:tje,defaultWidth:"full"})},rje={lastWeek:"eeee 'lalu pukul' p",yesterday:"'Kemarin pukul' p",today:"'Hari ini pukul' p",tomorrow:"'Besok pukul' p",nextWeek:"eeee 'pukul' p",other:"P"},ije=(e,t,n,r)=>rje[e],aje={narrow:["SM","M"],abbreviated:["SM","M"],wide:["Sebelum Masehi","Masehi"]},oje={narrow:["1","2","3","4"],abbreviated:["K1","K2","K3","K4"],wide:["Kuartal ke-1","Kuartal ke-2","Kuartal ke-3","Kuartal ke-4"]},sje={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agt","Sep","Okt","Nov","Des"],wide:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"]},lje={narrow:["M","S","S","R","K","J","S"],short:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],abbreviated:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],wide:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},uje={narrow:{am:"AM",pm:"PM",midnight:"tengah malam",noon:"tengah hari",morning:"pagi",afternoon:"siang",evening:"sore",night:"malam"},abbreviated:{am:"AM",pm:"PM",midnight:"tengah malam",noon:"tengah hari",morning:"pagi",afternoon:"siang",evening:"sore",night:"malam"},wide:{am:"AM",pm:"PM",midnight:"tengah malam",noon:"tengah hari",morning:"pagi",afternoon:"siang",evening:"sore",night:"malam"}},cje={narrow:{am:"AM",pm:"PM",midnight:"tengah malam",noon:"tengah hari",morning:"pagi",afternoon:"siang",evening:"sore",night:"malam"},abbreviated:{am:"AM",pm:"PM",midnight:"tengah malam",noon:"tengah hari",morning:"pagi",afternoon:"siang",evening:"sore",night:"malam"},wide:{am:"AM",pm:"PM",midnight:"tengah malam",noon:"tengah hari",morning:"pagi",afternoon:"siang",evening:"sore",night:"malam"}},fje=(e,t)=>"ke-"+Number(e),dje={ordinalNumber:fje,era:Cl({values:aje,defaultWidth:"wide"}),quarter:Cl({values:oje,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Cl({values:sje,defaultWidth:"wide"}),day:Cl({values:lje,defaultWidth:"wide"}),dayPeriod:Cl({values:uje,defaultWidth:"wide",formattingValues:cje,defaultFormattingWidth:"wide"})},hje=/^ke-(\d+)?/i,pje=/\d+/i,mje={narrow:/^(sm|m)/i,abbreviated:/^(s\.?\s?m\.?|s\.?\s?e\.?\s?u\.?|m\.?|e\.?\s?u\.?)/i,wide:/^(sebelum masehi|sebelum era umum|masehi|era umum)/i},gje={any:[/^s/i,/^(m|e)/i]},vje={narrow:/^[1234]/i,abbreviated:/^K-?\s[1234]/i,wide:/^Kuartal ke-?\s?[1234]/i},yje={any:[/1/i,/2/i,/3/i,/4/i]},bje={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|mei|jun|jul|agt|sep|okt|nov|des)/i,wide:/^(januari|februari|maret|april|mei|juni|juli|agustus|september|oktober|november|desember)/i},xje={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,/^ma/i,/^ap/i,/^me/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},wje={narrow:/^[srkjm]/i,short:/^(min|sen|sel|rab|kam|jum|sab)/i,abbreviated:/^(min|sen|sel|rab|kam|jum|sab)/i,wide:/^(minggu|senin|selasa|rabu|kamis|jumat|sabtu)/i},_je={narrow:[/^m/i,/^s/i,/^s/i,/^r/i,/^k/i,/^j/i,/^s/i],any:[/^m/i,/^sen/i,/^sel/i,/^r/i,/^k/i,/^j/i,/^sa/i]},Sje={narrow:/^(a|p|tengah m|tengah h|(di(\swaktu)?) (pagi|siang|sore|malam))/i,any:/^([ap]\.?\s?m\.?|tengah malam|tengah hari|(di(\swaktu)?) (pagi|siang|sore|malam))/i},Pje={any:{am:/^a/i,pm:/^pm/i,midnight:/^tengah m/i,noon:/^tengah h/i,morning:/pagi/i,afternoon:/siang/i,evening:/sore/i,night:/malam/i}},jje={ordinalNumber:XW({matchPattern:hje,parsePattern:pje,valueCallback:e=>parseInt(e,10)}),era:Nl({matchPatterns:mje,defaultMatchWidth:"wide",parsePatterns:gje,defaultParseWidth:"any"}),quarter:Nl({matchPatterns:vje,defaultMatchWidth:"wide",parsePatterns:yje,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Nl({matchPatterns:bje,defaultMatchWidth:"wide",parsePatterns:xje,defaultParseWidth:"any"}),day:Nl({matchPatterns:wje,defaultMatchWidth:"wide",parsePatterns:_je,defaultParseWidth:"any"}),dayPeriod:Nl({matchPatterns:Sje,defaultMatchWidth:"any",parsePatterns:Pje,defaultParseWidth:"any"})},gg={code:"id",formatDistance:QPe,formatLong:nje,formatRelative:ije,localize:dje,match:jje,options:{weekStartsOn:1,firstWeekContainsDate:1}},Oje={kepala_desa:"Kepala Desa",kepala_dusun:"Kepala Dusun",rt:"Ketua RT",rw:"Ketua RW"};function Tje(){const e=As(),[t,n]=M.useState(!1),[r,i]=M.useState({user_email:"",full_name:"",role:"kepala_desa",village:"",district:"",regency:"",province:"",phone:"",is_active:!0}),{data:a=[]}=bn({queryKey:["provinces"],queryFn:()=>{try{const b=mt.entities.Province.list();return Array.isArray(b)?b:[]}catch{return[]}}}),{data:o=[],isLoading:s,error:c}=bn({queryKey:["validators"],queryFn:()=>{try{const b=mt.entities.Validator.list();return Array.isArray(b)?b:[]}catch{return[]}}}),d=(b,P)=>{i(x=>({...x,[b]:P}))};if(c)return h.jsx("div",{className:"p-6 text-red-600",children:"Gagal memuat validator (offline mock belum siap)"});const p=ci({mutationFn:b=>mt.entities.Validator.create(b),onSuccess:()=>{e.invalidateQueries({queryKey:["validators"]}),n(!1),i({user_email:"",full_name:"",role:"kepala_desa",village:"",district:"",regency:"",phone:"",is_active:!0}),Mt.success("Validator berhasil ditambahkan!")}}),m=ci({mutationFn:({id:b,is_active:P})=>mt.entities.Validator.update(b,{is_active:P}),onSuccess:()=>{e.invalidateQueries({queryKey:["validators"]}),Mt.success("Status validator diperbarui")}}),y=ci({mutationFn:b=>mt.entities.Validator.delete(b),onSuccess:()=>{e.invalidateQueries({queryKey:["validators"]}),Mt.success("Validator dihapus")}});return h.jsxs("div",{className:"p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Validator Lahan"}),h.jsx("p",{className:"text-slate-500",children:"Kelola validator untuk verifikasi lahan"})]}),h.jsxs(sl,{open:t,onOpenChange:n,children:[h.jsx(HW,{asChild:!0,children:h.jsxs(pt,{className:"bg-blue-600 hover:bg-blue-700",children:[h.jsx(Dc,{className:"w-4 h-4 mr-2"}),"Tambah Validator"]})}),h.jsxs(Ss,{children:[h.jsx(ql,{children:h.jsx(zl,{children:"Tambah Validator Baru"})}),h.jsxs("div",{className:"space-y-4 pt-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Email *"}),h.jsx(nn,{type:"email",value:r.user_email,onChange:b=>i(P=>({...P,user_email:b.target.value})),placeholder:"email@example.com"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Nama Lengkap *"}),h.jsx(nn,{value:r.full_name,onChange:b=>i(P=>({...P,full_name:b.target.value})),placeholder:"Nama lengkap"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Jabatan *"}),h.jsxs(Hr,{value:r.role,onValueChange:b=>i(P=>({...P,role:b})),children:[h.jsx(Dr,{children:h.jsx(Gr,{})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"kepala_desa",children:"Kepala Desa"}),h.jsx(Kt,{value:"kepala_dusun",children:"Kepala Dusun"}),h.jsx(Kt,{value:"rt",children:"Ketua RT"}),h.jsx(Kt,{value:"rw",children:"Ketua RW"})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Telepon"}),h.jsx(nn,{value:r.phone,onChange:b=>i(P=>({...P,phone:b.target.value})),placeholder:"08xxx"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Desa *"}),h.jsx(nn,{value:r.village,onChange:b=>i(P=>({...P,village:b.target.value})),placeholder:"Nama desa"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Kecamatan"}),h.jsx(nn,{value:r.district,onChange:b=>i(P=>({...P,district:b.target.value})),placeholder:"Kecamatan"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Kabupaten"}),h.jsx(nn,{value:r.regency,onChange:b=>i(P=>({...P,regency:b.target.value})),placeholder:"Kabupaten"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Provinsi"}),h.jsxs(Hr,{value:r.province,onValueChange:b=>d("province",b),children:[h.jsx(Dr,{children:h.jsx(Gr,{placeholder:"Pilih provinsi"})}),h.jsx(Br,{children:a.map(b=>h.jsx(Kt,{value:b.id,children:b.nama},b.id))})]})]})]}),h.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[h.jsx(pt,{variant:"outline",onClick:()=>n(!1),children:"Batal"}),h.jsxs(pt,{onClick:()=>p.mutate(r),disabled:!r.user_email||!r.full_name||!r.village||p.isPending,className:"bg-blue-600 hover:bg-blue-700",children:[p.isPending&&h.jsx(ti,{className:"w-4 h-4 mr-2 animate-spin"}),"Simpan"]})]})]})]})]})]}),s?h.jsx("div",{className:"flex justify-center py-12",children:h.jsx(ti,{className:"w-8 h-8 animate-spin text-blue-600"})}):o.length>0?h.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(b=>{var P;return h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsxs(Pn,{className:"p-4",children:[h.jsxs("div",{className:"flex items-start justify-between mb-3",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center",children:h.jsx(gh,{className:"w-5 h-5 text-blue-600"})}),h.jsxs("div",{children:[h.jsx("p",{className:"font-semibold text-slate-900",children:b.full_name}),h.jsx(ur,{className:"bg-blue-100 text-blue-700 text-xs",children:Oje[b.role]})]})]}),h.jsx(Rk,{checked:b.is_active,onCheckedChange:x=>m.mutate({id:b.id,is_active:x})})]}),h.jsxs("div",{className:"space-y-2 text-sm text-slate-600",children:[h.jsxs("p",{className:"flex items-center gap-2",children:[h.jsx(So,{className:"w-4 h-4"}),b.village,", ",b.district,", ",b.regency,",",(P=a.find(x=>x.id===b.province))==null?void 0:P.nama]}),b.phone&&h.jsxs("p",{className:"flex items-center gap-2",children:[h.jsx(Yh,{className:"w-4 h-4"})," ",b.phone]}),h.jsx("p",{className:"text-xs text-slate-400",children:b.user_email})]}),h.jsxs(pt,{variant:"ghost",size:"sm",className:"w-full mt-3 text-red-600 hover:bg-red-50",onClick:()=>y.mutate(b.id),children:[h.jsx(nb,{className:"w-4 h-4 mr-2"}),"Hapus"]})]})},b.id)})}):h.jsx(Qa,{icon:gh,title:"Belum ada validator",description:"Tambahkan validator untuk memverifikasi lahan di wilayah tertentu",action:()=>n(!0),actionLabel:"Tambah Validator"})]})}const Ic=M.forwardRef(({className:e,...t},n)=>h.jsx("textarea",{className:fn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));Ic.displayName="Textarea";const Eje={kepala_desa:"Kepala Desa",kepala_dusun:"Kepala Dusun",rt:"Ketua RT",rw:"Ketua RW"},yj={pending:{bg:"bg-amber-100",text:"text-amber-700",label:"Menunggu Validasi"},valid:{bg:"bg-emerald-100",text:"text-emerald-700",label:"Valid"},invalid:{bg:"bg-red-100",text:"text-red-700",label:"Tidak Valid"},need_review:{bg:"bg-blue-100",text:"text-blue-700",label:"Perlu Review"}};function Aje(){var k;const e=As(),[t,n]=M.useState(null),[r,i]=M.useState(null),[a,o]=M.useState(!0),[s,c]=M.useState(null),[d,p]=M.useState("");M.useEffect(()=>{(async()=>{try{const I=await mt.auth.me();n(I);const R=await mt.entities.Validator.filter({user_email:I.email});R.length>0&&R[0].is_active&&i(R[0])}catch{}finally{o(!1)}})()},[]);const{data:m=[]}=bn({queryKey:["validator-lands",r==null?void 0:r.village],queryFn:()=>mt.entities.Land.filter({village:r.village}),enabled:!!(r!=null&&r.village)}),{data:y=[]}=bn({queryKey:["farmers"],queryFn:()=>mt.entities.Farmer.list(),enabled:!!r}),{data:b=[]}=bn({queryKey:["validations",r==null?void 0:r.id],queryFn:()=>mt.entities.LandValidation.filter({validator_email:r.user_email}),enabled:!!r}),P=ci({mutationFn:async({landId:D,status:I})=>{const R=I==="approved"?"valid":"invalid";await mt.entities.Land.update(D,{validation_status:R,validation_notes:d}),await mt.entities.LandValidation.create({land_id:D,validator_role:r.role,validator_name:r.full_name,validator_email:r.user_email,status:I,notes:d,validated_at:new Date().toISOString()})},onSuccess:()=>{e.invalidateQueries({queryKey:["validator-lands"]}),e.invalidateQueries({queryKey:["validations"]}),c(null),p(""),Mt.success("Validasi berhasil disimpan!")}}),x=()=>{mt.auth.redirectToLogin(window.location.href)},w=()=>{mt.auth.logout()},T=D=>{const I=y.find(R=>R.id===D);return(I==null?void 0:I.full_name)||"Tidak diketahui"},E=m.filter(D=>D.validation_status==="pending"||D.validation_status==="need_review");return m.filter(D=>D.validation_status==="valid"||D.validation_status==="invalid"),a?h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-slate-100 flex items-center justify-center",children:h.jsx(ti,{className:"w-8 h-8 animate-spin text-blue-600"})}):t?r?h.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-slate-100",children:[h.jsxs("div",{className:"max-w-4xl mx-auto p-4 md:p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("div",{className:"w-14 h-14 rounded-full bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center shadow-lg",children:h.jsx(gh,{className:"w-7 h-7 text-white"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-slate-900",children:r.full_name}),h.jsxs(ur,{className:"bg-blue-100 text-blue-700 border-blue-200",children:[Eje[r.role]," - ",r.village]})]})]}),h.jsx(pt,{variant:"outline",size:"sm",onClick:w,children:h.jsx(mh,{className:"w-4 h-4"})})]}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"grid grid-cols-3 gap-3",children:[h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(Hf,{className:"w-6 h-6 mx-auto text-amber-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:E.length}),h.jsx("p",{className:"text-xs text-slate-500",children:"Perlu Validasi"})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(la,{className:"w-6 h-6 mx-auto text-emerald-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:b.filter(D=>D.status==="approved").length}),h.jsx("p",{className:"text-xs text-slate-500",children:"Disetujui"})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(ph,{className:"w-6 h-6 mx-auto text-red-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:b.filter(D=>D.status==="rejected").length}),h.jsx("p",{className:"text-xs text-slate-500",children:"Ditolak"})]})]}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:h.jsxs(Ak,{defaultValue:"pending",className:"space-y-4",children:[h.jsxs(mx,{className:"w-full bg-white shadow-sm p-1 h-auto",children:[h.jsxs(al,{value:"pending",className:"flex-1 py-3 data-[state=active]:bg-blue-50 data-[state=active]:text-blue-700",children:[h.jsx(Hf,{className:"w-4 h-4 mr-2"}),"Perlu Validasi (",E.length,")"]}),h.jsxs(al,{value:"history",className:"flex-1 py-3 data-[state=active]:bg-blue-50 data-[state=active]:text-blue-700",children:[h.jsx(AN,{className:"w-4 h-4 mr-2"}),"Riwayat"]})]}),h.jsx(ol,{value:"pending",className:"space-y-4",children:E.length>0?h.jsx("div",{className:"grid gap-4",children:E.map(D=>{var I,R,$,V;return h.jsx(Tt,{className:"border-0 shadow-sm overflow-hidden",children:h.jsxs(Pn,{className:"p-4",children:[h.jsxs("div",{className:"flex items-start justify-between mb-3",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"font-semibold text-slate-900",children:D.name}),h.jsxs("p",{className:"text-sm text-slate-500",children:["Pemilik: ",T(D.farmer_id)]})]}),h.jsx(ur,{className:`${(I=yj[D.validation_status])==null?void 0:I.bg} ${(R=yj[D.validation_status])==null?void 0:R.text}`,children:($=yj[D.validation_status])==null?void 0:$.label})]}),h.jsxs("div",{className:"flex items-center gap-4 text-sm text-slate-600 mb-4",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(So,{className:"w-4 h-4"}),D.village,", ",D.district]}),h.jsxs("span",{children:[(V=D.area_hectares)==null?void 0:V.toFixed(2)," Ha"]})]}),h.jsx(pt,{className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>c(D),children:"Validasi Lahan"})]})},D.id)})}):h.jsx(Qa,{icon:la,title:"Semua lahan sudah divalidasi",description:"Tidak ada lahan yang perlu divalidasi saat ini"})}),h.jsx(ol,{value:"history",className:"space-y-4",children:b.length>0?h.jsx("div",{className:"grid gap-3",children:b.map(D=>{const I=m.find(R=>R.id===D.land_id);return h.jsxs(Tt,{className:"border-0 shadow-sm p-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-medium text-slate-900",children:(I==null?void 0:I.name)||"Lahan"}),h.jsx("p",{className:"text-sm text-slate-500",children:D.validated_at?Uc(new Date(D.validated_at),"dd MMM yyyy, HH:mm",{locale:gg}):"-"})]}),h.jsx(ur,{className:D.status==="approved"?"bg-emerald-100 text-emerald-700":"bg-red-100 text-red-700",children:D.status==="approved"?"Disetujui":"Ditolak"})]}),D.notes&&h.jsx("p",{className:"text-sm text-slate-600 mt-2 bg-slate-50 p-2 rounded",children:D.notes})]},D.id)})}):h.jsx(Qa,{icon:AN,title:"Belum ada riwayat",description:"Riwayat validasi akan muncul di sini"})})]})})]}),h.jsx(sl,{open:!!s,onOpenChange:()=>c(null),children:h.jsxs(Ss,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[h.jsx(ql,{children:h.jsxs(zl,{children:["Validasi Lahan: ",s==null?void 0:s.name]})}),s&&h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[h.jsxs("div",{className:"p-3 bg-slate-50 rounded-lg",children:[h.jsx("p",{className:"text-slate-500",children:"Pemilik"}),h.jsx("p",{className:"font-medium",children:T(s.farmer_id)})]}),h.jsxs("div",{className:"p-3 bg-slate-50 rounded-lg",children:[h.jsx("p",{className:"text-slate-500",children:"Luas"}),h.jsxs("p",{className:"font-medium",children:[(k=s.area_hectares)==null?void 0:k.toFixed(4)," Ha"]})]}),h.jsxs("div",{className:"p-3 bg-slate-50 rounded-lg col-span-2",children:[h.jsx("p",{className:"text-slate-500",children:"Lokasi"}),h.jsxs("p",{className:"font-medium",children:[s.village,", ",s.district,", ",s.regency]})]})]}),h.jsx("div",{className:"h-[300px] rounded-lg overflow-hidden",children:h.jsx(Tk,{center:[s.center_lat||-6.2,s.center_lng||106.8],zoom:17,lands:[s],readOnly:!0})}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-sm font-medium text-slate-700",children:"Catatan Validasi"}),h.jsx(Ic,{value:d,onChange:D=>p(D.target.value),placeholder:"Tambahkan catatan validasi (opsional)",rows:3})]}),h.jsxs("div",{className:"flex gap-3 pt-2",children:[h.jsxs(pt,{variant:"outline",className:"flex-1 h-12 border-red-200 text-red-600 hover:bg-red-50",onClick:()=>P.mutate({landId:s.id,status:"rejected"}),disabled:P.isPending,children:[h.jsx(ph,{className:"w-5 h-5 mr-2"}),"Tolak"]}),h.jsxs(pt,{className:"flex-1 h-12 bg-emerald-600 hover:bg-emerald-700",onClick:()=>P.mutate({landId:s.id,status:"approved"}),disabled:P.isPending,children:[P.isPending?h.jsx(ti,{className:"w-5 h-5 mr-2 animate-spin"}):h.jsx(la,{className:"w-5 h-5 mr-2"}),"Setujui"]})]})]})]})})]}):h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-slate-100 flex items-center justify-center p-6",children:h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:h.jsx(Tt,{className:"border-0 shadow-xl max-w-md w-full",children:h.jsxs(Pn,{className:"p-8 text-center",children:[h.jsx("div",{className:"w-20 h-20 rounded-full bg-amber-100 flex items-center justify-center mx-auto mb-6",children:h.jsx(ul,{className:"w-10 h-10 text-amber-600"})}),h.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Akses Ditolak"}),h.jsxs("p",{className:"text-slate-500 mb-4",children:["Email ",h.jsx("span",{className:"font-medium",children:t.email})," tidak terdaftar sebagai validator."]}),h.jsx("p",{className:"text-sm text-slate-400 mb-8",children:"Hubungi admin untuk mendaftarkan Anda sebagai validator wilayah."}),h.jsxs(pt,{variant:"outline",onClick:w,className:"w-full h-12",children:[h.jsx(mh,{className:"w-5 h-5 mr-2"}),"Keluar"]})]})})})}):h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 to-slate-100 flex items-center justify-center p-6",children:h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:h.jsx(Tt,{className:"border-0 shadow-xl max-w-md w-full",children:h.jsxs(Pn,{className:"p-8 text-center",children:[h.jsx("div",{className:"w-20 h-20 rounded-full bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center mx-auto mb-6",children:h.jsx(gh,{className:"w-10 h-10 text-white"})}),h.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Portal Validator"}),h.jsx("p",{className:"text-slate-500 mb-8",children:"Masuk untuk memvalidasi lahan di wilayah Anda"}),h.jsx(pt,{onClick:x,className:"w-full h-12 bg-blue-600 hover:bg-blue-700 text-lg",children:"Masuk"})]})})})})}const kje={alive:"bg-emerald-100 text-emerald-700 border-emerald-200",sick:"bg-amber-100 text-amber-700 border-amber-200",dead:"bg-slate-100 text-slate-600 border-slate-200",harvested:"bg-blue-100 text-blue-700 border-blue-200"},Cje={alive:"Hidup",sick:"Sakit",dead:"Mati",harvested:"Dipanen"};function Nje(){const[e,t]=M.useState(""),[n,r]=M.useState("all"),[i,a]=M.useState("all"),{data:o=[],isLoading:s}=bn({queryKey:["plants"],queryFn:()=>mt.entities.Plant.list("-created_date")}),{data:c=[]}=bn({queryKey:["lands"],queryFn:()=>mt.entities.Land.list()}),{data:d=[]}=bn({queryKey:["farmers"],queryFn:()=>mt.entities.Farmer.list()}),p=Array.isArray(c)?c:[],m=Array.isArray(d)?d:[],y=Array.isArray(o)?o:[],b=M.useMemo(()=>{const E={};return p.forEach(k=>{k!=null&&k.id&&(E[k.id]=k)}),E},[p]),P=M.useMemo(()=>{const E={};return m.forEach(k=>{k!=null&&k.id&&(E[k.id]=k.full_name)}),E},[m]),x=M.useMemo(()=>[...new Set(y.map(E=>E.commodity_name).filter(Boolean))],[y]),w=M.useMemo(()=>{const E=e.toLowerCase();return y.filter(k=>{var $,V,K,Z;if(!k)return!1;const D=!e||(($=k.commodity_name)==null?void 0:$.toLowerCase().includes(E))||((K=(V=b[k.land_id])==null?void 0:V.name)==null?void 0:K.toLowerCase().includes(E))||((Z=P[k.farmer_id])==null?void 0:Z.toLowerCase().includes(E)),I=n==="all"||k.status===n,R=i==="all"||k.commodity_name===i;return D&&I&&R})},[y,e,n,i,b,P]),T=M.useMemo(()=>{const E={};return w.forEach(k=>{const D=k.commodity_name||"Lainnya";E[D]||(E[D]=[]),E[D].push(k)}),E},[w]);return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[h.jsx(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:h.jsxs("div",{children:[h.jsx("h1",{className:"text-3xl font-bold text-slate-900",children:"Daftar Tanaman"}),h.jsxs("p",{className:"text-slate-500",children:[y.length," tanaman terdaftar"]})]})}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[h.jsx(Tt,{className:"border-0 shadow-sm p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-100 flex items-center justify-center",children:h.jsx("div",{className:"w-3 h-3 rounded-full bg-emerald-500"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:y.filter(E=>E.status==="alive").length}),h.jsx("p",{className:"text-sm text-slate-500",children:"Hidup"})]})]})}),h.jsx(Tt,{className:"border-0 shadow-sm p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-100 flex items-center justify-center",children:h.jsx("div",{className:"w-3 h-3 rounded-full bg-amber-500"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:y.filter(E=>E.status==="sick"||E.productivity_status==="less_productive").length}),h.jsx("p",{className:"text-sm text-slate-500",children:"Sakit"})]})]})}),h.jsx(Tt,{className:"border-0 shadow-sm p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-100 flex items-center justify-center",children:h.jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:y.filter(E=>E.status==="harvested").length}),h.jsx("p",{className:"text-sm text-slate-500",children:"Dipanen"})]})]})}),h.jsx(Tt,{className:"border-0 shadow-sm p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-10 h-10 rounded-xl bg-slate-100 flex items-center justify-center",children:h.jsx("div",{className:"w-3 h-3 rounded-full bg-slate-400"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:y.filter(E=>E.status==="dead").length}),h.jsx("p",{className:"text-sm text-slate-500",children:"Mati"})]})]})})]}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.15},className:"flex flex-col md:flex-row gap-3",children:[h.jsxs("div",{className:"relative flex-1",children:[h.jsx(tE,{className:"w-5 h-5 absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),h.jsx(nn,{placeholder:"Cari komoditas, lahan, atau petani...",value:e,onChange:E=>t(E.target.value),className:"h-11 pl-11 bg-white border-0 shadow-sm"})]}),h.jsxs(Hr,{value:n,onValueChange:r,children:[h.jsxs(Dr,{className:"w-full md:w-40 h-11 bg-white border-0 shadow-sm",children:[h.jsx(eE,{className:"w-4 h-4 mr-2 text-slate-400"}),h.jsx(Gr,{placeholder:"Status"})]}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"all",children:"Semua Status"}),h.jsx(Kt,{value:"alive",children:"Hidup"}),h.jsx(Kt,{value:"sick",children:"Sakit"}),h.jsx(Kt,{value:"harvested",children:"Dipanen"}),h.jsx(Kt,{value:"dead",children:"Mati"})]})]}),h.jsxs(Hr,{value:i,onValueChange:a,children:[h.jsx(Dr,{className:"w-full md:w-48 h-11 bg-white border-0 shadow-sm",children:h.jsx(Gr,{placeholder:"Komoditas"})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"all",children:"Semua Komoditas"}),x.map(E=>h.jsx(Kt,{value:E,children:E},E))]})]})]}),s?h.jsx("div",{className:"space-y-4",children:[1,2,3].map(E=>h.jsx("div",{className:"h-24 bg-white rounded-xl animate-pulse"},E))}):w.length>0?h.jsx(Rt.div,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:"space-y-6",children:Object.entries(T).map(([E,k])=>h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[h.jsx("div",{className:"w-8 h-8 rounded-lg bg-emerald-100 flex items-center justify-center",children:h.jsx(sa,{className:"w-4 h-4 text-emerald-600"})}),h.jsx("h3",{className:"font-semibold text-slate-900",children:E}),h.jsx(ur,{variant:"secondary",className:"bg-slate-100 text-slate-600",children:k.length})]}),h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:k.map((D,I)=>{const R=b[D.land_id];return h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:I*.03},children:h.jsxs(Tt,{className:"border-0 shadow-sm hover:shadow-md transition-all p-4 bg-white group",children:[h.jsx("div",{className:"flex items-start justify-between mb-3",children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:`w-2 h-2 rounded-full ${D.status==="alive"?"bg-emerald-500":D.status==="sick"?"bg-amber-500":D.status==="harvested"?"bg-blue-500":"bg-slate-400"}`}),h.jsx(ur,{className:`${kje[D.status]} border text-xs font-medium`,children:Cje[D.status]})]})}),h.jsxs("div",{className:"space-y-2 text-sm",children:[h.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[h.jsx(So,{className:"w-4 h-4 text-slate-400"}),h.jsx("span",{className:"truncate",children:(R==null?void 0:R.name)||"Lahan tidak diketahui"})]}),h.jsxs("div",{className:"flex items-center gap-2 text-slate-600",children:[h.jsx(Z$,{className:"w-4 h-4 text-slate-400"}),h.jsx("span",{children:D.plant_date?Uc(new Date(D.plant_date),"dd MMM yyyy"):"-"})]})]}),R&&h.jsx(zo,{to:ei("LandDetail")+`?id=${R.id}`,children:h.jsxs(pt,{variant:"ghost",size:"sm",className:"w-full mt-3 opacity-0 group-hover:opacity-100 transition-opacity text-emerald-600",children:["Lihat Lahan",h.jsx(tb,{className:"w-4 h-4 ml-1"})]})})]})},D.id)})})]},E))}):h.jsx(Qa,{icon:sa,title:"Tidak ada tanaman ditemukan",description:e||n!=="all"||i!=="all"?"Coba ubah filter pencarian Anda":"Tanaman dapat ditambahkan melalui halaman detail lahan"})]})})}function bj(e){const[t,n]=M.useState(!1),r=M.useCallback(async()=>{n(!0);try{return pg()?await mt.entities[e].list():await Tr.getEntities(e)}catch{return await Tr.getEntities(e)}finally{n(!1)}},[e]),i=M.useCallback(async a=>{if(pg())try{return await mt.entities[e].create(a)}catch{console.warn("Switching to offline mode...")}if(e==="Farmer"){const o=await Tr.saveFarmerLocally(a);return Mt.info("Tersimpan di database lokal (Offline)"),{...a,id:o,sync_status:"pending"}}return await Tr.addToQueue(e,"CREATE",a),Mt.info("Data masuk antrean sinkronisasi"),{...a,sync_status:"pending"}},[e]);return{list:r,create:i,loading:t}}function Mje(){const[e,t]=M.useState(pg()),[n,r]=M.useState(!1),[i,a]=M.useState(0);M.useEffect(()=>{const s=()=>{t(!0),Mt.success("Koneksi internet tersambung"),o()},c=()=>{t(!1),Mt.warning("Mode offline - data disimpan di SQLite")};return window.addEventListener("online",s),window.addEventListener("offline",c),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",c)}},[]),M.useEffect(()=>{const s=async()=>{const d=await Tr.getPendingCount();a(d)};s();const c=setInterval(s,3e3);return()=>clearInterval(c)},[]);const o=M.useCallback(async()=>{if(!(!pg()||n)){r(!0);try{await Tr.syncAll(mt);const s=await Tr.getPendingCount();a(s)}catch(s){console.error("Sync failed:",s)}finally{r(!1)}}},[n]);return{online:e,syncing:n,pendingCount:i,syncPendingData:o,forceSync:o}}async function Rje(){try{const e=new AbortController;return setTimeout(()=>e.abort(),3e3),await fetch("https://www.google.com/favicon.ico",{method:"HEAD",mode:"no-cors",cache:"no-store",signal:e.signal}),!0}catch{return!1}}function Lje({compact:e=!1}){const{syncing:t,pendingCount:n,lastSync:r,forceSync:i}=Mje(),[a,o]=M.useState(!1);return M.useEffect(()=>{const s=new AbortController;return(async()=>{try{const d=await Rje(s.signal);o(d)}catch{}})(),()=>s.abort()},[]),e?h.jsxs("div",{className:"flex items-center gap-2",children:[a?h.jsxs(ur,{variant:"outline",className:"bg-emerald-50 text-emerald-700 border-emerald-200",children:[h.jsx(Pj,{className:"w-3 h-3 mr-1"}),"Online"]}):h.jsxs(ur,{variant:"outline",className:"bg-amber-50 text-amber-700 border-amber-200",children:[h.jsx(Sj,{className:"w-3 h-3 mr-1"}),"Offline"]}),n>0&&h.jsxs(ur,{variant:"outline",className:"bg-blue-50 text-blue-700 border-blue-200",children:[h.jsx(Q$,{className:"w-3 h-3 mr-1"}),n," pending"]})]}):h.jsxs("div",{className:"flex items-center justify-between p-3 bg-white rounded-xl border border-slate-200 shadow-sm",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${a?"bg-emerald-100":"bg-amber-100"}`,children:a?h.jsx(Pj,{className:"w-5 h-5 text-emerald-600"}):h.jsx(Sj,{className:"w-5 h-5 text-amber-600"})}),h.jsxs("div",{children:[h.jsx("p",{className:"font-medium text-slate-900",children:a?"Terhubung ke Internet":"Mode Offline"}),h.jsx("p",{className:"text-xs text-slate-500",children:r?`Sync terakhir: ${Uc(new Date(r),"dd MMM, HH:mm",{locale:gg})}`:"Belum pernah sync"})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[n>0&&h.jsxs(ur,{className:"bg-amber-100 text-amber-700 border-amber-200",children:[n," data menunggu sync"]}),t?h.jsxs(pt,{disabled:!0,size:"sm",variant:"outline",children:[h.jsx(ti,{className:"w-4 h-4 mr-2 animate-spin"}),"Syncing..."]}):a&&n>0?h.jsxs(pt,{size:"sm",onClick:i,className:"bg-emerald-600 hover:bg-emerald-700",children:[h.jsx(tF,{className:"w-4 h-4 mr-2"}),"Sync Sekarang"]}):a?h.jsxs(ur,{className:"bg-emerald-100 text-emerald-700",children:[h.jsx(Y$,{className:"w-3 h-3 mr-1"}),"Tersinkronisasi"]}):null]})]})}const Ije=[{value:"healthy",label:"Sehat",icon:la,color:"text-emerald-600"},{value:"mild_issue",label:"Masalah Ringan",icon:ul,color:"text-amber-500"},{value:"moderate_issue",label:"Masalah Sedang",icon:ul,color:"text-orange-500"},{value:"severe_issue",label:"Masalah Berat",icon:ul,color:"text-red-500"}],Dje=[{value:"productive",label:"Produktif"},{value:"less_productive",label:"Kurang Produktif"},{value:"not_productive",label:"Tidak Produktif"}],Bje=[{value:"none",label:"Tidak Ada Masalah",icon:la},{value:"pest",label:"Hama",icon:eb},{value:"disease",label:"Penyakit",icon:ky},{value:"weather",label:"Cuaca Buruk",icon:JT},{value:"nutrient_deficiency",label:"Kekurangan Nutrisi",icon:ky},{value:"water_shortage",label:"Kekurangan Air",icon:J$},{value:"other",label:"Lainnya",icon:ul}];function $je({plant:e,onClose:t,onSuccess:n}){const r=As(),[i,a]=M.useState({health_status:"healthy",productivity_status:"productive",issue_type:"none",issue_description:"",recommendation:"",notes:""}),o=ci({mutationFn:async()=>{await mt.entities.PlantInspection.create({plant_id:e.id,land_id:e.land_id,farmer_id:e.farmer_id,inspection_date:new Date().toISOString().split("T")[0],...i});const s=i.health_status==="severe_issue"?"sick":(i.health_status==="healthy","alive");await mt.entities.Plant.update(e.id,{status:s,productivity_status:i.productivity_status,issue_type:i.issue_type,issue_description:i.issue_description,last_inspection_date:new Date().toISOString().split("T")[0]})},onSuccess:()=>{r.invalidateQueries({queryKey:["plants"]}),r.invalidateQueries({queryKey:["farmer-plants"]}),Mt.success("Inspeksi berhasil disimpan!"),n==null||n(),t==null||t()}});return h.jsxs(Tt,{className:"border-0 shadow-lg",children:[h.jsxs(Ti,{className:"pb-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(Ei,{className:"text-lg",children:"Inspeksi Tanaman"}),h.jsx(pt,{variant:"ghost",size:"icon",onClick:t,children:h.jsx(rb,{className:"w-5 h-5"})})]}),h.jsx("p",{className:"text-sm text-slate-500",children:e.commodity_name})]}),h.jsxs(Pn,{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Status Kesehatan *"}),h.jsx("div",{className:"grid grid-cols-2 gap-2",children:Ije.map(s=>{const c=s.icon;return h.jsxs(pt,{type:"button",variant:i.health_status===s.value?"default":"outline",className:`justify-start h-auto py-3 ${i.health_status===s.value?"bg-slate-800":""}`,onClick:()=>a(d=>({...d,health_status:s.value})),children:[h.jsx(c,{className:`w-4 h-4 mr-2 ${i.health_status===s.value?"text-white":s.color}`}),s.label]},s.value)})})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Status Produktivitas *"}),h.jsxs(Hr,{value:i.productivity_status,onValueChange:s=>a(c=>({...c,productivity_status:s})),children:[h.jsx(Dr,{children:h.jsx(Gr,{})}),h.jsx(Br,{children:Dje.map(s=>h.jsx(Kt,{value:s.value,children:s.label},s.value))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Jenis Masalah"}),h.jsxs(Hr,{value:i.issue_type,onValueChange:s=>a(c=>({...c,issue_type:s})),children:[h.jsx(Dr,{children:h.jsx(Gr,{})}),h.jsx(Br,{children:Bje.map(s=>{const c=s.icon;return h.jsx(Kt,{value:s.value,children:h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(c,{className:"w-4 h-4"}),s.label]})},s.value)})})]})]}),i.issue_type!=="none"&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Deskripsi Masalah"}),h.jsx(Ic,{value:i.issue_description,onChange:s=>a(c=>({...c,issue_description:s.target.value})),placeholder:"Jelaskan kondisi masalah yang ditemukan...",rows:3})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Rekomendasi Tindakan"}),h.jsx(Ic,{value:i.recommendation,onChange:s=>a(c=>({...c,recommendation:s.target.value})),placeholder:"Saran penanganan atau perawatan...",rows:2})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Catatan Tambahan"}),h.jsx(Ic,{value:i.notes,onChange:s=>a(c=>({...c,notes:s.target.value})),placeholder:"Catatan lainnya...",rows:2})]}),h.jsxs("div",{className:"flex gap-3 pt-2",children:[h.jsx(pt,{variant:"outline",className:"flex-1",onClick:t,children:"Batal"}),h.jsxs(pt,{className:"flex-1 bg-emerald-600 hover:bg-emerald-700",onClick:()=>o.mutate(),disabled:o.isPending,children:[o.isPending?h.jsx(ti,{className:"w-4 h-4 mr-2 animate-spin"}):h.jsx(la,{className:"w-4 h-4 mr-2"}),"Simpan Inspeksi"]})]})]})]})}const E$={A:{label:"Grade A - Premium",color:"text-emerald-600"},B:{label:"Grade B - Baik",color:"text-green-600"},C:{label:"Grade C - Standar",color:"text-amber-600"},D:{label:"Grade D - Rendah",color:"text-orange-600"}};function Fje({farmer:e,onSuccess:t,onClose:n,harvests:r=[]}){var m,y;const[i,a]=M.useState(!1),[o,s]=M.useState({offtaker_id:"",harvest_id:"",commodity_name:"",quantity_kg:"",farmer_grade:"",distribution_date:new Date().toISOString().split("T")[0],notes:""}),{data:c=[]}=bn({queryKey:["offtakers-active"],queryFn:()=>mt.entities.Offtaker.filter({is_active:!0})}),d=b=>{const P=r.find(x=>x.id===b);s(P?x=>({...x,harvest_id:b,commodity_name:P.commodity_name,quantity_kg:P.weight_kg.toString()}):x=>({...x,harvest_id:""}))},p=async()=>{if(!o.offtaker_id||!o.commodity_name||!o.quantity_kg||!o.farmer_grade){Mt.error("Lengkapi semua field yang wajib");return}a(!0);try{const b=c.find(P=>P.id===o.offtaker_id);await mt.entities.Distribution.create({farmer_id:e.id,farmer_name:e.full_name,offtaker_id:o.offtaker_id,offtaker_name:(b==null?void 0:b.company_name)||"",harvest_id:o.harvest_id,commodity_name:o.commodity_name,quantity_kg:parseFloat(o.quantity_kg),farmer_grade:o.farmer_grade,distribution_date:o.distribution_date,notes:o.notes,status:"pending"}),Mt.success("Distribusi berhasil dikirim!"),t==null||t(),n==null||n()}catch{Mt.error("Gagal mengirim distribusi")}finally{a(!1)}};return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center",children:h.jsx(Tc,{className:"w-5 h-5 text-indigo-600"})}),h.jsxs("div",{children:[h.jsx("h3",{className:"font-semibold text-slate-900",children:"Kirim ke Offtaker"}),h.jsxs("p",{className:"text-sm text-slate-500",children:["Petani: ",e==null?void 0:e.full_name]})]})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2 p-3 bg-slate-50 rounded-lg border border-slate-100",children:[h.jsxs(St,{className:"text-indigo-700 flex items-center gap-2",children:[h.jsx(RH,{className:"w-4 h-4"})," Pilih dari Data Panen (Opsional)"]}),h.jsxs(Hr,{value:o.harvest_id,onValueChange:d,children:[h.jsx(Dr,{className:"w-full bg-white border-indigo-200 focus:ring-indigo-500",children:h.jsx(Gr,{placeholder:r&&r.length>0?"Pilih hasil panen...":"Tidak ada data panen tersedia"})}),h.jsx(Br,{children:Array.isArray(r)&&r.length>0?h.jsxs(h.Fragment,{children:[h.jsx(Kt,{value:"manual",className:"text-slate-400 italic",children:"-- Tanpa Referensi Panen --"}),r.map(b=>h.jsx(Kt,{value:b.id.toString(),children:h.jsxs("div",{className:"flex flex-col",children:[h.jsx("span",{className:"font-medium",children:b.commodity_name}),h.jsxs("span",{className:"text-xs text-slate-500",children:[b.weight_kg," Kg • ",b.notes]})]})},b.id))]}):h.jsxs("div",{className:"p-4 text-center text-sm text-slate-500",children:["Belum ada data panen terdaftar. ",h.jsx("br",{}),h.jsx("span",{className:"text-xs",children:"Catat panen terlebih dahulu di tab Panen."})]})})]}),h.jsx("p",{className:"text-[10px] text-slate-400",children:"Memilih data panen akan mengisi nama komoditas dan berat secara otomatis."})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Pilih Offtaker *"}),h.jsxs(Hr,{value:o.offtaker_id,onValueChange:b=>s(P=>({...P,offtaker_id:b})),children:[h.jsx(Dr,{children:h.jsx(Gr,{placeholder:"Pilih offtaker tujuan"})}),h.jsx(Br,{children:c.map(b=>h.jsxs(Kt,{value:b.id,children:[b.company_name," - ",b.contact_name]},b.id))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Komoditas *"}),h.jsx(nn,{value:o.commodity_name,onChange:b=>s(P=>({...P,commodity_name:b.target.value})),placeholder:"Contoh: Kopi Robusta"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Jumlah (Kg) *"}),h.jsx(nn,{type:"number",value:o.quantity_kg,onChange:b=>s(P=>({...P,quantity_kg:b.target.value})),placeholder:"0"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Tanggal Kirim *"}),h.jsx(nn,{type:"date",value:o.distribution_date,onChange:b=>s(P=>({...P,distribution_date:b.target.value}))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Grade Barang (Klaim Petani) *"}),h.jsx("div",{className:"grid grid-cols-4 gap-2",children:["A","B","C","D"].map(b=>h.jsx(pt,{type:"button",variant:o.farmer_grade===b?"default":"outline",className:`h-12 ${o.farmer_grade===b?"bg-indigo-600":""}`,onClick:()=>s(P=>({...P,farmer_grade:b})),children:b},b))}),o.farmer_grade&&h.jsx("p",{className:`text-sm font-medium ${(m=E$[o.farmer_grade])==null?void 0:m.color}`,children:(y=E$[o.farmer_grade])==null?void 0:y.label})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Catatan"}),h.jsx(Ic,{value:o.notes,onChange:b=>s(P=>({...P,notes:b.target.value})),placeholder:"Catatan tambahan (kondisi kemasan, supir, dll)...",rows:2})]}),h.jsxs(pt,{className:"w-full h-12 bg-indigo-600 hover:bg-indigo-700 text-white font-semibold",onClick:p,disabled:i,children:[i?h.jsx(ti,{className:"w-5 h-5 mr-2 animate-spin"}):h.jsx(iF,{className:"w-5 h-5 mr-2"}),"Konfirmasi Pengiriman"]})]})]})}function qje({lands:e,plants:t,onSubmit:n,onCancel:r,isLoading:i}){const[a,o]=M.useState({land_id:"",plant_id:"general",commodity_name:"",weight_kg:"",harvest_date:new Date().toISOString().split("T")[0],notes:""}),s=M.useMemo(()=>a.land_id?t.filter(d=>d.land_id===a.land_id):[],[t,a.land_id]),c=d=>{d.preventDefault(),!(!a.land_id||!a.weight_kg||!a.commodity_name)&&n({...a,weight_kg:parseFloat(a.weight_kg)})};return h.jsxs("form",{onSubmit:c,className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs(St,{className:"flex items-center gap-2",children:[h.jsx(So,{className:"w-4 h-4 text-emerald-600"})," Pilih Lahan"]}),h.jsxs(Hr,{value:a.land_id,onValueChange:d=>o(p=>({...p,land_id:d})),children:[h.jsx(Dr,{children:h.jsx(Gr,{placeholder:"Pilih lahan panen..."})}),h.jsx(Br,{children:e.map(d=>h.jsx(Kt,{value:d.id,children:d.name},d.id))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs(St,{className:"flex items-center gap-2",children:[h.jsx(sa,{className:"w-4 h-4 text-emerald-600"})," Spesifik Tanaman (Opsional)"]}),h.jsxs(Hr,{disabled:!a.land_id,value:a.plant_id,onValueChange:d=>{const p=s.find(m=>m.id===d);o(m=>({...m,plant_id:d,commodity_name:p?p.commodity_name:m.commodity_name}))},children:[h.jsx(Dr,{children:h.jsx(Gr,{placeholder:a.land_id?"Pilih tanaman atau biarkan umum":"Pilih lahan dahulu"})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"general",children:"Hasil Lahan Umum"}),s.map(d=>h.jsxs(Kt,{value:d.id,children:[d.commodity_name," (ID: ",d.id.slice(-4),")"]},d.id))]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Nama Komoditas"}),h.jsx(nn,{placeholder:"Contoh: Kopi Arabika, Jagung, dll",value:a.commodity_name,onChange:d=>o(p=>({...p,commodity_name:d.target.value})),required:!0})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs(St,{className:"flex items-center gap-2",children:[h.jsx(rF,{className:"w-4 h-4 text-emerald-600"})," Berat (Kg)"]}),h.jsx(nn,{type:"number",step:"0.1",placeholder:"0.0",value:a.weight_kg,onChange:d=>o(p=>({...p,weight_kg:d.target.value})),required:!0})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs(St,{className:"flex items-center gap-2",children:[h.jsx(Z$,{className:"w-4 h-4 text-emerald-600"})," Tanggal"]}),h.jsx(nn,{type:"date",value:a.harvest_date,onChange:d=>o(p=>({...p,harvest_date:d.target.value})),required:!0})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Catatan (Opsional)"}),h.jsx(nn,{placeholder:"Kualitas bagus, cuaca cerah, dll",value:a.notes,onChange:d=>o(p=>({...p,notes:d.target.value}))})]}),h.jsxs("div",{className:"flex gap-3 pt-2",children:[h.jsx(pt,{type:"button",variant:"outline",className:"flex-1",onClick:r,disabled:i,children:"Batal"}),h.jsxs(pt,{type:"submit",className:"flex-1 bg-emerald-600 hover:bg-emerald-700",disabled:i,children:[i?h.jsx(ti,{className:"w-4 h-4 animate-spin mr-2"}):null,"Simpan Panen"]})]})]})}async function zje(e){const t=await _k();if(console.log("🛠 DB Instance Check:",t),!t||typeof t.run!="function")throw console.error("❌ Database instance tidak valid!"),new Error("Database not initialized correctly");const n=crypto.randomUUID(),r=new Date().toISOString();if(!e.farmer_id)throw new Error("farmer_id is required");if(!e.center_lat||!e.center_lng)throw new Error("center coordinate is required");console.log("📦 createLand data:",e);try{const i=`INSERT INTO land ( id, farmer_id, name, polygon_coordinates, center_lat, center_lng, area_hectares, land_status, village, district, regency, validation_status, sync_status, created_at ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,a=[n,e.farmer_id,e.name,JSON.stringify(e.polygon_coordinates),e.center_lat,e.center_lng,e.area_hectares,e.land_status,e.village,e.district,e.regency,e.validation_status||"pending",e.sync_status||"pending",r];return console.log("📦 createLand values:",a),console.log("📡 Menjalankan query dengan nilai:",a),t.run(i,a),a1e(t),console.log("✅ Land inserted:",n),{id:n}}catch(i){throw console.error("❌ INSERT GAGAL",i),i}}async function Uje(e){const t=await _k();try{const n=t.exec("SELECT id, name, farmer_id FROM land");n[0]&&console.table(n[0].values.map(s=>({id:s[0],name:s[1],farmer_id_in_db:s[2]}))),console.log("Mencari farmerId:",e);const i=t.exec("SELECT * FROM land");if(!i||i.length===0||!i[0].values)return console.log(`ℹ️ Tidak ada lahan untuk farmerId: ${e}`),[];const{columns:a,values:o}=i[0];return o.map(s=>Object.fromEntries(a.map((c,d)=>[c,s[d]])))}catch(n){return console.error("❌ SQL Error:",n.message),[]}}function Vje(){var de,He;const e=As(),[t,n]=M.useState(null),[r,i]=M.useState(null),[a,o]=M.useState(!0),[s,c]=M.useState(!1),[d,p]=M.useState(!1),[m,y]=M.useState(null),[b,P]=M.useState({name:"",land_status:"owned",village:"",district:"",regency:""}),[x,w]=M.useState(null),[T,E]=M.useState(!1),[k,D]=M.useState(!1),[I,R]=M.useState(null),{data:$=[]}=bn({queryKey:["farmer-distributions",r==null?void 0:r.id],queryFn:()=>mt.entities.Distribution.filter({farmer_id:r==null?void 0:r.id}),enabled:!!(r!=null&&r.id)}),{data:V=[]}=bn({queryKey:["farmer-harvests",r==null?void 0:r.id],queryFn:()=>mt.entities.Harvest.filter({farmer_id:r==null?void 0:r.id}),enabled:!!(r!=null&&r.id)}),K=bj("Land"),Z=bj("Plant"),ee=bj("Harvest");M.useEffect(()=>{Uje().then(console.log),(async()=>{try{const $e=await mt.auth.me();n($e);const We=await mt.entities.Farmer.filter({user_email:$e.email});We.length>0&&i(We[0])}catch{}finally{o(!1)}})()},[]);const{data:ne=[]}=bn({queryKey:["farmer-lands",r==null?void 0:r.id],queryFn:()=>K.filter({farmer_id:r.id}),enabled:!!(r!=null&&r.id)});console.log("lands",ne);const{data:oe=[]}=bn({queryKey:["farmer-plants",r==null?void 0:r.id],queryFn:()=>Z.filter({farmer_id:r.id}),enabled:!!(r!=null&&r.id)}),he=ci({mutationFn:je=>zje({...je,farmer_id:r.id,validation_status:"pending",sync_status:"pending"}),onSuccess:()=>{e.invalidateQueries({queryKey:["farmer-lands"]}),c(!1),P({name:"",land_status:"owned",village:"",district:"",regency:""}),Mt.success("Lahan berhasil ditambahkan!")},onError:je=>{Mt.error(je.message)}}),Se=ci({mutationFn:je=>Z.create(je),onSuccess:()=>{e.invalidateQueries({queryKey:["farmer-plants"]}),Mt.success("Tanaman berhasil ditag!")}}),fe=ci({mutationFn:je=>ee.create({...je,farmer_id:r.id,sync_status:"pending",created_at:new Date().toISOString()}),onSuccess:()=>{e.invalidateQueries({queryKey:["farmer-harvests"]}),D(!1),R(null),Mt.success("Data panen berhasil disimpan!")}}),Oe=()=>{mt.auth.redirectToLogin(window.location.href)},re=()=>{mt.auth.logout()},Ce=je=>{if(!b.name){Mt.error("Masukkan nama lahan terlebih dahulu");return}he.mutate({...b,...je})};if(a)return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-emerald-50 to-slate-100 flex items-center justify-center",children:h.jsx(ti,{className:"w-8 h-8 animate-spin text-emerald-600"})});if(!t)return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-emerald-50 to-slate-100 flex items-center justify-center p-6",children:h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:h.jsx(Tt,{className:"border-0 shadow-xl max-w-md w-full",children:h.jsxs(Pn,{className:"p-8 text-center",children:[h.jsx("div",{className:"w-20 h-20 rounded-full bg-gradient-to-br from-emerald-500 to-emerald-600 flex items-center justify-center mx-auto mb-6",children:h.jsx(sa,{className:"w-10 h-10 text-white"})}),h.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Portal Petani"}),h.jsx("p",{className:"text-slate-500 mb-8",children:"Masuk untuk mengelola lahan dan tanaman Anda"}),h.jsx(pt,{onClick:Oe,className:"w-full h-12 bg-emerald-600 hover:bg-emerald-700 text-lg",children:"Masuk / Daftar"})]})})})});if(!r)return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-emerald-50 to-slate-100 flex items-center justify-center p-6",children:h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:h.jsx(Tt,{className:"border-0 shadow-xl max-w-md w-full",children:h.jsxs(Pn,{className:"p-8 text-center",children:[h.jsx("div",{className:"w-20 h-20 rounded-full bg-amber-100 flex items-center justify-center mx-auto mb-6",children:h.jsx(zf,{className:"w-10 h-10 text-amber-600"})}),h.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Akun Belum Terdaftar"}),h.jsxs("p",{className:"text-slate-500 mb-4",children:["Email ",h.jsx("span",{className:"font-medium",children:t.email})," belum terhubung dengan data petani."]}),h.jsx("p",{className:"text-sm text-slate-400 mb-8",children:"Hubungi admin untuk mendaftarkan akun Anda sebagai petani."}),h.jsxs(pt,{variant:"outline",onClick:re,className:"w-full h-12",children:[h.jsx(mh,{className:"w-5 h-5 mr-2"}),"Keluar"]})]})})})});const ae=oe.filter(je=>je.status==="alive").length,ie=ne.reduce((je,$e)=>je+($e.area_hectares||0),0);return h.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-emerald-50 to-slate-100",children:[h.jsxs("div",{className:"max-w-4xl mx-auto p-4 md:p-6 space-y-6",children:[h.jsx(Lje,{}),h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("div",{className:"w-14 h-14 rounded-full bg-gradient-to-br from-emerald-500 to-emerald-600 flex items-center justify-center shadow-lg",children:r.photo_url?h.jsx("img",{src:r.photo_url,alt:r.full_name,className:"w-full h-full rounded-full object-cover"}):h.jsx("span",{className:"text-xl font-bold text-white",children:(He=(de=r.full_name)==null?void 0:de.charAt(0))==null?void 0:He.toUpperCase()})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-slate-900",children:r.full_name}),h.jsx("div",{className:"flex items-center gap-2",children:r.verification_status==="verified"?h.jsxs(ur,{className:"bg-emerald-100 text-emerald-700 border-emerald-200 text-xs",children:[h.jsx(la,{className:"w-3 h-3 mr-1"}),"Terverifikasi"]}):h.jsxs(ur,{className:"bg-amber-100 text-amber-700 border-amber-200 text-xs",children:[h.jsx(Hf,{className:"w-3 h-3 mr-1"}),"Menunggu Verifikasi"]})})]})]}),h.jsx(pt,{variant:"outline",size:"sm",onClick:re,children:h.jsx(mh,{className:"w-4 h-4"})})]}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"grid grid-cols-3 gap-3",children:[h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(js,{className:"w-6 h-6 mx-auto text-emerald-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:ne.length}),h.jsx("p",{className:"text-xs text-slate-500",children:"Lahan"})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(sa,{className:"w-6 h-6 mx-auto text-emerald-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:ae}),h.jsx("p",{className:"text-xs text-slate-500",children:"Tanaman"})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(So,{className:"w-6 h-6 mx-auto text-emerald-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:ie.toFixed(1)}),h.jsx("p",{className:"text-xs text-slate-500",children:"Hektar"})]})]}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:h.jsxs(Ak,{defaultValue:"lands",className:"space-y-4",children:[h.jsxs(mx,{className:"w-full bg-white shadow-sm p-1 h-auto flex-wrap",children:[h.jsxs(al,{value:"lands",className:"flex-1 py-3 data-[state=active]:bg-emerald-50 data-[state=active]:text-emerald-700",children:[h.jsx(js,{className:"w-4 h-4 mr-2"}),"Lahan"]}),h.jsxs(al,{value:"plants",className:"flex-1 py-3 data-[state=active]:bg-emerald-50 data-[state=active]:text-emerald-700",children:[h.jsx(sa,{className:"w-4 h-4 mr-2"}),"Tanaman"]}),h.jsxs(al,{value:"harvest",className:"flex-1 py-3 data-[state=active]:bg-emerald-50 data-[state=active]:text-emerald-700",children:[h.jsx(Tc,{className:"w-4 h-4 mr-2"}),"Panen"]}),h.jsxs(al,{value:"distribution",className:"flex-1 py-3 data-[state=active]:bg-emerald-50 data-[state=active]:text-emerald-700",children:[h.jsx(fy,{className:"w-4 h-4 mr-2"}),"Distribusi"]}),h.jsxs(al,{value:"profile",className:"flex-1 py-3 data-[state=active]:bg-emerald-50 data-[state=active]:text-emerald-700",children:[h.jsx(zf,{className:"w-4 h-4 mr-2"}),"Profil"]})]}),h.jsxs(ol,{value:"lands",className:"space-y-4",children:[h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsx("h2",{className:"text-lg font-semibold text-slate-900",children:"Daftar Lahan"}),h.jsxs(pt,{size:"sm",onClick:()=>c(!0),className:"bg-emerald-600 hover:bg-emerald-700",children:[h.jsx(Dc,{className:"w-4 h-4 mr-2"}),"Tambah Lahan"]})]}),ne.length>0?h.jsx("div",{className:"grid gap-4",children:ne.map(je=>h.jsxs("div",{className:"relative",children:[h.jsx(Sk,{land:je,plantCount:oe.filter($e=>$e.land_id===je.id).length}),h.jsxs(pt,{size:"sm",variant:"outline",className:"absolute top-4 right-4",onClick:()=>{y(je),p(!0)},children:[h.jsx(sa,{className:"w-4 h-4 mr-1"}),"Tag Tanaman"]})]},je.id))}):h.jsx(Qa,{icon:js,title:"Belum ada lahan",description:"Tambahkan lahan pertama Anda dengan menggunakan GPS",action:()=>c(!0),actionLabel:"Tambah Lahan"})]}),h.jsxs(ol,{value:"plants",className:"space-y-4",children:[h.jsxs("h2",{className:"text-lg font-semibold text-slate-900",children:["Daftar Tanaman (",oe.length,")"]}),oe.length>0?h.jsx("div",{className:"grid gap-3",children:oe.map(je=>{const $e=ne.find(Ye=>Ye.id===je.land_id),We=je.issue_type&&je.issue_type!=="none";return h.jsx(Tt,{className:"border-0 shadow-sm p-4",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:`w-3 h-3 rounded-full ${je.status==="alive"&&je.productivity_status==="productive"?"bg-emerald-500":je.status==="alive"&&je.productivity_status==="less_productive"?"bg-amber-500":je.status==="sick"?"bg-red-500":je.status==="dead"?"bg-slate-400":"bg-emerald-500"}`}),h.jsxs("div",{children:[h.jsx("p",{className:"font-medium text-slate-900",children:je.commodity_name}),h.jsx("p",{className:"text-sm text-slate-500",children:($e==null?void 0:$e.name)||"Lahan tidak diketahui"}),We&&h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(eb,{className:"w-3 h-3 text-amber-500"}),h.jsx("span",{className:"text-xs text-amber-600",children:je.issue_type==="pest"?"Hama":je.issue_type==="disease"?"Penyakit":je.issue_type==="weather"?"Cuaca":je.issue_type==="nutrient_deficiency"?"Nutrisi":je.issue_type==="water_shortage"?"Air":"Masalah"})]})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(ur,{variant:"outline",className:`text-xs ${je.productivity_status==="not_productive"?"border-red-200 text-red-600":je.productivity_status==="less_productive"?"border-amber-200 text-amber-600":"border-emerald-200 text-emerald-600"}`,children:je.productivity_status==="productive"||!je.productivity_status?"Produktif":je.productivity_status==="less_productive"?"Kurang Produktif":"Tidak Produktif"}),h.jsx(pt,{size:"sm",variant:"outline",className:"h-8",onClick:()=>w(je),children:h.jsx(NH,{className:"w-4 h-4"})})]})]})},je.id)})}):h.jsx(Qa,{icon:sa,title:"Belum ada tanaman",description:"Tag tanaman Anda melalui menu lahan"})]}),h.jsxs(ol,{value:"harvest",className:"space-y-4",children:[h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsx("h2",{className:"text-lg font-semibold text-slate-900",children:"Catatan Panen"}),h.jsxs(pt,{size:"sm",onClick:()=>D(!0),className:"bg-emerald-600",children:[h.jsx(Dc,{className:"w-4 h-4 mr-2"}),"Catat Panen"]})]}),V.length>0?h.jsx("div",{className:"grid gap-3",children:V.map(je=>{var $e;return h.jsxs(Tt,{className:"border-0 shadow-sm p-4",children:[h.jsxs("div",{className:"flex justify-between items-start",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-bold text-slate-900",children:je.commodity_name||"Komoditas"}),h.jsx("p",{className:"text-sm text-slate-500",children:new Date(je.harvest_date).toLocaleDateString("id-ID",{day:"numeric",month:"long",year:"numeric"})})]}),h.jsxs(ur,{className:"bg-emerald-100 text-emerald-700",children:[je.weight_kg," Kg"]})]}),h.jsxs("div",{className:"mt-2 flex items-center gap-2 text-xs text-slate-400",children:[h.jsx(So,{className:"w-3 h-3"}),(($e=ne.find(We=>We.id===je.land_id))==null?void 0:$e.name)||"Lahan Umum"]})]},je.id)})}):h.jsx(Qa,{icon:Tc,title:"Belum ada catatan panen",description:"Mulai catat hasil panen Anda untuk melacak produktivitas",action:()=>D(!0),actionLabel:"Catat Panen Sekarang"})]}),h.jsxs(ol,{value:"distribution",className:"space-y-4",children:[h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsx("h2",{className:"text-lg font-semibold text-slate-900",children:"Distribusi ke Offtaker"}),h.jsxs(pt,{size:"sm",onClick:()=>E(!0),className:"bg-emerald-600 hover:bg-emerald-700",children:[h.jsx(iF,{className:"w-4 h-4 mr-2"}),"Kirim Baru"]})]}),$.length>0?h.jsx("div",{className:"grid gap-3",children:$.map(je=>{var Ye,rt;const $e={pending:{label:"Pending",color:"bg-amber-100 text-amber-700"},in_transit:{label:"Dalam Pengiriman",color:"bg-blue-100 text-blue-700"},received:{label:"Diterima",color:"bg-indigo-100 text-indigo-700"},graded:{label:"Sudah Grade",color:"bg-emerald-100 text-emerald-700"},completed:{label:"Selesai",color:"bg-emerald-100 text-emerald-700"},rejected:{label:"Ditolak",color:"bg-red-100 text-red-700"}},We=je.offtaker_grade&&je.offtaker_grade!==je.farmer_grade;return h.jsxs(Tt,{className:"border-0 shadow-sm p-4",children:[h.jsxs("div",{className:"flex items-start justify-between mb-2",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-medium text-slate-900",children:je.commodity_name}),h.jsxs("p",{className:"text-sm text-slate-500",children:["Ke: ",je.offtaker_name]})]}),h.jsx(ur,{className:((Ye=$e[je.status])==null?void 0:Ye.color)||"bg-slate-100",children:((rt=$e[je.status])==null?void 0:rt.label)||je.status})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-2 text-sm",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-slate-500",children:"Jumlah"}),h.jsxs("p",{className:"font-medium",children:[je.quantity_kg," Kg"]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-slate-500",children:"Grade Klaim"}),h.jsx("p",{className:"font-medium",children:je.farmer_grade})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-slate-500",children:"Grade Final"}),h.jsxs("p",{className:`font-medium ${We?"text-amber-600":"text-emerald-600"}`,children:[je.offtaker_grade||"-",We&&" ↓"]})]})]}),je.grade_difference_reason&&h.jsxs("div",{className:"mt-2 p-2 bg-amber-50 rounded text-sm text-amber-700",children:[h.jsx("strong",{children:"Alasan:"})," ",je.grade_difference_reason]}),je.total_value&&h.jsxs("p",{className:"mt-2 text-sm font-semibold text-emerald-600",children:["Total: Rp ",je.total_value.toLocaleString()]})]},je.id)})}):h.jsx(Qa,{icon:Tc,title:"Belum ada distribusi",description:"Kirim hasil panen ke offtaker untuk mendapatkan grading",action:()=>E(!0),actionLabel:"Kirim Distribusi"})]}),h.jsx(ol,{value:"profile",children:h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsxs(Pn,{className:"p-6 space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[h.jsx(zf,{className:"w-5 h-5 text-slate-400"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Nama Lengkap"}),h.jsx("p",{className:"font-medium text-slate-900",children:r.full_name})]})]}),h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[h.jsx(So,{className:"w-5 h-5 text-slate-400"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Alamat"}),h.jsxs("p",{className:"font-medium text-slate-900",children:[r.village,", ",r.district,", ",r.regency]})]})]}),r.phone&&h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[h.jsx(Yh,{className:"w-5 h-5 text-slate-400"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Telepon"}),h.jsx("p",{className:"font-medium text-slate-900",children:r.phone})]})]}),r.farmer_group&&h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-lg",children:[h.jsx(ll,{className:"w-5 h-5 text-slate-400"}),h.jsxs("div",{children:[h.jsx("p",{className:"text-xs text-slate-500",children:"Kelompok Tani"}),h.jsx("p",{className:"font-medium text-slate-900",children:r.farmer_group})]})]})]})})})]})})]}),h.jsx(sl,{open:s,onOpenChange:c,children:h.jsxs(Ss,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[h.jsx(ql,{children:h.jsx(zl,{children:"Tambah Lahan Baru"})}),h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Nama Lahan *"}),h.jsx(nn,{value:b.name,onChange:je=>P($e=>({...$e,name:je.target.value})),placeholder:"Contoh: Kebun Kopi Utara"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Status Kepemilikan"}),h.jsxs(Hr,{value:b.land_status,onValueChange:je=>P($e=>({...$e,land_status:je})),children:[h.jsx(Dr,{children:h.jsx(Gr,{})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"owned",children:"Milik Sendiri"}),h.jsx(Kt,{value:"rented",children:"Sewa"}),h.jsx(Kt,{value:"shared",children:"Bagi Hasil"})]})]})]})]}),h.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Desa"}),h.jsx(nn,{value:b.village,onChange:je=>P($e=>({...$e,village:je.target.value})),placeholder:"Nama desa"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Kecamatan"}),h.jsx(nn,{value:b.district,onChange:je=>P($e=>({...$e,district:je.target.value})),placeholder:"Nama kecamatan"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Kabupaten"}),h.jsx(nn,{value:b.regency,onChange:je=>P($e=>({...$e,regency:je.target.value})),placeholder:"Nama kabupaten"})]})]}),h.jsx(kk,{onSave:Ce})]})]})}),h.jsx(sl,{open:d,onOpenChange:p,children:h.jsxs(Ss,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[h.jsx(ql,{children:h.jsxs(zl,{children:["Tag Tanaman - ",m==null?void 0:m.name]})}),m&&h.jsx(eK,{landId:m.id,farmerId:r.id,landPolygon:m.polygon_coordinates,existingPlants:oe.filter(je=>je.land_id===m.id),onTagPlant:Se.mutate,isLoading:Se.isPending})]})}),h.jsx(sl,{open:!!x,onOpenChange:()=>w(null),children:h.jsx(Ss,{className:"max-w-md max-h-[90vh] overflow-y-auto p-0",children:x&&h.jsx($je,{plant:x,onClose:()=>w(null),onSuccess:()=>{e.invalidateQueries({queryKey:["farmer-plants"]})}})})}),h.jsx(sl,{open:T,onOpenChange:E,children:h.jsx(Ss,{className:"max-w-md max-h-[90vh] overflow-y-auto p-0",children:h.jsx(Fje,{farmer:r,onSuccess:()=>{e.invalidateQueries({queryKey:["farmer-distributions"]})},onClose:()=>E(!1),harvests:V})})}),h.jsx(sl,{open:k,onOpenChange:D,children:h.jsxs(Ss,{className:"max-w-md p-0 overflow-hidden",children:[h.jsx(ql,{className:"p-6 pb-0",children:h.jsx(zl,{children:"Input Hasil Panen"})}),h.jsx("div",{className:"p-6",children:h.jsx(qje,{lands:ne,plants:oe,onSubmit:je=>fe.mutate(je),onCancel:()=>D(!1),isLoading:fe.isPending})})]})})]})}function Wje(){const e=As(),[t,n]=M.useState(!1),[r,i]=M.useState({user_email:"",company_name:"",contact_name:"",phone:"",address:"",is_active:!0}),{data:a=[],isLoading:o}=bn({queryKey:["offtakers"],queryFn:()=>{try{const p=mt.entities.Offtaker.list();return Array.isArray(p)?p:[]}catch{return[]}}}),s=ci({mutationFn:p=>mt.entities.Offtaker.create(p),onSuccess:()=>{e.invalidateQueries({queryKey:["offtakers"]}),n(!1),i({user_email:"",company_name:"",contact_name:"",phone:"",address:"",is_active:!0}),Mt.success("Offtaker berhasil ditambahkan!")}}),c=ci({mutationFn:({id:p,is_active:m})=>mt.entities.Offtaker.update(p,{is_active:m}),onSuccess:()=>{e.invalidateQueries({queryKey:["offtakers"]}),Mt.success("Status offtaker diperbarui")}}),d=ci({mutationFn:p=>mt.entities.Offtaker.delete(p),onSuccess:()=>{e.invalidateQueries({queryKey:["offtakers"]}),Mt.success("Offtaker dihapus")}});return h.jsxs("div",{className:"p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Offtaker"}),h.jsx("p",{className:"text-slate-500",children:"Kelola pembeli hasil panen"})]}),h.jsxs(sl,{open:t,onOpenChange:n,children:[h.jsx(HW,{asChild:!0,children:h.jsxs(pt,{className:"bg-indigo-600 hover:bg-indigo-700",children:[h.jsx(Dc,{className:"w-4 h-4 mr-2"}),"Tambah Offtaker"]})}),h.jsxs(Ss,{children:[h.jsx(ql,{children:h.jsx(zl,{children:"Tambah Offtaker Baru"})}),h.jsxs("div",{className:"space-y-4 pt-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Email *"}),h.jsx(nn,{type:"email",value:r.user_email,onChange:p=>i(m=>({...m,user_email:p.target.value})),placeholder:"email@company.com"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Nama Perusahaan *"}),h.jsx(nn,{value:r.company_name,onChange:p=>i(m=>({...m,company_name:p.target.value})),placeholder:"PT. Example"})]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Nama Kontak *"}),h.jsx(nn,{value:r.contact_name,onChange:p=>i(m=>({...m,contact_name:p.target.value})),placeholder:"Nama PIC"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Telepon"}),h.jsx(nn,{value:r.phone,onChange:p=>i(m=>({...m,phone:p.target.value})),placeholder:"08xxx"})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Alamat"}),h.jsx(nn,{value:r.address,onChange:p=>i(m=>({...m,address:p.target.value})),placeholder:"Alamat lengkap"})]}),h.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[h.jsx(pt,{variant:"outline",onClick:()=>n(!1),children:"Batal"}),h.jsxs(pt,{onClick:()=>s.mutate(r),disabled:!r.user_email||!r.company_name||!r.contact_name||s.isPending,className:"bg-indigo-600 hover:bg-indigo-700",children:[s.isPending&&h.jsx(ti,{className:"w-4 h-4 mr-2 animate-spin"}),"Simpan"]})]})]})]})]})]}),o?h.jsx("div",{className:"flex justify-center py-12",children:h.jsx(ti,{className:"w-8 h-8 animate-spin text-indigo-600"})}):a.length>0?h.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-4",children:a.map(p=>h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsxs(Pn,{className:"p-4",children:[h.jsxs("div",{className:"flex items-start justify-between mb-3",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center",children:h.jsx(Tc,{className:"w-5 h-5 text-indigo-600"})}),h.jsxs("div",{children:[h.jsx("p",{className:"font-semibold text-slate-900",children:p.company_name}),h.jsx("p",{className:"text-sm text-slate-500",children:p.contact_name})]})]}),h.jsx(Rk,{checked:p.is_active,onCheckedChange:m=>c.mutate({id:p.id,is_active:m})})]}),h.jsxs("div",{className:"space-y-2 text-sm text-slate-600",children:[p.phone&&h.jsxs("p",{className:"flex items-center gap-2",children:[h.jsx(Yh,{className:"w-4 h-4"})," ",p.phone]}),p.address&&h.jsxs("p",{className:"flex items-center gap-2",children:[h.jsx(So,{className:"w-4 h-4"})," ",p.address]}),h.jsx("p",{className:"text-xs text-slate-400",children:p.user_email})]}),h.jsxs(pt,{variant:"ghost",size:"sm",className:"w-full mt-3 text-red-600 hover:bg-red-50",onClick:()=>d.mutate(p.id),children:[h.jsx(nb,{className:"w-4 h-4 mr-2"}),"Hapus"]})]})},p.id))}):h.jsx(Qa,{icon:Tc,title:"Belum ada offtaker",description:"Tambahkan offtaker untuk grading hasil panen",action:()=>n(!0),actionLabel:"Tambah Offtaker"})]})}const xj={A:{label:"Grade A",color:"bg-emerald-100 text-emerald-700",value:4},B:{label:"Grade B",color:"bg-green-100 text-green-700",value:3},C:{label:"Grade C",color:"bg-amber-100 text-amber-700",value:2},D:{label:"Grade D",color:"bg-orange-100 text-orange-700",value:1},rejected:{label:"Rejected",color:"bg-red-100 text-red-700",value:0}};function Kje({distribution:e,offtaker:t,onSuccess:n,onClose:r}){var y,b,P;const[i,a]=M.useState(!1),[o,s]=M.useState({offtaker_grade:(e==null?void 0:e.farmer_grade)||"",grade_difference_reason:"",price_per_kg:""}),c=((y=xj[e==null?void 0:e.farmer_grade])==null?void 0:y.value)||0,d=((b=xj[o.offtaker_grade])==null?void 0:b.value)||0,p=o.offtaker_grade&&d{if(!o.offtaker_grade||!o.price_per_kg){Mt.error("Lengkapi grade dan harga");return}if(p&&!o.grade_difference_reason){Mt.error("Berikan alasan penurunan grade");return}a(!0);try{const x=parseFloat(o.price_per_kg)*e.quantity_kg;await mt.entities.Distribution.update(e.id,{offtaker_grade:o.offtaker_grade,grade_difference_reason:o.grade_difference_reason,price_per_kg:parseFloat(o.price_per_kg),total_value:x,received_date:new Date().toISOString().split("T")[0],status:o.offtaker_grade==="rejected"?"rejected":"graded"}),Mt.success("Grading berhasil disimpan!"),n==null||n(),r==null||r()}catch{Mt.error("Gagal menyimpan grading")}finally{a(!1)}};return h.jsxs("div",{className:"space-y-4 p-4",children:[h.jsxs("div",{className:"p-4 bg-slate-50 rounded-lg space-y-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-semibold text-slate-900",children:e==null?void 0:e.commodity_name}),h.jsxs("p",{className:"text-sm text-slate-500",children:["Dari: ",e==null?void 0:e.farmer_name]})]}),h.jsxs(ur,{className:(P=xj[e==null?void 0:e.farmer_grade])==null?void 0:P.color,children:["Klaim: ",e==null?void 0:e.farmer_grade]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-slate-500",children:"Jumlah"}),h.jsxs("p",{className:"font-semibold",children:[e==null?void 0:e.quantity_kg," Kg"]})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-slate-500",children:"Tanggal Kirim"}),h.jsx("p",{className:"font-semibold",children:e!=null&&e.distribution_date?Uc(new Date(e.distribution_date),"dd MMM yyyy",{locale:gg}):"-"})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Grade Setelah Diterima *"}),h.jsx("div",{className:"grid grid-cols-5 gap-2",children:["A","B","C","D","rejected"].map(x=>h.jsx(pt,{type:"button",variant:o.offtaker_grade===x?"default":"outline",className:`h-12 ${o.offtaker_grade===x?x==="rejected"?"bg-red-600":"bg-indigo-600":""}`,onClick:()=>s(w=>({...w,offtaker_grade:x})),children:x==="rejected"?"X":x},x))})]}),p&&h.jsxs("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[h.jsxs("div",{className:"flex items-center gap-2 text-amber-700 mb-2",children:[h.jsx(G$,{className:"w-4 h-4"}),h.jsx("span",{className:"font-medium",children:"Grade Diturunkan"})]}),h.jsxs("p",{className:"text-sm text-amber-600 mb-3",children:["Grade petani: ",e==null?void 0:e.farmer_grade," → Grade Anda: ",o.offtaker_grade]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{className:"text-amber-700",children:"Alasan Penurunan Grade *"}),h.jsx(Ic,{value:o.grade_difference_reason,onChange:x=>s(w=>({...w,grade_difference_reason:x.target.value})),placeholder:"Contoh: Kondisi barang rusak saat pengiriman, kematangan tidak sesuai, dll",rows:2,className:"border-amber-200"})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Harga per Kg (Rp) *"}),h.jsx(nn,{type:"number",value:o.price_per_kg,onChange:x=>s(w=>({...w,price_per_kg:x.target.value})),placeholder:"0"}),o.price_per_kg&&h.jsxs("p",{className:"text-sm text-emerald-600 font-medium",children:["Total: Rp ",(parseFloat(o.price_per_kg)*e.quantity_kg).toLocaleString()]})]}),h.jsxs(pt,{className:"w-full h-12 bg-indigo-600 hover:bg-indigo-700",onClick:m,disabled:i,children:[i?h.jsx(ti,{className:"w-5 h-5 mr-2 animate-spin"}):h.jsx(la,{className:"w-5 h-5 mr-2"}),"Simpan Grading"]})]})}const wj={A:{label:"Grade A",color:"bg-emerald-100 text-emerald-700",description:"Kualitas Premium"},B:{label:"Grade B",color:"bg-green-100 text-green-700",description:"Kualitas Baik"},C:{label:"Grade C",color:"bg-amber-100 text-amber-700",description:"Kualitas Standar"},D:{label:"Grade D",color:"bg-orange-100 text-orange-700",description:"Kualitas Rendah"},rejected:{label:"Rejected",color:"bg-red-100 text-red-700",description:"Tidak Memenuhi Standar"}};function Hje(){var R;const e=As(),[t,n]=M.useState(null),[r,i]=M.useState(null),[a,o]=M.useState(!0),[s,c]=M.useState(null),[d,p]=M.useState({grade:"",notes:"",price_per_kg:""}),[m,y]=M.useState(null);M.useEffect(()=>{(async()=>{try{const V=await mt.auth.me();n(V);const K=await mt.entities.Offtaker.filter({user_email:V.email});K.length>0&&K[0].is_active&&i(K[0])}catch{}finally{o(!1)}})()},[]);const{data:b=[]}=bn({queryKey:["pending-harvests"],queryFn:()=>mt.entities.Harvest.filter({status:"pending_grade"}),enabled:!!r}),{data:P=[]}=bn({queryKey:["graded-harvests",r==null?void 0:r.user_email],queryFn:()=>mt.entities.Harvest.filter({graded_by:r.user_email}),enabled:!!r}),{data:x=[]}=bn({queryKey:["pending-distributions",r==null?void 0:r.id],queryFn:()=>mt.entities.Distribution.filter({offtaker_id:r.id,status:"pending"}),enabled:!!(r!=null&&r.id)}),{data:w=[]}=bn({queryKey:["graded-distributions",r==null?void 0:r.id],queryFn:()=>mt.entities.Distribution.filter({offtaker_id:r.id}),enabled:!!(r!=null&&r.id)}),{data:T=[]}=bn({queryKey:["farmers"],queryFn:()=>mt.entities.Farmer.list(),enabled:!!r}),E=ci({mutationFn:async()=>{const $=parseFloat(d.price_per_kg)*s.quantity_kg;await mt.entities.Harvest.update(s.id,{grade:d.grade,grade_notes:d.notes,price_per_kg:parseFloat(d.price_per_kg),total_value:$,graded_by:r.user_email,graded_by_name:r.contact_name,graded_at:new Date().toISOString(),status:d.grade==="rejected"?"rejected":"graded"})},onSuccess:()=>{e.invalidateQueries({queryKey:["pending-harvests"]}),e.invalidateQueries({queryKey:["graded-harvests"]}),c(null),p({grade:"",notes:"",price_per_kg:""}),Mt.success("Grading berhasil disimpan!")}}),k=()=>{mt.auth.redirectToLogin(window.location.href)},D=()=>{mt.auth.logout()},I=$=>{const V=T.find(K=>K.id===$);return(V==null?void 0:V.full_name)||"Tidak diketahui"};return a?h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 to-slate-100 flex items-center justify-center",children:h.jsx(ti,{className:"w-8 h-8 animate-spin text-indigo-600"})}):t?r?h.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 to-slate-100",children:[h.jsxs("div",{className:"max-w-4xl mx-auto p-4 md:p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsx("div",{className:"w-14 h-14 rounded-full bg-gradient-to-br from-indigo-500 to-indigo-600 flex items-center justify-center shadow-lg",children:h.jsx(Tc,{className:"w-7 h-7 text-white"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-xl font-bold text-slate-900",children:r.company_name}),h.jsx("p",{className:"text-sm text-slate-500",children:r.contact_name})]})]}),h.jsx(pt,{variant:"outline",size:"sm",onClick:D,children:h.jsx(mh,{className:"w-4 h-4"})})]}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"grid grid-cols-4 gap-3",children:[h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(fy,{className:"w-6 h-6 mx-auto text-indigo-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:x.length}),h.jsx("p",{className:"text-xs text-slate-500",children:"Distribusi Masuk"})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(Hf,{className:"w-6 h-6 mx-auto text-amber-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:b.length}),h.jsx("p",{className:"text-xs text-slate-500",children:"Panen Pending"})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(la,{className:"w-6 h-6 mx-auto text-emerald-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:w.filter($=>$.status==="graded").length}),h.jsx("p",{className:"text-xs text-slate-500",children:"Sudah Grade"})]}),h.jsxs(Tt,{className:"border-0 shadow-sm p-4 text-center",children:[h.jsx(rF,{className:"w-6 h-6 mx-auto text-blue-600 mb-2"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:w.reduce(($,V)=>$+(V.quantity_kg||0),0).toLocaleString()}),h.jsx("p",{className:"text-xs text-slate-500",children:"Total Kg"})]})]}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:h.jsxs(Ak,{defaultValue:"distributions",className:"space-y-4",children:[h.jsxs(mx,{className:"w-full bg-white shadow-sm p-1 h-auto",children:[h.jsxs(al,{value:"distributions",className:"flex-1 py-3 data-[state=active]:bg-indigo-50 data-[state=active]:text-indigo-700",children:[h.jsx(fy,{className:"w-4 h-4 mr-2"}),"Distribusi (",x.length,")"]}),h.jsxs(al,{value:"pending",className:"flex-1 py-3 data-[state=active]:bg-indigo-50 data-[state=active]:text-indigo-700",children:[h.jsx(Hf,{className:"w-4 h-4 mr-2"}),"Panen (",b.length,")"]}),h.jsxs(al,{value:"graded",className:"flex-1 py-3 data-[state=active]:bg-indigo-50 data-[state=active]:text-indigo-700",children:[h.jsx(Mv,{className:"w-4 h-4 mr-2"}),"Riwayat"]})]}),h.jsx(ol,{value:"distributions",className:"space-y-4",children:x.length>0?h.jsx("div",{className:"grid gap-4",children:x.map($=>h.jsx(Tt,{className:"border-0 shadow-sm overflow-hidden",children:h.jsxs(Pn,{className:"p-4",children:[h.jsxs("div",{className:"flex items-start justify-between mb-3",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"font-semibold text-slate-900",children:$.commodity_name}),h.jsxs("p",{className:"text-sm text-slate-500",children:["Dari: ",$.farmer_name]})]}),h.jsxs(ur,{className:"bg-indigo-100 text-indigo-700",children:["Klaim: Grade ",$.farmer_grade]})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm mb-4",children:[h.jsxs("div",{className:"p-2 bg-slate-50 rounded",children:[h.jsx("p",{className:"text-slate-500",children:"Jumlah"}),h.jsxs("p",{className:"font-semibold",children:[$.quantity_kg," Kg"]})]}),h.jsxs("div",{className:"p-2 bg-slate-50 rounded",children:[h.jsx("p",{className:"text-slate-500",children:"Tanggal Kirim"}),h.jsx("p",{className:"font-semibold",children:$.distribution_date?Uc(new Date($.distribution_date),"dd MMM yyyy",{locale:gg}):"-"})]})]}),$.notes&&h.jsxs("p",{className:"text-sm text-slate-600 bg-slate-50 p-2 rounded mb-4",children:["Catatan: ",$.notes]}),h.jsxs(pt,{className:"w-full bg-indigo-600 hover:bg-indigo-700",onClick:()=>y($),children:[h.jsx(Mv,{className:"w-4 h-4 mr-2"}),"Validasi & Grading"]})]})},$.id))}):h.jsx(Qa,{icon:fy,title:"Tidak ada distribusi pending",description:"Distribusi dari petani akan muncul di sini"})}),h.jsx(ol,{value:"pending",className:"space-y-4",children:b.length>0?h.jsx("div",{className:"grid gap-4",children:b.map($=>h.jsx(Tt,{className:"border-0 shadow-sm overflow-hidden",children:h.jsxs(Pn,{className:"p-4",children:[h.jsxs("div",{className:"flex items-start justify-between mb-3",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"font-semibold text-slate-900",children:$.commodity_name}),h.jsxs("p",{className:"text-sm text-slate-500",children:["Petani: ",I($.farmer_id)]})]}),h.jsx(ur,{className:"bg-amber-100 text-amber-700",children:"Pending Grade"})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm mb-4",children:[h.jsxs("div",{className:"p-2 bg-slate-50 rounded",children:[h.jsx("p",{className:"text-slate-500",children:"Jumlah"}),h.jsxs("p",{className:"font-semibold",children:[$.quantity_kg," Kg"]})]}),h.jsxs("div",{className:"p-2 bg-slate-50 rounded",children:[h.jsx("p",{className:"text-slate-500",children:"Tanggal Panen"}),h.jsx("p",{className:"font-semibold",children:$.harvest_date?Uc(new Date($.harvest_date),"dd MMM yyyy",{locale:gg}):"-"})]})]}),h.jsxs(pt,{className:"w-full bg-indigo-600 hover:bg-indigo-700",onClick:()=>{c($),p({grade:"",notes:"",price_per_kg:""})},children:[h.jsx(Mv,{className:"w-4 h-4 mr-2"}),"Lakukan Grading"]})]})},$.id))}):h.jsx(Qa,{icon:la,title:"Tidak ada hasil panen pending",description:"Semua hasil panen sudah di-grading"})}),h.jsxs(ol,{value:"graded",className:"space-y-4",children:[h.jsx("h3",{className:"font-medium text-slate-700",children:"Riwayat Distribusi"}),w.filter($=>$.status==="graded"||$.status==="rejected").length>0?h.jsx("div",{className:"grid gap-3",children:w.filter($=>$.status==="graded"||$.status==="rejected").map($=>{var K,Z;const V=$.offtaker_grade&&$.offtaker_grade!==$.farmer_grade;return h.jsxs(Tt,{className:"border-0 shadow-sm p-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("p",{className:"font-medium text-slate-900",children:$.commodity_name}),h.jsxs("p",{className:"text-sm text-slate-500",children:[$.quantity_kg," Kg • Dari: ",$.farmer_name]})]}),h.jsxs("div",{className:"text-right",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[V&&h.jsxs(ur,{variant:"outline",className:"text-amber-600 border-amber-200",children:[$.farmer_grade," ",h.jsx(G$,{className:"w-3 h-3 mx-1"})," ",$.offtaker_grade]}),!V&&h.jsx(ur,{className:((K=wj[$.offtaker_grade])==null?void 0:K.color)||"bg-slate-100 text-slate-700",children:((Z=wj[$.offtaker_grade])==null?void 0:Z.label)||$.offtaker_grade})]}),$.total_value&&h.jsxs("p",{className:"text-sm font-semibold text-emerald-600 mt-1",children:["Rp ",$.total_value.toLocaleString()]})]})]}),$.grade_difference_reason&&h.jsxs("p",{className:"text-sm text-amber-700 mt-2 bg-amber-50 p-2 rounded",children:[h.jsx("strong",{children:"Alasan:"})," ",$.grade_difference_reason]})]},$.id)})}):h.jsx(Qa,{icon:Mv,title:"Belum ada riwayat",description:"Riwayat grading akan muncul di sini"})]})]})})]}),h.jsx(sl,{open:!!s,onOpenChange:()=>c(null),children:h.jsxs(Ss,{className:"max-w-md",children:[h.jsx(ql,{children:h.jsx(zl,{children:"Grading Hasil Panen"})}),s&&h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"p-4 bg-slate-50 rounded-lg",children:h.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[h.jsxs("div",{children:[h.jsx("p",{className:"text-slate-500",children:"Komoditas"}),h.jsx("p",{className:"font-semibold",children:s.commodity_name})]}),h.jsxs("div",{children:[h.jsx("p",{className:"text-slate-500",children:"Jumlah"}),h.jsxs("p",{className:"font-semibold",children:[s.quantity_kg," Kg"]})]})]})}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Pilih Grade *"}),h.jsx("div",{className:"grid grid-cols-5 gap-2",children:["A","B","C","D","rejected"].map($=>h.jsx(pt,{type:"button",variant:d.grade===$?"default":"outline",className:`h-12 ${d.grade===$?"bg-indigo-600":""}`,onClick:()=>p(V=>({...V,grade:$})),children:$==="rejected"?"X":$},$))}),d.grade&&h.jsx("p",{className:"text-sm text-slate-500",children:(R=wj[d.grade])==null?void 0:R.description})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Harga per Kg (Rp) *"}),h.jsx(nn,{type:"number",value:d.price_per_kg,onChange:$=>p(V=>({...V,price_per_kg:$.target.value})),placeholder:"0"}),d.price_per_kg&&h.jsxs("p",{className:"text-sm text-emerald-600 font-medium",children:["Total: Rp ",(parseFloat(d.price_per_kg)*s.quantity_kg).toLocaleString()]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(St,{children:"Catatan"}),h.jsx(Ic,{value:d.notes,onChange:$=>p(V=>({...V,notes:$.target.value})),placeholder:"Catatan kualitas, kondisi, dll",rows:3})]}),h.jsxs(pt,{className:"w-full h-12 bg-indigo-600 hover:bg-indigo-700",onClick:()=>E.mutate(),disabled:!d.grade||!d.price_per_kg||E.isPending,children:[E.isPending?h.jsx(ti,{className:"w-5 h-5 mr-2 animate-spin"}):h.jsx(la,{className:"w-5 h-5 mr-2"}),"Simpan Grading"]})]})]})}),h.jsx(sl,{open:!!m,onOpenChange:()=>y(null),children:h.jsxs(Ss,{className:"max-w-md p-0",children:[h.jsx(ql,{className:"p-4 pb-0",children:h.jsx(zl,{children:"Validasi & Grading Distribusi"})}),m&&h.jsx(Kje,{distribution:m,offtaker:r,onSuccess:()=>{e.invalidateQueries({queryKey:["pending-distributions"]}),e.invalidateQueries({queryKey:["graded-distributions"]})},onClose:()=>y(null)})]})})]}):h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 to-slate-100 flex items-center justify-center p-6",children:h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:h.jsx(Tt,{className:"border-0 shadow-xl max-w-md w-full",children:h.jsxs(Pn,{className:"p-8 text-center",children:[h.jsx("div",{className:"w-20 h-20 rounded-full bg-amber-100 flex items-center justify-center mx-auto mb-6",children:h.jsx(ul,{className:"w-10 h-10 text-amber-600"})}),h.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Akses Ditolak"}),h.jsxs("p",{className:"text-slate-500 mb-4",children:["Email ",h.jsx("span",{className:"font-medium",children:t.email})," tidak terdaftar sebagai offtaker."]}),h.jsx("p",{className:"text-sm text-slate-400 mb-8",children:"Hubungi admin untuk mendaftarkan Anda sebagai offtaker."}),h.jsxs(pt,{variant:"outline",onClick:D,className:"w-full h-12",children:[h.jsx(mh,{className:"w-5 h-5 mr-2"}),"Keluar"]})]})})})}):h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-indigo-50 to-slate-100 flex items-center justify-center p-6",children:h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:h.jsx(Tt,{className:"border-0 shadow-xl max-w-md w-full",children:h.jsxs(Pn,{className:"p-8 text-center",children:[h.jsx("div",{className:"w-20 h-20 rounded-full bg-gradient-to-br from-indigo-500 to-indigo-600 flex items-center justify-center mx-auto mb-6",children:h.jsx(Tc,{className:"w-10 h-10 text-white"})}),h.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:"Portal Offtaker"}),h.jsx("p",{className:"text-slate-500 mb-8",children:"Masuk untuk melakukan grading hasil panen"}),h.jsx(pt,{onClick:k,className:"w-full h-12 bg-indigo-600 hover:bg-indigo-700 text-lg",children:"Masuk"})]})})})})}function Gje(e,t=[]){let n=[];function r(a,o){const s=M.createContext(o);s.displayName=a+"Context";const c=n.length;n=[...n,o];const d=m=>{var T;const{scope:y,children:b,...P}=m,x=((T=y==null?void 0:y[e])==null?void 0:T[c])||s,w=M.useMemo(()=>P,Object.values(P));return h.jsx(x.Provider,{value:w,children:b})};d.displayName=a+"Provider";function p(m,y){var x;const b=((x=y==null?void 0:y[e])==null?void 0:x[c])||s,P=M.useContext(b);if(P)return P;if(o!==void 0)return o;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[d,p]}const i=()=>{const a=n.map(o=>M.createContext(o));return function(s){const c=(s==null?void 0:s[e])||a;return M.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return i.scopeName=e,[r,Zje(i,...t)]}function Zje(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((s,{useScope:c,scopeName:d})=>{const m=c(a)[`__scope${d}`];return{...s,...m}},{});return M.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Yje=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],sK=Yje.reduce((e,t)=>{const n=sk(`Primitive.${t}`),r=M.forwardRef((i,a)=>{const{asChild:o,...s}=i,c=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(c,{...s,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Lk="Progress",Ik=100,[Xje]=Gje(Lk),[Qje,Jje]=Xje(Lk),lK=M.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:a=eOe,...o}=e;(i||i===0)&&!A$(i)&&console.error(tOe(`${i}`,"Progress"));const s=A$(i)?i:Ik;r!==null&&!k$(r,s)&&console.error(nOe(`${r}`,"Progress"));const c=k$(r,s)?r:null,d=Y0(c)?a(c,s):void 0;return h.jsx(Qje,{scope:n,value:c,max:s,children:h.jsx(sK.div,{"aria-valuemax":s,"aria-valuemin":0,"aria-valuenow":Y0(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":fK(c,s),"data-value":c??void 0,"data-max":s,...o,ref:t})})});lK.displayName=Lk;var uK="ProgressIndicator",cK=M.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,i=Jje(uK,n);return h.jsx(sK.div,{"data-state":fK(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});cK.displayName=uK;function eOe(e,t){return`${Math.round(e/t*100)}%`}function fK(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Y0(e){return typeof e=="number"}function A$(e){return Y0(e)&&!isNaN(e)&&e>0}function k$(e,t){return Y0(e)&&!isNaN(e)&&e<=t&&e>=0}function tOe(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Ik}\`.`}function nOe(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${Ik} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var dK=lK,rOe=cK;const YT=M.forwardRef(({className:e,value:t,...n},r)=>h.jsx(dK,{ref:r,className:fn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:h.jsx(rOe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));YT.displayName=dK.displayName;const C$=["#10b981","#f59e0b","#ef4444","#6b7280"],iOe={none:la,pest:eb,disease:ky,weather:JT,nutrient_deficiency:ky,water_shortage:J$,other:ul},aOe={none:"Tidak Ada Masalah",pest:"Hama",disease:"Penyakit",weather:"Cuaca",nutrient_deficiency:"Kekurangan Nutrisi",water_shortage:"Kekurangan Air",other:"Lainnya"};function oOe(){const[e,t]=M.useState("regency"),[n,r]=M.useState("all"),{data:i=[]}=bn({queryKey:["farmers"],queryFn:async()=>{let R=[];try{const K=await mt.entities.Farmer.list();R=Array.isArray(K)?K:[]}catch{}const $=await Tr.getEntities("farmers"),V=new Map;return R.forEach(K=>V.set(K.id,K)),$.array.forEach(K=>V.set(K.id,K)),Array.from(V.values())}}),{data:a=[]}=bn({queryKey:["plants"],queryFn:async()=>{let R=[];try{const K=await mt.entities.Plant.list();R=Array.isArray(K)?K:[]}catch{}const $=await Tr.getEntities("plants"),V=new Map;return R.forEach(K=>V.set(K.id,K)),$.forEach(K=>V.set(K.id,K)),Array.from(V.values())}}),o=Array.isArray(i)?i:[],s=Array.isArray(a)?a:[],{data:c=[]}=bn({queryKey:["harvests"],queryFn:async()=>{try{const R=await mt.entities.Harvest.list();return Array.isArray(R)?R:[]}catch{return[]}}}),d=Array.isArray(c)?c:[],p={regency:[...new Set(o.map(R=>R.regency).filter(Boolean))],district:[...new Set(o.map(R=>R.district).filter(Boolean))],village:[...new Set(o.map(R=>R.village).filter(Boolean))]},m=n==="all"?o:o.filter(R=>R[e]===n),y=m.map(R=>R.id),b=s.filter(R=>y.includes(R.land_id)),P=()=>{if(m.length===0)return{avg:0,distribution:[]};const $=m.filter(Z=>Z.productivity_percentage!==void 0),V=$.length>0?$.reduce((Z,ee)=>Z+(ee.productivity_percentage||0),0)/$.length:0,K=[{name:"Sangat Produktif (>80%)",value:m.filter(Z=>(Z.productivity_percentage||0)>80).length,color:"#10b981"},{name:"Produktif (60-80%)",value:m.filter(Z=>(Z.productivity_percentage||0)>=60&&(Z.productivity_percentage||0)<=80).length,color:"#22c55e"},{name:"Kurang Produktif (40-60%)",value:m.filter(Z=>(Z.productivity_percentage||0)>=40&&(Z.productivity_percentage||0)<60).length,color:"#f59e0b"},{name:"Tidak Produktif (<40%)",value:m.filter(Z=>(Z.productivity_percentage||0)<40).length,color:"#ef4444"}];return{avg:V,distribution:K}},x=()=>{if(b.length===0)return{statusDist:[],issueDist:[]};const $=[{name:"Produktif",value:b.filter(Z=>Z.productivity_status==="productive"||!Z.productivity_status).length},{name:"Kurang Produktif",value:b.filter(Z=>Z.productivity_status==="less_productive").length},{name:"Tidak Produktif",value:b.filter(Z=>Z.productivity_status==="not_productive").length}],V=b.reduce((Z,ee)=>{const ne=ee.issue_type||"none";return Z[ne]=(Z[ne]||0)+1,Z},{}),K=Object.entries(V).filter(([Z])=>Z!=="none").map(([Z,ee])=>({name:aOe[Z],value:ee,type:Z}));return{statusDist:$,issueDist:K}},w=()=>{const R=e==="regency"?"regency":e==="district"?"district":"village",$=o.reduce((V,K)=>{const Z=K[R]||"Tidak Diketahui";return V[Z]||(V[Z]={totalLands:0,totalArea:0,totalProductivity:0,landsWithProductivity:0}),V[Z].totalLands++,V[Z].totalArea+=K.area_hectares||0,K.productivity_percentage!==void 0&&(V[Z].totalProductivity+=K.productivity_percentage,V[Z].landsWithProductivity++),V},{});return Object.entries($).map(([V,K])=>({name:V,productivity:K.landsWithProductivity>0?Math.round(K.totalProductivity/K.landsWithProductivity):0,area:K.totalArea,lands:K.totalLands})).sort((V,K)=>K.productivity-V.productivity)},T=P(),E=x(),k=w(),D=d.reduce((R,$)=>($.grade&&(R[$.grade]=(R[$.grade]||0)+1),R),{}),I=["A","B","C","D","rejected"].map(R=>({name:R==="rejected"?"Rejected":`Grade ${R}`,value:D[R]||0}));return h.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100",children:h.jsxs("div",{className:"max-w-7xl mx-auto p-6 space-y-6",children:[h.jsxs(Rt.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold text-slate-900",children:"Monitoring Produktivitas"}),h.jsx("p",{className:"text-slate-500",children:"Pantau produktivitas lahan dan tanaman"})]}),h.jsxs("div",{className:"flex gap-3",children:[h.jsxs(Hr,{value:e,onValueChange:R=>{t(R),r("all")},children:[h.jsx(Dr,{className:"w-40",children:h.jsx(Gr,{})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"regency",children:"Kabupaten"}),h.jsx(Kt,{value:"district",children:"Kecamatan"}),h.jsx(Kt,{value:"village",children:"Desa"})]})]}),h.jsxs(Hr,{value:n,onValueChange:r,children:[h.jsx(Dr,{className:"w-48",children:h.jsx(Gr,{placeholder:"Semua Wilayah"})}),h.jsxs(Br,{children:[h.jsx(Kt,{value:"all",children:"Semua Wilayah"}),p[e].map(R=>h.jsx(Kt,{value:R,children:R},R))]})]})]})]}),h.jsxs(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsx(Pn,{className:"p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-12 h-12 rounded-xl bg-emerald-100 flex items-center justify-center",children:h.jsx(oF,{className:"w-6 h-6 text-emerald-600"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-slate-500",children:"Avg Produktivitas"}),h.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:[T.avg.toFixed(0),"%"]})]})]})})}),h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsx(Pn,{className:"p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-100 flex items-center justify-center",children:h.jsx(js,{className:"w-6 h-6 text-blue-600"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-slate-500",children:"Total Lahan"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:m.length})]})]})})}),h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsx(Pn,{className:"p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-12 h-12 rounded-xl bg-green-100 flex items-center justify-center",children:h.jsx(sa,{className:"w-6 h-6 text-green-600"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-slate-500",children:"Total Tanaman"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:b.length})]})]})})}),h.jsx(Tt,{className:"border-0 shadow-sm",children:h.jsx(Pn,{className:"p-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-12 h-12 rounded-xl bg-amber-100 flex items-center justify-center",children:h.jsx(ul,{className:"w-6 h-6 text-amber-600"})}),h.jsxs("div",{children:[h.jsx("p",{className:"text-sm text-slate-500",children:"Bermasalah"}),h.jsx("p",{className:"text-2xl font-bold text-slate-900",children:b.filter(R=>R.issue_type&&R.issue_type!=="none").length})]})]})})})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[h.jsx(Rt.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.2},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{children:h.jsx(Ei,{className:"text-lg",children:"Produktivitas per Wilayah"})}),h.jsx(Pn,{children:h.jsx("div",{className:"h-[300px]",children:h.jsx(hm,{width:"100%",height:"100%",children:h.jsxs(bT,{data:k.slice(0,8),layout:"vertical",children:[h.jsx(k0,{strokeDasharray:"3 3"}),h.jsx(Fh,{type:"number",domain:[0,100]}),h.jsx(zh,{dataKey:"name",type:"category",width:100,tick:{fontSize:12}}),h.jsx(wo,{formatter:R=>`${R}%`}),h.jsx(Nu,{dataKey:"productivity",fill:"#10b981",radius:[0,4,4,0]})]})})})})]})}),h.jsx(Rt.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{delay:.2},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{children:h.jsx(Ei,{className:"text-lg",children:"Distribusi Produktivitas Lahan"})}),h.jsx(Pn,{children:h.jsx("div",{className:"h-[300px]",children:h.jsx(hm,{width:"100%",height:"100%",children:h.jsxs(Y6,{children:[h.jsx(Gl,{data:T.distribution,cx:"50%",cy:"50%",outerRadius:100,dataKey:"value",label:({name:R,percent:$})=>`${($*100).toFixed(0)}%`,children:T.distribution.map((R,$)=>h.jsx(Sh,{fill:R.color},`cell-${$}`))}),h.jsx(wo,{}),h.jsx(Cc,{})]})})})})]})})]}),h.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(eb,{className:"w-5 h-5 text-amber-500"}),"Masalah Tanaman"]})}),h.jsx(Pn,{children:E.issueDist.length>0?h.jsx("div",{className:"space-y-3",children:E.issueDist.map(R=>{const $=iOe[R.type]||ul,V=(R.value/b.length*100).toFixed(1);return h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-100 flex items-center justify-center",children:h.jsx($,{className:"w-5 h-5 text-amber-600"})}),h.jsxs("div",{className:"flex-1",children:[h.jsxs("div",{className:"flex justify-between mb-1",children:[h.jsx("span",{className:"text-sm font-medium",children:R.name}),h.jsxs("span",{className:"text-sm text-slate-500",children:[R.value," (",V,"%)"]})]}),h.jsx(YT,{value:parseFloat(V),className:"h-2"})]})]},R.type)})}):h.jsxs("div",{className:"text-center py-8 text-slate-500",children:[h.jsx(la,{className:"w-12 h-12 mx-auto text-emerald-500 mb-2"}),h.jsx("p",{children:"Tidak ada masalah terdeteksi"})]})})]})}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{children:h.jsxs(Ei,{className:"text-lg flex items-center gap-2",children:[h.jsx(_j,{className:"w-5 h-5 text-blue-500"}),"Distribusi Grade Hasil Panen"]})}),h.jsx(Pn,{children:d.length>0?h.jsx("div",{className:"h-[250px]",children:h.jsx(hm,{width:"100%",height:"100%",children:h.jsxs(bT,{data:I,children:[h.jsx(k0,{strokeDasharray:"3 3"}),h.jsx(Fh,{dataKey:"name"}),h.jsx(zh,{}),h.jsx(wo,{}),h.jsx(Nu,{dataKey:"value",radius:[4,4,0,0],children:I.map((R,$)=>h.jsx(Sh,{fill:C$[Math.min($,C$.length-1)]},`cell-${$}`))})]})})}):h.jsxs("div",{className:"text-center py-8 text-slate-500",children:[h.jsx(_j,{className:"w-12 h-12 mx-auto text-slate-300 mb-2"}),h.jsx("p",{children:"Belum ada data hasil panen"})]})})]})})]}),h.jsx(Rt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},children:h.jsxs(Tt,{className:"border-0 shadow-sm",children:[h.jsx(Ti,{children:h.jsx(Ei,{className:"text-lg",children:"Detail Produktivitas per Wilayah"})}),h.jsx(Pn,{children:h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-sm",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b",children:[h.jsx("th",{className:"text-left py-3 px-4 font-medium text-slate-600",children:"Wilayah"}),h.jsx("th",{className:"text-center py-3 px-4 font-medium text-slate-600",children:"Jumlah Lahan"}),h.jsx("th",{className:"text-center py-3 px-4 font-medium text-slate-600",children:"Luas (Ha)"}),h.jsx("th",{className:"text-center py-3 px-4 font-medium text-slate-600",children:"Produktivitas"}),h.jsx("th",{className:"text-center py-3 px-4 font-medium text-slate-600",children:"Status"})]})}),h.jsx("tbody",{children:k.map(R=>h.jsxs("tr",{className:"border-b hover:bg-slate-50",children:[h.jsx("td",{className:"py-3 px-4 font-medium",children:R.name}),h.jsx("td",{className:"text-center py-3 px-4",children:R.lands}),h.jsx("td",{className:"text-center py-3 px-4",children:R.area.toFixed(2)}),h.jsx("td",{className:"text-center py-3 px-4",children:h.jsxs("div",{className:"flex items-center justify-center gap-2",children:[h.jsx(YT,{value:R.productivity,className:"w-20 h-2"}),h.jsxs("span",{className:"text-xs font-medium",children:[R.productivity,"%"]})]})}),h.jsx("td",{className:"text-center py-3 px-4",children:h.jsx(ur,{className:R.productivity>80?"bg-emerald-100 text-emerald-700":R.productivity>=60?"bg-green-100 text-green-700":R.productivity>=40?"bg-amber-100 text-amber-700":"bg-red-100 text-red-700",children:R.productivity>80?"Sangat Produktif":R.productivity>=60?"Produktif":R.productivity>=40?"Kurang Produktif":"Tidak Produktif"})})]},R.name))})]})})})]})})]})})}function sOe(){const[e,t]=M.useState(pg()),[n,r]=M.useState(0);M.useEffect(()=>{let a=!0;const o=async()=>{const d=await lOe(),p=await Tr.getPendingCount();a&&(t(d),r(p))};o();const s=()=>o();window.addEventListener("online",s),window.addEventListener("offline",s);const c=setInterval(o,3e3);return()=>{a=!1,window.removeEventListener("online",s),window.removeEventListener("offline",s),clearInterval(c)}},[]);const i=e&&n>0;return h.jsxs("div",{className:fn("flex items-center gap-3 px-4 py-3 rounded-xl transition-colors",!e&&"bg-amber-50",e&&i&&"bg-yellow-50",e&&!i&&"bg-emerald-50"),children:[!e&&h.jsx(Sj,{className:"w-5 h-5 text-amber-600"}),e&&i&&h.jsx(tF,{className:"w-5 h-5 text-yellow-600 animate-spin"}),e&&!i&&h.jsx(Pj,{className:"w-5 h-5 text-emerald-600"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("p",{className:fn("text-sm font-medium",e?i?"text-yellow-700":"text-emerald-700":"text-amber-700"),children:e?i?"Online (Sinkronisasi...)":"Online":"Offline"}),h.jsx("p",{className:"text-xs truncate opacity-80",children:e?i?`${n} data diproses`:"Data sinkron":"Data disimpan lokal"})]})]})}async function lOe(){if(!navigator.onLine)return!1;try{const e=new AbortController;return setTimeout(()=>e.abort(),3e3),await fetch("https://www.google.com/favicon.ico",{method:"HEAD",mode:"no-cors",cache:"no-store",signal:e.signal}),!0}catch{return!1}}const uOe=[{name:"Dashboard",page:"Dashboard",icon:kN},{name:"Petani",page:"Farmers",icon:ll},{name:"Lahan",page:"Lands",icon:js},{name:"Tanaman",page:"Plants",icon:sa},{name:"Produktivitas",page:"ProductivityMonitoring",icon:kN},{name:"Validator",page:"Validators",icon:gh},{name:"Offtaker",page:"Offtakers",icon:ll},{name:"Portal Petani",page:"FarmerPortal",icon:ll},{name:"Portal Validator",page:"ValidatorPortal",icon:gh},{name:"Portal Offtaker",page:"OfftakerPortal",icon:ll}];function cOe({children:e,currentPageName:t}){const[n,r]=M.useState(!1),i=cd(),a=o=>t===o||i.pathname.includes(o.toLowerCase());return h.jsxs("div",{className:"min-h-screen bg-slate-50",children:[h.jsx("div",{className:"lg:hidden fixed top-0 left-0 right-0 h-16 bg-white border-b border-slate-200 z-50 flex items-center justify-between px-4",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(pt,{variant:"ghost",size:"icon",onClick:()=>r(!0),children:h.jsx(t9,{className:"w-6 h-6"})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-emerald-500 to-emerald-600 flex items-center justify-center",children:h.jsx(sa,{className:"w-5 h-5 text-white"})}),h.jsx("span",{className:"font-bold text-slate-900",children:"AgroMonev"})]})]})}),n&&h.jsx("div",{className:"lg:hidden fixed inset-0 bg-black/50 z-50",onClick:()=>r(!1)}),h.jsxs("aside",{className:fn("fixed top-0 left-0 h-full w-64 bg-white border-r border-slate-200 z-50 transition-transform duration-300","lg:translate-x-0",n?"translate-x-0":"-translate-x-full"),children:[h.jsxs("div",{className:"p-6",children:[h.jsxs("div",{className:"flex items-center justify-between mb-8",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500 to-emerald-600 flex items-center justify-center shadow-lg shadow-emerald-500/25",children:h.jsx(sa,{className:"w-6 h-6 text-white"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"font-bold text-slate-900",children:"AgroMonev"}),h.jsx("p",{className:"text-xs text-slate-500",children:"Monitoring Pertanian"})]})]}),h.jsx(pt,{variant:"ghost",size:"icon",className:"lg:hidden",onClick:()=>r(!1),children:h.jsx(rb,{className:"w-5 h-5"})})]}),h.jsx("nav",{className:"space-y-1",children:uOe.map(o=>{const s=a(o.page);return h.jsxs(zo,{to:ei(o.page),onClick:()=>r(!1),className:fn("flex items-center gap-3 px-4 py-3 rounded-xl transition-all duration-200 group",s?"bg-emerald-50 text-emerald-700":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),children:[h.jsx(o.icon,{className:fn("w-5 h-5 transition-colors",s?"text-emerald-600":"text-slate-400 group-hover:text-slate-600")}),h.jsx("span",{className:"font-medium",children:o.name}),s&&h.jsx(tb,{className:"w-4 h-4 ml-auto text-emerald-600"})]},o.page)})})]}),h.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-4 border-t border-slate-100",children:h.jsx(sOe,{})})]}),h.jsx("main",{className:"lg:ml-64 pt-16 lg:pt-0 min-h-screen",children:e})]})}const fOe={Dashboard:hbe,Farmers:u1e,FarmerRegister:w1e,FarmerDetail:O1e,Lands:hSe,LandRegister:gSe,LandDetail:WPe,Plants:Nje,FarmerPortal:Vje,Validators:Tje,ValidatorPortal:Aje,Offtakers:Wje,OfftakerPortal:Hje,ProductivityMonitoring:oOe},Dk={mainPage:"Dashboard",Pages:fOe,Layout:cOe};function dOe(){const e=cd(),{isAuthenticated:t}=PE(),{Pages:n,mainPage:r}=Dk,i=r;return M.useEffect(()=>{const a=e.pathname;let o;if(a==="/"||a==="")o=i;else{const s=a.replace(/^\//,"").split("/")[0];o=Object.keys(n).find(p=>p.toLowerCase()===s.toLowerCase())||null}t&&o&&mt.appLogs.logUserInApp(o).catch(()=>{})},[e,t,n,i]),null}function hOe(){const e=cd(),{isAuthenticated:t}=PE(),{Pages:n,mainPage:r}=Dk,i=r,[a,o]=M.useState(!1);return M.useEffect(()=>{const s=e.pathname;let c;if(s==="/"||s==="")c=i;else{const d=s.replace(/^\//,"").split("/")[0];c=Object.keys(n).find(m=>m.toLowerCase()===d.toLowerCase())??null}t&&c&&(o(!0),mt.appLogs.logUserInApp(c).finally(()=>{setTimeout(()=>o(!1),600)}))},[e.pathname]),a?h.jsx("div",{className:"fixed bottom-4 right-4 z-50 rounded-xl bg-slate-900 text-white px-4 py-2 text-xs shadow-lg",children:"Mencatat aktivitas halaman…"}):null}const pOe=()=>h.jsx("div",{className:"flex flex-col items-center justify-center min-h-screen bg-gradient-to-b from-white to-slate-50",children:h.jsx("div",{className:"max-w-md w-full p-8 bg-white rounded-lg shadow-lg border border-slate-100",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 mb-6 rounded-full bg-orange-100",children:h.jsx("svg",{className:"w-8 h-8 text-orange-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),h.jsx("h1",{className:"text-3xl font-bold text-slate-900 mb-4",children:"Access Restricted"}),h.jsx("p",{className:"text-slate-600 mb-8",children:"You are not registered to use this application. Please contact the app administrator to request access."}),h.jsxs("div",{className:"p-4 bg-slate-50 rounded-md text-sm text-slate-600",children:[h.jsx("p",{children:"If you believe this is an error, you can:"}),h.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[h.jsx("li",{children:"Verify you are logged in with the correct account"}),h.jsx("li",{children:"Contact the app administrator for access"}),h.jsx("li",{children:"Try logging out and back in again"})]})]})]})})}),{Pages:hK,Layout:N$,mainPage:mOe}=Dk,pK=mOe,gOe=hK[pK],M$=({children:e,currentPageName:t})=>N$?h.jsx(N$,{currentPageName:t,children:e}):h.jsx(h.Fragment,{children:e}),vOe=()=>{const{isLoadingAuth:e,isLoadingPublicSettings:t,authError:n,navigateToLogin:r}=PE();if(t||e)return h.jsx("div",{className:"fixed inset-0 flex items-center justify-center",children:h.jsx("div",{className:"w-8 h-8 border-4 border-slate-200 border-t-slate-800 rounded-full animate-spin"})});if(n){if(n.type==="user_not_registered")return h.jsx(pOe,{});if(n.type==="auth_required")return r(),null}return h.jsxs(YG,{children:[h.jsx(hy,{path:"/",element:h.jsx(M$,{currentPageName:pK,children:h.jsx(gOe,{})})}),Object.entries(hK).map(([i,a])=>h.jsx(hy,{path:`/${i}`,element:h.jsx(M$,{currentPageName:i,children:h.jsx(a,{})})},i)),h.jsx(hy,{path:"*",element:h.jsx(hOe,{})})]})};function yOe(){return h.jsx(hQ,{children:h.jsxs(W7,{client:rG,children:[h.jsxs(rZ,{children:[h.jsx(dOe,{}),h.jsx(vOe,{})]}),h.jsx(x7,{})]})})}sH.createRoot(document.getElementById("root")).render(h.jsx(yOe,{}));