@inspectr/app 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,209 @@
1
+ import{r as QR,g as eF,v as y,a as m,Q as rs}from"./index.DFkTrL5a.js";var nr=QR();const tF=eF(nr);var u9={},rd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var z1={exports:{}},_c={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var H1;function rF(){if(H1)return _c;H1=1;var e=y,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function i(s,u,c){var d,f={},h=null,p=null;c!==void 0&&(h=""+c),u.key!==void 0&&(h=""+u.key),u.ref!==void 0&&(p=u.ref);for(d in u)n.call(u,d)&&!a.hasOwnProperty(d)&&(f[d]=u[d]);if(s&&s.defaultProps)for(d in u=s.defaultProps,u)f[d]===void 0&&(f[d]=u[d]);return{$$typeof:t,type:s,key:h,ref:p,props:f,_owner:o.current}}return _c.Fragment=r,_c.jsx=i,_c.jsxs=i,_c}var q1;function nF(){return q1||(q1=1,z1.exports=rF()),z1.exports}var l=nF(),Qk={exports:{}},oF=Qk.exports,U1;function aF(){return U1||(U1=1,function(e,t){(function(r,n){e.exports=n()})(oF,function(){var r=function(w,N){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,D){P.__proto__=D}||function(P,D){for(var z in D)Object.prototype.hasOwnProperty.call(D,z)&&(P[z]=D[z])})(w,N)},n=function(){return(n=Object.assign||function(w){for(var N,P=1,D=arguments.length;P<D;P++)for(var z in N=arguments[P])Object.prototype.hasOwnProperty.call(N,z)&&(w[z]=N[z]);return w}).apply(this,arguments)};function o(w,N,P){for(var D,z=0,K=N.length;z<K;z++)!D&&z in N||((D=D||Array.prototype.slice.call(N,0,z))[z]=N[z]);return w.concat(D||Array.prototype.slice.call(N))}var a=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:rd,i=Object.keys,s=Array.isArray;function u(w,N){return typeof N!="object"||i(N).forEach(function(P){w[P]=N[P]}),w}typeof Promise>"u"||a.Promise||(a.Promise=Promise);var c=Object.getPrototypeOf,d={}.hasOwnProperty;function f(w,N){return d.call(w,N)}function h(w,N){typeof N=="function"&&(N=N(c(w))),(typeof Reflect>"u"?i:Reflect.ownKeys)(N).forEach(function(P){g(w,P,N[P])})}var p=Object.defineProperty;function g(w,N,P,D){p(w,N,u(P&&f(P,"get")&&typeof P.get=="function"?{get:P.get,set:P.set,configurable:!0}:{value:P,configurable:!0,writable:!0},D))}function b(w){return{from:function(N){return w.prototype=Object.create(N.prototype),g(w.prototype,"constructor",w),{extend:h.bind(null,w.prototype)}}}}var v=Object.getOwnPropertyDescriptor,x=[].slice;function k(w,N,P){return x.call(w,N,P)}function E(w,N){return N(w)}function j(w){if(!w)throw new Error("Assertion Failed")}function S(w){a.setImmediate?setImmediate(w):setTimeout(w,0)}function C(w,N){if(typeof N=="string"&&f(w,N))return w[N];if(!N)return w;if(typeof N!="string"){for(var P=[],D=0,z=N.length;D<z;++D){var K=C(w,N[D]);P.push(K)}return P}var J=N.indexOf(".");if(J!==-1){var re=w[N.substr(0,J)];return re==null?void 0:C(re,N.substr(J+1))}}function O(w,N,P){if(w&&N!==void 0&&!("isFrozen"in Object&&Object.isFrozen(w)))if(typeof N!="string"&&"length"in N){j(typeof P!="string"&&"length"in P);for(var D=0,z=N.length;D<z;++D)O(w,N[D],P[D])}else{var K,J,re=N.indexOf(".");re!==-1?(K=N.substr(0,re),(J=N.substr(re+1))===""?P===void 0?s(w)&&!isNaN(parseInt(K))?w.splice(K,1):delete w[K]:w[K]=P:O(re=!(re=w[K])||!f(w,K)?w[K]={}:re,J,P)):P===void 0?s(w)&&!isNaN(parseInt(N))?w.splice(N,1):delete w[N]:w[N]=P}}function M(w){var N,P={};for(N in w)f(w,N)&&(P[N]=w[N]);return P}var A=[].concat;function T(w){return A.apply([],w)}var pt="BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(T([8,16,32,64].map(function(w){return["Int","Uint","Float"].map(function(N){return N+w+"Array"})}))).filter(function(w){return a[w]}),_=new Set(pt.map(function(w){return a[w]})),F=null;function $(w){return F=new WeakMap,w=function N(P){if(!P||typeof P!="object")return P;var D=F.get(P);if(D)return D;if(s(P)){D=[],F.set(P,D);for(var z=0,K=P.length;z<K;++z)D.push(N(P[z]))}else if(_.has(P.constructor))D=P;else{var J,re=c(P);for(J in D=re===Object.prototype?{}:Object.create(re),F.set(P,D),P)f(P,J)&&(D[J]=N(P[J]))}return D}(w),F=null,w}var I={}.toString;function R(w){return I.call(w).slice(8,-1)}var W=typeof Symbol<"u"?Symbol.iterator:"@@iterator",B=typeof W=="symbol"?function(w){var N;return w!=null&&(N=w[W])&&N.apply(w)}:function(){return null};function L(w,N){return N=w.indexOf(N),0<=N&&w.splice(N,1),0<=N}var q={};function U(w){var N,P,D,z;if(arguments.length===1){if(s(w))return w.slice();if(this===q&&typeof w=="string")return[w];if(z=B(w)){for(P=[];!(D=z.next()).done;)P.push(D.value);return P}if(w==null)return[w];if(typeof(N=w.length)!="number")return[w];for(P=new Array(N);N--;)P[N]=w[N];return P}for(N=arguments.length,P=new Array(N);N--;)P[N]=arguments[N];return P}var H=typeof Symbol<"u"?function(w){return w[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},Ke=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Ao=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(Ke),X={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function Y(w,N){this.name=w,this.message=N}function ae(w,N){return w+". Errors: "+Object.keys(N).map(function(P){return N[P].toString()}).filter(function(P,D,z){return z.indexOf(P)===D}).join(`
10
+ `)}function te(w,N,P,D){this.failures=N,this.failedKeys=D,this.successCount=P,this.message=ae(w,N)}function me(w,N){this.name="BulkError",this.failures=Object.keys(N).map(function(P){return N[P]}),this.failuresByPos=N,this.message=ae(w,this.failures)}b(Y).from(Error).extend({toString:function(){return this.name+": "+this.message}}),b(te).from(Y),b(me).from(Y);var Q=Ao.reduce(function(w,N){return w[N]=N+"Error",w},{}),ue=Y,G=Ao.reduce(function(w,N){var P=N+"Error";function D(z,K){this.name=P,z?typeof z=="string"?(this.message="".concat(z).concat(K?`
11
+ `+K:""),this.inner=K||null):typeof z=="object"&&(this.message="".concat(z.name," ").concat(z.message),this.inner=z):(this.message=X[N]||P,this.inner=null)}return b(D).from(ue),w[N]=D,w},{});G.Syntax=SyntaxError,G.Type=TypeError,G.Range=RangeError;var de=Ke.reduce(function(w,N){return w[N+"Error"]=G[N],w},{}),ie=Ao.reduce(function(w,N){return["Syntax","Type","Range"].indexOf(N)===-1&&(w[N+"Error"]=G[N]),w},{});function V(){}function ee(w){return w}function ne(w,N){return w==null||w===ee?N:function(P){return N(w(P))}}function ge(w,N){return function(){w.apply(this,arguments),N.apply(this,arguments)}}function Ee(w,N){return w===V?N:function(){var P=w.apply(this,arguments);P!==void 0&&(arguments[0]=P);var D=this.onsuccess,z=this.onerror;this.onsuccess=null,this.onerror=null;var K=N.apply(this,arguments);return D&&(this.onsuccess=this.onsuccess?ge(D,this.onsuccess):D),z&&(this.onerror=this.onerror?ge(z,this.onerror):z),K!==void 0?K:P}}function Pe(w,N){return w===V?N:function(){w.apply(this,arguments);var P=this.onsuccess,D=this.onerror;this.onsuccess=this.onerror=null,N.apply(this,arguments),P&&(this.onsuccess=this.onsuccess?ge(P,this.onsuccess):P),D&&(this.onerror=this.onerror?ge(D,this.onerror):D)}}function Ie(w,N){return w===V?N:function(P){var D=w.apply(this,arguments);u(P,D);var z=this.onsuccess,K=this.onerror;return this.onsuccess=null,this.onerror=null,P=N.apply(this,arguments),z&&(this.onsuccess=this.onsuccess?ge(z,this.onsuccess):z),K&&(this.onerror=this.onerror?ge(K,this.onerror):K),D===void 0?P===void 0?void 0:P:u(D,P)}}function nt(w,N){return w===V?N:function(){return N.apply(this,arguments)!==!1&&w.apply(this,arguments)}}function Me(w,N){return w===V?N:function(){var P=w.apply(this,arguments);if(P&&typeof P.then=="function"){for(var D=this,z=arguments.length,K=new Array(z);z--;)K[z]=arguments[z];return P.then(function(){return N.apply(D,K)})}return N.apply(this,arguments)}}ie.ModifyError=te,ie.DexieError=Y,ie.BulkError=me;var ot=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Ge(w){ot=w}var at={},mt=100,pt=typeof Promise>"u"?[]:function(){var w=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[w,c(w),w];var N=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[N,c(N),w]}(),Ke=pt[0],Ao=pt[1],pt=pt[2],Ao=Ao&&Ao.then,jt=Ke&&Ke.constructor,Ze=!!pt,$e=function(w,N){jn.push([w,N]),$t&&(queueMicrotask(Mr),$t=!1)},ut=!0,$t=!0,St=[],An=[],Zt=ee,Jr={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:V,pgp:!1,env:{},finalize:V},Ye=Jr,jn=[],Wr=0,Qn=[];function Be(w){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var N=this._PSD=Ye;if(typeof w!="function"){if(w!==at)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Xe(this,this._value))}this._state=null,this._value=null,++N.ref,function P(D,z){try{z(function(K){if(D._state===null){if(K===D)throw new TypeError("A promise cannot be resolved with itself.");var J=D._lib&&tr();K&&typeof K.then=="function"?P(D,function(re,se){K instanceof Be?K._then(re,se):K.then(re,se)}):(D._state=!0,D._value=K,Bt(D)),J&&_n()}},Xe.bind(null,D))}catch(K){Xe(D,K)}}(this,w)}var Kr={get:function(){var w=Ye,N=ke;function P(D,z){var K=this,J=!w.global&&(w!==Ye||N!==ke),re=J&&!st(),se=new Be(function(ce,pe){Tt(K,new ur(In(D,w,J,re),In(z,w,J,re),ce,pe,w))});return this._consoleTask&&(se._consoleTask=this._consoleTask),se}return P.prototype=at,P},set:function(w){g(this,"then",w&&w.prototype===at?Kr:{get:function(){return w},set:Kr.set})}};function ur(w,N,P,D,z){this.onFulfilled=typeof w=="function"?w:null,this.onRejected=typeof N=="function"?N:null,this.resolve=P,this.reject=D,this.psd=z}function Xe(w,N){var P,D;An.push(N),w._state===null&&(P=w._lib&&tr(),N=Zt(N),w._state=!1,w._value=N,D=w,St.some(function(z){return z._value===D._value})||St.push(D),Bt(w),P&&_n())}function Bt(w){var N=w._listeners;w._listeners=[];for(var P=0,D=N.length;P<D;++P)Tt(w,N[P]);var z=w._PSD;--z.ref||z.finalize(),Wr===0&&(++Wr,$e(function(){--Wr==0&&Je()},[]))}function Tt(w,N){if(w._state!==null){var P=w._state?N.onFulfilled:N.onRejected;if(P===null)return(w._state?N.resolve:N.reject)(w._value);++N.psd.ref,++Wr,$e(Qr,[P,w,N])}else w._listeners.push(N)}function Qr(w,N,P){try{var D,z=N._value;!N._state&&An.length&&(An=[]),D=ot&&N._consoleTask?N._consoleTask.run(function(){return w(z)}):w(z),N._state||An.indexOf(z)!==-1||function(K){for(var J=St.length;J;)if(St[--J]._value===K._value)return St.splice(J,1)}(N),P.resolve(D)}catch(K){P.reject(K)}finally{--Wr==0&&Je(),--P.psd.ref||P.psd.finalize()}}function Mr(){Nr(Jr,function(){tr()&&_n()})}function tr(){var w=ut;return $t=ut=!1,w}function _n(){var w,N,P;do for(;0<jn.length;)for(w=jn,jn=[],P=w.length,N=0;N<P;++N){var D=w[N];D[0].apply(null,D[1])}while(0<jn.length);$t=ut=!0}function Je(){var w=St;St=[],w.forEach(function(D){D._PSD.onunhandled.call(null,D._value,D)});for(var N=Qn.slice(0),P=N.length;P;)N[--P]()}function or(w){return new Be(at,!1,w)}function Et(w,N){var P=Ye;return function(){var D=tr(),z=Ye;try{return gr(P,!0),w.apply(this,arguments)}catch(K){N&&N(K)}finally{gr(z,!1),D&&_n()}}}h(Be.prototype,{then:Kr,_then:function(w,N){Tt(this,new ur(null,null,w,N,Ye))},catch:function(w){if(arguments.length===1)return this.then(null,w);var N=w,P=arguments[1];return typeof N=="function"?this.then(null,function(D){return(D instanceof N?P:or)(D)}):this.then(null,function(D){return(D&&D.name===N?P:or)(D)})},finally:function(w){return this.then(function(N){return Be.resolve(w()).then(function(){return N})},function(N){return Be.resolve(w()).then(function(){return or(N)})})},timeout:function(w,N){var P=this;return w<1/0?new Be(function(D,z){var K=setTimeout(function(){return z(new G.Timeout(N))},w);P.then(D,z).finally(clearTimeout.bind(null,K))}):this}}),typeof Symbol<"u"&&Symbol.toStringTag&&g(Be.prototype,Symbol.toStringTag,"Dexie.Promise"),Jr.env=cr(),h(Be,{all:function(){var w=U.apply(null,arguments).map(lt);return new Be(function(N,P){w.length===0&&N([]);var D=w.length;w.forEach(function(z,K){return Be.resolve(z).then(function(J){w[K]=J,--D||N(w)},P)})})},resolve:function(w){return w instanceof Be?w:w&&typeof w.then=="function"?new Be(function(N,P){w.then(N,P)}):new Be(at,!0,w)},reject:or,race:function(){var w=U.apply(null,arguments).map(lt);return new Be(function(N,P){w.map(function(D){return Be.resolve(D).then(N,P)})})},PSD:{get:function(){return Ye},set:function(w){return Ye=w}},totalEchoes:{get:function(){return ke}},newPSD:bt,usePSD:Nr,scheduler:{get:function(){return $e},set:function(w){$e=w}},rejectionMapper:{get:function(){return Zt},set:function(w){Zt=w}},follow:function(w,N){return new Be(function(P,D){return bt(function(z,K){var J=Ye;J.unhandleds=[],J.onunhandled=K,J.finalize=ge(function(){var re,se=this;re=function(){se.unhandleds.length===0?z():K(se.unhandleds[0])},Qn.push(function ce(){re(),Qn.splice(Qn.indexOf(ce),1)}),++Wr,$e(function(){--Wr==0&&Je()},[])},J.finalize),w()},N,P,D)})}}),jt&&(jt.allSettled&&g(Be,"allSettled",function(){var w=U.apply(null,arguments).map(lt);return new Be(function(N){w.length===0&&N([]);var P=w.length,D=new Array(P);w.forEach(function(z,K){return Be.resolve(z).then(function(J){return D[K]={status:"fulfilled",value:J}},function(J){return D[K]={status:"rejected",reason:J}}).then(function(){return--P||N(D)})})})}),jt.any&&typeof AggregateError<"u"&&g(Be,"any",function(){var w=U.apply(null,arguments).map(lt);return new Be(function(N,P){w.length===0&&P(new AggregateError([]));var D=w.length,z=new Array(D);w.forEach(function(K,J){return Be.resolve(K).then(function(re){return N(re)},function(re){z[J]=re,--D||P(new AggregateError(z))})})})}),jt.withResolvers&&(Be.withResolvers=jt.withResolvers));var Lt={awaits:0,echoes:0,id:0},en=0,Yr=[],hr=0,ke=0,_e=0;function bt(w,N,P,D){var z=Ye,K=Object.create(z);return K.parent=z,K.ref=0,K.global=!1,K.id=++_e,Jr.env,K.env=Ze?{Promise:Be,PromiseProp:{value:Be,configurable:!0,writable:!0},all:Be.all,race:Be.race,allSettled:Be.allSettled,any:Be.any,resolve:Be.resolve,reject:Be.reject}:{},N&&u(K,N),++z.ref,K.finalize=function(){--this.parent.ref||this.parent.finalize()},D=Nr(K,w,P,D),K.ref===0&&K.finalize(),D}function Ot(){return Lt.id||(Lt.id=++en),++Lt.awaits,Lt.echoes+=mt,Lt.id}function st(){return!!Lt.awaits&&(--Lt.awaits==0&&(Lt.id=0),Lt.echoes=Lt.awaits*mt,!0)}function lt(w){return Lt.echoes&&w&&w.constructor===jt?(Ot(),w.then(function(N){return st(),N},function(N){return st(),Wt(N)})):w}function tn(){var w=Yr[Yr.length-1];Yr.pop(),gr(w,!1)}function gr(w,N){var P,D=Ye;(N?!Lt.echoes||hr++&&w===Ye:!hr||--hr&&w===Ye)||queueMicrotask(N?function(z){++ke,Lt.echoes&&--Lt.echoes!=0||(Lt.echoes=Lt.awaits=Lt.id=0),Yr.push(Ye),gr(z,!0)}.bind(null,w):tn),w!==Ye&&(Ye=w,D===Jr&&(Jr.env=cr()),Ze&&(P=Jr.env.Promise,N=w.env,(D.global||w.global)&&(Object.defineProperty(a,"Promise",N.PromiseProp),P.all=N.all,P.race=N.race,P.resolve=N.resolve,P.reject=N.reject,N.allSettled&&(P.allSettled=N.allSettled),N.any&&(P.any=N.any))))}function cr(){var w=a.Promise;return Ze?{Promise:w,PromiseProp:Object.getOwnPropertyDescriptor(a,"Promise"),all:w.all,race:w.race,allSettled:w.allSettled,any:w.any,resolve:w.resolve,reject:w.reject}:{}}function Nr(w,N,P,D,z){var K=Ye;try{return gr(w,!0),N(P,D,z)}finally{gr(K,!1)}}function In(w,N,P,D){return typeof w!="function"?w:function(){var z=Ye;P&&Ot(),gr(N,!0);try{return w.apply(this,arguments)}finally{gr(z,!1),D&&queueMicrotask(st)}}}function eo(w){Promise===jt&&Lt.echoes===0?hr===0?w():enqueueNativeMicroTask(w):setTimeout(w,0)}(""+Ao).indexOf("[native code]")===-1&&(Ot=st=V);var Wt=Be.reject,un="￿",rn="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Kt="String expected.",En=[],Vo="__dbnames",Si="readonly",Ba="readwrite";function fo(w,N){return w?N?function(){return w.apply(this,arguments)&&N.apply(this,arguments)}:w:N}var Nl={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Oi(w){return typeof w!="string"||/\./.test(w)?function(N){return N}:function(N){return N[w]===void 0&&w in N&&delete(N=$(N))[w],N}}function Sl(){throw G.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function Xt(w,N){try{var P=Qf(w),D=Qf(N);if(P!==D)return P==="Array"?1:D==="Array"?-1:P==="binary"?1:D==="binary"?-1:P==="string"?1:D==="string"?-1:P==="Date"?1:D!=="Date"?NaN:-1;switch(P){case"number":case"Date":case"string":return N<w?1:w<N?-1:0;case"binary":return function(z,K){for(var J=z.length,re=K.length,se=J<re?J:re,ce=0;ce<se;++ce)if(z[ce]!==K[ce])return z[ce]<K[ce]?-1:1;return J===re?0:J<re?-1:1}(em(w),em(N));case"Array":return function(z,K){for(var J=z.length,re=K.length,se=J<re?J:re,ce=0;ce<se;++ce){var pe=Xt(z[ce],K[ce]);if(pe!==0)return pe}return J===re?0:J<re?-1:1}(w,N)}}catch{}return NaN}function Qf(w){var N=typeof w;return N!="object"?N:ArrayBuffer.isView(w)?"binary":(w=R(w),w==="ArrayBuffer"?"binary":w)}function em(w){return w instanceof Uint8Array?w:ArrayBuffer.isView(w)?new Uint8Array(w.buffer,w.byteOffset,w.byteLength):new Uint8Array(w)}function Ol(w,N,P){var D=w.schema.yProps;return D?(N&&0<P.numFailures&&(N=N.filter(function(z,K){return!P.failures[K]})),Promise.all(D.map(function(z){return z=z.updatesTable,N?w.db.table(z).where("k").anyOf(N).delete():w.db.table(z).clear()})).then(function(){return P})):P}var tm=(Sr.prototype._trans=function(w,N,P){var D=this._tx||Ye.trans,z=this.name,K=ot&&typeof console<"u"&&console.createTask&&console.createTask("Dexie: ".concat(w==="readonly"?"read":"write"," ").concat(this.name));function J(ce,pe,oe){if(!oe.schema[z])throw new G.NotFound("Table "+z+" not part of transaction");return N(oe.idbtrans,oe)}var re=tr();try{var se=D&&D.db._novip===this.db._novip?D===Ye.trans?D._promise(w,J,P):bt(function(){return D._promise(w,J,P)},{trans:D,transless:Ye.transless||Ye}):function ce(pe,oe,ve,le){if(pe.idbdb&&(pe._state.openComplete||Ye.letThrough||pe._vip)){var fe=pe._createTransaction(oe,ve,pe._dbSchema);try{fe.create(),pe._state.PR1398_maxLoop=3}catch(be){return be.name===Q.InvalidState&&pe.isOpen()&&0<--pe._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),pe.close({disableAutoOpen:!1}),pe.open().then(function(){return ce(pe,oe,ve,le)})):Wt(be)}return fe._promise(oe,function(be,he){return bt(function(){return Ye.trans=fe,le(be,he,fe)})}).then(function(be){if(oe==="readwrite")try{fe.idbtrans.commit()}catch{}return oe==="readonly"?be:fe._completion.then(function(){return be})})}if(pe._state.openComplete)return Wt(new G.DatabaseClosed(pe._state.dbOpenError));if(!pe._state.isBeingOpened){if(!pe._state.autoOpen)return Wt(new G.DatabaseClosed);pe.open().catch(V)}return pe._state.dbReadyPromise.then(function(){return ce(pe,oe,ve,le)})}(this.db,w,[this.name],J);return K&&(se._consoleTask=K,se=se.catch(function(ce){return console.trace(ce),Wt(ce)})),se}finally{re&&_n()}},Sr.prototype.get=function(w,N){var P=this;return w&&w.constructor===Object?this.where(w).first(N):w==null?Wt(new G.Type("Invalid argument to Table.get()")):this._trans("readonly",function(D){return P.core.get({trans:D,key:w}).then(function(z){return P.hook.reading.fire(z)})}).then(N)},Sr.prototype.where=function(w){if(typeof w=="string")return new this.db.WhereClause(this,w);if(s(w))return new this.db.WhereClause(this,"[".concat(w.join("+"),"]"));var N=i(w);if(N.length===1)return this.where(N[0]).equals(w[N[0]]);var P=this.schema.indexes.concat(this.schema.primKey).filter(function(re){if(re.compound&&N.every(function(ce){return 0<=re.keyPath.indexOf(ce)})){for(var se=0;se<N.length;++se)if(N.indexOf(re.keyPath[se])===-1)return!1;return!0}return!1}).sort(function(re,se){return re.keyPath.length-se.keyPath.length})[0];if(P&&this.db._maxKey!==un){var K=P.keyPath.slice(0,N.length);return this.where(K).equals(K.map(function(se){return w[se]}))}!P&&ot&&console.warn("The query ".concat(JSON.stringify(w)," on ").concat(this.name," would benefit from a ")+"compound index [".concat(N.join("+"),"]"));var D=this.schema.idxByName;function z(re,se){return Xt(re,se)===0}var J=N.reduce(function(oe,se){var ce=oe[0],pe=oe[1],oe=D[se],ve=w[se];return[ce||oe,ce||!oe?fo(pe,oe&&oe.multi?function(le){return le=C(le,se),s(le)&&le.some(function(fe){return z(ve,fe)})}:function(le){return z(ve,C(le,se))}):pe]},[null,null]),K=J[0],J=J[1];return K?this.where(K.name).equals(w[K.keyPath]).filter(J):P?this.filter(J):this.where(N).equals("")},Sr.prototype.filter=function(w){return this.toCollection().and(w)},Sr.prototype.count=function(w){return this.toCollection().count(w)},Sr.prototype.offset=function(w){return this.toCollection().offset(w)},Sr.prototype.limit=function(w){return this.toCollection().limit(w)},Sr.prototype.each=function(w){return this.toCollection().each(w)},Sr.prototype.toArray=function(w){return this.toCollection().toArray(w)},Sr.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},Sr.prototype.orderBy=function(w){return new this.db.Collection(new this.db.WhereClause(this,s(w)?"[".concat(w.join("+"),"]"):w))},Sr.prototype.reverse=function(){return this.toCollection().reverse()},Sr.prototype.mapToClass=function(w){var N,P=this.db,D=this.name;function z(){return N!==null&&N.apply(this,arguments)||this}(this.schema.mappedClass=w).prototype instanceof Sl&&(function(se,ce){if(typeof ce!="function"&&ce!==null)throw new TypeError("Class extends value "+String(ce)+" is not a constructor or null");function pe(){this.constructor=se}r(se,ce),se.prototype=ce===null?Object.create(ce):(pe.prototype=ce.prototype,new pe)}(z,N=w),Object.defineProperty(z.prototype,"db",{get:function(){return P},enumerable:!1,configurable:!0}),z.prototype.table=function(){return D},w=z);for(var K=new Set,J=w.prototype;J;J=c(J))Object.getOwnPropertyNames(J).forEach(function(se){return K.add(se)});function re(se){if(!se)return se;var ce,pe=Object.create(w.prototype);for(ce in se)if(!K.has(ce))try{pe[ce]=se[ce]}catch{}return pe}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=re,this.hook("reading",re),w},Sr.prototype.defineClass=function(){return this.mapToClass(function(w){u(this,w)})},Sr.prototype.add=function(w,N){var P=this,D=this.schema.primKey,z=D.auto,K=D.keyPath,J=w;return K&&z&&(J=Oi(K)(w)),this._trans("readwrite",function(re){return P.core.mutate({trans:re,type:"add",keys:N!=null?[N]:null,values:[J]})}).then(function(re){return re.numFailures?Be.reject(re.failures[0]):re.lastResult}).then(function(re){if(K)try{O(w,K,re)}catch{}return re})},Sr.prototype.update=function(w,N){return typeof w!="object"||s(w)?this.where(":id").equals(w).modify(N):(w=C(w,this.schema.primKey.keyPath),w===void 0?Wt(new G.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(w).modify(N))},Sr.prototype.put=function(w,N){var P=this,D=this.schema.primKey,z=D.auto,K=D.keyPath,J=w;return K&&z&&(J=Oi(K)(w)),this._trans("readwrite",function(re){return P.core.mutate({trans:re,type:"put",values:[J],keys:N!=null?[N]:null})}).then(function(re){return re.numFailures?Be.reject(re.failures[0]):re.lastResult}).then(function(re){if(K)try{O(w,K,re)}catch{}return re})},Sr.prototype.delete=function(w){var N=this;return this._trans("readwrite",function(P){return N.core.mutate({trans:P,type:"delete",keys:[w]}).then(function(D){return Ol(N,[w],D)}).then(function(D){return D.numFailures?Be.reject(D.failures[0]):void 0})})},Sr.prototype.clear=function(){var w=this;return this._trans("readwrite",function(N){return w.core.mutate({trans:N,type:"deleteRange",range:Nl}).then(function(P){return Ol(w,null,P)})}).then(function(N){return N.numFailures?Be.reject(N.failures[0]):void 0})},Sr.prototype.bulkGet=function(w){var N=this;return this._trans("readonly",function(P){return N.core.getMany({keys:w,trans:P}).then(function(D){return D.map(function(z){return N.hook.reading.fire(z)})})})},Sr.prototype.bulkAdd=function(w,N,P){var D=this,z=Array.isArray(N)?N:void 0,K=(P=P||(z?void 0:N))?P.allKeys:void 0;return this._trans("readwrite",function(J){var ce=D.schema.primKey,re=ce.auto,ce=ce.keyPath;if(ce&&z)throw new G.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(z&&z.length!==w.length)throw new G.InvalidArgument("Arguments objects and keys must have the same length");var se=w.length,ce=ce&&re?w.map(Oi(ce)):w;return D.core.mutate({trans:J,type:"add",keys:z,values:ce,wantResults:K}).then(function(fe){var oe=fe.numFailures,ve=fe.results,le=fe.lastResult,fe=fe.failures;if(oe===0)return K?ve:le;throw new me("".concat(D.name,".bulkAdd(): ").concat(oe," of ").concat(se," operations failed"),fe)})})},Sr.prototype.bulkPut=function(w,N,P){var D=this,z=Array.isArray(N)?N:void 0,K=(P=P||(z?void 0:N))?P.allKeys:void 0;return this._trans("readwrite",function(J){var ce=D.schema.primKey,re=ce.auto,ce=ce.keyPath;if(ce&&z)throw new G.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(z&&z.length!==w.length)throw new G.InvalidArgument("Arguments objects and keys must have the same length");var se=w.length,ce=ce&&re?w.map(Oi(ce)):w;return D.core.mutate({trans:J,type:"put",keys:z,values:ce,wantResults:K}).then(function(fe){var oe=fe.numFailures,ve=fe.results,le=fe.lastResult,fe=fe.failures;if(oe===0)return K?ve:le;throw new me("".concat(D.name,".bulkPut(): ").concat(oe," of ").concat(se," operations failed"),fe)})})},Sr.prototype.bulkUpdate=function(w){var N=this,P=this.core,D=w.map(function(J){return J.key}),z=w.map(function(J){return J.changes}),K=[];return this._trans("readwrite",function(J){return P.getMany({trans:J,keys:D,cache:"clone"}).then(function(re){var se=[],ce=[];w.forEach(function(oe,ve){var le=oe.key,fe=oe.changes,be=re[ve];if(be){for(var he=0,ye=Object.keys(fe);he<ye.length;he++){var je=ye[he],Se=fe[je];if(je===N.schema.primKey.keyPath){if(Xt(Se,le)!==0)throw new G.Constraint("Cannot update primary key in bulkUpdate()")}else O(be,je,Se)}K.push(ve),se.push(le),ce.push(be)}});var pe=se.length;return P.mutate({trans:J,type:"put",keys:se,values:ce,updates:{keys:D,changeSpecs:z}}).then(function(oe){var ve=oe.numFailures,le=oe.failures;if(ve===0)return pe;for(var fe=0,be=Object.keys(le);fe<be.length;fe++){var he,ye=be[fe],je=K[Number(ye)];je!=null&&(he=le[ye],delete le[ye],le[je]=he)}throw new me("".concat(N.name,".bulkUpdate(): ").concat(ve," of ").concat(pe," operations failed"),le)})})})},Sr.prototype.bulkDelete=function(w){var N=this,P=w.length;return this._trans("readwrite",function(D){return N.core.mutate({trans:D,type:"delete",keys:w}).then(function(z){return Ol(N,w,z)})}).then(function(J){var z=J.numFailures,K=J.lastResult,J=J.failures;if(z===0)return K;throw new me("".concat(N.name,".bulkDelete(): ").concat(z," of ").concat(P," operations failed"),J)})},Sr);function Sr(){}function Ci(w){function N(J,re){if(re){for(var se=arguments.length,ce=new Array(se-1);--se;)ce[se-1]=arguments[se];return P[J].subscribe.apply(null,ce),w}if(typeof J=="string")return P[J]}var P={};N.addEventType=K;for(var D=1,z=arguments.length;D<z;++D)K(arguments[D]);return N;function K(J,re,se){if(typeof J!="object"){var ce;re=re||nt;var pe={subscribers:[],fire:se=se||V,subscribe:function(oe){pe.subscribers.indexOf(oe)===-1&&(pe.subscribers.push(oe),pe.fire=re(pe.fire,oe))},unsubscribe:function(oe){pe.subscribers=pe.subscribers.filter(function(ve){return ve!==oe}),pe.fire=pe.subscribers.reduce(re,se)}};return P[J]=N[J]=pe}i(ce=J).forEach(function(oe){var ve=ce[oe];if(s(ve))K(oe,ce[oe][0],ce[oe][1]);else{if(ve!=="asap")throw new G.InvalidArgument("Invalid event config");var le=K(oe,ee,function(){for(var fe=arguments.length,be=new Array(fe);fe--;)be[fe]=arguments[fe];le.subscribers.forEach(function(he){S(function(){he.apply(null,be)})})})}})}}function Os(w,N){return b(N).from({prototype:w}),N}function Pi(w,N){return!(w.filter||w.algorithm||w.or)&&(N?w.justLimit:!w.replayFilter)}function Nc(w,N){w.filter=fo(w.filter,N)}function Sc(w,N,P){var D=w.replayFilter;w.replayFilter=D?function(){return fo(D(),N())}:N,w.justLimit=P&&!D}function Cl(w,N){if(w.isPrimKey)return N.primaryKey;var P=N.getIndexByKeyPath(w.index);if(!P)throw new G.Schema("KeyPath "+w.index+" on object store "+N.name+" is not indexed");return P}function xe(w,N,P){var D=Cl(w,N.schema);return N.openCursor({trans:P,values:!w.keysOnly,reverse:w.dir==="prev",unique:!!w.unique,query:{index:D,range:w.range}})}function we(w,N,P,D){var z=w.replayFilter?fo(w.filter,w.replayFilter()):w.filter;if(w.or){var K={},J=function(re,se,ce){var pe,oe;z&&!z(se,ce,function(ve){return se.stop(ve)},function(ve){return se.fail(ve)})||((oe=""+(pe=se.primaryKey))=="[object ArrayBuffer]"&&(oe=""+new Uint8Array(pe)),f(K,oe)||(K[oe]=!0,N(re,se,ce)))};return Promise.all([w.or._iterate(J,P),De(xe(w,D,P),w.algorithm,J,!w.keysOnly&&w.valueMapper)])}return De(xe(w,D,P),fo(w.algorithm,z),N,!w.keysOnly&&w.valueMapper)}function De(w,N,P,D){var z=Et(D?function(K,J,re){return P(D(K),J,re)}:P);return w.then(function(K){if(K)return K.start(function(){var J=function(){return K.continue()};N&&!N(K,function(re){return J=re},function(re){K.stop(re),J=V},function(re){K.fail(re),J=V})||z(K.value,K,function(re){return J=re}),J()})})}var Te=(ct.prototype.execute=function(w){var N=this["@@propmod"];if(N.add!==void 0){var P=N.add;if(s(P))return o(o([],s(w)?w:[],!0),P).sort();if(typeof P=="number")return(Number(w)||0)+P;if(typeof P=="bigint")try{return BigInt(w)+P}catch{return BigInt(0)+P}throw new TypeError("Invalid term ".concat(P))}if(N.remove!==void 0){var D=N.remove;if(s(D))return s(w)?w.filter(function(z){return!D.includes(z)}).sort():[];if(typeof D=="number")return Number(w)-D;if(typeof D=="bigint")try{return BigInt(w)-D}catch{return BigInt(0)-D}throw new TypeError("Invalid subtrahend ".concat(D))}return P=(P=N.replacePrefix)===null||P===void 0?void 0:P[0],P&&typeof w=="string"&&w.startsWith(P)?N.replacePrefix[1]+w.substring(P.length):w},ct);function ct(w){this["@@propmod"]=w}var ht=(Ve.prototype._read=function(w,N){var P=this._ctx;return P.error?P.table._trans(null,Wt.bind(null,P.error)):P.table._trans("readonly",w).then(N)},Ve.prototype._write=function(w){var N=this._ctx;return N.error?N.table._trans(null,Wt.bind(null,N.error)):N.table._trans("readwrite",w,"locked")},Ve.prototype._addAlgorithm=function(w){var N=this._ctx;N.algorithm=fo(N.algorithm,w)},Ve.prototype._iterate=function(w,N){return we(this._ctx,w,N,this._ctx.table.core)},Ve.prototype.clone=function(w){var N=Object.create(this.constructor.prototype),P=Object.create(this._ctx);return w&&u(P,w),N._ctx=P,N},Ve.prototype.raw=function(){return this._ctx.valueMapper=null,this},Ve.prototype.each=function(w){var N=this._ctx;return this._read(function(P){return we(N,w,P,N.table.core)})},Ve.prototype.count=function(w){var N=this;return this._read(function(P){var D=N._ctx,z=D.table.core;if(Pi(D,!0))return z.count({trans:P,query:{index:Cl(D,z.schema),range:D.range}}).then(function(J){return Math.min(J,D.limit)});var K=0;return we(D,function(){return++K,!1},P,z).then(function(){return K})}).then(w)},Ve.prototype.sortBy=function(w,N){var P=w.split(".").reverse(),D=P[0],z=P.length-1;function K(se,ce){return ce?K(se[P[ce]],ce-1):se[D]}var J=this._ctx.dir==="next"?1:-1;function re(se,ce){return Xt(K(se,z),K(ce,z))*J}return this.toArray(function(se){return se.sort(re)}).then(N)},Ve.prototype.toArray=function(w){var N=this;return this._read(function(P){var D=N._ctx;if(D.dir==="next"&&Pi(D,!0)&&0<D.limit){var z=D.valueMapper,K=Cl(D,D.table.core.schema);return D.table.core.query({trans:P,limit:D.limit,values:!0,query:{index:K,range:D.range}}).then(function(re){return re=re.result,z?re.map(z):re})}var J=[];return we(D,function(re){return J.push(re)},P,D.table.core).then(function(){return J})},w)},Ve.prototype.offset=function(w){var N=this._ctx;return w<=0||(N.offset+=w,Pi(N)?Sc(N,function(){var P=w;return function(D,z){return P===0||(P===1?--P:z(function(){D.advance(P),P=0}),!1)}}):Sc(N,function(){var P=w;return function(){return--P<0}})),this},Ve.prototype.limit=function(w){return this._ctx.limit=Math.min(this._ctx.limit,w),Sc(this._ctx,function(){var N=w;return function(P,D,z){return--N<=0&&D(z),0<=N}},!0),this},Ve.prototype.until=function(w,N){return Nc(this._ctx,function(P,D,z){return!w(P.value)||(D(z),N)}),this},Ve.prototype.first=function(w){return this.limit(1).toArray(function(N){return N[0]}).then(w)},Ve.prototype.last=function(w){return this.reverse().first(w)},Ve.prototype.filter=function(w){var N;return Nc(this._ctx,function(P){return w(P.value)}),(N=this._ctx).isMatch=fo(N.isMatch,w),this},Ve.prototype.and=function(w){return this.filter(w)},Ve.prototype.or=function(w){return new this.db.WhereClause(this._ctx.table,w,this)},Ve.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},Ve.prototype.desc=function(){return this.reverse()},Ve.prototype.eachKey=function(w){var N=this._ctx;return N.keysOnly=!N.isMatch,this.each(function(P,D){w(D.key,D)})},Ve.prototype.eachUniqueKey=function(w){return this._ctx.unique="unique",this.eachKey(w)},Ve.prototype.eachPrimaryKey=function(w){var N=this._ctx;return N.keysOnly=!N.isMatch,this.each(function(P,D){w(D.primaryKey,D)})},Ve.prototype.keys=function(w){var N=this._ctx;N.keysOnly=!N.isMatch;var P=[];return this.each(function(D,z){P.push(z.key)}).then(function(){return P}).then(w)},Ve.prototype.primaryKeys=function(w){var N=this._ctx;if(N.dir==="next"&&Pi(N,!0)&&0<N.limit)return this._read(function(D){var z=Cl(N,N.table.core.schema);return N.table.core.query({trans:D,values:!1,limit:N.limit,query:{index:z,range:N.range}})}).then(function(D){return D.result}).then(w);N.keysOnly=!N.isMatch;var P=[];return this.each(function(D,z){P.push(z.primaryKey)}).then(function(){return P}).then(w)},Ve.prototype.uniqueKeys=function(w){return this._ctx.unique="unique",this.keys(w)},Ve.prototype.firstKey=function(w){return this.limit(1).keys(function(N){return N[0]}).then(w)},Ve.prototype.lastKey=function(w){return this.reverse().firstKey(w)},Ve.prototype.distinct=function(){var w=this._ctx,w=w.index&&w.table.schema.idxByName[w.index];if(!w||!w.multi)return this;var N={};return Nc(this._ctx,function(z){var D=z.primaryKey.toString(),z=f(N,D);return N[D]=!0,!z}),this},Ve.prototype.modify=function(w){var N=this,P=this._ctx;return this._write(function(D){var z,K,J;J=typeof w=="function"?w:(z=i(w),K=z.length,function(ye){for(var je=!1,Se=0;Se<K;++Se){var Oe=z[Se],Le=w[Oe],We=C(ye,Oe);Le instanceof Te?(O(ye,Oe,Le.execute(We)),je=!0):We!==Le&&(O(ye,Oe,Le),je=!0)}return je});var re=P.table.core,oe=re.schema.primaryKey,se=oe.outbound,ce=oe.extractKey,pe=200,oe=N.db._options.modifyChunkSize;oe&&(pe=typeof oe=="object"?oe[re.name]||oe["*"]||200:oe);function ve(ye,Oe){var Se=Oe.failures,Oe=Oe.numFailures;fe+=ye-Oe;for(var Le=0,We=i(Se);Le<We.length;Le++){var ze=We[Le];le.push(Se[ze])}}var le=[],fe=0,be=[],he=w===Mt;return N.clone().primaryKeys().then(function(ye){function je(Oe){var Le=Math.min(pe,ye.length-Oe),We=ye.slice(Oe,Oe+Le);return(he?Promise.resolve([]):re.getMany({trans:D,keys:We,cache:"immutable"})).then(function(ze){var Ue=[],tt=[],Qe=se?[]:null,it=he?We:[];if(!he)for(var Rt=0;Rt<Le;++Rt){var rr=ze[Rt],It={value:$(rr),primKey:ye[Oe+Rt]};J.call(It,It.value,It)!==!1&&(It.value==null?it.push(ye[Oe+Rt]):se||Xt(ce(rr),ce(It.value))===0?(tt.push(It.value),se&&Qe.push(ye[Oe+Rt])):(it.push(ye[Oe+Rt]),Ue.push(It.value)))}return Promise.resolve(0<Ue.length&&re.mutate({trans:D,type:"add",values:Ue}).then(function(nn){for(var Pt in nn.failures)it.splice(parseInt(Pt),1);ve(Ue.length,nn)})).then(function(){return(0<tt.length||Se&&typeof w=="object")&&re.mutate({trans:D,type:"put",keys:Qe,values:tt,criteria:Se,changeSpec:typeof w!="function"&&w,isAdditionalChunk:0<Oe}).then(function(nn){return ve(tt.length,nn)})}).then(function(){return(0<it.length||Se&&he)&&re.mutate({trans:D,type:"delete",keys:it,criteria:Se,isAdditionalChunk:0<Oe}).then(function(nn){return Ol(P.table,it,nn)}).then(function(nn){return ve(it.length,nn)})}).then(function(){return ye.length>Oe+Le&&je(Oe+pe)})})}var Se=Pi(P)&&P.limit===1/0&&(typeof w!="function"||he)&&{index:P.index,range:P.range};return je(0).then(function(){if(0<le.length)throw new te("Error modifying one or more objects",le,fe,be);return ye.length})})})},Ve.prototype.delete=function(){var w=this._ctx,N=w.range;return!Pi(w)||w.table.schema.yProps||!w.isPrimKey&&N.type!==3?this.modify(Mt):this._write(function(P){var D=w.table.core.schema.primaryKey,z=N;return w.table.core.count({trans:P,query:{index:D,range:z}}).then(function(K){return w.table.core.mutate({trans:P,type:"deleteRange",range:z}).then(function(se){var re=se.failures,se=se.numFailures;if(se)throw new te("Could not delete some values",Object.keys(re).map(function(ce){return re[ce]}),K-se);return K-se})})})},Ve);function Ve(){}var Mt=function(w,N){return N.value=null};function Or(w,N){return w<N?-1:w===N?0:1}function Rr(w,N){return N<w?-1:w===N?0:1}function yt(w,N,P){return w=w instanceof Cr?new w.Collection(w):w,w._ctx.error=new(P||TypeError)(N),w}function _t(w){return new w.Collection(w,function(){return Gr("")}).limit(0)}function Ut(w,N,P,D){var z,K,J,re,se,ce,pe,oe=P.length;if(!P.every(function(fe){return typeof fe=="string"}))return yt(w,Kt);function ve(fe){z=fe==="next"?function(he){return he.toUpperCase()}:function(he){return he.toLowerCase()},K=fe==="next"?function(he){return he.toLowerCase()}:function(he){return he.toUpperCase()},J=fe==="next"?Or:Rr;var be=P.map(function(he){return{lower:K(he),upper:z(he)}}).sort(function(he,ye){return J(he.lower,ye.lower)});re=be.map(function(he){return he.upper}),se=be.map(function(he){return he.lower}),pe=(ce=fe)==="next"?"":D}ve("next"),w=new w.Collection(w,function(){return br(re[0],se[oe-1]+D)}),w._ondirectionchange=function(fe){ve(fe)};var le=0;return w._addAlgorithm(function(fe,be,he){var ye=fe.key;if(typeof ye!="string")return!1;var je=K(ye);if(N(je,se,le))return!0;for(var Se=null,Oe=le;Oe<oe;++Oe){var Le=function(We,ze,Ue,tt,Qe,it){for(var Rt=Math.min(We.length,tt.length),rr=-1,It=0;It<Rt;++It){var nn=ze[It];if(nn!==tt[It])return Qe(We[It],Ue[It])<0?We.substr(0,It)+Ue[It]+Ue.substr(It+1):Qe(We[It],tt[It])<0?We.substr(0,It)+tt[It]+Ue.substr(It+1):0<=rr?We.substr(0,rr)+ze[rr]+Ue.substr(rr+1):null;Qe(We[It],nn)<0&&(rr=It)}return Rt<tt.length&&it==="next"?We+Ue.substr(We.length):Rt<We.length&&it==="prev"?We.substr(0,Ue.length):rr<0?null:We.substr(0,rr)+tt[rr]+Ue.substr(rr+1)}(ye,je,re[Oe],se[Oe],J,ce);Le===null&&Se===null?le=Oe+1:(Se===null||0<J(Se,Le))&&(Se=Le)}return be(Se!==null?function(){fe.continue(Se+pe)}:he),!1}),w}function br(w,N,P,D){return{type:2,lower:w,upper:N,lowerOpen:P,upperOpen:D}}function Gr(w){return{type:1,lower:w,upper:w}}var Cr=(Object.defineProperty(an.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),an.prototype.between=function(w,N,P,D){P=P!==!1,D=D===!0;try{return 0<this._cmp(w,N)||this._cmp(w,N)===0&&(P||D)&&(!P||!D)?_t(this):new this.Collection(this,function(){return br(w,N,!P,!D)})}catch{return yt(this,rn)}},an.prototype.equals=function(w){return w==null?yt(this,rn):new this.Collection(this,function(){return Gr(w)})},an.prototype.above=function(w){return w==null?yt(this,rn):new this.Collection(this,function(){return br(w,void 0,!0)})},an.prototype.aboveOrEqual=function(w){return w==null?yt(this,rn):new this.Collection(this,function(){return br(w,void 0,!1)})},an.prototype.below=function(w){return w==null?yt(this,rn):new this.Collection(this,function(){return br(void 0,w,!1,!0)})},an.prototype.belowOrEqual=function(w){return w==null?yt(this,rn):new this.Collection(this,function(){return br(void 0,w)})},an.prototype.startsWith=function(w){return typeof w!="string"?yt(this,Kt):this.between(w,w+un,!0,!0)},an.prototype.startsWithIgnoreCase=function(w){return w===""?this.startsWith(w):Ut(this,function(N,P){return N.indexOf(P[0])===0},[w],un)},an.prototype.equalsIgnoreCase=function(w){return Ut(this,function(N,P){return N===P[0]},[w],"")},an.prototype.anyOfIgnoreCase=function(){var w=U.apply(q,arguments);return w.length===0?_t(this):Ut(this,function(N,P){return P.indexOf(N)!==-1},w,"")},an.prototype.startsWithAnyOfIgnoreCase=function(){var w=U.apply(q,arguments);return w.length===0?_t(this):Ut(this,function(N,P){return P.some(function(D){return N.indexOf(D)===0})},w,un)},an.prototype.anyOf=function(){var w=this,N=U.apply(q,arguments),P=this._cmp;try{N.sort(P)}catch{return yt(this,rn)}if(N.length===0)return _t(this);var D=new this.Collection(this,function(){return br(N[0],N[N.length-1])});D._ondirectionchange=function(K){P=K==="next"?w._ascending:w._descending,N.sort(P)};var z=0;return D._addAlgorithm(function(K,J,re){for(var se=K.key;0<P(se,N[z]);)if(++z===N.length)return J(re),!1;return P(se,N[z])===0||(J(function(){K.continue(N[z])}),!1)}),D},an.prototype.notEqual=function(w){return this.inAnyRange([[-1/0,w],[w,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},an.prototype.noneOf=function(){var w=U.apply(q,arguments);if(w.length===0)return new this.Collection(this);try{w.sort(this._ascending)}catch{return yt(this,rn)}var N=w.reduce(function(P,D){return P?P.concat([[P[P.length-1][1],D]]):[[-1/0,D]]},null);return N.push([w[w.length-1],this.db._maxKey]),this.inAnyRange(N,{includeLowers:!1,includeUppers:!1})},an.prototype.inAnyRange=function(ye,N){var P=this,D=this._cmp,z=this._ascending,K=this._descending,J=this._min,re=this._max;if(ye.length===0)return _t(this);if(!ye.every(function(je){return je[0]!==void 0&&je[1]!==void 0&&z(je[0],je[1])<=0}))return yt(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",G.InvalidArgument);var se=!N||N.includeLowers!==!1,ce=N&&N.includeUppers===!0,pe,oe=z;function ve(je,Se){return oe(je[0],Se[0])}try{(pe=ye.reduce(function(je,Se){for(var Oe=0,Le=je.length;Oe<Le;++Oe){var We=je[Oe];if(D(Se[0],We[1])<0&&0<D(Se[1],We[0])){We[0]=J(We[0],Se[0]),We[1]=re(We[1],Se[1]);break}}return Oe===Le&&je.push(Se),je},[])).sort(ve)}catch{return yt(this,rn)}var le=0,fe=ce?function(je){return 0<z(je,pe[le][1])}:function(je){return 0<=z(je,pe[le][1])},be=se?function(je){return 0<K(je,pe[le][0])}:function(je){return 0<=K(je,pe[le][0])},he=fe,ye=new this.Collection(this,function(){return br(pe[0][0],pe[pe.length-1][1],!se,!ce)});return ye._ondirectionchange=function(je){oe=je==="next"?(he=fe,z):(he=be,K),pe.sort(ve)},ye._addAlgorithm(function(je,Se,Oe){for(var Le,We=je.key;he(We);)if(++le===pe.length)return Se(Oe),!1;return!fe(Le=We)&&!be(Le)||(P._cmp(We,pe[le][1])===0||P._cmp(We,pe[le][0])===0||Se(function(){oe===z?je.continue(pe[le][0]):je.continue(pe[le][1])}),!1)}),ye},an.prototype.startsWithAnyOf=function(){var w=U.apply(q,arguments);return w.every(function(N){return typeof N=="string"})?w.length===0?_t(this):this.inAnyRange(w.map(function(N){return[N,N+un]})):yt(this,"startsWithAnyOf() only works with strings")},an);function an(){}function sn(w){return Et(function(N){return Oc(N),w(N.target.error),!1})}function Oc(w){w.stopPropagation&&w.stopPropagation(),w.preventDefault&&w.preventDefault()}var Cc="storagemutated",Cb="x-storagemutated-1",Ai=Ci(null,Cc),LR=(la.prototype._lock=function(){return j(!Ye.global),++this._reculock,this._reculock!==1||Ye.global||(Ye.lockOwnerFor=this),this},la.prototype._unlock=function(){if(j(!Ye.global),--this._reculock==0)for(Ye.global||(Ye.lockOwnerFor=null);0<this._blockedFuncs.length&&!this._locked();){var w=this._blockedFuncs.shift();try{Nr(w[1],w[0])}catch{}}return this},la.prototype._locked=function(){return this._reculock&&Ye.lockOwnerFor!==this},la.prototype.create=function(w){var N=this;if(!this.mode)return this;var P=this.db.idbdb,D=this.db._state.dbOpenError;if(j(!this.idbtrans),!w&&!P)switch(D&&D.name){case"DatabaseClosedError":throw new G.DatabaseClosed(D);case"MissingAPIError":throw new G.MissingAPI(D.message,D);default:throw new G.OpenFailed(D)}if(!this.active)throw new G.TransactionInactive;return j(this._completion._state===null),(w=this.idbtrans=w||(this.db.core||P).transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})).onerror=Et(function(z){Oc(z),N._reject(w.error)}),w.onabort=Et(function(z){Oc(z),N.active&&N._reject(new G.Abort(w.error)),N.active=!1,N.on("abort").fire(z)}),w.oncomplete=Et(function(){N.active=!1,N._resolve(),"mutatedParts"in w&&Ai.storagemutated.fire(w.mutatedParts)}),this},la.prototype._promise=function(w,N,P){var D=this;if(w==="readwrite"&&this.mode!=="readwrite")return Wt(new G.ReadOnly("Transaction is readonly"));if(!this.active)return Wt(new G.TransactionInactive);if(this._locked())return new Be(function(K,J){D._blockedFuncs.push([function(){D._promise(w,N,P).then(K,J)},Ye])});if(P)return bt(function(){var K=new Be(function(J,re){D._lock();var se=N(J,re,D);se&&se.then&&se.then(J,re)});return K.finally(function(){return D._unlock()}),K._lib=!0,K});var z=new Be(function(K,J){var re=N(K,J,D);re&&re.then&&re.then(K,J)});return z._lib=!0,z},la.prototype._root=function(){return this.parent?this.parent._root():this},la.prototype.waitFor=function(w){var N,P=this._root(),D=Be.resolve(w);P._waitingFor?P._waitingFor=P._waitingFor.then(function(){return D}):(P._waitingFor=D,P._waitingQueue=[],N=P.idbtrans.objectStore(P.storeNames[0]),function K(){for(++P._spinCount;P._waitingQueue.length;)P._waitingQueue.shift()();P._waitingFor&&(N.get(-1/0).onsuccess=K)}());var z=P._waitingFor;return new Be(function(K,J){D.then(function(re){return P._waitingQueue.push(Et(K.bind(null,re)))},function(re){return P._waitingQueue.push(Et(J.bind(null,re)))}).finally(function(){P._waitingFor===z&&(P._waitingFor=null)})})},la.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new G.Abort))},la.prototype.table=function(w){var N=this._memoizedTables||(this._memoizedTables={});if(f(N,w))return N[w];var P=this.schema[w];if(!P)throw new G.NotFound("Table "+w+" not part of transaction");return P=new this.db.Table(w,P,this),P.core=this.db.core.table(w),N[w]=P},la);function la(){}function Pb(w,N,P,D,z,K,J,re){return{name:w,keyPath:N,unique:P,multi:D,auto:z,compound:K,src:(P&&!J?"&":"")+(D?"*":"")+(z?"++":"")+N1(N),type:re}}function N1(w){return typeof w=="string"?w:w?"["+[].join.call(w,"+")+"]":""}function Ab(w,N,P){return{name:w,primKey:N,indexes:P,mappedClass:null,idxByName:(D=function(z){return[z.name,z]},P.reduce(function(z,K,J){return J=D(K,J),J&&(z[J[0]]=J[1]),z},{}))};var D}var Pc=function(w){try{return w.only([[]]),Pc=function(){return[[]]},[[]]}catch{return Pc=function(){return un},un}};function Tb(w){return w==null?function(){}:typeof w=="string"?(N=w).split(".").length===1?function(P){return P[N]}:function(P){return C(P,N)}:function(P){return C(P,w)};var N}function S1(w){return[].slice.call(w)}var RR=0;function Ac(w){return w==null?":id":typeof w=="string"?w:"[".concat(w.join("+"),"]")}function FR(w,N,se){function D(he){if(he.type===3)return null;if(he.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var le=he.lower,fe=he.upper,be=he.lowerOpen,he=he.upperOpen;return le===void 0?fe===void 0?null:N.upperBound(fe,!!he):fe===void 0?N.lowerBound(le,!!be):N.bound(le,fe,!!be,!!he)}function z(ve){var le,fe=ve.name;return{name:fe,schema:ve,mutate:function(be){var he=be.trans,ye=be.type,je=be.keys,Se=be.values,Oe=be.range;return new Promise(function(Le,We){Le=Et(Le);var ze=he.objectStore(fe),Ue=ze.keyPath==null,tt=ye==="put"||ye==="add";if(!tt&&ye!=="delete"&&ye!=="deleteRange")throw new Error("Invalid operation type: "+ye);var Qe,it=(je||Se||{length:1}).length;if(je&&Se&&je.length!==Se.length)throw new Error("Given keys array must have same length as given values array.");if(it===0)return Le({numFailures:0,failures:{},results:[],lastResult:void 0});function Rt(Un){++nn,Oc(Un)}var rr=[],It=[],nn=0;if(ye==="deleteRange"){if(Oe.type===4)return Le({numFailures:nn,failures:It,results:[],lastResult:void 0});Oe.type===3?rr.push(Qe=ze.clear()):rr.push(Qe=ze.delete(D(Oe)))}else{var Ue=tt?Ue?[Se,je]:[Se,null]:[je,null],Pt=Ue[0],Ln=Ue[1];if(tt)for(var Rn=0;Rn<it;++Rn)rr.push(Qe=Ln&&Ln[Rn]!==void 0?ze[ye](Pt[Rn],Ln[Rn]):ze[ye](Pt[Rn])),Qe.onerror=Rt;else for(Rn=0;Rn<it;++Rn)rr.push(Qe=ze[ye](Pt[Rn])),Qe.onerror=Rt}function mm(Un){Un=Un.target.result,rr.forEach(function(As,Gb){return As.error!=null&&(It[Gb]=As.error)}),Le({numFailures:nn,failures:It,results:ye==="delete"?je:rr.map(function(As){return As.result}),lastResult:Un})}Qe.onerror=function(Un){Rt(Un),mm(Un)},Qe.onsuccess=mm})},getMany:function(be){var he=be.trans,ye=be.keys;return new Promise(function(je,Se){je=Et(je);for(var Oe,Le=he.objectStore(fe),We=ye.length,ze=new Array(We),Ue=0,tt=0,Qe=function(rr){rr=rr.target,ze[rr._pos]=rr.result,++tt===Ue&&je(ze)},it=sn(Se),Rt=0;Rt<We;++Rt)ye[Rt]!=null&&((Oe=Le.get(ye[Rt]))._pos=Rt,Oe.onsuccess=Qe,Oe.onerror=it,++Ue);Ue===0&&je(ze)})},get:function(be){var he=be.trans,ye=be.key;return new Promise(function(je,Se){je=Et(je);var Oe=he.objectStore(fe).get(ye);Oe.onsuccess=function(Le){return je(Le.target.result)},Oe.onerror=sn(Se)})},query:(le=ce,function(be){return new Promise(function(he,ye){he=Et(he);var je,Se,Oe,Ue=be.trans,Le=be.values,We=be.limit,Qe=be.query,ze=We===1/0?void 0:We,tt=Qe.index,Qe=Qe.range,Ue=Ue.objectStore(fe),tt=tt.isPrimaryKey?Ue:Ue.index(tt.name),Qe=D(Qe);if(We===0)return he({result:[]});le?((ze=Le?tt.getAll(Qe,ze):tt.getAllKeys(Qe,ze)).onsuccess=function(it){return he({result:it.target.result})},ze.onerror=sn(ye)):(je=0,Se=!Le&&"openKeyCursor"in tt?tt.openKeyCursor(Qe):tt.openCursor(Qe),Oe=[],Se.onsuccess=function(it){var Rt=Se.result;return Rt?(Oe.push(Le?Rt.value:Rt.primaryKey),++je===We?he({result:Oe}):void Rt.continue()):he({result:Oe})},Se.onerror=sn(ye))})}),openCursor:function(be){var he=be.trans,ye=be.values,je=be.query,Se=be.reverse,Oe=be.unique;return new Promise(function(Le,We){Le=Et(Le);var tt=je.index,ze=je.range,Ue=he.objectStore(fe),Ue=tt.isPrimaryKey?Ue:Ue.index(tt.name),tt=Se?Oe?"prevunique":"prev":Oe?"nextunique":"next",Qe=!ye&&"openKeyCursor"in Ue?Ue.openKeyCursor(D(ze),tt):Ue.openCursor(D(ze),tt);Qe.onerror=sn(We),Qe.onsuccess=Et(function(it){var Rt,rr,It,nn,Pt=Qe.result;Pt?(Pt.___id=++RR,Pt.done=!1,Rt=Pt.continue.bind(Pt),rr=(rr=Pt.continuePrimaryKey)&&rr.bind(Pt),It=Pt.advance.bind(Pt),nn=function(){throw new Error("Cursor not stopped")},Pt.trans=he,Pt.stop=Pt.continue=Pt.continuePrimaryKey=Pt.advance=function(){throw new Error("Cursor not started")},Pt.fail=Et(We),Pt.next=function(){var Ln=this,Rn=1;return this.start(function(){return Rn--?Ln.continue():Ln.stop()}).then(function(){return Ln})},Pt.start=function(Ln){function Rn(){if(Qe.result)try{Ln()}catch(Un){Pt.fail(Un)}else Pt.done=!0,Pt.start=function(){throw new Error("Cursor behind last entry")},Pt.stop()}var mm=new Promise(function(Un,As){Un=Et(Un),Qe.onerror=sn(As),Pt.fail=As,Pt.stop=function(Gb){Pt.stop=Pt.continue=Pt.continuePrimaryKey=Pt.advance=nn,Un(Gb)}});return Qe.onsuccess=Et(function(Un){Qe.onsuccess=Rn,Rn()}),Pt.continue=Rt,Pt.continuePrimaryKey=rr,Pt.advance=It,Rn(),mm},Le(Pt)):Le(null)},We)})},count:function(be){var he=be.query,ye=be.trans,je=he.index,Se=he.range;return new Promise(function(Oe,Le){var We=ye.objectStore(fe),ze=je.isPrimaryKey?We:We.index(je.name),We=D(Se),ze=We?ze.count(We):ze.count();ze.onsuccess=Et(function(Ue){return Oe(Ue.target.result)}),ze.onerror=sn(Le)})}}}var K,J,re,pe=(J=se,re=S1((K=w).objectStoreNames),{schema:{name:K.name,tables:re.map(function(ve){return J.objectStore(ve)}).map(function(ve){var le=ve.keyPath,he=ve.autoIncrement,fe=s(le),be={},he={name:ve.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:le==null,compound:fe,keyPath:le,autoIncrement:he,unique:!0,extractKey:Tb(le)},indexes:S1(ve.indexNames).map(function(ye){return ve.index(ye)}).map(function(Oe){var je=Oe.name,Se=Oe.unique,Le=Oe.multiEntry,Oe=Oe.keyPath,Le={name:je,compound:s(Oe),keyPath:Oe,unique:Se,multiEntry:Le,extractKey:Tb(Oe)};return be[Ac(Oe)]=Le}),getIndexByKeyPath:function(ye){return be[Ac(ye)]}};return be[":id"]=he.primaryKey,le!=null&&(be[Ac(le)]=he.primaryKey),he})},hasGetAll:0<re.length&&"getAll"in J.objectStore(re[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}),se=pe.schema,ce=pe.hasGetAll,pe=se.tables.map(z),oe={};return pe.forEach(function(ve){return oe[ve.name]=ve}),{stack:"dbcore",transaction:w.transaction.bind(w),table:function(ve){if(!oe[ve])throw new Error("Table '".concat(ve,"' not found"));return oe[ve]},MIN_KEY:-1/0,MAX_KEY:Pc(N),schema:se}}function $R(w,N,P,D){var z=P.IDBKeyRange;return P.indexedDB,{dbcore:(D=FR(N,z,D),w.dbcore.reduce(function(K,J){return J=J.create,n(n({},K),J(K))},D))}}function rm(w,D){var P=D.db,D=$R(w._middlewares,P,w._deps,D);w.core=D.dbcore,w.tables.forEach(function(z){var K=z.name;w.core.schema.tables.some(function(J){return J.name===K})&&(z.core=w.core.table(K),w[K]instanceof w.Table&&(w[K].core=z.core))})}function nm(w,N,P,D){P.forEach(function(z){var K=D[z];N.forEach(function(J){var re=function se(ce,pe){return v(ce,pe)||(ce=c(ce))&&se(ce,pe)}(J,z);(!re||"value"in re&&re.value===void 0)&&(J===w.Transaction.prototype||J instanceof w.Transaction?g(J,z,{get:function(){return this.table(z)},set:function(se){p(this,z,{value:se,writable:!0,configurable:!0,enumerable:!0})}}):J[z]=new w.Table(z,K))})})}function Mb(w,N){N.forEach(function(P){for(var D in P)P[D]instanceof w.Table&&delete P[D]})}function BR(w,N){return w._cfg.version-N._cfg.version}function zR(w,N,P,D){var z=w._dbSchema;P.objectStoreNames.contains("$meta")&&!z.$meta&&(z.$meta=Ab("$meta",C1("")[0],[]),w._storeNames.push("$meta"));var K=w._createTransaction("readwrite",w._storeNames,z);K.create(P),K._completion.catch(D);var J=K._reject.bind(K),re=Ye.transless||Ye;bt(function(){return Ye.trans=K,Ye.transless=re,N!==0?(rm(w,P),ce=N,((se=K).storeNames.includes("$meta")?se.table("$meta").get("version").then(function(pe){return pe??ce}):Be.resolve(ce)).then(function(pe){return ve=pe,le=K,fe=P,be=[],pe=(oe=w)._versions,he=oe._dbSchema=am(0,oe.idbdb,fe),(pe=pe.filter(function(ye){return ye._cfg.version>=ve})).length!==0?(pe.forEach(function(ye){be.push(function(){var je=he,Se=ye._cfg.dbschema;im(oe,je,fe),im(oe,Se,fe),he=oe._dbSchema=Se;var Oe=_b(je,Se);Oe.add.forEach(function(tt){Ib(fe,tt[0],tt[1].primKey,tt[1].indexes)}),Oe.change.forEach(function(tt){if(tt.recreate)throw new G.Upgrade("Not yet support for changing primary key");var Qe=fe.objectStore(tt.name);tt.add.forEach(function(it){return om(Qe,it)}),tt.change.forEach(function(it){Qe.deleteIndex(it.name),om(Qe,it)}),tt.del.forEach(function(it){return Qe.deleteIndex(it)})});var Le=ye._cfg.contentUpgrade;if(Le&&ye._cfg.version>ve){rm(oe,fe),le._memoizedTables={};var We=M(Se);Oe.del.forEach(function(tt){We[tt]=je[tt]}),Mb(oe,[oe.Transaction.prototype]),nm(oe,[oe.Transaction.prototype],i(We),We),le.schema=We;var ze,Ue=H(Le);return Ue&&Ot(),Oe=Be.follow(function(){var tt;(ze=Le(le))&&Ue&&(tt=st.bind(null,null),ze.then(tt,tt))}),ze&&typeof ze.then=="function"?Be.resolve(ze):Oe.then(function(){return ze})}}),be.push(function(je){var Se,Oe,Le=ye._cfg.dbschema;Se=Le,Oe=je,[].slice.call(Oe.db.objectStoreNames).forEach(function(We){return Se[We]==null&&Oe.db.deleteObjectStore(We)}),Mb(oe,[oe.Transaction.prototype]),nm(oe,[oe.Transaction.prototype],oe._storeNames,oe._dbSchema),le.schema=oe._dbSchema}),be.push(function(je){oe.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(oe.idbdb.version/10)===ye._cfg.version?(oe.idbdb.deleteObjectStore("$meta"),delete oe._dbSchema.$meta,oe._storeNames=oe._storeNames.filter(function(Se){return Se!=="$meta"})):je.objectStore("$meta").put(ye._cfg.version,"version"))})}),function ye(){return be.length?Be.resolve(be.shift()(le.idbtrans)).then(ye):Be.resolve()}().then(function(){O1(he,fe)})):Be.resolve();var oe,ve,le,fe,be,he}).catch(J)):(i(z).forEach(function(pe){Ib(P,pe,z[pe].primKey,z[pe].indexes)}),rm(w,P),void Be.follow(function(){return w.on.populate.fire(K)}).catch(J));var se,ce})}function HR(w,N){O1(w._dbSchema,N),N.db.version%10!=0||N.objectStoreNames.contains("$meta")||N.db.createObjectStore("$meta").add(Math.ceil(N.db.version/10-1),"version");var P=am(0,w.idbdb,N);im(w,w._dbSchema,N);for(var D=0,z=_b(P,w._dbSchema).change;D<z.length;D++){var K=function(J){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 re=N.objectStore(J.name);J.add.forEach(function(se){ot&&console.debug("Dexie upgrade patch: Creating missing index ".concat(J.name,".").concat(se.src)),om(re,se)})}(z[D]);if(typeof K=="object")return K.value}}function _b(w,N){var P,D={del:[],add:[],change:[]};for(P in w)N[P]||D.del.push(P);for(P in N){var z=w[P],K=N[P];if(z){var J={name:P,def:K,recreate:!1,del:[],add:[],change:[]};if(""+(z.primKey.keyPath||"")!=""+(K.primKey.keyPath||"")||z.primKey.auto!==K.primKey.auto)J.recreate=!0,D.change.push(J);else{var re=z.idxByName,se=K.idxByName,ce=void 0;for(ce in re)se[ce]||J.del.push(ce);for(ce in se){var pe=re[ce],oe=se[ce];pe?pe.src!==oe.src&&J.change.push(oe):J.add.push(oe)}(0<J.del.length||0<J.add.length||0<J.change.length)&&D.change.push(J)}}else D.add.push([P,K])}return D}function Ib(w,N,P,D){var z=w.db.createObjectStore(N,P.keyPath?{keyPath:P.keyPath,autoIncrement:P.auto}:{autoIncrement:P.auto});return D.forEach(function(K){return om(z,K)}),z}function O1(w,N){i(w).forEach(function(P){N.db.objectStoreNames.contains(P)||(ot&&console.debug("Dexie: Creating missing table",P),Ib(N,P,w[P].primKey,w[P].indexes))})}function om(w,N){w.createIndex(N.name,N.keyPath,{unique:N.unique,multiEntry:N.multi})}function am(w,N,P){var D={};return k(N.objectStoreNames,0).forEach(function(z){for(var K=P.objectStore(z),J=Pb(N1(ce=K.keyPath),ce||"",!0,!1,!!K.autoIncrement,ce&&typeof ce!="string",!0),re=[],se=0;se<K.indexNames.length;++se){var pe=K.index(K.indexNames[se]),ce=pe.keyPath,pe=Pb(pe.name,ce,!!pe.unique,!!pe.multiEntry,!1,ce&&typeof ce!="string",!1);re.push(pe)}D[z]=Ab(z,J,re)}),D}function im(w,N,P){for(var D=P.db.objectStoreNames,z=0;z<D.length;++z){var K=D[z],J=P.objectStore(K);w._hasGetAll="getAll"in J;for(var re=0;re<J.indexNames.length;++re){var se=J.indexNames[re],ce=J.index(se).keyPath,pe=typeof ce=="string"?ce:"["+k(ce).join("+")+"]";!N[K]||(ce=N[K].idxByName[pe])&&(ce.name=se,delete N[K].idxByName[pe],N[K].idxByName[se]=ce)}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&a.WorkerGlobalScope&&a instanceof a.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(w._hasGetAll=!1)}function C1(w){return w.split(",").map(function(N,P){var K=N.split(":"),D=(z=K[1])===null||z===void 0?void 0:z.trim(),z=(N=K[0].trim()).replace(/([&*]|\+\+)/g,""),K=/^\[/.test(z)?z.match(/^\[(.*)\]$/)[1].split("+"):z;return Pb(z,K||null,/\&/.test(N),/\*/.test(N),/\+\+/.test(N),s(K),P===0,D)})}var qR=(Pl.prototype._createTableSchema=Ab,Pl.prototype._parseIndexSyntax=C1,Pl.prototype._parseStoresSpec=function(w,N){var P=this;i(w).forEach(function(D){if(w[D]!==null){var z=P._parseIndexSyntax(w[D]),K=z.shift();if(!K)throw new G.Schema("Invalid schema for table "+D+": "+w[D]);if(K.unique=!0,K.multi)throw new G.Schema("Primary key cannot be multiEntry*");z.forEach(function(J){if(J.auto)throw new G.Schema("Only primary key can be marked as autoIncrement (++)");if(!J.keyPath)throw new G.Schema("Index must have a name and cannot be an empty string")}),z=P._createTableSchema(D,K,z),N[D]=z}})},Pl.prototype.stores=function(P){var N=this.db;this._cfg.storesSource=this._cfg.storesSource?u(this._cfg.storesSource,P):P;var P=N._versions,D={},z={};return P.forEach(function(K){u(D,K._cfg.storesSource),z=K._cfg.dbschema={},K._parseStoresSpec(D,z)}),N._dbSchema=z,Mb(N,[N._allTables,N,N.Transaction.prototype]),nm(N,[N._allTables,N,N.Transaction.prototype,this._cfg.tables],i(z),z),N._storeNames=i(z),this},Pl.prototype.upgrade=function(w){return this._cfg.contentUpgrade=Me(this._cfg.contentUpgrade||V,w),this},Pl);function Pl(){}function Db(w,N){var P=w._dbNamesDB;return P||(P=w._dbNamesDB=new za(Vo,{addons:[],indexedDB:w,IDBKeyRange:N})).version(1).stores({dbnames:"name"}),P.table("dbnames")}function Lb(w){return w&&typeof w.databases=="function"}function Rb(w){return bt(function(){return Ye.letThrough=!0,w()})}function Fb(w){return!("from"in w)}var Dn=function(w,N){if(!this){var P=new Dn;return w&&"d"in w&&u(P,w),P}u(this,arguments.length?{d:1,from:w,to:1<arguments.length?N:w}:{d:0})};function Tc(w,N,P){var D=Xt(N,P);if(!isNaN(D)){if(0<D)throw RangeError();if(Fb(w))return u(w,{from:N,to:P,d:1});var z=w.l,D=w.r;if(Xt(P,w.from)<0)return z?Tc(z,N,P):w.l={from:N,to:P,d:1,l:null,r:null},A1(w);if(0<Xt(N,w.to))return D?Tc(D,N,P):w.r={from:N,to:P,d:1,l:null,r:null},A1(w);Xt(N,w.from)<0&&(w.from=N,w.l=null,w.d=D?D.d+1:1),0<Xt(P,w.to)&&(w.to=P,w.r=null,w.d=w.l?w.l.d+1:1),P=!w.r,z&&!w.l&&Mc(w,z),D&&P&&Mc(w,D)}}function Mc(w,N){Fb(N)||function P(D,se){var K=se.from,J=se.to,re=se.l,se=se.r;Tc(D,K,J),re&&P(D,re),se&&P(D,se)}(w,N)}function P1(w,N){var P=sm(N),D=P.next();if(D.done)return!1;for(var z=D.value,K=sm(w),J=K.next(z.from),re=J.value;!D.done&&!J.done;){if(Xt(re.from,z.to)<=0&&0<=Xt(re.to,z.from))return!0;Xt(z.from,re.from)<0?z=(D=P.next(re.from)).value:re=(J=K.next(z.from)).value}return!1}function sm(w){var N=Fb(w)?null:{s:0,n:w};return{next:function(P){for(var D=0<arguments.length;N;)switch(N.s){case 0:if(N.s=1,D)for(;N.n.l&&Xt(P,N.n.from)<0;)N={up:N,n:N.n.l,s:1};else for(;N.n.l;)N={up:N,n:N.n.l,s:1};case 1:if(N.s=2,!D||Xt(P,N.n.to)<=0)return{value:N.n,done:!1};case 2:if(N.n.r){N.s=3,N={up:N,n:N.n.r,s:0};continue}case 3:N=N.up}return{done:!0}}}}function A1(w){var N,P,D=(((N=w.r)===null||N===void 0?void 0:N.d)||0)-(((P=w.l)===null||P===void 0?void 0:P.d)||0),z=1<D?"r":D<-1?"l":"";z&&(N=z=="r"?"l":"r",P=n({},w),D=w[z],w.from=D.from,w.to=D.to,w[z]=D[z],P[z]=D[N],(w[N]=P).d=T1(P)),w.d=T1(w)}function T1(P){var N=P.r,P=P.l;return(N?P?Math.max(N.d,P.d):N.d:P?P.d:0)+1}function lm(w,N){return i(N).forEach(function(P){w[P]?Mc(w[P],N[P]):w[P]=function D(z){var K,J,re={};for(K in z)f(z,K)&&(J=z[K],re[K]=!J||typeof J!="object"||_.has(J.constructor)?J:D(J));return re}(N[P])}),w}function $b(w,N){return w.all||N.all||Object.keys(w).some(function(P){return N[P]&&P1(N[P],w[P])})}h(Dn.prototype,((Ao={add:function(w){return Mc(this,w),this},addKey:function(w){return Tc(this,w,w),this},addKeys:function(w){var N=this;return w.forEach(function(P){return Tc(N,P,P)}),this},hasKey:function(w){var N=sm(this).next(w).value;return N&&Xt(N.from,w)<=0&&0<=Xt(N.to,w)}})[W]=function(){return sm(this)},Ao));var Cs={},Bb={},zb=!1;function um(w){lm(Bb,w),zb||(zb=!0,setTimeout(function(){zb=!1,Hb(Bb,!(Bb={}))},0))}function Hb(w,N){N===void 0&&(N=!1);var P=new Set;if(w.all)for(var D=0,z=Object.values(Cs);D<z.length;D++)M1(J=z[D],w,P,N);else for(var K in w){var J,re=/^idb\:\/\/(.*)\/(.*)\//.exec(K);re&&(K=re[1],re=re[2],(J=Cs["idb://".concat(K,"/").concat(re)])&&M1(J,w,P,N))}P.forEach(function(se){return se()})}function M1(w,N,P,D){for(var z=[],K=0,J=Object.entries(w.queries.query);K<J.length;K++){for(var re=J[K],se=re[0],ce=[],pe=0,oe=re[1];pe<oe.length;pe++){var ve=oe[pe];$b(N,ve.obsSet)?ve.subscribers.forEach(function(he){return P.add(he)}):D&&ce.push(ve)}D&&z.push([se,ce])}if(D)for(var le=0,fe=z;le<fe.length;le++){var be=fe[le],se=be[0],ce=be[1];w.queries.query[se]=ce}}function UR(w){var N=w._state,P=w._deps.indexedDB;if(N.isBeingOpened||w.idbdb)return N.dbReadyPromise.then(function(){return N.dbOpenError?Wt(N.dbOpenError):w});N.isBeingOpened=!0,N.dbOpenError=null,N.openComplete=!1;var D=N.openCanceller,z=Math.round(10*w.verno),K=!1;function J(){if(N.openCanceller!==D)throw new G.DatabaseClosed("db.open() was cancelled")}function re(){return new Be(function(ve,le){if(J(),!P)throw new G.MissingAPI;var fe=w.name,be=N.autoSchema||!z?P.open(fe):P.open(fe,z);if(!be)throw new G.MissingAPI;be.onerror=sn(le),be.onblocked=Et(w._fireOnBlocked),be.onupgradeneeded=Et(function(he){var ye;pe=be.transaction,N.autoSchema&&!w._options.allowEmptyDB?(be.onerror=Oc,pe.abort(),be.result.close(),(ye=P.deleteDatabase(fe)).onsuccess=ye.onerror=Et(function(){le(new G.NoSuchDatabase("Database ".concat(fe," doesnt exist")))})):(pe.onerror=sn(le),he=he.oldVersion>Math.pow(2,62)?0:he.oldVersion,oe=he<1,w.idbdb=be.result,K&&HR(w,pe),zR(w,he/10,pe,le))},le),be.onsuccess=Et(function(){pe=null;var he,ye,je,Se,Oe,Le=w.idbdb=be.result,We=k(Le.objectStoreNames);if(0<We.length)try{var ze=Le.transaction((Se=We).length===1?Se[0]:Se,"readonly");if(N.autoSchema)ye=Le,je=ze,(he=w).verno=ye.version/10,je=he._dbSchema=am(0,ye,je),he._storeNames=k(ye.objectStoreNames,0),nm(he,[he._allTables],i(je),je);else if(im(w,w._dbSchema,ze),((Oe=_b(am(0,(Oe=w).idbdb,ze),Oe._dbSchema)).add.length||Oe.change.some(function(Ue){return Ue.add.length||Ue.change.length}))&&!K)return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),Le.close(),z=Le.version+1,K=!0,ve(re());rm(w,ze)}catch{}En.push(w),Le.onversionchange=Et(function(Ue){N.vcFired=!0,w.on("versionchange").fire(Ue)}),Le.onclose=Et(function(Ue){w.on("close").fire(Ue)}),oe&&(Oe=w._deps,ze=fe,Le=Oe.indexedDB,Oe=Oe.IDBKeyRange,Lb(Le)||ze===Vo||Db(Le,Oe).put({name:ze}).catch(V)),ve()},le)}).catch(function(ve){switch(ve?.name){case"UnknownError":if(0<N.PR1398_maxLoop)return N.PR1398_maxLoop--,console.warn("Dexie: Workaround for Chrome UnknownError on open()"),re();break;case"VersionError":if(0<z)return z=0,re()}return Be.reject(ve)})}var se,ce=N.dbReadyResolve,pe=null,oe=!1;return Be.race([D,(typeof navigator>"u"?Be.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(ve){function le(){return indexedDB.databases().finally(ve)}se=setInterval(le,100),le()}).finally(function(){return clearInterval(se)}):Promise.resolve()).then(re)]).then(function(){return J(),N.onReadyBeingFired=[],Be.resolve(Rb(function(){return w.on.ready.fire(w.vip)})).then(function ve(){if(0<N.onReadyBeingFired.length){var le=N.onReadyBeingFired.reduce(Me,V);return N.onReadyBeingFired=[],Be.resolve(Rb(function(){return le(w.vip)})).then(ve)}})}).finally(function(){N.openCanceller===D&&(N.onReadyBeingFired=null,N.isBeingOpened=!1)}).catch(function(ve){N.dbOpenError=ve;try{pe&&pe.abort()}catch{}return D===N.openCanceller&&w._close(),Wt(ve)}).finally(function(){N.openComplete=!0,ce()}).then(function(){var ve;return oe&&(ve={},w.tables.forEach(function(le){le.schema.indexes.forEach(function(fe){fe.name&&(ve["idb://".concat(w.name,"/").concat(le.name,"/").concat(fe.name)]=new Dn(-1/0,[[[]]]))}),ve["idb://".concat(w.name,"/").concat(le.name,"/")]=ve["idb://".concat(w.name,"/").concat(le.name,"/:dels")]=new Dn(-1/0,[[[]]])}),Ai(Cc).fire(ve),Hb(ve,!0)),w})}function qb(w){function N(K){return w.next(K)}var P=z(N),D=z(function(K){return w.throw(K)});function z(K){return function(se){var re=K(se),se=re.value;return re.done?se:se&&typeof se.then=="function"?se.then(P,D):s(se)?Promise.all(se).then(P,D):P(se)}}return z(N)()}function cm(w,N,P){for(var D=s(w)?w.slice():[w],z=0;z<P;++z)D.push(N);return D}var VR={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:function(w){return n(n({},w),{table:function(N){var P=w.table(N),D=P.schema,z={},K=[];function J(oe,ve,le){var fe=Ac(oe),be=z[fe]=z[fe]||[],he=oe==null?0:typeof oe=="string"?1:oe.length,ye=0<ve,ye=n(n({},le),{name:ye?"".concat(fe,"(virtual-from:").concat(le.name,")"):le.name,lowLevelIndex:le,isVirtual:ye,keyTail:ve,keyLength:he,extractKey:Tb(oe),unique:!ye&&le.unique});return be.push(ye),ye.isPrimaryKey||K.push(ye),1<he&&J(he===2?oe[0]:oe.slice(0,he-1),ve+1,le),be.sort(function(je,Se){return je.keyTail-Se.keyTail}),ye}N=J(D.primaryKey.keyPath,0,D.primaryKey),z[":id"]=[N];for(var re=0,se=D.indexes;re<se.length;re++){var ce=se[re];J(ce.keyPath,0,ce)}function pe(oe){var ve,le=oe.query.index;return le.isVirtual?n(n({},oe),{query:{index:le.lowLevelIndex,range:(ve=oe.query.range,le=le.keyTail,{type:ve.type===1?2:ve.type,lower:cm(ve.lower,ve.lowerOpen?w.MAX_KEY:w.MIN_KEY,le),lowerOpen:!0,upper:cm(ve.upper,ve.upperOpen?w.MIN_KEY:w.MAX_KEY,le),upperOpen:!0})}}):oe}return n(n({},P),{schema:n(n({},D),{primaryKey:N,indexes:K,getIndexByKeyPath:function(oe){return(oe=z[Ac(oe)])&&oe[0]}}),count:function(oe){return P.count(pe(oe))},query:function(oe){return P.query(pe(oe))},openCursor:function(oe){var ve=oe.query.index,le=ve.keyTail,fe=ve.isVirtual,be=ve.keyLength;return fe?P.openCursor(pe(oe)).then(function(ye){return ye&&he(ye)}):P.openCursor(oe);function he(ye){return Object.create(ye,{continue:{value:function(je){je!=null?ye.continue(cm(je,oe.reverse?w.MAX_KEY:w.MIN_KEY,le)):oe.unique?ye.continue(ye.key.slice(0,be).concat(oe.reverse?w.MIN_KEY:w.MAX_KEY,le)):ye.continue()}},continuePrimaryKey:{value:function(je,Se){ye.continuePrimaryKey(cm(je,w.MAX_KEY,le),Se)}},primaryKey:{get:function(){return ye.primaryKey}},key:{get:function(){var je=ye.key;return be===1?je[0]:je.slice(0,be)}},value:{get:function(){return ye.value}}})}}})}})}};function Ub(w,N,P,D){return P=P||{},D=D||"",i(w).forEach(function(z){var K,J,re;f(N,z)?(K=w[z],J=N[z],typeof K=="object"&&typeof J=="object"&&K&&J?(re=R(K))!==R(J)?P[D+z]=N[z]:re==="Object"?Ub(K,J,P,D+z+"."):K!==J&&(P[D+z]=N[z]):K!==J&&(P[D+z]=N[z])):P[D+z]=void 0}),i(N).forEach(function(z){f(w,z)||(P[D+z]=N[z])}),P}function Vb(w,N){return N.type==="delete"?N.keys:N.keys||N.values.map(w.extractKey)}var WR={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(w){return n(n({},w),{table:function(N){var P=w.table(N),D=P.schema.primaryKey;return n(n({},P),{mutate:function(z){var K=Ye.trans,J=K.table(N).hook,re=J.deleting,se=J.creating,ce=J.updating;switch(z.type){case"add":if(se.fire===V)break;return K._promise("readwrite",function(){return pe(z)},!0);case"put":if(se.fire===V&&ce.fire===V)break;return K._promise("readwrite",function(){return pe(z)},!0);case"delete":if(re.fire===V)break;return K._promise("readwrite",function(){return pe(z)},!0);case"deleteRange":if(re.fire===V)break;return K._promise("readwrite",function(){return function oe(ve,le,fe){return P.query({trans:ve,values:!1,query:{index:D,range:le},limit:fe}).then(function(be){var he=be.result;return pe({type:"delete",keys:he,trans:ve}).then(function(ye){return 0<ye.numFailures?Promise.reject(ye.failures[0]):he.length<fe?{failures:[],numFailures:0,lastResult:void 0}:oe(ve,n(n({},le),{lower:he[he.length-1],lowerOpen:!0}),fe)})})}(z.trans,z.range,1e4)},!0)}return P.mutate(z);function pe(oe){var ve,le,fe,be=Ye.trans,he=oe.keys||Vb(D,oe);if(!he)throw new Error("Keys missing");return(oe=oe.type==="add"||oe.type==="put"?n(n({},oe),{keys:he}):n({},oe)).type!=="delete"&&(oe.values=o([],oe.values)),oe.keys&&(oe.keys=o([],oe.keys)),ve=P,fe=he,((le=oe).type==="add"?Promise.resolve([]):ve.getMany({trans:le.trans,keys:fe,cache:"immutable"})).then(function(ye){var je=he.map(function(Se,Oe){var Le,We,ze,Ue=ye[Oe],tt={onerror:null,onsuccess:null};return oe.type==="delete"?re.fire.call(tt,Se,Ue,be):oe.type==="add"||Ue===void 0?(Le=se.fire.call(tt,Se,oe.values[Oe],be),Se==null&&Le!=null&&(oe.keys[Oe]=Se=Le,D.outbound||O(oe.values[Oe],D.keyPath,Se))):(Le=Ub(Ue,oe.values[Oe]),(We=ce.fire.call(tt,Le,Se,Ue,be))&&(ze=oe.values[Oe],Object.keys(We).forEach(function(Qe){f(ze,Qe)?ze[Qe]=We[Qe]:O(ze,Qe,We[Qe])}))),tt});return P.mutate(oe).then(function(Se){for(var Oe=Se.failures,Le=Se.results,We=Se.numFailures,Se=Se.lastResult,ze=0;ze<he.length;++ze){var Ue=(Le||he)[ze],tt=je[ze];Ue==null?tt.onerror&&tt.onerror(Oe[ze]):tt.onsuccess&&tt.onsuccess(oe.type==="put"&&ye[ze]?oe.values[ze]:Ue)}return{failures:Oe,results:Le,numFailures:We,lastResult:Se}}).catch(function(Se){return je.forEach(function(Oe){return Oe.onerror&&Oe.onerror(Se)}),Promise.reject(Se)})})}}})}})}};function _1(w,N,P){try{if(!N||N.keys.length<w.length)return null;for(var D=[],z=0,K=0;z<N.keys.length&&K<w.length;++z)Xt(N.keys[z],w[K])===0&&(D.push(P?$(N.values[z]):N.values[z]),++K);return D.length===w.length?D:null}catch{return null}}var KR={stack:"dbcore",level:-1,create:function(w){return{table:function(N){var P=w.table(N);return n(n({},P),{getMany:function(D){if(!D.cache)return P.getMany(D);var z=_1(D.keys,D.trans._cache,D.cache==="clone");return z?Be.resolve(z):P.getMany(D).then(function(K){return D.trans._cache={keys:D.keys,values:D.cache==="clone"?$(K):K},K})},mutate:function(D){return D.type!=="add"&&(D.trans._cache=null),P.mutate(D)}})}}}};function I1(w,N){return w.trans.mode==="readonly"&&!!w.subscr&&!w.trans.explicit&&w.trans.db._options.cache!=="disabled"&&!N.schema.primaryKey.outbound}function D1(w,N){switch(w){case"query":return N.values&&!N.unique;case"get":case"getMany":case"count":case"openCursor":return!1}}var YR={stack:"dbcore",level:0,name:"Observability",create:function(w){var N=w.schema.name,P=new Dn(w.MIN_KEY,w.MAX_KEY);return n(n({},w),{transaction:function(D,z,K){if(Ye.subscr&&z!=="readonly")throw new G.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(Ye.querier));return w.transaction(D,z,K)},table:function(D){var z=w.table(D),K=z.schema,J=K.primaryKey,oe=K.indexes,re=J.extractKey,se=J.outbound,ce=J.autoIncrement&&oe.filter(function(le){return le.compound&&le.keyPath.includes(J.keyPath)}),pe=n(n({},z),{mutate:function(le){function fe(Qe){return Qe="idb://".concat(N,"/").concat(D,"/").concat(Qe),Se[Qe]||(Se[Qe]=new Dn)}var be,he,ye,je=le.trans,Se=le.mutatedParts||(le.mutatedParts={}),Oe=fe(""),Le=fe(":dels"),We=le.type,tt=le.type==="deleteRange"?[le.range]:le.type==="delete"?[le.keys]:le.values.length<50?[Vb(J,le).filter(function(Qe){return Qe}),le.values]:[],ze=tt[0],Ue=tt[1],tt=le.trans._cache;return s(ze)?(Oe.addKeys(ze),(tt=We==="delete"||ze.length===Ue.length?_1(ze,tt):null)||Le.addKeys(ze),(tt||Ue)&&(be=fe,he=tt,ye=Ue,K.indexes.forEach(function(Qe){var it=be(Qe.name||"");function Rt(It){return It!=null?Qe.extractKey(It):null}function rr(It){return Qe.multiEntry&&s(It)?It.forEach(function(nn){return it.addKey(nn)}):it.addKey(It)}(he||ye).forEach(function(It,Ln){var Pt=he&&Rt(he[Ln]),Ln=ye&&Rt(ye[Ln]);Xt(Pt,Ln)!==0&&(Pt!=null&&rr(Pt),Ln!=null&&rr(Ln))})}))):ze?(Ue={from:(Ue=ze.lower)!==null&&Ue!==void 0?Ue:w.MIN_KEY,to:(Ue=ze.upper)!==null&&Ue!==void 0?Ue:w.MAX_KEY},Le.add(Ue),Oe.add(Ue)):(Oe.add(P),Le.add(P),K.indexes.forEach(function(Qe){return fe(Qe.name).add(P)})),z.mutate(le).then(function(Qe){return!ze||le.type!=="add"&&le.type!=="put"||(Oe.addKeys(Qe.results),ce&&ce.forEach(function(it){for(var Rt=le.values.map(function(Pt){return it.extractKey(Pt)}),rr=it.keyPath.findIndex(function(Pt){return Pt===J.keyPath}),It=0,nn=Qe.results.length;It<nn;++It)Rt[It][rr]=Qe.results[It];fe(it.name).addKeys(Rt)})),je.mutatedParts=lm(je.mutatedParts||{},Se),Qe})}}),oe=function(fe){var be=fe.query,fe=be.index,be=be.range;return[fe,new Dn((fe=be.lower)!==null&&fe!==void 0?fe:w.MIN_KEY,(be=be.upper)!==null&&be!==void 0?be:w.MAX_KEY)]},ve={get:function(le){return[J,new Dn(le.key)]},getMany:function(le){return[J,new Dn().addKeys(le.keys)]},count:oe,query:oe,openCursor:oe};return i(ve).forEach(function(le){pe[le]=function(fe){var be=Ye.subscr,he=!!be,ye=I1(Ye,z)&&D1(le,fe)?fe.obsSet={}:be;if(he){var je=function(Ue){return Ue="idb://".concat(N,"/").concat(D,"/").concat(Ue),ye[Ue]||(ye[Ue]=new Dn)},Se=je(""),Oe=je(":dels"),be=ve[le](fe),he=be[0],be=be[1];if((le==="query"&&he.isPrimaryKey&&!fe.values?Oe:je(he.name||"")).add(be),!he.isPrimaryKey){if(le!=="count"){var Le=le==="query"&&se&&fe.values&&z.query(n(n({},fe),{values:!1}));return z[le].apply(this,arguments).then(function(Ue){if(le==="query"){if(se&&fe.values)return Le.then(function(Rt){return Rt=Rt.result,Se.addKeys(Rt),Ue});var tt=fe.values?Ue.result.map(re):Ue.result;(fe.values?Se:Oe).addKeys(tt)}else if(le==="openCursor"){var Qe=Ue,it=fe.values;return Qe&&Object.create(Qe,{key:{get:function(){return Oe.addKey(Qe.primaryKey),Qe.key}},primaryKey:{get:function(){var Rt=Qe.primaryKey;return Oe.addKey(Rt),Rt}},value:{get:function(){return it&&Se.addKey(Qe.primaryKey),Qe.value}}})}return Ue})}Oe.add(P)}}return z[le].apply(this,arguments)}}),pe}})}};function L1(w,N,P){if(P.numFailures===0)return N;if(N.type==="deleteRange")return null;var D=N.keys?N.keys.length:"values"in N&&N.values?N.values.length:1;return P.numFailures===D?null:(N=n({},N),s(N.keys)&&(N.keys=N.keys.filter(function(z,K){return!(K in P.failures)})),"values"in N&&s(N.values)&&(N.values=N.values.filter(function(z,K){return!(K in P.failures)})),N)}function Wb(w,N){return P=w,((D=N).lower===void 0||(D.lowerOpen?0<Xt(P,D.lower):0<=Xt(P,D.lower)))&&(w=w,(N=N).upper===void 0||(N.upperOpen?Xt(w,N.upper)<0:Xt(w,N.upper)<=0));var P,D}function R1(w,N,ve,D,z,K){if(!ve||ve.length===0)return w;var J=N.query.index,re=J.multiEntry,se=N.query.range,ce=D.schema.primaryKey.extractKey,pe=J.extractKey,oe=(J.lowLevelIndex||J).extractKey,ve=ve.reduce(function(le,fe){var be=le,he=[];if(fe.type==="add"||fe.type==="put")for(var ye=new Dn,je=fe.values.length-1;0<=je;--je){var Se,Oe=fe.values[je],Le=ce(Oe);ye.hasKey(Le)||(Se=pe(Oe),(re&&s(Se)?Se.some(function(Qe){return Wb(Qe,se)}):Wb(Se,se))&&(ye.addKey(Le),he.push(Oe)))}switch(fe.type){case"add":var We=new Dn().addKeys(N.values?le.map(function(it){return ce(it)}):le),be=le.concat(N.values?he.filter(function(it){return it=ce(it),!We.hasKey(it)&&(We.addKey(it),!0)}):he.map(function(it){return ce(it)}).filter(function(it){return!We.hasKey(it)&&(We.addKey(it),!0)}));break;case"put":var ze=new Dn().addKeys(fe.values.map(function(it){return ce(it)}));be=le.filter(function(it){return!ze.hasKey(N.values?ce(it):it)}).concat(N.values?he:he.map(function(it){return ce(it)}));break;case"delete":var Ue=new Dn().addKeys(fe.keys);be=le.filter(function(it){return!Ue.hasKey(N.values?ce(it):it)});break;case"deleteRange":var tt=fe.range;be=le.filter(function(it){return!Wb(ce(it),tt)})}return be},w);return ve===w?w:(ve.sort(function(le,fe){return Xt(oe(le),oe(fe))||Xt(ce(le),ce(fe))}),N.limit&&N.limit<1/0&&(ve.length>N.limit?ve.length=N.limit:w.length===N.limit&&ve.length<N.limit&&(z.dirty=!0)),K?Object.freeze(ve):ve)}function F1(w,N){return Xt(w.lower,N.lower)===0&&Xt(w.upper,N.upper)===0&&!!w.lowerOpen==!!N.lowerOpen&&!!w.upperOpen==!!N.upperOpen}function GR(w,N){return function(P,D,z,K){if(P===void 0)return D!==void 0?-1:0;if(D===void 0)return 1;if((D=Xt(P,D))===0){if(z&&K)return 0;if(z)return 1;if(K)return-1}return D}(w.lower,N.lower,w.lowerOpen,N.lowerOpen)<=0&&0<=function(P,D,z,K){if(P===void 0)return D!==void 0?1:0;if(D===void 0)return-1;if((D=Xt(P,D))===0){if(z&&K)return 0;if(z)return-1;if(K)return 1}return D}(w.upper,N.upper,w.upperOpen,N.upperOpen)}function XR(w,N,P,D){w.subscribers.add(P),D.addEventListener("abort",function(){var z,K;w.subscribers.delete(P),w.subscribers.size===0&&(z=w,K=N,setTimeout(function(){z.subscribers.size===0&&L(K,z)},3e3))})}var ZR={stack:"dbcore",level:0,name:"Cache",create:function(w){var N=w.schema.name;return n(n({},w),{transaction:function(P,D,z){var K,J,re=w.transaction(P,D,z);return D==="readwrite"&&(J=(K=new AbortController).signal,z=function(se){return function(){if(K.abort(),D==="readwrite"){for(var ce=new Set,pe=0,oe=P;pe<oe.length;pe++){var ve=oe[pe],le=Cs["idb://".concat(N,"/").concat(ve)];if(le){var fe=w.table(ve),be=le.optimisticOps.filter(function(it){return it.trans===re});if(re._explicit&&se&&re.mutatedParts)for(var he=0,ye=Object.values(le.queries.query);he<ye.length;he++)for(var je=0,Se=(We=ye[he]).slice();je<Se.length;je++)$b((ze=Se[je]).obsSet,re.mutatedParts)&&(L(We,ze),ze.subscribers.forEach(function(it){return ce.add(it)}));else if(0<be.length){le.optimisticOps=le.optimisticOps.filter(function(it){return it.trans!==re});for(var Oe=0,Le=Object.values(le.queries.query);Oe<Le.length;Oe++)for(var We,ze,Ue,tt=0,Qe=(We=Le[Oe]).slice();tt<Qe.length;tt++)(ze=Qe[tt]).res!=null&&re.mutatedParts&&(se&&!ze.dirty?(Ue=Object.isFrozen(ze.res),Ue=R1(ze.res,ze.req,be,fe,ze,Ue),ze.dirty?(L(We,ze),ze.subscribers.forEach(function(it){return ce.add(it)})):Ue!==ze.res&&(ze.res=Ue,ze.promise=Be.resolve({result:Ue}))):(ze.dirty&&L(We,ze),ze.subscribers.forEach(function(it){return ce.add(it)})))}}}ce.forEach(function(it){return it()})}}},re.addEventListener("abort",z(!1),{signal:J}),re.addEventListener("error",z(!1),{signal:J}),re.addEventListener("complete",z(!0),{signal:J})),re},table:function(P){var D=w.table(P),z=D.schema.primaryKey;return n(n({},D),{mutate:function(K){var J=Ye.trans;if(z.outbound||J.db._options.cache==="disabled"||J.explicit||J.idbtrans.mode!=="readwrite")return D.mutate(K);var re=Cs["idb://".concat(N,"/").concat(P)];return re?(J=D.mutate(K),K.type!=="add"&&K.type!=="put"||!(50<=K.values.length||Vb(z,K).some(function(se){return se==null}))?(re.optimisticOps.push(K),K.mutatedParts&&um(K.mutatedParts),J.then(function(se){0<se.numFailures&&(L(re.optimisticOps,K),(se=L1(0,K,se))&&re.optimisticOps.push(se),K.mutatedParts&&um(K.mutatedParts))}),J.catch(function(){L(re.optimisticOps,K),K.mutatedParts&&um(K.mutatedParts)})):J.then(function(se){var ce=L1(0,n(n({},K),{values:K.values.map(function(pe,oe){var ve;return se.failures[oe]||(pe=(ve=z.keyPath)!==null&&ve!==void 0&&ve.includes(".")?$(pe):n({},pe),O(pe,z.keyPath,se.results[oe])),pe})}),se);re.optimisticOps.push(ce),queueMicrotask(function(){return K.mutatedParts&&um(K.mutatedParts)})}),J):D.mutate(K)},query:function(K){if(!I1(Ye,D)||!D1("query",K))return D.query(K);var J=((ce=Ye.trans)===null||ce===void 0?void 0:ce.db._options.cache)==="immutable",oe=Ye,re=oe.requery,se=oe.signal,ce=function(fe,be,he,ye){var je=Cs["idb://".concat(fe,"/").concat(be)];if(!je)return[];if(!(be=je.queries[he]))return[null,!1,je,null];var Se=be[(ye.query?ye.query.index.name:null)||""];if(!Se)return[null,!1,je,null];switch(he){case"query":var Oe=Se.find(function(Le){return Le.req.limit===ye.limit&&Le.req.values===ye.values&&F1(Le.req.query.range,ye.query.range)});return Oe?[Oe,!0,je,Se]:[Se.find(function(Le){return("limit"in Le.req?Le.req.limit:1/0)>=ye.limit&&(!ye.values||Le.req.values)&&GR(Le.req.query.range,ye.query.range)}),!1,je,Se];case"count":return Oe=Se.find(function(Le){return F1(Le.req.query.range,ye.query.range)}),[Oe,!!Oe,je,Se]}}(N,P,"query",K),pe=ce[0],oe=ce[1],ve=ce[2],le=ce[3];return pe&&oe?pe.obsSet=K.obsSet:(oe=D.query(K).then(function(fe){var be=fe.result;if(pe&&(pe.res=be),J){for(var he=0,ye=be.length;he<ye;++he)Object.freeze(be[he]);Object.freeze(be)}else fe.result=$(be);return fe}).catch(function(fe){return le&&pe&&L(le,pe),Promise.reject(fe)}),pe={obsSet:K.obsSet,promise:oe,subscribers:new Set,type:"query",req:K,dirty:!1},le?le.push(pe):(le=[pe],(ve=ve||(Cs["idb://".concat(N,"/").concat(P)]={queries:{query:{},count:{}},objs:new Map,optimisticOps:[],unsignaledParts:{}})).queries.query[K.query.index.name||""]=le)),XR(pe,le,re,se),pe.promise.then(function(fe){return{result:R1(fe.result,K,ve?.optimisticOps,D,pe,J)}})}})}})}};function dm(w,N){return new Proxy(w,{get:function(P,D,z){return D==="db"?N:Reflect.get(P,D,z)}})}var za=(ln.prototype.version=function(w){if(isNaN(w)||w<.1)throw new G.Type("Given version is not a positive number");if(w=Math.round(10*w)/10,this.idbdb||this._state.isBeingOpened)throw new G.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,w);var N=this._versions,P=N.filter(function(D){return D._cfg.version===w})[0];return P||(P=new this.Version(w),N.push(P),N.sort(BR),P.stores({}),this._state.autoSchema=!1,P)},ln.prototype._whenReady=function(w){var N=this;return this.idbdb&&(this._state.openComplete||Ye.letThrough||this._vip)?w():new Be(function(P,D){if(N._state.openComplete)return D(new G.DatabaseClosed(N._state.dbOpenError));if(!N._state.isBeingOpened){if(!N._state.autoOpen)return void D(new G.DatabaseClosed);N.open().catch(V)}N._state.dbReadyPromise.then(P,D)}).then(w)},ln.prototype.use=function(w){var N=w.stack,P=w.create,D=w.level,z=w.name;return z&&this.unuse({stack:N,name:z}),w=this._middlewares[N]||(this._middlewares[N]=[]),w.push({stack:N,create:P,level:D??10,name:z}),w.sort(function(K,J){return K.level-J.level}),this},ln.prototype.unuse=function(w){var N=w.stack,P=w.name,D=w.create;return N&&this._middlewares[N]&&(this._middlewares[N]=this._middlewares[N].filter(function(z){return D?z.create!==D:!!P&&z.name!==P})),this},ln.prototype.open=function(){var w=this;return Nr(Jr,function(){return UR(w)})},ln.prototype._close=function(){this.on.close.fire(new CustomEvent("close"));var w=this._state,N=En.indexOf(this);if(0<=N&&En.splice(N,1),this.idbdb){try{this.idbdb.close()}catch{}this.idbdb=null}w.isBeingOpened||(w.dbReadyPromise=new Be(function(P){w.dbReadyResolve=P}),w.openCanceller=new Be(function(P,D){w.cancelOpen=D}))},ln.prototype.close=function(P){var N=(P===void 0?{disableAutoOpen:!0}:P).disableAutoOpen,P=this._state;N?(P.isBeingOpened&&P.cancelOpen(new G.DatabaseClosed),this._close(),P.autoOpen=!1,P.dbOpenError=new G.DatabaseClosed):(this._close(),P.autoOpen=this._options.autoOpen||P.isBeingOpened,P.openComplete=!1,P.dbOpenError=null)},ln.prototype.delete=function(w){var N=this;w===void 0&&(w={disableAutoOpen:!0});var P=0<arguments.length&&typeof arguments[0]!="object",D=this._state;return new Be(function(z,K){function J(){N.close(w);var re=N._deps.indexedDB.deleteDatabase(N.name);re.onsuccess=Et(function(){var se,ce,pe;se=N._deps,ce=N.name,pe=se.indexedDB,se=se.IDBKeyRange,Lb(pe)||ce===Vo||Db(pe,se).delete(ce).catch(V),z()}),re.onerror=sn(K),re.onblocked=N._fireOnBlocked}if(P)throw new G.InvalidArgument("Invalid closeOptions argument to db.delete()");D.isBeingOpened?D.dbReadyPromise.then(J):J()})},ln.prototype.backendDB=function(){return this.idbdb},ln.prototype.isOpen=function(){return this.idbdb!==null},ln.prototype.hasBeenClosed=function(){var w=this._state.dbOpenError;return w&&w.name==="DatabaseClosed"},ln.prototype.hasFailed=function(){return this._state.dbOpenError!==null},ln.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(ln.prototype,"tables",{get:function(){var w=this;return i(this._allTables).map(function(N){return w._allTables[N]})},enumerable:!1,configurable:!0}),ln.prototype.transaction=function(){var w=function(N,P,D){var z=arguments.length;if(z<2)throw new G.InvalidArgument("Too few arguments");for(var K=new Array(z-1);--z;)K[z-1]=arguments[z];return D=K.pop(),[N,T(K),D]}.apply(this,arguments);return this._transaction.apply(this,w)},ln.prototype._transaction=function(w,N,P){var D=this,z=Ye.trans;z&&z.db===this&&w.indexOf("!")===-1||(z=null);var K,J,re=w.indexOf("?")!==-1;w=w.replace("!","").replace("?","");try{if(J=N.map(function(ce){if(ce=ce instanceof D.Table?ce.name:ce,typeof ce!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return ce}),w=="r"||w===Si)K=Si;else{if(w!="rw"&&w!=Ba)throw new G.InvalidArgument("Invalid transaction mode: "+w);K=Ba}if(z){if(z.mode===Si&&K===Ba){if(!re)throw new G.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");z=null}z&&J.forEach(function(ce){if(z&&z.storeNames.indexOf(ce)===-1){if(!re)throw new G.SubTransaction("Table "+ce+" not included in parent transaction.");z=null}}),re&&z&&!z.active&&(z=null)}}catch(ce){return z?z._promise(null,function(pe,oe){oe(ce)}):Wt(ce)}var se=function ce(pe,oe,ve,le,fe){return Be.resolve().then(function(){var be=Ye.transless||Ye,he=pe._createTransaction(oe,ve,pe._dbSchema,le);if(he.explicit=!0,be={trans:he,transless:be},le)he.idbtrans=le.idbtrans;else try{he.create(),he.idbtrans._explicit=!0,pe._state.PR1398_maxLoop=3}catch(Se){return Se.name===Q.InvalidState&&pe.isOpen()&&0<--pe._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),pe.close({disableAutoOpen:!1}),pe.open().then(function(){return ce(pe,oe,ve,null,fe)})):Wt(Se)}var ye,je=H(fe);return je&&Ot(),be=Be.follow(function(){var Se;(ye=fe.call(he,he))&&(je?(Se=st.bind(null,null),ye.then(Se,Se)):typeof ye.next=="function"&&typeof ye.throw=="function"&&(ye=qb(ye)))},be),(ye&&typeof ye.then=="function"?Be.resolve(ye).then(function(Se){return he.active?Se:Wt(new G.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):be.then(function(){return ye})).then(function(Se){return le&&he._resolve(),he._completion.then(function(){return Se})}).catch(function(Se){return he._reject(Se),Wt(Se)})})}.bind(null,this,K,J,z,P);return z?z._promise(K,se,"lock"):Ye.trans?Nr(Ye.transless,function(){return D._whenReady(se)}):this._whenReady(se)},ln.prototype.table=function(w){if(!f(this._allTables,w))throw new G.InvalidTable("Table ".concat(w," does not exist"));return this._allTables[w]},ln);function ln(w,N){var P=this;this._middlewares={},this.verno=0;var D=ln.dependencies;this._options=N=n({addons:ln.addons,autoOpen:!0,indexedDB:D.indexedDB,IDBKeyRange:D.IDBKeyRange,cache:"cloned"},N),this._deps={indexedDB:N.indexedDB,IDBKeyRange:N.IDBKeyRange},D=N.addons,this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var z,K,J,re,se,ce={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:V,dbReadyPromise:null,cancelOpen:V,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3,autoOpen:N.autoOpen};ce.dbReadyPromise=new Be(function(oe){ce.dbReadyResolve=oe}),ce.openCanceller=new Be(function(oe,ve){ce.cancelOpen=ve}),this._state=ce,this.name=w,this.on=Ci(this,"populate","blocked","versionchange","close",{ready:[Me,V]}),this.once=function(oe,ve){var le=function(){for(var fe=[],be=0;be<arguments.length;be++)fe[be]=arguments[be];P.on(oe).unsubscribe(le),ve.apply(P,fe)};return P.on(oe,le)},this.on.ready.subscribe=E(this.on.ready.subscribe,function(oe){return function(ve,le){ln.vip(function(){var fe,be=P._state;be.openComplete?(be.dbOpenError||Be.resolve().then(ve),le&&oe(ve)):be.onReadyBeingFired?(be.onReadyBeingFired.push(ve),le&&oe(ve)):(oe(ve),fe=P,le||oe(function he(){fe.on.ready.unsubscribe(ve),fe.on.ready.unsubscribe(he)}))})}}),this.Collection=(z=this,Os(ht.prototype,function(ye,he){this.db=z;var le=Nl,fe=null;if(he)try{le=he()}catch(je){fe=je}var be=ye._ctx,he=be.table,ye=he.hook.reading.fire;this._ctx={table:he,index:be.index,isPrimKey:!be.index||he.schema.primKey.keyPath&&be.index===he.schema.primKey.name,range:le,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:fe,or:be.or,valueMapper:ye!==ee?ye:null}})),this.Table=(K=this,Os(tm.prototype,function(oe,ve,le){this.db=K,this._tx=le,this.name=oe,this.schema=ve,this.hook=K._allTables[oe]?K._allTables[oe].hook:Ci(null,{creating:[Ee,V],reading:[ne,ee],updating:[Ie,V],deleting:[Pe,V]})})),this.Transaction=(J=this,Os(LR.prototype,function(oe,ve,le,fe,be){var he=this;oe!=="readonly"&&ve.forEach(function(ye){ye=(ye=le[ye])===null||ye===void 0?void 0:ye.yProps,ye&&(ve=ve.concat(ye.map(function(je){return je.updatesTable})))}),this.db=J,this.mode=oe,this.storeNames=ve,this.schema=le,this.chromeTransactionDurability=fe,this.idbtrans=null,this.on=Ci(this,"complete","error","abort"),this.parent=be||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new Be(function(ye,je){he._resolve=ye,he._reject=je}),this._completion.then(function(){he.active=!1,he.on.complete.fire()},function(ye){var je=he.active;return he.active=!1,he.on.error.fire(ye),he.parent?he.parent._reject(ye):je&&he.idbtrans&&he.idbtrans.abort(),Wt(ye)})})),this.Version=(re=this,Os(qR.prototype,function(oe){this.db=re,this._cfg={version:oe,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})),this.WhereClause=(se=this,Os(Cr.prototype,function(oe,ve,le){if(this.db=se,this._ctx={table:oe,index:ve===":id"?null:ve,or:le},this._cmp=this._ascending=Xt,this._descending=function(fe,be){return Xt(be,fe)},this._max=function(fe,be){return 0<Xt(fe,be)?fe:be},this._min=function(fe,be){return Xt(fe,be)<0?fe:be},this._IDBKeyRange=se._deps.IDBKeyRange,!this._IDBKeyRange)throw new G.MissingAPI})),this.on("versionchange",function(oe){0<oe.newVersion?console.warn("Another connection wants to upgrade database '".concat(P.name,"'. Closing db now to resume the upgrade.")):console.warn("Another connection wants to delete database '".concat(P.name,"'. Closing db now to resume the delete request.")),P.close({disableAutoOpen:!1})}),this.on("blocked",function(oe){!oe.newVersion||oe.newVersion<oe.oldVersion?console.warn("Dexie.delete('".concat(P.name,"') was blocked")):console.warn("Upgrade '".concat(P.name,"' blocked by other connection holding version ").concat(oe.oldVersion/10))}),this._maxKey=Pc(N.IDBKeyRange),this._createTransaction=function(oe,ve,le,fe){return new P.Transaction(oe,ve,le,P._options.chromeTransactionDurability,fe)},this._fireOnBlocked=function(oe){P.on("blocked").fire(oe),En.filter(function(ve){return ve.name===P.name&&ve!==P&&!ve._state.vcFired}).map(function(ve){return ve.on("versionchange").fire(oe)})},this.use(KR),this.use(ZR),this.use(YR),this.use(VR),this.use(WR);var pe=new Proxy(this,{get:function(oe,ve,le){if(ve==="_vip")return!0;if(ve==="table")return function(be){return dm(P.table(be),pe)};var fe=Reflect.get(oe,ve,le);return fe instanceof tm?dm(fe,pe):ve==="tables"?fe.map(function(be){return dm(be,pe)}):ve==="_createTransaction"?function(){return dm(fe.apply(this,arguments),pe)}:fe}});this.vip=pe,D.forEach(function(oe){return oe(P)})}var fm,Ao=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",JR=(Kb.prototype.subscribe=function(w,N,P){return this._subscribe(w&&typeof w!="function"?w:{next:w,error:N,complete:P})},Kb.prototype[Ao]=function(){return this},Kb);function Kb(w){this._subscribe=w}try{fm={indexedDB:a.indexedDB||a.mozIndexedDB||a.webkitIndexedDB||a.msIndexedDB,IDBKeyRange:a.IDBKeyRange||a.webkitIDBKeyRange}}catch{fm={indexedDB:null,IDBKeyRange:null}}function $1(w){var N,P=!1,D=new JR(function(z){var K=H(w),J,re=!1,se={},ce={},pe={get closed(){return re},unsubscribe:function(){re||(re=!0,J&&J.abort(),oe&&Ai.storagemutated.unsubscribe(le))}};z.start&&z.start(pe);var oe=!1,ve=function(){return eo(fe)},le=function(be){lm(se,be),$b(ce,se)&&ve()},fe=function(){var be,he,ye;!re&&fm.indexedDB&&(se={},be={},J&&J.abort(),J=new AbortController,ye=function(je){var Se=tr();try{K&&Ot();var Oe=bt(w,je);return Oe=K?Oe.finally(st):Oe}finally{Se&&_n()}}(he={subscr:be,signal:J.signal,requery:ve,querier:w,trans:null}),Promise.resolve(ye).then(function(je){P=!0,N=je,re||he.signal.aborted||(se={},function(Se){for(var Oe in Se)if(f(Se,Oe))return;return 1}(ce=be)||oe||(Ai(Cc,le),oe=!0),eo(function(){return!re&&z.next&&z.next(je)}))},function(je){P=!1,["DatabaseClosedError","AbortError"].includes(je?.name)||re||eo(function(){re||z.error&&z.error(je)})}))};return setTimeout(ve,0),pe});return D.hasValue=function(){return P},D.getValue=function(){return N},D}var Ps=za;function Yb(w){var N=Ti;try{Ti=!0,Ai.storagemutated.fire(w),Hb(w,!0)}finally{Ti=N}}h(Ps,n(n({},ie),{delete:function(w){return new Ps(w,{addons:[]}).delete()},exists:function(w){return new Ps(w,{addons:[]}).open().then(function(N){return N.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(w){try{return N=Ps.dependencies,P=N.indexedDB,N=N.IDBKeyRange,(Lb(P)?Promise.resolve(P.databases()).then(function(D){return D.map(function(z){return z.name}).filter(function(z){return z!==Vo})}):Db(P,N).toCollection().primaryKeys()).then(w)}catch{return Wt(new G.MissingAPI)}var N,P},defineClass:function(){return function(w){u(this,w)}},ignoreTransaction:function(w){return Ye.trans?Nr(Ye.transless,w):w()},vip:Rb,async:function(w){return function(){try{var N=qb(w.apply(this,arguments));return N&&typeof N.then=="function"?N:Be.resolve(N)}catch(P){return Wt(P)}}},spawn:function(w,N,P){try{var D=qb(w.apply(P,N||[]));return D&&typeof D.then=="function"?D:Be.resolve(D)}catch(z){return Wt(z)}},currentTransaction:{get:function(){return Ye.trans||null}},waitFor:function(w,N){return N=Be.resolve(typeof w=="function"?Ps.ignoreTransaction(w):w).timeout(N||6e4),Ye.trans?Ye.trans.waitFor(N):N},Promise:Be,debug:{get:function(){return ot},set:function(w){Ge(w)}},derive:b,extend:u,props:h,override:E,Events:Ci,on:Ai,liveQuery:$1,extendObservabilitySet:lm,getByKeyPath:C,setByKeyPath:O,delByKeyPath:function(w,N){typeof N=="string"?O(w,N,void 0):"length"in N&&[].map.call(N,function(P){O(w,P,void 0)})},shallowClone:M,deepClone:$,getObjectDiff:Ub,cmp:Xt,asap:S,minKey:-1/0,addons:[],connections:En,errnames:Q,dependencies:fm,cache:Cs,semVer:"4.2.0",version:"4.2.0".split(".").map(function(w){return parseInt(w)}).reduce(function(w,N,P){return w+N/Math.pow(10,2*P)})})),Ps.maxKey=Pc(Ps.dependencies.IDBKeyRange),typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Ai(Cc,function(w){Ti||(w=new CustomEvent(Cb,{detail:w}),Ti=!0,dispatchEvent(w),Ti=!1)}),addEventListener(Cb,function(w){w=w.detail,Ti||Yb(w)}));var Al,Ti=!1,B1=function(){};return typeof BroadcastChannel<"u"&&((B1=function(){(Al=new BroadcastChannel(Cb)).onmessage=function(w){return w.data&&Yb(w.data)}})(),typeof Al.unref=="function"&&Al.unref(),Ai(Cc,function(w){Ti||Al.postMessage(w)})),typeof addEventListener<"u"&&(addEventListener("pagehide",function(w){if(!za.disableBfCache&&w.persisted){ot&&console.debug("Dexie: handling persisted pagehide"),Al?.close();for(var N=0,P=En;N<P.length;N++)P[N].close({disableAutoOpen:!1})}}),addEventListener("pageshow",function(w){!za.disableBfCache&&w.persisted&&(ot&&console.debug("Dexie: handling persisted pageshow"),B1(),Yb({all:new Dn(-1/0,[[]])}))})),Be.rejectionMapper=function(w,N){return!w||w instanceof Y||w instanceof TypeError||w instanceof SyntaxError||!w.name||!de[w.name]?w:(N=new de[w.name](N||w.message,w),"stack"in w&&g(N,"stack",{get:function(){return this.inner.stack}}),N)},Ge(ot),n(za,Object.freeze({__proto__:null,Dexie:za,liveQuery:$1,Entity:Sl,cmp:Xt,PropModification:Te,replacePrefix:function(w,N){return new Te({replacePrefix:[w,N]})},add:function(w){return new Te({add:w})},remove:function(w){return new Te({remove:w})},default:za,RangeSet:Dn,mergeRanges:Mc,rangesOverlap:P1}),{default:za}),za})}(Qk)),Qk.exports}var iF=aF();const ew=mr(iF),V1=Symbol.for("Dexie"),mu=globalThis[V1]||(globalThis[V1]=ew);if(ew.semVer!==mu.semVer)throw new Error(`Two different versions of Dexie loaded in the same app: ${ew.semVer} and ${mu.semVer}`);const{liveQuery:L2e,mergeRanges:R2e,rangesOverlap:F2e,RangeSet:$2e,cmp:B2e,Entity:z2e,PropModification:H2e,replacePrefix:q2e,add:U2e,remove:V2e,DexieYProvider:W2e}=mu;function sF(e,t,r){var n,o;typeof e=="function"?(n=t||[],o=r):(n=[],o=t);var a=y.useRef({hasResult:!1,result:o,error:null}),i=y.useReducer(function(c){return c+1},0);i[0];var s=i[1],u=y.useMemo(function(){var c=typeof e=="function"?e():e;if(!c||typeof c.subscribe!="function")throw e===c?new TypeError("Given argument to useObservable() was neither a valid observable nor a function."):new TypeError("Observable factory given to useObservable() did not return a valid observable.");if(!a.current.hasResult&&typeof window<"u"&&(typeof c.hasValue!="function"||c.hasValue()))if(typeof c.getValue=="function")a.current.result=c.getValue(),a.current.hasResult=!0;else{var d=c.subscribe(function(f){a.current.result=f,a.current.hasResult=!0});typeof d=="function"?d():d.unsubscribe()}return c},n);if(y.useDebugValue(a.current.result),y.useEffect(function(){var c=u.subscribe(function(d){var f=a.current;(f.error!==null||f.result!==d)&&(f.error=null,f.result=d,f.hasResult=!0,s())},function(d){var f=a.current;f.error!==d&&(f.error=d,s())});return typeof c=="function"?c:c.unsubscribe.bind(c)},n),a.current.error)throw a.current.error;return a.current.result}function ba(e,t,r){return sF(function(){return mu.liveQuery(e)},t||[],r)}typeof FinalizationRegistry<"u"&&new FinalizationRegistry(function(e){var t=mu.DexieYProvider;t&&t.release(e)});function Ur(e,t){const[r,n]=m.useState(()=>{if(typeof window>"u")return t;const o=localStorage.getItem(e);return o!==null?o:t});return m.useEffect(()=>{if(typeof window>"u")return;const o=a=>{if(a.key&&a.key!==e)return;const i=localStorage.getItem(e);n(i!==null?i:t)};return window.addEventListener("storage",o),window.addEventListener("local-storage",o),()=>{window.removeEventListener("storage",o),window.removeEventListener("local-storage",o)}},[e,t]),m.useEffect(()=>{typeof window>"u"||(r==null?localStorage.removeItem(e):localStorage.setItem(e,r),window.dispatchEvent(new CustomEvent("local-storage",{detail:{key:e,value:r}})))},[e,r]),[r,n]}const bf=e=>e>=200&&e<300?"bg-green-200 text-green-800":e>=300&&e<400?"bg-blue-200 text-blue-800":e>=400&&e<500?"bg-orange-600 text-orange-200":e>=500?"bg-red-800 text-red-100":"bg-gray-200 text-gray-800",vf=e=>{if(!e)return"";switch(e.toUpperCase()){case"GET":return"text-[rgb(0,107,230)]";case"POST":return"text-[rgb(23,131,135)]";case"PATCH":return"text-[rgb(204,75,0)]";case"DELETE":return"text-red-700";default:return""}},mj=e=>{if(!e)return"text-gray-700 dark:text-gray-200 border border-gray-700 dark:border-gray-200";switch(e.toUpperCase()){case"GET":return"text-green-700 dark:text-green-300 border border-green-700 dark:border-green-300";case"POST":return"text-sky-700 dark:text-white border border-sky-700 dark:border-sky-300";case"PUT":return"text-fuchsia-700 dark:text-fuchsia-300 border border-fuchsia-700 dark:border-fuchsia-300";case"PATCH":return"text-purple-700 dark:text-purple-300 border border-purple-700 dark:border-purple-300";case"DELETE":return"text-red-700 dark:text-red-300 border border-red-700 dark:border-red-300";case"OPTIONS":return"text-rose-700 dark:text-rose-300 border border-rose-700 dark:border-rose-300";case"HEAD":return"text-pink-700 dark:text-pink-300 border border-pink-700 dark:border-pink-300";default:return"text-gray-700 dark:text-gray-200 border border-gray-700 dark:border-gray-200"}},zn=(e,t)=>{if(!e)return"N/A";const r=new Date(e),n=r.toLocaleDateString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}),o=r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),a=t?.includeMilliseconds===!0?`.${String(r.getMilliseconds()).padStart(3,"0")}`:"";return`${n} at ${o}${a}`},ao=e=>{if(e==null)return"N/A";const t=Number(e);return t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(2)}s`:`${(t/6e4).toFixed(2)}m`},Ts=e=>{if(e==null)return"N/A";const t=Number(e);if(t===0)return"0 B";const r=["B","KB","MB","GB","TB"],n=Math.floor(Math.log10(t)/Math.log10(1024));return n===0?`${t} ${r[n]}`:`${(t/Math.pow(1024,n)).toFixed(2)} ${r[n]}`},lF=["bg-blue-100 dark:bg-blue-900/30","border-blue-700 dark:border-blue-500"].join(" "),uF="border-l-4",cF=({operation:e,opId:t,onSelect:r,onRemove:n,selected:o,showQueryParams:a=!1,selectedOperationRef:i})=>{var s,u,c,d,f,h,p,g,b;const v=O=>{r(O)},x=O=>{const M=new Date(O),A=String(M.getHours()).padStart(2,"0"),T=String(M.getMinutes()).padStart(2,"0"),_=String(M.getSeconds()).padStart(2,"0");return`${A}:${T}:${_}`},k=e?.path||((s=e?.request)==null?void 0:s.path),E=e?.query_params||((u=e?.request)==null?void 0:u.query_params);let j=k||e?.url||((c=e?.request)==null?void 0:c.url);const S=a&&k&&Array.isArray(E)&&E.length>0,C=S?`?${E.map(O=>`${O.name}=${O.value}`).join("&")}`:"";return S&&(j=`${k}${C}`),l.jsx("li",{ref:o?i:null,className:`flex items-center cursor-pointer hover:bg-gray-200 dark:hover:bg-dark-tremor-background-subtle ${uF} ${o?lF:"border-transparent"}`,onClick:()=>{v(e)},children:l.jsxs("div",{className:"flex items-center py-1 px-2 w-full [container-type:inline-size] [container-name:requestlist]",children:[l.jsx("div",{className:"w-16 flex justify-center",children:l.jsx("span",{className:`inline-flex px-3 py-1 text-xs font-semibold rounded-full ${bf(e?.status_code??((d=e?.response)==null?void 0:d.status))}`,children:(e?.status_code??((f=e?.response)==null?void 0:f.status))||"N/A"})}),l.jsx("div",{className:`w-20 text-center font-medium ${vf(e?.method||((h=e?.request)==null?void 0:h.method))}`,children:e?.method||((p=e?.request)==null?void 0:p.method)||"GET"}),l.jsx("div",{className:"flex-grow truncate text-left text-tremor-content-strong dark:text-dark-tremor-content-strong",title:j,children:k?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:k}),S&&l.jsx("span",{className:"text-gray-400 dark:text-gray-400",children:C})]}):j}),l.jsx("div",{className:"w-20 text-gray-900 dark:text-dark-tremor-content text-center text-xs hidden [@container(min-width:440px)]:inline",children:e!=null&&e.time?x(e.time):(g=e?.request)!=null&&g.timestamp?x(e.request.timestamp):"N/A"}),l.jsx("div",{className:"w-16 text-gray-500 dark:text-dark-tremor-content text-center text-xs hidden [@container(min-width:520px)]:inline",children:ao(e?.duration??((b=e?.timing)==null?void 0:b.duration))}),l.jsx("button",{className:"w-8 h-8 flex items-center justify-center cursor-pointer text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",onClick:O=>{O.stopPropagation(),n(t)},children:"✕"})]})})},Ys=({options:e=[],selected:t,onChange:r,placeholder:n="Add option...",colorFn:o})=>{const[a,i]=m.useState(""),[s,u]=m.useState(!1),[c,d]=m.useState(0),f=m.useRef(null),h=e.filter(v=>v.toLowerCase().includes(a.toLowerCase())&&!t.includes(v));m.useEffect(()=>{d(0)},[a,t]);const p=v=>{t.includes(v)||r([...t,v]),i("")},g=v=>{r(t.filter(x=>x!==v))},b=v=>{v.key==="ArrowDown"?(v.preventDefault(),d(x=>x+1<h.length?x+1:x)):v.key==="ArrowUp"?(v.preventDefault(),d(x=>x-1>=0?x-1:0)):v.key==="Enter"?(console.log("enter",c),v.preventDefault(),h.length>0&&p(h[c])):v.key==="Backspace"&&!a&&t.length>0&&g(t[t.length-1])};return l.jsxs("div",{className:"w-full max-w-md relative",children:[l.jsxs("div",{className:"flex flex-wrap items-center border border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm px-2 py-1 bg-white dark:bg-dark-tremor-background-subtle",children:[t.map(v=>l.jsxs("div",{className:`flex items-center rounded-full px-2 py-1 mr-2 my-1 text-xs ${o?o(v):"bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-200"}`,children:[l.jsx("span",{children:v}),l.jsx("button",{type:"button",onClick:()=>g(v),className:"ml-1 focus:outline-none cursor-pointer","aria-label":`Remove ${v}`,children:l.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:l.jsx("path",{fillRule:"evenodd",d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414
12
+ 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293
13
+ 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z`,clipRule:"evenodd"})})})]},v)),l.jsx("input",{ref:f,type:"text",className:"flex-grow outline-none p-1 text-gray-900 dark:text-dark-tremor-content placeholder-gray-400 dark:placeholder-dark-tremor-content-subtle bg-transparent dark:bg-dark-tremor-background-subtle border-0",placeholder:t.length>0?"":n,value:a,onChange:v=>i(v.target.value),onKeyDown:b,onFocus:()=>u(!0),onBlur:()=>setTimeout(()=>u(!1),100)})]}),s&&h.length>0&&l.jsx("ul",{className:"absolute left-0 right-0 border border-gray-300 dark:border-dark-tremor-border mt-1 rounded-md shadow-lg bg-white dark:bg-dark-tremor-background-subtle max-h-40 overflow-y-auto z-10",children:h.map((v,x)=>l.jsx("li",{className:`cursor-pointer px-2 py-1 hover:bg-indigo-100 dark:hover:bg-dark-tremor-background ${x===c?"bg-indigo-200 dark:bg-dark-tremor-background-muted":""} text-gray-900 dark:text-dark-tremor-content`,onMouseEnter:()=>d(x),onMouseDown:()=>p(v),children:v},v))})]})},c9=["GET","POST","PUT","PATCH","DELETE","OPTIONS","HEAD"],d9=["200","201","204","301","302","400","401","403","404","500","502","503"],dF=({isOpen:e,onClose:t,sortField:r,sortDirection:n,filters:o,setSortField:a,setSortDirection:i,setFilters:s,tagOptions:u=[]})=>{const c=()=>{a("time"),i("desc")},d=()=>{s({})},f=b=>{const v=b.target.value;s(x=>({...x,timestampRange:v,customStart:void 0,customEnd:void 0}))},h=(b,v)=>{s(x=>({...x,timestampRange:{...typeof x.timestampRange=="object"&&x.timestampRange||{},[b]:v}}))},p=c9,g=d9;return l.jsxs(l.Fragment,{children:[e&&l.jsx("div",{className:"fixed inset-0 bg-black opacity-50",style:{zIndex:9998},onClick:t}),l.jsxs("div",{className:`fixed top-0 left-0 h-full w-100 bg-white dark:bg-dark-tremor-background shadow-xl dark:shadow-dark-tremor-shadow transform transition-transform duration-300
14
+ ${e?"translate-x-0":"-translate-x-full"}
15
+ `,style:{zIndex:9999},children:[l.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-300 dark:border-dark-tremor-border bg-gray-50 dark:bg-dark-tremor-background-subtle",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-dark-tremor-content-strong",children:"Filter & Sort"}),l.jsx("button",{onClick:t,className:"text-gray-600 dark:text-dark-tremor-content hover:text-gray-800 dark:hover:text-dark-tremor-content-strong focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]}),l.jsxs("div",{className:"p-4 overflow-y-auto h-full",children:[l.jsxs("section",{className:"mb-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"mb-3 text-xs font-bold text-gray-600 dark:text-dark-tremor-content uppercase tracking-wide",children:"Sort By"}),l.jsx("button",{onClick:c,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"flex items-center text-xs",children:[l.jsx("input",{type:"radio",name:"sortField",value:"time",checked:r==="time",onChange:b=>a(b.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),l.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Timestamp"})]}),l.jsxs("label",{className:"flex items-center text-xs",children:[l.jsx("input",{type:"radio",name:"sortField",value:"status_code",checked:r==="status_code",onChange:b=>a(b.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),l.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Status"})]}),l.jsxs("label",{className:"flex items-center text-xs",children:[l.jsx("input",{type:"radio",name:"sortField",value:"method",checked:r==="method",onChange:b=>a(b.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),l.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Method"})]})]}),l.jsxs("div",{className:"mt-4",children:[l.jsx("h4",{className:"mb-2 text-xs font-bold text-gray-600 dark:text-dark-tremor-content uppercase tracking-wide",children:"Sort Direction"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"flex items-center text-xs",children:[l.jsx("input",{type:"radio",name:"sortDirection",value:"asc",checked:n==="asc",onChange:b=>i(b.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),l.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Ascending"})]}),l.jsxs("label",{className:"flex items-center text-xs",children:[l.jsx("input",{type:"radio",name:"sortDirection",value:"desc",checked:n==="desc",onChange:b=>i(b.target.value),className:"form-radio text-blue-600 dark:text-blue-500 h-3 w-3"}),l.jsx("span",{className:"ml-2 text-xs text-gray-700 dark:text-dark-tremor-content",children:"Descending"})]})]})]})]}),l.jsxs("section",{className:"mb-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"mb-3 text-xs font-bold text-gray-600 dark:text-dark-tremor-content uppercase tracking-wide",children:"Filters"}),l.jsx("button",{onClick:d,className:"text-xs text-blue-600 dark:text-blue-400 hover:underline cursor-pointer",children:"Reset"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Quick Time Range"}),l.jsxs("select",{value:typeof o.timestampRange=="string"?o.timestampRange:"",onChange:f,className:"block w-full border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm",children:[l.jsx("option",{value:"",children:"Any"}),l.jsx("option",{value:"5M",children:"Last 5 minutes"}),l.jsx("option",{value:"15M",children:"Last 15 minutes"}),l.jsx("option",{value:"30M",children:"Last 30 minutes"}),l.jsx("option",{value:"1H",children:"Last 1 hour"}),l.jsx("option",{value:"3H",children:"Last 3 hours"}),l.jsx("option",{value:"6H",children:"Last 6 hours"}),l.jsx("option",{value:"12H",children:"Last 12 hours"}),l.jsx("option",{value:"24H",children:"Last 24 hours"}),l.jsx("option",{value:"48H",children:"Last 48 hours"}),l.jsx("option",{value:"week",children:"Last Week"}),l.jsx("option",{value:"month",children:"Last Month"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Specific Time Range"}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx("input",{type:"datetime-local",value:typeof o.timestampRange=="object"&&o.timestampRange.start?o.timestampRange.start:"",onChange:b=>h("start",b.target.value),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),l.jsx("input",{type:"datetime-local",value:typeof o.timestampRange=="object"&&o.timestampRange.end?o.timestampRange.end:"",onChange:b=>h("end",b.target.value),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Status"}),l.jsx(Ys,{options:g,selected:o.status||[],onChange:b=>s(v=>({...v,status:b})),placeholder:"Add status code...",colorFn:bf})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Method"}),l.jsx(Ys,{options:p,selected:o.method||[],onChange:b=>s(v=>({...v,method:b})),placeholder:"Add method...",colorFn:mj})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Tags"}),l.jsx(Ys,{options:u,selected:o.tags||[],onChange:b=>s(v=>({...v,tags:b})),placeholder:"Add tag..."})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Path"}),l.jsx("input",{type:"text",placeholder:"e.g. /api/users",value:o.path||"",onChange:b=>s(v=>({...v,path:b.target.value})),className:"block w-full border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Duration (ms)"}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx("input",{type:"number",placeholder:"Min",value:o.durationMin||"",onChange:b=>s(v=>({...v,durationMin:b.target.value})),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),l.jsx("input",{type:"number",placeholder:"Max",value:o.durationMax||"",onChange:b=>s(v=>({...v,durationMax:b.target.value})),className:"w-1/2 border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Host"}),l.jsx("input",{type:"text",placeholder:"e.g. localhost",value:o.host||"",onChange:b=>s(v=>({...v,host:b.target.value})),className:"block w-full border border-gray-300 dark:border-dark-tremor-border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]})]})]})]})},pj=({currentPage:e,totalPages:t,meta:r,onPageChange:n,alwaysShow:o=!0})=>{const a=g=>{const b=Number(g);return Number.isFinite(b)?b:null},i=a(r?.page??r?.current_page),s=a(r?.total_pages??r?.totalPages),u=Math.max(0,s??a(t)??0),c=i??a(e)??1,d=u>0?Math.min(Math.max(1,c),u):1;if(u===0||!o&&u<=1)return null;const f=typeof n=="function",h=g=>{f&&(g<1||g>u||g!==d&&n(g))},p=((g,b)=>{const v=[];if(b<=7)for(let x=1;x<=b;x++)v.push(x);else if(g<=4){for(let x=1;x<=5;x++)v.push(x);v.push("ellipsis"),v.push(b)}else if(g>=b-3){v.push(1),v.push("ellipsis");for(let x=b-4;x<=b;x++)v.push(x)}else v.push(1),v.push("ellipsis"),v.push(g-1),v.push(g),v.push(g+1),v.push("ellipsis"),v.push(b);return v})(d,u);return l.jsx("nav",{className:"p-2 border-t border-gray-300",children:l.jsxs("ul",{className:"flex items-center justify-center -space-x-px h-8 text-xs",children:[l.jsx("li",{children:l.jsxs("button",{onClick:()=>h(d-1),disabled:!f||d<=1,className:"flex items-center justify-center px-2 h-7 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:[l.jsx("span",{className:"sr-only",children:"Previous"}),l.jsx("svg",{className:"w-2.5 h-2.5 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:l.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 1 1 5l4 4"})})]})}),p.map((g,b)=>{if(g==="ellipsis")return l.jsx("li",{children:l.jsx("span",{className:"flex items-center justify-center px-2 h-7 leading-tight text-gray-500 bg-white border border-gray-300 cursor-pointer",children:"..."})},`ellipsis-${b}`);const v=g===d;return l.jsx("li",{children:l.jsx("button",{onClick:()=>h(g),disabled:!f,className:v?"z-10 flex items-center justify-center px-2 h-7 leading-tight text-blue-600 border border-blue-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 disabled:cursor-not-allowed dark:border-gray-700 dark:bg-gray-700 dark:text-white cursor-pointer":"flex items-center justify-center px-2 h-7 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:g})},g)}),l.jsx("li",{children:l.jsxs("button",{onClick:()=>h(d+1),disabled:!f||d>=u,className:"flex items-center justify-center px-2 h-7 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white cursor-pointer",children:[l.jsx("span",{className:"sr-only",children:"Next"}),l.jsx("svg",{className:"w-2.5 h-2.5 rtl:rotate-180","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:l.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})})]})})]})})},W1=({color:e="currentColor",size:t=24,className:r,...n})=>y.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...n,className:"remixicon "+(r||"")},y.createElement("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"})),fF=({color:e="currentColor",size:t=24,className:r,...n})=>y.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...n,className:"remixicon "+(r||"")},y.createElement("path",{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V11H19L18.9999 6.413L11.2071 14.2071L9.79289 12.7929L17.5849 5H13V3H21Z"})),mF=({color:e="currentColor",size:t=24,className:r,...n})=>y.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...n,className:"remixicon "+(r||"")},y.createElement("path",{d:"M10.9042 2.10025L20.8037 3.51446L22.2179 13.414L13.0255 22.6063C12.635 22.9969 12.0019 22.9969 11.6113 22.6063L1.71184 12.7069C1.32131 12.3163 1.32131 11.6832 1.71184 11.2926L10.9042 2.10025ZM11.6113 4.22157L3.83316 11.9997L12.3184 20.485L20.0966 12.7069L19.036 5.28223L11.6113 4.22157ZM13.7327 10.5855C12.9516 9.80448 12.9516 8.53815 13.7327 7.7571C14.5137 6.97606 15.78 6.97606 16.5611 7.7571C17.3421 8.53815 17.3421 9.80448 16.5611 10.5855C15.78 11.3666 14.5137 11.3666 13.7327 10.5855Z"})),pF=({color:e="currentColor",size:t=24,className:r,...n})=>y.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:t,height:t,fill:e,...n,className:"remixicon "+(r||"")},y.createElement("path",{d:"M2 6L2 18H4L4 6H2ZM9.44975 7.05025L4.5 12L9.44727 16.9473L9.44826 13H14.5501L14.55 16.9492L19.5 11.9995L14.5503 7.04976L14.5502 11H9.44876L9.44975 7.05025ZM20 6H22V18H20V6Z"})),hF=({open:e,onClose:t,onConfirmAll:r,onConfirmFiltered:n,hasFilters:o})=>e?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"flex-shrink-0 bg-red-100 rounded-full p-2",children:l.jsx("svg",{className:"size-6 text-red-600",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}),l.jsxs("div",{className:"ml-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:o?"Clear Requests":"Clear All Requests"}),l.jsx("p",{className:"mt-2 text-sm text-gray-500",children:o?"You have active filters. Would you like to clear only the filtered requests or all requests?":"Are you sure you want to clear all requests? This action cannot be undone."})]})]}),l.jsxs("div",{className:"mt-6 flex justify-end space-x-3",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),o&&l.jsx("button",{onClick:()=>{n(),t()},className:"px-4 py-2 bg-yellow-500 text-white rounded hover:bg-yellow-600 text-sm",children:"Clear Filtered"}),l.jsx("button",{onClick:()=>{r(),t()},className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:"Clear All"})]})]})]}):null,gF=({text:e,align:t="center"})=>t==="left"?l.jsxs("div",{className:"flex items-center my-1",children:[l.jsx("span",{className:"px-3 text-xs text-slate-600",children:e}),l.jsx("div",{className:"flex-grow border-t border-gray-300"})]}):t==="right"?l.jsxs("div",{className:"flex items-center my-1",children:[l.jsx("div",{className:"flex-grow border-t border-gray-300"}),l.jsx("span",{className:"px-3 text-xs text-slate-600",children:e})]}):l.jsxs("div",{className:"flex items-center my-1",children:[l.jsx("div",{className:"flex-grow border-t border-gray-300"}),l.jsx("span",{className:"px-3 text-xs text-slate-600",children:e}),l.jsx("div",{className:"flex-grow border-t border-gray-300"})]}),bF=({operations:e,onSelect:t,onRemove:r,clearOperations:n,clearFilteredOperations:o,syncOperations:a,selectedOperation:i,currentPage:s,totalPages:u,totalCount:c,onPageChange:d,sortField:f,sortDirection:h,filters:p,setSortField:g,setSortDirection:b,setFilters:v,isSyncing:x,tagOptions:k=[]})=>{const[E,j]=m.useState(!1),[S,C]=m.useState(!1),O=m.useRef(null),[M,A]=Ur("showQueryParams","false"),T=M==="true",_=Object.entries(p||{}).reduce((W,[B,L])=>B==="timestampRange"&&typeof L=="object"?L.start||L.end?W+1:W:Array.isArray(L)?L.length>0?W+1:W:L?W+1:W,0),F=_>0?"bg-green-500 text-white":"bg-blue-500 text-white",$=W=>{const B=new Date(W),L=String(B.getDate()).padStart(2,"0"),q=String(B.getMonth()+1).padStart(2,"0");return`${B.getFullYear()}-${q}-${L}`},I=(W=>W.reduce((B,L)=>{var q;const U=L?.time||((q=L?.request)==null?void 0:q.timestamp),H=U?$(U):"N/A";return B[H]||(B[H]=[]),B[H].push(L),B},{}))(e),R=i?.id??null;return m.useEffect(()=>{if(!R||!O.current)return;const W=setTimeout(()=>{O.current&&O.current.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},150);return()=>clearTimeout(W)},[R]),l.jsxs("div",{className:"flex flex-col h-full relative",children:[l.jsxs("div",{className:"p-4 flex justify-between items-center",children:[l.jsxs("span",{className:"font-bold text-xl text-tremor-content-strong dark:text-dark-tremor-content-strong",children:["Requests (",e.length," of ",c,")"]}),l.jsxs("div",{className:"space-x-2 relative",children:[l.jsxs("button",{className:`relative px-3 py-1 rounded text-xs cursor-pointer ${F}`,onClick:()=>j(!0),children:[l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 text-white",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})}),_>0&&l.jsx("span",{className:"absolute -top-1 -right-1 bg-green-700 text-white text-[10px] font-bold w-4 h-4 flex items-center justify-center rounded-full",children:_})]}),l.jsx("button",{className:`px-3 py-1 bg-teal-500 text-white rounded text-xs ${x?"opacity-75 cursor-not-allowed":"cursor-pointer"}`,onClick:a,disabled:x,children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:`w-4 h-4 text-white ${x?"animate-spin":""}`,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.0228 9.34841H21.0154M21.0154 9.34841V4.3558M21.0154 9.34841L17.8342 6.1655C16.8437 5.17312 15.5866 4.4202 14.1349 4.03121C9.73377 2.85194 5.21 5.46374 4.03073 9.86484M7.97677 14.6517H2.98413M2.98413 14.6517V19.6444M2.98413 14.6517L6.16502 17.8347C7.15555 18.8271 8.41261 19.589 9.86436 19.969C14.2654 21.1483 18.7892 18.5364 19.9685 14.1353"})})}),l.jsx("button",{className:"px-3 py-1 bg-red-500 text-white rounded text-xs cursor-pointer",onClick:()=>C(!0),children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"w-4 h-4 text-white",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})})]})]}),l.jsxs("div",{className:"flex items-center bg-gray-200 dark:bg-dark-tremor-background-subtle p-2 border-b border-gray-300 dark:border-dark-tremor-border text-sm font-bold text-tremor-content-strong dark:text-dark-tremor-content-strong cursor-pointer [container-type:inline-size] [container-name:requestlist]",onClick:()=>j(!0),children:[l.jsx("div",{className:"w-16 text-center",children:"Status"}),l.jsx("div",{className:"w-20 text-center",children:"Method"}),l.jsxs("div",{className:"flex-grow text-left flex items-center",children:[l.jsx("span",{children:"Path"}),l.jsx("button",{type:"button",className:`ml-2 p-1 rounded transition-colors cursor-pointer ${T?"text-blue-700 bg-blue-100 hover:bg-blue-200 dark:text-blue-400 dark:bg-blue-900/30 dark:hover:bg-blue-900/50":"text-gray-500 hover:bg-gray-300 dark:text-gray-400 dark:hover:bg-gray-700"}`,title:`Toggle query params (${T?"On":"Off"})`,"aria-label":`Show query params: ${T?"On":"Off"}`,"aria-pressed":T,onClick:W=>{W.stopPropagation(),A(T?"false":"true")},children:l.jsx(pF,{className:"w-4 h-4"})})]}),l.jsx("div",{className:"w-20 text-center hidden [@container(min-width:450px)]:inline",children:"Time"}),l.jsx("div",{className:"w-16 text-right hidden [@container(min-width:530px)]:inline",children:"Duration"}),l.jsx("div",{className:"w-10"})]}),l.jsx("ul",{className:"overflow-y-auto flex-grow",style:{maxHeight:"calc(100vh - 40px - 100px - 49px - 64px)"},children:e.length===0?l.jsx("li",{className:"flex items-center justify-center h-full text-gray-500 dark:text-gray-400 text-2xl",children:"No operations"}):Object.entries(I).map(([W,B])=>l.jsxs(y.Fragment,{children:[l.jsx("li",{children:l.jsx(gF,{text:W,align:"center"})}),B.map((L,q)=>{const U=L.id||q;return l.jsx(cF,{opId:U,operation:L,onSelect:t,onRemove:r,selected:i&&i.id===U,showQueryParams:T,selectedOperationRef:O},U)})]},W))}),l.jsx(pj,{currentPage:s,totalPages:u,onPageChange:d}),l.jsx(dF,{isOpen:E,onClose:()=>j(!1),sortField:f,sortDirection:h,filters:p,setSortField:g,setSortDirection:b,setFilters:v,tagOptions:k}),l.jsx(hF,{open:S,onClose:()=>C(!1),onConfirmAll:n,onConfirmFiltered:o,hasFilters:_>0})]})},Km=({message:e,subMessage:t,onClose:r,type:n="success"})=>{const[o,a]=m.useState(3e3),[i,s]=m.useState(!1);m.useEffect(()=>{const p=setInterval(()=>{i||a(g=>Math.max(0,g-50))},50);return()=>clearInterval(p)},[i]),m.useEffect(()=>{o===0&&r()},[o,r]);const u=o/3e3*100,c=n==="error"?"border-red-500":"border-green-500",d=n==="error"?"text-red-500":"text-green-500",f=n==="error"?"bg-red-500":"bg-green-500",h=n==="error"?"M12 9v2m0 4h.01M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z":"M9 12.75L11.25 15L15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z";return l.jsx("div",{className:"fixed top-4 right-4 z-50 w-80",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:l.jsx("div",{className:`bg-white border-l-4 ${c} p-2 shadow-lg rounded-lg`,children:l.jsxs("div",{className:"flex items-start",children:[l.jsx("div",{className:"flex-shrink-0",children:l.jsx("svg",{className:`h-6 w-6 ${d}`,fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:h})})}),l.jsxs("div",{className:"ml-1 flex-1",children:[l.jsx("p",{className:"text-sm font-medium text-gray-900",children:e}),t&&l.jsx("p",{className:"mt-1 text-sm text-gray-500 break-words",children:t}),l.jsx("div",{className:`w-full h-1 rounded-t-lg ${f}`,style:{width:`${u}%`}})]}),l.jsx("div",{className:"ml-auto pl-1",children:l.jsxs("button",{onClick:r,className:`text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-${n==="error"?"red":"green"}-500`,children:[l.jsx("span",{className:"sr-only",children:"Close"}),l.jsx("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:l.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 0 1 1.414 0L10 8.586l4.293-4.293a1 1 0 1 1 1.414 1.414L11.414 10l4.293 4.293a1 1 0 0 1-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 1 1-1.414-1.414L8.586 10 4.293 5.707a1 1 0 0 1 0-1.414z",clipRule:"evenodd"})})]})})]})})})},f9=typeof document<"u"?y.useLayoutEffect:()=>{};var Xb;const vF=(Xb=y.useInsertionEffect)!==null&&Xb!==void 0?Xb:f9;function yF(e){const t=m.useRef(null);return vF(()=>{t.current=e},[e]),m.useCallback((...r)=>{const n=t.current;return n?.(...r)},[])}const gs=e=>{var t;return(t=e?.ownerDocument)!==null&&t!==void 0?t:document},Gs=e=>e&&"window"in e&&e.window===e?e:gs(e).defaultView||window;function m9(e,t){return t&&e?e.contains(t):!1}const tw=(e=document)=>e.activeElement;function p9(e){return e.target}function h9(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(r=h9(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Dt(){for(var e,t,r=0,n="",o=arguments.length;r<o;r++)(e=arguments[r])&&(t=h9(e))&&(n&&(n+=" "),n+=t);return n}function xF(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let r=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(r)&&r.some(n=>e.test(n.brand))||e.test(window.navigator.userAgent)}function kF(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function g9(e){let t=null;return()=>(t==null&&(t=e()),t)}const wF=g9(function(){return kF(/^Mac/i)}),jF=g9(function(){return xF(/Android/i)});function b9(){let e=m.useRef(new Map),t=m.useCallback((o,a,i,s)=>{let u=s!=null&&s.once?(...c)=>{e.current.delete(i),i(...c)}:i;e.current.set(i,{type:a,eventTarget:o,fn:u,options:s}),o.addEventListener(a,u,s)},[]),r=m.useCallback((o,a,i,s)=>{var u;let c=((u=e.current.get(i))===null||u===void 0?void 0:u.fn)||i;o.removeEventListener(a,c,s),e.current.delete(i)},[]),n=m.useCallback(()=>{e.current.forEach((o,a)=>{r(o.eventTarget,o.type,a,o.options)})},[r]);return m.useEffect(()=>n,[n]),{addGlobalListener:t,removeGlobalListener:r,removeAllGlobalListeners:n}}function EF(e){return e.pointerType===""&&e.isTrusted?!0:jF()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function v9(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function NF(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function y9(e){let t=m.useRef({isFocused:!1,observer:null});f9(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]);let r=yF(n=>{e?.(n)});return m.useCallback(n=>{if(n.target instanceof HTMLButtonElement||n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement||n.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=n.target,a=i=>{if(t.current.isFocused=!1,o.disabled){let s=v9(i);r(s)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",a,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var i;(i=t.current.observer)===null||i===void 0||i.disconnect();let s=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:s})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:s}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[r])}let SF=!1,yf=null,rw=new Set,cd=new Map,sl=!1,nw=!1;const OF={Tab:!0,Escape:!0};function hj(e,t){for(let r of rw)r(e,t)}function CF(e){return!(e.metaKey||!wF()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function fp(e){sl=!0,CF(e)&&(yf="keyboard",hj("keyboard",e))}function tu(e){yf="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(sl=!0,hj("pointer",e))}function x9(e){EF(e)&&(sl=!0,yf="virtual")}function k9(e){e.target===window||e.target===document||SF||!e.isTrusted||(!sl&&!nw&&(yf="virtual",hj("virtual",e)),sl=!1,nw=!1)}function w9(){sl=!1,nw=!0}function ow(e){if(typeof window>"u"||typeof document>"u"||cd.get(Gs(e)))return;const t=Gs(e),r=gs(e);let n=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){sl=!0,n.apply(this,arguments)},r.addEventListener("keydown",fp,!0),r.addEventListener("keyup",fp,!0),r.addEventListener("click",x9,!0),t.addEventListener("focus",k9,!0),t.addEventListener("blur",w9,!1),typeof PointerEvent<"u"&&(r.addEventListener("pointerdown",tu,!0),r.addEventListener("pointermove",tu,!0),r.addEventListener("pointerup",tu,!0)),t.addEventListener("beforeunload",()=>{j9(e)},{once:!0}),cd.set(t,{focus:n})}const j9=(e,t)=>{const r=Gs(e),n=gs(e);t&&n.removeEventListener("DOMContentLoaded",t),cd.has(r)&&(r.HTMLElement.prototype.focus=cd.get(r).focus,n.removeEventListener("keydown",fp,!0),n.removeEventListener("keyup",fp,!0),n.removeEventListener("click",x9,!0),r.removeEventListener("focus",k9,!0),r.removeEventListener("blur",w9,!1),typeof PointerEvent<"u"&&(n.removeEventListener("pointerdown",tu,!0),n.removeEventListener("pointermove",tu,!0),n.removeEventListener("pointerup",tu,!0)),cd.delete(r))};function PF(e){const t=gs(e);let r;return t.readyState!=="loading"?ow(e):(r=()=>{ow(e)},t.addEventListener("DOMContentLoaded",r)),()=>j9(e,r)}typeof document<"u"&&PF();function E9(){return yf!=="pointer"}const AF=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function TF(e,t,r){let n=gs(r?.target);const o=typeof window<"u"?Gs(r?.target).HTMLInputElement:HTMLInputElement,a=typeof window<"u"?Gs(r?.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?Gs(r?.target).HTMLElement:HTMLElement,s=typeof window<"u"?Gs(r?.target).KeyboardEvent:KeyboardEvent;return e=e||n.activeElement instanceof o&&!AF.has(n.activeElement.type)||n.activeElement instanceof a||n.activeElement instanceof i&&n.activeElement.isContentEditable,!(e&&t==="keyboard"&&r instanceof s&&!OF[r.key])}function MF(e,t,r){ow(),m.useEffect(()=>{let n=(o,a)=>{TF(!!(r!=null&&r.isTextInput),o,a)&&e(E9())};return rw.add(n),()=>{rw.delete(n)}},t)}function _F(e){let{isDisabled:t,onFocus:r,onBlur:n,onFocusChange:o}=e;const a=m.useCallback(u=>{if(u.target===u.currentTarget)return n&&n(u),o&&o(!1),!0},[n,o]),i=y9(a),s=m.useCallback(u=>{const c=gs(u.target),d=c?tw(c):tw();u.target===u.currentTarget&&d===p9(u.nativeEvent)&&(r&&r(u),o&&o(!0),i(u))},[o,r,i]);return{focusProps:{onFocus:!t&&(r||o||n)?s:void 0,onBlur:!t&&(n||o)?a:void 0}}}function IF(e){let{isDisabled:t,onBlurWithin:r,onFocusWithin:n,onFocusWithinChange:o}=e,a=m.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:s}=b9(),u=m.useCallback(f=>{f.currentTarget.contains(f.target)&&a.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(a.current.isFocusWithin=!1,s(),r&&r(f),o&&o(!1))},[r,o,a,s]),c=y9(u),d=m.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const h=gs(f.target),p=tw(h);if(!a.current.isFocusWithin&&p===p9(f.nativeEvent)){n&&n(f),o&&o(!0),a.current.isFocusWithin=!0,c(f);let g=f.currentTarget;i(h,"focus",b=>{if(a.current.isFocusWithin&&!m9(g,b.target)){let v=new h.defaultView.FocusEvent("blur",{relatedTarget:b.target});NF(v,g);let x=v9(v);u(x)}},{capture:!0})}},[n,o,c,i,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:u}}}let aw=!1,pm=0;function DF(){aw=!0,setTimeout(()=>{aw=!1},50)}function K1(e){e.pointerType==="touch"&&DF()}function LF(){if(!(typeof document>"u"))return pm===0&&(typeof PointerEvent<"u"&&document.addEventListener("pointerup",K1)),pm++,()=>{pm--,!(pm>0)&&(typeof PointerEvent<"u"&&document.removeEventListener("pointerup",K1))}}function oa(e){let{onHoverStart:t,onHoverChange:r,onHoverEnd:n,isDisabled:o}=e,[a,i]=m.useState(!1),s=m.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;m.useEffect(LF,[]);let{addGlobalListener:u,removeAllGlobalListeners:c}=b9(),{hoverProps:d,triggerHoverEnd:f}=m.useMemo(()=>{let h=(b,v)=>{if(s.pointerType=v,o||v==="touch"||s.isHovered||!b.currentTarget.contains(b.target))return;s.isHovered=!0;let x=b.currentTarget;s.target=x,u(gs(b.target),"pointerover",k=>{s.isHovered&&s.target&&!m9(s.target,k.target)&&p(k,k.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:x,pointerType:v}),r&&r(!0),i(!0)},p=(b,v)=>{let x=s.target;s.pointerType="",s.target=null,!(v==="touch"||!s.isHovered||!x)&&(s.isHovered=!1,c(),n&&n({type:"hoverend",target:x,pointerType:v}),r&&r(!1),i(!1))},g={};return typeof PointerEvent<"u"&&(g.onPointerEnter=b=>{aw&&b.pointerType==="mouse"||h(b,b.pointerType)},g.onPointerLeave=b=>{!o&&b.currentTarget.contains(b.target)&&p(b,b.pointerType)}),{hoverProps:g,triggerHoverEnd:p}},[t,r,n,o,s,u,c]);return m.useEffect(()=>{o&&f({currentTarget:s.target},s.pointerType)},[o]),{hoverProps:d,isHovered:a}}function qo(e={}){let{autoFocus:t=!1,isTextInput:r,within:n}=e,o=m.useRef({isFocused:!1,isFocusVisible:t||E9()}),[a,i]=m.useState(!1),[s,u]=m.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=m.useCallback(()=>u(o.current.isFocused&&o.current.isFocusVisible),[]),d=m.useCallback(p=>{o.current.isFocused=p,i(p),c()},[c]);MF(p=>{o.current.isFocusVisible=p,c()},[],{isTextInput:r});let{focusProps:f}=_F({isDisabled:n,onFocusChange:d}),{focusWithinProps:h}=IF({isDisabled:!n,onFocusWithinChange:d});return{isFocused:a,isFocusVisible:s,focusProps:n?h:f}}var RF=Object.defineProperty,FF=(e,t,r)=>t in e?RF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zb=(e,t,r)=>(FF(e,typeof t!="symbol"?t+"":t,r),r);let $F=class{constructor(){Zb(this,"current",this.detect()),Zb(this,"handoffState","pending"),Zb(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},va=new $F;function hi(e){var t;return va.isServer?null:e==null?document:(t=e?.ownerDocument)!=null?t:document}function ns(e){var t,r;return va.isServer?null:e==null?document:(r=(t=e?.getRootNode)==null?void 0:t.call(e))!=null?r:document}function os(e){var t,r;return(r=(t=ns(e))==null?void 0:t.activeElement)!=null?r:null}function N9(e){return os(e)===e}function Lh(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function uo(){let e=[],t={addEventListener(r,n,o,a){return r.addEventListener(n,o,a),t.add(()=>r.removeEventListener(n,o,a))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Lh(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,o){let a=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:o}),this.add(()=>{Object.assign(r.style,{[n]:a})})},group(r){let n=uo();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let o of e.splice(n,1))o()}},dispose(){for(let r of e.splice(0))r()}};return t}function gi(){let[e]=m.useState(uo);return m.useEffect(()=>()=>e.dispose(),[e]),e}let Dr=(e,t)=>{va.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function oi(e){let t=m.useRef(e);return Dr(()=>{t.current=e},[e]),t}let rt=function(e){let t=oi(e);return y.useCallback((...r)=>t.current(...r),[t])};function BF(e){let t=e.width/2,r=e.height/2;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}function zF(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Rh({disabled:e=!1}={}){let t=m.useRef(null),[r,n]=m.useState(!1),o=gi(),a=rt(()=>{t.current=null,n(!1),o.dispose()}),i=rt(s=>{if(o.dispose(),t.current===null){t.current=s.currentTarget,n(!0);{let u=hi(s.currentTarget);o.addEventListener(u,"pointerup",a,!1),o.addEventListener(u,"pointermove",c=>{if(t.current){let d=BF(c);n(zF(d,t.current.getBoundingClientRect()))}},!1),o.addEventListener(u,"pointercancel",a,!1)}}});return{pressed:r,pressProps:e?{}:{onPointerDown:i,onPointerUp:a,onClick:a}}}function kn(e){return m.useMemo(()=>e,Object.values(e))}let HF=m.createContext(void 0);function gj(){return m.useContext(HF)}function iw(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function pn(e,t,...r){if(e in t){let o=t[e];return typeof o=="function"?o(...r):o}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,pn),n}var Fo=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Fo||{}),Ui=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Ui||{});function pr(){let e=UF();return m.useCallback(t=>qF({mergeRefs:e,...t}),[e])}function qF({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:o,visible:a=!0,name:i,mergeRefs:s}){s=s??VF;let u=S9(t,e);if(a)return hm(u,r,n,i,s);let c=o??0;if(c&2){let{static:d=!1,...f}=u;if(d)return hm(f,r,n,i,s)}if(c&1){let{unmount:d=!0,...f}=u;return pn(d?0:1,{0(){return null},1(){return hm({...f,hidden:!0,style:{display:"none"}},r,n,i,s)}})}return hm(u,r,n,i,s)}function hm(e,t={},r,n,o){let{as:a=r,children:i,refName:s="ref",...u}=Jb(e,["unmount","static"]),c=e.ref!==void 0?{[s]:e.ref}:{},d=typeof i=="function"?i(t):i;"className"in u&&u.className&&typeof u.className=="function"&&(u.className=u.className(t)),u["aria-labelledby"]&&u["aria-labelledby"]===u.id&&(u["aria-labelledby"]=void 0);let f={};if(t){let h=!1,p=[];for(let[g,b]of Object.entries(t))typeof b=="boolean"&&(h=!0),b===!0&&p.push(g.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(h){f["data-headlessui-state"]=p.join(" ");for(let g of p)f[`data-${g}`]=""}}if(ru(a)&&(Object.keys(Fi(u)).length>0||Object.keys(Fi(f)).length>0))if(!m.isValidElement(d)||Array.isArray(d)&&d.length>1||KF(d)){if(Object.keys(Fi(u)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Fi(u)).concat(Object.keys(Fi(f))).map(h=>` - ${h}`).join(`
16
+ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(h=>` - ${h}`).join(`
17
+ `)].join(`
18
+ `))}else{let h=d.props,p=h?.className,g=typeof p=="function"?(...x)=>iw(p(...x),u.className):iw(p,u.className),b=g?{className:g}:{},v=S9(d.props,Fi(Jb(u,["ref"])));for(let x in f)x in v&&delete f[x];return m.cloneElement(d,Object.assign({},v,f,c,{ref:o(WF(d),c.ref)},b))}return m.createElement(a,Object.assign({},Jb(u,["ref"]),!ru(a)&&c,!ru(a)&&f),d)}function UF(){let e=m.useRef([]),t=m.useCallback(r=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return e.current=r,t}}function VF(...e){return e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}function S9(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let o in n)o.startsWith("on")&&typeof n[o]=="function"?(r[o]!=null||(r[o]=[]),r[o].push(n[o])):t[o]=n[o];if(t.disabled||t["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[o=>{var a;return(a=o?.preventDefault)==null?void 0:a.call(o)}]);for(let n in r)Object.assign(t,{[n](o,...a){let i=r[n];for(let s of i){if((o instanceof Event||o?.nativeEvent instanceof Event)&&o.defaultPrevented)return;s(o,...a)}}});return t}function ec(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let o in n)o.startsWith("on")&&typeof n[o]=="function"?(r[o]!=null||(r[o]=[]),r[o].push(n[o])):t[o]=n[o];for(let n in r)Object.assign(t,{[n](...o){let a=r[n];for(let i of a)i?.(...o)}});return t}function lr(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Fi(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function Jb(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function WF(e){return y.version.split(".")[0]>="19"?e.props.ref:e.ref}function ru(e){return e===m.Fragment||e===Symbol.for("react.fragment")}function KF(e){return ru(e.type)}function YF(e,t,r){let[n,o]=m.useState(r),a=e!==void 0,i=m.useRef(a),s=m.useRef(!1),u=m.useRef(!1);return a&&!i.current&&!s.current?(s.current=!0,i.current=a,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!a&&i.current&&!u.current&&(u.current=!0,i.current=a,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[a?e:n,rt(c=>(a||nr.flushSync(()=>o(c)),t?.(c)))]}function GF(e){let[t]=m.useState(e);return t}function O9(e={},t=null,r=[]){for(let[n,o]of Object.entries(e))P9(r,C9(t,n),o);return r}function C9(e,t){return e?e+"["+t+"]":t}function P9(e,t,r){if(Array.isArray(r))for(let[n,o]of r.entries())P9(e,C9(t,n.toString()),o);else r instanceof Date?e.push([t,r.toISOString()]):typeof r=="boolean"?e.push([t,r?"1":"0"]):typeof r=="string"?e.push([t,r]):typeof r=="number"?e.push([t,`${r}`]):r==null?e.push([t,""]):ZF(r)&&!m.isValidElement(r)&&O9(r,t,e)}function XF(e){var t,r;let n=(t=e?.form)!=null?t:e.closest("form");if(n){for(let o of n.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(r=n.requestSubmit)==null||r.call(n)}}function ZF(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let JF="span";var ai=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(ai||{});function QF(e,t){var r;let{features:n=1,...o}=e,a={ref:t,"aria-hidden":(n&2)===2?!0:(r=o["aria-hidden"])!=null?r:void 0,hidden:(n&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return pr()({ourProps:a,theirProps:o,slot:{},defaultTag:JF,name:"Hidden"})}let as=lr(QF),e$=m.createContext(null);function t$({children:e}){let t=m.useContext(e$);if(!t)return y.createElement(y.Fragment,null,e);let{target:r}=t;return r?nr.createPortal(y.createElement(y.Fragment,null,e),r):null}function r$({data:e,form:t,disabled:r,onReset:n,overrides:o}){let[a,i]=m.useState(null),s=gi();return m.useEffect(()=>{if(n&&a)return s.addEventListener(a,"reset",n)},[a,t,n]),y.createElement(t$,null,y.createElement(n$,{setForm:i,formId:t}),O9(e).map(([u,c])=>y.createElement(as,{features:ai.Hidden,...Fi({key:u,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:r,name:u,value:c,...o})})))}function n$({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let r=document.getElementById(t);r&&e(r)}},[e,t]),t?null:y.createElement(as,{features:ai.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:r=>{if(!r)return;let n=r.closest("form");n&&e(n)}})}let o$=m.createContext(void 0);function A9(){return m.useContext(o$)}function T9(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Qa(e){return T9(e)&&"tagName"in e}function Hn(e){return Qa(e)&&"accessKey"in e}function wo(e){return Qa(e)&&"tabIndex"in e}function a$(e){return Qa(e)&&"style"in e}function i$(e){return Hn(e)&&e.nodeName==="IFRAME"}function M9(e){return Hn(e)&&e.nodeName==="INPUT"}function sw(e){return Hn(e)&&e.nodeName==="LABEL"}function s$(e){return Hn(e)&&e.nodeName==="FIELDSET"}function _9(e){return Hn(e)&&e.nodeName==="LEGEND"}function l$(e){return Qa(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function pu(e){let t=e.parentElement,r=null;for(;t&&!s$(t);)_9(t)&&(r=t),t=t.parentElement;let n=t?.getAttribute("disabled")==="";return n&&u$(r)?!1:n}function u$(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(_9(t))return!1;t=t.previousElementSibling}return!0}let I9=Symbol();function bj(e,t=!0){return Object.assign(e,{[I9]:t})}function qr(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let r=rt(n=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(n):o.current=n)});return e.every(n=>n==null||n?.[I9])?void 0:r}let Fh=m.createContext(null);Fh.displayName="DescriptionContext";function D9(){let e=m.useContext(Fh);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,D9),t}return e}function c$(){var e,t;return(t=(e=m.useContext(Fh))==null?void 0:e.value)!=null?t:void 0}function vj(){let[e,t]=m.useState([]);return[e.length>0?e.join(" "):void 0,m.useMemo(()=>function(r){let n=rt(a=>(t(i=>[...i,a]),()=>t(i=>{let s=i.slice(),u=s.indexOf(a);return u!==-1&&s.splice(u,1),s}))),o=m.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props,value:r.value}),[n,r.slot,r.name,r.props,r.value]);return y.createElement(Fh.Provider,{value:o},r.children)},[t])]}let d$="p";function f$(e,t){let r=m.useId(),n=gj(),{id:o=`headlessui-description-${r}`,...a}=e,i=D9(),s=qr(t);Dr(()=>i.register(o),[o,i.register]);let u=kn({...i.slot,disabled:n||!1}),c={ref:s,...i.props,id:o};return pr()({ourProps:c,theirProps:a,slot:u,defaultTag:d$,name:i.name||"Description"})}let m$=lr(f$),L9=Object.assign(m$,{});var ar=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ar||{});let $h=m.createContext(null);$h.displayName="LabelContext";function yj(){let e=m.useContext($h);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,yj),t}return e}function R9(e){var t,r,n;let o=(r=(t=m.useContext($h))==null?void 0:t.value)!=null?r:void 0;return((n=void 0)!=null?n:0)>0?[o,...e].filter(Boolean).join(" "):o}function xj({inherit:e=!1}={}){let t=R9(),[r,n]=m.useState([]),o=e?[t,...r].filter(Boolean):r;return[o.length>0?o.join(" "):void 0,m.useMemo(()=>function(a){let i=rt(u=>(n(c=>[...c,u]),()=>n(c=>{let d=c.slice(),f=d.indexOf(u);return f!==-1&&d.splice(f,1),d}))),s=m.useMemo(()=>({register:i,slot:a.slot,name:a.name,props:a.props,value:a.value}),[i,a.slot,a.name,a.props,a.value]);return y.createElement($h.Provider,{value:s},a.children)},[n])]}let p$="label";function h$(e,t){var r;let n=m.useId(),o=yj(),a=A9(),i=gj(),{id:s=`headlessui-label-${n}`,htmlFor:u=a??((r=o.props)==null?void 0:r.htmlFor),passive:c=!1,...d}=e,f=qr(t);Dr(()=>o.register(s),[s,o.register]);let h=rt(b=>{let v=b.currentTarget;if(!(b.target!==b.currentTarget&&l$(b.target))&&(sw(v)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),sw(v))){let x=document.getElementById(v.htmlFor);if(x){let k=x.getAttribute("disabled");if(k==="true"||k==="")return;let E=x.getAttribute("aria-disabled");if(E==="true"||E==="")return;(M9(x)&&(x.type==="file"||x.type==="radio"||x.type==="checkbox")||x.role==="radio"||x.role==="checkbox"||x.role==="switch")&&x.click(),x.focus({preventScroll:!0})}}}),p=kn({...o.slot,disabled:i||!1}),g={ref:f,...o.props,id:s,htmlFor:u,onClick:h};return c&&("onClick"in g&&(delete g.htmlFor,delete g.onClick),"onClick"in d&&delete d.onClick),pr()({ourProps:g,theirProps:d,slot:p,defaultTag:u?p$:"div",name:o.name||"Label"})}let g$=lr(h$),b$=Object.assign(g$,{}),v$=m.createContext(()=>{});function Bh({value:e,children:t}){return y.createElement(v$.Provider,{value:e},t)}function Tl(e,t,r){let n=r.initialDeps??[],o;function a(){var i,s,u,c;let d;r.key&&(i=r.debug)!=null&&i.call(r)&&(d=Date.now());const f=e();if(!(f.length!==n.length||f.some((p,g)=>n[g]!==p)))return o;n=f;let h;if(r.key&&(s=r.debug)!=null&&s.call(r)&&(h=Date.now()),o=t(...f),r.key&&(u=r.debug)!=null&&u.call(r)){const p=Math.round((Date.now()-d)*100)/100,g=Math.round((Date.now()-h)*100)/100,b=g/16,v=(x,k)=>{for(x=String(x);x.length<k;)x=" "+x;return x};console.info(`%c⏱ ${v(g,5)} /${v(p,5)} ms`,`
19
+ font-size: .6rem;
20
+ font-weight: bold;
21
+ color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,r?.key)}return(c=r?.onChange)==null||c.call(r,o),o}return a.updateDeps=i=>{n=i},a}function Y1(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const y$=(e,t)=>Math.abs(e-t)<1.01,x$=(e,t,r)=>{let n;return function(...o){e.clearTimeout(n),n=e.setTimeout(()=>t.apply(this,o),r)}},G1=e=>{const{offsetWidth:t,offsetHeight:r}=e;return{width:t,height:r}},k$=e=>e,w$=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1),n=[];for(let o=t;o<=r;o++)n.push(o);return n},j$=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;const o=i=>{const{width:s,height:u}=i;t({width:Math.round(s),height:Math.round(u)})};if(o(G1(r)),!n.ResizeObserver)return()=>{};const a=new n.ResizeObserver(i=>{const s=()=>{const u=i[0];if(u!=null&&u.borderBoxSize){const c=u.borderBoxSize[0];if(c){o({width:c.inlineSize,height:c.blockSize});return}}o(G1(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return a.observe(r,{box:"border-box"}),()=>{a.unobserve(r)}},X1={passive:!0},Z1=typeof window>"u"?!0:"onscrollend"in window,E$=(e,t)=>{const r=e.scrollElement;if(!r)return;const n=e.targetWindow;if(!n)return;let o=0;const a=e.options.useScrollendEvent&&Z1?()=>{}:x$(n,()=>{t(o,!1)},e.options.isScrollingResetDelay),i=d=>()=>{const{horizontal:f,isRtl:h}=e.options;o=f?r.scrollLeft*(h&&-1||1):r.scrollTop,a(),t(o,d)},s=i(!0),u=i(!1);u(),r.addEventListener("scroll",s,X1);const c=e.options.useScrollendEvent&&Z1;return c&&r.addEventListener("scrollend",u,X1),()=>{r.removeEventListener("scroll",s),c&&r.removeEventListener("scrollend",u)}},N$=(e,t,r)=>{if(t!=null&&t.borderBoxSize){const n=t.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}return e[r.options.horizontal?"offsetWidth":"offsetHeight"]},S$=(e,{adjustments:t=0,behavior:r},n)=>{var o,a;const i=e+t;(a=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||a.call(o,{[n.options.horizontal?"left":"top"]:i,behavior:r})};class O${constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let r=null;const n=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(a=>{const i=()=>{this._measureElement(a.target,a)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),r=null},observe:o=>{var a;return(a=n())==null?void 0:a.observe(o,{box:"border-box"})},unobserve:o=>{var a;return(a=n())==null?void 0:a.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([n,o])=>{typeof o>"u"&&delete r[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:k$,rangeExtractor:w$,onChange:()=>{},measureElement:N$,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...r}},this.notify=r=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,r)},this.maybeNotify=Tl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=a,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,n)=>{const o=new Map,a=new Map;for(let i=n-1;i>=0;i--){const s=r[i];if(o.has(s.lane))continue;const u=a.get(s.lane);if(u==null||s.end>u.end?a.set(s.lane,s):s.end<u.end&&o.set(s.lane,!0),o.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((i,s)=>i.end===s.end?i.index-s.index:i.end-s.end)[0]:void 0},this.getMeasurementOptions=Tl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(r,n,o,a,i)=>(this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:o,getItemKey:a,enabled:i}),{key:!1}),this.getMeasurements=Tl(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:n,scrollMargin:o,getItemKey:a,enabled:i},s)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const u=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,u);for(let d=u;d<r;d++){const f=a(d),h=this.options.lanes===1?c[d-1]:this.getFurthestMeasurement(c,d),p=h?h.end+this.options.gap:n+o,g=s.get(f),b=typeof g=="number"?g:this.options.estimateSize(d),v=p+b,x=h?h.lane:d%this.options.lanes;c[d]={index:d,start:p,size:b,end:v,key:f,lane:x}}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Tl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,o,a)=>this.range=r.length>0&&n>0?C$({measurements:r,outerSize:n,scrollOffset:o,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Tl(()=>{let r=null,n=null;const o=this.calculateRange();return o&&(r=o.startIndex,n=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,n]},(r,n,o,a,i)=>a===null||i===null?[]:r({startIndex:a,endIndex:i,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const n=this.options.indexAttribute,o=r.getAttribute(n);return o?parseInt(o,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(r,n)=>{const o=this.indexFromElement(r),a=this.measurementsCache[o];if(!a)return;const i=a.key,s=this.elementsCache.get(i);s!==r&&(s&&this.observer.unobserve(s),this.observer.observe(r),this.elementsCache.set(i,r)),r.isConnected&&this.resizeItem(o,this.options.measureElement(r,n,this))},this.resizeItem=(r,n)=>{const o=this.measurementsCache[r];if(!o)return;const a=this.itemSizeCache.get(o.key)??o.size,i=n-a;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,i,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,n)),this.notify(!1))},this.measureElement=r=>{if(!r){this.elementsCache.forEach((n,o)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(o))});return}this._measureElement(r,void 0)},this.getVirtualItems=Tl(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,n)=>{const o=[];for(let a=0,i=r.length;a<i;a++){const s=r[a],u=n[s];o.push(u)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const n=this.getMeasurements();if(n.length!==0)return Y1(n[F9(0,n.length-1,o=>Y1(n[o]).start,r)])},this.getOffsetForAlignment=(r,n,o=0)=>{const a=this.getSize(),i=this.getScrollOffset();n==="auto"&&(n=r>=i+a?"end":"start"),n==="center"?r+=(o-a)/2:n==="end"&&(r-=a);const s=this.getTotalSize()+this.options.scrollMargin-a;return Math.max(Math.min(s,r),0)},this.getOffsetForIndex=(r,n="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.measurementsCache[r];if(!o)return;const a=this.getSize(),i=this.getScrollOffset();if(n==="auto")if(o.end>=i+a-this.options.scrollPaddingEnd)n="end";else if(o.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];const s=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,n,o.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(r,{align:n="start",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(r,n),{adjustments:void 0,behavior:o})},this.scrollToIndex=(r,{align:n="auto",behavior:o}={})=>{o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r=Math.max(0,Math.min(r,this.options.count-1));let a=0;const i=10,s=c=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(r,c);if(!d){console.warn("Failed to get offset for index:",r);return}const[f,h]=d;this._scrollToOffset(f,{adjustments:void 0,behavior:o}),this.targetWindow.requestAnimationFrame(()=>{const p=this.getScrollOffset(),g=this.getOffsetForIndex(r,h);if(!g){console.warn("Failed to get offset for index:",r);return}y$(g[0],p)||u(h)})},u=c=>{this.targetWindow&&(a++,a<i?this.targetWindow.requestAnimationFrame(()=>s(c)):console.warn(`Failed to scroll to index ${r} after ${i} attempts.`))};s(n)},this.scrollBy=(r,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+r,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var r;const n=this.getMeasurements();let o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((r=n[n.length-1])==null?void 0:r.end)??0;else{const a=Array(this.options.lanes).fill(null);let i=n.length-1;for(;i>=0&&a.some(s=>s===null);){const s=n[i];a[s.lane]===null&&(a[s.lane]=s.end),i--}o=Math.max(...a.filter(s=>s!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:n,behavior:o})=>{this.options.scrollToFn(r,{behavior:o,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const F9=(e,t,r,n)=>{for(;e<=t;){const o=(e+t)/2|0,a=r(o);if(a<n)e=o+1;else if(a>n)t=o-1;else return o}return e>0?e-1:0};function C$({measurements:e,outerSize:t,scrollOffset:r,lanes:n}){const o=e.length-1,a=u=>e[u].start;if(e.length<=n)return{startIndex:0,endIndex:o};let i=F9(0,o,a,r),s=i;if(n===1)for(;s<o&&e[s].end<r+t;)s++;else if(n>1){const u=Array(n).fill(0);for(;s<o&&u.some(d=>d<r+t);){const d=e[s];u[d.lane]=d.end,s++}const c=Array(n).fill(r+t);for(;i>=0&&c.some(d=>d>=r);){const d=e[i];c[d.lane]=d.start,i--}i=Math.max(0,i-i%n),s=Math.min(o,s+(n-1-s%n))}return{startIndex:i,endIndex:s}}const J1=typeof document<"u"?m.useLayoutEffect:m.useEffect;function P$(e){const t=m.useReducer(()=>({}),{})[1],r={...e,onChange:(o,a)=>{var i;a?nr.flushSync(t):t(),(i=e.onChange)==null||i.call(e,o,a)}},[n]=m.useState(()=>new O$(r));return n.setOptions(r),J1(()=>n._didMount(),[]),J1(()=>n._willUpdate()),n}function A$(e){return P$({observeElementRect:j$,observeElementOffset:E$,scrollToFn:S$,...e})}function Q1(e){if(e===null)return{width:0,height:0};let{width:t,height:r}=e.getBoundingClientRect();return{width:t,height:r}}function $9(e,t,r=!1){let[n,o]=m.useState(()=>Q1(t));return Dr(()=>{if(!t||!e)return;let a=uo();return a.requestAnimationFrame(function i(){a.requestAnimationFrame(i),o(s=>{let u=Q1(t);return u.width===s.width&&u.height===s.height?s:u})}),()=>{a.dispose()}},[t,e]),r?{width:`${n.width}px`,height:`${n.height}px`}:n}var B9=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(B9||{});function T$(e){let t=m.useRef(null),r=rt(o=>{t.current=o.pointerType,!pu(o.currentTarget)&&o.pointerType==="mouse"&&o.button===B9.Left&&(o.preventDefault(),e(o))}),n=rt(o=>{t.current!=="mouse"&&(pu(o.currentTarget)||e(o))});return{onPointerDown:r,onClick:n}}let z9=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};var M$=Object.defineProperty,_$=(e,t,r)=>t in e?M$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,I$=(e,t,r)=>(_$(e,t+"",r),r),H9=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},To=(e,t,r)=>(H9(e,t,"read from private field"),r?r.call(e):t.get(e)),Qb=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},e5=(e,t,r,n)=>(H9(e,t,"write to private field"),t.set(e,r),r),ua,nd,od;let kj=class{constructor(e){Qb(this,ua,{}),Qb(this,nd,new z9(()=>new Set)),Qb(this,od,new Set),I$(this,"disposables",uo()),e5(this,ua,e),va.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return To(this,ua)}subscribe(e,t){if(va.isServer)return()=>{};let r={selector:e,callback:t,current:e(To(this,ua))};return To(this,od).add(r),this.disposables.add(()=>{To(this,od).delete(r)})}on(e,t){return va.isServer?()=>{}:(To(this,nd).get(e).add(t),this.disposables.add(()=>{To(this,nd).get(e).delete(t)}))}send(e){let t=this.reduce(To(this,ua),e);if(t!==To(this,ua)){e5(this,ua,t);for(let r of To(this,od)){let n=r.selector(To(this,ua));q9(r.current,n)||(r.current=n,r.callback(n))}for(let r of To(this,nd).get(e.type))r(To(this,ua),e)}}};ua=new WeakMap,nd=new WeakMap,od=new WeakMap;function q9(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:ev(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:ev(e.entries(),t.entries()):t5(e)&&t5(t)?ev(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function ev(e,t){do{let r=e.next(),n=t.next();if(r.done&&n.done)return!0;if(r.done||n.done||!Object.is(r.value,n.value))return!1}while(!0)}function t5(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function r5(e){let[t,r]=e(),n=uo();return(...o)=>{t(...o),n.dispose(),n.microTask(r)}}var D$=Object.defineProperty,L$=(e,t,r)=>t in e?D$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,n5=(e,t,r)=>(L$(e,typeof t!="symbol"?t+"":t,r),r),U9=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(U9||{});let R$={0(e,t){let r=t.id,n=e.stack,o=e.stack.indexOf(r);if(o!==-1){let a=e.stack.slice();return a.splice(o,1),a.push(r),n=a,{...e,stack:n}}return{...e,stack:[...e.stack,r]}},1(e,t){let r=t.id,n=e.stack.indexOf(r);if(n===-1)return e;let o=e.stack.slice();return o.splice(n,1),{...e,stack:o}}},F$=class V9 extends kj{constructor(){super(...arguments),n5(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),n5(this,"selectors",{isTop:(t,r)=>t.stack[t.stack.length-1]===r,inStack:(t,r)=>t.stack.includes(r)})}static new(){return new V9({stack:[]})}reduce(t,r){return pn(r.type,R$,t,r)}};const xf=new z9(()=>F$.new());var o5={exports:{}},tv={};/**
22
+ * @license React
23
+ * use-sync-external-store-with-selector.production.js
24
+ *
25
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */var a5;function $$(){if(a5)return tv;a5=1;var e=y;function t(u,c){return u===c&&(u!==0||1/u===1/c)||u!==u&&c!==c}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,o=e.useRef,a=e.useEffect,i=e.useMemo,s=e.useDebugValue;return tv.useSyncExternalStoreWithSelector=function(u,c,d,f,h){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=i(function(){function v(S){if(!x){if(x=!0,k=S,S=f(S),h!==void 0&&g.hasValue){var C=g.value;if(h(C,S))return E=C}return E=S}if(C=E,r(k,S))return C;var O=f(S);return h!==void 0&&h(C,O)?(k=S,C):(k=S,E=O)}var x=!1,k,E,j=d===void 0?null:d;return[function(){return v(c())},j===null?void 0:function(){return v(j())}]},[c,d,f,h]);var b=n(u,p[0],p[1]);return a(function(){g.hasValue=!0,g.value=b},[b]),s(b),b},tv}var i5;function B$(){return i5||(i5=1,o5.exports=$$()),o5.exports}var z$=B$();function On(e,t,r=q9){return z$.useSyncExternalStoreWithSelector(rt(n=>e.subscribe(H$,n)),rt(()=>e.state),rt(()=>e.state),rt(t),r)}function H$(e){return e}function kf(e,t){let r=m.useId(),n=xf.get(t),[o,a]=On(n,m.useCallback(i=>[n.selectors.isTop(i,r),n.selectors.inStack(i,r)],[n,r]));return Dr(()=>{if(e)return n.actions.push(r),()=>n.actions.pop(r)},[n,e,r]),e?a?o:!0:!1}let lw=new Map,dd=new Map;function s5(e){var t;let r=(t=dd.get(e))!=null?t:0;return dd.set(e,r+1),r!==0?()=>l5(e):(lw.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>l5(e))}function l5(e){var t;let r=(t=dd.get(e))!=null?t:1;if(r===1?dd.delete(e):dd.set(e,r-1),r!==1)return;let n=lw.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,lw.delete(e))}function W9(e,{allowed:t,disallowed:r}={}){let n=kf(e,"inert-others");Dr(()=>{var o,a;if(!n)return;let i=uo();for(let u of(o=r?.())!=null?o:[])u&&i.add(s5(u));let s=(a=t?.())!=null?a:[];for(let u of s){if(!u)continue;let c=hi(u);if(!c)continue;let d=u.parentElement;for(;d&&d!==c.body;){for(let f of d.children)s.some(h=>f.contains(h))||i.add(s5(f));d=d.parentElement}}return i.dispose},[n,t,r])}function wj(e,t,r){let n=oi(o=>{let a=o.getBoundingClientRect();a.x===0&&a.y===0&&a.width===0&&a.height===0&&r()});m.useEffect(()=>{if(!e)return;let o=t===null?null:Hn(t)?t:t.current;if(!o)return;let a=uo();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>n.current(o));i.observe(o),a.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>n.current(o));i.observe(o),a.add(()=>i.disconnect())}return()=>a.dispose()},[t,n,e])}let mp=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),q$=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var vn=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(vn||{}),hu=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(hu||{}),U$=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(U$||{});function wf(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(mp)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}function V$(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(q$)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var zh=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(zh||{});function Hh(e,t=0){var r;return e===((r=hi(e))==null?void 0:r.body)?!1:pn(t,{0(){return e.matches(mp)},1(){let n=e;for(;n!==null;){if(n.matches(mp))return!0;n=n.parentElement}return!1}})}function K9(e){uo().nextFrame(()=>{let t=os(e);t&&wo(t)&&!Hh(t,0)&&ya(e)})}var W$=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(W$||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function ya(e){e?.focus({preventScroll:!0})}let K$=["textarea","input"].join(",");function Y$(e){var t,r;return(r=(t=e?.matches)==null?void 0:t.call(e,K$))!=null?r:!1}function Y9(e,t=r=>r){return e.slice().sort((r,n)=>{let o=t(r),a=t(n);if(o===null||a===null)return 0;let i=o.compareDocumentPosition(a);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function G$(e,t,r=e===null?document.body:ns(e)){return jo(wf(r),t,{relativeTo:e})}function jo(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?ns(e[0]):document:ns(e),i=Array.isArray(e)?r?Y9(e):e:t&64?V$(e):wf(e);o.length>0&&i.length>1&&(i=i.filter(p=>!o.some(g=>g!=null&&"current"in g?g?.current===p:g===p))),n=n??a?.activeElement;let s=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(n))-1;if(t&4)return Math.max(0,i.indexOf(n))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},d=0,f=i.length,h;do{if(d>=f||d+f<=0)return 0;let p=u+d;if(t&16)p=(p+f)%f;else{if(p<0)return 3;if(p>=f)return 1}h=i[p],h?.focus(c),d+=s}while(h!==os(h));return t&6&&Y$(h)&&h.select(),2}function G9(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function X$(){return/Android/gi.test(window.navigator.userAgent)}function u5(){return G9()||X$()}function Ul(e,t,r,n){let o=oi(r);m.useEffect(()=>{if(!e)return;function a(i){o.current(i)}return document.addEventListener(t,a,n),()=>document.removeEventListener(t,a,n)},[e,t,n])}function X9(e,t,r,n){let o=oi(r);m.useEffect(()=>{if(!e)return;function a(i){o.current(i)}return window.addEventListener(t,a,n),()=>window.removeEventListener(t,a,n)},[e,t,n])}const c5=30;function jj(e,t,r){let n=oi(r),o=m.useCallback(function(s,u){if(s.defaultPrevented)return;let c=u(s);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let d=function f(h){return typeof h=="function"?f(h()):Array.isArray(h)||h instanceof Set?h:[h]}(t);for(let f of d)if(f!==null&&(f.contains(c)||s.composed&&s.composedPath().includes(f)))return;return!Hh(c,zh.Loose)&&c.tabIndex!==-1&&s.preventDefault(),n.current(s,c)},[n,t]),a=m.useRef(null);Ul(e,"pointerdown",s=>{var u,c;u5()||(a.current=((c=(u=s.composedPath)==null?void 0:u.call(s))==null?void 0:c[0])||s.target)},!0),Ul(e,"pointerup",s=>{if(u5()||!a.current)return;let u=a.current;return a.current=null,o(s,()=>u)},!0);let i=m.useRef({x:0,y:0});Ul(e,"touchstart",s=>{i.current.x=s.touches[0].clientX,i.current.y=s.touches[0].clientY},!0),Ul(e,"touchend",s=>{let u={x:s.changedTouches[0].clientX,y:s.changedTouches[0].clientY};if(!(Math.abs(u.x-i.current.x)>=c5||Math.abs(u.y-i.current.y)>=c5))return o(s,()=>wo(s.target)?s.target:null)},!0),X9(e,"blur",s=>o(s,()=>i$(window.document.activeElement)?window.document.activeElement:null),!0)}function ll(...e){return m.useMemo(()=>hi(...e),[...e])}function Z$(...e){return m.useMemo(()=>ns(...e),[...e])}var J$=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(J$||{});const gm={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},Q$=200,d5=5;function eB(e,{trigger:t,action:r,close:n,select:o}){let a=m.useRef(null),i=m.useRef(null),s=m.useRef(null);Ul(e&&t!==null,"pointerdown",u=>{T9(u?.target)&&t!=null&&t.contains(u.target)&&(i.current=u.x,s.current=u.y,a.current=u.timeStamp)}),Ul(e&&t!==null,"pointerup",u=>{var c,d;let f=a.current;if(f===null||(a.current=null,!wo(u.target))||Math.abs(u.x-((c=i.current)!=null?c:u.x))<d5&&Math.abs(u.y-((d=s.current)!=null?d:u.y))<d5)return;let h=r(u);switch(h.kind){case 0:return;case 1:{u.timeStamp-f>Q$&&(o(h.target),n());break}case 2:{n();break}}},{capture:!0})}function Ej(e,t,r,n){let o=oi(r);m.useEffect(()=>{e=e??window;function a(i){o.current(i)}return e.addEventListener(t,a,n),()=>e.removeEventListener(t,a,n)},[e,t,n])}function qh(e,t){return m.useMemo(()=>{var r;if(e.type)return e.type;let n=(r=e.as)!=null?r:"button";if(typeof n=="string"&&n.toLowerCase()==="button"||t?.tagName==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function tB(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function rB(e,t){let r=e(),n=new Set;return{getSnapshot(){return r},subscribe(o){return n.add(o),()=>n.delete(o)},dispatch(o,...a){let i=t[o].call(r,...a);i&&(r=i,n.forEach(s=>s()))}}}function nB(){let e;return{before({doc:t}){var r;let n=t.documentElement,o=(r=t.defaultView)!=null?r:window;e=Math.max(0,o.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,o=Math.max(0,n.clientWidth-n.offsetWidth),a=Math.max(0,e-o);r.style(n,"paddingRight",`${a}px`)}}}function oB(){return G9()?{before({doc:e,d:t,meta:r}){function n(o){for(let a of r().containers)for(let i of a())if(i.contains(o))return!0;return!1}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let s=uo();s.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>s.dispose()))}let a=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",s=>{if(wo(s.target))try{let u=s.target.closest("a");if(!u)return;let{hash:c}=new URL(u.href),d=e.querySelector(c);wo(d)&&!n(d)&&(i=d)}catch{}},!0),t.group(s=>{t.addEventListener(e,"touchstart",u=>{if(s.dispose(),wo(u.target)&&a$(u.target))if(n(u.target)){let c=u.target;for(;c.parentElement&&n(c.parentElement);)c=c.parentElement;s.style(c,"overscrollBehavior","contain")}else s.style(u.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",s=>{if(wo(s.target)){if(M9(s.target))return;if(n(s.target)){let u=s.target;for(;u.parentElement&&u.dataset.headlessuiPortal!==""&&!(u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth);)u=u.parentElement;u.dataset.headlessuiPortal===""&&s.preventDefault()}else s.preventDefault()}},{passive:!1}),t.add(()=>{var s;let u=(s=window.scrollY)!=null?s:window.pageYOffset;a!==u&&window.scrollTo(0,a),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function aB(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function f5(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let Xs=rB(()=>new Map,{PUSH(e,t){var r;let n=(r=this.get(e))!=null?r:{doc:e,count:0,d:uo(),meta:new Set,computedMeta:{}};return n.count++,n.meta.add(t),n.computedMeta=f5(n.meta),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t),r.computedMeta=f5(r.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},r=[oB(),nB(),aB()];r.forEach(({before:n})=>n?.(t)),r.forEach(({after:n})=>n?.(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Xs.subscribe(()=>{let e=Xs.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let n=t.get(r.doc)==="hidden",o=r.count!==0;(o&&!n||!o&&n)&&Xs.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),r.count===0&&Xs.dispatch("TEARDOWN",r)}});function iB(e,t,r=()=>({containers:[]})){let n=tB(Xs),o=t?n.get(t):void 0,a=o?o.count>0:!1;return Dr(()=>{if(!(!t||!e))return Xs.dispatch("PUSH",t,r),()=>Xs.dispatch("POP",t,r)},[e,t]),a}function Nj(e,t,r=()=>[document.body]){let n=kf(e,"scroll-lock");iB(n,t,o=>{var a;return{containers:[...(a=o.containers)!=null?a:[],r]}})}function m5(e){return[e.screenX,e.screenY]}function sB(){let e=m.useRef([-1,-1]);return{wasMoved(t){let r=m5(t);return e.current[0]===r[0]&&e.current[1]===r[1]?!1:(e.current=r,!0)},update(t){e.current=m5(t)}}}function lB(e=0){let[t,r]=m.useState(e),n=m.useCallback(u=>r(u),[]),o=m.useCallback(u=>r(c=>c|u),[]),a=m.useCallback(u=>(t&u)===u,[t]),i=m.useCallback(u=>r(c=>c&~u),[]),s=m.useCallback(u=>r(c=>c^u),[]);return{flags:t,setFlag:n,addFlag:o,hasFlag:a,removeFlag:i,toggleFlag:s}}var p5,h5;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((p5=process==null?void 0:u9)==null?void 0:p5.NODE_ENV)==="test"&&typeof((h5=Element?.prototype)==null?void 0:h5.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
30
+ `)),[]});var uB=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(uB||{});function jf(e){let t={};for(let r in e)e[r]===!0&&(t[`data-${r}`]="");return t}function Ef(e,t,r,n){let[o,a]=m.useState(r),{hasFlag:i,addFlag:s,removeFlag:u}=lB(e&&o?3:0),c=m.useRef(!1),d=m.useRef(!1),f=gi();return Dr(()=>{var h;if(e){if(r&&a(!0),!t){r&&s(3);return}return(h=n?.start)==null||h.call(n,r),cB(t,{inFlight:c,prepare(){d.current?d.current=!1:d.current=c.current,c.current=!0,!d.current&&(r?(s(3),u(4)):(s(4),u(2)))},run(){d.current?r?(u(3),s(4)):(u(4),s(3)):r?u(1):s(1)},done(){var p;d.current&&mB(t)||(c.current=!1,u(7),r||a(!1),(p=n?.end)==null||p.call(n,r))}})}},[e,r,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function cB(e,{prepare:t,run:r,done:n,inFlight:o}){let a=uo();return fB(e,{prepare:t,inFlight:o}),a.nextFrame(()=>{r(),a.requestAnimationFrame(()=>{a.add(dB(e,n))})}),a.dispose}function dB(e,t){var r,n;let o=uo();if(!e)return o.dispose;let a=!1;o.add(()=>{a=!0});let i=(n=(r=e.getAnimations)==null?void 0:r.call(e).filter(s=>s instanceof CSSTransition))!=null?n:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(s=>s.finished)).then(()=>{a||t()}),o.dispose)}function fB(e,{inFlight:t,prepare:r}){if(t!=null&&t.current){r();return}let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}function mB(e){var t,r;return((r=(t=e.getAnimations)==null?void 0:t.call(e))!=null?r:[]).some(n=>n instanceof CSSTransition&&n.playState!=="finished")}function pB(e,{container:t,accept:r,walk:n}){let o=m.useRef(r),a=m.useRef(n);m.useEffect(()=>{o.current=r,a.current=n},[r,n]),Dr(()=>{if(!t||!e)return;let i=hi(t);if(!i)return;let s=o.current,u=a.current,c=Object.assign(f=>s(f),{acceptNode:s}),d=i.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;d.nextNode();)u(d.currentNode)},[t,e,o,a])}function Sj(e,t){let r=m.useRef([]),n=rt(e);m.useEffect(()=>{let o=[...r.current];for(let[a,i]of t.entries())if(r.current[a]!==i){let s=n(t,o);return r.current=t,s}},[n,...t])}function Uh(){return typeof window<"u"}function tc(e){return Z9(e)?(e.nodeName||"").toLowerCase():"#document"}function So(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ia(e){var t;return(t=(Z9(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Z9(e){return Uh()?e instanceof Node||e instanceof So(e).Node:!1}function yn(e){return Uh()?e instanceof Element||e instanceof So(e).Element:!1}function Sa(e){return Uh()?e instanceof HTMLElement||e instanceof So(e).HTMLElement:!1}function g5(e){return!Uh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof So(e).ShadowRoot}function Nf(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=ea(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(o)}function hB(e){return["table","td","th"].includes(tc(e))}function Vh(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Oj(e){const t=Cj(),r=yn(e)?ea(e):e;return["transform","translate","scale","rotate","perspective"].some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function gB(e){let t=is(e);for(;Sa(t)&&!gu(t);){if(Oj(t))return t;if(Vh(t))return null;t=is(t)}return null}function Cj(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function gu(e){return["html","body","#document"].includes(tc(e))}function ea(e){return So(e).getComputedStyle(e)}function Wh(e){return yn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function is(e){if(tc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||g5(e)&&e.host||Ia(e);return g5(t)?t.host:t}function J9(e){const t=is(e);return gu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Sa(t)&&Nf(t)?t:J9(t)}function Ji(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=J9(e),a=o===((n=e.ownerDocument)==null?void 0:n.body),i=So(o);if(a){const s=uw(i);return t.concat(i,i.visualViewport||[],Nf(o)?o:[],s&&r?Ji(s):[])}return t.concat(o,Ji(o,[],r))}function uw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bB(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:r,version:n}=t;return r+"/"+n}).join(" "):navigator.userAgent}const vB=["top","right","bottom","left"],Oa=Math.min,gn=Math.max,bu=Math.round,bm=Math.floor,xa=e=>({x:e,y:e}),yB={left:"right",right:"left",bottom:"top",top:"bottom"},xB={start:"end",end:"start"};function cw(e,t,r){return gn(e,Oa(t,r))}function ta(e,t){return typeof e=="function"?e(t):e}function ii(e){return e.split("-")[0]}function rc(e){return e.split("-")[1]}function Pj(e){return e==="x"?"y":"x"}function Aj(e){return e==="y"?"height":"width"}function ss(e){return["top","bottom"].includes(ii(e))?"y":"x"}function Tj(e){return Pj(ss(e))}function kB(e,t,r){r===void 0&&(r=!1);const n=rc(e),o=Tj(e),a=Aj(o);let i=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=pp(i)),[i,pp(i)]}function wB(e){const t=pp(e);return[dw(e),t,dw(t)]}function dw(e){return e.replace(/start|end/g,t=>xB[t])}function jB(e,t,r){const n=["left","right"],o=["right","left"],a=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return r?t?o:n:t?n:o;case"left":case"right":return t?a:i;default:return[]}}function EB(e,t,r,n){const o=rc(e);let a=jB(ii(e),r==="start",n);return o&&(a=a.map(i=>i+"-"+o),t&&(a=a.concat(a.map(dw)))),a}function pp(e){return e.replace(/left|right|bottom|top/g,t=>yB[t])}function NB(e){return{top:0,right:0,bottom:0,left:0,...e}}function Q9(e){return typeof e!="number"?NB(e):{top:e,right:e,bottom:e,left:e}}function hp(e){const{x:t,y:r,width:n,height:o}=e;return{width:n,height:o,top:r,left:t,right:t+n,bottom:r+o,x:t,y:r}}function b5(e,t,r){let{reference:n,floating:o}=e;const a=ss(t),i=Tj(t),s=Aj(i),u=ii(t),c=a==="y",d=n.x+n.width/2-o.width/2,f=n.y+n.height/2-o.height/2,h=n[s]/2-o[s]/2;let p;switch(u){case"top":p={x:d,y:n.y-o.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:f};break;case"left":p={x:n.x-o.width,y:f};break;default:p={x:n.x,y:n.y}}switch(rc(t)){case"start":p[i]-=h*(r&&c?-1:1);break;case"end":p[i]+=h*(r&&c?-1:1);break}return p}const SB=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:a=[],platform:i}=r,s=a.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=b5(c,n,u),h=n,p={},g=0;for(let b=0;b<s.length;b++){const{name:v,fn:x}=s[b],{x:k,y:E,data:j,reset:S}=await x({x:d,y:f,initialPlacement:n,placement:h,strategy:o,middlewareData:p,rects:c,platform:i,elements:{reference:e,floating:t}});d=k??d,f=E??f,p={...p,[v]:{...p[v],...j}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(c=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:d,y:f}=b5(c,h,u)),b=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:p}};async function vu(e,t){var r;t===void 0&&(t={});const{x:n,y:o,platform:a,rects:i,elements:s,strategy:u}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=ta(t,e),g=Q9(p),b=s[h?f==="floating"?"reference":"floating":f],v=hp(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(b)))==null||r?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:u})),x=f==="floating"?{x:n,y:o,width:i.floating.width,height:i.floating.height}:i.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),E=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},j=hp(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:x,offsetParent:k,strategy:u}):x);return{top:(v.top-j.top+g.top)/E.y,bottom:(j.bottom-v.bottom+g.bottom)/E.y,left:(v.left-j.left+g.left)/E.x,right:(j.right-v.right+g.right)/E.x}}const OB=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:a,platform:i,elements:s,middlewareData:u}=t,{element:c,padding:d=0}=ta(e,t)||{};if(c==null)return{};const f=Q9(d),h={x:r,y:n},p=Tj(o),g=Aj(p),b=await i.getDimensions(c),v=p==="y",x=v?"top":"left",k=v?"bottom":"right",E=v?"clientHeight":"clientWidth",j=a.reference[g]+a.reference[p]-h[p]-a.floating[g],S=h[p]-a.reference[p],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let O=C?C[E]:0;(!O||!await(i.isElement==null?void 0:i.isElement(C)))&&(O=s.floating[E]||a.floating[g]);const M=j/2-S/2,A=O/2-b[g]/2-1,T=Oa(f[x],A),_=Oa(f[k],A),F=T,$=O-b[g]-_,I=O/2-b[g]/2+M,R=cw(F,I,$),W=!u.arrow&&rc(o)!=null&&I!==R&&a.reference[g]/2-(I<F?T:_)-b[g]/2<0,B=W?I<F?I-F:I-$:0;return{[p]:h[p]+B,data:{[p]:R,centerOffset:I-R-B,...W&&{alignmentOffset:B}},reset:W}}}),CB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:o,middlewareData:a,rects:i,initialPlacement:s,platform:u,elements:c}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=ta(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const x=ii(o),k=ss(s),E=ii(s)===s,j=await(u.isRTL==null?void 0:u.isRTL(c.floating)),S=h||(E||!b?[pp(s)]:wB(s)),C=g!=="none";!h&&C&&S.push(...EB(s,b,g,j));const O=[s,...S],M=await vu(t,v),A=[];let T=((n=a.flip)==null?void 0:n.overflows)||[];if(d&&A.push(M[x]),f){const I=kB(o,i,j);A.push(M[I[0]],M[I[1]])}if(T=[...T,{placement:o,overflows:A}],!A.every(I=>I<=0)){var _,F;const I=(((_=a.flip)==null?void 0:_.index)||0)+1,R=O[I];if(R)return{data:{index:I,overflows:T},reset:{placement:R}};let W=(F=T.filter(B=>B.overflows[0]<=0).sort((B,L)=>B.overflows[1]-L.overflows[1])[0])==null?void 0:F.placement;if(!W)switch(p){case"bestFit":{var $;const B=($=T.filter(L=>{if(C){const q=ss(L.placement);return q===k||q==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(q=>q>0).reduce((q,U)=>q+U,0)]).sort((L,q)=>L[1]-q[1])[0])==null?void 0:$[0];B&&(W=B);break}case"initialPlacement":W=s;break}if(o!==W)return{reset:{placement:W}}}return{}}}};function v5(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function y5(e){return vB.some(t=>e[t]>=0)}const PB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...o}=ta(e,t);switch(n){case"referenceHidden":{const a=await vu(t,{...o,elementContext:"reference"}),i=v5(a,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:y5(i)}}}case"escaped":{const a=await vu(t,{...o,altBoundary:!0}),i=v5(a,r.floating);return{data:{escapedOffsets:i,escaped:y5(i)}}}default:return{}}}}};async function AB(e,t){const{placement:r,platform:n,elements:o}=e,a=await(n.isRTL==null?void 0:n.isRTL(o.floating)),i=ii(r),s=rc(r),u=ss(r)==="y",c=["left","top"].includes(i)?-1:1,d=a&&u?-1:1,f=ta(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&typeof g=="number"&&(p=s==="end"?g*-1:g),u?{x:p*d,y:h*c}:{x:h*c,y:p*d}}const TB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:a,placement:i,middlewareData:s}=t,u=await AB(t,e);return i===((r=s.offset)==null?void 0:r.placement)&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:o+u.x,y:a+u.y,data:{...u,placement:i}}}}},MB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:s={fn:v=>{let{x,y:k}=v;return{x,y:k}}},...u}=ta(e,t),c={x:r,y:n},d=await vu(t,u),f=ss(ii(o)),h=Pj(f);let p=c[h],g=c[f];if(a){const v=h==="y"?"top":"left",x=h==="y"?"bottom":"right",k=p+d[v],E=p-d[x];p=cw(k,p,E)}if(i){const v=f==="y"?"top":"left",x=f==="y"?"bottom":"right",k=g+d[v],E=g-d[x];g=cw(k,g,E)}const b=s.fn({...t,[h]:p,[f]:g});return{...b,data:{x:b.x-r,y:b.y-n,enabled:{[h]:a,[f]:i}}}}}},_B=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:a,middlewareData:i}=t,{offset:s=0,mainAxis:u=!0,crossAxis:c=!0}=ta(e,t),d={x:r,y:n},f=ss(o),h=Pj(f);let p=d[h],g=d[f];const b=ta(s,t),v=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(u){const E=h==="y"?"height":"width",j=a.reference[h]-a.floating[E]+v.mainAxis,S=a.reference[h]+a.reference[E]-v.mainAxis;p<j?p=j:p>S&&(p=S)}if(c){var x,k;const E=h==="y"?"width":"height",j=["top","left"].includes(ii(o)),S=a.reference[f]-a.floating[E]+(j&&((x=i.offset)==null?void 0:x[f])||0)+(j?0:v.crossAxis),C=a.reference[f]+a.reference[E]+(j?0:((k=i.offset)==null?void 0:k[f])||0)-(j?v.crossAxis:0);g<S?g=S:g>C&&(g=C)}return{[h]:p,[f]:g}}}},IB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:o,rects:a,platform:i,elements:s}=t,{apply:u=()=>{},...c}=ta(e,t),d=await vu(t,c),f=ii(o),h=rc(o),p=ss(o)==="y",{width:g,height:b}=a.floating;let v,x;f==="top"||f==="bottom"?(v=f,x=h===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(x=f,v=h==="end"?"top":"bottom");const k=b-d.top-d.bottom,E=g-d.left-d.right,j=Oa(b-d[v],k),S=Oa(g-d[x],E),C=!t.middlewareData.shift;let O=j,M=S;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(M=E),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(O=k),C&&!h){const T=gn(d.left,0),_=gn(d.right,0),F=gn(d.top,0),$=gn(d.bottom,0);p?M=g-2*(T!==0||_!==0?T+_:gn(d.left,d.right)):O=b-2*(F!==0||$!==0?F+$:gn(d.top,d.bottom))}await u({...t,availableWidth:M,availableHeight:O});const A=await i.getDimensions(s.floating);return g!==A.width||b!==A.height?{reset:{rects:!0}}:{}}}};function e8(e){const t=ea(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=Sa(e),a=o?e.offsetWidth:r,i=o?e.offsetHeight:n,s=bu(r)!==a||bu(n)!==i;return s&&(r=a,n=i),{width:r,height:n,$:s}}function Mj(e){return yn(e)?e:e.contextElement}function nu(e){const t=Mj(e);if(!Sa(t))return xa(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:a}=e8(t);let i=(a?bu(r.width):r.width)/n,s=(a?bu(r.height):r.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const DB=xa(0);function t8(e){const t=So(e);return!Cj()||!t.visualViewport?DB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function LB(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==So(e)?!1:t}function ul(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),a=Mj(e);let i=xa(1);t&&(n?yn(n)&&(i=nu(n)):i=nu(e));const s=LB(a,r,n)?t8(a):xa(0);let u=(o.left+s.x)/i.x,c=(o.top+s.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(a){const h=So(a),p=n&&yn(n)?So(n):n;let g=h,b=uw(g);for(;b&&n&&p!==g;){const v=nu(b),x=b.getBoundingClientRect(),k=ea(b),E=x.left+(b.clientLeft+parseFloat(k.paddingLeft))*v.x,j=x.top+(b.clientTop+parseFloat(k.paddingTop))*v.y;u*=v.x,c*=v.y,d*=v.x,f*=v.y,u+=E,c+=j,g=So(b),b=uw(g)}}return hp({width:d,height:f,x:u,y:c})}function _j(e,t){const r=Wh(e).scrollLeft;return t?t.left+r:ul(Ia(e)).left+r}function r8(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-(r?0:_j(e,n)),a=n.top+t.scrollTop;return{x:o,y:a}}function RB(e){let{elements:t,rect:r,offsetParent:n,strategy:o}=e;const a=o==="fixed",i=Ia(n),s=t?Vh(t.floating):!1;if(n===i||s&&a)return r;let u={scrollLeft:0,scrollTop:0},c=xa(1);const d=xa(0),f=Sa(n);if((f||!f&&!a)&&((tc(n)!=="body"||Nf(i))&&(u=Wh(n)),Sa(n))){const p=ul(n);c=nu(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const h=i&&!f&&!a?r8(i,u,!0):xa(0);return{width:r.width*c.x,height:r.height*c.y,x:r.x*c.x-u.scrollLeft*c.x+d.x+h.x,y:r.y*c.y-u.scrollTop*c.y+d.y+h.y}}function FB(e){return Array.from(e.getClientRects())}function $B(e){const t=Ia(e),r=Wh(e),n=e.ownerDocument.body,o=gn(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=gn(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let i=-r.scrollLeft+_j(e);const s=-r.scrollTop;return ea(n).direction==="rtl"&&(i+=gn(t.clientWidth,n.clientWidth)-o),{width:o,height:a,x:i,y:s}}function BB(e,t){const r=So(e),n=Ia(e),o=r.visualViewport;let a=n.clientWidth,i=n.clientHeight,s=0,u=0;if(o){a=o.width,i=o.height;const c=Cj();(!c||c&&t==="fixed")&&(s=o.offsetLeft,u=o.offsetTop)}return{width:a,height:i,x:s,y:u}}function zB(e,t){const r=ul(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,a=Sa(e)?nu(e):xa(1),i=e.clientWidth*a.x,s=e.clientHeight*a.y,u=o*a.x,c=n*a.y;return{width:i,height:s,x:u,y:c}}function x5(e,t,r){let n;if(t==="viewport")n=BB(e,r);else if(t==="document")n=$B(Ia(e));else if(yn(t))n=zB(t,r);else{const o=t8(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return hp(n)}function n8(e,t){const r=is(e);return r===t||!yn(r)||gu(r)?!1:ea(r).position==="fixed"||n8(r,t)}function HB(e,t){const r=t.get(e);if(r)return r;let n=Ji(e,[],!1).filter(s=>yn(s)&&tc(s)!=="body"),o=null;const a=ea(e).position==="fixed";let i=a?is(e):e;for(;yn(i)&&!gu(i);){const s=ea(i),u=Oj(i);!u&&s.position==="fixed"&&(o=null),(a?!u&&!o:!u&&s.position==="static"&&o&&["absolute","fixed"].includes(o.position)||Nf(i)&&!u&&n8(e,i))?n=n.filter(c=>c!==i):o=s,i=is(i)}return t.set(e,n),n}function qB(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const a=[...r==="clippingAncestors"?Vh(t)?[]:HB(t,this._c):[].concat(r),n],i=a[0],s=a.reduce((u,c)=>{const d=x5(t,c,o);return u.top=gn(d.top,u.top),u.right=Oa(d.right,u.right),u.bottom=Oa(d.bottom,u.bottom),u.left=gn(d.left,u.left),u},x5(t,i,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function UB(e){const{width:t,height:r}=e8(e);return{width:t,height:r}}function VB(e,t,r){const n=Sa(t),o=Ia(t),a=r==="fixed",i=ul(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const u=xa(0);if(n||!n&&!a)if((tc(t)!=="body"||Nf(o))&&(s=Wh(t)),n){const h=ul(t,!0,a,t);u.x=h.x+t.clientLeft,u.y=h.y+t.clientTop}else o&&(u.x=_j(o));const c=o&&!n&&!a?r8(o,s):xa(0),d=i.left+s.scrollLeft-u.x-c.x,f=i.top+s.scrollTop-u.y-c.y;return{x:d,y:f,width:i.width,height:i.height}}function rv(e){return ea(e).position==="static"}function k5(e,t){if(!Sa(e)||ea(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ia(e)===r&&(r=r.ownerDocument.body),r}function o8(e,t){const r=So(e);if(Vh(e))return r;if(!Sa(e)){let o=is(e);for(;o&&!gu(o);){if(yn(o)&&!rv(o))return o;o=is(o)}return r}let n=k5(e,t);for(;n&&hB(n)&&rv(n);)n=k5(n,t);return n&&gu(n)&&rv(n)&&!Oj(n)?r:n||gB(e)||r}const WB=async function(e){const t=this.getOffsetParent||o8,r=this.getDimensions,n=await r(e.floating);return{reference:VB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function KB(e){return ea(e).direction==="rtl"}const YB={convertOffsetParentRelativeRectToViewportRelativeRect:RB,getDocumentElement:Ia,getClippingRect:qB,getOffsetParent:o8,getElementRects:WB,getClientRects:FB,getDimensions:UB,getScale:nu,isElement:yn,isRTL:KB};function a8(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function GB(e,t){let r=null,n;const o=Ia(e);function a(){var s;clearTimeout(n),(s=r)==null||s.disconnect(),r=null}function i(s,u){s===void 0&&(s=!1),u===void 0&&(u=1),a();const c=e.getBoundingClientRect(),{left:d,top:f,width:h,height:p}=c;if(s||t(),!h||!p)return;const g=bm(f),b=bm(o.clientWidth-(d+h)),v=bm(o.clientHeight-(f+p)),x=bm(d),k={rootMargin:-g+"px "+-b+"px "+-v+"px "+-x+"px",threshold:gn(0,Oa(1,u))||1};let E=!0;function j(S){const C=S[0].intersectionRatio;if(C!==u){if(!E)return i();C?i(!1,C):n=setTimeout(()=>{i(!1,1e-7)},1e3)}C===1&&!a8(c,e.getBoundingClientRect())&&i(),E=!1}try{r=new IntersectionObserver(j,{...k,root:o.ownerDocument})}catch{r=new IntersectionObserver(j,k)}r.observe(e)}return i(!0),a}function Kh(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:u=!1}=n,c=Mj(e),d=o||a?[...c?Ji(c):[],...Ji(t)]:[];d.forEach(x=>{o&&x.addEventListener("scroll",r,{passive:!0}),a&&x.addEventListener("resize",r)});const f=c&&s?GB(c,r):null;let h=-1,p=null;i&&(p=new ResizeObserver(x=>{let[k]=x;k&&k.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var E;(E=p)==null||E.observe(t)})),r()}),c&&!u&&p.observe(c),p.observe(t));let g,b=u?ul(e):null;u&&v();function v(){const x=ul(e);b&&!a8(b,x)&&r(),b=x,g=requestAnimationFrame(v)}return r(),()=>{var x;d.forEach(k=>{o&&k.removeEventListener("scroll",r),a&&k.removeEventListener("resize",r)}),f?.(),(x=p)==null||x.disconnect(),p=null,u&&cancelAnimationFrame(g)}}const ou=vu,Ij=TB,Dj=MB,Lj=CB,i8=IB,XB=PB,w5=OB,ZB=_B,Rj=(e,t,r)=>{const n=new Map,o={platform:YB,...r},a={...o.platform,_c:n};return SB(e,t,{...o,platform:a})};var Ym=typeof document<"u"?m.useLayoutEffect:m.useEffect;function gp(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 r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!gp(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const a=o[n];if(!(a==="_owner"&&e.$$typeof)&&!gp(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function s8(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function j5(e,t){const r=s8(e);return Math.round(t*r)/r}function nv(e){const t=m.useRef(e);return Ym(()=>{t.current=e}),t}function l8(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:a,floating:i}={},transform:s=!0,whileElementsMounted:u,open:c}=e,[d,f]=m.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=m.useState(n);gp(h,n)||p(n);const[g,b]=m.useState(null),[v,x]=m.useState(null),k=m.useCallback(L=>{L!==C.current&&(C.current=L,b(L))},[]),E=m.useCallback(L=>{L!==O.current&&(O.current=L,x(L))},[]),j=a||g,S=i||v,C=m.useRef(null),O=m.useRef(null),M=m.useRef(d),A=u!=null,T=nv(u),_=nv(o),F=nv(c),$=m.useCallback(()=>{if(!C.current||!O.current)return;const L={placement:t,strategy:r,middleware:h};_.current&&(L.platform=_.current),Rj(C.current,O.current,L).then(q=>{const U={...q,isPositioned:F.current!==!1};I.current&&!gp(M.current,U)&&(M.current=U,nr.flushSync(()=>{f(U)}))})},[h,t,r,_,F]);Ym(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[c]);const I=m.useRef(!1);Ym(()=>(I.current=!0,()=>{I.current=!1}),[]),Ym(()=>{if(j&&(C.current=j),S&&(O.current=S),j&&S){if(T.current)return T.current(j,S,$);$()}},[j,S,$,T,A]);const R=m.useMemo(()=>({reference:C,floating:O,setReference:k,setFloating:E}),[k,E]),W=m.useMemo(()=>({reference:j,floating:S}),[j,S]),B=m.useMemo(()=>{const L={position:r,left:0,top:0};if(!W.floating)return L;const q=j5(W.floating,d.x),U=j5(W.floating,d.y);return s?{...L,transform:"translate("+q+"px, "+U+"px)",...s8(W.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:q,top:U}},[r,s,W.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:$,refs:R,elements:W,floatingStyles:B}),[d,$,R,W,B])}const JB=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:o}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?w5({element:n.current,padding:o}).fn(r):{}:n?w5({element:n,padding:o}).fn(r):{}}}},Fj=(e,t)=>({...Ij(e),options:[e,t]}),u8=(e,t)=>({...Dj(e),options:[e,t]}),QB=(e,t)=>({...ZB(e),options:[e,t]}),c8=(e,t)=>({...Lj(e),options:[e,t]}),d8=(e,t)=>({...i8(e),options:[e,t]}),ez=(e,t)=>({...XB(e),options:[e,t]}),tz=(e,t)=>({...JB(e),options:[e,t]}),f8={...rs},rz=f8.useInsertionEffect,nz=rz||(e=>e());function m8(e){const t=m.useRef(()=>{});return nz(()=>{t.current=e}),m.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}var fw=typeof document<"u"?m.useLayoutEffect:m.useEffect;let E5=!1,oz=0;const N5=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+oz++;function az(){const[e,t]=m.useState(()=>E5?N5():void 0);return fw(()=>{e==null&&t(N5())},[]),m.useEffect(()=>{E5=!0},[]),e}const iz=f8.useId,sz=iz||az;function lz(){const e=new Map;return{emit(t,r){var n;(n=e.get(t))==null||n.forEach(o=>o(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){var n;e.set(t,((n=e.get(t))==null?void 0:n.filter(o=>o!==r))||[])}}}const uz=m.createContext(null),cz=m.createContext(null),dz=()=>{var e;return((e=m.useContext(uz))==null?void 0:e.id)||null},fz=()=>m.useContext(cz),mz="data-floating-ui-focusable";function pz(e){const{open:t=!1,onOpenChange:r,elements:n}=e,o=sz(),a=m.useRef({}),[i]=m.useState(()=>lz()),s=dz()!=null,[u,c]=m.useState(n.reference),d=m8((p,g,b)=>{a.current.openEvent=p?g:void 0,i.emit("openchange",{open:p,event:g,reason:b,nested:s}),r?.(p,g,b)}),f=m.useMemo(()=>({setPositionReference:c}),[]),h=m.useMemo(()=>({reference:u||n.reference||null,floating:n.floating||null,domReference:n.reference}),[u,n.reference,n.floating]);return m.useMemo(()=>({dataRef:a,open:t,onOpenChange:d,elements:h,events:i,floatingId:o,refs:f}),[t,d,h,i,o,f])}function hz(e){e===void 0&&(e={});const{nodeId:t}=e,r=pz({...e,elements:{reference:null,floating:null,...e.elements}}),n=e.rootContext||r,o=n.elements,[a,i]=m.useState(null),[s,u]=m.useState(null),c=o?.domReference||a,d=m.useRef(null),f=fz();fw(()=>{c&&(d.current=c)},[c]);const h=l8({...e,elements:{...o,...s&&{reference:s}}}),p=m.useCallback(k=>{const E=yn(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),contextElement:k}:k;u(E),h.refs.setReference(E)},[h.refs]),g=m.useCallback(k=>{(yn(k)||k===null)&&(d.current=k,i(k)),(yn(h.refs.reference.current)||h.refs.reference.current===null||k!==null&&!yn(k))&&h.refs.setReference(k)},[h.refs]),b=m.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d}),[h.refs,g,p]),v=m.useMemo(()=>({...h.elements,domReference:c}),[h.elements,c]),x=m.useMemo(()=>({...h,...n,refs:b,elements:v,nodeId:t}),[h,b,v,t,n]);return fw(()=>{n.dataRef.current.floatingContext=x;const k=f?.nodesRef.current.find(E=>E.id===t);k&&(k.context=x)}),m.useMemo(()=>({...h,context:x,refs:b,elements:v}),[h,b,v,x])}const S5="active",O5="selected";function ov(e,t,r){const n=new Map,o=r==="item";let a=e;if(o&&e){const{[S5]:i,[O5]:s,...u}=e;a=u}return{...r==="floating"&&{tabIndex:-1,[mz]:""},...a,...t.map(i=>{const s=i?i[r]:null;return typeof s=="function"?e?s(e):null:s}).concat(e).reduce((i,s)=>(s&&Object.entries(s).forEach(u=>{let[c,d]=u;if(!(o&&[S5,O5].includes(c)))if(c.indexOf("on")===0){if(n.has(c)||n.set(c,[]),typeof d=="function"){var f;(f=n.get(c))==null||f.push(d),i[c]=function(){for(var h,p=arguments.length,g=new Array(p),b=0;b<p;b++)g[b]=arguments[b];return(h=n.get(c))==null?void 0:h.map(v=>v(...g)).find(v=>v!==void 0)}}}else i[c]=d}),i),{})}}function gz(e){e===void 0&&(e=[]);const t=e.map(s=>s?.reference),r=e.map(s=>s?.floating),n=e.map(s=>s?.item),o=m.useCallback(s=>ov(s,e,"reference"),t),a=m.useCallback(s=>ov(s,e,"floating"),r),i=m.useCallback(s=>ov(s,e,"item"),n);return m.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:i}),[o,a,i])}function C5(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const bz=e=>({name:"inner",options:e,async fn(t){const{listRef:r,overflowRef:n,onFallbackChange:o,offset:a=0,index:i=0,minItemsVisible:s=4,referenceOverflowThreshold:u=0,scrollRef:c,...d}=ta(e,t),{rects:f,elements:{floating:h}}=t,p=r.current[i],g=c?.current||h,b=h.clientTop||g.clientTop,v=h.clientTop!==0,x=g.clientTop!==0,k=h===g;if(!p)return{};const E={...t,...await Fj(-p.offsetTop-h.clientTop-f.reference.height/2-p.offsetHeight/2-a).fn(t)},j=await ou(C5(E,g.scrollHeight+b+h.clientTop),d),S=await ou(E,{...d,elementContext:"reference"}),C=gn(0,j.top),O=E.y+C,M=(g.scrollHeight>g.clientHeight?A=>A:bu)(gn(0,g.scrollHeight+(v&&k||x?b*2:0)-C-gn(0,j.bottom)));if(g.style.maxHeight=M+"px",g.scrollTop=C,o){const A=g.offsetHeight<p.offsetHeight*Oa(s,r.current.length)-1||S.top>=-u||S.bottom>=-u;nr.flushSync(()=>o(A))}return n&&(n.current=await ou(C5({...E,y:O},g.offsetHeight+b+h.clientTop),d)),{y:O}}});function vz(e,t){const{open:r,elements:n}=e,{enabled:o=!0,overflowRef:a,scrollRef:i,onChange:s}=t,u=m8(s),c=m.useRef(!1),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(!o)return;function p(b){if(b.ctrlKey||!g||a.current==null)return;const v=b.deltaY,x=a.current.top>=-.5,k=a.current.bottom>=-.5,E=g.scrollHeight-g.clientHeight,j=v<0?-1:1,S=v<0?"max":"min";g.scrollHeight<=g.clientHeight||(!x&&v>0||!k&&v<0?(b.preventDefault(),nr.flushSync(()=>{u(C=>C+Math[S](v,E*j))})):/firefox/i.test(bB())&&(g.scrollTop+=v))}const g=i?.current||n.floating;if(r&&g)return g.addEventListener("wheel",p),requestAnimationFrame(()=>{d.current=g.scrollTop,a.current!=null&&(f.current={...a.current})}),()=>{d.current=null,f.current=null,g.removeEventListener("wheel",p)}},[o,r,n.floating,a,i,u]);const h=m.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const p=i?.current||n.floating;if(!(!a.current||!p||!c.current)){if(d.current!==null){const g=p.scrollTop-d.current;(a.current.bottom<-.5&&g<-1||a.current.top<-.5&&g>1)&&nr.flushSync(()=>u(b=>b+g))}requestAnimationFrame(()=>{d.current=p.scrollTop})}}}),[n.floating,u,a,i]);return m.useMemo(()=>o?{floating:h}:{},[o,h])}let nc=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});nc.displayName="FloatingContext";let $j=m.createContext(null);$j.displayName="PlacementContext";function p8(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function h8(){return m.useContext(nc).setReference}function yz(){return m.useContext(nc).getReferenceProps}function g8(){let{getFloatingProps:e,slot:t}=m.useContext(nc);return m.useCallback((...r)=>Object.assign({},e(...r),{"data-anchor":t.anchor}),[e,t])}function b8(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext($j),r=m.useMemo(()=>e,[JSON.stringify(e,(o,a)=>{var i;return(i=a?.outerHTML)!=null?i:a})]);Dr(()=>{t?.(r??null)},[t,r]);let n=m.useContext(nc);return m.useMemo(()=>[n.setFloating,e?n.styles:{}],[n.setFloating,e,n.styles])}let P5=4;function v8({children:e,enabled:t=!0}){let[r,n]=m.useState(null),[o,a]=m.useState(0),i=m.useRef(null),[s,u]=m.useState(null);xz(s);let c=t&&r!==null&&s!==null,{to:d="bottom",gap:f=0,offset:h=0,padding:p=0,inner:g}=kz(r,s),[b,v="center"]=d.split(" ");Dr(()=>{c&&a(0)},[c]);let{refs:x,floatingStyles:k,context:E}=hz({open:c,placement:b==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${b}`:`${b}-${v}`,strategy:"absolute",transform:!1,middleware:[Fj({mainAxis:b==="selection"?0:f,crossAxis:h}),u8({padding:p}),b!=="selection"&&c8({padding:p}),b==="selection"&&g?bz({...g,padding:p,overflowRef:i,offset:o,minItemsVisible:P5,referenceOverflowThreshold:p,onFallbackChange(_){var F,$;if(!_)return;let I=E.elements.floating;if(!I)return;let R=parseFloat(getComputedStyle(I).scrollPaddingBottom)||0,W=Math.min(P5,I.childElementCount),B=0,L=0;for(let q of($=(F=E.elements.floating)==null?void 0:F.childNodes)!=null?$:[])if(Hn(q)){let U=q.offsetTop,H=U+q.clientHeight+R,X=I.scrollTop,Y=X+I.clientHeight;if(U>=X&&H<=Y)W--;else{L=Math.max(0,Math.min(H,Y)-Math.max(U,X)),B=q.clientHeight;break}}W>=1&&a(q=>{let U=B*W-L+R;return q>=U?q:U})}}):null,d8({padding:p,apply({availableWidth:_,availableHeight:F,elements:$}){Object.assign($.floating.style,{overflow:"auto",maxWidth:`${_}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${F}px)`})}})].filter(Boolean),whileElementsMounted:Kh}),[j=b,S=v]=E.placement.split("-");b==="selection"&&(j="selection");let C=m.useMemo(()=>({anchor:[j,S].filter(Boolean).join(" ")}),[j,S]),O=vz(E,{overflowRef:i,onChange:a}),{getReferenceProps:M,getFloatingProps:A}=gz([O]),T=rt(_=>{u(_),x.setFloating(_)});return m.createElement($j.Provider,{value:n},m.createElement(nc.Provider,{value:{setFloating:T,setReference:x.setReference,styles:k,getReferenceProps:M,getFloatingProps:A,slot:C}},e))}function xz(e){Dr(()=>{if(!e)return;let t=new MutationObserver(()=>{let r=window.getComputedStyle(e).maxHeight,n=parseFloat(r);if(isNaN(n))return;let o=parseInt(r);isNaN(o)||n!==o&&(e.style.maxHeight=`${Math.ceil(n)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function kz(e,t){var r,n,o;let a=av((r=e?.gap)!=null?r:"var(--anchor-gap, 0)",t),i=av((n=e?.offset)!=null?n:"var(--anchor-offset, 0)",t),s=av((o=e?.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:a,offset:i,padding:s}}function av(e,t,r=void 0){let n=gi(),o=rt((u,c)=>{if(u==null)return[r,null];if(typeof u=="number")return[u,null];if(typeof u=="string"){if(!c)return[r,null];let d=A5(u,c);return[d,f=>{let h=y8(u);{let p=h.map(g=>window.getComputedStyle(c).getPropertyValue(g));n.requestAnimationFrame(function g(){n.nextFrame(g);let b=!1;for(let[x,k]of h.entries()){let E=window.getComputedStyle(c).getPropertyValue(k);if(p[x]!==E){p[x]=E,b=!0;break}}if(!b)return;let v=A5(u,c);d!==v&&(f(v),d=v)})}return n.dispose}]}return[r,null]}),a=m.useMemo(()=>o(e,t)[0],[e,t]),[i=a,s]=m.useState();return Dr(()=>{let[u,c]=o(e,t);if(s(u),!!c)return c(s)},[e,t]),i}function y8(e){let t=/var\((.*)\)/.exec(e);if(t){let r=t[1].indexOf(",");if(r===-1)return[t[1]];let n=t[1].slice(0,r).trim(),o=t[1].slice(r+1).trim();return o?[n,...y8(o)]:[n]}return[]}function A5(e,t){let r=document.createElement("div");t.appendChild(r),r.style.setProperty("margin-top","0px","important"),r.style.setProperty("margin-top",e,"important");let n=parseFloat(window.getComputedStyle(r).marginTop)||0;return t.removeChild(r),n}let Yh=m.createContext(null);Yh.displayName="OpenClosedContext";var Hr=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Hr||{});function bs(){return m.useContext(Yh)}function Gh({value:e,children:t}){return y.createElement(Yh.Provider,{value:e},t)}function Bj({children:e}){return y.createElement(Yh.Provider,{value:null},e)}function wz(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let zi=[];wz(()=>{function e(t){if(!wo(t.target)||t.target===document.body||zi[0]===t.target)return;let r=t.target;r=r.closest(mp),zi.unshift(r??t.target),zi=zi.filter(n=>n!=null&&n.isConnected),zi.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function jz(e){throw new Error("Unexpected object: "+e)}var dn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(dn||{});function vm(e,t){let r=t.resolveItems();if(r.length<=0)return null;let n=t.resolveActiveIndex(),o=n??-1;switch(e.focus){case 0:{for(let a=0;a<r.length;++a)if(!t.resolveDisabled(r[a],a,r))return a;return n}case 1:{o===-1&&(o=r.length);for(let a=o-1;a>=0;--a)if(!t.resolveDisabled(r[a],a,r))return a;return n}case 2:{for(let a=o+1;a<r.length;++a)if(!t.resolveDisabled(r[a],a,r))return a;return n}case 3:{for(let a=r.length-1;a>=0;--a)if(!t.resolveDisabled(r[a],a,r))return a;return n}case 4:{for(let a=0;a<r.length;++a)if(t.resolveId(r[a],a,r)===e.id)return a;return n}case 5:return null;default:jz(e)}}function Xh(e){let t=rt(e),r=m.useRef(!1);m.useEffect(()=>(r.current=!1,()=>{r.current=!0,Lh(()=>{r.current&&t()})}),[t])}let x8=m.createContext(!1);function Ez(){return m.useContext(x8)}function T5(e){return y.createElement(x8.Provider,{value:e.force},e.children)}function Nz(e){let t=Ez(),r=m.useContext(w8),[n,o]=m.useState(()=>{var a;if(!t&&r!==null)return(a=r.current)!=null?a:null;if(va.isServer)return null;let i=e?.getElementById("headlessui-portal-root");if(i)return i;if(e===null)return null;let s=e.createElement("div");return s.setAttribute("id","headlessui-portal-root"),e.body.appendChild(s)});return m.useEffect(()=>{n!==null&&(e!=null&&e.body.contains(n)||e==null||e.body.appendChild(n))},[n,e]),m.useEffect(()=>{t||r!==null&&o(r.current)},[r,o,t]),n}let k8=m.Fragment,Sz=lr(function(e,t){let{ownerDocument:r=null,...n}=e,o=m.useRef(null),a=qr(bj(h=>{o.current=h}),t),i=ll(o.current),s=r??i,u=Nz(s),c=m.useContext(mw),d=gi(),f=pr();return Xh(()=>{var h;u&&u.childNodes.length<=0&&((h=u.parentElement)==null||h.removeChild(u))}),u?nr.createPortal(y.createElement("div",{"data-headlessui-portal":"",ref:h=>{d.dispose(),c&&h&&d.add(c.register(h))}},f({ourProps:{ref:a},theirProps:n,slot:{},defaultTag:k8,name:"Portal"})),u):null});function Oz(e,t){let r=qr(t),{enabled:n=!0,ownerDocument:o,...a}=e,i=pr();return n?y.createElement(Sz,{...a,ownerDocument:o,ref:r}):i({ourProps:{ref:r},theirProps:a,slot:{},defaultTag:k8,name:"Portal"})}let Cz=m.Fragment,w8=m.createContext(null);function Pz(e,t){let{target:r,...n}=e,o={ref:qr(t)},a=pr();return y.createElement(w8.Provider,{value:r},a({ourProps:o,theirProps:n,defaultTag:Cz,name:"Popover.Group"}))}let mw=m.createContext(null);function j8(){let e=m.useContext(mw),t=m.useRef([]),r=rt(a=>(t.current.push(a),e&&e.register(a),()=>n(a))),n=rt(a=>{let i=t.current.indexOf(a);i!==-1&&t.current.splice(i,1),e&&e.unregister(a)}),o=m.useMemo(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,m.useMemo(()=>function({children:a}){return y.createElement(mw.Provider,{value:o},a)},[o])]}let Az=lr(Oz),E8=lr(Pz),zj=Object.assign(Az,{Group:E8});const Gm={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function N8(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function Tz(e,t,r){let n=uo();if(t.kind==="Tracked"){let o=function(){a!==N8(e)&&(n.dispose(),r())},{position:a}=t,i=new ResizeObserver(o);i.observe(e),n.add(()=>i.disconnect()),n.addEventListener(window,"scroll",o,{passive:!0}),n.addEventListener(window,"resize",o)}return()=>n.dispose()}function Mz(e,t=typeof document<"u"?document.defaultView:null,r){let n=kf(e,"escape");Ej(t,"keydown",o=>{n&&(o.defaultPrevented||o.key===ar.Escape&&r(o))})}function _z(){var e;let[t]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[r,n]=m.useState((e=t?.matches)!=null?e:!1);return Dr(()=>{if(!t)return;function o(a){n(a.matches)}return t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[t]),r}function S8({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=rt(()=>{var o,a;let i=hi(r),s=[];for(let u of e)u!==null&&(Qa(u)?s.push(u):"current"in u&&Qa(u.current)&&s.push(u.current));if(t!=null&&t.current)for(let u of t.current)s.push(u);for(let u of(o=i?.querySelectorAll("html > *, body > *"))!=null?o:[])u!==document.body&&u!==document.head&&Qa(u)&&u.id!=="headlessui-portal-root"&&(r&&(u.contains(r)||u.contains((a=r?.getRootNode())==null?void 0:a.host))||s.some(c=>u.contains(c))||s.push(u));return s});return{resolveContainers:n,contains:rt(o=>n().some(a=>a.contains(o)))}}let O8=m.createContext(null);function bp({children:e,node:t}){let[r,n]=m.useState(null),o=Hj(t??r);return y.createElement(O8.Provider,{value:o},e,o===null&&y.createElement(as,{features:ai.Hidden,ref:a=>{var i,s;if(a){for(let u of(s=(i=hi(a))==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?s:[])if(u!==document.body&&u!==document.head&&Qa(u)&&u!=null&&u.contains(a)){n(u);break}}}}))}function Hj(e=null){var t;return(t=m.useContext(O8))!=null?t:e}function Iz(){let e=typeof document>"u";return"useSyncExternalStore"in rs?(t=>t.useSyncExternalStore)(rs)(()=>()=>{},()=>!1,()=>!e):!1}function Zh(){let e=Iz(),[t,r]=m.useState(va.isHandoffComplete);return t&&va.isHandoffComplete===!1&&r(!1),m.useEffect(()=>{t!==!0&&r(!0)},[t]),m.useEffect(()=>va.handoff(),[]),e?!1:t}function qj(){let e=m.useRef(!1);return Dr(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var Eo=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Eo||{});function Uj(){let e=m.useRef(0);return X9(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function C8(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let r of e.current)Qa(r.current)&&t.add(r.current);return t}let Dz="div";var zs=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(zs||{});function Lz(e,t){let r=m.useRef(null),n=qr(r,t),{initialFocus:o,initialFocusFallback:a,containers:i,features:s=15,...u}=e;Zh()||(s=0);let c=ll(r.current);Bz(s,{ownerDocument:c});let d=zz(s,{ownerDocument:c,container:r,initialFocus:o,initialFocusFallback:a});Hz(s,{ownerDocument:c,container:r,containers:i,previousActiveElement:d});let f=Uj(),h=rt(k=>{if(!Hn(r.current))return;let E=r.current;(j=>j())(()=>{pn(f.current,{[Eo.Forwards]:()=>{jo(E,vn.First,{skipElements:[k.relatedTarget,a]})},[Eo.Backwards]:()=>{jo(E,vn.Last,{skipElements:[k.relatedTarget,a]})}})})}),p=kf(!!(s&2),"focus-trap#tab-lock"),g=gi(),b=m.useRef(!1),v={ref:n,onKeyDown(k){k.key=="Tab"&&(b.current=!0,g.requestAnimationFrame(()=>{b.current=!1}))},onBlur(k){if(!(s&4))return;let E=C8(i);Hn(r.current)&&E.add(r.current);let j=k.relatedTarget;wo(j)&&j.dataset.headlessuiFocusGuard!=="true"&&(P8(E,j)||(b.current?jo(r.current,pn(f.current,{[Eo.Forwards]:()=>vn.Next,[Eo.Backwards]:()=>vn.Previous})|vn.WrapAround,{relativeTo:k.target}):wo(k.target)&&ya(k.target)))}},x=pr();return y.createElement(y.Fragment,null,p&&y.createElement(as,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:h,features:ai.Focusable}),x({ourProps:v,theirProps:u,defaultTag:Dz,name:"FocusTrap"}),p&&y.createElement(as,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:h,features:ai.Focusable}))}let Rz=lr(Lz),Fz=Object.assign(Rz,{features:zs});function $z(e=!0){let t=m.useRef(zi.slice());return Sj(([r],[n])=>{n===!0&&r===!1&&Lh(()=>{t.current.splice(0)}),n===!1&&r===!0&&(t.current=zi.slice())},[e,zi,t]),rt(()=>{var r;return(r=t.current.find(n=>n!=null&&n.isConnected))!=null?r:null})}function Bz(e,{ownerDocument:t}){let r=!!(e&8),n=$z(r);Sj(()=>{r||N9(t?.body)&&ya(n())},[r]),Xh(()=>{r&&ya(n())})}function zz(e,{ownerDocument:t,container:r,initialFocus:n,initialFocusFallback:o}){let a=m.useRef(null),i=kf(!!(e&1),"focus-trap#initial-focus"),s=qj();return Sj(()=>{if(e===0)return;if(!i){o!=null&&o.current&&ya(o.current);return}let u=r.current;u&&Lh(()=>{if(!s.current)return;let c=t?.activeElement;if(n!=null&&n.current){if(n?.current===c){a.current=c;return}}else if(u.contains(c)){a.current=c;return}if(n!=null&&n.current)ya(n.current);else{if(e&16){if(jo(u,vn.First|vn.AutoFocus)!==hu.Error)return}else if(jo(u,vn.First)!==hu.Error)return;if(o!=null&&o.current&&(ya(o.current),t?.activeElement===o.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}a.current=t?.activeElement})},[o,i,e]),a}function Hz(e,{ownerDocument:t,container:r,containers:n,previousActiveElement:o}){let a=qj(),i=!!(e&4);Ej(t?.defaultView,"focus",s=>{if(!i||!a.current)return;let u=C8(n);Hn(r.current)&&u.add(r.current);let c=o.current;if(!c)return;let d=s.target;Hn(d)?P8(u,d)?(o.current=d,ya(d)):(s.preventDefault(),s.stopPropagation(),ya(c)):ya(o.current)},!0)}function P8(e,t){for(let r of e)if(r.contains(t))return!0;return!1}function A8(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!ru((t=e.as)!=null?t:M8)||y.Children.count(e.children)===1}let Jh=m.createContext(null);Jh.displayName="TransitionContext";var qz=(e=>(e.Visible="visible",e.Hidden="hidden",e))(qz||{});function Uz(){let e=m.useContext(Jh);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Vz(){let e=m.useContext(Qh);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Qh=m.createContext(null);Qh.displayName="NestingContext";function eg(e){return"children"in e?eg(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function T8(e,t){let r=oi(e),n=m.useRef([]),o=qj(),a=gi(),i=rt((p,g=Ui.Hidden)=>{let b=n.current.findIndex(({el:v})=>v===p);b!==-1&&(pn(g,{[Ui.Unmount](){n.current.splice(b,1)},[Ui.Hidden](){n.current[b].state="hidden"}}),a.microTask(()=>{var v;!eg(n)&&o.current&&((v=r.current)==null||v.call(r))}))}),s=rt(p=>{let g=n.current.find(({el:b})=>b===p);return g?g.state!=="visible"&&(g.state="visible"):n.current.push({el:p,state:"visible"}),()=>i(p,Ui.Unmount)}),u=m.useRef([]),c=m.useRef(Promise.resolve()),d=m.useRef({enter:[],leave:[]}),f=rt((p,g,b)=>{u.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([v])=>v!==p)),t?.chains.current[g].push([p,new Promise(v=>{u.current.push(v)})]),t?.chains.current[g].push([p,new Promise(v=>{Promise.all(d.current[g].map(([x,k])=>k)).then(()=>v())})]),g==="enter"?c.current=c.current.then(()=>t?.wait.current).then(()=>b(g)):b(g)}),h=rt((p,g,b)=>{Promise.all(d.current[g].splice(0).map(([v,x])=>x)).then(()=>{var v;(v=u.current.shift())==null||v()}).then(()=>b(g))});return m.useMemo(()=>({children:n,register:s,unregister:i,onStart:f,onStop:h,wait:c,chains:d}),[s,i,n,f,h,d,c])}let M8=m.Fragment,_8=Fo.RenderStrategy;function Wz(e,t){var r,n;let{transition:o=!0,beforeEnter:a,afterEnter:i,beforeLeave:s,afterLeave:u,enter:c,enterFrom:d,enterTo:f,entered:h,leave:p,leaveFrom:g,leaveTo:b,...v}=e,[x,k]=m.useState(null),E=m.useRef(null),j=A8(e),S=qr(...j?[E,t,k]:t===null?[]:[t]),C=(r=v.unmount)==null||r?Ui.Unmount:Ui.Hidden,{show:O,appear:M,initial:A}=Uz(),[T,_]=m.useState(O?"visible":"hidden"),F=Vz(),{register:$,unregister:I}=F;Dr(()=>$(E),[$,E]),Dr(()=>{if(C===Ui.Hidden&&E.current){if(O&&T!=="visible"){_("visible");return}return pn(T,{hidden:()=>I(E),visible:()=>$(E)})}},[T,E,$,I,O,C]);let R=Zh();Dr(()=>{if(j&&R&&T==="visible"&&E.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[E,T,R,j]);let W=A&&!M,B=M&&O&&A,L=m.useRef(!1),q=T8(()=>{L.current||(_("hidden"),I(E))},F),U=rt(Q=>{L.current=!0;let ue=Q?"enter":"leave";q.onStart(E,ue,G=>{G==="enter"?a?.():G==="leave"&&s?.()})}),H=rt(Q=>{let ue=Q?"enter":"leave";L.current=!1,q.onStop(E,ue,G=>{G==="enter"?i?.():G==="leave"&&u?.()}),ue==="leave"&&!eg(q)&&(_("hidden"),I(E))});m.useEffect(()=>{j&&o||(U(O),H(O))},[O,j,o]);let X=!(!o||!j||!R||W),[,Y]=Ef(X,x,O,{start:U,end:H}),ae=Fi({ref:S,className:((n=iw(v.className,B&&c,B&&d,Y.enter&&c,Y.enter&&Y.closed&&d,Y.enter&&!Y.closed&&f,Y.leave&&p,Y.leave&&!Y.closed&&g,Y.leave&&Y.closed&&b,!Y.transition&&O&&h))==null?void 0:n.trim())||void 0,...jf(Y)}),te=0;T==="visible"&&(te|=Hr.Open),T==="hidden"&&(te|=Hr.Closed),O&&T==="hidden"&&(te|=Hr.Opening),!O&&T==="visible"&&(te|=Hr.Closing);let me=pr();return y.createElement(Qh.Provider,{value:q},y.createElement(Gh,{value:te},me({ourProps:ae,theirProps:v,defaultTag:M8,features:_8,visible:T==="visible",name:"Transition.Child"})))}function Kz(e,t){let{show:r,appear:n=!1,unmount:o=!0,...a}=e,i=m.useRef(null),s=A8(e),u=qr(...s?[i,t]:t===null?[]:[t]);Zh();let c=bs();if(r===void 0&&c!==null&&(r=(c&Hr.Open)===Hr.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,f]=m.useState(r?"visible":"hidden"),h=T8(()=>{r||f("hidden")}),[p,g]=m.useState(!0),b=m.useRef([r]);Dr(()=>{p!==!1&&b.current[b.current.length-1]!==r&&(b.current.push(r),g(!1))},[b,r]);let v=m.useMemo(()=>({show:r,appear:n,initial:p}),[r,n,p]);Dr(()=>{r?f("visible"):!eg(h)&&i.current!==null&&f("hidden")},[r,h]);let x={unmount:o},k=rt(()=>{var S;p&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),E=rt(()=>{var S;p&&g(!1),(S=e.beforeLeave)==null||S.call(e)}),j=pr();return y.createElement(Qh.Provider,{value:h},y.createElement(Jh.Provider,{value:v},j({ourProps:{...x,as:m.Fragment,children:y.createElement(I8,{ref:u,...x,...a,beforeEnter:k,beforeLeave:E})},theirProps:{},defaultTag:m.Fragment,features:_8,visible:d==="visible",name:"Transition"})))}function Yz(e,t){let r=m.useContext(Jh)!==null,n=bs()!==null;return y.createElement(y.Fragment,null,!r&&n?y.createElement(pw,{ref:t,...e}):y.createElement(I8,{ref:t,...e}))}let pw=lr(Kz),I8=lr(Wz),Vj=lr(Yz),hw=Object.assign(pw,{Child:Vj,Root:pw});var Gz=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Gz||{}),Xz=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Xz||{});let Zz={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Wj=m.createContext(null);Wj.displayName="DialogContext";function tg(e){let t=m.useContext(Wj);if(t===null){let r=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,tg),r}return t}function Jz(e,t){return pn(t.type,Zz,e,t)}let M5=lr(function(e,t){let r=m.useId(),{id:n=`headlessui-dialog-${r}`,open:o,onClose:a,initialFocus:i,role:s="dialog",autoFocus:u=!0,__demoMode:c=!1,unmount:d=!1,...f}=e,h=m.useRef(!1);s=function(){return s==="dialog"||s==="alertdialog"?s:(h.current||(h.current=!0,console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let p=bs();o===void 0&&p!==null&&(o=(p&Hr.Open)===Hr.Open);let g=m.useRef(null),b=qr(g,t),v=ll(g.current),x=o?0:1,[k,E]=m.useReducer(Jz,{titleId:null,descriptionId:null,panelRef:m.createRef()}),j=rt(()=>a(!1)),S=rt(Y=>E({type:0,id:Y})),C=Zh()?x===0:!1,[O,M]=j8(),A={get current(){var Y;return(Y=k.panelRef.current)!=null?Y:g.current}},T=Hj(),{resolveContainers:_}=S8({mainTreeNode:T,portals:O,defaultContainers:[A]}),F=p!==null?(p&Hr.Closing)===Hr.Closing:!1;W9(c||F?!1:C,{allowed:rt(()=>{var Y,ae;return[(ae=(Y=g.current)==null?void 0:Y.closest("[data-headlessui-portal]"))!=null?ae:null]}),disallowed:rt(()=>{var Y;return[(Y=T?.closest("body > *:not(#headlessui-portal-root)"))!=null?Y:null]})});let $=xf.get(null);Dr(()=>{if(C)return $.actions.push(n),()=>$.actions.pop(n)},[$,n,C]);let I=On($,m.useCallback(Y=>$.selectors.isTop(Y,n),[$,n]));jj(I,_,Y=>{Y.preventDefault(),j()}),Mz(I,v?.defaultView,Y=>{Y.preventDefault(),Y.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),j()}),Nj(c||F?!1:C,v,_),wj(C,g,j);let[R,W]=vj(),B=m.useMemo(()=>[{dialogState:x,close:j,setTitleId:S,unmount:d},k],[x,j,S,d,k]),L=kn({open:x===0}),q={ref:b,id:n,role:s,tabIndex:-1,"aria-modal":c?void 0:x===0?!0:void 0,"aria-labelledby":k.titleId,"aria-describedby":R,unmount:d},U=!_z(),H=zs.None;C&&!c&&(H|=zs.RestoreFocus,H|=zs.TabLock,u&&(H|=zs.AutoFocus),U&&(H|=zs.InitialFocus));let X=pr();return y.createElement(Bj,null,y.createElement(T5,{force:!0},y.createElement(zj,null,y.createElement(Wj.Provider,{value:B},y.createElement(E8,{target:g},y.createElement(T5,{force:!1},y.createElement(W,{slot:L},y.createElement(M,null,y.createElement(Fz,{initialFocus:i,initialFocusFallback:g,containers:_,features:H},y.createElement(Bh,{value:j},X({ourProps:q,theirProps:f,slot:L,defaultTag:Qz,features:eH,visible:x===0,name:"Dialog"})))))))))))}),Qz="div",eH=Fo.RenderStrategy|Fo.Static;function tH(e,t){let{transition:r=!1,open:n,...o}=e,a=bs(),i=e.hasOwnProperty("open")||a!==null,s=e.hasOwnProperty("onClose");if(!i&&!s)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!i)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!s)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!a&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(n!==void 0||r)&&!o.static?y.createElement(bp,null,y.createElement(hw,{show:n,transition:r,unmount:o.unmount},y.createElement(M5,{ref:t,...o}))):y.createElement(bp,null,y.createElement(M5,{ref:t,open:n,...o}))}let rH="div";function nH(e,t){let r=m.useId(),{id:n=`headlessui-dialog-panel-${r}`,transition:o=!1,...a}=e,[{dialogState:i,unmount:s},u]=tg("Dialog.Panel"),c=qr(t,u.panelRef),d=kn({open:i===0}),f=rt(v=>{v.stopPropagation()}),h={ref:c,id:n,onClick:f},p=o?Vj:m.Fragment,g=o?{unmount:s}:{},b=pr();return y.createElement(p,{...g},b({ourProps:h,theirProps:a,slot:d,defaultTag:rH,name:"Dialog.Panel"}))}let oH="div";function aH(e,t){let{transition:r=!1,...n}=e,[{dialogState:o,unmount:a}]=tg("Dialog.Backdrop"),i=kn({open:o===0}),s={ref:t,"aria-hidden":!0},u=r?Vj:m.Fragment,c=r?{unmount:a}:{},d=pr();return y.createElement(u,{...c},d({ourProps:s,theirProps:n,slot:i,defaultTag:oH,name:"Dialog.Backdrop"}))}let iH="h2";function sH(e,t){let r=m.useId(),{id:n=`headlessui-dialog-title-${r}`,...o}=e,[{dialogState:a,setTitleId:i}]=tg("Dialog.Title"),s=qr(t);m.useEffect(()=>(i(n),()=>i(null)),[n,i]);let u=kn({open:a===0}),c={ref:s,id:n};return pr()({ourProps:c,theirProps:o,slot:u,defaultTag:iH,name:"Dialog.Title"})}let lH=lr(tH),uH=lr(nH);lr(aH);let cH=lr(sH),ym=Object.assign(lH,{Panel:uH,Title:cH,Description:L9});var _5;let dH=(_5=y.startTransition)!=null?_5:function(e){e()};var fH=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(fH||{}),mH=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.SetButtonElement=4]="SetButtonElement",e[e.SetPanelElement=5]="SetPanelElement",e))(mH||{});let pH={0:e=>({...e,disclosureState:pn(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}},4(e,t){return e.buttonElement===t.element?e:{...e,buttonElement:t.element}},5(e,t){return e.panelElement===t.element?e:{...e,panelElement:t.element}}},Kj=m.createContext(null);Kj.displayName="DisclosureContext";function Yj(e){let t=m.useContext(Kj);if(t===null){let r=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Yj),r}return t}let Gj=m.createContext(null);Gj.displayName="DisclosureAPIContext";function D8(e){let t=m.useContext(Gj);if(t===null){let r=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,D8),r}return t}let Xj=m.createContext(null);Xj.displayName="DisclosurePanelContext";function hH(){return m.useContext(Xj)}function gH(e,t){return pn(t.type,pH,e,t)}let bH=m.Fragment;function vH(e,t){let{defaultOpen:r=!1,...n}=e,o=m.useRef(null),a=qr(t,bj(b=>{o.current=b},e.as===void 0||ru(e.as))),i=m.useReducer(gH,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:s,buttonId:u},c]=i,d=rt(b=>{c({type:1});let v=hi(o.current);if(!v||!u)return;let x=b?wo(b)?b:"current"in b&&wo(b.current)?b.current:v.getElementById(u):v.getElementById(u);x?.focus()}),f=m.useMemo(()=>({close:d}),[d]),h=kn({open:s===0,close:d}),p={ref:a},g=pr();return y.createElement(Kj.Provider,{value:i},y.createElement(Gj.Provider,{value:f},y.createElement(Bh,{value:d},y.createElement(Gh,{value:pn(s,{0:Hr.Open,1:Hr.Closed})},g({ourProps:p,theirProps:n,slot:h,defaultTag:bH,name:"Disclosure"})))))}let yH="button";function xH(e,t){let r=m.useId(),{id:n=`headlessui-disclosure-button-${r}`,disabled:o=!1,autoFocus:a=!1,...i}=e,[s,u]=Yj("Disclosure.Button"),c=hH(),d=c===null?!1:c===s.panelId,f=m.useRef(null),h=qr(f,t,rt(A=>{if(!d)return u({type:4,element:A})}));m.useEffect(()=>{if(!d)return u({type:2,buttonId:n}),()=>{u({type:2,buttonId:null})}},[n,u,d]);let p=rt(A=>{var T;if(d){if(s.disclosureState===1)return;switch(A.key){case ar.Space:case ar.Enter:A.preventDefault(),A.stopPropagation(),u({type:0}),(T=s.buttonElement)==null||T.focus();break}}else switch(A.key){case ar.Space:case ar.Enter:A.preventDefault(),A.stopPropagation(),u({type:0});break}}),g=rt(A=>{switch(A.key){case ar.Space:A.preventDefault();break}}),b=rt(A=>{var T;pu(A.currentTarget)||o||(d?(u({type:0}),(T=s.buttonElement)==null||T.focus()):u({type:0}))}),{isFocusVisible:v,focusProps:x}=qo({autoFocus:a}),{isHovered:k,hoverProps:E}=oa({isDisabled:o}),{pressed:j,pressProps:S}=Rh({disabled:o}),C=kn({open:s.disclosureState===0,hover:k,active:j,disabled:o,focus:v,autofocus:a}),O=qh(e,s.buttonElement),M=ec(d?{ref:h,type:O,disabled:o||void 0,autoFocus:a,onKeyDown:p,onClick:b}:{ref:h,id:n,type:O,"aria-expanded":s.disclosureState===0,"aria-controls":s.panelElement?s.panelId:void 0,disabled:o||void 0,autoFocus:a,onKeyDown:p,onKeyUp:g,onClick:b},x,E,S);return pr()({ourProps:M,theirProps:i,slot:C,defaultTag:yH,name:"Disclosure.Button"})}let kH="div",wH=Fo.RenderStrategy|Fo.Static;function jH(e,t){let r=m.useId(),{id:n=`headlessui-disclosure-panel-${r}`,transition:o=!1,...a}=e,[i,s]=Yj("Disclosure.Panel"),{close:u}=D8("Disclosure.Panel"),[c,d]=m.useState(null),f=qr(t,rt(k=>{dH(()=>s({type:5,element:k}))}),d);m.useEffect(()=>(s({type:3,panelId:n}),()=>{s({type:3,panelId:null})}),[n,s]);let h=bs(),[p,g]=Ef(o,c,h!==null?(h&Hr.Open)===Hr.Open:i.disclosureState===0),b=kn({open:i.disclosureState===0,close:u}),v={ref:f,id:n,...jf(g)},x=pr();return y.createElement(Bj,null,y.createElement(Xj.Provider,{value:i.panelId},x({ourProps:v,theirProps:a,slot:b,defaultTag:kH,features:wH,visible:p,name:"Disclosure.Panel"})))}let EH=lr(vH),NH=lr(xH),SH=lr(jH),iv=Object.assign(EH,{Button:NH,Panel:SH}),I5=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function D5(e){var t,r;let n=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!Hn(o))return n;let a=!1;for(let s of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))s.remove(),a=!0;let i=a?(r=o.innerText)!=null?r:"":n;return I5.test(i)&&(i=i.replace(I5,"")),i}function OH(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let r=e.getAttribute("aria-labelledby");if(r){let n=r.split(" ").map(o=>{let a=document.getElementById(o);if(a){let i=a.getAttribute("aria-label");return typeof i=="string"?i.trim():D5(a).trim()}return null}).filter(Boolean);if(n.length>0)return n.join(", ")}return D5(e).trim()}function CH(e){let t=m.useRef(""),r=m.useRef("");return rt(()=>{let n=e.current;if(!n)return"";let o=n.innerText;if(t.current===o)return r.current;let a=OH(n).trim().toLowerCase();return t.current=o,r.current=a,a})}var PH=Object.defineProperty,AH=(e,t,r)=>t in e?PH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,L5=(e,t,r)=>(AH(e,typeof t!="symbol"?t+"":t,r),r),$n=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))($n||{}),vp=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(vp||{}),Pr=(e=>(e[e.OpenMenu=0]="OpenMenu",e[e.CloseMenu=1]="CloseMenu",e[e.GoToItem=2]="GoToItem",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterItems=5]="RegisterItems",e[e.UnregisterItems=6]="UnregisterItems",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetItemsElement=8]="SetItemsElement",e[e.SortItems=9]="SortItems",e[e.MarkButtonAsMoved=10]="MarkButtonAsMoved",e))(Pr||{});function R5(e,t=r=>r){let r=e.activeItemIndex!==null?e.items[e.activeItemIndex]:null,n=Y9(t(e.items.slice()),a=>a.dataRef.current.domRef.current),o=r?n.indexOf(r):null;return o===-1&&(o=null),{items:n,activeItemIndex:o}}let TH={1(e){if(e.menuState===1)return e;let t=e.buttonElement?Gm.Tracked(N8(e.buttonElement)):e.buttonPositionState;return{...e,activeItemIndex:null,pendingFocus:{focus:dn.Nothing},menuState:1,buttonPositionState:t}},0(e,t){return e.menuState===0?e:{...e,__demoMode:!1,pendingFocus:t.focus,menuState:0,buttonPositionState:Gm.Idle}},2:(e,t)=>{var r,n,o,a,i;if(e.menuState===1)return e;let s={...e,searchQuery:"",activationTrigger:(r=t.trigger)!=null?r:1,__demoMode:!1};if(t.focus===dn.Nothing)return{...s,activeItemIndex:null};if(t.focus===dn.Specific)return{...s,activeItemIndex:e.items.findIndex(d=>d.id===t.id)};if(t.focus===dn.Previous){let d=e.activeItemIndex;if(d!==null){let f=e.items[d].dataRef.current.domRef,h=vm(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(h!==null){let p=e.items[h].dataRef.current.domRef;if(((n=f.current)==null?void 0:n.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...s,activeItemIndex:h}}}}else if(t.focus===dn.Next){let d=e.activeItemIndex;if(d!==null){let f=e.items[d].dataRef.current.domRef,h=vm(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(h!==null){let p=e.items[h].dataRef.current.domRef;if(((a=f.current)==null?void 0:a.nextElementSibling)===p.current||((i=p.current)==null?void 0:i.nextElementSibling)===null)return{...s,activeItemIndex:h}}}}let u=R5(e),c=vm(t,{resolveItems:()=>u.items,resolveActiveIndex:()=>u.activeItemIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...s,...u,activeItemIndex:c}},3:(e,t)=>{let r=e.searchQuery!==""?0:1,n=e.searchQuery+t.value.toLowerCase(),o=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+r).concat(e.items.slice(0,e.activeItemIndex+r)):e.items).find(i=>{var s;return((s=i.dataRef.current.textValue)==null?void 0:s.startsWith(n))&&!i.dataRef.current.disabled}),a=o?e.items.indexOf(o):-1;return a===-1||a===e.activeItemIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeItemIndex:a,activationTrigger:1}},4(e){return e.searchQuery===""?e:{...e,searchQuery:"",searchActiveItemIndex:null}},5:(e,t)=>{let r=e.items.concat(t.items.map(o=>o)),n=e.activeItemIndex;return e.pendingFocus.focus!==dn.Nothing&&(n=vm(e.pendingFocus,{resolveItems:()=>r,resolveActiveIndex:()=>e.activeItemIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),{...e,items:r,activeItemIndex:n,pendingFocus:{focus:dn.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let r=e.items,n=[],o=new Set(t.items);for(let[a,i]of r.entries())if(o.has(i.id)&&(n.push(a),o.delete(i.id),o.size===0))break;if(n.length>0){r=r.slice();for(let a of n.reverse())r.splice(a,1)}return{...e,items:r,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.itemsElement===t.element?e:{...e,itemsElement:t.element},9:e=>e.pendingShouldSort?{...e,...R5(e),pendingShouldSort:!1}:e,10(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:Gm.Moved}}},MH=class L8 extends kj{constructor(t){super(t),L5(this,"actions",{registerItem:r5(()=>{let r=[],n=new Set;return[(o,a)=>{n.has(a)||(n.add(a),r.push({id:o,dataRef:a}))},()=>(n.clear(),this.send({type:5,items:r.splice(0)}))]}),unregisterItem:r5(()=>{let r=[];return[n=>r.push(n),()=>this.send({type:6,items:r.splice(0)})]})}),L5(this,"selectors",{activeDescendantId(r){var n;let o=r.activeItemIndex,a=r.items;return o===null||(n=a[o])==null?void 0:n.id},isActive(r,n){var o;let a=r.activeItemIndex,i=r.items;return a!==null?((o=i[a])==null?void 0:o.id)===n:!1},shouldScrollIntoView(r,n){return r.__demoMode||r.menuState!==0||r.activationTrigger===0?!1:this.isActive(r,n)},didButtonMove(r){return r.buttonPositionState.kind==="Moved"}}),this.on(5,()=>{this.disposables.requestAnimationFrame(()=>{this.send({type:9})})});{let r=this.state.id,n=xf.get(null);this.disposables.add(n.on(U9.Push,o=>{!n.selectors.isTop(o,r)&&this.state.menuState===0&&this.send({type:1})})),this.on(0,()=>n.actions.push(r)),this.on(1,()=>n.actions.pop(r))}this.disposables.group(r=>{this.on(1,n=>{n.buttonElement&&(r.dispose(),r.add(Tz(n.buttonElement,n.buttonPositionState,()=>{this.send({type:10})})))})})}static new({id:t,__demoMode:r=!1}){return new L8({id:t,__demoMode:r,menuState:r?0:1,buttonElement:null,itemsElement:null,items:[],searchQuery:"",activeItemIndex:null,activationTrigger:1,pendingShouldSort:!1,pendingFocus:{focus:dn.Nothing},buttonPositionState:Gm.Idle})}reduce(t,r){return pn(r.type,TH,t,r)}};const R8=m.createContext(null);function Zj(e){let t=m.useContext(R8);if(t===null){let r=new Error(`<${e} /> is missing a parent <Menu /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,F8),r}return t}function F8({id:e,__demoMode:t=!1}){let r=m.useMemo(()=>MH.new({id:e,__demoMode:t}),[]);return Xh(()=>r.dispose()),r}let _H=m.Fragment;function IH(e,t){let r=m.useId(),{__demoMode:n=!1,...o}=e,a=F8({id:r,__demoMode:n}),[i,s,u]=On(a,v=>[v.menuState,v.itemsElement,v.buttonElement]),c=qr(t),d=xf.get(null),f=On(d,m.useCallback(v=>d.selectors.isTop(v,r),[d,r]));jj(f,[u,s],(v,x)=>{var k;a.send({type:Pr.CloseMenu}),Hh(x,zh.Loose)||(v.preventDefault(),(k=a.state.buttonElement)==null||k.focus())});let h=rt(()=>{a.send({type:Pr.CloseMenu})}),p=kn({open:i===$n.Open,close:h}),g={ref:c},b=pr();return y.createElement(v8,null,y.createElement(R8.Provider,{value:a},y.createElement(Gh,{value:pn(i,{[$n.Open]:Hr.Open,[$n.Closed]:Hr.Closed})},b({ourProps:g,theirProps:o,slot:p,defaultTag:_H,name:"Menu"}))))}let DH="button";function LH(e,t){let r=Zj("Menu.Button"),n=m.useId(),{id:o=`headlessui-menu-button-${n}`,disabled:a=!1,autoFocus:i=!1,...s}=e,u=m.useRef(null),c=yz(),d=qr(t,u,h8(),rt(T=>r.send({type:Pr.SetButtonElement,element:T}))),f=rt(T=>{switch(T.key){case ar.Space:case ar.Enter:case ar.ArrowDown:T.preventDefault(),T.stopPropagation(),r.send({type:Pr.OpenMenu,focus:{focus:dn.First}});break;case ar.ArrowUp:T.preventDefault(),T.stopPropagation(),r.send({type:Pr.OpenMenu,focus:{focus:dn.Last}});break}}),h=rt(T=>{switch(T.key){case ar.Space:T.preventDefault();break}}),[p,g,b]=On(r,T=>[T.menuState,T.buttonElement,T.itemsElement]),v=p===$n.Open;eB(v,{trigger:g,action:m.useCallback(T=>{if(g!=null&&g.contains(T.target))return gm.Ignore;let _=T.target.closest('[role="menuitem"]:not([data-disabled])');return Hn(_)?gm.Select(_):b!=null&&b.contains(T.target)?gm.Ignore:gm.Close},[g,b]),close:m.useCallback(()=>r.send({type:Pr.CloseMenu}),[]),select:m.useCallback(T=>T.click(),[])});let x=T$(T=>{var _;a||(p===$n.Open?(nr.flushSync(()=>r.send({type:Pr.CloseMenu})),(_=u.current)==null||_.focus({preventScroll:!0})):(T.preventDefault(),r.send({type:Pr.OpenMenu,focus:{focus:dn.Nothing},trigger:vp.Pointer})))}),{isFocusVisible:k,focusProps:E}=qo({autoFocus:i}),{isHovered:j,hoverProps:S}=oa({isDisabled:a}),{pressed:C,pressProps:O}=Rh({disabled:a}),M=kn({open:p===$n.Open,active:C||p===$n.Open,disabled:a,hover:j,focus:k,autofocus:i}),A=ec(c(),{ref:d,id:o,type:qh(e,u.current),"aria-haspopup":"menu","aria-controls":b?.id,"aria-expanded":p===$n.Open,disabled:a||void 0,autoFocus:i,onKeyDown:f,onKeyUp:h},x,E,S,O);return pr()({ourProps:A,theirProps:s,slot:M,defaultTag:DH,name:"Menu.Button"})}let RH="div",FH=Fo.RenderStrategy|Fo.Static;function $H(e,t){let r=m.useId(),{id:n=`headlessui-menu-items-${r}`,anchor:o,portal:a=!1,modal:i=!0,transition:s=!1,...u}=e,c=p8(o),d=Zj("Menu.Items"),[f,h]=b8(c),p=g8(),[g,b]=m.useState(null),v=qr(t,c?f:null,rt(L=>d.send({type:Pr.SetItemsElement,element:L})),b),[x,k]=On(d,L=>[L.menuState,L.buttonElement]),E=ll(k),j=ll(g);c&&(a=!0);let S=bs(),[C,O]=Ef(s,g,S!==null?(S&Hr.Open)===Hr.Open:x===$n.Open);wj(C,k,()=>{d.send({type:Pr.CloseMenu})});let M=On(d,L=>L.__demoMode),A=M?!1:i&&x===$n.Open;Nj(A,j);let T=M?!1:i&&x===$n.Open;W9(T,{allowed:m.useCallback(()=>[k,g],[k,g])});let _=On(d,d.selectors.didButtonMove)?!1:C;m.useEffect(()=>{let L=g;L&&x===$n.Open&&(N9(L)||L.focus({preventScroll:!0}))},[x,g]),pB(x===$n.Open,{container:g,accept(L){return L.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:L.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(L){L.setAttribute("role","none")}});let F=gi(),$=rt(L=>{var q,U,H;switch(F.dispose(),L.key){case ar.Space:if(d.state.searchQuery!=="")return L.preventDefault(),L.stopPropagation(),d.send({type:Pr.Search,value:L.key});case ar.Enter:if(L.preventDefault(),L.stopPropagation(),d.state.activeItemIndex!==null){let{dataRef:X}=d.state.items[d.state.activeItemIndex];(U=(q=X.current)==null?void 0:q.domRef.current)==null||U.click()}d.send({type:Pr.CloseMenu}),K9(d.state.buttonElement);break;case ar.ArrowDown:return L.preventDefault(),L.stopPropagation(),d.send({type:Pr.GoToItem,focus:dn.Next});case ar.ArrowUp:return L.preventDefault(),L.stopPropagation(),d.send({type:Pr.GoToItem,focus:dn.Previous});case ar.Home:case ar.PageUp:return L.preventDefault(),L.stopPropagation(),d.send({type:Pr.GoToItem,focus:dn.First});case ar.End:case ar.PageDown:return L.preventDefault(),L.stopPropagation(),d.send({type:Pr.GoToItem,focus:dn.Last});case ar.Escape:L.preventDefault(),L.stopPropagation(),nr.flushSync(()=>d.send({type:Pr.CloseMenu})),(H=d.state.buttonElement)==null||H.focus({preventScroll:!0});break;case ar.Tab:L.preventDefault(),L.stopPropagation(),nr.flushSync(()=>d.send({type:Pr.CloseMenu})),G$(d.state.buttonElement,L.shiftKey?vn.Previous:vn.Next);break;default:L.key.length===1&&(d.send({type:Pr.Search,value:L.key}),F.setTimeout(()=>d.send({type:Pr.ClearSearch}),350));break}}),I=rt(L=>{switch(L.key){case ar.Space:L.preventDefault();break}}),R=kn({open:x===$n.Open}),W=ec(c?p():{},{"aria-activedescendant":On(d,d.selectors.activeDescendantId),"aria-labelledby":On(d,L=>{var q;return(q=L.buttonElement)==null?void 0:q.id}),id:n,onKeyDown:$,onKeyUp:I,role:"menu",tabIndex:x===$n.Open?0:void 0,ref:v,style:{...u.style,...h,"--button-width":$9(C,k,!0).width},...jf(O)}),B=pr();return y.createElement(zj,{enabled:a?e.static||C:!1,ownerDocument:E},B({ourProps:W,theirProps:u,slot:R,defaultTag:RH,features:FH,visible:_,name:"Menu.Items"}))}let BH=m.Fragment;function zH(e,t){let r=m.useId(),{id:n=`headlessui-menu-item-${r}`,disabled:o=!1,...a}=e,i=Zj("Menu.Item"),s=On(i,_=>i.selectors.isActive(_,n)),u=m.useRef(null),c=qr(t,u),d=On(i,_=>i.selectors.shouldScrollIntoView(_,n));Dr(()=>{if(d)return uo().requestAnimationFrame(()=>{var _,F;(F=(_=u.current)==null?void 0:_.scrollIntoView)==null||F.call(_,{block:"nearest"})})},[d,u]);let f=CH(u),h=m.useRef({disabled:o,domRef:u,get textValue(){return f()}});Dr(()=>{h.current.disabled=o},[h,o]),Dr(()=>(i.actions.registerItem(n,h),()=>i.actions.unregisterItem(n)),[h,n]);let p=rt(()=>{i.send({type:Pr.CloseMenu})}),g=rt(_=>{if(o)return _.preventDefault();i.send({type:Pr.CloseMenu}),K9(i.state.buttonElement)}),b=rt(()=>{if(o)return i.send({type:Pr.GoToItem,focus:dn.Nothing});i.send({type:Pr.GoToItem,focus:dn.Specific,id:n})}),v=sB(),x=rt(_=>v.update(_)),k=rt(_=>{v.wasMoved(_)&&(o||s||i.send({type:Pr.GoToItem,focus:dn.Specific,id:n,trigger:vp.Pointer}))}),E=rt(_=>{v.wasMoved(_)&&(o||s&&i.state.activationTrigger===vp.Pointer&&i.send({type:Pr.GoToItem,focus:dn.Nothing}))}),[j,S]=xj(),[C,O]=vj(),M=kn({active:s,focus:s,disabled:o,close:p}),A={id:n,ref:c,role:"menuitem",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-labelledby":j,"aria-describedby":C,disabled:void 0,onClick:g,onFocus:b,onPointerEnter:x,onMouseEnter:x,onPointerMove:k,onMouseMove:k,onPointerLeave:E,onMouseLeave:E},T=pr();return y.createElement(S,null,y.createElement(O,null,T({ourProps:A,theirProps:a,slot:M,defaultTag:BH,name:"Menu.Item"})))}let HH="div";function qH(e,t){let[r,n]=xj(),o=e,a={ref:t,"aria-labelledby":r,role:"group"},i=pr();return y.createElement(n,null,i({ourProps:a,theirProps:o,slot:{},defaultTag:HH,name:"Menu.Section"}))}let UH="header";function VH(e,t){let r=m.useId(),{id:n=`headlessui-menu-heading-${r}`,...o}=e,a=yj();Dr(()=>a.register(n),[n,a.register]);let i={id:n,ref:t,role:"presentation",...a.props};return pr()({ourProps:i,theirProps:o,slot:{},defaultTag:UH,name:"Menu.Heading"})}let WH="div";function KH(e,t){let r=e,n={ref:t,role:"separator"};return pr()({ourProps:n,theirProps:r,slot:{},defaultTag:WH,name:"Menu.Separator"})}let YH=lr(IH),gw=lr(LH),bw=lr($H),zl=lr(zH),GH=lr(qH),XH=lr(VH),ZH=lr(KH),F5=Object.assign(YH,{Button:gw,Items:bw,Item:zl,Section:GH,Heading:XH,Separator:ZH});var JH=Object.defineProperty,QH=(e,t,r)=>t in e?JH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$5=(e,t,r)=>(QH(e,typeof t!="symbol"?t+"":t,r),r),fn=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(fn||{}),eq=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(eq||{});let tq={0:e=>e.popoverState===0?e:{...e,popoverState:0,__demoMode:!1},1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},rq=class $8 extends kj{constructor(t){super(t),$5(this,"actions",{close:()=>this.send({type:1}),refocusableClose:r=>{this.actions.close();let n=r?Hn(r)?r:"current"in r&&Hn(r.current)?r.current:this.state.button:this.state.button;n?.focus()},open:()=>this.send({type:0}),setButtonId:r=>this.send({type:3,buttonId:r}),setButton:r=>this.send({type:2,button:r}),setPanelId:r=>this.send({type:5,panelId:r}),setPanel:r=>this.send({type:4,panel:r})}),$5(this,"selectors",{isPortalled:r=>{var n;if(!r.button||!r.panel)return!1;let o=(n=hi(r.button))!=null?n:document;for(let f of o.querySelectorAll("body > *"))if(Number(f?.contains(r.button))^Number(f?.contains(r.panel)))return!0;let a=wf(o),i=a.indexOf(r.button),s=(i+a.length-1)%a.length,u=(i+1)%a.length,c=a[s],d=a[u];return!r.panel.contains(c)&&!r.panel.contains(d)}});{let r=this.state.id,n=xf.get(null);this.on(0,()=>n.actions.push(r)),this.on(1,()=>n.actions.pop(r))}}static new({id:t,__demoMode:r=!1}){return new $8({id:t,__demoMode:r,popoverState:r?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(t,r){return pn(r.type,tq,t,r)}};const B8=m.createContext(null);function rg(e){let t=m.useContext(B8);if(t===null){let r=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,rg),r}return t}function nq({id:e,__demoMode:t=!1}){let r=m.useMemo(()=>rq.new({id:e,__demoMode:t}),[]);return Xh(()=>r.dispose()),r}let Jj=m.createContext(null);Jj.displayName="PopoverGroupContext";function z8(){return m.useContext(Jj)}let ng=m.createContext(null);ng.displayName="PopoverPanelContext";function oq(){return m.useContext(ng)}let aq="div";function iq(e,t){var r;let n=m.useId(),{__demoMode:o=!1,...a}=e,i=nq({id:n,__demoMode:o}),s=m.useRef(null),u=qr(t,bj(I=>{s.current=I})),[c,d,f,h,p]=On(i,m.useCallback(I=>[I.popoverState,I.button,I.panel,I.buttonId,I.panelId],[])),g=Z$((r=s.current)!=null?r:d),b=oi(h),v=oi(p),x=m.useMemo(()=>({buttonId:b,panelId:v,close:i.actions.close}),[b,v,i]),k=z8(),E=k?.registerPopover,j=rt(()=>{var I,R;let W=os((I=s.current)!=null?I:d);return(R=k?.isFocusWithinPopoverGroup())!=null?R:W&&(d?.contains(W)||f?.contains(W))});m.useEffect(()=>E?.(x),[E,x]);let[S,C]=j8(),O=Hj(d),M=S8({mainTreeNode:O,portals:S,defaultContainers:[{get current(){return i.state.button}},{get current(){return i.state.panel}}]});Ej(g,"focus",I=>{var R,W,B,L,q,U;I.target!==window&&wo(I.target)&&i.state.popoverState===fn.Open&&(j()||i.state.button&&i.state.panel&&(M.contains(I.target)||(W=(R=i.state.beforePanelSentinel.current)==null?void 0:R.contains)!=null&&W.call(R,I.target)||(L=(B=i.state.afterPanelSentinel.current)==null?void 0:B.contains)!=null&&L.call(B,I.target)||(U=(q=i.state.afterButtonSentinel.current)==null?void 0:q.contains)!=null&&U.call(q,I.target)||i.actions.close()))},!0);let A=c===fn.Open;jj(A,M.resolveContainers,(I,R)=>{i.actions.close(),Hh(R,zh.Loose)||(I.preventDefault(),d?.focus())});let T=kn({open:c===fn.Open,close:i.actions.refocusableClose}),_=On(i,m.useCallback(I=>pn(I.popoverState,{[fn.Open]:Hr.Open,[fn.Closed]:Hr.Closed}),[])),F={ref:u},$=pr();return y.createElement(bp,{node:O},y.createElement(v8,null,y.createElement(ng.Provider,{value:null},y.createElement(B8.Provider,{value:i},y.createElement(Bh,{value:i.actions.refocusableClose},y.createElement(Gh,{value:_},y.createElement(C,null,$({ourProps:F,theirProps:a,slot:T,defaultTag:aq,name:"Popover"}))))))))}let sq="button";function lq(e,t){let r=m.useId(),{id:n=`headlessui-popover-button-${r}`,disabled:o=!1,autoFocus:a=!1,...i}=e,s=rg("Popover.Button"),[u,c,d,f,h,p,g]=On(s,m.useCallback(ae=>[ae.popoverState,s.selectors.isPortalled(ae),ae.button,ae.buttonId,ae.panel,ae.panelId,ae.afterButtonSentinel],[])),b=m.useRef(null),v=`headlessui-focus-sentinel-${m.useId()}`,x=z8(),k=x?.closeOthers,E=oq()!==null;m.useEffect(()=>{if(!E)return s.actions.setButtonId(n),()=>s.actions.setButtonId(null)},[E,n,s]);let[j]=m.useState(()=>Symbol()),S=qr(b,t,h8(),rt(ae=>{if(!E){if(ae)s.state.buttons.current.push(j);else{let te=s.state.buttons.current.indexOf(j);te!==-1&&s.state.buttons.current.splice(te,1)}s.state.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),ae&&s.actions.setButton(ae)}})),C=qr(b,t),O=rt(ae=>{var te,me,Q;if(E){if(s.state.popoverState===fn.Closed)return;switch(ae.key){case ar.Space:case ar.Enter:ae.preventDefault(),(me=(te=ae.target).click)==null||me.call(te),s.actions.close(),(Q=s.state.button)==null||Q.focus();break}}else switch(ae.key){case ar.Space:case ar.Enter:ae.preventDefault(),ae.stopPropagation(),s.state.popoverState===fn.Closed?(k?.(s.state.buttonId),s.actions.open()):s.actions.close();break;case ar.Escape:if(s.state.popoverState!==fn.Open)return k?.(s.state.buttonId);if(!b.current)return;let ue=os(b.current);if(ue&&!b.current.contains(ue))return;ae.preventDefault(),ae.stopPropagation(),s.actions.close();break}}),M=rt(ae=>{E||ae.key===ar.Space&&ae.preventDefault()}),A=rt(ae=>{var te,me;pu(ae.currentTarget)||o||(E?(s.actions.close(),(te=s.state.button)==null||te.focus()):(ae.preventDefault(),ae.stopPropagation(),s.state.popoverState===fn.Closed?(k?.(s.state.buttonId),s.actions.open()):s.actions.close(),(me=s.state.button)==null||me.focus()))}),T=rt(ae=>{ae.preventDefault(),ae.stopPropagation()}),{isFocusVisible:_,focusProps:F}=qo({autoFocus:a}),{isHovered:$,hoverProps:I}=oa({isDisabled:o}),{pressed:R,pressProps:W}=Rh({disabled:o}),B=u===fn.Open,L=kn({open:B,active:R||B,disabled:o,hover:$,focus:_,autofocus:a}),q=qh(e,d),U=ec(E?{ref:C,type:q,onKeyDown:O,onClick:A,disabled:o||void 0,autoFocus:a}:{ref:S,id:f,type:q,"aria-expanded":u===fn.Open,"aria-controls":h?p:void 0,disabled:o||void 0,autoFocus:a,onKeyDown:O,onKeyUp:M,onClick:A,onMouseDown:T},F,I,W),H=Uj(),X=rt(()=>{if(!Hn(s.state.panel))return;let ae=s.state.panel;function te(){pn(H.current,{[Eo.Forwards]:()=>jo(ae,vn.First),[Eo.Backwards]:()=>jo(ae,vn.Last)})===hu.Error&&jo(wf(ns(s.state.button)).filter(me=>me.dataset.headlessuiFocusGuard!=="true"),pn(H.current,{[Eo.Forwards]:vn.Next,[Eo.Backwards]:vn.Previous}),{relativeTo:s.state.button})}te()}),Y=pr();return y.createElement(y.Fragment,null,Y({ourProps:U,theirProps:i,slot:L,defaultTag:sq,name:"Popover.Button"}),B&&!E&&c&&y.createElement(as,{id:v,ref:g,features:ai.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:X}))}let uq="div",cq=Fo.RenderStrategy|Fo.Static;function H8(e,t){let r=m.useId(),{id:n=`headlessui-popover-backdrop-${r}`,transition:o=!1,...a}=e,i=rg("Popover.Backdrop"),s=On(i,m.useCallback(x=>x.popoverState,[])),[u,c]=m.useState(null),d=qr(t,c),f=bs(),[h,p]=Ef(o,u,f!==null?(f&Hr.Open)===Hr.Open:s===fn.Open),g=rt(x=>{if(pu(x.currentTarget))return x.preventDefault();i.actions.close()}),b=kn({open:s===fn.Open}),v={ref:d,id:n,"aria-hidden":!0,onClick:g,...jf(p)};return pr()({ourProps:v,theirProps:a,slot:b,defaultTag:uq,features:cq,visible:h,name:"Popover.Backdrop"})}let dq="div",fq=Fo.RenderStrategy|Fo.Static;function mq(e,t){let r=m.useId(),{id:n=`headlessui-popover-panel-${r}`,focus:o=!1,anchor:a,portal:i=!1,modal:s=!1,transition:u=!1,...c}=e,d=rg("Popover.Panel"),f=On(d,d.selectors.isPortalled),[h,p,g,b,v]=On(d,m.useCallback(Y=>[Y.popoverState,Y.button,Y.__demoMode,Y.beforePanelSentinel,Y.afterPanelSentinel],[])),x=`headlessui-focus-sentinel-before-${r}`,k=`headlessui-focus-sentinel-after-${r}`,E=m.useRef(null),j=p8(a),[S,C]=b8(j),O=g8();j&&(i=!0);let[M,A]=m.useState(null),T=qr(E,t,j?S:null,d.actions.setPanel,A),_=ll(p),F=ll(E.current);Dr(()=>(d.actions.setPanelId(n),()=>d.actions.setPanelId(null)),[n,d]);let $=bs(),[I,R]=Ef(u,M,$!==null?($&Hr.Open)===Hr.Open:h===fn.Open);wj(I,p,d.actions.close),Nj(g?!1:s&&I,F);let W=rt(Y=>{var ae;switch(Y.key){case ar.Escape:if(d.state.popoverState!==fn.Open||!E.current)return;let te=os(E.current);if(te&&!E.current.contains(te))return;Y.preventDefault(),Y.stopPropagation(),d.actions.close(),(ae=d.state.button)==null||ae.focus();break}});m.useEffect(()=>{var Y;e.static||h===fn.Closed&&((Y=e.unmount)==null||Y)&&d.actions.setPanel(null)},[h,e.unmount,e.static,d]),m.useEffect(()=>{if(g||!o||h!==fn.Open||!E.current)return;let Y=os(E.current);E.current.contains(Y)||jo(E.current,vn.First)},[g,o,E.current,h]);let B=kn({open:h===fn.Open,close:d.actions.refocusableClose}),L=ec(j?O():{},{ref:T,id:n,onKeyDown:W,onBlur:o&&h===fn.Open?Y=>{var ae,te,me,Q,ue;let G=Y.relatedTarget;G&&E.current&&((ae=E.current)!=null&&ae.contains(G)||(d.actions.close(),((me=(te=b.current)==null?void 0:te.contains)!=null&&me.call(te,G)||(ue=(Q=v.current)==null?void 0:Q.contains)!=null&&ue.call(Q,G))&&G.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...c.style,...C,"--button-width":$9(I,p,!0).width},...jf(R)}),q=Uj(),U=rt(()=>{let Y=E.current;if(!Y)return;function ae(){pn(q.current,{[Eo.Forwards]:()=>{var te;jo(Y,vn.First)===hu.Error&&((te=d.state.afterPanelSentinel.current)==null||te.focus())},[Eo.Backwards]:()=>{var te;(te=d.state.button)==null||te.focus({preventScroll:!0})}})}ae()}),H=rt(()=>{let Y=E.current;if(!Y)return;function ae(){pn(q.current,{[Eo.Forwards]:()=>{var te;if(!d.state.button)return;let me=(te=ns(d.state.button))!=null?te:document.body,Q=wf(me),ue=Q.indexOf(d.state.button),G=Q.slice(0,ue+1),de=[...Q.slice(ue+1),...G];for(let ie of de.slice())if(ie.dataset.headlessuiFocusGuard==="true"||M!=null&&M.contains(ie)){let V=de.indexOf(ie);V!==-1&&de.splice(V,1)}jo(de,vn.First,{sorted:!1})},[Eo.Backwards]:()=>{var te;jo(Y,vn.Previous)===hu.Error&&((te=d.state.button)==null||te.focus())}})}ae()}),X=pr();return y.createElement(Bj,null,y.createElement(ng.Provider,{value:n},y.createElement(Bh,{value:d.actions.refocusableClose},y.createElement(zj,{enabled:i?e.static||I:!1,ownerDocument:_},I&&f&&y.createElement(as,{id:x,ref:b,features:ai.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:U}),X({ourProps:L,theirProps:c,slot:B,defaultTag:dq,features:fq,visible:I,name:"Popover.Panel"}),I&&f&&y.createElement(as,{id:k,ref:v,features:ai.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:H})))))}let pq="div";function hq(e,t){let r=m.useRef(null),n=qr(r,t),[o,a]=m.useState([]),i=rt(b=>{a(v=>{let x=v.indexOf(b);if(x!==-1){let k=v.slice();return k.splice(x,1),k}return v})}),s=rt(b=>(a(v=>[...v,b]),()=>i(b))),u=rt(()=>{var b;let v=ns(r.current);if(!v)return!1;let x=os(r.current);return(b=r.current)!=null&&b.contains(x)?!0:o.some(k=>{var E,j;return((E=v.getElementById(k.buttonId.current))==null?void 0:E.contains(x))||((j=v.getElementById(k.panelId.current))==null?void 0:j.contains(x))})}),c=rt(b=>{for(let v of o)v.buttonId.current!==b&&v.close()}),d=m.useMemo(()=>({registerPopover:s,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:c}),[s,i,u,c]),f=kn({}),h=e,p={ref:n},g=pr();return y.createElement(bp,null,y.createElement(Jj.Provider,{value:d},g({ourProps:p,theirProps:h,slot:f,defaultTag:pq,name:"Popover.Group"})))}let gq=lr(iq),bq=lr(lq),vq=lr(H8),yq=lr(H8),xq=lr(mq),kq=lr(hq),sv=Object.assign(gq,{Button:bq,Backdrop:yq,Overlay:vq,Panel:xq,Group:kq}),Qj=m.createContext(null);Qj.displayName="GroupContext";let wq=m.Fragment;function jq(e){var t;let[r,n]=m.useState(null),[o,a]=xj(),[i,s]=vj(),u=m.useMemo(()=>({switch:r,setSwitch:n}),[r,n]),c={},d=e,f=pr();return y.createElement(s,{name:"Switch.Description",value:i},y.createElement(a,{name:"Switch.Label",value:o,props:{htmlFor:(t=u.switch)==null?void 0:t.id,onClick(h){r&&(sw(h.currentTarget)&&h.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},y.createElement(Qj.Provider,{value:u},f({ourProps:c,theirProps:d,slot:{},defaultTag:wq,name:"Switch.Group"}))))}let Eq="button";function Nq(e,t){var r;let n=m.useId(),o=A9(),a=gj(),{id:i=o||`headlessui-switch-${n}`,disabled:s=a||!1,checked:u,defaultChecked:c,onChange:d,name:f,value:h,form:p,autoFocus:g=!1,...b}=e,v=m.useContext(Qj),[x,k]=m.useState(null),E=m.useRef(null),j=qr(E,t,v===null?null:v.setSwitch,k),S=GF(c),[C,O]=YF(u,d,S??!1),M=gi(),[A,T]=m.useState(!1),_=rt(()=>{T(!0),O?.(!C),M.nextFrame(()=>{T(!1)})}),F=rt(Q=>{if(pu(Q.currentTarget))return Q.preventDefault();Q.preventDefault(),_()}),$=rt(Q=>{Q.key===ar.Space?(Q.preventDefault(),_()):Q.key===ar.Enter&&XF(Q.currentTarget)}),I=rt(Q=>Q.preventDefault()),R=R9(),W=c$(),{isFocusVisible:B,focusProps:L}=qo({autoFocus:g}),{isHovered:q,hoverProps:U}=oa({isDisabled:s}),{pressed:H,pressProps:X}=Rh({disabled:s}),Y=kn({checked:C,disabled:s,hover:q,focus:B,active:H,autofocus:g,changing:A}),ae=ec({id:i,ref:j,role:"switch",type:qh(e,x),tabIndex:e.tabIndex===-1?0:(r=e.tabIndex)!=null?r:0,"aria-checked":C,"aria-labelledby":R,"aria-describedby":W,disabled:s||void 0,autoFocus:g,onClick:F,onKeyUp:$,onKeyPress:I},L,U,X),te=m.useCallback(()=>{if(S!==void 0)return O?.(S)},[O,S]),me=pr();return y.createElement(y.Fragment,null,f!=null&&y.createElement(r$,{disabled:s,data:{[f]:h||"on"},overrides:{type:"checkbox",checked:C},form:p,onReset:te}),me({ourProps:ae,theirProps:b,slot:Y,defaultTag:Eq,name:"Switch"}))}let Sq=lr(Nq),Oq=jq,Cq=b$,Pq=L9,og=Object.assign(Sq,{Group:Oq,Label:Cq,Description:Pq});const Cn=({textToCopy:e,onCopy:t=()=>{},copiedTimeout:r=2500,showLabel:n=!0,labelText:o="Copy",copiedText:a="Copied"})=>{const[i,s]=m.useState(!1),u=f=>{f.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{s(!0),t(),setTimeout(()=>s(!1),r)}).catch(h=>{console.error("Failed to copy text:",h)})},c=()=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4 align-middle",children:l.jsx("path",{fillRule:"evenodd",d:"M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z",clipRule:"evenodd"})}),d=()=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z",fill:"currentColor"})});return l.jsx("span",{className:"inline-flex items-center rounded font-sans text-xs font-normal leading-none tracking-normal text-token-text-secondary h-4",children:l.jsx("span",{"data-state":i?"copied":"closed",children:l.jsxs("button",{onClick:u,className:"inline-flex items-center justify-end gap-1 select-none py-1 cursor-pointer","aria-label":"Copy",children:[l.jsx("span",{className:"inline-flex h-4 w-4 items-center justify-center leading-none shrink-0",children:i?l.jsx(c,{}):l.jsx(d,{})}),n?l.jsx("span",{className:"whitespace-nowrap text-left",children:i?a:o}):null]})})})},B5=e=>e.replace(/\/+$/,"");class Aq{constructor(t={}){this.apiEndpoint=B5(t.apiEndpoint||"/api"),this.defaultHeaders={"inspectr-client":"inspectr-app",...t.headers},this.jsonHeaders={...this.defaultHeaders,"Content-Type":"application/json"},this.registration=new Tq(this),this.auth=new Mq(this),this.operations=new Iq(this),this.service=new Dq(this),this.stats=new Lq(this),this.mock=new Fq(this),this.mcp=new _q(this),this.rules=new $q(this),this.traces=new Rq(this),this.connectors=new Bq(this)}configure(t={}){t.apiEndpoint&&(this.apiEndpoint=B5(t.apiEndpoint)),t.headers&&(this.defaultHeaders={...this.defaultHeaders,...t.headers},this.jsonHeaders={...this.defaultHeaders,"Content-Type":"application/json"})}}class Tq{constructor(t){this.client=t}async register(t){const r=await fetch(`${this.client.apiEndpoint}/register`,{method:"POST",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok)throw new Error(`Registration failed (${r.status})`);return await r.json()}async getConfig(){const t=await fetch("/app/config");if(!t.ok)throw new Error(`Config load failed (${t.status})`);return await t.json()}}class Mq{constructor(t){this.client=t}async getAuthenticationSettings(){const t=await fetch(`${this.client.apiEndpoint}/auth/settings`,{headers:this.client.defaultHeaders});if(!t.ok)throw new Error(`Authentication settings failed (${t.status})`);return await t.json()}async updateAuthenticationSettings(t){const r=await fetch(`${this.client.apiEndpoint}/auth/settings`,{method:"PATCH",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok)throw new Error(`Update authentication settings failed (${r.status})`);return await r.json()}}class _q{constructor(t){this.client=t}async getMCPServerSettings(){const t=await fetch(`${this.client.apiEndpoint}/mcp/settings`,{headers:this.client.defaultHeaders});if(!t.ok)throw new Error(`MCP Server settings failed (${t.status})`);return await t.json()}async updateMCPServerSettings(t){const r=await fetch(`${this.client.apiEndpoint}/mcp/settings`,{method:"PATCH",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok)throw new Error(`Update MCP Server settings failed (${r.status})`);return await r.json()}async updateAuthenticationSettings(t){return console.warn("[Inspectr SDK] mcp.updateAuthenticationSettings is deprecated. Use updateMCPServerSettings instead."),this.updateMCPServerSettings(t)}}class Iq{constructor(t){this.client=t}async getOperation(t){const r=await fetch(`${this.client.apiEndpoint}/operations/${t}`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!r.ok){const n=await r.json().catch(()=>({})),o=n?.error||n?.message||`Get ${t} failed (${r.status})`,a=new Error(o);throw a.status=r.status,a.body=n,a}return await r.json()}async deleteAll(){const t=await fetch(`${this.client.apiEndpoint}/operations`,{method:"DELETE",headers:this.client.defaultHeaders});if(!t.ok)throw new Error(`Delete all failed (${t.status})`)}async delete(t){const r=await fetch(`${this.client.apiEndpoint}/operations/${t}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!(r.ok||r.status===404))throw new Error(`Delete ${t} failed (${r.status})`)}async replay(t,r={}){var n,o,a;const i=(o=(n=t?.meta)==null?void 0:n.proxy)==null?void 0:o.url,{meta:s,timing:u,response:c,...d}=t,f=r.replay_target||r.replayTarget,h=f?{...d,replay_target:f}:d;f==="proxy"&&i&&(a=h?.request)!=null&&a.url&&(h.request={...h.request,url:i});const p=await fetch(`${this.client.apiEndpoint}/replay`,{method:"POST",headers:this.client.jsonHeaders,body:JSON.stringify(h)});if(!p.ok)throw new Error(`Replay failed (${p.status})`);return await p.json()}async export({path:t,preset:r,since:n,until:o,format:a="json"}={}){let i;["postman","openapi","phar"].includes(a)?i=`${this.client.apiEndpoint}/operations/export/${a}`:i=`${this.client.apiEndpoint}/operations/export`;const s=new URLSearchParams;t&&s.append("path",t),r&&s.append("preset",r),n&&s.append("since",n),o&&s.append("until",o);const u=await fetch(`${i}?${s}`,{headers:this.client.defaultHeaders});if(!u.ok){const c=u.headers.get("content-type")||"";let d=null,f=`Export failed (${u.status})`;if(c.toLowerCase().includes("application/json")){d=await u.json().catch(()=>null);const p=d?.error||d?.message||d?.detail||d?.title;p&&(f=p)}else{const p=await u.text().catch(()=>"");p&&(d=p,f=p)}const h=new Error(f);throw h.status=u.status,d!==null&&(h.body=d),h}return await u.blob()}async import(t){const r=new FormData;r.append("file",t),{...this.client.defaultHeaders};const n=await fetch(`${this.client.apiEndpoint}/operations/import`,{method:"POST",headers:this.client.defaultHeaders,body:r});if(!n.ok)throw new Error(`Import failed (${n.status})`)}async summarize(t={}){const r=new URLSearchParams,n=u=>{if(u!=null)return u instanceof Date?u.toISOString():String(u)},o=(u,c)=>{if(c==null)return;if(Array.isArray(c)){if(c.length===0)return;r.set(u,c.map(n).join(","));return}const d=n(c);d!==void 0&&r.set(u,d)};o("operation_id",t.operationId),o("since",t.since),o("until",t.until),o("sort_field",t.sortField),o("sort_direction",t.sortDirection),o("filter[status]",t.status),o("filter[statuses]",t.statuses),o("filter[path]",t.path),o("filter[host]",t.host),o("filter[method]",t.method),o("filter[methods]",t.methods),o("min_duration",t.minDuration),o("max_duration",t.maxDuration),o("filter[tag]",t.tag),o("filter[tags]",t.tags),o("filter[tag_any]",t.tagAny),o("filter[tags_any]",t.tagsAny);const a=r.toString(),i=`${this.client.apiEndpoint}/operations/summary${a?`?${a}`:""}`,s=await fetch(i,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!s.ok)throw new Error(`Operations summary failed (${s.status})`);return await s.json()}async getSeries(t={}){const{method:r,path:n}=t;if(!r)throw new Error("options.method is required");if(!n)throw new Error("options.path is required");const o=new URLSearchParams,a=d=>{if(d!=null)return d instanceof Date?d.toISOString():String(d)},i=(d,f)=>{if(f==null)return;if(Array.isArray(f)){if(!f.length)return;o.set(d,f.map(a).join(","));return}const h=a(f);h!==void 0&&o.set(d,h)};i("method",r),i("path",n),i("operation_id",t.operationId),i("since",t.since),i("until",t.until),i("host",t.host),i("min_duration",t.minDuration),i("max_duration",t.maxDuration),i("status",t.status),i("statuses",t.statuses),i("tag",t.tag),i("tags",t.tags),i("tag_any",t.tagAny),i("tags_any",t.tagsAny),i("series_limit",t.seriesLimit);const s=o.toString(),u=`${this.client.apiEndpoint}/operations/series${s?`?${s}`:""}`,c=await fetch(u,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!c.ok)throw new Error(`Operations series failed (${c.status})`);return await c.json()}async listTags(){const t=await fetch(`${this.client.apiEndpoint}/operations/tags`,{headers:this.client.defaultHeaders});if(!t.ok)throw new Error(`List tags failed (${t.status})`);return await t.json()}async listCompact(t={}){const r=new URLSearchParams,n=u=>{if(!(u==null||u===""))return u instanceof Date?u.toISOString():String(u)},o=(u,c)=>{if(!(c==null||c==="")){if(Array.isArray(c)){if(!c.length)return;r.set(u,c.map(d=>String(d)).join(","));return}r.set(u,String(c))}};o("operation_id",t.operationId),o("since",n(t.since)),o("until",n(t.until)),o("sort_field",t.sortField),o("sort_direction",t.sortDirection),o("page",t.page),o("limit",t.limit),o("filter[status]",t.status),o("filter[statuses]",t.statuses),o("filter[method]",t.method),o("filter[methods]",t.methods),o("filter[path]",t.path),o("filter[paths]",t.paths),o("filter[host]",t.host),o("filter[hosts]",t.hosts),o("min_duration",t.minDuration),o("max_duration",t.maxDuration),o("filter[tag]",t.tag),o("filter[tags]",t.tags),o("filter[tag_any]",t.tagAny),o("filter[tags_any]",t.tagsAny);const a=r.toString(),i=`${this.client.apiEndpoint}/operations/compact${a?`?${a}`:""}`,s=await fetch(i,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!s.ok)throw new Error(`List compact operations failed (${s.status})`);return await s.json()}async deleteOperationTags(t,r={}){if(!t)throw new Error("Operation id is required");const n=new URLSearchParams,o=(u,c)=>{Array.isArray(c)?c.forEach(d=>{d!=null&&`${d}`!=""&&n.append(u,String(d))}):c!=null&&`${c}`!=""&&n.append(u,String(c))},a=(u,c)=>{Array.isArray(c)?c.length&&n.set(u,c.join(",")):c!=null&&`${c}`!=""&&n.set(u,String(c))};if(o("tag",r.tag),a("tags",r.tags),!n.has("tag")&&!n.has("tags"))throw new Error("At least one tag must be provided via options.tag or options.tags");const i=`${this.client.apiEndpoint}/operations/${encodeURIComponent(t)}/tags`,s=await fetch(`${i}?${n.toString()}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!s.ok)throw new Error(`Delete operation tags failed (${s.status})`);return await s.json()}async deleteTag(t,r={}){if(!t)throw new Error("tag is required");const n=new URLSearchParams,o=u=>{if(u)return u instanceof Date?u.toISOString():u},a=(u,c)=>{c==null||c===""||Array.isArray(c)&&c.length===0||n.set(u,Array.isArray(c)?c.join(","):String(c))};a("since",o(r.since)),a("until",o(r.until)),a("method",r.method),a("path",r.path),a("host",r.host),Array.isArray(r.tagsAll)&&r.tagsAll.length&&a("tags_all",r.tagsAll),Array.isArray(r.tagsAny)&&r.tagsAny.length&&a("tags_any",r.tagsAny),Array.isArray(r.statuses)&&r.statuses.length&&a("statuses",r.statuses),a("limit",r.limit),a("page_size",r.pageSize);const i=`${this.client.apiEndpoint}/operations/tags/${encodeURIComponent(t)}`,s=await fetch(`${i}${n.toString()?"?"+n.toString():""}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!s.ok)throw new Error(`Delete tag failed (${s.status})`);return await s.json()}async bulkDeleteTag(t={}){const{tag:r}=t;if(!r)throw new Error("options.tag is required");const n=new URLSearchParams,o=u=>{if(u)return u instanceof Date?u.toISOString():u},a=(u,c)=>{c==null||c===""||Array.isArray(c)&&c.length===0||n.set(u,Array.isArray(c)?c.join(","):String(c))};a("tag",r),a("since",o(t.since)),a("until",o(t.until)),a("method",t.method),a("path",t.path),a("host",t.host),Array.isArray(t.tagsAll)&&t.tagsAll.length&&a("tags_all",t.tagsAll),Array.isArray(t.tagsAny)&&t.tagsAny.length&&a("tags_any",t.tagsAny),Array.isArray(t.statuses)&&t.statuses.length&&a("statuses",t.statuses),a("limit",t.limit),a("page_size",t.pageSize),t.dryRun!==void 0&&t.dryRun!==null&&a("dry_run",t.dryRun?"true":"false");const i=`${this.client.apiEndpoint}/operations/tags/bulk-delete`,s=await fetch(`${i}?${n.toString()}`,{method:"POST",headers:this.client.defaultHeaders});if(!s.ok)throw new Error(`Bulk delete tag failed (${s.status})`);return await s.json()}}class Dq{constructor(t){this.client=t}async getHealth(){const t=await fetch(`${this.client.apiEndpoint}/health`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Health check failed (${t.status})`);return await t.json()}async getVersion(){const t=await fetch(`${this.client.apiEndpoint}/version`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Version check failed (${t.status})`);return await t.json()}async ping(t){const r=await fetch(`${this.client.apiEndpoint}/ping/${t}`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!r.ok){const n=await r.json();throw new Error(`${n?.error||r.status}`)}return await r.json()}async getMetrics(){const t=await fetch(`${this.client.apiEndpoint}/metrics`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Metrics failed (${t.status})`);return await t.json()}async getInfo(){const t=await fetch(`${this.client.apiEndpoint}/info`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Info failed (${t.status})`);return await t.json()}async getLicense(){const t=await fetch(`${this.client.apiEndpoint}/license`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`License failed (${t.status})`);return await t.json()}async putLicense(t){const r=JSON.stringify({license_key:t}),n=await fetch(`${this.client.apiEndpoint}/license`,{method:"PUT",headers:this.client.jsonHeaders,body:r});if(!n.ok){const o=n.status,a=await n.json().catch(()=>({})),i=a?.error||a?.message||`License update failed (${o})`,s=new Error(i);throw s.status=o,s.code=a?.code,s.reason=a?.reason,s.details=a?.error||a?.message,s}return await n.json()}}class Lq{constructor(t){this.client=t}async getOperations({group:t,start:r,end:n,tag:o}){const a=new URLSearchParams({group:t,start:r,end:n});o&&a.append("tag",o);const i=`${this.client.apiEndpoint}/stats/operations?${a.toString()}`,s=await fetch(i,{headers:this.client.defaultHeaders});if(!s.ok)throw new Error(`Stats operations failed (${s.status})`);return await s.json()}async getOverview(t={}){const r=u=>{if(!(u==null||u===""))return u instanceof Date?u.toISOString():String(u)},n=new URLSearchParams,o=(u,c)=>{c==null||c===""||n.set(u,String(c))};o("from",r(t.from)),o("to",r(t.to)),o("interval",t.interval),o("tag",t.tag);const a=n.toString(),i=`${this.client.apiEndpoint}/stats/operations/overview${a?`?${a}`:""}`,s=await fetch(i,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!s.ok)throw new Error(`Stats overview failed (${s.status})`);return await s.json()}async getMcpOperations(t={}){const r=u=>{if(!(u==null||u===""))return u instanceof Date?u.toISOString():String(u)},n=new URLSearchParams,o=(u,c)=>{c==null||c===""||n.set(u,String(c))};o("from",r(t.from)),o("to",r(t.to));const a=n.toString(),i=`${this.client.apiEndpoint}/stats/operations/mcp${a?`?${a}`:""}`,s=await fetch(i,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!s.ok)throw new Error(`Stats MCP operations failed (${s.status})`);return await s.json()}async getMcpBuckets(t={}){const r=u=>{if(!(u==null||u===""))return u instanceof Date?u.toISOString():String(u)},n=new URLSearchParams,o=(u,c)=>{c==null||c===""||n.set(u,String(c))};o("from",r(t.from)),o("to",r(t.to)),o("interval",t.interval),o("group",t.group);const a=n.toString(),i=`${this.client.apiEndpoint}/stats/operations/mcp/buckets${a?`?${a}`:""}`,s=await fetch(i,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!s.ok)throw new Error(`Stats MCP buckets failed (${s.status})`);return await s.json()}async getBuckets(t={}){const r=c=>{if(!(c==null||c===""))return c instanceof Date?c.toISOString():String(c)},n=new URLSearchParams,o=(c,d)=>{d==null||d===""||n.set(c,String(d))},a=(c,d)=>{if(d!=null)if(Array.isArray(d)){if(!d.length)return;n.set(c,d.map(f=>String(f)).join(","))}else n.set(c,String(d))};o("from",r(t.from)),o("to",r(t.to)),o("interval",t.interval),o("group",t.group),a("filter[method]",t.method),a("filter[status]",t.status),a("filter[status_class]",t.statusClass),a("filter[tag]",t.tag),a("filter[path]",t.path),o("path_prefix",t.pathPrefix),a("filter[host]",t.host);const i=n.toString(),s=`${this.client.apiEndpoint}/stats/operations/buckets${i?`?${i}`:""}`,u=await fetch(s,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!u.ok)throw new Error(`Stats buckets failed (${u.status})`);return await u.json()}async getBucketsGroup(t,r={}){if(!t)throw new Error("Stats buckets group is required");const n=d=>{if(!(d==null||d===""))return d instanceof Date?d.toISOString():String(d)},o=new URLSearchParams,a=(d,f)=>{f==null||f===""||o.set(d,String(f))},i=(d,f)=>{if(f!=null)if(Array.isArray(f)){if(!f.length)return;o.set(d,f.map(h=>String(h)).join(","))}else o.set(d,String(f))};a("from",n(r.from)),a("to",n(r.to)),a("interval",r.interval),a("group",r.group),i("filter[method]",r.method),i("filter[status]",r.status),i("filter[status_class]",r.statusClass),i("filter[tag]",r.tag),i("filter[path]",r.path),a("path_prefix",r.pathPrefix),i("filter[host]",r.host);const s=o.toString(),u=`${this.client.apiEndpoint}/stats/operations/buckets/${encodeURIComponent(t)}${s?`?${s}`:""}`,c=await fetch(u,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!c.ok)throw new Error(`Stats buckets failed (${c.status})`);return await c.json()}async aggregateBy(t,r={}){const n=["path","method","host","status_class","status","tag","protocol"];if(!n.includes(t))throw new Error(`Invalid dimension: ${t}. Allowed: ${n.join(", ")}`);const o=f=>{if(!(f==null||f===""))return f instanceof Date?f.toISOString():String(f)},a=new URLSearchParams,i=(f,h)=>{h==null||h===""||a.set(f,String(h))},s=(f,h)=>{if(h!=null)if(Array.isArray(h)){if(!h.length)return;a.set(f,h.map(p=>String(p)).join(","))}else a.set(f,String(h))};i("from",o(r.from)),i("to",o(r.to)),s("metrics",r.metrics),typeof r.limit=="number"&&i("limit",r.limit),i("order",r.order),s("method",r.method),s("status",r.status),s("status_class",r.statusClass),i("path",r.path),i("path_prefix",r.pathPrefix),i("host",r.host),s("tag",r.tag);const u=a.toString(),c=`${this.client.apiEndpoint}/stats/operations/aggregate/${encodeURIComponent(t)}${u?`?${u}`:""}`,d=await fetch(c,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!d.ok)throw new Error(`Stats aggregate failed (${d.status})`);return await d.json()}async deleteOperations(){const t=await fetch(`${this.client.apiEndpoint}/stats/operations`,{method:"DELETE",headers:this.client.defaultHeaders});if(t.status!==204)throw new Error(`Delete stats operations failed (${t.status})`)}}class Rq{constructor(t){this.client=t}async list(t={}){const r=new URLSearchParams,{page:n,limit:o,source:a,search:i}=t;n!=null&&r.set("page",String(n)),o!=null&&r.set("limit",String(o)),a&&r.set("source",a),i&&r.set("search",i);const s=r.toString(),u=`${this.client.apiEndpoint}/traces${s?`?${s}`:""}`,c=await fetch(u,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!c.ok)throw new Error(`Trace list failed (${c.status})`);return await c.json()}async get(t,r={}){if(!t)throw new Error("Trace ID is required");const n=new URLSearchParams,{page:o,limit:a}=r;o!=null&&n.set("page",String(o)),a!=null&&n.set("limit",String(a));const i=n.toString(),s=`${this.client.apiEndpoint}/traces/${encodeURIComponent(t)}${i?`?${i}`:""}`,u=await fetch(s,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!u.ok)throw new Error(`Trace detail failed (${u.status})`);return await u.json()}}class Fq{constructor(t){this.client=t}async getConfig(){const t=await fetch(`${this.client.apiEndpoint}/mock`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!t.ok)throw new Error(`Mock info failed (${t.status})`);return await t.json()}async launch(t){const r=`${this.client.apiEndpoint}/mock/launch?openapi=`+encodeURIComponent(t),n=await fetch(r,{method:"GET",headers:this.client.defaultHeaders});if(!n.ok){const o=await n.json().catch(()=>({}));throw new Error(o.error||`Mock launch failed (${n.status})`)}return await n.json()}}class $q{constructor(t){this.client=t}async export(t={}){const r=t?.id,n=r?`${this.client.apiEndpoint}/rules/${encodeURIComponent(r)}/export`:`${this.client.apiEndpoint}/rules/export`,o=await fetch(n,{method:"GET",headers:{...this.client.defaultHeaders,Accept:"application/x-yaml"}});if(!o.ok){let d="";try{d=await o.text()}catch{}throw new Error(`Rules export failed (${o.status})${d?`: ${d}`:""}`)}const a=await o.blob(),i=o.headers.get("Content-Type")||"application/x-yaml",s=o.headers.get("Content-Disposition")||"",u=/filename\*=UTF-8''([^;]+)|filename="?([^";]+)"?/i.exec(s),c=decodeURIComponent(u?.[1]||u?.[2]||"rules.yaml");return{blob:a,filename:c,contentType:i}}async import(t,r={}){const n=t&&typeof t=="object"&&(t instanceof Blob||t instanceof File)?t:String(t??""),o=r?.overwrite===!0,a=`${this.client.apiEndpoint}/rules/import`+(o?"?overwrite=true":""),i=await fetch(a,{method:"POST",headers:{...this.client.defaultHeaders,"Content-Type":"application/x-yaml",Accept:"application/json"},body:n});if(!i.ok){let s={};try{s=await i.json()}catch{try{s={message:await i.text()}}catch{}}const u=s?.error||s?.message||`Rules import failed (${i.status})`,c=new Error(u);throw c.status=i.status,c.body=s,c}try{return await i.json()}catch{return{}}}async applyToHistory(t,r={}){if(!t)throw new Error("Rule id is required");const n=new URLSearchParams,o=c=>{if(c)return c instanceof Date?c.toISOString():c},a=(c,d)=>{d==null||d===""||n.set(c,String(d))};a("since",o(r.since)),a("until",o(r.until)),a("method",r.method),a("path",r.path),a("host",r.host),Array.isArray(r.tagsAll)&&r.tagsAll.length&&a("tags_all",r.tagsAll.join(",")),Array.isArray(r.tagsAny)&&r.tagsAny.length&&a("tags_any",r.tagsAny.join(",")),Array.isArray(r.statuses)&&r.statuses.length&&a("statuses",r.statuses.join(",")),typeof r.limit=="number"&&a("limit",r.limit),typeof r.pageSize=="number"&&a("page_size",r.pageSize);const i=r.dryRun!==!1;a("dry_run",i);const s=`${this.client.apiEndpoint}/rules/${encodeURIComponent(t)}/apply`+(n.toString()?`?${n.toString()}`:""),u=await fetch(s,{method:"POST",headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!u.ok){let c={};try{c=await u.json()}catch{}const d=c?.error||c?.message||`Apply rule failed (${u.status})`,f=new Error(d);throw f.status=u.status,f.body=c,f}return await u.json()}async list({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/rules`;const o=new URLSearchParams;t&&o.set("page",t),r&&o.set("limit",r),o.toString()&&(n+=`?${o.toString()}`);const a=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!a.ok)throw new Error(`Rules load failed (${a.status})`);return await a.json()}async create(t){const r=await fetch(`${this.client.apiEndpoint}/rules`,{method:"POST",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok){const n=await r.json().catch(()=>({})),o=n?.error||n?.message||`Rule create failed (${r.status})`,a=new Error(o);throw a.status=r.status,a.body=n,a}return await r.json()}async get(t){const r=await fetch(`${this.client.apiEndpoint}/rules/${t}`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!r.ok)throw new Error(`Rule load failed (${r.status})`);return await r.json()}async replace(t,r){const n=await fetch(`${this.client.apiEndpoint}/rules/${t}`,{method:"PUT",headers:this.client.jsonHeaders,body:JSON.stringify(r)});if(!n.ok){const o=await n.json().catch(()=>({})),a=o?.error||o?.message||`Rule update failed (${n.status})`,i=new Error(a);throw i.status=n.status,i.body=o,i}return await n.json()}async delete(t){const r=await fetch(`${this.client.apiEndpoint}/rules/${t}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!(r.ok||r.status===204)){const n=await r.json().catch(()=>({})),o=n?.error||n?.message||`Rule delete failed (${r.status})`,a=new Error(o);throw a.status=r.status,a.body=n,a}}async update(t,r){return this.replace(t,r)}async getEvents({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/rules/events`;const o=new URLSearchParams;t&&o.set("page",t),r&&o.set("limit",r),o.toString()&&(n+=`?${o.toString()}`);const a=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!a.ok)throw new Error(`Rules events failed (${a.status})`);return await a.json()}async getActions({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/rules/actions`;const o=new URLSearchParams;t&&o.set("page",t),r&&o.set("limit",r),o.toString()&&(n+=`?${o.toString()}`);const a=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!a.ok)throw new Error(`Rules actions failed (${a.status})`);return await a.json()}async getOperators({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/rules/operators`;const o=new URLSearchParams;t&&o.set("page",t),r&&o.set("limit",r),o.toString()&&(n+=`?${o.toString()}`);const a=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!a.ok)throw new Error(`Rules operators failed (${a.status})`);const i=await a.json();return Array.isArray(i)?i:i&&Array.isArray(i.operators)?i.operators:[]}}class Bq{constructor(t){this.client=t}async list({page:t,limit:r}={}){let n=`${this.client.apiEndpoint}/connectors`;const o=new URLSearchParams;t&&o.set("page",t),r&&o.set("limit",r),o.toString()&&(n+=`?${o.toString()}`);const a=await fetch(n,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!a.ok)throw new Error(`Connectors list failed (${a.status})`);return await a.json()}async create(t){const r=await fetch(`${this.client.apiEndpoint}/connectors`,{method:"POST",headers:this.client.jsonHeaders,body:JSON.stringify(t)});if(!r.ok){const n=await r.json().catch(()=>({})),o=n?.error||n?.message||`Connector create failed (${r.status})`,a=new Error(o);throw a.status=r.status,a.body=n,a}return await r.json()}async get(t){const r=await fetch(`${this.client.apiEndpoint}/connectors/${encodeURIComponent(t)}`,{headers:{...this.client.defaultHeaders,Accept:"application/json"}});if(!r.ok)throw new Error(`Connector load failed (${r.status})`);return await r.json()}async update(t,r){const n=await fetch(`${this.client.apiEndpoint}/connectors/${encodeURIComponent(t)}`,{method:"PUT",headers:this.client.jsonHeaders,body:JSON.stringify(r)});if(!n.ok){const o=await n.json().catch(()=>({})),a=o?.error||o?.message||`Connector update failed (${n.status})`,i=new Error(a);throw i.status=n.status,i.body=o,i}return await n.json()}async delete(t){const r=await fetch(`${this.client.apiEndpoint}/connectors/${encodeURIComponent(t)}`,{method:"DELETE",headers:this.client.defaultHeaders});if(!(r.ok||r.status===204)){const n=await r.json().catch(()=>({})),o=n?.error||n?.message||`Connector delete failed (${r.status})`,a=new Error(o);throw a.status=r.status,a.body=n,a}}}const zq=[":","="],Hq=e=>e==null?"":typeof e=="string"?e:String(e),yu=e=>{const t=Hq(e).trim();if(!t)return null;let r=-1,n="";for(const i of zq){const s=t.indexOf(i);if(s>0&&s<t.length-1){r=s,n=i;break}}if(r===-1)return{type:"simple",raw:t,display:t,key:null,value:null,separator:null,token:t.toLowerCase()};const o=t.slice(0,r).trim(),a=t.slice(r+1).trim();return!o||!a?{type:"simple",raw:t,display:t,key:null,value:null,separator:null,token:t.toLowerCase()}:{type:"kv",raw:t,display:`${o}:${a}`,key:o,value:a,separator:n,token:`${o}:${a}`.toLowerCase(),keyToken:o.toLowerCase()}},Sf=e=>Array.isArray(e)?e.map(yu).filter(Boolean):[],qq=e=>Array.isArray(e)?e.map(yu).filter(Boolean).map(t=>t.token):[],z5=e=>{if(!e)return[];if(Array.isArray(e.__normalizedTags))return e.__normalizedTags;const t=Sf(e?.tags||[]);return e.__normalizedTags=t,t};class Uq{constructor(){this.db=new mu("InspectrDB"),this.db.version(1).stores({events:"id, time, operation_id, method, status_code, path, duration, server"}),this.db.version(2).stores({events:"id, time, operation_id, method, status_code, path, duration, server"}).upgrade(()=>this.db.events.clear())}transformEvent(t){var r,n;const{id:o,data:a,operation_id:i}=t,s=Sf(((r=a?.meta)==null?void 0:r.tags)||[]);return{id:o,time:a.request.timestamp,operation_id:i,method:a.request.method,url:a.request.url,server:a.request.server,path:a.request.path,query_params:a.request.query_params||[],client_ip:a.request.client_ip,duration:a.timing.duration,status_code:(n=a.response)==null?void 0:n.status,tagTokens:s.map(u=>u.token),tags:s.map(u=>u.display)}}async upsertEvent(t){const r=this.transformEvent(t);return await this.db.events.put(r)}async bulkUpsertEvents(t){const r=t.map(n=>this.transformEvent(n));return await this.db.transaction("rw",this.db.events,()=>this.db.events.bulkPut(r))}async deleteEvent(t){return await this.db.events.delete(t)}async getEvent(t){return await this.db.events.get(t)}async queryEvents(t={}){const{filters:r={},sort:n={field:"time",order:"desc"},page:o=1,pageSize:a=20}=t;if(!(r.timestampRange||r.status&&r.status.length||r.method&&r.method.length||r.path||r.durationMin||r.durationMax||r.host||r.tags&&r.tags.length)){const f=this.db.events,h=f.count();let p=f.orderBy(n.field);n.order==="desc"&&(p=p.reverse());const g=p.offset((o-1)*a).limit(a).toArray(),[b,v]=await Promise.all([g,h]);return{results:b,totalCount:v}}let i=this.db.events.toCollection();if(r.timestampRange){if(typeof r.timestampRange=="string"){let f=new Date;switch(r.timestampRange){case"5M":f.setMinutes(f.getMinutes()-5);break;case"15M":f.setMinutes(f.getMinutes()-15);break;case"30M":f.setMinutes(f.getMinutes()-30);break;case"1H":f.setHours(f.getHours()-1);break;case"3H":f.setHours(f.getHours()-3);break;case"6H":f.setHours(f.getHours()-6);break;case"12H":f.setHours(f.getHours()-12);break;case"24H":f.setHours(f.getHours()-24);break;case"48H":f.setHours(f.getHours()-48);break;case"week":f.setDate(f.getDate()-7);break;case"month":f.setMonth(f.getMonth()-1);break}i=i.filter(h=>new Date(h.time)>=f)}else if(typeof r.timestampRange=="object"){if(r.timestampRange.start&&r.timestampRange.end){const f=new Date(r.timestampRange.start),h=new Date(r.timestampRange.end);i=i.filter(p=>{const g=new Date(p.time);return g>=f&&g<=h})}else if(r.timestampRange.start){const f=new Date(r.timestampRange.start);i=i.filter(h=>new Date(h.time)>=f)}else if(r.timestampRange.end){const f=new Date(r.timestampRange.end);i=i.filter(h=>new Date(h.time)<=f)}}}if(r.status&&Array.isArray(r.status)&&r.status.length>0&&(i=i.filter(f=>f.status_code===null||f.status_code===void 0?!1:r.status.includes(String(f.status_code)))),r.method&&Array.isArray(r.method)&&r.method.length>0){const f=r.method.map(h=>h.toLowerCase());i=i.filter(h=>f.includes(h.method.toLowerCase()))}if(r.path&&(i=i.filter(f=>f.path.includes(r.path))),r.durationMin&&(i=i.filter(f=>Number(f.duration)>=Number(r.durationMin))),r.durationMax&&(i=i.filter(f=>Number(f.duration)<=Number(r.durationMax))),r.host&&(i=i.filter(f=>f.server.toLowerCase().includes(r.host.toLowerCase()))),r.tags&&Array.isArray(r.tags)&&r.tags.length>0){const f=qq(r.tags);f.length>0&&(i=i.filter(h=>{const p=Array.isArray(h.tagTokens)&&h.tagTokens.length>0?h.tagTokens:z5(h).map(g=>g.token);return!p||p.length===0?!1:f.every(g=>p.includes(g))}))}const s=await i.count();let u;if(typeof i.orderBy=="function")try{u=i.orderBy(n.field),n.order==="desc"&&(u=u.reverse())}catch(f){console.error("[EventDB] orderBy error, fallback sorting:",f),u=(await i.toArray()).sort((h,p)=>{const g=n.field;return h[g]<p[g]?n.order==="asc"?-1:1:h[g]>p[g]?n.order==="asc"?1:-1:0})}else u=(await i.toArray()).sort((f,h)=>{const p=n.field;return f[p]<h[p]?n.order==="asc"?-1:1:f[p]>h[p]?n.order==="asc"?1:-1:0});const c=(o-1)*a;let d;return Array.isArray(u)?d=u.slice(c,c+a):typeof u.offset=="function"?d=await u.offset(c).limit(a).toArray():d=[],{results:d,totalCount:s}}async clearEvents(){return await this.db.events.clear()}async getAllTagOptions(){const t=await this.db.events.toArray(),r=new Map;return t.forEach(n=>{z5(n).forEach(o=>{r.has(o.token)||r.set(o.token,o.display)})}),Array.from(r.values()).sort((n,o)=>n.localeCompare(o))}}const Nn=new Uq,q8=m.createContext({apiEndpoint:"/api",setApiEndpoint:()=>{},connectionStatus:"reconnecting",setConnectionStatus:()=>{},sseEndpoint:"",ingressEndpoint:"",channelCode:"",setChannelCode:()=>{},channel:"",setChannel:()=>{},token:"",reRegistrationFailedRef:{current:!1},userInitiatedRegistrationRef:{current:!1},handleRegister:()=>{},attemptReRegistration:()=>{},toast:null,setToast:()=>{},debugMode:!1,client:null}),Er=()=>m.useContext(q8),Vq=({children:e})=>{const[t,r]=Ur("apiEndpoint","/api"),n=t?t.replace(/\/+$/,""):"/api",o=Me=>{r(Me&&Me.replace(/\/+$/,""))},[a,i]=m.useState("disconnected"),[s,u]=Ur("sseEndpoint",""),[c,d]=Ur("ingressEndpoint",""),[f,h]=Ur("channelCode",""),[p,g]=Ur("channel",""),[b,v]=Ur("token",""),[x,k]=Ur("expires",""),[,E]=Ur("expose","false"),[j,S]=m.useState(!1),[C,O]=m.useState(null),M=m.useRef(0),A=m.useRef(!1),T=6,_=5e3,F=typeof window<"u"&&window.location.hostname==="localhost",$=typeof window<"u"&&localStorage.getItem("debug")==="true";m.useEffect(()=>{$&&console.log("[Inspectr] Debug Mode enabled")},[]);const I=()=>{const Me=new URLSearchParams(window.location.search),ot=new URLSearchParams(window.location.hash.split("?")[1]||""),Ge=$t=>Me.get($t)||ot.get($t),at=Me.get("channelCode"),mt=Me.get("channel"),Ke=Me.get("token"),pt=Me.get("sseEndpoint"),jt=at||Ge("channelCode"),Ze=mt||Ge("channel"),$e=Ke||Ge("token"),ut=pt||Ge("sseEndpoint");return jt||Ze||$e||ut?(console.log("🔍 Found credentials in query params"),jt&&h(jt),Ze&&g(Ze),$e&&v($e),ut&&u(ut),window.history.replaceState({},"",`${window.location.pathname}${Me.toString()?"?"+Me.toString():""}`),!0):!1},R=()=>f&&p&&b?(console.log("✅ Using stored credentials from localStorage"),!0):!1,[W,B]=Ur("proxyEndpoint",""),[L,q]=m.useState(()=>new Aq({apiEndpoint:n}));m.useEffect(()=>{L.configure({apiEndpoint:n})},[n]);const U=async()=>{console.log("🔄 Fetching /app/config (Localhost, No credentials found)");try{const Me=await L.registration.getConfig();Me!=null&&Me.token&&Me!=null&&Me.sse_endpoint&&Me!=null&&Me.channel_code&&(console.log("✅ Loaded from /app/config:",Me),h(Me.channel_code),g(Me.channel),v(Me.token),u(Me.sse_endpoint),d(Me.ingress_endpoint),B(Me.proxy_endpoint),E(Me.expose?"true":"false"))}catch(Me){console.error("❌ Failed to load /app/config:",Me)}},H=async(Me=f,ot=p,Ge=b,at)=>{try{let mt={};Me&&ot?mt={channel:ot,channel_code:Me}:Ge&&(mt={token:Ge}),console.log("📤 Registering with:",mt);const Ke=await L.registration.register(mt);if(Ke!=null&&Ke.token&&Ke!=null&&Ke.sse_endpoint&&Ke!=null&&Ke.channel_code)return console.log("✅ Registration successful"),M.current=0,A.current=!1,h(Ke.channel_code),g(Ke.channel),v(Ke.token),k(Ke.expires),u(Ke.sse_endpoint),d(Ke.ingress_endpoint),B(Ke.proxy_endpoint),E(Ke.expose?"true":"false"),at&&O({message:"Registration Successful",subMessage:"Your channel and access code have been registered."}),i("connected"),!0;throw console.error("❌ Registration failed:",Ke),O({message:"Registration Failed",subMessage:"Please check your channel and access code.",type:"error"}),i("disconnected"),new Error("Registration failed")}catch(mt){throw console.error("❌ Registration error:",mt),O({message:"Registration Error",subMessage:"An error occurred during registration.",type:"error"}),i("disconnected"),mt}},X=()=>{A.current||(i("reconnecting"),M.current<T?(M.current+=1,console.log(`🔄 Attempting re-registration (${M.current}/${T}) in ${_/1e3} seconds...`),setTimeout(async()=>{try{await H()}catch(Me){console.log("❌ Re-registration attempt failed:",Me),X()}},_)):(console.log(`❌ Re-registration failed after ${T} attempts. Giving up.`),M.current=0,A.current=!0,i("disconnected")))},Y=()=>{M.current=0,A.current=!1};m.useEffect(()=>{(async()=>typeof window>"u"||(I()||!R()&&F&&await U(),S(!0)))()},[]);const ae=m.useRef(!1);m.useEffect(()=>{if(j){if(ae.current){ae.current=!1;return}if(b&&!s&&!A.current){console.log("🔄 Have token but missing sseEndpoint, re-registering"),H("","",b);return}console.log("🔄 Auto-registering with stored credentials:",p,f),p&&f?H(f,p):console.log("⚠️ Missing credentials for auto-registration, skipping.")}},[j,p,f,b,s]);const[te,me]=Ur("lastEventId",""),Q=m.useRef(null),ue=m.useRef(!1),G=50,de=50,ie=m.useRef(0),V=m.useRef(0),ee=m.useRef([]),ne=()=>{if(Q.current){try{Q.current.close()}catch{}Q.current=null}},ge=Me=>{if(ne(),!s||!b)return;const ot=Me??te;let Ge=`${s}?token=${encodeURIComponent(b)}`;if(ot){const mt=Ge.includes("?")?"&":"?";Ge=`${Ge}${mt}last_event_id=${encodeURIComponent(ot)}`}const at=new EventSource(Ge);Q.current=at,console.log(`🔄 SSE connecting with ${Ge}`),i(ue.current?"reconnecting":"connecting"),at.onopen=()=>{ue.current=!0,i("connected"),$&&console.log("📡️ SSE connection opened.")},at.onmessage=mt=>{try{const Ke=performance.now();if(Ke-ie.current>G&&(ie.current=Ke,V.current=0),V.current++,!mt.data||mt.data.trim()===""){$&&console.warn("Received empty SSE data, skipping");return}const pt=JSON.parse(mt.data);$&&console.log("[Inspectr] Received event:",pt),pt.operation_id?(pt.id=pt.operation_id,me(pt.operation_id)):pt.id=pt.id||`req-${Math.random().toString(36).slice(2,11)}`,V.current<de?Nn.upsertEvent(pt).catch(jt=>console.error("Error saving event to DB:",jt)):(ee.current.push(pt),V.current===de&&setTimeout(async()=>{try{await Nn.bulkUpsertEvents(ee.current)}catch(jt){console.error("bulk save failed",jt)}finally{ee.current=[],V.current=0,ie.current=performance.now()}},G))}catch(Ke){console.error("Error parsing SSE Inspectr data:",Ke)}},at.onerror=mt=>{if(console.error("❌ SSE connection error:",mt),i("reconnecting"),A.current){console.log("❌ Maximum re-registration attempts reached. Closing EventSource."),i("disconnected");try{at.close()}catch{}return}console.log("🔄 Starting re-registration retry loop due to SSE error."),X()}},Ee=()=>{ne(),i("disconnected"),console.log("📡️ SSE connection closed.")},Pe="sync",Ie=()=>{$&&console.log("[Inspectr] Syncing all operations..."),me(Pe),ge(Pe)};m.useEffect(()=>{if(!(!s||!b))return Y(),ge(),()=>{Ee()}},[s,b]),m.useEffect(()=>{const Me=()=>{try{ne()}catch{}};return window.addEventListener("beforeunload",Me),()=>window.removeEventListener("beforeunload",Me)},[]);const nt={apiEndpoint:n,setApiEndpoint:o,connectionStatus:a,setConnectionStatus:i,sseEndpoint:s,ingressEndpoint:c,proxyEndpoint:W,setProxyEndpoint:B,channelCode:f,setChannelCode:h,channel:p,setChannel:g,token:b,reRegistrationFailedRef:A,userInitiatedRegistrationRef:ae,handleRegister:H,attemptReRegistration:X,resetReRegistration:Y,toast:C,setToast:O,debugMode:$,client:L,lastEventId:te,setLastEventId:me,connect:ge,disconnect:Ee,syncOperations:Ie,eventSource:Q.current};return l.jsx(q8.Provider,{value:nt,children:e})};function Ka(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),r===!1||!n.defaultPrevented)return t?.(n)}}function H5(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function U8(...e){return t=>{let r=!1;const n=e.map(o=>{const a=H5(o,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let o=0;o<n.length;o++){const a=n[o];typeof a=="function"?a():H5(e[o],null)}}}}function vl(...e){return m.useCallback(U8(...e),e)}function V8(e,t=[]){let r=[];function n(a,i){const s=m.createContext(i),u=r.length;r=[...r,i];const c=f=>{var h;const{scope:p,children:g,...b}=f,v=((h=p?.[e])==null?void 0:h[u])||s,x=m.useMemo(()=>b,Object.values(b));return l.jsx(v.Provider,{value:x,children:g})};c.displayName=a+"Provider";function d(f,h){var p;const g=((p=h?.[e])==null?void 0:p[u])||s,b=m.useContext(g);if(b)return b;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[c,d]}const o=()=>{const a=r.map(i=>m.createContext(i));return function(i){const s=i?.[e]||a;return m.useMemo(()=>({[`__scope${e}`]:{...i,[e]:s}}),[i,s])}};return o.scopeName=e,[n,Wq(o,...t)]}function Wq(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(o){const a=n.reduce((i,{useScope:s,scopeName:u})=>{const c=s(o)[`__scope${u}`];return{...i,...c}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function Kq(e){const t=Yq(e),r=m.forwardRef((n,o)=>{const{children:a,...i}=n,s=m.Children.toArray(a),u=s.find(Xq);if(u){const c=u.props.children,d=s.map(f=>f===u?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return l.jsx(t,{...i,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,d):null})}return l.jsx(t,{...i,ref:o,children:a})});return r.displayName=`${e}.Slot`,r}function Yq(e){const t=m.forwardRef((r,n)=>{const{children:o,...a}=r;if(m.isValidElement(o)){const i=Jq(o),s=Zq(a,o.props);return o.type!==m.Fragment&&(s.ref=n?U8(n,i):i),m.cloneElement(o,s)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var W8=Symbol("radix.slottable");function Gq(e){const t=({children:r})=>l.jsx(l.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=W8,t}function Xq(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===W8}function Zq(e,t){const r={...t};for(const n in t){const o=e[n],a=t[n];/^on[A-Z]/.test(n)?o&&a?r[n]=(...i)=>{const s=a(...i);return o(...i),s}:o&&(r[n]=o):n==="style"?r[n]={...o,...a}:n==="className"&&(r[n]=[o,a].filter(Boolean).join(" "))}return{...e,...r}}function Jq(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var Qq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vs=Qq.reduce((e,t)=>{const r=Kq(`Primitive.${t}`),n=m.forwardRef((o,a)=>{const{asChild:i,...s}=o,u=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(u,{...s,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function eU(e,t){e&&nr.flushSync(()=>e.dispatchEvent(t))}function ag(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function tU(e,t=globalThis?.document){const r=ag(e);m.useEffect(()=>{const n=o=>{o.key==="Escape"&&r(o)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var rU="DismissableLayer",vw="dismissableLayer.update",nU="dismissableLayer.pointerDownOutside",oU="dismissableLayer.focusOutside",q5,K8=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Y8=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:s,...u}=e,c=m.useContext(K8),[d,f]=m.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=m.useState({}),g=vl(t,O=>f(O)),b=Array.from(c.layers),[v]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),x=b.indexOf(v),k=d?b.indexOf(d):-1,E=c.layersWithOutsidePointerEventsDisabled.size>0,j=k>=x,S=sU(O=>{const M=O.target,A=[...c.branches].some(T=>T.contains(M));!j||A||(o?.(O),i?.(O),O.defaultPrevented||s==null||s())},h),C=lU(O=>{const M=O.target;[...c.branches].some(A=>A.contains(M))||(a?.(O),i?.(O),O.defaultPrevented||s==null||s())},h);return tU(O=>{k===c.layers.size-1&&(n?.(O),!O.defaultPrevented&&s&&(O.preventDefault(),s()))},h),m.useEffect(()=>{if(d)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(q5=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),U5(),()=>{r&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=q5)}},[d,h,r,c]),m.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),U5())},[d,c]),m.useEffect(()=>{const O=()=>p({});return document.addEventListener(vw,O),()=>document.removeEventListener(vw,O)},[]),l.jsx(vs.div,{...u,ref:g,style:{pointerEvents:E?j?"auto":"none":void 0,...e.style},onFocusCapture:Ka(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Ka(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Ka(e.onPointerDownCapture,S.onPointerDownCapture)})});Y8.displayName=rU;var aU="DismissableLayerBranch",iU=m.forwardRef((e,t)=>{const r=m.useContext(K8),n=m.useRef(null),o=vl(t,n);return m.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),l.jsx(vs.div,{...e,ref:o})});iU.displayName=aU;function sU(e,t=globalThis?.document){const r=ag(e),n=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const a=s=>{if(s.target&&!n.current){let u=function(){G8(nU,r,c,{discrete:!0})};const c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);n.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function lU(e,t=globalThis?.document){const r=ag(e),n=m.useRef(!1);return m.useEffect(()=>{const o=a=>{a.target&&!n.current&&G8(oU,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function U5(){const e=new CustomEvent(vw);document.dispatchEvent(e)}function G8(e,t,r,{discrete:n}){const o=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),n?eU(o,a):o.dispatchEvent(a)}var ls=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},uU=rs[" useId ".trim().toString()]||(()=>{}),cU=0;function dU(e){const[t,r]=m.useState(uU());return ls(()=>{r(n=>n??String(cU++))},[e]),t?`radix-${t}`:""}var fU="Arrow",X8=m.forwardRef((e,t)=>{const{children:r,width:n=10,height:o=5,...a}=e;return l.jsx(vs.svg,{...a,ref:t,width:n,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});X8.displayName=fU;var mU=X8;function pU(e){const[t,r]=m.useState(void 0);return ls(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let i,s;if("borderBoxSize"in a){const u=a.borderBoxSize,c=Array.isArray(u)?u[0]:u;i=c.inlineSize,s=c.blockSize}else i=e.offsetWidth,s=e.offsetHeight;r({width:i,height:s})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var eE="Popper",[Z8,J8]=V8(eE),[hU,Q8]=Z8(eE),eT=e=>{const{__scopePopper:t,children:r}=e,[n,o]=m.useState(null);return l.jsx(hU,{scope:t,anchor:n,onAnchorChange:o,children:r})};eT.displayName=eE;var tT="PopperAnchor",rT=m.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...o}=e,a=Q8(tT,r),i=m.useRef(null),s=vl(t,i),u=m.useRef(null);return m.useEffect(()=>{const c=u.current;u.current=n?.current||i.current,c!==u.current&&a.onAnchorChange(u.current)}),n?null:l.jsx(vs.div,{...o,ref:s})});rT.displayName=tT;var tE="PopperContent",[gU,bU]=Z8(tE),nT=m.forwardRef((e,t)=>{var r,n,o,a,i,s;const{__scopePopper:u,side:c="bottom",sideOffset:d=0,align:f="center",alignOffset:h=0,arrowPadding:p=0,avoidCollisions:g=!0,collisionBoundary:b=[],collisionPadding:v=0,sticky:x="partial",hideWhenDetached:k=!1,updatePositionStrategy:E="optimized",onPlaced:j,...S}=e,C=Q8(tE,u),[O,M]=m.useState(null),A=vl(t,ee=>M(ee)),[T,_]=m.useState(null),F=pU(T),$=F?.width??0,I=F?.height??0,R=c+(f!=="center"?"-"+f:""),W=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},B=Array.isArray(b)?b:[b],L=B.length>0,q={padding:W,boundary:B.filter(yU),altBoundary:L},{refs:U,floatingStyles:H,placement:X,isPositioned:Y,middlewareData:ae}=l8({strategy:"fixed",placement:R,whileElementsMounted:(...ee)=>Kh(...ee,{animationFrame:E==="always"}),elements:{reference:C.anchor},middleware:[Fj({mainAxis:d+I,alignmentAxis:h}),g&&u8({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?QB():void 0,...q}),g&&c8({...q}),d8({...q,apply:({elements:ee,rects:ne,availableWidth:ge,availableHeight:Ee})=>{const{width:Pe,height:Ie}=ne.reference,nt=ee.floating.style;nt.setProperty("--radix-popper-available-width",`${ge}px`),nt.setProperty("--radix-popper-available-height",`${Ee}px`),nt.setProperty("--radix-popper-anchor-width",`${Pe}px`),nt.setProperty("--radix-popper-anchor-height",`${Ie}px`)}}),T&&tz({element:T,padding:p}),xU({arrowWidth:$,arrowHeight:I}),k&&ez({strategy:"referenceHidden",...q})]}),[te,me]=iT(X),Q=ag(j);ls(()=>{Y&&Q?.()},[Y,Q]);const ue=(r=ae.arrow)==null?void 0:r.x,G=(n=ae.arrow)==null?void 0:n.y,de=((o=ae.arrow)==null?void 0:o.centerOffset)!==0,[ie,V]=m.useState();return ls(()=>{O&&V(window.getComputedStyle(O).zIndex)},[O]),l.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:Y?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ie,"--radix-popper-transform-origin":[(a=ae.transformOrigin)==null?void 0:a.x,(i=ae.transformOrigin)==null?void 0:i.y].join(" "),...((s=ae.hide)==null?void 0:s.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(gU,{scope:u,placedSide:te,onArrowChange:_,arrowX:ue,arrowY:G,shouldHideArrow:de,children:l.jsx(vs.div,{"data-side":te,"data-align":me,...S,ref:A,style:{...S.style,animation:Y?void 0:"none"}})})})});nT.displayName=tE;var oT="PopperArrow",vU={top:"bottom",right:"left",bottom:"top",left:"right"},aT=m.forwardRef(function(e,t){const{__scopePopper:r,...n}=e,o=bU(oT,r),a=vU[o.placedSide];return l.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:l.jsx(mU,{...n,ref:t,style:{...n.style,display:"block"}})})});aT.displayName=oT;function yU(e){return e!==null}var xU=e=>({name:"transformOrigin",options:e,fn(t){var r,n,o;const{placement:a,rects:i,middlewareData:s}=t,u=((r=s.arrow)==null?void 0:r.centerOffset)!==0,c=u?0:e.arrowWidth,d=u?0:e.arrowHeight,[f,h]=iT(a),p={start:"0%",center:"50%",end:"100%"}[h],g=(((n=s.arrow)==null?void 0:n.x)??0)+c/2,b=(((o=s.arrow)==null?void 0:o.y)??0)+d/2;let v="",x="";return f==="bottom"?(v=u?p:`${g}px`,x=`${-d}px`):f==="top"?(v=u?p:`${g}px`,x=`${i.floating.height+d}px`):f==="right"?(v=`${-d}px`,x=u?p:`${b}px`):f==="left"&&(v=`${i.floating.width+d}px`,x=u?p:`${b}px`),{data:{x:v,y:x}}}});function iT(e){const[t,r="center"]=e.split("-");return[t,r]}var kU=eT,wU=rT,jU=nT,EU=aT,NU="Portal",sT=m.forwardRef((e,t)=>{var r;const{container:n,...o}=e,[a,i]=m.useState(!1);ls(()=>i(!0),[]);const s=n||a&&((r=globalThis?.document)==null?void 0:r.body);return s?tF.createPortal(l.jsx(vs.div,{...o,ref:t}),s):null});sT.displayName=NU;function SU(e,t){return m.useReducer((r,n)=>t[r][n]??r,e)}var rE=e=>{const{present:t,children:r}=e,n=OU(t),o=typeof r=="function"?r({present:n.isPresent}):m.Children.only(r),a=vl(n.ref,CU(o));return typeof r=="function"||n.isPresent?m.cloneElement(o,{ref:a}):null};rE.displayName="Presence";function OU(e){const[t,r]=m.useState(),n=m.useRef(null),o=m.useRef(e),a=m.useRef("none"),i=e?"mounted":"unmounted",[s,u]=SU(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=xm(n.current);a.current=s==="mounted"?c:"none"},[s]),ls(()=>{const c=n.current,d=o.current;if(d!==e){const f=a.current,h=xm(c);e?u("MOUNT"):h==="none"||c?.display==="none"?u("UNMOUNT"):u(d&&f!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),ls(()=>{if(t){let c;const d=t.ownerDocument.defaultView??window,f=p=>{const g=xm(n.current).includes(CSS.escape(p.animationName));if(p.target===t&&g&&(u("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(a.current=xm(n.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:m.useCallback(c=>{n.current=c?getComputedStyle(c):null,r(c)},[])}}function xm(e){return e?.animationName||"none"}function CU(e){var t,r;let n=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}var PU=rs[" useInsertionEffect ".trim().toString()]||ls;function AU({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[o,a,i]=TU({defaultProp:t,onChange:r}),s=e!==void 0,u=s?e:o;{const d=m.useRef(e!==void 0);m.useEffect(()=>{const f=d.current;f!==s&&console.warn(`${n} is changing from ${f?"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.`),d.current=s},[s,n])}const c=m.useCallback(d=>{var f;if(s){const h=MU(d)?d(e):d;h!==e&&((f=i.current)==null||f.call(i,h))}else a(d)},[s,e,a,i]);return[u,c]}function TU({defaultProp:e,onChange:t}){const[r,n]=m.useState(e),o=m.useRef(r),a=m.useRef(t);return PU(()=>{a.current=t},[t]),m.useEffect(()=>{var i;o.current!==r&&((i=a.current)==null||i.call(a,r),o.current=r)},[r,o]),[r,n,a]}function MU(e){return typeof e=="function"}var _U=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"}),IU="VisuallyHidden",lT=m.forwardRef((e,t)=>l.jsx(vs.span,{...e,ref:t,style:{..._U,...e.style}}));lT.displayName=IU;var DU=lT,[ig,K2e]=V8("Tooltip",[J8]),sg=J8(),uT="TooltipProvider",LU=700,yw="tooltip.open",[RU,nE]=ig(uT),cT=e=>{const{__scopeTooltip:t,delayDuration:r=LU,skipDelayDuration:n=300,disableHoverableContent:o=!1,children:a}=e,i=m.useRef(!0),s=m.useRef(!1),u=m.useRef(0);return m.useEffect(()=>{const c=u.current;return()=>window.clearTimeout(c)},[]),l.jsx(RU,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:m.useCallback(()=>{window.clearTimeout(u.current),i.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>i.current=!0,n)},[n]),isPointerInTransitRef:s,onPointerInTransitChange:m.useCallback(c=>{s.current=c},[]),disableHoverableContent:o,children:a})};cT.displayName=uT;var Sd="Tooltip",[FU,Of]=ig(Sd),dT=e=>{const{__scopeTooltip:t,children:r,open:n,defaultOpen:o,onOpenChange:a,disableHoverableContent:i,delayDuration:s}=e,u=nE(Sd,e.__scopeTooltip),c=sg(t),[d,f]=m.useState(null),h=dU(),p=m.useRef(0),g=i??u.disableHoverableContent,b=s??u.delayDuration,v=m.useRef(!1),[x,k]=AU({prop:n,defaultProp:o??!1,onChange:O=>{O?(u.onOpen(),document.dispatchEvent(new CustomEvent(yw))):u.onClose(),a?.(O)},caller:Sd}),E=m.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),j=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v.current=!1,k(!0)},[k]),S=m.useCallback(()=>{window.clearTimeout(p.current),p.current=0,k(!1)},[k]),C=m.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{v.current=!0,k(!0),p.current=0},b)},[b,k]);return m.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),l.jsx(kU,{...c,children:l.jsx(FU,{scope:t,contentId:h,open:x,stateAttribute:E,trigger:d,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{u.isOpenDelayedRef.current?C():j()},[u.isOpenDelayedRef,C,j]),onTriggerLeave:m.useCallback(()=>{g?S():(window.clearTimeout(p.current),p.current=0)},[S,g]),onOpen:j,onClose:S,disableHoverableContent:g,children:r})})};dT.displayName=Sd;var xw="TooltipTrigger",fT=m.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,o=Of(xw,r),a=nE(xw,r),i=sg(r),s=m.useRef(null),u=vl(t,s,o.onTriggerChange),c=m.useRef(!1),d=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),l.jsx(wU,{asChild:!0,...i,children:l.jsx(vs.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...n,ref:u,onPointerMove:Ka(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ka(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:Ka(e.onPointerDown,()=>{o.open&&o.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ka(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:Ka(e.onBlur,o.onClose),onClick:Ka(e.onClick,o.onClose)})})});fT.displayName=xw;var oE="TooltipPortal",[$U,BU]=ig(oE,{forceMount:void 0}),mT=e=>{const{__scopeTooltip:t,forceMount:r,children:n,container:o}=e,a=Of(oE,t);return l.jsx($U,{scope:t,forceMount:r,children:l.jsx(rE,{present:r||a.open,children:l.jsx(sT,{asChild:!0,container:o,children:n})})})};mT.displayName=oE;var xu="TooltipContent",pT=m.forwardRef((e,t)=>{const r=BU(xu,e.__scopeTooltip),{forceMount:n=r.forceMount,side:o="top",...a}=e,i=Of(xu,e.__scopeTooltip);return l.jsx(rE,{present:n||i.open,children:i.disableHoverableContent?l.jsx(hT,{side:o,...a,ref:t}):l.jsx(zU,{side:o,...a,ref:t})})}),zU=m.forwardRef((e,t)=>{const r=Of(xu,e.__scopeTooltip),n=nE(xu,e.__scopeTooltip),o=m.useRef(null),a=vl(t,o),[i,s]=m.useState(null),{trigger:u,onClose:c}=r,d=o.current,{onPointerInTransitChange:f}=n,h=m.useCallback(()=>{s(null),f(!1)},[f]),p=m.useCallback((g,b)=>{const v=g.currentTarget,x={x:g.clientX,y:g.clientY},k=VU(x,v.getBoundingClientRect()),E=WU(x,k),j=KU(b.getBoundingClientRect()),S=GU([...E,...j]);s(S),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(u&&d){const g=v=>p(v,d),b=v=>p(v,u);return u.addEventListener("pointerleave",g),d.addEventListener("pointerleave",b),()=>{u.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",b)}}},[u,d,p,h]),m.useEffect(()=>{if(i){const g=b=>{const v=b.target,x={x:b.clientX,y:b.clientY},k=u?.contains(v)||d?.contains(v),E=!YU(x,i);k?h():E&&(h(),c())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[u,d,i,c,h]),l.jsx(hT,{...e,ref:a})}),[HU,qU]=ig(Sd,{isInside:!1}),UU=Gq("TooltipContent"),hT=m.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":o,onEscapeKeyDown:a,onPointerDownOutside:i,...s}=e,u=Of(xu,r),c=sg(r),{onClose:d}=u;return m.useEffect(()=>(document.addEventListener(yw,d),()=>document.removeEventListener(yw,d)),[d]),m.useEffect(()=>{if(u.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(u.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[u.trigger,d]),l.jsx(Y8,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:l.jsxs(jU,{"data-state":u.stateAttribute,...c,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(UU,{children:n}),l.jsx(HU,{scope:r,isInside:!0,children:l.jsx(DU,{id:u.contentId,role:"tooltip",children:o||n})})]})})});pT.displayName=xu;var gT="TooltipArrow",bT=m.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,o=sg(r);return qU(gT,r).isInside?null:l.jsx(EU,{...o,...n,ref:t})});bT.displayName=gT;function VU(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(r,n,o,a)){case a:return"left";case o:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function WU(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function KU(e){const{top:t,right:r,bottom:n,left:o}=e;return[{x:o,y:t},{x:r,y:t},{x:r,y:n},{x:o,y:n}]}function YU(e,t){const{x:r,y:n}=e;let o=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){const s=t[a],u=t[i],c=s.x,d=s.y,f=u.x,h=u.y;d>n!=h>n&&r<(f-c)*(n-d)/(h-d)+c&&(o=!o)}return o}function GU(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),XU(t)}function XU(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const o=e[n];for(;t.length>=2;){const a=t[t.length-1],i=t[t.length-2];if((a.x-i.x)*(o.y-i.y)>=(a.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const o=e[n];for(;r.length>=2;){const a=r[r.length-1],i=r[r.length-2];if((a.x-i.x)*(o.y-i.y)>=(a.y-i.y)*(o.x-i.x))r.pop();else break}r.push(o)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var ZU=cT,JU=dT,QU=fT,eV=mT,tV=pT,rV=bT;function Oo(...e){return e.filter(Boolean).join(" ")}const Cf=y.forwardRef(({children:e,className:t,content:r,delayDuration:n,defaultOpen:o,open:a,onClick:i,onOpenChange:s,showArrow:u=!0,side:c,sideOffset:d=10,asChild:f,...h},p)=>l.jsx(ZU,{delayDuration:150,children:l.jsxs(JU,{open:a,defaultOpen:o,onOpenChange:s,delayDuration:n,"tremor-id":"tremor-raw",children:[l.jsx(QU,{onClick:i,asChild:f,children:e}),l.jsx(eV,{children:l.jsxs(tV,{ref:p,side:c,sideOffset:d,align:"center",className:Oo("max-w-60 select-none rounded-md px-2.5 py-1.5 text-sm leading-5 shadow-md","text-gray-50 dark:text-gray-900","bg-gray-900 dark:bg-gray-50","will-change-[transform,opacity]","data-[side=bottom]:animate-slide-down-and-fade data-[side=left]:animate-slide-left-and-fade data-[side=right]:animate-slide-right-and-fade data-[side=top]:animate-slide-up-and-fade data-[state=closed]:animate-hide",t),...h,children:[r,u&&l.jsx(rV,{className:"border-none fill-gray-900 dark:fill-gray-50",width:12,height:7,"aria-hidden":"true"})]})})]})}));Cf.displayName="Tooltip";function nV({operation:e,onClick:t}){var r,n,o;const a=((n=(r=e?.meta)==null?void 0:r.inspectr)==null?void 0:n.guard)||{},i=((o=e?.request)==null?void 0:o.headers)||[],s=({children:c})=>l.jsxs("span",{onClick:t,className:"py-1 px-1.5 inline-flex items-center gap-x-1 text-xs font-medium bg-blue-100 text-blue-800 rounded-md dark:bg-blue-500/10 dark:text-blue-500 cursor-pointer select-none hover:ring-1 ring-blue-300",children:[l.jsxs("svg",{className:"shrink-0 h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),c]});if(a["inspectr-auth-token"])return l.jsx(s,{children:"Guard Token"});if(a["inspectr-auth-key"])return l.jsx(s,{children:"Guard Key"});if(i.find(c=>{const d=c?.name;return d?d.toLowerCase().replace(/[^a-z]/g,"").includes("apikey"):!1}))return l.jsx(s,{children:"API Key"});const u=i.find(c=>c.name&&c.name.toLowerCase()==="authorization");if(u&&u.value){const c=u.value.toLowerCase();return c.startsWith("basic")?l.jsx(s,{children:"Basic Auth"}):c.startsWith("bearer")?l.jsx(s,{children:"Bearer"}):l.jsx(s,{children:"Auth"})}return null}const vT=({mcp:e,showCategory:t=!1,showToolName:r=!1,showMethod:n=!1,onClick:o})=>{if(!e)return null;const{category:a,tool_name:i,method:s}=e;return l.jsxs("span",{onClick:o,role:o?"button":void 0,tabIndex:o?0:void 0,className:`inline-flex items-center gap-2 rounded-full bg-sky-100 px-3 py-1 text-xs font-semibold uppercase tracking-wide text-sky-700 dark:bg-sky-900/40 dark:text-sky-200 ${o?"cursor-pointer hover:ring-2 hover:ring-sky-200 focus:outline-none focus:ring-2 focus:ring-sky-300":""}`,children:[l.jsx("span",{children:"MCP"}),t&&a?l.jsx("span",{className:"rounded bg-white px-1 py-0.5 text-[10px] font-semibold uppercase text-sky-700 shadow-sm dark:bg-sky-900/60 dark:text-sky-100",children:a}):null,r&&i?l.jsx("span",{className:"font-mono text-[11px] normal-case text-sky-800 dark:text-sky-100",children:i}):null,n&&s?l.jsx("span",{className:"text-[11px] normal-case text-sky-600 dark:text-sky-200",children:s}):null]})};function lg({open:e,rule:t,isDeleting:r,error:n,onCancel:o,onConfirm:a,title:i,description:s,confirmLabel:u}){if(!e)return null;const c=i||"Delete rule?",d=s||l.jsxs(l.Fragment,{children:["This will permanently remove ",l.jsx("span",{className:"font-medium",children:t?.name||"this rule"}),". Actions triggered by this rule will no longer run."]}),f=u||"Delete Rule";return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:l.jsxs("div",{className:"w-full max-w-md rounded-lg border border-gray-200 bg-white p-6 shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:c}),l.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:d}),n&&l.jsx("p",{className:"mt-3 text-sm text-red-600 dark:text-red-400",children:n}),l.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[l.jsx("button",{type:"button",onClick:o,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",disabled:r,children:"Cancel"}),l.jsx("button",{type:"button",onClick:a,disabled:r,className:"inline-flex items-center rounded-md border border-transparent bg-red-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-300 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-red-500 dark:hover:bg-red-400",children:r?"Deleting…":f})]})]})})}function cl({tag:e,showRemove:t=!1,onRemove:r,removeLabel:n="Remove tag"}){const o=typeof e=="string"?yu(e):e;if(!o)return null;const a=()=>{t&&r?.(o)},i=t?l.jsx("button",{type:"button",onClick:a,className:"inline-flex size-4 -mr-1.5 p-0.5 items-center justify-center rounded-full text-[11px] font-semibold text-red-700 transition hover:bg-red-50 focus:outline-none dark:text-red-300 dark:hover:bg-red-950","aria-label":`${n} ${o.display}`.trim(),title:`${n} ${o.display}`.trim(),children:l.jsx("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20",children:l.jsx("path",{"fill-rule":"evenodd",d:`M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414
31
+ 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293
32
+ 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z`,"clip-rule":"evenodd"})})}):null;return o.type==="kv"?l.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-slate-100 pl-2.5 pr-2.5 py-1 text-xs text-slate-700 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:[l.jsxs("span",{className:"font-semibold uppercase tracking-wide text-[10px] text-slate-500 dark:text-dark-tremor-content",children:[o.key,":"]}),l.jsx("span",{className:"font-mono text-[11px] text-slate-700 dark:text-dark-tremor-content",children:o.value}),i]}):l.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-slate-100 pl-2.5 pr-2.5 py-1 font-mono text-[11px] font-medium text-slate-700 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:[o.display,i]})}const aE="flex items-center space-x-2 border border-slate-600 dark:border-blue-500 text-slate-700 dark:text-white bg-slate-100 dark:bg-blue-600 rounded focus:outline-none cursor-pointer transition-transform duration-150 ease-in-out active:scale-95 hover:bg-slate-200 dark:hover:bg-blue-700 active:ring active:ring-slate-300 dark:active:ring-blue-400",V5=`${aE} px-2 py-1`,W5=`${aE} px-2 py-1 rounded-r-none border-r-0`,K5=`${aE} px-1 py-1 rounded-l-none`,oV="flex items-center space-x-2 px-2 py-1 border border-purple-500 text-purple-600 dark:text-purple-200 bg-purple-50 dark:bg-purple-900/30 rounded focus:outline-none cursor-pointer transition-transform duration-150 ease-in-out active:scale-95 hover:bg-purple-100 dark:hover:bg-purple-800/50 active:ring active:ring-purple-200 dark:active:ring-purple-400",km=()=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})}),aV=()=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M7.5 10.5L12 15m0 0l4.5-4.5M12 15V3"})}),iV=()=>l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.91 11.672a.375.375 0 0 1 0 .656l-5.603 3.113a.375.375 0 0 1-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112Z"})]}),sV=({className:e=""})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:`h-4 w-4 ${e}`,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"})}),lV=({className:e="",...t})=>l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",...t,children:[l.jsx("path",{d:"M10 6h8"}),l.jsx("path",{d:"M12 16h6"}),l.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),l.jsx("path",{d:"M8 11h7"})]}),lv=()=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"h-4 w-4",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})}),Y5=()=>l.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",className:"w-3 h-3",children:l.jsx("path",{d:"M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z",fill:"currentColor"})}),G5=()=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4 text-slate-600 dark:text-white",children:l.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.293l3.71-4.06a.75.75 0 1 1 1.1 1.02l-4.25 4.65a.75.75 0 0 1-1.1 0l-4.25-4.65a.75.75 0 0 1 .02-1.06Z",clipRule:"evenodd"})});function uV({hasTrace:e=!1,onViewTrace:t,onDownload:r,onCopyCurl:n,onCopyInspectrCurl:o,onCopyOperation:a,copyActionKey:i="curl",onCopyActionChange:s,copiedCurl:u=!1,copiedOperation:c=!1,hasInspectrCurl:d=!1,onReplay:f,replayTarget:h="original",onReplayTargetChange:p,hasProxy:g=!1,replayed:b=!1,onRefresh:v,isRefreshing:x=!1}){const k=i==="curl",E=i==="proxy_curl",j=k||E?u:c,S=E?"Copy Proxy cURL":k?"Copy cURL":"Copy Operation",C=k||E?"Copied cURL":"Copied Operation",O=k||E?l.jsx(lv,{}):l.jsx(Y5,{}),M=E?o:k?n:a,A=typeof v=="function",T=h==="original",_=T?"Replay to original host":"Replay via Inspectr",F=e?"text-xs hidden [@container(min-width:620px)]:inline":"text-xs hidden [@container(min-width:520px)]:inline";return l.jsxs("div",{className:"flex space-x-2",children:[e?l.jsxs("button",{type:"button",onClick:t,className:oV,children:[l.jsx(lV,{className:"h-4 w-4"}),l.jsx("span",{className:F,children:"View trace"})]}):null,l.jsx("button",{onClick:r,className:V5,"aria-label":"Export as JSON",children:l.jsx(aV,{})}),l.jsxs("div",{className:"relative flex",children:[l.jsxs("button",{onClick:M,className:W5,children:[j?l.jsx(km,{}):O,l.jsx("span",{className:F,children:j?C:S})]}),l.jsxs(F5,{children:[l.jsx(gw,{className:K5,"aria-label":"Select copy action",children:l.jsx(G5,{})}),l.jsxs(bw,{className:"absolute right-0 top-full z-20 mt-1 w-48 rounded-lg border border-slate-200 bg-white p-1 text-sm text-slate-700 shadow-lg focus:outline-none dark:border-dark-tremor-border dark:bg-dark-tremor-background dark:text-dark-tremor-content",children:[l.jsx(zl,{children:l.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 data-[focus]:bg-slate-100 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>s?.("curl"),children:[l.jsx(lv,{}),"Copy cURL"]})}),d?l.jsx(zl,{children:l.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 data-[focus]:bg-slate-100 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>s?.("proxy_curl"),children:[l.jsx(lv,{}),"Copy Proxy cURL"]})}):null,l.jsx(zl,{children:l.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 data-[focus]:bg-slate-100 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>s?.("operation"),children:[l.jsx(Y5,{}),"Copy Operation"]})})]})]})]}),l.jsxs("div",{className:"relative flex",children:[l.jsxs("button",{onClick:f,className:W5,"aria-label":_,children:[b?l.jsx(km,{}):l.jsx(iV,{}),l.jsx("span",{className:F,children:b?"Replayed":"Replay"})]}),l.jsxs(F5,{children:[l.jsx(gw,{className:K5,"aria-label":"Select replay target",children:l.jsx(G5,{})}),l.jsxs(bw,{className:"absolute right-0 top-full z-20 mt-1 w-44 rounded-lg border border-slate-200 bg-white p-1 text-sm text-slate-700 shadow-lg focus:outline-none dark:border-dark-tremor-border dark:bg-dark-tremor-background dark:text-dark-tremor-content",children:[l.jsx(zl,{children:l.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-right data-[focus]:bg-slate-100 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>p?.("original"),children:[T?l.jsx(km,{}):null,"Replay to host"]})}),l.jsx(zl,{disabled:!g,children:l.jsxs("button",{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-right data-[focus]:bg-slate-100 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 dark:data-[focus]:bg-dark-tremor-background-subtle",onClick:()=>p?.("proxy"),disabled:!g,children:[T?null:l.jsx(km,{}),"Replay via Inspectr ",g?"":" (unavailable)"]})})]})]})]}),A?l.jsx("button",{onClick:v,className:V5,"aria-label":"Refresh operation",children:l.jsx(sV,{className:x?"animate-spin":""})}):null]})}const cV=({operation:e,setCurrentTab:t,onRefresh:r,isRefreshing:n=!1})=>{var o,a,i,s,u,c,d,f,h,p,g,b,v,x,k,E,j,S;const{client:C,setToast:O,proxyEndpoint:M}=Er(),[A,T]=m.useState(!1),[_,F]=m.useState(!1),[$,I]=m.useState(!1),[R,W]=m.useState(!1),[B,L]=m.useState(!1),[q,U]=m.useState(!1),[H,X]=Ur("copyActionPreference","curl"),[Y,ae]=Ur("replayTargetPreference","original"),te=H==="operation"?"operation":H==="proxy_curl"?"proxy_curl":"curl",me=Y==="proxy"?"proxy":"original",[Q,ue]=m.useState(()=>{var Xe;return((Xe=e?.meta)==null?void 0:Xe.tags)||[]});m.useEffect(()=>{var Xe;ue(((Xe=e?.meta)==null?void 0:Xe.tags)||[])},[e?.id,e?.operation_id,(o=e?.meta)==null?void 0:o.tags]);const[G,de]=m.useState(null),[ie,V]=m.useState(!1),[ee,ne]=m.useState(""),ge=()=>{if(!(e!=null&&e.request))return{headers:0,body:0,total:0};const Xe=e.request.headers_size||0,Bt=e.request.body_size||0;return{headers:Xe,body:Bt,total:Xe+Bt}},Ee=()=>{if(!(e!=null&&e.response))return{headers:0,body:0,total:0};const Xe=e.response.headers_size||0,Bt=e.response.body_size||0;return{headers:Xe,body:Bt,total:Xe+Bt}},Pe=ge(),Ie=Ee(),nt=Sf(Q),Me=nt.length>0,ot=!!(M||(i=(a=e?.meta)==null?void 0:a.proxy)!=null&&i.url),Ge=!!((u=(s=e?.meta)==null?void 0:s.proxy)!=null&&u.url);m.useEffect(()=>{!ot&&Y==="proxy"&&ae("original")},[ot,Y,ae]),m.useEffect(()=>{!Ge&&H==="proxy_curl"&&X("curl")},[H,Ge,X]);const at=Xe=>{if(!(e!=null&&e.request))return;const{request:Bt}=e,{method:Tt,url:Qr,headers:Mr,body:tr}=Bt;let _n=`curl -X ${Tt} '${Xe||Qr}'`;return Mr&&Mr.forEach(Je=>{_n+=` -H '${Je.name}: ${Je.value}'`}),tr&&(_n+=` --data '${tr}'`),_n},mt=()=>{const Xe=at();navigator.clipboard.writeText(Xe).then(()=>{T(!0),setTimeout(()=>T(!1),2500)}).catch(Bt=>{console.error("[Inspectr] Failed to copy cURL command:",Bt),I(!0)})},Ke=()=>{var Xe,Bt,Tt;const Qr=(Bt=(Xe=e?.meta)==null?void 0:Xe.proxy)==null?void 0:Bt.url;if(!Qr||!((Tt=e?.request)!=null&&Tt.url))return null;try{const Mr=new URL(Qr),tr=new URL(e.request.url);return Mr.pathname=tr.pathname||Mr.pathname,Mr.search=tr.search,Mr.toString()}catch(Mr){return console.warn("[Inspectr] Failed to build Inspectr cURL URL:",Mr),Qr}},pt=()=>{const Xe=Ke();if(!Xe)return;const Bt=at(Xe);navigator.clipboard.writeText(Bt).then(()=>{T(!0),setTimeout(()=>T(!1),2500)}).catch(Tt=>{console.error("[Inspectr] Failed to copy Inspectr cURL command:",Tt),I(!0)})},jt=()=>{try{const Xe=e?{...e}:{},Bt=JSON.stringify(Xe,null,2);navigator.clipboard.writeText(Bt).then(()=>{F(!0),setTimeout(()=>F(!1),2500)}).catch(Tt=>{console.error("[Inspectr] Failed to copy operation JSON:",Tt),O?.({type:"error",message:"Failed to copy operation",subMessage:Tt?.message||"Unable to copy the operation details."})})}catch(Xe){console.error("[Inspectr] Failed to copy operation JSON:",Xe),O?.({type:"error",message:"Failed to copy operation",subMessage:Xe?.message||"Unable to copy the operation details."})}},Ze=()=>{navigator.clipboard.writeText(e.request.url).then(()=>{W(!0)}).catch(Xe=>{console.error("[Inspectr] Failed to copy URL:",Xe)})},$e=()=>{C.operations.replay(e,{replayTarget:me}).then(()=>{U(!0),setTimeout(()=>U(!1),2500)}).catch(Xe=>{console.error("[Inspectr] Failed to replay request:",Xe),L(!0)})},ut=()=>{try{const Xe=e?{...e}:{},Bt=JSON.stringify(Xe,null,2),Tt=new Blob([Bt],{type:"application/json"}),Qr=`operation_${e!=null&&e.id?String(e.id):String(Date.now())}.json`,Mr=URL.createObjectURL(Tt),tr=document.createElement("a");tr.href=Mr,tr.download=Qr,document.body.appendChild(tr),tr.click(),tr.remove(),URL.revokeObjectURL(Mr)}catch(Xe){console.error("[Inspectr] Failed to download operation JSON:",Xe)}},$t=Xe=>{de(Xe),ne("")},St=()=>{de(null),ne("")},An=async()=>{var Xe;if(!G)return;const Bt=e?.operation_id??e?.id;if(!(C!=null&&C.operations)||!Bt){ne("Operation or client not available");return}try{V(!0),ne(""),await C.operations.deleteOperationTags(Bt,{tag:G.raw});const Tt=G.token||((Xe=yu(G.raw))==null?void 0:Xe.token);ue(Qr=>Array.isArray(Qr)?Qr.filter(Mr=>{const tr=yu(Mr);return!tr||tr.token!==Tt}):[]),O?.({type:"success",message:`Tag "${G.display}" removed from this operation`}),de(null)}catch(Tt){console.error("Delete operation tag failed",Tt),ne(Tt?.message||"Failed to delete tag"),O?.({type:"error",message:Tt?.message||"Failed to delete tag"})}finally{V(!1)}},Zt=((c=e?.meta)==null?void 0:c.trace)||null,Jr=Zt?.trace_id||null;Zt?.source;const Ye=(d=e?.meta)==null?void 0:d.mcp,jn=Ye&&typeof Ye=="object"&&Object.keys(Ye).some(Xe=>Ye[Xe]!==void 0)?Ye:null,Wr=!!Jr,Qn=()=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})}),Be=()=>{var Xe,Bt;const Tt=((Bt=(Xe=e?.meta)==null?void 0:Xe.inspectr)==null?void 0:Bt.guard)||{},Qr=Tt["inspectr-auth-key"],Mr=Tt["inspectr-auth-token"];if(Qr||Mr){typeof t=="function"&&t("meta"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("inspectr:openMetaGuard",{detail:{name:Mr?"inspectr-auth-token":"inspectr-auth-key"}}))},150);return}typeof t=="function"?(t("request"),setTimeout(()=>{window.dispatchEvent(new CustomEvent("inspectr:openRequestHeaders"))},50)):window.dispatchEvent(new CustomEvent("inspectr:openRequestHeaders"))},Kr=()=>{if(!Jr)return;const Xe=e?.operation_id||e?.id||null,Bt=`#traces/${Jr}${Xe?`/${Xe}`:""}`;window.location.hash===Bt?window.dispatchEvent(new HashChangeEvent("hashchange")):window.location.hash=Bt},ur=()=>{typeof t=="function"&&t("mcp")};return l.jsxs("div",{className:"mb-4 p-4 bg-white dark:bg-dark-tremor-background border border-gray-300 dark:border-dark-tremor-border rounded shadow dark:shadow-dark-tremor-shadow relative [container-type:inline-size] [container-name:requestdetail] ",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h2",{className:"font-bold text-xl text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Request Details"}),l.jsx(nV,{operation:e,onClick:Be}),l.jsx(vT,{mcp:jn,showCategory:!0,onClick:ur})]}),l.jsx(uV,{hasTrace:Wr,onViewTrace:Kr,onDownload:ut,onCopyCurl:mt,onCopyInspectrCurl:pt,onCopyOperation:jt,copyActionKey:te,onCopyActionChange:X,copiedCurl:A,copiedOperation:_,hasInspectrCurl:Ge,onReplay:$e,replayTarget:me,onReplayTargetChange:ae,hasProxy:ot,replayed:q,onRefresh:r,isRefreshing:n})]}),l.jsxs("div",{className:"flex flex-col space-y-1",children:[l.jsxs("div",{className:"flex items-center space-x-2 font-mono text-base",children:[l.jsx("span",{className:`font-bold ${vf((f=e?.request)==null?void 0:f.method)}`,children:(h=e?.request)==null?void 0:h.method}),l.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:(p=e?.request)==null?void 0:p.path}),l.jsx("span",{className:`inline-flex px-3 py-1 text-xs font-semibold rounded-full ${bf((g=e?.response)==null?void 0:g.status)}`,children:(b=e?.response)==null?void 0:b.status}),l.jsx("span",{className:"text-sm dark:text-dark-tremor-content",children:(v=e?.response)==null?void 0:v.status_text})]}),l.jsxs("div",{className:"flex items-center text-gray-600 dark:text-dark-tremor-content",children:[l.jsx("span",{onClick:Ze,className:"cursor-pointer",children:(x=e?.request)==null?void 0:x.url}),l.jsx(Cn,{textToCopy:e.request.url,showLabel:!1})]}),l.jsxs("div",{className:"text-gray-500 dark:text-dark-tremor-content text-xs",children:["Received on"," ",l.jsx("span",{className:"font-semibold",children:zn((k=e?.request)==null?void 0:k.timestamp)})," • Took ",l.jsx("span",{className:"font-semibold",children:ao((E=e?.timing)==null?void 0:E.duration)})," ","to respond •",l.jsxs(sv,{className:"relative inline-block",children:[l.jsxs("span",{className:"flex items-center pl-1",children:["size",l.jsx("span",{className:"font-semibold pl-1",children:Ts(Ie.total)}),l.jsx(sv.Button,{className:"cursor-pointer pl-1",children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",width:"12",height:"12",children:l.jsx("path",{d:"M20 22H4C3.44772 22 3 21.5523 3 21V3C3 2.44772 3.44772 2 4 2H20C20.5523 2 21 2.44772 21 3V21C21 21.5523 20.5523 22 20 22ZM19 20V4H5V20H19ZM8 7H16V9H8V7ZM8 11H16V13H8V11ZM8 15H16V17H8V15Z"})})})]}),l.jsx(sv.Panel,{className:"absolute z-10 mt-2 w-72 -translate-x-1/2 transform px-4 sm:px-0",children:l.jsxs("div",{className:"rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 bg-white dark:bg-dark-tremor-background p-3",children:[l.jsx("div",{className:"text-sm font-semibold mb-2",children:"Request Size"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[l.jsx("div",{children:"Total:"}),l.jsx("div",{className:"font-mono text-right",children:Ts(Pe.total)}),l.jsx("div",{children:"Headers:"}),l.jsx("div",{className:"font-mono text-right",children:Ts(Pe.headers)}),l.jsx("div",{children:"Body:"}),l.jsx("div",{className:"font-mono text-right",children:Ts(Pe.body)})]}),l.jsx("div",{className:"text-sm font-semibold mt-3 mb-2",children:"Response Size"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[l.jsx("div",{children:"Total:"}),l.jsx("div",{className:"font-mono text-right",children:Ts(Ie.total)}),l.jsx("div",{children:"Headers:"}),l.jsx("div",{className:"font-mono text-right",children:Ts(Ie.headers)}),l.jsx("div",{children:"Body:"}),l.jsx("div",{className:"font-mono text-right",children:Ts(Ie.body)})]})]})})]}),((S=(j=e?.meta)==null?void 0:j.proxy)==null?void 0:S.url)&&l.jsxs(l.Fragment,{children:[l.jsx("span",{children:" • Proxy "}),l.jsx("div",{className:"relative inline-block align-middle",children:l.jsx(Cf,{side:"right",content:e.meta.proxy.url,children:l.jsx(Qn,{className:"relative inline-block"})})})]})]})]}),Me&&l.jsxs("div",{className:"mt-4",children:[l.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:"Tags"}),l.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:nt.map(Xe=>l.jsx(cl,{tag:Xe,showRemove:!0,onRemove:()=>$t(Xe)},Xe.token||Xe.display))})]}),l.jsx(lg,{open:!!G,isDeleting:ie,error:ee,onCancel:St,onConfirm:An,title:"Remove tag from this operation?",description:G?l.jsxs(l.Fragment,{children:["This will remove the tag ",l.jsx("span",{className:"font-semibold",children:G.display})," ","from this operation. This action cannot be undone."]}):"",confirmLabel:"Remove Tag"}),$&&l.jsx(Km,{message:"Failed to copy cURL command!",subMessage:"Please try again.",onClose:()=>I(!1),type:"error"}),R&&l.jsx(Km,{message:"URL copied!",subMessage:"The request URL has been copied to your clipboard.",onClose:()=>W(!1)}),B&&l.jsx(Km,{message:"Replay failed!",subMessage:"Failed to replay the request. Please try again.",onClose:()=>L(!1),type:"error"})]})};function dV(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Z5(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?X5(Object(r),!0).forEach(function(n){dV(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fV(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function mV(e,t){if(e==null)return{};var r=fV(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pV(e,t){return hV(e)||gV(e,t)||bV(e,t)||vV()}function hV(e){if(Array.isArray(e))return e}function gV(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,o=!1,a=void 0;try{for(var i=e[Symbol.iterator](),s;!(n=(s=i.next()).done)&&(r.push(s.value),!(t&&r.length===t));n=!0);}catch(u){o=!0,a=u}finally{try{!n&&i.return!=null&&i.return()}finally{if(o)throw a}}return r}}function bV(e,t){if(e){if(typeof e=="string")return J5(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return J5(e,t)}}function J5(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function vV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
33
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yV(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q5(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function eS(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Q5(Object(r),!0).forEach(function(n){yV(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Q5(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xV(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,a){return a(o)},n)}}function ad(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var i=arguments.length,s=new Array(i),u=0;u<i;u++)s[u]=arguments[u];return t.apply(r,[].concat(o,s))}}}function yp(e){return{}.toString.call(e).includes("Object")}function kV(e){return!Object.keys(e).length}function Od(e){return typeof e=="function"}function wV(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function jV(e,t){return yp(t)||Qi("changeType"),Object.keys(t).some(function(r){return!wV(e,r)})&&Qi("changeField"),t}function EV(e){Od(e)||Qi("selectorType")}function NV(e){Od(e)||yp(e)||Qi("handlerType"),yp(e)&&Object.values(e).some(function(t){return!Od(t)})&&Qi("handlersType")}function SV(e){e||Qi("initialIsRequired"),yp(e)||Qi("initialType"),kV(e)&&Qi("initialContent")}function OV(e,t){throw new Error(e[t]||e.default)}var CV={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Qi=ad(OV)(CV),wm={changes:jV,selector:EV,handler:NV,initial:SV};function PV(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};wm.initial(e),wm.handler(t);var r={current:e},n=ad(MV)(r,t),o=ad(TV)(r),a=ad(wm.changes)(e),i=ad(AV)(r);function s(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return wm.selector(c),c(r.current)}function u(c){xV(n,o,a,i)(c)}return[s,u]}function AV(e,t){return Od(t)?t(e.current):t}function TV(e,t){return e.current=eS(eS({},e.current),t),t}function MV(e,t,r){return Od(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var _V={create:PV},IV={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function DV(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return o.length>=e.length?e.apply(this,o):function(){for(var i=arguments.length,s=new Array(i),u=0;u<i;u++)s[u]=arguments[u];return t.apply(r,[].concat(o,s))}}}function LV(e){return{}.toString.call(e).includes("Object")}function RV(e){return e||tS("configIsRequired"),LV(e)||tS("configType"),e.urls?(FV(),{paths:{vs:e.urls.monacoBase}}):e}function FV(){console.warn(yT.deprecation)}function $V(e,t){throw new Error(e[t]||e.default)}var yT={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
34
+ You are using deprecated way of configuration.
35
+
36
+ Instead of using
37
+ monaco.config({ urls: { monacoBase: '...' } })
38
+ use
39
+ monaco.config({ paths: { vs: '...' } })
40
+
41
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
42
+ `},tS=DV($V)(yT),BV={config:RV},zV=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,a){return a(o)},n)}};function xT(e,t){return Object.keys(t).forEach(function(r){t[r]instanceof Object&&e[r]&&Object.assign(t[r],xT(e[r],t[r]))}),Z5(Z5({},e),t)}var HV={type:"cancelation",msg:"operation is manually canceled"};function uv(e){var t=!1,r=new Promise(function(n,o){e.then(function(a){return t?o(HV):n(a)}),e.catch(o)});return r.cancel=function(){return t=!0},r}var qV=_V.create({config:IV,isInitialized:!1,resolve:null,reject:null,monaco:null}),kT=pV(qV,2),Pf=kT[0],ug=kT[1];function UV(e){var t=BV.config(e),r=t.monaco,n=mV(t,["monaco"]);ug(function(o){return{config:xT(o.config,n),monaco:r}})}function VV(){var e=Pf(function(t){var r=t.monaco,n=t.isInitialized,o=t.resolve;return{monaco:r,isInitialized:n,resolve:o}});if(!e.isInitialized){if(ug({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),uv(cv);if(window.monaco&&window.monaco.editor)return wT(window.monaco),e.resolve(window.monaco),uv(cv);zV(WV,YV)(GV)}return uv(cv)}function WV(e){return document.body.appendChild(e)}function KV(e){var t=document.createElement("script");return e&&(t.src=e),t}function YV(e){var t=Pf(function(n){var o=n.config,a=n.reject;return{config:o,reject:a}}),r=KV("".concat(t.config.paths.vs,"/loader.js"));return r.onload=function(){return e()},r.onerror=t.reject,r}function GV(){var e=Pf(function(r){var n=r.config,o=r.resolve,a=r.reject;return{config:n,resolve:o,reject:a}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(r){wT(r),e.resolve(r)},function(r){e.reject(r)})}function wT(e){Pf().monaco||ug({monaco:e})}function XV(){return Pf(function(e){var t=e.monaco;return t})}var cv=new Promise(function(e,t){return ug({resolve:e,reject:t})}),jT={config:UV,init:VV,__getMonacoInstance:XV},ZV={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},dv=ZV,JV={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},QV=JV;function eW({children:e}){return y.createElement("div",{style:QV.container},e)}var tW=eW,rW=tW;function nW({width:e,height:t,isEditorReady:r,loading:n,_ref:o,className:a,wrapperProps:i}){return y.createElement("section",{style:{...dv.wrapper,width:e,height:t},...i},!r&&y.createElement(rW,null,n),y.createElement("div",{ref:o,style:{...dv.fullWidth,...!r&&dv.hide},className:a}))}var oW=nW,ET=m.memo(oW);function aW(e){m.useEffect(e,[])}var NT=aW;function iW(e,t,r=!0){let n=m.useRef(!0);m.useEffect(n.current||!r?()=>{n.current=!1}:e,t)}var go=iW;function fd(){}function Vl(e,t,r,n){return sW(e,n)||lW(e,t,r,n)}function sW(e,t){return e.editor.getModel(ST(e,t))}function lW(e,t,r,n){return e.editor.createModel(t,r,n?ST(e,n):void 0)}function ST(e,t){return e.Uri.parse(t)}function uW({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:o,originalModelPath:a,modifiedModelPath:i,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:u=!1,theme:c="light",loading:d="Loading...",options:f={},height:h="100%",width:p="100%",className:g,wrapperProps:b={},beforeMount:v=fd,onMount:x=fd}){let[k,E]=m.useState(!1),[j,S]=m.useState(!0),C=m.useRef(null),O=m.useRef(null),M=m.useRef(null),A=m.useRef(x),T=m.useRef(v),_=m.useRef(!1);NT(()=>{let R=jT.init();return R.then(W=>(O.current=W)&&S(!1)).catch(W=>W?.type!=="cancelation"&&console.error("Monaco initialization: error:",W)),()=>C.current?I():R.cancel()}),go(()=>{if(C.current&&O.current){let R=C.current.getOriginalEditor(),W=Vl(O.current,e||"",n||r||"text",a||"");W!==R.getModel()&&R.setModel(W)}},[a],k),go(()=>{if(C.current&&O.current){let R=C.current.getModifiedEditor(),W=Vl(O.current,t||"",o||r||"text",i||"");W!==R.getModel()&&R.setModel(W)}},[i],k),go(()=>{let R=C.current.getModifiedEditor();R.getOption(O.current.editor.EditorOption.readOnly)?R.setValue(t||""):t!==R.getValue()&&(R.executeEdits("",[{range:R.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),R.pushUndoStop())},[t],k),go(()=>{var R,W;(W=(R=C.current)==null?void 0:R.getModel())==null||W.original.setValue(e||"")},[e],k),go(()=>{let{original:R,modified:W}=C.current.getModel();O.current.editor.setModelLanguage(R,n||r||"text"),O.current.editor.setModelLanguage(W,o||r||"text")},[r,n,o],k),go(()=>{var R;(R=O.current)==null||R.editor.setTheme(c)},[c],k),go(()=>{var R;(R=C.current)==null||R.updateOptions(f)},[f],k);let F=m.useCallback(()=>{var R;if(!O.current)return;T.current(O.current);let W=Vl(O.current,e||"",n||r||"text",a||""),B=Vl(O.current,t||"",o||r||"text",i||"");(R=C.current)==null||R.setModel({original:W,modified:B})},[r,t,o,e,n,a,i]),$=m.useCallback(()=>{var R;!_.current&&M.current&&(C.current=O.current.editor.createDiffEditor(M.current,{automaticLayout:!0,...f}),F(),(R=O.current)==null||R.editor.setTheme(c),E(!0),_.current=!0)},[f,c,F]);m.useEffect(()=>{k&&A.current(C.current,O.current)},[k]),m.useEffect(()=>{!j&&!k&&$()},[j,k,$]);function I(){var R,W,B,L;let q=(R=C.current)==null?void 0:R.getModel();s||(W=q?.original)==null||W.dispose(),u||(B=q?.modified)==null||B.dispose(),(L=C.current)==null||L.dispose()}return y.createElement(ET,{width:p,height:h,isEditorReady:k,loading:d,_ref:M,className:g,wrapperProps:b})}var cW=uW;m.memo(cW);function dW(e){let t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}var fW=dW,jm=new Map;function mW({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:o,path:a,theme:i="light",line:s,loading:u="Loading...",options:c={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:h=!1,width:p="100%",height:g="100%",className:b,wrapperProps:v={},beforeMount:x=fd,onMount:k=fd,onChange:E,onValidate:j=fd}){let[S,C]=m.useState(!1),[O,M]=m.useState(!0),A=m.useRef(null),T=m.useRef(null),_=m.useRef(null),F=m.useRef(k),$=m.useRef(x),I=m.useRef(),R=m.useRef(n),W=fW(a),B=m.useRef(!1),L=m.useRef(!1);NT(()=>{let H=jT.init();return H.then(X=>(A.current=X)&&M(!1)).catch(X=>X?.type!=="cancelation"&&console.error("Monaco initialization: error:",X)),()=>T.current?U():H.cancel()}),go(()=>{var H,X,Y,ae;let te=Vl(A.current,e||n||"",t||o||"",a||r||"");te!==((H=T.current)==null?void 0:H.getModel())&&(f&&jm.set(W,(X=T.current)==null?void 0:X.saveViewState()),(Y=T.current)==null||Y.setModel(te),f&&((ae=T.current)==null||ae.restoreViewState(jm.get(a))))},[a],S),go(()=>{var H;(H=T.current)==null||H.updateOptions(c)},[c],S),go(()=>{!T.current||n===void 0||(T.current.getOption(A.current.editor.EditorOption.readOnly)?T.current.setValue(n):n!==T.current.getValue()&&(L.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),T.current.pushUndoStop(),L.current=!1))},[n],S),go(()=>{var H,X;let Y=(H=T.current)==null?void 0:H.getModel();Y&&o&&((X=A.current)==null||X.editor.setModelLanguage(Y,o))},[o],S),go(()=>{var H;s!==void 0&&((H=T.current)==null||H.revealLine(s))},[s],S),go(()=>{var H;(H=A.current)==null||H.editor.setTheme(i)},[i],S);let q=m.useCallback(()=>{var H;if(!(!_.current||!A.current)&&!B.current){$.current(A.current);let X=a||r,Y=Vl(A.current,n||e||"",t||o||"",X||"");T.current=(H=A.current)==null?void 0:H.editor.create(_.current,{model:Y,automaticLayout:!0,...c},d),f&&T.current.restoreViewState(jm.get(X)),A.current.editor.setTheme(i),s!==void 0&&T.current.revealLine(s),C(!0),B.current=!0}},[e,t,r,n,o,a,c,d,f,i,s]);m.useEffect(()=>{S&&F.current(T.current,A.current)},[S]),m.useEffect(()=>{!O&&!S&&q()},[O,S,q]),R.current=n,m.useEffect(()=>{var H,X;S&&E&&((H=I.current)==null||H.dispose(),I.current=(X=T.current)==null?void 0:X.onDidChangeModelContent(Y=>{L.current||E(T.current.getValue(),Y)}))},[S,E]),m.useEffect(()=>{if(S){let H=A.current.editor.onDidChangeMarkers(X=>{var Y;let ae=(Y=T.current.getModel())==null?void 0:Y.uri;if(ae&&X.find(te=>te.path===ae.path)){let te=A.current.editor.getModelMarkers({resource:ae});j?.(te)}});return()=>{H?.dispose()}}return()=>{}},[S,j]);function U(){var H,X;(H=I.current)==null||H.dispose(),h?f&&jm.set(a,T.current.saveViewState()):(X=T.current.getModel())==null||X.dispose(),T.current.dispose()}return y.createElement(ET,{width:p,height:g,isEditorReady:S,loading:u,_ref:_,className:b,wrapperProps:v})}var pW=mW,hW=m.memo(pW),si=hW;const gW=({open:e,onClose:t,decoded:r})=>{var n,o,a;if(!e)return null;const i=JSON.stringify(r,null,2),s=u=>u?new Date(u*1e3).toLocaleString():"N/A";return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"flex-shrink-0 bg-blue-100 rounded-full p-2",children:l.jsxs("svg",{className:"w-6 h-6",viewBox:"0 0 48 48",children:[l.jsx("polygon",{fill:"#546e7a",points:"21.906,31.772 24.507,29.048 27.107,31.772 27.107,43 21.906,43"}),l.jsx("polygon",{fill:"#f50057",points:"17.737,29.058 21.442,28.383 21.945,32.115 15.345,41.199 11.138,38.141"}),l.jsx("polygon",{fill:"#d500f9",points:"15.962,24.409 19.355,26.041 17.569,29.356 6.89,32.825 5.283,27.879"}),l.jsx("polygon",{fill:"#29b6f6",points:"17.256,19.607 19.042,22.922 15.649,24.554 4.97,21.084 6.577,16.137"}),l.jsx("polygon",{fill:"#00e5ff",points:"21.126,16.482 20.623,20.214 16.918,19.539 10.318,10.455 14.526,7.398"}),l.jsx("polygon",{fill:"#546e7a",points:"26.094,16.228 23.493,18.952 20.893,16.228 20.893,5 26.094,5"}),l.jsx("polygon",{fill:"#f50057",points:"30.262,18.943 26.558,19.618 26.055,15.886 32.654,6.802 36.862,9.859"}),l.jsx("polygon",{fill:"#d500f9",points:"32.039,23.59 28.645,21.958 30.431,18.643 41.11,15.174 42.717,20.12"}),l.jsx("polygon",{fill:"#29b6f6",points:"30.744,28.393 28.958,25.078 32.351,23.447 43.03,26.916 41.423,31.863"}),l.jsx("polygon",{fill:"#00e5ff",points:"26.874,31.518 27.378,27.786 31.082,28.461 37.682,37.545 33.474,40.602"})]})}),l.jsxs("div",{className:"ml-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Decoded JWT"}),l.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Below is the decoded JWT information."})]})]}),l.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800 focus:outline-none cursor-pointer","aria-label":"Close",children:"×"})]}),l.jsxs("div",{className:"relative mt-4",children:[l.jsx("div",{className:"absolute top-2 right-2 z-10",children:l.jsx(Cn,{textToCopy:i})}),l.jsx("pre",{className:"bg-gray-100 p-2 rounded text-xs text-gray-700 overflow-x-auto",children:i}),r&&l.jsxs("div",{className:"mt-2 text-sm text-gray-600",children:[((n=r?.payload)==null?void 0:n.iat)&&l.jsxs("p",{children:["Issued At (iat): ",s(r.payload.iat)]}),((o=r?.payload)==null?void 0:o.nbf)&&l.jsxs("p",{children:["Not Before (nbf): ",s(r.payload.nbf)]}),((a=r?.payload)==null?void 0:a.exp)&&l.jsxs("p",{children:["Expires At (exp): ",s(r.payload.exp)]})]})]}),l.jsx("div",{className:"mt-6 flex justify-end",children:l.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Close"})})]})]})},li=e=>{e.editor.defineTheme("tremor-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#334155","editor.foreground":"#e1e7ef"}})},ui=()=>{if(typeof window<"u"){const e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,t=document.documentElement.classList.contains("dark");if(e||t)return"tremor-dark"}return"light"},rS=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");for(;t.length%4;)t+="=";return t},bW=e=>{try{const t=e.split(".");if(t.length!==3)return null;const r=JSON.parse(atob(rS(t[0]))),n=JSON.parse(atob(rS(t[1])));return{header:r,payload:n,signature:t[2]}}catch(t){return console.error("Failed to decode JWT:",t),null}},vW=e=>typeof e!="string"?!1:((e.startsWith("Bearer ")||e.startsWith("bearer "))&&(e=e.slice(7).trim()),/^[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+$/.test(e)),fv=({open:e,className:t=""})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-tremor-content transition-transform dark:text-dark-tremor-content ${e?"rotate-180":"rotate-0"} ${t}`,"aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})}),yW=({operation:e})=>{var t,r,n,o;const[a,i]=m.useState(!1),[s,u]=m.useState(!1),[c,d]=m.useState(!0),f=m.useRef(null);m.useEffect(()=>{const M=()=>{u(!0),setTimeout(()=>{var A;(A=f.current)==null||A.scrollIntoView({behavior:"smooth",block:"start"})},0)};return window.addEventListener("inspectr:openRequestHeaders",M),()=>window.removeEventListener("inspectr:openRequestHeaders",M)},[]);const[h,p]=m.useState(!1),[g,b]=m.useState(null),v=M=>M?Array.isArray(M)?M.map(A=>({name:A.name??A.key??"",value:A.value})):typeof M=="object"?"name"in M&&"value"in M?[{name:M.name,value:M.value}]:Object.entries(M).map(([A,T])=>({name:A,value:T})):[]:[],x=M=>{const A=M.startsWith("Bearer ")||M.startsWith("bearer ")?M.slice(7).trim():M,T=bW(A);T&&(b(T),p(!0))},k=(M,A)=>{if(!M)return null;const T=M.toLowerCase(),_=T.replace(/[^a-z]/g,"");if(T==="authorization"){const F=String(A||"").toLowerCase();return F.startsWith("basic")?"Basic":F.startsWith("bearer")?"Bearer":"Auth"}return _.includes("apikey")?"API Key":_.includes("inspectrauthkey")?"Key":_.includes("inspectrauthtoken")?"Token":null},E=({label:M})=>l.jsxs("span",{className:"ml-2 py-0.5 px-1.5 inline-flex items-center gap-x-1 text-[10px] font-medium bg-blue-100 text-blue-800 rounded-md dark:bg-blue-500/10 dark:text-blue-500",children:[l.jsxs("svg",{className:"shrink-0 h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),M]}),j=(M,A=!1)=>M.map(T=>{const _=A?k(T.name,T.value):null;return l.jsxs("tr",{children:[l.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-slate-500 dark:text-dark-tremor-content text-xs",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{children:T.name}),_&&l.jsx(E,{label:_})]})}),l.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-xs dark:text-dark-tremor-content",children:l.jsxs("div",{className:"flex flex-wrap items-center",children:[l.jsx("span",{className:"min-w-0 break-all flex-1",children:T.value}),vW(T.value)&&l.jsx("button",{onClick:()=>x(T.value),className:"ml-2 p-1 text-blue-500 dark:text-blue-400 text-xs border border-slate-600 dark:border-slate-500 rounded cursor-pointer",children:l.jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 48 48",children:[l.jsx("polygon",{fill:"#546e7a",points:"21.906,31.772 24.507,29.048 27.107,31.772 27.107,43 21.906,43"}),l.jsx("polygon",{fill:"#f50057",points:"17.737,29.058 21.442,28.383 21.945,32.115 15.345,41.199 11.138,38.141"}),l.jsx("polygon",{fill:"#d500f9",points:"15.962,24.409 19.355,26.041 17.569,29.356 6.89,32.825 5.283,27.879"}),l.jsx("polygon",{fill:"#29b6f6",points:"17.256,19.607 19.042,22.922 15.649,24.554 4.97,21.084 6.577,16.137"}),l.jsx("polygon",{fill:"#00e5ff",points:"21.126,16.482 20.623,20.214 16.918,19.539 10.318,10.455 14.526,7.398"}),l.jsx("polygon",{fill:"#546e7a",points:"26.094,16.228 23.493,18.952 20.893,16.228 20.893,5 26.094,5"}),l.jsx("polygon",{fill:"#f50057",points:"30.262,18.943 26.558,19.618 26.055,15.886 32.654,6.802 36.862,9.859"}),l.jsx("polygon",{fill:"#d500f9",points:"32.039,23.59 28.645,21.958 30.431,18.643 41.11,15.174 42.717,20.12"}),l.jsx("polygon",{fill:"#29b6f6",points:"30.744,28.393 28.958,25.078 32.351,23.447 43.03,26.916 41.423,31.863"}),l.jsx("polygon",{fill:"#00e5ff",points:"26.874,31.518 27.378,27.786 31.082,28.461 37.682,37.545 33.474,40.602"})]})})]})})]},T.name)}),S=e.request.body,C=!S||typeof S=="object"&&Object.keys(S).length===0||typeof S=="string"&&(S.trim()===""||S.trim()==="{}"),O=M=>{try{const A=JSON.parse(M);return JSON.stringify(A,null,2)}catch{return M}};return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:`mb-4 border border-slate-200 dark:border-dark-tremor-border ${a?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"}`,children:[l.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",onClick:()=>i(!a),type:"button",children:[l.jsxs("span",{children:["Query Parameters (",(((t=e?.request)==null?void 0:t.query_params)??[]).length,")"]}),l.jsx(fv,{open:a})]}),a&&l.jsx("div",{className:"p-0 border-t border-tremor-border dark:border-dark-tremor-border",children:l.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-sm text-left font-semibold text-gray-700 dark:text-white",children:"Key"}),l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-sm text-left font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),l.jsx("tbody",{children:j(((r=e?.request)==null?void 0:r.query_params)??[],!1)})]})})]}),l.jsxs("div",{className:`mb-4 border border-slate-200 dark:border-dark-tremor-border ${s?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"}`,ref:f,children:[l.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",onClick:()=>u(!s),type:"button",children:[l.jsxs("span",{children:["Headers (",v((n=e?.request)==null?void 0:n.headers).length,")"]}),l.jsx(fv,{open:s})]}),s&&l.jsx("div",{className:"p-0",children:l.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-left text-sm font-semibold text-gray-700 dark:text-white",children:"Header"}),l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-left text-sm font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),l.jsx("tbody",{children:j(v((o=e?.request)==null?void 0:o.headers),!0)})]})})]}),l.jsxs("div",{className:`${c?"flex flex-col flex-1":""} mb-4 border border-slate-200 dark:border-dark-tremor-border ${c?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"} bg-white dark:bg-dark-tremor-background-subtle overflow-hidden`,children:[l.jsxs("button",{type:"button",onClick:()=>d(!c),className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",children:[l.jsx("span",{children:"Request Body"}),l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx(Cn,{textToCopy:O(S),showLabel:!0}),l.jsx(fv,{open:c})]})]}),c?l.jsx("div",{className:"border-t border-tremor-border dark:border-dark-tremor-border flex flex-col flex-1",children:C?l.jsx("div",{className:"p-4 flex-1 bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:"No payload"}):l.jsx(si,{height:"100%",className:"flex-1",defaultLanguage:"json",value:O(S),theme:ui(),beforeMount:li,options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})}):null]}),l.jsx(gW,{open:h,decoded:g,onClose:()=>{p(!1),b(null)}})]})};var Xm={exports:{}},mv={exports:{}},nS;function xW(){return nS||(nS=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ParsingError=void 0;class r extends Error{constructor(j,S){super(j),this.cause=S}}t.ParsingError=r;let n;function o(){return u(!1)||h()||f()||d()||s()}function a(){return b(/\s*/),u(!0)||f()||c()||s()}function i(){const E=s(),j=[];let S,C=a();for(;C;){if(C.node.type==="Element"){if(S)throw new Error("Found multiple root nodes");S=C.node}C.excluded||j.push(C.node),C=a()}if(!S)throw new r("Failed to parse XML","Root Element not found");if(n.xml.length!==0)throw new r("Failed to parse XML","Not Well-Formed XML");return{declaration:E?E.node:null,root:S,children:j}}function s(){const E=b(/^<\?([\w-:.]+)\s*/);if(!E)return;const j={name:E[1],type:"ProcessingInstruction",content:""},S=n.xml.indexOf("?>");if(S>-1)j.content=n.xml.substring(0,S).trim(),n.xml=n.xml.slice(S);else throw new r("Failed to parse XML","ProcessingInstruction closing tag not found");return b(/\?>/),{excluded:n.options.filter(j)===!1,node:j}}function u(E){const j=b(/^<([^?!</>\s]+)\s*/);if(!j)return;const S={type:"Element",name:j[1],attributes:{},children:[]},C=E?!1:n.options.filter(S)===!1;for(;!(v()||x(">")||x("?>")||x("/>"));){const M=p();if(M)S.attributes[M.name]=M.value;else return}if(b(/^\s*\/>/))return S.children=null,{excluded:C,node:S};b(/\??>/);let O=o();for(;O;)O.excluded||S.children.push(O.node),O=o();if(n.options.strictMode){const M=`</${S.name}>`;if(n.xml.startsWith(M))n.xml=n.xml.slice(M.length);else throw new r("Failed to parse XML",`Closing tag not matching "${M}"`)}else b(/^<\/[\w-:.\u00C0-\u00FF]+\s*>/);return{excluded:C,node:S}}function c(){const E=b(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/)||b(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/)||b(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/)||b(/^<!DOCTYPE\s+\S+\s*>/);if(E){const j={type:"DocumentType",content:E[0]};return{excluded:n.options.filter(j)===!1,node:j}}}function d(){if(n.xml.startsWith("<![CDATA[")){const E=n.xml.indexOf("]]>");if(E>-1){const j=E+3,S={type:"CDATA",content:n.xml.substring(0,j)};return n.xml=n.xml.slice(j),{excluded:n.options.filter(S)===!1,node:S}}}}function f(){const E=b(/^<!--[\s\S]*?-->/);if(E){const j={type:"Comment",content:E[0]};return{excluded:n.options.filter(j)===!1,node:j}}}function h(){const E=b(/^([^<]+)/);if(E){const j={type:"Text",content:E[1]};return{excluded:n.options.filter(j)===!1,node:j}}}function p(){const E=b(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);if(E)return{name:E[1].trim(),value:g(E[2].trim())}}function g(E){return E.replace(/^['"]|['"]$/g,"")}function b(E){const j=n.xml.match(E);if(j)return n.xml=n.xml.slice(j[0].length),j}function v(){return n.xml.length===0}function x(E){return n.xml.indexOf(E)===0}function k(E,j={}){E=E.trim();const S=j.filter||(()=>!0);return n={xml:E,options:Object.assign(Object.assign({},j),{filter:S,strictMode:j.strictMode===!0})},i()}e.exports=k,t.default=k}(mv,mv.exports)),mv.exports}var oS=Xm.exports,aS;function kW(){return aS||(aS=1,function(e,t){var r=oS&&oS.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(t,"__esModule",{value:!0});const n=r(xW());function o(g){if(!g.options.indentation&&!g.options.lineSeparator)return;g.content+=g.options.lineSeparator;let b;for(b=0;b<g.level;b++)g.content+=g.options.indentation}function a(g){g.content=g.content.replace(/ +$/,"");let b;for(b=0;b<g.level;b++)g.content+=g.options.indentation}function i(g,b){g.content+=b}function s(g,b,v){if(g.type==="Element")d(g,b,v);else if(g.type==="ProcessingInstruction")h(g,b);else if(typeof g.content=="string")u(g.content,b,v);else throw new Error("Unknown node type: "+g.type)}function u(g,b,v){if(!v){const x=g.trim();(b.options.lineSeparator||x.length===0)&&(g=x)}g.length>0&&(!v&&b.content.length>0&&o(b),i(b,g))}function c(g,b){const v="/"+g.join("/"),x=g[g.length-1];return b.includes(x)||b.includes(v)}function d(g,b,v){if(b.path.push(g.name),!v&&b.content.length>0&&o(b),i(b,"<"+g.name),f(b,g.attributes),g.children===null||b.options.forceSelfClosingEmptyTag&&g.children.length===0){const x=b.options.whiteSpaceAtEndOfSelfclosingTag?" />":"/>";i(b,x)}else if(g.children.length===0)i(b,"></"+g.name+">");else{const x=g.children;i(b,">"),b.level++;let k=g.attributes["xml:space"]==="preserve"||v,E=!1;if(!k&&b.options.ignoredPaths&&(E=c(b.path,b.options.ignoredPaths),k=E),!k&&b.options.collapseContent){let j=!1,S=!1,C=!1;x.forEach(function(O,M){O.type==="Text"?(O.content.includes(`
43
+ `)?(S=!0,O.content=O.content.trim()):(M===0||M===x.length-1)&&!v&&O.content.trim().length===0&&(O.content=""),(O.content.trim().length>0||x.length===1)&&(j=!0)):O.type==="CDATA"?j=!0:C=!0}),j&&(!C||!S)&&(k=!0)}x.forEach(function(j){s(j,b,v||k)}),b.level--,!v&&!k&&o(b),E&&a(b),i(b,"</"+g.name+">")}b.path.pop()}function f(g,b){Object.keys(b).forEach(function(v){const x=b[v].replace(/"/g,"&quot;");i(g," "+v+'="'+x+'"')})}function h(g,b){b.content.length>0&&o(b),i(b,"<?"+g.name),i(b," "+g.content.trim()),i(b,"?>")}function p(g,b={}){b.indentation="indentation"in b?b.indentation:" ",b.collapseContent=b.collapseContent===!0,b.lineSeparator="lineSeparator"in b?b.lineSeparator:`\r
44
+ `,b.whiteSpaceAtEndOfSelfclosingTag=b.whiteSpaceAtEndOfSelfclosingTag===!0,b.throwOnFailure=b.throwOnFailure!==!1;try{const v=(0,n.default)(g,{filter:b.filter,strictMode:b.strictMode}),x={content:"",level:0,options:b,path:[]};return v.declaration&&h(v.declaration,x),v.children.forEach(function(k){s(k,x,!1)}),b.lineSeparator?x.content.replace(/\r\n/g,`
45
+ `).replace(/\n/g,b.lineSeparator):x.content}catch(v){if(b.throwOnFailure)throw v;return g}}p.minify=(g,b={})=>p(g,Object.assign(Object.assign({},b),{indentation:"",lineSeparator:""})),e.exports=p,t.default=p}(Xm,Xm.exports)),Xm.exports}var wW=kW();const jW=mr(wW);function OT(e){try{return jW(e,{indentation:" ",collapseContent:!0,lineSeparator:`
46
+ `})}catch{return e}}function EW(e){if(!e)return[];const t=[];let r=null;const n=String(e).split(/\r?\n/);for(const o of n){if(o===""){r&&(t.push({...r,timestamp:r.timestamp??Date.now()}),r=null);continue}if(o.startsWith(":")){const u=o.slice(1).trimStart();t.push({event:"comment",data:u,timestamp:Date.now()});continue}const a=o.indexOf(":");if(a===-1)continue;r||(r={});const i=o.slice(0,a).trim(),s=o.slice(a+1).trimStart();if(i==="data")r.data=r.data?r.data+`
47
+ `+s:s;else if(i==="timestamp"||i==="time"){const u=Number(s);r.timestamp=Number.isNaN(u)?s:u}else r[i]=s}return r&&t.push({...r,timestamp:r.timestamp??Date.now()}),t}const iS=({frames:e,raw:t})=>{const r=y.useMemo(()=>e&&e.length?e:EW(t),[e,t]),[n,o]=y.useState({}),[a,i]=y.useState(null),[s,u]=y.useState("asc"),c=v=>{const x=v.timestamp??v.time;if(x==null)return 0;if(typeof x=="number")return x;const k=Number(x);if(!Number.isNaN(k))return k;const E=new Date(x).getTime();return Number.isNaN(E)?0:E},d=(v,x)=>String(v||"").localeCompare(String(x||"")),f=y.useMemo(()=>{if(!a)return r;const v=s==="asc"?1:-1;return[...r].sort((x,k)=>{let E=0;return a==="id"?E=d(x.id,k.id):a==="type"?E=d(x.event,k.event):a==="data"?E=d(x.data,k.data):a==="time"&&(E=c(x)-c(k)),E*v})},[r,a,s]),h=v=>{a!==v?(i(v),u("asc")):s==="asc"?u("desc"):s==="desc"?(i(null),u("asc")):(i(v),u("asc"))};if(!r||!r.length)return l.jsx("div",{className:"p-4",children:"No event frames"});const p=v=>{try{return JSON.parse(v)}catch{return null}},g=v=>{const x=v.timestamp??v.time;if(!x)return"";const k=new Date(x);if(Number.isNaN(k.getTime()))return typeof x=="string"?x:"";const E=(j,S=2)=>String(j).padStart(S,"0");return`${E(k.getHours())}:${E(k.getMinutes())}:${E(k.getSeconds())}.${E(k.getMilliseconds(),3)}`},b=v=>{if(!v)return"";if(v==="comment")return"bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-gray-200";const x=["bg-blue-200 text-blue-800 dark:bg-blue-700 dark:text-blue-200","bg-green-200 text-green-800 dark:bg-green-700 dark:text-green-200","bg-red-200 text-red-800 dark:bg-red-700 dark:text-red-200","bg-yellow-200 text-yellow-800 dark:bg-yellow-700 dark:text-yellow-200","bg-purple-200 text-purple-800 dark:bg-purple-700 dark:text-purple-200","bg-pink-200 text-pink-800 dark:bg-pink-700 dark:text-pink-200"],k=[...v].reduce((E,j)=>E+j.charCodeAt(0),0);return x[k%x.length]};return l.jsx("div",{className:"overflow-auto h-full",children:l.jsxs("table",{className:"w-full border-collapse border border-slate-200 dark:border-dark-tremor-border",children:[l.jsxs("colgroup",{children:[l.jsx("col",{className:"w-1/6"})," ",l.jsx("col",{className:"w-1/6"})," ",l.jsx("col",{})," ",l.jsx("col",{className:"w-[12ch]"})," "]}),l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-100 dark:bg-dark-tremor-background-subtle",children:[l.jsx("th",{className:"sticky top-0 z-10 border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white bg-gray-100 dark:bg-dark-tremor-background-subtle cursor-pointer select-none",onClick:()=>h("id"),"aria-sort":a==="id"?s==="asc"?"ascending":"descending":"none",children:l.jsxs("span",{className:"inline-flex items-center gap-1",children:["ID ",a==="id"?s==="asc"?"▲":"▼":""]})}),l.jsx("th",{className:"sticky top-0 z-10 border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white bg-gray-100 dark:bg-dark-tremor-background-subtle cursor-pointer select-none",onClick:()=>h("type"),"aria-sort":a==="type"?s==="asc"?"ascending":"descending":"none",children:l.jsxs("span",{className:"inline-flex items-center gap-1",children:["Type ",a==="type"?s==="asc"?"▲":"▼":""]})}),l.jsx("th",{className:"sticky top-0 z-10 border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white bg-gray-100 dark:bg-dark-tremor-background-subtle cursor-pointer select-none",onClick:()=>h("data"),"aria-sort":a==="data"?s==="asc"?"ascending":"descending":"none",children:l.jsxs("span",{className:"inline-flex items-center gap-1",children:["Data ",a==="data"?s==="asc"?"▲":"▼":""]})}),l.jsx("th",{className:"sticky top-0 z-10 border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white bg-gray-100 dark:bg-dark-tremor-background-subtle whitespace-nowrap cursor-pointer select-none",onClick:()=>h("time"),"aria-sort":a==="time"?s==="asc"?"ascending":"descending":"none",children:l.jsxs("span",{className:"inline-flex items-center gap-1",children:["Time ",a==="time"?s==="asc"?"▲":"▼":""]})})]})}),l.jsx("tbody",{children:f.map((v,x)=>{const k=v.id??x,E=p(v.data),j=!!n[k];return l.jsxs(y.Fragment,{children:[l.jsxs("tr",{className:"align-top",children:[l.jsx("td",{className:"border px-2 py-1 font-mono text-xs text-slate-500 dark:text-dark-tremor-content",children:v.id||""}),l.jsx("td",{className:"border px-2 py-1",children:v.event?l.jsx("span",{className:`inline-flex items-center rounded px-2.5 py-0.5 font-mono text-xs font-medium ${b(v.event)}`,children:v.event}):""}),l.jsx("td",{className:"border px-2 py-1 font-mono text-xs whitespace-pre-wrap break-all dark:text-dark-tremor-content",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("div",{className:"flex-1 break-all whitespace-pre-wrap",children:v.data}),E&&l.jsx("button",{className:"self-start px-2 py-1 text-xs rounded bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200",title:j?"Hide formatted JSON":"Show formatted JSON","aria-expanded":j,onClick:()=>o(S=>({...S,[k]:!S[k]})),children:j?"Hide":"Preview"})]})}),l.jsx("td",{className:"border px-2 py-1 font-mono text-xs text-slate-500 dark:text-dark-tremor-content whitespace-nowrap w-[12ch]",children:g(v)})]}),E&&j&&l.jsx("tr",{children:l.jsx("td",{className:"border px-2 py-2 bg-slate-50 dark:bg-dark-tremor-background-subtle",colSpan:4,children:l.jsx(si,{height:"260px",language:"json",value:JSON.stringify(E,null,2),theme:ui(),beforeMount:li,options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})})})]},k)})})]})})},sS=e=>{if(typeof e!="string"||e.trim()==="")return"";const t=e.trim();try{if(typeof globalThis<"u"&&typeof globalThis.atob=="function")return globalThis.atob(t)}catch{}try{if(typeof Buffer<"u")return Buffer.from(t,"base64").toString("binary")}catch{}return""},NW=e=>{const t=e.length,r=new Uint8Array(t);for(let n=0;n<t;n+=1)r[n]=e.charCodeAt(n)&255;return r},lS=({open:e,className:t=""})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-tremor-content transition-transform dark:text-dark-tremor-content ${e?"rotate-180":"rotate-0"} ${t}`,"aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})}),SW=({operation:e})=>{var t,r,n,o,a,i,s;const[u,c]=m.useState(!1),[d,f]=m.useState("source"),[h,p]=m.useState(!0),g=e?.id,b=V=>V?Array.isArray(V)?V.map(ee=>({name:ee.name??ee.key??"",value:ee.value})):typeof V=="object"?"name"in V&&"value"in V?[{name:V.name,value:V.value}]:Object.entries(V).map(([ee,ne])=>({name:ee,value:ne})):[]:[],v=V=>V.map(ee=>l.jsxs("tr",{children:[l.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-slate-500 dark:text-dark-tremor-content text-xs",children:ee.name}),l.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-xs dark:text-dark-tremor-content",children:l.jsx("div",{className:"flex flex-wrap items-center",children:l.jsx("span",{className:"min-w-0 break-all flex-1",children:ee.value})})})]},ee.name)),x=typeof((t=e?.response)==null?void 0:t.body)=="string"?e.response.body:void 0,k=(r=e?.response)==null?void 0:r.body_encoding,E=(typeof k=="string"?k.toLowerCase():"utf8")==="base64",j=E&&typeof x=="string"?sS(x):x,S=typeof j=="string"&&j!==""?j:x,C=x,O=!S||typeof S=="object"&&Object.keys(S).length===0||typeof S=="string"&&(S.trim()===""||S.trim()==="{}"),M=(V,ee)=>{if(typeof V!="string")return V;if(ee&&ee.includes("json"))try{const ne=JSON.parse(V);return JSON.stringify(ne,null,2)}catch{return V}return ee&&ee.includes("xml")?OT(V):V},A=(()=>{var V,ee;const ne=(ee=b((V=e?.response)==null?void 0:V.headers).find(ge=>{var Ee,Pe;return((Ee=ge.name)==null?void 0:Ee.toLowerCase())==="content-type"||((Pe=ge.key)==null?void 0:Pe.toLowerCase())==="content-type"}))==null?void 0:ee.value;return typeof ne=="string"?ne.split(";")[0].trim():void 0})(),T=A||"application/octet-stream",_=typeof A=="string"&&A.includes("text/html");typeof A=="string"&&A.includes("xml");const F=typeof A=="string"&&A.startsWith("image/"),$=typeof A=="string"&&A.includes("text/event-stream"),I=((n=e?.response)==null?void 0:n.event_frames)||[],R=Array.isArray(I)&&I.length>0||$,W=(V=>{if(!V)return"json";const ee=V.toLowerCase();return ee.includes("json")?"json":ee.includes("html")?"html":ee.includes("xml")?"xml":ee.includes("javascript")?"javascript":ee.includes("css")?"css":ee.includes("yaml")||ee.includes("yml")?"yaml":ee.includes("sql")?"sql":(ee.startsWith("text/"),"plaintext")})(A),B=_||F||R,L=B&&(F||E);m.useEffect(()=>{g&&f(L?"preview":"source")},[g,L]);const q=typeof C=="string"?C:"",U=q.trim(),H=F&&U?U.startsWith("data:")?q:E?`data:${T};base64,${q}`:`data:${T};charset=utf-8,${encodeURIComponent(q)}`:"",X=()=>{var V,ee;const ne=(ee=b((V=e?.response)==null?void 0:V.headers).find(ge=>{var Ee,Pe;return((Ee=ge.name)==null?void 0:Ee.toLowerCase())==="content-disposition"||((Pe=ge.key)==null?void 0:Pe.toLowerCase())==="content-disposition"}))==null?void 0:ee.value;if(typeof ne=="string"){const ge=ne.match(/filename\*=UTF-8''([^;]+)/i);if(ge&&ge[1])try{return decodeURIComponent(ge[1])}catch{return ge[1]}const Ee=ne.match(/filename=\"?([^\";]+)\"?/i);if(Ee&&Ee[1])return Ee[1]}return`operation-response-${e!=null&&e.id?String(e.id):Date.now().toString()}`},Y=()=>{if(typeof x!="string"||x==="")return null;if(E){const V=sS(x);if(!V)return null;const ee=NW(V);return new Blob([ee],{type:T})}return new Blob([x],{type:`${T};charset=utf-8`})},ae=()=>{if(typeof document>"u")return;const V=Y();if(!V)return;const ee=URL.createObjectURL(V),ne=X(),ge=document.createElement("a");ge.href=ee,ge.download=ne,document.body.appendChild(ge),ge.click(),ge.remove(),URL.revokeObjectURL(ee)},te=(a=b((o=e?.response)==null?void 0:o.headers).find(V=>String(V.name??V.key??"").toLowerCase()==="content-disposition"))==null?void 0:a.value,me=typeof te=="string"?te:"",Q=/attachment/i.test(me)||/filename\*=|filename=/i.test(me),ue=typeof x=="string"&&x.trim().length>0,G=typeof A=="string"?A.toLowerCase():"",de=G.startsWith("text/")||G.includes("json")||G.includes("xml")||G.includes("html")||G.includes("javascript")||G.includes("css")||G.includes("yaml")||G.includes("yml")||G.includes("sql"),ie=ue&&(E||F||T==="application/octet-stream"||Q||G!==""&&!de);return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:`mb-4 border border-slate-200 dark:border-dark-tremor-border ${u?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"}`,children:[l.jsxs("button",{type:"button",className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",onClick:()=>c(!u),children:[l.jsxs("span",{children:["Headers (",b((i=e?.response)==null?void 0:i.headers).length,")"]}),l.jsx(lS,{open:u})]}),u&&l.jsx("div",{className:"p-0 border-t border-tremor-border dark:border-dark-tremor-border",children:l.jsxs("table",{className:"w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-left text-sm font-semibold text-gray-700 dark:text-white",children:"Header"}),l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-left text-sm font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),l.jsx("tbody",{children:v(b((s=e?.response)==null?void 0:s.headers))})]})})]}),l.jsxs("div",{className:`${h?"flex flex-col flex-1":""} border border-slate-200 dark:border-dark-tremor-border ${h?"rounded-tremor-small rounded-b-none":"rounded-tremor-small"} bg-white dark:bg-dark-tremor-background-subtle overflow-hidden`,children:[l.jsxs("button",{type:"button",onClick:()=>p(!h),className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong cursor-pointer flex items-center justify-between",children:[l.jsx("span",{children:"Response Body"}),l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"flex items-center",onClick:V=>V.stopPropagation(),children:l.jsxs("div",{className:"flex items-center space-x-2 mr-2",children:[B&&l.jsxs("div",{className:"flex space-x-1",children:[l.jsx("button",{type:"button",onClick:()=>f("source"),className:`px-2 py-1 text-xs rounded ${d==="source"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200"}`,children:"Source"}),R?l.jsx("button",{type:"button",onClick:()=>f("events"),className:`px-2 py-1 text-xs rounded ${d==="events"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200"}`,children:"Events"}):l.jsx("button",{type:"button",onClick:()=>f("preview"),className:`px-2 py-1 text-xs rounded ${d==="preview"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200"}`,children:"Preview"})]}),ie&&l.jsx("button",{type:"button",onClick:ae,className:"px-2 py-1 text-xs rounded bg-gray-300 dark:bg-gray-700 text-gray-800 dark:text-gray-200 hover:bg-gray-400 dark:hover:bg-gray-600",children:"Download"}),l.jsx(Cn,{textToCopy:(_||F||$?S??"":M(S,A))??""})]})}),l.jsx(lS,{open:h})]})]}),h?l.jsx(l.Fragment,{children:R&&d==="events"?l.jsx(iS,{frames:I,raw:S??""}):$?d==="events"?l.jsx(iS,{frames:I,raw:S??""}):O?l.jsx("div",{className:"p-4 flex-1 bg-white dark:bg-dark-tremor-background-subtle rounded-b shadow dark:shadow-dark-tremor-shadow dark:text-dark-tremor-content",children:"No payload"}):l.jsx(si,{height:"100%",className:"flex-1",language:"plaintext",value:S??"",theme:ui(),beforeMount:li,options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}}):O?l.jsx("div",{className:"p-4 flex-1 bg-white dark:bg-dark-tremor-background-subtle rounded-b shadow dark:shadow-dark-tremor-shadow dark:text-dark-tremor-content",children:"No payload"}):d==="preview"&&_?l.jsx("iframe",{title:"HTML Preview",srcDoc:S??"",className:"flex-1 w-full h-full border-none"}):d==="preview"&&F?H?l.jsx("div",{className:"flex-1 w-full h-full overflow-auto bg-white dark:bg-dark-tremor-background-subtle",children:l.jsx("img",{alt:"Response Preview",src:H,className:"max-w-none"})}):l.jsx("div",{className:"p-4 flex-1 bg-white dark:bg-dark-tremor-background-subtle rounded-b shadow dark:shadow-dark-tremor-shadow dark:text-dark-tremor-content",children:"Unable to render image preview"}):l.jsx(si,{height:"100%",className:"flex-1",language:W,value:M(S,A)??"",theme:ui(),beforeMount:li,options:{readOnly:!0,minimap:{enabled:!1},automaticLayout:!0,fontFamily:'"Cascadia Code", "Jetbrains Mono", "Fira Code", "Menlo", "Consolas", monospace',tabSize:2,scrollBeyondLastLine:!1}})}):null]})]})},uS=e=>e?Array.isArray(e)?e:Object.entries(e).map(([t,r])=>({name:t,value:r})):[],OW=({operation:e})=>{var t,r,n,o;const a=uS((r=(t=e?.meta)==null?void 0:t.inspectr)==null?void 0:r.guard),i=uS((o=(n=e?.meta)==null?void 0:n.inspectr)==null?void 0:o.directives),[s,u]=m.useState(null),c=m.useRef(null);m.useEffect(()=>{const f=h=>{var p,g;const b=(p=h?.detail)==null?void 0:p.name;u(b||null),(g=c.current)==null||g.scrollIntoView({behavior:"smooth",block:"start"}),b&&setTimeout(()=>u(null),1600)};return window.addEventListener("inspectr:openMetaGuard",f),()=>window.removeEventListener("inspectr:openMetaGuard",f)},[]);const d=({label:f})=>l.jsxs("span",{className:"ml-2 py-0.5 px-1.5 inline-flex items-center gap-x-1 text-[10px] font-medium bg-blue-100 text-blue-800 rounded-md dark:bg-blue-500/10 dark:text-blue-500",children:[l.jsxs("svg",{className:"shrink-0 h-3 w-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),l.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),f]});return a.length===0&&i.length===0?l.jsx("div",{className:"text-gray-500 dark:text-dark-tremor-content text-sm",children:"No Inspectr metadata"}):l.jsxs("div",{className:"space-y-4",children:[a.length>0&&l.jsxs("div",{ref:c,children:[l.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong",children:["Guard (",(a??[]).length,")"]}),l.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-left font-semibold text-gray-700 dark:text-white",children:"API Key"}),l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),l.jsx("tbody",{children:a.map(f=>{const h=f.name==="inspectr-auth-token",p=f.name==="inspectr-auth-key",g=s&&s===f.name;return l.jsxs("tr",{className:g?"bg-blue-50 dark:bg-blue-950/30":"",children:[l.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-slate-500 dark:text-dark-tremor-content text-xs",children:l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{children:f.name}),h&&l.jsx(d,{label:"Guard Token"}),p&&l.jsx(d,{label:"Guard Key"})]})}),l.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-xs break-all dark:text-dark-tremor-content",children:f.value})]},f.name)})})]})]}),i.length>0&&l.jsxs("div",{children:[l.jsxs("button",{className:"w-full p-2 text-left font-bold bg-gray-200 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong",children:["Directives (",(i??[]).length,")"]}),l.jsxs("table",{className:"table-fixed w-full border-collapse border border-gray-300 dark:border-dark-tremor-border",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"bg-gray-100 dark:bg-blue-900/30",children:[l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 w-1/4 text-left font-semibold text-gray-700 dark:text-white",children:"Directive"}),l.jsx("th",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 text-left font-semibold text-gray-700 dark:text-white",children:"Value"})]})}),l.jsx("tbody",{children:i.map(f=>l.jsxs("tr",{children:[l.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-slate-500 dark:text-dark-tremor-content text-xs",children:f.name}),l.jsx("td",{className:"border border-slate-200 dark:border-dark-tremor-border px-2 py-1 font-mono text-xs break-all dark:text-dark-tremor-content",children:f.value})]},f.name))})]})]})]})};function Re(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}var pv,cS;function co(){if(cS)return pv;cS=1;var e=Array.isArray;return pv=e,pv}var hv,dS;function CT(){if(dS)return hv;dS=1;var e=typeof rd=="object"&&rd&&rd.Object===Object&&rd;return hv=e,hv}var gv,fS;function Da(){if(fS)return gv;fS=1;var e=CT(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return gv=r,gv}var bv,mS;function Af(){if(mS)return bv;mS=1;var e=Da(),t=e.Symbol;return bv=t,bv}var vv,pS;function CW(){if(pS)return vv;pS=1;var e=Af(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;function a(i){var s=r.call(i,o),u=i[o];try{i[o]=void 0;var c=!0}catch{}var d=n.call(i);return c&&(s?i[o]=u:delete i[o]),d}return vv=a,vv}var yv,hS;function PW(){if(hS)return yv;hS=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return yv=r,yv}var xv,gS;function bi(){if(gS)return xv;gS=1;var e=Af(),t=CW(),r=PW(),n="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function i(s){return s==null?s===void 0?o:n:a&&a in Object(s)?t(s):r(s)}return xv=i,xv}var kv,bS;function vi(){if(bS)return kv;bS=1;function e(t){return t!=null&&typeof t=="object"}return kv=e,kv}var wv,vS;function oc(){if(vS)return wv;vS=1;var e=bi(),t=vi(),r="[object Symbol]";function n(o){return typeof o=="symbol"||t(o)&&e(o)==r}return wv=n,wv}var jv,yS;function iE(){if(yS)return jv;yS=1;var e=co(),t=oc(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function o(a,i){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||i!=null&&a in Object(i)}return jv=o,jv}var Ev,xS;function ys(){if(xS)return Ev;xS=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Ev=e,Ev}var Nv,kS;function sE(){if(kS)return Nv;kS=1;var e=bi(),t=ys(),r="[object AsyncFunction]",n="[object Function]",o="[object GeneratorFunction]",a="[object Proxy]";function i(s){if(!t(s))return!1;var u=e(s);return u==n||u==o||u==r||u==a}return Nv=i,Nv}var Sv,wS;function AW(){if(wS)return Sv;wS=1;var e=Da(),t=e["__core-js_shared__"];return Sv=t,Sv}var Ov,jS;function TW(){if(jS)return Ov;jS=1;var e=AW(),t=function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function r(n){return!!t&&t in n}return Ov=r,Ov}var Cv,ES;function PT(){if(ES)return Cv;ES=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return Cv=r,Cv}var Pv,NS;function MW(){if(NS)return Pv;NS=1;var e=sE(),t=TW(),r=ys(),n=PT(),o=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,i=Function.prototype,s=Object.prototype,u=i.toString,c=s.hasOwnProperty,d=RegExp("^"+u.call(c).replace(o,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(h){if(!r(h)||t(h))return!1;var p=e(h)?d:a;return p.test(n(h))}return Pv=f,Pv}var Av,SS;function _W(){if(SS)return Av;SS=1;function e(t,r){return t?.[r]}return Av=e,Av}var Tv,OS;function yl(){if(OS)return Tv;OS=1;var e=MW(),t=_W();function r(n,o){var a=t(n,o);return e(a)?a:void 0}return Tv=r,Tv}var Mv,CS;function cg(){if(CS)return Mv;CS=1;var e=yl(),t=e(Object,"create");return Mv=t,Mv}var _v,PS;function IW(){if(PS)return _v;PS=1;var e=cg();function t(){this.__data__=e?e(null):{},this.size=0}return _v=t,_v}var Iv,AS;function DW(){if(AS)return Iv;AS=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Iv=e,Iv}var Dv,TS;function LW(){if(TS)return Dv;TS=1;var e=cg(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function o(a){var i=this.__data__;if(e){var s=i[a];return s===t?void 0:s}return n.call(i,a)?i[a]:void 0}return Dv=o,Dv}var Lv,MS;function RW(){if(MS)return Lv;MS=1;var e=cg(),t=Object.prototype,r=t.hasOwnProperty;function n(o){var a=this.__data__;return e?a[o]!==void 0:r.call(a,o)}return Lv=n,Lv}var Rv,_S;function FW(){if(_S)return Rv;_S=1;var e=cg(),t="__lodash_hash_undefined__";function r(n,o){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&o===void 0?t:o,this}return Rv=r,Rv}var Fv,IS;function $W(){if(IS)return Fv;IS=1;var e=IW(),t=DW(),r=LW(),n=RW(),o=FW();function a(i){var s=-1,u=i==null?0:i.length;for(this.clear();++s<u;){var c=i[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Fv=a,Fv}var $v,DS;function BW(){if(DS)return $v;DS=1;function e(){this.__data__=[],this.size=0}return $v=e,$v}var Bv,LS;function lE(){if(LS)return Bv;LS=1;function e(t,r){return t===r||t!==t&&r!==r}return Bv=e,Bv}var zv,RS;function dg(){if(RS)return zv;RS=1;var e=lE();function t(r,n){for(var o=r.length;o--;)if(e(r[o][0],n))return o;return-1}return zv=t,zv}var Hv,FS;function zW(){if(FS)return Hv;FS=1;var e=dg(),t=Array.prototype,r=t.splice;function n(o){var a=this.__data__,i=e(a,o);if(i<0)return!1;var s=a.length-1;return i==s?a.pop():r.call(a,i,1),--this.size,!0}return Hv=n,Hv}var qv,$S;function HW(){if($S)return qv;$S=1;var e=dg();function t(r){var n=this.__data__,o=e(n,r);return o<0?void 0:n[o][1]}return qv=t,qv}var Uv,BS;function qW(){if(BS)return Uv;BS=1;var e=dg();function t(r){return e(this.__data__,r)>-1}return Uv=t,Uv}var Vv,zS;function UW(){if(zS)return Vv;zS=1;var e=dg();function t(r,n){var o=this.__data__,a=e(o,r);return a<0?(++this.size,o.push([r,n])):o[a][1]=n,this}return Vv=t,Vv}var Wv,HS;function fg(){if(HS)return Wv;HS=1;var e=BW(),t=zW(),r=HW(),n=qW(),o=UW();function a(i){var s=-1,u=i==null?0:i.length;for(this.clear();++s<u;){var c=i[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Wv=a,Wv}var Kv,qS;function uE(){if(qS)return Kv;qS=1;var e=yl(),t=Da(),r=e(t,"Map");return Kv=r,Kv}var Yv,US;function VW(){if(US)return Yv;US=1;var e=$W(),t=fg(),r=uE();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Yv=n,Yv}var Gv,VS;function WW(){if(VS)return Gv;VS=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Gv=e,Gv}var Xv,WS;function mg(){if(WS)return Xv;WS=1;var e=WW();function t(r,n){var o=r.__data__;return e(n)?o[typeof n=="string"?"string":"hash"]:o.map}return Xv=t,Xv}var Zv,KS;function KW(){if(KS)return Zv;KS=1;var e=mg();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Zv=t,Zv}var Jv,YS;function YW(){if(YS)return Jv;YS=1;var e=mg();function t(r){return e(this,r).get(r)}return Jv=t,Jv}var Qv,GS;function GW(){if(GS)return Qv;GS=1;var e=mg();function t(r){return e(this,r).has(r)}return Qv=t,Qv}var ey,XS;function XW(){if(XS)return ey;XS=1;var e=mg();function t(r,n){var o=e(this,r),a=o.size;return o.set(r,n),this.size+=o.size==a?0:1,this}return ey=t,ey}var ty,ZS;function cE(){if(ZS)return ty;ZS=1;var e=VW(),t=KW(),r=YW(),n=GW(),o=XW();function a(i){var s=-1,u=i==null?0:i.length;for(this.clear();++s<u;){var c=i[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,ty=a,ty}var ry,JS;function AT(){if(JS)return ry;JS=1;var e=cE(),t="Expected a function";function r(n,o){if(typeof n!="function"||o!=null&&typeof o!="function")throw new TypeError(t);var a=function(){var i=arguments,s=o?o.apply(this,i):i[0],u=a.cache;if(u.has(s))return u.get(s);var c=n.apply(this,i);return a.cache=u.set(s,c)||u,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,ry=r,ry}var ny,QS;function ZW(){if(QS)return ny;QS=1;var e=AT(),t=500;function r(n){var o=e(n,function(i){return a.size===t&&a.clear(),i}),a=o.cache;return o}return ny=r,ny}var oy,e4;function JW(){if(e4)return oy;e4=1;var e=ZW(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(t,function(i,s,u,c){a.push(u?c.replace(r,"$1"):s||i)}),a});return oy=n,oy}var ay,t4;function dE(){if(t4)return ay;t4=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,a=Array(o);++n<o;)a[n]=r(t[n],n,t);return a}return ay=e,ay}var iy,r4;function QW(){if(r4)return iy;r4=1;var e=Af(),t=dE(),r=co(),n=oc(),o=e?e.prototype:void 0,a=o?o.toString:void 0;function i(s){if(typeof s=="string")return s;if(r(s))return t(s,i)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return iy=i,iy}var sy,n4;function TT(){if(n4)return sy;n4=1;var e=QW();function t(r){return r==null?"":e(r)}return sy=t,sy}var ly,o4;function MT(){if(o4)return ly;o4=1;var e=co(),t=iE(),r=JW(),n=TT();function o(a,i){return e(a)?a:t(a,i)?[a]:r(n(a))}return ly=o,ly}var uy,a4;function pg(){if(a4)return uy;a4=1;var e=oc();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return uy=t,uy}var cy,i4;function fE(){if(i4)return cy;i4=1;var e=MT(),t=pg();function r(n,o){o=e(o,n);for(var a=0,i=o.length;n!=null&&a<i;)n=n[t(o[a++])];return a&&a==i?n:void 0}return cy=r,cy}var dy,s4;function _T(){if(s4)return dy;s4=1;var e=fE();function t(r,n,o){var a=r==null?void 0:e(r,n);return a===void 0?o:a}return dy=t,dy}var eK=_T();const Co=mr(eK);var fy,l4;function tK(){if(l4)return fy;l4=1;function e(t){return t==null}return fy=e,fy}var rK=tK();const wt=mr(rK);var my,u4;function nK(){if(u4)return my;u4=1;var e=bi(),t=co(),r=vi(),n="[object String]";function o(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return my=o,my}var oK=nK();const Tf=mr(oK);var aK=sE();const kt=mr(aK);var iK=ys();const ac=mr(iK);var c4={exports:{}},dr={};/**
48
+ * @license React
49
+ * react-is.production.min.js
50
+ *
51
+ * Copyright (c) Facebook, Inc. and its affiliates.
52
+ *
53
+ * This source code is licensed under the MIT license found in the
54
+ * LICENSE file in the root directory of this source tree.
55
+ */var d4;function sK(){if(d4)return dr;d4=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),i=Symbol.for("react.context"),s=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function b(v){if(typeof v=="object"&&v!==null){var x=v.$$typeof;switch(x){case e:switch(v=v.type,v){case r:case o:case n:case c:case d:return v;default:switch(v=v&&v.$$typeof,v){case s:case i:case u:case h:case f:case a:return v;default:return x}}case t:return x}}}return dr.ContextConsumer=i,dr.ContextProvider=a,dr.Element=e,dr.ForwardRef=u,dr.Fragment=r,dr.Lazy=h,dr.Memo=f,dr.Portal=t,dr.Profiler=o,dr.StrictMode=n,dr.Suspense=c,dr.SuspenseList=d,dr.isAsyncMode=function(){return!1},dr.isConcurrentMode=function(){return!1},dr.isContextConsumer=function(v){return b(v)===i},dr.isContextProvider=function(v){return b(v)===a},dr.isElement=function(v){return typeof v=="object"&&v!==null&&v.$$typeof===e},dr.isForwardRef=function(v){return b(v)===u},dr.isFragment=function(v){return b(v)===r},dr.isLazy=function(v){return b(v)===h},dr.isMemo=function(v){return b(v)===f},dr.isPortal=function(v){return b(v)===t},dr.isProfiler=function(v){return b(v)===o},dr.isStrictMode=function(v){return b(v)===n},dr.isSuspense=function(v){return b(v)===c},dr.isSuspenseList=function(v){return b(v)===d},dr.isValidElementType=function(v){return typeof v=="string"||typeof v=="function"||v===r||v===o||v===n||v===c||v===d||v===p||typeof v=="object"&&v!==null&&(v.$$typeof===h||v.$$typeof===f||v.$$typeof===a||v.$$typeof===i||v.$$typeof===u||v.$$typeof===g||v.getModuleId!==void 0)},dr.typeOf=b,dr}var f4;function lK(){return f4||(f4=1,c4.exports=sK()),c4.exports}var uK=lK(),py,m4;function IT(){if(m4)return py;m4=1;var e=bi(),t=vi(),r="[object Number]";function n(o){return typeof o=="number"||t(o)&&e(o)==r}return py=n,py}var hy,p4;function cK(){if(p4)return hy;p4=1;var e=IT();function t(r){return e(r)&&r!=+r}return hy=t,hy}var dK=cK();const ic=mr(dK);var fK=IT();const mK=mr(fK);var Yn=function(e){return e===0?0:e>0?1:-1},Zs=function(e){return Tf(e)&&e.indexOf("%")===e.length-1},qe=function(e){return mK(e)&&!ic(e)},xn=function(e){return qe(e)||Tf(e)},pK=0,xs=function(e){var t=++pK;return"".concat(e||"").concat(t)},Gn=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!qe(e)&&!Tf(e))return r;var o;if(Zs(e)){var a=e.indexOf("%");o=t*parseFloat(e.slice(0,a))/100}else o=+e;return ic(o)&&(o=r),n&&o>t&&(o=t),o},Hi=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},hK=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[e[n]])r[e[n]]=!0;else return!0;return!1},Zr=function(e,t){return qe(e)&&qe(t)?function(r){return e+r*(t-e)}:function(){return t}};function xp(e,t,r){return!e||!e.length?null:e.find(function(n){return n&&(typeof t=="function"?t(n):Co(n,t))===r})}var gK=function(e){if(!e||!e.length)return null;for(var t=e.length,r=0,n=0,o=0,a=0,i=1/0,s=-1/0,u=0,c=0,d=0;d<t;d++)u=e[d].cx||0,c=e[d].cy||0,r+=u,n+=c,o+=u*c,a+=u*u,i=Math.min(i,u),s=Math.max(s,u);var f=t*a!==r*r?(t*o-r*n)/(t*a-r*r):0;return{xmin:i,xmax:s,a:f,b:(n-f*r)/t}};function au(e,t){for(var r in e)if({}.hasOwnProperty.call(e,r)&&(!{}.hasOwnProperty.call(t,r)||e[r]!==t[r]))return!1;for(var n in t)if({}.hasOwnProperty.call(t,n)&&!{}.hasOwnProperty.call(e,n))return!1;return!0}function kw(e){"@babel/helpers - typeof";return kw=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},kw(e)}var bK=["viewBox","children"],vK=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],h4=["points","pathLength"],g4={svg:bK,polygon:h4,polyline:h4},mE=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],kp=function(e,t){if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(m.isValidElement(e)&&(r=e.props),!ac(r))return null;var n={};return Object.keys(r).forEach(function(o){mE.includes(o)&&(n[o]=t||function(a){return r[o](r,a)})}),n},yK=function(e,t,r){return function(n){return e(t,r,n),null}},us=function(e,t,r){if(!ac(e)||kw(e)!=="object")return null;var n=null;return Object.keys(e).forEach(function(o){var a=e[o];mE.includes(o)&&typeof a=="function"&&(n||(n={}),n[o]=yK(a,t,r))}),n},xK=["children"],kK=["children"];function b4(e,t){if(e==null)return{};var r=wK(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function wK(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ww(e){"@babel/helpers - typeof";return ww=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},ww(e)}var v4={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"},ei=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},y4=null,gy=null,pE=function e(t){if(t===y4&&Array.isArray(gy))return gy;var r=[];return m.Children.forEach(t,function(n){wt(n)||(uK.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),gy=r,y4=t,r};function Jn(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(o){return ei(o)}):n=[ei(t)],pE(e).forEach(function(o){var a=Co(o,"type.displayName")||Co(o,"type.name");n.indexOf(a)!==-1&&r.push(o)}),r}function ho(e,t){var r=Jn(e,t);return r&&r[0]}var x4=function(e){if(!e||!e.props)return!1;var t=e.props,r=t.width,n=t.height;return!(!qe(r)||r<=0||!qe(n)||n<=0)},jK=["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"],EK=function(e){return e&&e.type&&Tf(e.type)&&jK.indexOf(e.type)>=0},DT=function(e){return e&&ww(e)==="object"&&"clipDot"in e},NK=function(e,t,r,n){var o,a=(o=g4?.[n])!==null&&o!==void 0?o:[];return t.startsWith("data-")||!kt(e)&&(n&&a.includes(t)||vK.includes(t))||r&&mE.includes(t)},ft=function(e,t,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(m.isValidElement(e)&&(n=e.props),!ac(n))return null;var o={};return Object.keys(n).forEach(function(a){var i;NK((i=n)===null||i===void 0?void 0:i[a],a,t,r)&&(o[a]=n[a])}),o},jw=function e(t,r){if(t===r)return!0;var n=m.Children.count(t);if(n!==m.Children.count(r))return!1;if(n===0)return!0;if(n===1)return k4(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var o=0;o<n;o++){var a=t[o],i=r[o];if(Array.isArray(a)||Array.isArray(i)){if(!e(a,i))return!1}else if(!k4(a,i))return!1}return!0},k4=function(e,t){if(wt(e)&&wt(t))return!0;if(!wt(e)&&!wt(t)){var r=e.props||{},n=r.children,o=b4(r,xK),a=t.props||{},i=a.children,s=b4(a,kK);return n&&i?au(o,s)&&jw(n,i):!n&&!i?au(o,s):!1}return!1},w4=function(e,t){var r=[],n={};return pE(e).forEach(function(o,a){if(EK(o))r.push(o);else if(o){var i=ei(o.type),s=t[i]||{},u=s.handler,c=s.once;if(u&&(!c||!n[i])){var d=u(o,i,a);r.push(d),n[i]=!0}}}),r},SK=function(e){var t=e&&e.type;return t&&v4[t]?v4[t]:null},OK=function(e,t){return pE(t).indexOf(e)},CK=["children","width","height","viewBox","className","style","title","desc"];function Ew(){return Ew=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ew.apply(this,arguments)}function PK(e,t){if(e==null)return{};var r=AK(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function AK(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Nw(e){var t=e.children,r=e.width,n=e.height,o=e.viewBox,a=e.className,i=e.style,s=e.title,u=e.desc,c=PK(e,CK),d=o||{width:r,height:n,x:0,y:0},f=Dt("recharts-surface",a);return y.createElement("svg",Ew({},ft(c,!0,"svg"),{className:f,width:r,height:n,style:i,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),y.createElement("title",null,s),y.createElement("desc",null,u),t)}var TK=["children","className"];function Sw(){return Sw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sw.apply(this,arguments)}function MK(e,t){if(e==null)return{};var r=_K(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function _K(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Ft=y.forwardRef(function(e,t){var r=e.children,n=e.className,o=MK(e,TK),a=Dt("recharts-layer",n);return y.createElement("g",Sw({className:a},ft(o,!0),{ref:t}),r)}),Jo=function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o]},by,j4;function IK(){if(j4)return by;j4=1;function e(t,r,n){var o=-1,a=t.length;r<0&&(r=-r>a?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var i=Array(a);++o<a;)i[o]=t[o+r];return i}return by=e,by}var vy,E4;function DK(){if(E4)return vy;E4=1;var e=IK();function t(r,n,o){var a=r.length;return o=o===void 0?a:o,!n&&o>=a?r:e(r,n,o)}return vy=t,vy}var yy,N4;function LT(){if(N4)return yy;N4=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",o=t+r+n,a="\\ufe0e\\ufe0f",i="\\u200d",s=RegExp("["+i+e+o+a+"]");function u(c){return s.test(c)}return yy=u,yy}var xy,S4;function LK(){if(S4)return xy;S4=1;function e(t){return t.split("")}return xy=e,xy}var ky,O4;function RK(){if(O4)return ky;O4=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",o=t+r+n,a="\\ufe0e\\ufe0f",i="["+e+"]",s="["+o+"]",u="\\ud83c[\\udffb-\\udfff]",c="(?:"+s+"|"+u+")",d="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",g=c+"?",b="["+a+"]?",v="(?:"+p+"(?:"+[d,f,h].join("|")+")"+b+g+")*",x=b+g+v,k="(?:"+[d+s+"?",s,f,h,i].join("|")+")",E=RegExp(u+"(?="+u+")|"+k+x,"g");function j(S){return S.match(E)||[]}return ky=j,ky}var wy,C4;function FK(){if(C4)return wy;C4=1;var e=LK(),t=LT(),r=RK();function n(o){return t(o)?r(o):e(o)}return wy=n,wy}var jy,P4;function $K(){if(P4)return jy;P4=1;var e=DK(),t=LT(),r=FK(),n=TT();function o(a){return function(i){i=n(i);var s=t(i)?r(i):void 0,u=s?s[0]:i.charAt(0),c=s?e(s,1).join(""):i.slice(1);return u[a]()+c}}return jy=o,jy}var Ey,A4;function BK(){if(A4)return Ey;A4=1;var e=$K(),t=e("toUpperCase");return Ey=t,Ey}var zK=BK();const hg=mr(zK);function $r(e){return function(){return e}}const RT=Math.cos,wp=Math.sin,aa=Math.sqrt,jp=Math.PI,gg=2*jp,Ow=Math.PI,Cw=2*Ow,Ls=1e-6,HK=Cw-Ls;function FT(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function qK(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return FT;const r=10**t;return function(n){this._+=n[0];for(let o=1,a=n.length;o<a;++o)this._+=Math.round(arguments[o]*r)/r+n[o]}}class UK{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?FT:qK(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,o){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+o}`}bezierCurveTo(t,r,n,o,a,i){this._append`C${+t},${+r},${+n},${+o},${this._x1=+a},${this._y1=+i}`}arcTo(t,r,n,o,a){if(t=+t,r=+r,n=+n,o=+o,a=+a,a<0)throw new Error(`negative radius: ${a}`);let i=this._x1,s=this._y1,u=n-t,c=o-r,d=i-t,f=s-r,h=d*d+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(h>Ls)if(!(Math.abs(f*u-c*d)>Ls)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-i,g=o-s,b=u*u+c*c,v=p*p+g*g,x=Math.sqrt(b),k=Math.sqrt(h),E=a*Math.tan((Ow-Math.acos((b+h-v)/(2*x*k)))/2),j=E/k,S=E/x;Math.abs(j-1)>Ls&&this._append`L${t+j*d},${r+j*f}`,this._append`A${a},${a},0,0,${+(f*p>d*g)},${this._x1=t+S*u},${this._y1=r+S*c}`}}arc(t,r,n,o,a,i){if(t=+t,r=+r,n=+n,i=!!i,n<0)throw new Error(`negative radius: ${n}`);let s=n*Math.cos(o),u=n*Math.sin(o),c=t+s,d=r+u,f=1^i,h=i?o-a:a-o;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Ls||Math.abs(this._y1-d)>Ls)&&this._append`L${c},${d}`,n&&(h<0&&(h=h%Cw+Cw),h>HK?this._append`A${n},${n},0,1,${f},${t-s},${r-u}A${n},${n},0,1,${f},${this._x1=c},${this._y1=d}`:h>Ls&&this._append`A${n},${n},0,${+(h>=Ow)},${f},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,o){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+o}h${-n}Z`}toString(){return this._}}function hE(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new UK(t)}function gE(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $T(e){this._context=e}$T.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 bg(e){return new $T(e)}function BT(e){return e[0]}function zT(e){return e[1]}function HT(e,t){var r=$r(!0),n=null,o=bg,a=null,i=hE(s);e=typeof e=="function"?e:e===void 0?BT:$r(e),t=typeof t=="function"?t:t===void 0?zT:$r(t);function s(u){var c,d=(u=gE(u)).length,f,h=!1,p;for(n==null&&(a=o(p=i())),c=0;c<=d;++c)!(c<d&&r(f=u[c],c,u))===h&&((h=!h)?a.lineStart():a.lineEnd()),h&&a.point(+e(f,c,u),+t(f,c,u));if(p)return a=null,p+""||null}return s.x=function(u){return arguments.length?(e=typeof u=="function"?u:$r(+u),s):e},s.y=function(u){return arguments.length?(t=typeof u=="function"?u:$r(+u),s):t},s.defined=function(u){return arguments.length?(r=typeof u=="function"?u:$r(!!u),s):r},s.curve=function(u){return arguments.length?(o=u,n!=null&&(a=o(n)),s):o},s.context=function(u){return arguments.length?(u==null?n=a=null:a=o(n=u),s):n},s}function Em(e,t,r){var n=null,o=$r(!0),a=null,i=bg,s=null,u=hE(c);e=typeof e=="function"?e:e===void 0?BT:$r(+e),t=typeof t=="function"?t:$r(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?zT:$r(+r);function c(f){var h,p,g,b=(f=gE(f)).length,v,x=!1,k,E=new Array(b),j=new Array(b);for(a==null&&(s=i(k=u())),h=0;h<=b;++h){if(!(h<b&&o(v=f[h],h,f))===x)if(x=!x)p=h,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),g=h-1;g>=p;--g)s.point(E[g],j[g]);s.lineEnd(),s.areaEnd()}x&&(E[h]=+e(v,h,f),j[h]=+t(v,h,f),s.point(n?+n(v,h,f):E[h],r?+r(v,h,f):j[h]))}if(k)return s=null,k+""||null}function d(){return HT().defined(o).curve(i).context(a)}return c.x=function(f){return arguments.length?(e=typeof f=="function"?f:$r(+f),n=null,c):e},c.x0=function(f){return arguments.length?(e=typeof f=="function"?f:$r(+f),c):e},c.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:$r(+f),c):n},c.y=function(f){return arguments.length?(t=typeof f=="function"?f:$r(+f),r=null,c):t},c.y0=function(f){return arguments.length?(t=typeof f=="function"?f:$r(+f),c):t},c.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:$r(+f),c):r},c.lineX0=c.lineY0=function(){return d().x(e).y(t)},c.lineY1=function(){return d().x(e).y(r)},c.lineX1=function(){return d().x(n).y(t)},c.defined=function(f){return arguments.length?(o=typeof f=="function"?f:$r(!!f),c):o},c.curve=function(f){return arguments.length?(i=f,a!=null&&(s=i(a)),c):i},c.context=function(f){return arguments.length?(f==null?a=s=null:s=i(a=f),c):a},c}class qT{constructor(t,r){this._context=t,this._x=r}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,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function VK(e){return new qT(e,!0)}function WK(e){return new qT(e,!1)}const bE={draw(e,t){const r=aa(t/jp);e.moveTo(r,0),e.arc(0,0,r,0,gg)}},KK={draw(e,t){const r=aa(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},UT=aa(1/3),YK=UT*2,GK={draw(e,t){const r=aa(t/YK),n=r*UT;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},XK={draw(e,t){const r=aa(t),n=-r/2;e.rect(n,n,r,r)}},ZK=.8908130915292852,VT=wp(jp/10)/wp(7*jp/10),JK=wp(gg/10)*VT,QK=-RT(gg/10)*VT,eY={draw(e,t){const r=aa(t*ZK),n=JK*r,o=QK*r;e.moveTo(0,-r),e.lineTo(n,o);for(let a=1;a<5;++a){const i=gg*a/5,s=RT(i),u=wp(i);e.lineTo(u*r,-s*r),e.lineTo(s*n-u*o,u*n+s*o)}e.closePath()}},Ny=aa(3),tY={draw(e,t){const r=-aa(t/(Ny*3));e.moveTo(0,r*2),e.lineTo(-Ny*r,-r),e.lineTo(Ny*r,-r),e.closePath()}},Mo=-.5,_o=aa(3)/2,Pw=1/aa(12),rY=(Pw/2+1)*3,nY={draw(e,t){const r=aa(t/rY),n=r/2,o=r*Pw,a=n,i=r*Pw+r,s=-a,u=i;e.moveTo(n,o),e.lineTo(a,i),e.lineTo(s,u),e.lineTo(Mo*n-_o*o,_o*n+Mo*o),e.lineTo(Mo*a-_o*i,_o*a+Mo*i),e.lineTo(Mo*s-_o*u,_o*s+Mo*u),e.lineTo(Mo*n+_o*o,Mo*o-_o*n),e.lineTo(Mo*a+_o*i,Mo*i-_o*a),e.lineTo(Mo*s+_o*u,Mo*u-_o*s),e.closePath()}};function oY(e,t){let r=null,n=hE(o);e=typeof e=="function"?e:$r(e||bE),t=typeof t=="function"?t:$r(t===void 0?64:+t);function o(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return o.type=function(a){return arguments.length?(e=typeof a=="function"?a:$r(a),o):e},o.size=function(a){return arguments.length?(t=typeof a=="function"?a:$r(+a),o):t},o.context=function(a){return arguments.length?(r=a??null,o):r},o}function Ep(){}function Np(e,t,r){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+r)/6)}function WT(e){this._context=e}WT.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:Np(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:Np(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function aY(e){return new WT(e)}function KT(e){this._context=e}KT.prototype={areaStart:Ep,areaEnd:Ep,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:Np(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function iY(e){return new KT(e)}function YT(e){this._context=e}YT.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 r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Np(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function sY(e){return new YT(e)}function GT(e){this._context=e}GT.prototype={areaStart:Ep,areaEnd:Ep,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 lY(e){return new GT(e)}function T4(e){return e<0?-1:1}function M4(e,t,r){var n=e._x1-e._x0,o=t-e._x1,a=(e._y1-e._y0)/(n||o<0&&-0),i=(r-e._y1)/(o||n<0&&-0),s=(a*o+i*n)/(n+o);return(T4(a)+T4(i))*Math.min(Math.abs(a),Math.abs(i),.5*Math.abs(s))||0}function _4(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function Sy(e,t,r){var n=e._x0,o=e._y0,a=e._x1,i=e._y1,s=(a-n)/3;e._context.bezierCurveTo(n+s,o+s*t,a-s,i-s*r,a,i)}function Sp(e){this._context=e}Sp.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:Sy(this,this._t0,_4(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 r=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,Sy(this,_4(this,r=M4(this,e,t)),r);break;default:Sy(this,this._t0,r=M4(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function XT(e){this._context=new ZT(e)}(XT.prototype=Object.create(Sp.prototype)).point=function(e,t){Sp.prototype.point.call(this,t,e)};function ZT(e){this._context=e}ZT.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,r,n,o,a){this._context.bezierCurveTo(t,e,n,r,a,o)}};function uY(e){return new Sp(e)}function cY(e){return new XT(e)}function JT(e){this._context=e}JT.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,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=I4(e),o=I4(t),a=0,i=1;i<r;++a,++i)this._context.bezierCurveTo(n[0][a],o[0][a],n[1][a],o[1][a],e[i],t[i]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function I4(e){var t,r=e.length-1,n,o=new Array(r),a=new Array(r),i=new Array(r);for(o[0]=0,a[0]=2,i[0]=e[0]+2*e[1],t=1;t<r-1;++t)o[t]=1,a[t]=4,i[t]=4*e[t]+2*e[t+1];for(o[r-1]=2,a[r-1]=7,i[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=o[t]/a[t-1],a[t]-=n,i[t]-=n*i[t-1];for(o[r-1]=i[r-1]/a[r-1],t=r-2;t>=0;--t)o[t]=(i[t]-o[t+1])/a[t];for(a[r-1]=(e[r]+o[r-1])/2,t=0;t<r-1;++t)a[t]=2*e[t+1]-o[t+1];return[o,a]}function dY(e){return new JT(e)}function vg(e,t){this._context=e,this._t=t}vg.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=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 r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function fY(e){return new vg(e,.5)}function mY(e){return new vg(e,0)}function pY(e){return new vg(e,1)}function ku(e,t){if((i=e.length)>1)for(var r=1,n,o,a=e[t[0]],i,s=a.length;r<i;++r)for(o=a,a=e[t[r]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(o[n][1])?o[n][0]:o[n][1]}function Aw(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function hY(e,t){return e[t]}function gY(e){const t=[];return t.key=e,t}function bY(){var e=$r([]),t=Aw,r=ku,n=hY;function o(a){var i=Array.from(e.apply(this,arguments),gY),s,u=i.length,c=-1,d;for(const f of a)for(s=0,++c;s<u;++s)(i[s][c]=[0,+n(f,i[s].key,c,a)]).data=f;for(s=0,d=gE(t(i));s<u;++s)i[d[s]].index=s;return r(i,d),i}return o.keys=function(a){return arguments.length?(e=typeof a=="function"?a:$r(Array.from(a)),o):e},o.value=function(a){return arguments.length?(n=typeof a=="function"?a:$r(+a),o):n},o.order=function(a){return arguments.length?(t=a==null?Aw:typeof a=="function"?a:$r(Array.from(a)),o):t},o.offset=function(a){return arguments.length?(r=a??ku,o):r},o}function vY(e,t){if((n=e.length)>0){for(var r,n,o=0,a=e[0].length,i;o<a;++o){for(i=r=0;r<n;++r)i+=e[r][o][1]||0;if(i)for(r=0;r<n;++r)e[r][o][1]/=i}ku(e,t)}}function yY(e,t){if((o=e.length)>0){for(var r=0,n=e[t[0]],o,a=n.length;r<a;++r){for(var i=0,s=0;i<o;++i)s+=e[i][r][1]||0;n[r][1]+=n[r][0]=-s/2}ku(e,t)}}function xY(e,t){if(!(!((i=e.length)>0)||!((a=(o=e[t[0]]).length)>0))){for(var r=0,n=1,o,a,i;n<a;++n){for(var s=0,u=0,c=0;s<i;++s){for(var d=e[t[s]],f=d[n][1]||0,h=d[n-1][1]||0,p=(f-h)/2,g=0;g<s;++g){var b=e[t[g]],v=b[n][1]||0,x=b[n-1][1]||0;p+=v-x}u+=f,c+=p*f}o[n-1][1]+=o[n-1][0]=r,u&&(r-=c/u)}o[n-1][1]+=o[n-1][0]=r,ku(e,t)}}function Cd(e){"@babel/helpers - typeof";return Cd=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},Cd(e)}var kY=["type","size","sizeType"];function Tw(){return Tw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tw.apply(this,arguments)}function D4(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function L4(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?D4(Object(r),!0).forEach(function(n){wY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):D4(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wY(e,t,r){return t=jY(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jY(e){var t=EY(e,"string");return Cd(t)=="symbol"?t:t+""}function EY(e,t){if(Cd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Cd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function NY(e,t){if(e==null)return{};var r=SY(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function SY(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var QT={symbolCircle:bE,symbolCross:KK,symbolDiamond:GK,symbolSquare:XK,symbolStar:eY,symbolTriangle:tY,symbolWye:nY},OY=Math.PI/180,CY=function(e){var t="symbol".concat(hg(e));return QT[t]||bE},PY=function(e,t,r){if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*OY;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.pow(Math.tan(n),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},AY=function(e,t){QT["symbol".concat(hg(e))]=t},yg=function(e){var t=e.type,r=t===void 0?"circle":t,n=e.size,o=n===void 0?64:n,a=e.sizeType,i=a===void 0?"area":a,s=NY(e,kY),u=L4(L4({},s),{},{type:r,size:o,sizeType:i}),c=function(){var g=CY(r),b=oY().type(g).size(PY(o,i,r));return b()},d=u.className,f=u.cx,h=u.cy,p=ft(u,!0);return f===+f&&h===+h&&o===+o?y.createElement("path",Tw({},p,{className:Dt("recharts-symbols",d),transform:"translate(".concat(f,", ").concat(h,")"),d:c()})):null};yg.registerSymbol=AY;function wu(e){"@babel/helpers - typeof";return wu=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},wu(e)}function Mw(){return Mw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Mw.apply(this,arguments)}function R4(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function TY(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?R4(Object(r),!0).forEach(function(n){Pd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R4(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function MY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _Y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,tM(n.key),n)}}function IY(e,t,r){return t&&_Y(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function DY(e,t,r){return t=Op(t),LY(e,eM()?Reflect.construct(t,r||[],Op(e).constructor):t.apply(e,r))}function LY(e,t){if(t&&(wu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return RY(e)}function RY(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function eM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eM=function(){return!!e})()}function Op(e){return Op=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Op(e)}function FY(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_w(e,t)}function _w(e,t){return _w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},_w(e,t)}function Pd(e,t,r){return t=tM(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tM(e){var t=$Y(e,"string");return wu(t)=="symbol"?t:t+""}function $Y(e,t){if(wu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(wu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Wo=32,vE=function(e){function t(){return MY(this,t),DY(this,t,arguments)}return FY(t,e),IY(t,[{key:"renderIcon",value:function(r){var n=this.props.inactiveColor,o=Wo/2,a=Wo/6,i=Wo/3,s=r.inactive?n:r.color;if(r.type==="plainline")return y.createElement("line",{strokeWidth:4,fill:"none",stroke:s,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:o,x2:Wo,y2:o,className:"recharts-legend-icon"});if(r.type==="line")return y.createElement("path",{strokeWidth:4,fill:"none",stroke:s,d:"M0,".concat(o,"h").concat(i,`
56
+ A`).concat(a,",").concat(a,",0,1,1,").concat(2*i,",").concat(o,`
57
+ H`).concat(Wo,"M").concat(2*i,",").concat(o,`
58
+ A`).concat(a,",").concat(a,",0,1,1,").concat(i,",").concat(o),className:"recharts-legend-icon"});if(r.type==="rect")return y.createElement("path",{stroke:"none",fill:s,d:"M0,".concat(Wo/8,"h").concat(Wo,"v").concat(Wo*3/4,"h").concat(-32,"z"),className:"recharts-legend-icon"});if(y.isValidElement(r.legendIcon)){var u=TY({},r);return delete u.legendIcon,y.cloneElement(r.legendIcon,u)}return y.createElement(yg,{fill:s,cx:o,cy:o,size:Wo,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,n=this.props,o=n.payload,a=n.iconSize,i=n.layout,s=n.formatter,u=n.inactiveColor,c={x:0,y:0,width:Wo,height:Wo},d={display:i==="horizontal"?"inline-block":"block",marginRight:10},f={display:"inline-block",verticalAlign:"middle",marginRight:4};return o.map(function(h,p){var g=h.formatter||s,b=Dt(Pd(Pd({"recharts-legend-item":!0},"legend-item-".concat(p),!0),"inactive",h.inactive));if(h.type==="none")return null;var v=kt(h.value)?null:h.value;Jo(!kt(h.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var x=h.inactive?u:h.color;return y.createElement("li",Mw({className:b,style:d,key:"legend-item-".concat(p)},us(r.props,h,p)),y.createElement(Nw,{width:a,height:a,viewBox:c,style:f},r.renderIcon(h)),y.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},g?g(v,h,p):v))})}},{key:"render",value:function(){var r=this.props,n=r.payload,o=r.layout,a=r.align;if(!n||!n.length)return null;var i={padding:0,margin:0,textAlign:o==="horizontal"?a:"left"};return y.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}])}(m.PureComponent);Pd(vE,"displayName","Legend");Pd(vE,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Oy,F4;function BY(){if(F4)return Oy;F4=1;var e=fg();function t(){this.__data__=new e,this.size=0}return Oy=t,Oy}var Cy,$4;function zY(){if($4)return Cy;$4=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return Cy=e,Cy}var Py,B4;function HY(){if(B4)return Py;B4=1;function e(t){return this.__data__.get(t)}return Py=e,Py}var Ay,z4;function qY(){if(z4)return Ay;z4=1;function e(t){return this.__data__.has(t)}return Ay=e,Ay}var Ty,H4;function UY(){if(H4)return Ty;H4=1;var e=fg(),t=uE(),r=cE(),n=200;function o(a,i){var s=this.__data__;if(s instanceof e){var u=s.__data__;if(!t||u.length<n-1)return u.push([a,i]),this.size=++s.size,this;s=this.__data__=new r(u)}return s.set(a,i),this.size=s.size,this}return Ty=o,Ty}var My,q4;function rM(){if(q4)return My;q4=1;var e=fg(),t=BY(),r=zY(),n=HY(),o=qY(),a=UY();function i(s){var u=this.__data__=new e(s);this.size=u.size}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=n,i.prototype.has=o,i.prototype.set=a,My=i,My}var _y,U4;function VY(){if(U4)return _y;U4=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return _y=t,_y}var Iy,V4;function WY(){if(V4)return Iy;V4=1;function e(t){return this.__data__.has(t)}return Iy=e,Iy}var Dy,W4;function nM(){if(W4)return Dy;W4=1;var e=cE(),t=VY(),r=WY();function n(o){var a=-1,i=o==null?0:o.length;for(this.__data__=new e;++a<i;)this.add(o[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,Dy=n,Dy}var Ly,K4;function oM(){if(K4)return Ly;K4=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o;)if(r(t[n],n,t))return!0;return!1}return Ly=e,Ly}var Ry,Y4;function aM(){if(Y4)return Ry;Y4=1;function e(t,r){return t.has(r)}return Ry=e,Ry}var Fy,G4;function iM(){if(G4)return Fy;G4=1;var e=nM(),t=oM(),r=aM(),n=1,o=2;function a(i,s,u,c,d,f){var h=u&n,p=i.length,g=s.length;if(p!=g&&!(h&&g>p))return!1;var b=f.get(i),v=f.get(s);if(b&&v)return b==s&&v==i;var x=-1,k=!0,E=u&o?new e:void 0;for(f.set(i,s),f.set(s,i);++x<p;){var j=i[x],S=s[x];if(c)var C=h?c(S,j,x,s,i,f):c(j,S,x,i,s,f);if(C!==void 0){if(C)continue;k=!1;break}if(E){if(!t(s,function(O,M){if(!r(E,M)&&(j===O||d(j,O,u,c,f)))return E.push(M)})){k=!1;break}}else if(!(j===S||d(j,S,u,c,f))){k=!1;break}}return f.delete(i),f.delete(s),k}return Fy=a,Fy}var $y,X4;function KY(){if(X4)return $y;X4=1;var e=Da(),t=e.Uint8Array;return $y=t,$y}var By,Z4;function YY(){if(Z4)return By;Z4=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o,a){n[++r]=[a,o]}),n}return By=e,By}var zy,J4;function yE(){if(J4)return zy;J4=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(o){n[++r]=o}),n}return zy=e,zy}var Hy,Q4;function GY(){if(Q4)return Hy;Q4=1;var e=Af(),t=KY(),r=lE(),n=iM(),o=YY(),a=yE(),i=1,s=2,u="[object Boolean]",c="[object Date]",d="[object Error]",f="[object Map]",h="[object Number]",p="[object RegExp]",g="[object Set]",b="[object String]",v="[object Symbol]",x="[object ArrayBuffer]",k="[object DataView]",E=e?e.prototype:void 0,j=E?E.valueOf:void 0;function S(C,O,M,A,T,_,F){switch(M){case k:if(C.byteLength!=O.byteLength||C.byteOffset!=O.byteOffset)return!1;C=C.buffer,O=O.buffer;case x:return!(C.byteLength!=O.byteLength||!_(new t(C),new t(O)));case u:case c:case h:return r(+C,+O);case d:return C.name==O.name&&C.message==O.message;case p:case b:return C==O+"";case f:var $=o;case g:var I=A&i;if($||($=a),C.size!=O.size&&!I)return!1;var R=F.get(C);if(R)return R==O;A|=s,F.set(C,O);var W=n($(C),$(O),A,T,_,F);return F.delete(C),W;case v:if(j)return j.call(C)==j.call(O)}return!1}return Hy=S,Hy}var qy,eO;function sM(){if(eO)return qy;eO=1;function e(t,r){for(var n=-1,o=r.length,a=t.length;++n<o;)t[a+n]=r[n];return t}return qy=e,qy}var Uy,tO;function XY(){if(tO)return Uy;tO=1;var e=sM(),t=co();function r(n,o,a){var i=o(n);return t(n)?i:e(i,a(n))}return Uy=r,Uy}var Vy,rO;function ZY(){if(rO)return Vy;rO=1;function e(t,r){for(var n=-1,o=t==null?0:t.length,a=0,i=[];++n<o;){var s=t[n];r(s,n,t)&&(i[a++]=s)}return i}return Vy=e,Vy}var Wy,nO;function JY(){if(nO)return Wy;nO=1;function e(){return[]}return Wy=e,Wy}var Ky,oO;function QY(){if(oO)return Ky;oO=1;var e=ZY(),t=JY(),r=Object.prototype,n=r.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(i){return i==null?[]:(i=Object(i),e(o(i),function(s){return n.call(i,s)}))}:t;return Ky=a,Ky}var Yy,aO;function eG(){if(aO)return Yy;aO=1;function e(t,r){for(var n=-1,o=Array(t);++n<t;)o[n]=r(n);return o}return Yy=e,Yy}var Gy,iO;function tG(){if(iO)return Gy;iO=1;var e=bi(),t=vi(),r="[object Arguments]";function n(o){return t(o)&&e(o)==r}return Gy=n,Gy}var Xy,sO;function xE(){if(sO)return Xy;sO=1;var e=tG(),t=vi(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e(function(){return arguments}())?e:function(i){return t(i)&&n.call(i,"callee")&&!o.call(i,"callee")};return Xy=a,Xy}var Zm={exports:{}},Zy,lO;function rG(){if(lO)return Zy;lO=1;function e(){return!1}return Zy=e,Zy}Zm.exports;var uO;function lM(){return uO||(uO=1,function(e,t){var r=Da(),n=rG(),o=t&&!t.nodeType&&t,a=o&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===o,s=i?r.Buffer:void 0,u=s?s.isBuffer:void 0,c=u||n;e.exports=c}(Zm,Zm.exports)),Zm.exports}var Jy,cO;function kE(){if(cO)return Jy;cO=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,o){var a=typeof n;return o=o??e,!!o&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<o}return Jy=r,Jy}var Qy,dO;function wE(){if(dO)return Qy;dO=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Qy=t,Qy}var ex,fO;function nG(){if(fO)return ex;fO=1;var e=bi(),t=wE(),r=vi(),n="[object Arguments]",o="[object Array]",a="[object Boolean]",i="[object Date]",s="[object Error]",u="[object Function]",c="[object Map]",d="[object Number]",f="[object Object]",h="[object RegExp]",p="[object Set]",g="[object String]",b="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",k="[object Float32Array]",E="[object Float64Array]",j="[object Int8Array]",S="[object Int16Array]",C="[object Int32Array]",O="[object Uint8Array]",M="[object Uint8ClampedArray]",A="[object Uint16Array]",T="[object Uint32Array]",_={};_[k]=_[E]=_[j]=_[S]=_[C]=_[O]=_[M]=_[A]=_[T]=!0,_[n]=_[o]=_[v]=_[a]=_[x]=_[i]=_[s]=_[u]=_[c]=_[d]=_[f]=_[h]=_[p]=_[g]=_[b]=!1;function F($){return r($)&&t($.length)&&!!_[e($)]}return ex=F,ex}var tx,mO;function uM(){if(mO)return tx;mO=1;function e(t){return function(r){return t(r)}}return tx=e,tx}var Jm={exports:{}};Jm.exports;var pO;function oG(){return pO||(pO=1,function(e,t){var r=CT(),n=t&&!t.nodeType&&t,o=n&&!0&&e&&!e.nodeType&&e,a=o&&o.exports===n,i=a&&r.process,s=function(){try{var u=o&&o.require&&o.require("util").types;return u||i&&i.binding&&i.binding("util")}catch{}}();e.exports=s}(Jm,Jm.exports)),Jm.exports}var rx,hO;function cM(){if(hO)return rx;hO=1;var e=nG(),t=uM(),r=oG(),n=r&&r.isTypedArray,o=n?t(n):e;return rx=o,rx}var nx,gO;function aG(){if(gO)return nx;gO=1;var e=eG(),t=xE(),r=co(),n=lM(),o=kE(),a=cM(),i=Object.prototype,s=i.hasOwnProperty;function u(c,d){var f=r(c),h=!f&&t(c),p=!f&&!h&&n(c),g=!f&&!h&&!p&&a(c),b=f||h||p||g,v=b?e(c.length,String):[],x=v.length;for(var k in c)(d||s.call(c,k))&&!(b&&(k=="length"||p&&(k=="offset"||k=="parent")||g&&(k=="buffer"||k=="byteLength"||k=="byteOffset")||o(k,x)))&&v.push(k);return v}return nx=u,nx}var ox,bO;function iG(){if(bO)return ox;bO=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,o=typeof n=="function"&&n.prototype||e;return r===o}return ox=t,ox}var ax,vO;function dM(){if(vO)return ax;vO=1;function e(t,r){return function(n){return t(r(n))}}return ax=e,ax}var ix,yO;function sG(){if(yO)return ix;yO=1;var e=dM(),t=e(Object.keys,Object);return ix=t,ix}var sx,xO;function lG(){if(xO)return sx;xO=1;var e=iG(),t=sG(),r=Object.prototype,n=r.hasOwnProperty;function o(a){if(!e(a))return t(a);var i=[];for(var s in Object(a))n.call(a,s)&&s!="constructor"&&i.push(s);return i}return sx=o,sx}var lx,kO;function Mf(){if(kO)return lx;kO=1;var e=sE(),t=wE();function r(n){return n!=null&&t(n.length)&&!e(n)}return lx=r,lx}var ux,wO;function xg(){if(wO)return ux;wO=1;var e=aG(),t=lG(),r=Mf();function n(o){return r(o)?e(o):t(o)}return ux=n,ux}var cx,jO;function uG(){if(jO)return cx;jO=1;var e=XY(),t=QY(),r=xg();function n(o){return e(o,r,t)}return cx=n,cx}var dx,EO;function cG(){if(EO)return dx;EO=1;var e=uG(),t=1,r=Object.prototype,n=r.hasOwnProperty;function o(a,i,s,u,c,d){var f=s&t,h=e(a),p=h.length,g=e(i),b=g.length;if(p!=b&&!f)return!1;for(var v=p;v--;){var x=h[v];if(!(f?x in i:n.call(i,x)))return!1}var k=d.get(a),E=d.get(i);if(k&&E)return k==i&&E==a;var j=!0;d.set(a,i),d.set(i,a);for(var S=f;++v<p;){x=h[v];var C=a[x],O=i[x];if(u)var M=f?u(O,C,x,i,a,d):u(C,O,x,a,i,d);if(!(M===void 0?C===O||c(C,O,s,u,d):M)){j=!1;break}S||(S=x=="constructor")}if(j&&!S){var A=a.constructor,T=i.constructor;A!=T&&"constructor"in a&&"constructor"in i&&!(typeof A=="function"&&A instanceof A&&typeof T=="function"&&T instanceof T)&&(j=!1)}return d.delete(a),d.delete(i),j}return dx=o,dx}var fx,NO;function dG(){if(NO)return fx;NO=1;var e=yl(),t=Da(),r=e(t,"DataView");return fx=r,fx}var mx,SO;function fG(){if(SO)return mx;SO=1;var e=yl(),t=Da(),r=e(t,"Promise");return mx=r,mx}var px,OO;function fM(){if(OO)return px;OO=1;var e=yl(),t=Da(),r=e(t,"Set");return px=r,px}var hx,CO;function mG(){if(CO)return hx;CO=1;var e=yl(),t=Da(),r=e(t,"WeakMap");return hx=r,hx}var gx,PO;function pG(){if(PO)return gx;PO=1;var e=dG(),t=uE(),r=fG(),n=fM(),o=mG(),a=bi(),i=PT(),s="[object Map]",u="[object Object]",c="[object Promise]",d="[object Set]",f="[object WeakMap]",h="[object DataView]",p=i(e),g=i(t),b=i(r),v=i(n),x=i(o),k=a;return(e&&k(new e(new ArrayBuffer(1)))!=h||t&&k(new t)!=s||r&&k(r.resolve())!=c||n&&k(new n)!=d||o&&k(new o)!=f)&&(k=function(E){var j=a(E),S=j==u?E.constructor:void 0,C=S?i(S):"";if(C)switch(C){case p:return h;case g:return s;case b:return c;case v:return d;case x:return f}return j}),gx=k,gx}var bx,AO;function hG(){if(AO)return bx;AO=1;var e=rM(),t=iM(),r=GY(),n=cG(),o=pG(),a=co(),i=lM(),s=cM(),u=1,c="[object Arguments]",d="[object Array]",f="[object Object]",h=Object.prototype,p=h.hasOwnProperty;function g(b,v,x,k,E,j){var S=a(b),C=a(v),O=S?d:o(b),M=C?d:o(v);O=O==c?f:O,M=M==c?f:M;var A=O==f,T=M==f,_=O==M;if(_&&i(b)){if(!i(v))return!1;S=!0,A=!1}if(_&&!A)return j||(j=new e),S||s(b)?t(b,v,x,k,E,j):r(b,v,O,x,k,E,j);if(!(x&u)){var F=A&&p.call(b,"__wrapped__"),$=T&&p.call(v,"__wrapped__");if(F||$){var I=F?b.value():b,R=$?v.value():v;return j||(j=new e),E(I,R,x,k,j)}}return _?(j||(j=new e),n(b,v,x,k,E,j)):!1}return bx=g,bx}var vx,TO;function jE(){if(TO)return vx;TO=1;var e=hG(),t=vi();function r(n,o,a,i,s){return n===o?!0:n==null||o==null||!t(n)&&!t(o)?n!==n&&o!==o:e(n,o,a,i,r,s)}return vx=r,vx}var yx,MO;function gG(){if(MO)return yx;MO=1;var e=rM(),t=jE(),r=1,n=2;function o(a,i,s,u){var c=s.length,d=c,f=!u;if(a==null)return!d;for(a=Object(a);c--;){var h=s[c];if(f&&h[2]?h[1]!==a[h[0]]:!(h[0]in a))return!1}for(;++c<d;){h=s[c];var p=h[0],g=a[p],b=h[1];if(f&&h[2]){if(g===void 0&&!(p in a))return!1}else{var v=new e;if(u)var x=u(g,b,p,a,i,v);if(!(x===void 0?t(b,g,r|n,u,v):x))return!1}}return!0}return yx=o,yx}var xx,_O;function mM(){if(_O)return xx;_O=1;var e=ys();function t(r){return r===r&&!e(r)}return xx=t,xx}var kx,IO;function bG(){if(IO)return kx;IO=1;var e=mM(),t=xg();function r(n){for(var o=t(n),a=o.length;a--;){var i=o[a],s=n[i];o[a]=[i,s,e(s)]}return o}return kx=r,kx}var wx,DO;function pM(){if(DO)return wx;DO=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return wx=e,wx}var jx,LO;function vG(){if(LO)return jx;LO=1;var e=gG(),t=bG(),r=pM();function n(o){var a=t(o);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(i){return i===o||e(i,o,a)}}return jx=n,jx}var Ex,RO;function yG(){if(RO)return Ex;RO=1;function e(t,r){return t!=null&&r in Object(t)}return Ex=e,Ex}var Nx,FO;function xG(){if(FO)return Nx;FO=1;var e=MT(),t=xE(),r=co(),n=kE(),o=wE(),a=pg();function i(s,u,c){u=e(u,s);for(var d=-1,f=u.length,h=!1;++d<f;){var p=a(u[d]);if(!(h=s!=null&&c(s,p)))break;s=s[p]}return h||++d!=f?h:(f=s==null?0:s.length,!!f&&o(f)&&n(p,f)&&(r(s)||t(s)))}return Nx=i,Nx}var Sx,$O;function kG(){if($O)return Sx;$O=1;var e=yG(),t=xG();function r(n,o){return n!=null&&t(n,o,e)}return Sx=r,Sx}var Ox,BO;function wG(){if(BO)return Ox;BO=1;var e=jE(),t=_T(),r=kG(),n=iE(),o=mM(),a=pM(),i=pg(),s=1,u=2;function c(d,f){return n(d)&&o(f)?a(i(d),f):function(h){var p=t(h,d);return p===void 0&&p===f?r(h,d):e(f,p,s|u)}}return Ox=c,Ox}var Cx,zO;function sc(){if(zO)return Cx;zO=1;function e(t){return t}return Cx=e,Cx}var Px,HO;function jG(){if(HO)return Px;HO=1;function e(t){return function(r){return r?.[t]}}return Px=e,Px}var Ax,qO;function EG(){if(qO)return Ax;qO=1;var e=fE();function t(r){return function(n){return e(n,r)}}return Ax=t,Ax}var Tx,UO;function NG(){if(UO)return Tx;UO=1;var e=jG(),t=EG(),r=iE(),n=pg();function o(a){return r(a)?e(n(a)):t(a)}return Tx=o,Tx}var Mx,VO;function La(){if(VO)return Mx;VO=1;var e=vG(),t=wG(),r=sc(),n=co(),o=NG();function a(i){return typeof i=="function"?i:i==null?r:typeof i=="object"?n(i)?t(i[0],i[1]):e(i):o(i)}return Mx=a,Mx}var _x,WO;function hM(){if(WO)return _x;WO=1;function e(t,r,n,o){for(var a=t.length,i=n+(o?1:-1);o?i--:++i<a;)if(r(t[i],i,t))return i;return-1}return _x=e,_x}var Ix,KO;function SG(){if(KO)return Ix;KO=1;function e(t){return t!==t}return Ix=e,Ix}var Dx,YO;function OG(){if(YO)return Dx;YO=1;function e(t,r,n){for(var o=n-1,a=t.length;++o<a;)if(t[o]===r)return o;return-1}return Dx=e,Dx}var Lx,GO;function CG(){if(GO)return Lx;GO=1;var e=hM(),t=SG(),r=OG();function n(o,a,i){return a===a?r(o,a,i):e(o,t,i)}return Lx=n,Lx}var Rx,XO;function PG(){if(XO)return Rx;XO=1;var e=CG();function t(r,n){var o=r==null?0:r.length;return!!o&&e(r,n,0)>-1}return Rx=t,Rx}var Fx,ZO;function AG(){if(ZO)return Fx;ZO=1;function e(t,r,n){for(var o=-1,a=t==null?0:t.length;++o<a;)if(n(r,t[o]))return!0;return!1}return Fx=e,Fx}var $x,JO;function TG(){if(JO)return $x;JO=1;function e(){}return $x=e,$x}var Bx,QO;function MG(){if(QO)return Bx;QO=1;var e=fM(),t=TG(),r=yE(),n=1/0,o=e&&1/r(new e([,-0]))[1]==n?function(a){return new e(a)}:t;return Bx=o,Bx}var zx,e3;function _G(){if(e3)return zx;e3=1;var e=nM(),t=PG(),r=AG(),n=aM(),o=MG(),a=yE(),i=200;function s(u,c,d){var f=-1,h=t,p=u.length,g=!0,b=[],v=b;if(d)g=!1,h=r;else if(p>=i){var x=c?null:o(u);if(x)return a(x);g=!1,h=n,v=new e}else v=c?[]:b;e:for(;++f<p;){var k=u[f],E=c?c(k):k;if(k=d||k!==0?k:0,g&&E===E){for(var j=v.length;j--;)if(v[j]===E)continue e;c&&v.push(E),b.push(k)}else h(v,E,d)||(v!==b&&v.push(E),b.push(k))}return b}return zx=s,zx}var Hx,t3;function IG(){if(t3)return Hx;t3=1;var e=La(),t=_G();function r(n,o){return n&&n.length?t(n,e(o,2)):[]}return Hx=r,Hx}var DG=IG();const r3=mr(DG);function gM(e,t,r){return t===!0?r3(e,r):kt(t)?r3(e,t):e}function ju(e){"@babel/helpers - typeof";return ju=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},ju(e)}var LG=["ref"];function n3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ha(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?n3(Object(r),!0).forEach(function(n){kg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function RG(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,vM(n.key),n)}}function FG(e,t,r){return t&&o3(e.prototype,t),r&&o3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function $G(e,t,r){return t=Cp(t),BG(e,bM()?Reflect.construct(t,r||[],Cp(e).constructor):t.apply(e,r))}function BG(e,t){if(t&&(ju(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zG(e)}function zG(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bM=function(){return!!e})()}function Cp(e){return Cp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cp(e)}function HG(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Iw(e,t)}function Iw(e,t){return Iw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Iw(e,t)}function kg(e,t,r){return t=vM(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vM(e){var t=qG(e,"string");return ju(t)=="symbol"?t:t+""}function qG(e,t){if(ju(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ju(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function UG(e,t){if(e==null)return{};var r=VG(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function VG(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function WG(e){return e.value}function KG(e,t){if(y.isValidElement(e))return y.cloneElement(e,t);if(typeof e=="function")return y.createElement(e,t);t.ref;var r=UG(t,LG);return y.createElement(vE,r)}var a3=1,ka=function(e){function t(){var r;RG(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=$G(this,t,[].concat(o)),kg(r,"lastBoundingBox",{width:-1,height:-1}),r}return HG(t,e),FG(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,n=this.getBBox();n?(Math.abs(n.width-this.lastBoundingBox.width)>a3||Math.abs(n.height-this.lastBoundingBox.height)>a3)&&(this.lastBoundingBox.width=n.width,this.lastBoundingBox.height=n.height,r&&r(n)):(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?Ha({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var n=this.props,o=n.layout,a=n.align,i=n.verticalAlign,s=n.margin,u=n.chartWidth,c=n.chartHeight,d,f;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(a==="center"&&o==="vertical"){var h=this.getBBoxSnapshot();d={left:((u||0)-h.width)/2}}else d=a==="right"?{right:s&&s.right||0}:{left:s&&s.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(i==="middle"){var p=this.getBBoxSnapshot();f={top:((c||0)-p.height)/2}}else f=i==="bottom"?{bottom:s&&s.bottom||0}:{top:s&&s.top||0};return Ha(Ha({},d),f)}},{key:"render",value:function(){var r=this,n=this.props,o=n.content,a=n.width,i=n.height,s=n.wrapperStyle,u=n.payloadUniqBy,c=n.payload,d=Ha(Ha({position:"absolute",width:a||"auto",height:i||"auto"},this.getDefaultPosition(s)),s);return y.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(f){r.wrapperNode=f}},KG(o,Ha(Ha({},this.props),{},{payload:gM(c,u,WG)})))}}],[{key:"getWithHeight",value:function(r,n){var o=Ha(Ha({},this.defaultProps),r.props),a=o.layout;return a==="vertical"&&qe(r.props.height)?{height:r.props.height}:a==="horizontal"?{width:r.props.width||n}:null}}])}(m.PureComponent);kg(ka,"displayName","Legend");kg(ka,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var qx,i3;function YG(){if(i3)return qx;i3=1;var e=Af(),t=xE(),r=co(),n=e?e.isConcatSpreadable:void 0;function o(a){return r(a)||t(a)||!!(n&&a&&a[n])}return qx=o,qx}var Ux,s3;function yM(){if(s3)return Ux;s3=1;var e=sM(),t=YG();function r(n,o,a,i,s){var u=-1,c=n.length;for(a||(a=t),s||(s=[]);++u<c;){var d=n[u];o>0&&a(d)?o>1?r(d,o-1,a,i,s):e(s,d):i||(s[s.length]=d)}return s}return Ux=r,Ux}var Vx,l3;function GG(){if(l3)return Vx;l3=1;function e(t){return function(r,n,o){for(var a=-1,i=Object(r),s=o(r),u=s.length;u--;){var c=s[t?u:++a];if(n(i[c],c,i)===!1)break}return r}}return Vx=e,Vx}var Wx,u3;function XG(){if(u3)return Wx;u3=1;var e=GG(),t=e();return Wx=t,Wx}var Kx,c3;function xM(){if(c3)return Kx;c3=1;var e=XG(),t=xg();function r(n,o){return n&&e(n,o,t)}return Kx=r,Kx}var Yx,d3;function ZG(){if(d3)return Yx;d3=1;var e=Mf();function t(r,n){return function(o,a){if(o==null)return o;if(!e(o))return r(o,a);for(var i=o.length,s=n?i:-1,u=Object(o);(n?s--:++s<i)&&a(u[s],s,u)!==!1;);return o}}return Yx=t,Yx}var Gx,f3;function EE(){if(f3)return Gx;f3=1;var e=xM(),t=ZG(),r=t(e);return Gx=r,Gx}var Xx,m3;function kM(){if(m3)return Xx;m3=1;var e=EE(),t=Mf();function r(n,o){var a=-1,i=t(n)?Array(n.length):[];return e(n,function(s,u,c){i[++a]=o(s,u,c)}),i}return Xx=r,Xx}var Zx,p3;function JG(){if(p3)return Zx;p3=1;function e(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}return Zx=e,Zx}var Jx,h3;function QG(){if(h3)return Jx;h3=1;var e=oc();function t(r,n){if(r!==n){var o=r!==void 0,a=r===null,i=r===r,s=e(r),u=n!==void 0,c=n===null,d=n===n,f=e(n);if(!c&&!f&&!s&&r>n||s&&u&&d&&!c&&!f||a&&u&&d||!o&&d||!i)return 1;if(!a&&!s&&!f&&r<n||f&&o&&i&&!a&&!s||c&&o&&i||!u&&i||!d)return-1}return 0}return Jx=t,Jx}var Qx,g3;function eX(){if(g3)return Qx;g3=1;var e=QG();function t(r,n,o){for(var a=-1,i=r.criteria,s=n.criteria,u=i.length,c=o.length;++a<u;){var d=e(i[a],s[a]);if(d){if(a>=c)return d;var f=o[a];return d*(f=="desc"?-1:1)}}return r.index-n.index}return Qx=t,Qx}var e0,b3;function tX(){if(b3)return e0;b3=1;var e=dE(),t=fE(),r=La(),n=kM(),o=JG(),a=uM(),i=eX(),s=sc(),u=co();function c(d,f,h){f.length?f=e(f,function(b){return u(b)?function(v){return t(v,b.length===1?b[0]:b)}:b}):f=[s];var p=-1;f=e(f,a(r));var g=n(d,function(b,v,x){var k=e(f,function(E){return E(b)});return{criteria:k,index:++p,value:b}});return o(g,function(b,v){return i(b,v,h)})}return e0=c,e0}var t0,v3;function rX(){if(v3)return t0;v3=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return t0=e,t0}var r0,y3;function nX(){if(y3)return r0;y3=1;var e=rX(),t=Math.max;function r(n,o,a){return o=t(o===void 0?n.length-1:o,0),function(){for(var i=arguments,s=-1,u=t(i.length-o,0),c=Array(u);++s<u;)c[s]=i[o+s];s=-1;for(var d=Array(o+1);++s<o;)d[s]=i[s];return d[o]=a(c),e(n,this,d)}}return r0=r,r0}var n0,x3;function oX(){if(x3)return n0;x3=1;function e(t){return function(){return t}}return n0=e,n0}var o0,k3;function wM(){if(k3)return o0;k3=1;var e=yl(),t=function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}}();return o0=t,o0}var a0,w3;function aX(){if(w3)return a0;w3=1;var e=oX(),t=wM(),r=sc(),n=t?function(o,a){return t(o,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return a0=n,a0}var i0,j3;function iX(){if(j3)return i0;j3=1;var e=800,t=16,r=Date.now;function n(o){var a=0,i=0;return function(){var s=r(),u=t-(s-i);if(i=s,u>0){if(++a>=e)return arguments[0]}else a=0;return o.apply(void 0,arguments)}}return i0=n,i0}var s0,E3;function sX(){if(E3)return s0;E3=1;var e=aX(),t=iX(),r=t(e);return s0=r,s0}var l0,N3;function lX(){if(N3)return l0;N3=1;var e=sc(),t=nX(),r=sX();function n(o,a){return r(t(o,a,e),o+"")}return l0=n,l0}var u0,S3;function wg(){if(S3)return u0;S3=1;var e=lE(),t=Mf(),r=kE(),n=ys();function o(a,i,s){if(!n(s))return!1;var u=typeof i;return(u=="number"?t(s)&&r(i,s.length):u=="string"&&i in s)?e(s[i],a):!1}return u0=o,u0}var c0,O3;function uX(){if(O3)return c0;O3=1;var e=yM(),t=tX(),r=lX(),n=wg(),o=r(function(a,i){if(a==null)return[];var s=i.length;return s>1&&n(a,i[0],i[1])?i=[]:s>2&&n(i[0],i[1],i[2])&&(i=[i[0]]),t(a,e(i,1),[])});return c0=o,c0}var cX=uX();const NE=mr(cX);function Ad(e){"@babel/helpers - typeof";return Ad=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},Ad(e)}function Dw(){return Dw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Dw.apply(this,arguments)}function dX(e,t){return hX(e)||pX(e,t)||mX(e,t)||fX()}function fX(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
59
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mX(e,t){if(e){if(typeof e=="string")return C3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C3(e,t)}}function C3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function pX(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function hX(e){if(Array.isArray(e))return e}function P3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function d0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?P3(Object(r),!0).forEach(function(n){gX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gX(e,t,r){return t=bX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bX(e){var t=vX(e,"string");return Ad(t)=="symbol"?t:t+""}function vX(e,t){if(Ad(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ad(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yX(e){return Array.isArray(e)&&xn(e[0])&&xn(e[1])?e.join(" ~ "):e}var xX=function(e){var t=e.separator,r=t===void 0?" : ":t,n=e.contentStyle,o=n===void 0?{}:n,a=e.itemStyle,i=a===void 0?{}:a,s=e.labelStyle,u=s===void 0?{}:s,c=e.payload,d=e.formatter,f=e.itemSorter,h=e.wrapperClassName,p=e.labelClassName,g=e.label,b=e.labelFormatter,v=e.accessibilityLayer,x=v===void 0?!1:v,k=function(){if(c&&c.length){var T={padding:0,margin:0},_=(f?NE(c,f):c).map(function(F,$){if(F.type==="none")return null;var I=d0({display:"block",paddingTop:4,paddingBottom:4,color:F.color||"#000"},i),R=F.formatter||d||yX,W=F.value,B=F.name,L=W,q=B;if(R&&L!=null&&q!=null){var U=R(W,B,F,$,c);if(Array.isArray(U)){var H=dX(U,2);L=H[0],q=H[1]}else L=U}return y.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat($),style:I},xn(q)?y.createElement("span",{className:"recharts-tooltip-item-name"},q):null,xn(q)?y.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,y.createElement("span",{className:"recharts-tooltip-item-value"},L),y.createElement("span",{className:"recharts-tooltip-item-unit"},F.unit||""))});return y.createElement("ul",{className:"recharts-tooltip-item-list",style:T},_)}return null},E=d0({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},o),j=d0({margin:0},u),S=!wt(g),C=S?g:"",O=Dt("recharts-default-tooltip",h),M=Dt("recharts-tooltip-label",p);S&&b&&c!==void 0&&c!==null&&(C=b(g,c));var A=x?{role:"status","aria-live":"assertive"}:{};return y.createElement("div",Dw({className:O,style:E},A),y.createElement("p",{className:M,style:j},y.isValidElement(C)?C:"".concat(C)),k())};function Td(e){"@babel/helpers - typeof";return Td=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},Td(e)}function Nm(e,t,r){return t=kX(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kX(e){var t=wX(e,"string");return Td(t)=="symbol"?t:t+""}function wX(e,t){if(Td(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Td(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ic="recharts-tooltip-wrapper",jX={visibility:"hidden"};function EX(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return Dt(Ic,Nm(Nm(Nm(Nm({},"".concat(Ic,"-right"),qe(r)&&t&&qe(t.x)&&r>=t.x),"".concat(Ic,"-left"),qe(r)&&t&&qe(t.x)&&r<t.x),"".concat(Ic,"-bottom"),qe(n)&&t&&qe(t.y)&&n>=t.y),"".concat(Ic,"-top"),qe(n)&&t&&qe(t.y)&&n<t.y))}function A3(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.key,o=e.offsetTopLeft,a=e.position,i=e.reverseDirection,s=e.tooltipDimension,u=e.viewBox,c=e.viewBoxDimension;if(a&&qe(a[n]))return a[n];var d=r[n]-s-o,f=r[n]+o;if(t[n])return i[n]?d:f;if(i[n]){var h=d,p=u[n];return h<p?Math.max(f,u[n]):Math.max(d,u[n])}var g=f+s,b=u[n]+c;return g>b?Math.max(d,u[n]):Math.max(f,u[n])}function NX(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function SX(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTopLeft,o=e.position,a=e.reverseDirection,i=e.tooltipBox,s=e.useTranslate3d,u=e.viewBox,c,d,f;return i.height>0&&i.width>0&&r?(d=A3({allowEscapeViewBox:t,coordinate:r,key:"x",offsetTopLeft:n,position:o,reverseDirection:a,tooltipDimension:i.width,viewBox:u,viewBoxDimension:u.width}),f=A3({allowEscapeViewBox:t,coordinate:r,key:"y",offsetTopLeft:n,position:o,reverseDirection:a,tooltipDimension:i.height,viewBox:u,viewBoxDimension:u.height}),c=NX({translateX:d,translateY:f,useTranslate3d:s})):c=jX,{cssProperties:c,cssClasses:EX({translateX:d,translateY:f,coordinate:r})}}function Eu(e){"@babel/helpers - typeof";return Eu=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},Eu(e)}function T3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function M3(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?T3(Object(r),!0).forEach(function(n){Rw(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function OX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CX(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,EM(n.key),n)}}function PX(e,t,r){return t&&CX(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function AX(e,t,r){return t=Pp(t),TX(e,jM()?Reflect.construct(t,r||[],Pp(e).constructor):t.apply(e,r))}function TX(e,t){if(t&&(Eu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return MX(e)}function MX(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jM=function(){return!!e})()}function Pp(e){return Pp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Pp(e)}function _X(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Lw(e,t)}function Lw(e,t){return Lw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Lw(e,t)}function Rw(e,t,r){return t=EM(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function EM(e){var t=IX(e,"string");return Eu(t)=="symbol"?t:t+""}function IX(e,t){if(Eu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Eu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var _3=1,DX=function(e){function t(){var r;OX(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=AX(this,t,[].concat(o)),Rw(r,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Rw(r,"handleKeyDown",function(i){if(i.key==="Escape"){var s,u,c,d;r.setState({dismissed:!0,dismissedAtCoordinate:{x:(s=(u=r.props.coordinate)===null||u===void 0?void 0:u.x)!==null&&s!==void 0?s:0,y:(c=(d=r.props.coordinate)===null||d===void 0?void 0:d.y)!==null&&c!==void 0?c:0}})}}),r}return _X(t,e),PX(t,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>_3||Math.abs(r.height-this.state.lastBoundingBox.height)>_3)&&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,n;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((n=this.props.coordinate)===null||n===void 0?void 0:n.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,n=this.props,o=n.active,a=n.allowEscapeViewBox,i=n.animationDuration,s=n.animationEasing,u=n.children,c=n.coordinate,d=n.hasPayload,f=n.isAnimationActive,h=n.offset,p=n.position,g=n.reverseDirection,b=n.useTranslate3d,v=n.viewBox,x=n.wrapperStyle,k=SX({allowEscapeViewBox:a,coordinate:c,offsetTopLeft:h,position:p,reverseDirection:g,tooltipBox:this.state.lastBoundingBox,useTranslate3d:b,viewBox:v}),E=k.cssClasses,j=k.cssProperties,S=M3(M3({transition:f&&o?"transform ".concat(i,"ms ").concat(s):void 0},j),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&d?"visible":"hidden",position:"absolute",top:0,left:0},x);return y.createElement("div",{tabIndex:-1,className:E,style:S,ref:function(C){r.wrapperNode=C}},u)}}])}(m.PureComponent),LX=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},yi={isSsr:LX()};function Nu(e){"@babel/helpers - typeof";return Nu=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},Nu(e)}function I3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function D3(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?I3(Object(r),!0).forEach(function(n){SE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function RX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FX(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,SM(n.key),n)}}function $X(e,t,r){return t&&FX(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function BX(e,t,r){return t=Ap(t),zX(e,NM()?Reflect.construct(t,r||[],Ap(e).constructor):t.apply(e,r))}function zX(e,t){if(t&&(Nu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return HX(e)}function HX(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function NM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(NM=function(){return!!e})()}function Ap(e){return Ap=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ap(e)}function qX(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fw(e,t)}function Fw(e,t){return Fw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Fw(e,t)}function SE(e,t,r){return t=SM(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SM(e){var t=UX(e,"string");return Nu(t)=="symbol"?t:t+""}function UX(e,t){if(Nu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Nu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function VX(e){return e.dataKey}function WX(e,t){return y.isValidElement(e)?y.cloneElement(e,t):typeof e=="function"?y.createElement(e,t):y.createElement(xX,t)}var to=function(e){function t(){return RX(this,t),BX(this,t,arguments)}return qX(t,e),$X(t,[{key:"render",value:function(){var r=this,n=this.props,o=n.active,a=n.allowEscapeViewBox,i=n.animationDuration,s=n.animationEasing,u=n.content,c=n.coordinate,d=n.filterNull,f=n.isAnimationActive,h=n.offset,p=n.payload,g=n.payloadUniqBy,b=n.position,v=n.reverseDirection,x=n.useTranslate3d,k=n.viewBox,E=n.wrapperStyle,j=p??[];d&&j.length&&(j=gM(p.filter(function(C){return C.value!=null&&(C.hide!==!0||r.props.includeHidden)}),g,VX));var S=j.length>0;return y.createElement(DX,{allowEscapeViewBox:a,animationDuration:i,animationEasing:s,isAnimationActive:f,active:o,coordinate:c,hasPayload:S,offset:h,position:b,reverseDirection:v,useTranslate3d:x,viewBox:k,wrapperStyle:E},WX(u,D3(D3({},this.props),{},{payload:j})))}}])}(m.PureComponent);SE(to,"displayName","Tooltip");SE(to,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!yi.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 f0,L3;function KX(){if(L3)return f0;L3=1;var e=Da(),t=function(){return e.Date.now()};return f0=t,f0}var m0,R3;function YX(){if(R3)return m0;R3=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return m0=t,m0}var p0,F3;function GX(){if(F3)return p0;F3=1;var e=YX(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return p0=r,p0}var h0,$3;function OM(){if($3)return h0;$3=1;var e=GX(),t=ys(),r=oc(),n=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt;function u(c){if(typeof c=="number")return c;if(r(c))return n;if(t(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=t(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=e(c);var f=a.test(c);return f||i.test(c)?s(c.slice(2),f?2:8):o.test(c)?n:+c}return h0=u,h0}var g0,B3;function XX(){if(B3)return g0;B3=1;var e=ys(),t=KX(),r=OM(),n="Expected a function",o=Math.max,a=Math.min;function i(s,u,c){var d,f,h,p,g,b,v=0,x=!1,k=!1,E=!0;if(typeof s!="function")throw new TypeError(n);u=r(u)||0,e(c)&&(x=!!c.leading,k="maxWait"in c,h=k?o(r(c.maxWait)||0,u):h,E="trailing"in c?!!c.trailing:E);function j($){var I=d,R=f;return d=f=void 0,v=$,p=s.apply(R,I),p}function S($){return v=$,g=setTimeout(M,u),x?j($):p}function C($){var I=$-b,R=$-v,W=u-I;return k?a(W,h-R):W}function O($){var I=$-b,R=$-v;return b===void 0||I>=u||I<0||k&&R>=h}function M(){var $=t();if(O($))return A($);g=setTimeout(M,C($))}function A($){return g=void 0,E&&d?j($):(d=f=void 0,p)}function T(){g!==void 0&&clearTimeout(g),v=0,d=b=f=g=void 0}function _(){return g===void 0?p:A(t())}function F(){var $=t(),I=O($);if(d=arguments,f=this,b=$,I){if(g===void 0)return S(b);if(k)return clearTimeout(g),g=setTimeout(M,u),j(b)}return g===void 0&&(g=setTimeout(M,u)),p}return F.cancel=T,F.flush=_,F}return g0=i,g0}var b0,z3;function ZX(){if(z3)return b0;z3=1;var e=XX(),t=ys(),r="Expected a function";function n(o,a,i){var s=!0,u=!0;if(typeof o!="function")throw new TypeError(r);return t(i)&&(s="leading"in i?!!i.leading:s,u="trailing"in i?!!i.trailing:u),e(o,a,{leading:s,maxWait:a,trailing:u})}return b0=n,b0}var JX=ZX();const CM=mr(JX);function Md(e){"@babel/helpers - typeof";return Md=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},Md(e)}function H3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Sm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?H3(Object(r),!0).forEach(function(n){QX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):H3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function QX(e,t,r){return t=eZ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eZ(e){var t=tZ(e,"string");return Md(t)=="symbol"?t:t+""}function tZ(e,t){if(Md(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Md(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rZ(e,t){return iZ(e)||aZ(e,t)||oZ(e,t)||nZ()}function nZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
60
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oZ(e,t){if(e){if(typeof e=="string")return q3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q3(e,t)}}function q3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function aZ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function iZ(e){if(Array.isArray(e))return e}var ks=m.forwardRef(function(e,t){var r=e.aspect,n=e.initialDimension,o=n===void 0?{width:-1,height:-1}:n,a=e.width,i=a===void 0?"100%":a,s=e.height,u=s===void 0?"100%":s,c=e.minWidth,d=c===void 0?0:c,f=e.minHeight,h=e.maxHeight,p=e.children,g=e.debounce,b=g===void 0?0:g,v=e.id,x=e.className,k=e.onResize,E=e.style,j=E===void 0?{}:E,S=m.useRef(null),C=m.useRef();C.current=k,m.useImperativeHandle(t,function(){return Object.defineProperty(S.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),S.current},configurable:!0})});var O=m.useState({containerWidth:o.width,containerHeight:o.height}),M=rZ(O,2),A=M[0],T=M[1],_=m.useCallback(function($,I){T(function(R){var W=Math.round($),B=Math.round(I);return R.containerWidth===W&&R.containerHeight===B?R:{containerWidth:W,containerHeight:B}})},[]);m.useEffect(function(){var $=function(L){var q,U=L[0].contentRect,H=U.width,X=U.height;_(H,X),(q=C.current)===null||q===void 0||q.call(C,H,X)};b>0&&($=CM($,b,{trailing:!0,leading:!1}));var I=new ResizeObserver($),R=S.current.getBoundingClientRect(),W=R.width,B=R.height;return _(W,B),I.observe(S.current),function(){I.disconnect()}},[_,b]);var F=m.useMemo(function(){var $=A.containerWidth,I=A.containerHeight;if($<0||I<0)return null;Jo(Zs(i)||Zs(u),`The width(%s) and height(%s) are both fixed numbers,
61
+ maybe you don't need to use a ResponsiveContainer.`,i,u),Jo(!r||r>0,"The aspect(%s) must be greater than zero.",r);var R=Zs(i)?$:i,W=Zs(u)?I:u;r&&r>0&&(R?W=R/r:W&&(R=W*r),h&&W>h&&(W=h)),Jo(R>0||W>0,`The width(%s) and height(%s) of chart should be greater than 0,
62
+ please check the style of container, or the props width(%s) and height(%s),
63
+ or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
64
+ height and width.`,R,W,i,u,d,f,r);var B=!Array.isArray(p)&&ei(p.type).endsWith("Chart");return y.Children.map(p,function(L){return y.isValidElement(L)?m.cloneElement(L,Sm({width:R,height:W},B?{style:Sm({height:"100%",width:"100%",maxHeight:W,maxWidth:R},L.props.style)}:{})):L})},[r,p,u,h,f,d,A,i]);return y.createElement("div",{id:v?"".concat(v):void 0,className:Dt("recharts-responsive-container",x),style:Sm(Sm({},j),{},{width:i,height:u,minWidth:d,minHeight:f,maxHeight:h}),ref:S},F)}),jg=function(e){return null};jg.displayName="Cell";function _d(e){"@babel/helpers - typeof";return _d=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},_d(e)}function U3(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function $w(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U3(Object(r),!0).forEach(function(n){sZ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U3(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function sZ(e,t,r){return t=lZ(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lZ(e){var t=uZ(e,"string");return _d(t)=="symbol"?t:t+""}function uZ(e,t){if(_d(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(_d(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ml={widthCache:{},cacheCount:0},cZ=2e3,dZ={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},V3="recharts_measurement_span";function fZ(e){var t=$w({},e);return Object.keys(t).forEach(function(r){t[r]||delete t[r]}),t}var md=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||yi.isSsr)return{width:0,height:0};var r=fZ(t),n=JSON.stringify({text:e,copyStyle:r});if(Ml.widthCache[n])return Ml.widthCache[n];try{var o=document.getElementById(V3);o||(o=document.createElement("span"),o.setAttribute("id",V3),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var a=$w($w({},dZ),r);Object.assign(o.style,a),o.textContent="".concat(e);var i=o.getBoundingClientRect(),s={width:i.width,height:i.height};return Ml.widthCache[n]=s,++Ml.cacheCount>cZ&&(Ml.cacheCount=0,Ml.widthCache={}),s}catch{return{width:0,height:0}}},mZ=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function Id(e){"@babel/helpers - typeof";return Id=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},Id(e)}function Tp(e,t){return bZ(e)||gZ(e,t)||hZ(e,t)||pZ()}function pZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
65
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hZ(e,t){if(e){if(typeof e=="string")return W3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W3(e,t)}}function W3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function gZ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function bZ(e){if(Array.isArray(e))return e}function vZ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,xZ(n.key),n)}}function yZ(e,t,r){return t&&K3(e.prototype,t),r&&K3(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xZ(e){var t=kZ(e,"string");return Id(t)=="symbol"?t:t+""}function kZ(e,t){if(Id(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Id(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Y3=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,G3=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,wZ=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,jZ=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,PM={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},EZ=Object.keys(PM),Wl="NaN";function NZ(e,t){return e*PM[t]}var Om=function(){function e(t,r){vZ(this,e),this.num=t,this.unit=r,this.num=t,this.unit=r,Number.isNaN(t)&&(this.unit=""),r!==""&&!wZ.test(r)&&(this.num=NaN,this.unit=""),EZ.includes(r)&&(this.num=NZ(t,r),this.unit="px")}return yZ(e,[{key:"add",value:function(t){return this.unit!==t.unit?new e(NaN,""):new e(this.num+t.num,this.unit)}},{key:"subtract",value:function(t){return this.unit!==t.unit?new e(NaN,""):new e(this.num-t.num,this.unit)}},{key:"multiply",value:function(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new e(NaN,""):new e(this.num*t.num,this.unit||t.unit)}},{key:"divide",value:function(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new e(NaN,""):new e(this.num/t.num,this.unit||t.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(t){var r,n=(r=jZ.exec(t))!==null&&r!==void 0?r:[],o=Tp(n,3),a=o[1],i=o[2];return new e(parseFloat(a),i??"")}}])}();function AM(e){if(e.includes(Wl))return Wl;for(var t=e;t.includes("*")||t.includes("/");){var r,n=(r=Y3.exec(t))!==null&&r!==void 0?r:[],o=Tp(n,4),a=o[1],i=o[2],s=o[3],u=Om.parse(a??""),c=Om.parse(s??""),d=i==="*"?u.multiply(c):u.divide(c);if(d.isNaN())return Wl;t=t.replace(Y3,d.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var f,h=(f=G3.exec(t))!==null&&f!==void 0?f:[],p=Tp(h,4),g=p[1],b=p[2],v=p[3],x=Om.parse(g??""),k=Om.parse(v??""),E=b==="+"?x.add(k):x.subtract(k);if(E.isNaN())return Wl;t=t.replace(G3,E.toString())}return t}var X3=/\(([^()]*)\)/;function SZ(e){for(var t=e;t.includes("(");){var r=X3.exec(t),n=Tp(r,2),o=n[1];t=t.replace(X3,AM(o))}return t}function OZ(e){var t=e.replace(/\s+/g,"");return t=SZ(t),t=AM(t),t}function CZ(e){try{return OZ(e)}catch{return Wl}}function v0(e){var t=CZ(e.slice(5,-1));return t===Wl?"":t}var PZ=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],AZ=["dx","dy","angle","className","breakAll"];function Bw(){return Bw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bw.apply(this,arguments)}function Z3(e,t){if(e==null)return{};var r=TZ(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function TZ(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function J3(e,t){return DZ(e)||IZ(e,t)||_Z(e,t)||MZ()}function MZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
66
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Z(e,t){if(e){if(typeof e=="string")return Q3(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Q3(e,t)}}function Q3(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function IZ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function DZ(e){if(Array.isArray(e))return e}var TM=/[ \f\n\r\t\v\u2028\u2029]+/,MM=function(e){var t=e.children,r=e.breakAll,n=e.style;try{var o=[];wt(t)||(r?o=t.toString().split(""):o=t.toString().split(TM));var a=o.map(function(s){return{word:s,width:md(s,n).width}}),i=r?0:md(" ",n).width;return{wordsWithComputedWidth:a,spaceWidth:i}}catch{return null}},LZ=function(e,t,r,n,o){var a=e.maxLines,i=e.children,s=e.style,u=e.breakAll,c=qe(a),d=i,f=function(){var $=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return $.reduce(function(I,R){var W=R.word,B=R.width,L=I[I.length-1];if(L&&(n==null||o||L.width+B+r<Number(n)))L.words.push(W),L.width+=B+r;else{var q={words:[W],width:B};I.push(q)}return I},[])},h=f(t),p=function($){return $.reduce(function(I,R){return I.width>R.width?I:R})};if(!c)return h;for(var g="…",b=function($){var I=d.slice(0,$),R=MM({breakAll:u,style:s,children:I+g}).wordsWithComputedWidth,W=f(R),B=W.length>a||p(W).width>Number(n);return[B,W]},v=0,x=d.length-1,k=0,E;v<=x&&k<=d.length-1;){var j=Math.floor((v+x)/2),S=j-1,C=b(S),O=J3(C,2),M=O[0],A=O[1],T=b(j),_=J3(T,1),F=_[0];if(!M&&!F&&(v=j+1),M&&F&&(x=j-1),!M&&F){E=A;break}k++}return E||h},eC=function(e){var t=wt(e)?[]:e.toString().split(TM);return[{words:t}]},RZ=function(e){var t=e.width,r=e.scaleToFit,n=e.children,o=e.style,a=e.breakAll,i=e.maxLines;if((t||r)&&!yi.isSsr){var s,u,c=MM({breakAll:a,children:n,style:o});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;s=d,u=f}else return eC(n);return LZ({breakAll:a,children:n,maxLines:i,style:o},s,u,t,r)}return eC(n)},tC="#808080",dl=function(e){var t=e.x,r=t===void 0?0:t,n=e.y,o=n===void 0?0:n,a=e.lineHeight,i=a===void 0?"1em":a,s=e.capHeight,u=s===void 0?"0.71em":s,c=e.scaleToFit,d=c===void 0?!1:c,f=e.textAnchor,h=f===void 0?"start":f,p=e.verticalAnchor,g=p===void 0?"end":p,b=e.fill,v=b===void 0?tC:b,x=Z3(e,PZ),k=m.useMemo(function(){return RZ({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:d,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,d,x.style,x.width]),E=x.dx,j=x.dy,S=x.angle,C=x.className,O=x.breakAll,M=Z3(x,AZ);if(!xn(r)||!xn(o))return null;var A=r+(qe(E)?E:0),T=o+(qe(j)?j:0),_;switch(g){case"start":_=v0("calc(".concat(u,")"));break;case"middle":_=v0("calc(".concat((k.length-1)/2," * -").concat(i," + (").concat(u," / 2))"));break;default:_=v0("calc(".concat(k.length-1," * -").concat(i,")"));break}var F=[];if(d){var $=k[0].width,I=x.width;F.push("scale(".concat((qe(I)?I/$:1)/$,")"))}return S&&F.push("rotate(".concat(S,", ").concat(A,", ").concat(T,")")),F.length&&(M.transform=F.join(" ")),y.createElement("text",Bw({},ft(M,!0),{x:A,y:T,className:Dt("recharts-text",C),textAnchor:h,fill:v.includes("url")?tC:v}),k.map(function(R,W){var B=R.words.join(O?"":" ");return y.createElement("tspan",{x:A,dy:W===0?_:i,key:"".concat(B,"-").concat(W)},B)}))};function es(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function FZ(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function OE(e){let t,r,n;e.length!==2?(t=es,r=(s,u)=>es(e(s),u),n=(s,u)=>e(s)-u):(t=e===es||e===FZ?e:$Z,r=e,n=e);function o(s,u,c=0,d=s.length){if(c<d){if(t(u,u)!==0)return d;do{const f=c+d>>>1;r(s[f],u)<0?c=f+1:d=f}while(c<d)}return c}function a(s,u,c=0,d=s.length){if(c<d){if(t(u,u)!==0)return d;do{const f=c+d>>>1;r(s[f],u)<=0?c=f+1:d=f}while(c<d)}return c}function i(s,u,c=0,d=s.length){const f=o(s,u,c,d-1);return f>c&&n(s[f-1],u)>-n(s[f],u)?f-1:f}return{left:o,center:i,right:a}}function $Z(){return 0}function _M(e){return e===null?NaN:+e}function*BZ(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const zZ=OE(es),_f=zZ.right;OE(_M).center;class rC extends Map{constructor(t,r=UZ){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,o]of t)this.set(n,o)}get(t){return super.get(nC(this,t))}has(t){return super.has(nC(this,t))}set(t,r){return super.set(HZ(this,t),r)}delete(t){return super.delete(qZ(this,t))}}function nC({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function HZ({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function qZ({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function UZ(e){return e!==null&&typeof e=="object"?e.valueOf():e}function VZ(e=es){if(e===es)return IM;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function IM(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const WZ=Math.sqrt(50),KZ=Math.sqrt(10),YZ=Math.sqrt(2);function Mp(e,t,r){const n=(t-e)/Math.max(0,r),o=Math.floor(Math.log10(n)),a=n/Math.pow(10,o),i=a>=WZ?10:a>=KZ?5:a>=YZ?2:1;let s,u,c;return o<0?(c=Math.pow(10,-o)/i,s=Math.round(e*c),u=Math.round(t*c),s/c<e&&++s,u/c>t&&--u,c=-c):(c=Math.pow(10,o)*i,s=Math.round(e/c),u=Math.round(t/c),s*c<e&&++s,u*c>t&&--u),u<s&&.5<=r&&r<2?Mp(e,t,r*2):[s,u,c]}function zw(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[o,a,i]=n?Mp(t,e,r):Mp(e,t,r);if(!(a>=o))return[];const s=a-o+1,u=new Array(s);if(n)if(i<0)for(let c=0;c<s;++c)u[c]=(a-c)/-i;else for(let c=0;c<s;++c)u[c]=(a-c)*i;else if(i<0)for(let c=0;c<s;++c)u[c]=(o+c)/-i;else for(let c=0;c<s;++c)u[c]=(o+c)*i;return u}function Hw(e,t,r){return t=+t,e=+e,r=+r,Mp(e,t,r)[2]}function qw(e,t,r){t=+t,e=+e,r=+r;const n=t<e,o=n?Hw(t,e,r):Hw(e,t,r);return(n?-1:1)*(o<0?1/-o:o)}function oC(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function aC(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function DM(e,t,r=0,n=1/0,o){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(o=o===void 0?IM:VZ(o);n>r;){if(n-r>600){const u=n-r+1,c=t-r+1,d=Math.log(u),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(u-f)/u)*(c-u/2<0?-1:1),p=Math.max(r,Math.floor(t-c*f/u+h)),g=Math.min(n,Math.floor(t+(u-c)*f/u+h));DM(e,t,p,g,o)}const a=e[t];let i=r,s=n;for(Dc(e,r,t),o(e[n],a)>0&&Dc(e,r,n);i<s;){for(Dc(e,i,s),++i,--s;o(e[i],a)<0;)++i;for(;o(e[s],a)>0;)--s}o(e[r],a)===0?Dc(e,r,s):(++s,Dc(e,s,n)),s<=t&&(r=s+1),t<=s&&(n=s-1)}return e}function Dc(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function GZ(e,t,r){if(e=Float64Array.from(BZ(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return aC(e);if(t>=1)return oC(e);var n,o=(n-1)*t,a=Math.floor(o),i=oC(DM(e,a).subarray(0,a+1)),s=aC(e.subarray(a+1));return i+(s-i)*(o-a)}}function XZ(e,t,r=_M){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,o=(n-1)*t,a=Math.floor(o),i=+r(e[a],a,e),s=+r(e[a+1],a+1,e);return i+(s-i)*(o-a)}}function ZZ(e,t,r){e=+e,t=+t,r=(o=arguments.length)<2?(t=e,e=0,1):o<3?1:+r;for(var n=-1,o=Math.max(0,Math.ceil((t-e)/r))|0,a=new Array(o);++n<o;)a[n]=e+n*r;return a}function Uo(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function xi(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Uw=Symbol("implicit");function CE(){var e=new rC,t=[],r=[],n=Uw;function o(a){let i=e.get(a);if(i===void 0){if(n!==Uw)return n;e.set(a,i=t.push(a)-1)}return r[i%r.length]}return o.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new rC;for(const i of a)e.has(i)||e.set(i,t.push(i)-1);return o},o.range=function(a){return arguments.length?(r=Array.from(a),o):r.slice()},o.unknown=function(a){return arguments.length?(n=a,o):n},o.copy=function(){return CE(t,r).unknown(n)},Uo.apply(o,arguments),o}function Dd(){var e=CE().unknown(void 0),t=e.domain,r=e.range,n=0,o=1,a,i,s=!1,u=0,c=0,d=.5;delete e.unknown;function f(){var h=t().length,p=o<n,g=p?o:n,b=p?n:o;a=(b-g)/Math.max(1,h-u+c*2),s&&(a=Math.floor(a)),g+=(b-g-a*(h-u))*d,i=a*(1-u),s&&(g=Math.round(g),i=Math.round(i));var v=ZZ(h).map(function(x){return g+a*x});return r(p?v.reverse():v)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([n,o]=h,n=+n,o=+o,f()):[n,o]},e.rangeRound=function(h){return[n,o]=h,n=+n,o=+o,s=!0,f()},e.bandwidth=function(){return i},e.step=function(){return a},e.round=function(h){return arguments.length?(s=!!h,f()):s},e.padding=function(h){return arguments.length?(u=Math.min(1,c=+h),f()):u},e.paddingInner=function(h){return arguments.length?(u=Math.min(1,h),f()):u},e.paddingOuter=function(h){return arguments.length?(c=+h,f()):c},e.align=function(h){return arguments.length?(d=Math.max(0,Math.min(1,h)),f()):d},e.copy=function(){return Dd(t(),[n,o]).round(s).paddingInner(u).paddingOuter(c).align(d)},Uo.apply(f(),arguments)}function LM(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return LM(t())},e}function pd(){return LM(Dd.apply(null,arguments).paddingInner(1))}function PE(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function RM(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function If(){}var Ld=.7,_p=1/Ld,iu="\\s*([+-]?\\d+)\\s*",Rd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",JZ=/^#([0-9a-f]{3,8})$/,QZ=new RegExp(`^rgb\\(${iu},${iu},${iu}\\)$`),eJ=new RegExp(`^rgb\\(${wa},${wa},${wa}\\)$`),tJ=new RegExp(`^rgba\\(${iu},${iu},${iu},${Rd}\\)$`),rJ=new RegExp(`^rgba\\(${wa},${wa},${wa},${Rd}\\)$`),nJ=new RegExp(`^hsl\\(${Rd},${wa},${wa}\\)$`),oJ=new RegExp(`^hsla\\(${Rd},${wa},${wa},${Rd}\\)$`),iC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};PE(If,Fd,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sC,formatHex:sC,formatHex8:aJ,formatHsl:iJ,formatRgb:lC,toString:lC});function sC(){return this.rgb().formatHex()}function aJ(){return this.rgb().formatHex8()}function iJ(){return FM(this).formatHsl()}function lC(){return this.rgb().formatRgb()}function Fd(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=JZ.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?uC(t):r===3?new no(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Cm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Cm(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=QZ.exec(e))?new no(t[1],t[2],t[3],1):(t=eJ.exec(e))?new no(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tJ.exec(e))?Cm(t[1],t[2],t[3],t[4]):(t=rJ.exec(e))?Cm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nJ.exec(e))?fC(t[1],t[2]/100,t[3]/100,1):(t=oJ.exec(e))?fC(t[1],t[2]/100,t[3]/100,t[4]):iC.hasOwnProperty(e)?uC(iC[e]):e==="transparent"?new no(NaN,NaN,NaN,0):null}function uC(e){return new no(e>>16&255,e>>8&255,e&255,1)}function Cm(e,t,r,n){return n<=0&&(e=t=r=NaN),new no(e,t,r,n)}function sJ(e){return e instanceof If||(e=Fd(e)),e?(e=e.rgb(),new no(e.r,e.g,e.b,e.opacity)):new no}function Vw(e,t,r,n){return arguments.length===1?sJ(e):new no(e,t,r,n??1)}function no(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}PE(no,Vw,RM(If,{brighter(e){return e=e==null?_p:Math.pow(_p,e),new no(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ld:Math.pow(Ld,e),new no(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new no(nl(this.r),nl(this.g),nl(this.b),Ip(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:cC,formatHex:cC,formatHex8:lJ,formatRgb:dC,toString:dC}));function cC(){return`#${Js(this.r)}${Js(this.g)}${Js(this.b)}`}function lJ(){return`#${Js(this.r)}${Js(this.g)}${Js(this.b)}${Js((isNaN(this.opacity)?1:this.opacity)*255)}`}function dC(){const e=Ip(this.opacity);return`${e===1?"rgb(":"rgba("}${nl(this.r)}, ${nl(this.g)}, ${nl(this.b)}${e===1?")":`, ${e})`}`}function Ip(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Js(e){return e=nl(e),(e<16?"0":"")+e.toString(16)}function fC(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Zo(e,t,r,n)}function FM(e){if(e instanceof Zo)return new Zo(e.h,e.s,e.l,e.opacity);if(e instanceof If||(e=Fd(e)),!e)return new Zo;if(e instanceof Zo)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,o=Math.min(t,r,n),a=Math.max(t,r,n),i=NaN,s=a-o,u=(a+o)/2;return s?(t===a?i=(r-n)/s+(r<n)*6:r===a?i=(n-t)/s+2:i=(t-r)/s+4,s/=u<.5?a+o:2-a-o,i*=60):s=u>0&&u<1?0:i,new Zo(i,s,u,e.opacity)}function uJ(e,t,r,n){return arguments.length===1?FM(e):new Zo(e,t,r,n??1)}function Zo(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}PE(Zo,uJ,RM(If,{brighter(e){return e=e==null?_p:Math.pow(_p,e),new Zo(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ld:Math.pow(Ld,e),new Zo(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,r=this.l,n=r+(r<.5?r:1-r)*t,o=2*r-n;return new no(y0(e>=240?e-240:e+120,o,n),y0(e,o,n),y0(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new Zo(mC(this.h),Pm(this.s),Pm(this.l),Ip(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=Ip(this.opacity);return`${e===1?"hsl(":"hsla("}${mC(this.h)}, ${Pm(this.s)*100}%, ${Pm(this.l)*100}%${e===1?")":`, ${e})`}`}}));function mC(e){return e=(e||0)%360,e<0?e+360:e}function Pm(e){return Math.max(0,Math.min(1,e||0))}function y0(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const AE=e=>()=>e;function cJ(e,t){return function(r){return e+r*t}}function dJ(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function fJ(e){return(e=+e)==1?$M:function(t,r){return r-t?dJ(t,r,e):AE(isNaN(t)?r:t)}}function $M(e,t){var r=t-e;return r?cJ(e,r):AE(isNaN(e)?t:e)}const pC=function e(t){var r=fJ(t);function n(o,a){var i=r((o=Vw(o)).r,(a=Vw(a)).r),s=r(o.g,a.g),u=r(o.b,a.b),c=$M(o.opacity,a.opacity);return function(d){return o.r=i(d),o.g=s(d),o.b=u(d),o.opacity=c(d),o+""}}return n.gamma=e,n}(1);function mJ(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),o;return function(a){for(o=0;o<r;++o)n[o]=e[o]*(1-a)+t[o]*a;return n}}function pJ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function hJ(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,o=new Array(n),a=new Array(r),i;for(i=0;i<n;++i)o[i]=lc(e[i],t[i]);for(;i<r;++i)a[i]=t[i];return function(s){for(i=0;i<n;++i)a[i]=o[i](s);return a}}function gJ(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Dp(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function bJ(e,t){var r={},n={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?r[o]=lc(e[o],t[o]):n[o]=t[o];return function(a){for(o in r)n[o]=r[o](a);return n}}var Ww=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,x0=new RegExp(Ww.source,"g");function vJ(e){return function(){return e}}function yJ(e){return function(t){return e(t)+""}}function xJ(e,t){var r=Ww.lastIndex=x0.lastIndex=0,n,o,a,i=-1,s=[],u=[];for(e=e+"",t=t+"";(n=Ww.exec(e))&&(o=x0.exec(t));)(a=o.index)>r&&(a=t.slice(r,a),s[i]?s[i]+=a:s[++i]=a),(n=n[0])===(o=o[0])?s[i]?s[i]+=o:s[++i]=o:(s[++i]=null,u.push({i,x:Dp(n,o)})),r=x0.lastIndex;return r<t.length&&(a=t.slice(r),s[i]?s[i]+=a:s[++i]=a),s.length<2?u[0]?yJ(u[0].x):vJ(t):(t=u.length,function(c){for(var d=0,f;d<t;++d)s[(f=u[d]).i]=f.x(c);return s.join("")})}function lc(e,t){var r=typeof t,n;return t==null||r==="boolean"?AE(t):(r==="number"?Dp:r==="string"?(n=Fd(t))?(t=n,pC):xJ:t instanceof Fd?pC:t instanceof Date?gJ:pJ(t)?mJ:Array.isArray(t)?hJ:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?bJ:Dp)(e,t)}function TE(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function kJ(e,t){t===void 0&&(t=e,e=lc);for(var r=0,n=t.length-1,o=t[0],a=new Array(n<0?0:n);r<n;)a[r]=e(o,o=t[++r]);return function(i){var s=Math.max(0,Math.min(n-1,Math.floor(i*=n)));return a[s](i-s)}}function wJ(e){return function(){return e}}function Lp(e){return+e}var hC=[0,1];function Xn(e){return e}function Kw(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:wJ(isNaN(t)?NaN:.5)}function jJ(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function EJ(e,t,r){var n=e[0],o=e[1],a=t[0],i=t[1];return o<n?(n=Kw(o,n),a=r(i,a)):(n=Kw(n,o),a=r(a,i)),function(s){return a(n(s))}}function NJ(e,t,r){var n=Math.min(e.length,t.length)-1,o=new Array(n),a=new Array(n),i=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++i<n;)o[i]=Kw(e[i],e[i+1]),a[i]=r(t[i],t[i+1]);return function(s){var u=_f(e,s,1,n)-1;return a[u](o[u](s))}}function Df(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Eg(){var e=hC,t=hC,r=lc,n,o,a,i=Xn,s,u,c;function d(){var h=Math.min(e.length,t.length);return i!==Xn&&(i=jJ(e[0],e[h-1])),s=h>2?NJ:EJ,u=c=null,f}function f(h){return h==null||isNaN(h=+h)?a:(u||(u=s(e.map(n),t,r)))(n(i(h)))}return f.invert=function(h){return i(o((c||(c=s(t,e.map(n),Dp)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,Lp),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),r=TE,d()},f.clamp=function(h){return arguments.length?(i=h?!0:Xn,d()):i!==Xn},f.interpolate=function(h){return arguments.length?(r=h,d()):r},f.unknown=function(h){return arguments.length?(a=h,f):a},function(h,p){return n=h,o=p,d()}}function ME(){return Eg()(Xn,Xn)}function SJ(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Rp(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Su(e){return e=Rp(Math.abs(e)),e?e[1]:NaN}function OJ(e,t){return function(r,n){for(var o=r.length,a=[],i=0,s=e[0],u=0;o>0&&s>0&&(u+s+1>n&&(s=Math.max(1,n-u)),a.push(r.substring(o-=s,o+s)),!((u+=s+1)>n));)s=e[i=(i+1)%e.length];return a.reverse().join(t)}}function CJ(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var PJ=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $d(e){if(!(t=PJ.exec(e)))throw new Error("invalid format: "+e);var t;return new _E({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]})}$d.prototype=_E.prototype;function _E(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+""}_E.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 AJ(e){e:for(var t=e.length,r=1,n=-1,o;r<t;++r)switch(e[r]){case".":n=o=r;break;case"0":n===0&&(n=r),o=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(o+1):e}var BM;function TJ(e,t){var r=Rp(e,t);if(!r)return e+"";var n=r[0],o=r[1],a=o-(BM=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,i=n.length;return a===i?n:a>i?n+new Array(a-i+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+Rp(e,Math.max(0,t+a-1))[0]}function gC(e,t){var r=Rp(e,t);if(!r)return e+"";var n=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+n:n.length>o+1?n.slice(0,o+1)+"."+n.slice(o+1):n+new Array(o-n.length+2).join("0")}const bC={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:SJ,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)=>gC(e*100,t),r:gC,s:TJ,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function vC(e){return e}var yC=Array.prototype.map,xC=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function MJ(e){var t=e.grouping===void 0||e.thousands===void 0?vC:OJ(yC.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?vC:CJ(yC.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"−":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function c(f){f=$d(f);var h=f.fill,p=f.align,g=f.sign,b=f.symbol,v=f.zero,x=f.width,k=f.comma,E=f.precision,j=f.trim,S=f.type;S==="n"?(k=!0,S="g"):bC[S]||(E===void 0&&(E=12),j=!0,S="g"),(v||h==="0"&&p==="=")&&(v=!0,h="0",p="=");var C=b==="$"?r:b==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",O=b==="$"?n:/[%p]/.test(S)?i:"",M=bC[S],A=/[defgprs%]/.test(S);E=E===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,E)):Math.max(0,Math.min(20,E));function T(_){var F=C,$=O,I,R,W;if(S==="c")$=M(_)+$,_="";else{_=+_;var B=_<0||1/_<0;if(_=isNaN(_)?u:M(Math.abs(_),E),j&&(_=AJ(_)),B&&+_==0&&g!=="+"&&(B=!1),F=(B?g==="("?g:s:g==="-"||g==="("?"":g)+F,$=(S==="s"?xC[8+BM/3]:"")+$+(B&&g==="("?")":""),A){for(I=-1,R=_.length;++I<R;)if(W=_.charCodeAt(I),48>W||W>57){$=(W===46?o+_.slice(I+1):_.slice(I))+$,_=_.slice(0,I);break}}}k&&!v&&(_=t(_,1/0));var L=F.length+_.length+$.length,q=L<x?new Array(x-L+1).join(h):"";switch(k&&v&&(_=t(q+_,q.length?x-$.length:1/0),q=""),p){case"<":_=F+_+$+q;break;case"=":_=F+q+_+$;break;case"^":_=q.slice(0,L=q.length>>1)+F+_+$+q.slice(L);break;default:_=q+F+_+$;break}return a(_)}return T.toString=function(){return f+""},T}function d(f,h){var p=c((f=$d(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(Su(h)/3)))*3,b=Math.pow(10,-g),v=xC[8+g/3];return function(x){return p(b*x)+v}}return{format:c,formatPrefix:d}}var Am,IE,zM;_J({thousands:",",grouping:[3],currency:["$",""]});function _J(e){return Am=MJ(e),IE=Am.format,zM=Am.formatPrefix,Am}function IJ(e){return Math.max(0,-Su(Math.abs(e)))}function DJ(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Su(t)/3)))*3-Su(Math.abs(e)))}function LJ(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Su(t)-Su(e))+1}function HM(e,t,r,n){var o=qw(e,t,r),a;switch(n=$d(n??",f"),n.type){case"s":{var i=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(a=DJ(o,i))&&(n.precision=a),zM(n,i)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=LJ(o,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=IJ(o))&&(n.precision=a-(n.type==="%")*2);break}}return IE(n)}function ws(e){var t=e.domain;return e.ticks=function(r){var n=t();return zw(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var o=t();return HM(o[0],o[o.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),o=0,a=n.length-1,i=n[o],s=n[a],u,c,d=10;for(s<i&&(c=i,i=s,s=c,c=o,o=a,a=c);d-- >0;){if(c=Hw(i,s,r),c===u)return n[o]=i,n[a]=s,t(n);if(c>0)i=Math.floor(i/c)*c,s=Math.ceil(s/c)*c;else if(c<0)i=Math.ceil(i*c)/c,s=Math.floor(s*c)/c;else break;u=c}return e},e}function Fp(){var e=ME();return e.copy=function(){return Df(e,Fp())},Uo.apply(e,arguments),ws(e)}function qM(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,Lp),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return qM(e).unknown(t)},e=arguments.length?Array.from(e,Lp):[0,1],ws(r)}function UM(e,t){e=e.slice();var r=0,n=e.length-1,o=e[r],a=e[n],i;return a<o&&(i=r,r=n,n=i,i=o,o=a,a=i),e[r]=t.floor(o),e[n]=t.ceil(a),e}function kC(e){return Math.log(e)}function wC(e){return Math.exp(e)}function RJ(e){return-Math.log(-e)}function FJ(e){return-Math.exp(-e)}function $J(e){return isFinite(e)?+("1e"+e):e<0?0:e}function BJ(e){return e===10?$J:e===Math.E?Math.exp:t=>Math.pow(e,t)}function zJ(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 jC(e){return(t,r)=>-e(-t,r)}function DE(e){const t=e(kC,wC),r=t.domain;let n=10,o,a;function i(){return o=zJ(n),a=BJ(n),r()[0]<0?(o=jC(o),a=jC(a),e(RJ,FJ)):e(kC,wC),t}return t.base=function(s){return arguments.length?(n=+s,i()):n},t.domain=function(s){return arguments.length?(r(s),i()):r()},t.ticks=s=>{const u=r();let c=u[0],d=u[u.length-1];const f=d<c;f&&([c,d]=[d,c]);let h=o(c),p=o(d),g,b;const v=s==null?10:+s;let x=[];if(!(n%1)&&p-h<v){if(h=Math.floor(h),p=Math.ceil(p),c>0){for(;h<=p;++h)for(g=1;g<n;++g)if(b=h<0?g/a(-h):g*a(h),!(b<c)){if(b>d)break;x.push(b)}}else for(;h<=p;++h)for(g=n-1;g>=1;--g)if(b=h>0?g/a(-h):g*a(h),!(b<c)){if(b>d)break;x.push(b)}x.length*2<v&&(x=zw(c,d,v))}else x=zw(h,p,Math.min(p-h,v)).map(a);return f?x.reverse():x},t.tickFormat=(s,u)=>{if(s==null&&(s=10),u==null&&(u=n===10?"s":","),typeof u!="function"&&(!(n%1)&&(u=$d(u)).precision==null&&(u.trim=!0),u=IE(u)),s===1/0)return u;const c=Math.max(1,n*s/t.ticks().length);return d=>{let f=d/a(Math.round(o(d)));return f*n<n-.5&&(f*=n),f<=c?u(d):""}},t.nice=()=>r(UM(r(),{floor:s=>a(Math.floor(o(s))),ceil:s=>a(Math.ceil(o(s)))})),t}function VM(){const e=DE(Eg()).domain([1,10]);return e.copy=()=>Df(e,VM()).base(e.base()),Uo.apply(e,arguments),e}function EC(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function NC(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function LE(e){var t=1,r=e(EC(t),NC(t));return r.constant=function(n){return arguments.length?e(EC(t=+n),NC(t)):t},ws(r)}function WM(){var e=LE(Eg());return e.copy=function(){return Df(e,WM()).constant(e.constant())},Uo.apply(e,arguments)}function SC(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function HJ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function qJ(e){return e<0?-e*e:e*e}function RE(e){var t=e(Xn,Xn),r=1;function n(){return r===1?e(Xn,Xn):r===.5?e(HJ,qJ):e(SC(r),SC(1/r))}return t.exponent=function(o){return arguments.length?(r=+o,n()):r},ws(t)}function FE(){var e=RE(Eg());return e.copy=function(){return Df(e,FE()).exponent(e.exponent())},Uo.apply(e,arguments),e}function UJ(){return FE.apply(null,arguments).exponent(.5)}function OC(e){return Math.sign(e)*e*e}function VJ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function KM(){var e=ME(),t=[0,1],r=!1,n;function o(a){var i=VJ(e(a));return isNaN(i)?n:r?Math.round(i):i}return o.invert=function(a){return e.invert(OC(a))},o.domain=function(a){return arguments.length?(e.domain(a),o):e.domain()},o.range=function(a){return arguments.length?(e.range((t=Array.from(a,Lp)).map(OC)),o):t.slice()},o.rangeRound=function(a){return o.range(a).round(!0)},o.round=function(a){return arguments.length?(r=!!a,o):r},o.clamp=function(a){return arguments.length?(e.clamp(a),o):e.clamp()},o.unknown=function(a){return arguments.length?(n=a,o):n},o.copy=function(){return KM(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},Uo.apply(o,arguments),ws(o)}function YM(){var e=[],t=[],r=[],n;function o(){var i=0,s=Math.max(1,t.length);for(r=new Array(s-1);++i<s;)r[i-1]=XZ(e,i/s);return a}function a(i){return i==null||isNaN(i=+i)?n:t[_f(r,i)]}return a.invertExtent=function(i){var s=t.indexOf(i);return s<0?[NaN,NaN]:[s>0?r[s-1]:e[0],s<r.length?r[s]:e[e.length-1]]},a.domain=function(i){if(!arguments.length)return e.slice();e=[];for(let s of i)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(es),o()},a.range=function(i){return arguments.length?(t=Array.from(i),o()):t.slice()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.quantiles=function(){return r.slice()},a.copy=function(){return YM().domain(e).range(t).unknown(n)},Uo.apply(a,arguments)}function GM(){var e=0,t=1,r=1,n=[.5],o=[0,1],a;function i(u){return u!=null&&u<=u?o[_f(n,u,0,r)]:a}function s(){var u=-1;for(n=new Array(r);++u<r;)n[u]=((u+1)*t-(u-r)*e)/(r+1);return i}return i.domain=function(u){return arguments.length?([e,t]=u,e=+e,t=+t,s()):[e,t]},i.range=function(u){return arguments.length?(r=(o=Array.from(u)).length-1,s()):o.slice()},i.invertExtent=function(u){var c=o.indexOf(u);return c<0?[NaN,NaN]:c<1?[e,n[0]]:c>=r?[n[r-1],t]:[n[c-1],n[c]]},i.unknown=function(u){return arguments.length&&(a=u),i},i.thresholds=function(){return n.slice()},i.copy=function(){return GM().domain([e,t]).range(o).unknown(a)},Uo.apply(ws(i),arguments)}function XM(){var e=[.5],t=[0,1],r,n=1;function o(a){return a!=null&&a<=a?t[_f(e,a,0,n)]:r}return o.domain=function(a){return arguments.length?(e=Array.from(a),n=Math.min(e.length,t.length-1),o):e.slice()},o.range=function(a){return arguments.length?(t=Array.from(a),n=Math.min(e.length,t.length-1),o):t.slice()},o.invertExtent=function(a){var i=t.indexOf(a);return[e[i-1],e[i]]},o.unknown=function(a){return arguments.length?(r=a,o):r},o.copy=function(){return XM().domain(e).range(t).unknown(r)},Uo.apply(o,arguments)}const k0=new Date,w0=new Date;function wn(e,t,r,n){function o(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return o.floor=a=>(e(a=new Date(+a)),a),o.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),o.round=a=>{const i=o(a),s=o.ceil(a);return a-i<s-a?i:s},o.offset=(a,i)=>(t(a=new Date(+a),i==null?1:Math.floor(i)),a),o.range=(a,i,s)=>{const u=[];if(a=o.ceil(a),s=s==null?1:Math.floor(s),!(a<i)||!(s>0))return u;let c;do u.push(c=new Date(+a)),t(a,s),e(a);while(c<a&&a<i);return u},o.filter=a=>wn(i=>{if(i>=i)for(;e(i),!a(i);)i.setTime(i-1)},(i,s)=>{if(i>=i)if(s<0)for(;++s<=0;)for(;t(i,-1),!a(i););else for(;--s>=0;)for(;t(i,1),!a(i););}),r&&(o.count=(a,i)=>(k0.setTime(+a),w0.setTime(+i),e(k0),e(w0),Math.floor(r(k0,w0))),o.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?o.filter(n?i=>n(i)%a===0:i=>o.count(0,i)%a===0):o)),o}const $p=wn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);$p.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?wn(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):$p);$p.range;const Ya=1e3,Ro=Ya*60,Ga=Ro*60,ci=Ga*24,$E=ci*7,CC=ci*30,j0=ci*365,Qs=wn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ya)},(e,t)=>(t-e)/Ya,e=>e.getUTCSeconds());Qs.range;const BE=wn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ya)},(e,t)=>{e.setTime(+e+t*Ro)},(e,t)=>(t-e)/Ro,e=>e.getMinutes());BE.range;const zE=wn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ro)},(e,t)=>(t-e)/Ro,e=>e.getUTCMinutes());zE.range;const HE=wn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ya-e.getMinutes()*Ro)},(e,t)=>{e.setTime(+e+t*Ga)},(e,t)=>(t-e)/Ga,e=>e.getHours());HE.range;const qE=wn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Ga)},(e,t)=>(t-e)/Ga,e=>e.getUTCHours());qE.range;const Lf=wn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ro)/ci,e=>e.getDate()-1);Lf.range;const Ng=wn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ci,e=>e.getUTCDate()-1);Ng.range;const ZM=wn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ci,e=>Math.floor(e/ci));ZM.range;function xl(e){return wn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Ro)/$E)}const Sg=xl(0),Bp=xl(1),WJ=xl(2),KJ=xl(3),Ou=xl(4),YJ=xl(5),GJ=xl(6);Sg.range;Bp.range;WJ.range;KJ.range;Ou.range;YJ.range;GJ.range;function kl(e){return wn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/$E)}const Og=kl(0),zp=kl(1),XJ=kl(2),ZJ=kl(3),Cu=kl(4),JJ=kl(5),QJ=kl(6);Og.range;zp.range;XJ.range;ZJ.range;Cu.range;JJ.range;QJ.range;const UE=wn(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());UE.range;const VE=wn(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());VE.range;const di=wn(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());di.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:wn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});di.range;const fi=wn(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());fi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:wn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});fi.range;function JM(e,t,r,n,o,a){const i=[[Qs,1,Ya],[Qs,5,5*Ya],[Qs,15,15*Ya],[Qs,30,30*Ya],[a,1,Ro],[a,5,5*Ro],[a,15,15*Ro],[a,30,30*Ro],[o,1,Ga],[o,3,3*Ga],[o,6,6*Ga],[o,12,12*Ga],[n,1,ci],[n,2,2*ci],[r,1,$E],[t,1,CC],[t,3,3*CC],[e,1,j0]];function s(c,d,f){const h=d<c;h&&([c,d]=[d,c]);const p=f&&typeof f.range=="function"?f:u(c,d,f),g=p?p.range(c,+d+1):[];return h?g.reverse():g}function u(c,d,f){const h=Math.abs(d-c)/f,p=OE(([,,v])=>v).right(i,h);if(p===i.length)return e.every(qw(c/j0,d/j0,f));if(p===0)return $p.every(Math.max(qw(c,d,f),1));const[g,b]=i[h/i[p-1][2]<i[p][2]/h?p-1:p];return g.every(b)}return[s,u]}const[eQ,tQ]=JM(fi,VE,Og,ZM,qE,zE),[rQ,nQ]=JM(di,UE,Sg,Lf,HE,BE);function E0(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function N0(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Lc(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function oQ(e){var t=e.dateTime,r=e.date,n=e.time,o=e.periods,a=e.days,i=e.shortDays,s=e.months,u=e.shortMonths,c=Rc(o),d=Fc(o),f=Rc(a),h=Fc(a),p=Rc(i),g=Fc(i),b=Rc(s),v=Fc(s),x=Rc(u),k=Fc(u),E={a:B,A:L,b:q,B:U,c:null,d:IC,e:IC,f:OQ,g:RQ,G:$Q,H:EQ,I:NQ,j:SQ,L:QM,m:CQ,M:PQ,p:H,q:X,Q:RC,s:FC,S:AQ,u:TQ,U:MQ,V:_Q,w:IQ,W:DQ,x:null,X:null,y:LQ,Y:FQ,Z:BQ,"%":LC},j={a:Y,A:ae,b:te,B:me,c:null,d:DC,e:DC,f:UQ,g:eee,G:ree,H:zQ,I:HQ,j:qQ,L:t_,m:VQ,M:WQ,p:Q,q:ue,Q:RC,s:FC,S:KQ,u:YQ,U:GQ,V:XQ,w:ZQ,W:JQ,x:null,X:null,y:QQ,Y:tee,Z:nee,"%":LC},S={a:T,A:_,b:F,B:$,c:I,d:MC,e:MC,f:xQ,g:TC,G:AC,H:_C,I:_C,j:gQ,L:yQ,m:hQ,M:bQ,p:A,q:pQ,Q:wQ,s:jQ,S:vQ,u:uQ,U:cQ,V:dQ,w:lQ,W:fQ,x:R,X:W,y:TC,Y:AC,Z:mQ,"%":kQ};E.x=C(r,E),E.X=C(n,E),E.c=C(t,E),j.x=C(r,j),j.X=C(n,j),j.c=C(t,j);function C(G,de){return function(ie){var V=[],ee=-1,ne=0,ge=G.length,Ee,Pe,Ie;for(ie instanceof Date||(ie=new Date(+ie));++ee<ge;)G.charCodeAt(ee)===37&&(V.push(G.slice(ne,ee)),(Pe=PC[Ee=G.charAt(++ee)])!=null?Ee=G.charAt(++ee):Pe=Ee==="e"?" ":"0",(Ie=de[Ee])&&(Ee=Ie(ie,Pe)),V.push(Ee),ne=ee+1);return V.push(G.slice(ne,ee)),V.join("")}}function O(G,de){return function(ie){var V=Lc(1900,void 0,1),ee=M(V,G,ie+="",0),ne,ge;if(ee!=ie.length)return null;if("Q"in V)return new Date(V.Q);if("s"in V)return new Date(V.s*1e3+("L"in V?V.L:0));if(de&&!("Z"in V)&&(V.Z=0),"p"in V&&(V.H=V.H%12+V.p*12),V.m===void 0&&(V.m="q"in V?V.q:0),"V"in V){if(V.V<1||V.V>53)return null;"w"in V||(V.w=1),"Z"in V?(ne=N0(Lc(V.y,0,1)),ge=ne.getUTCDay(),ne=ge>4||ge===0?zp.ceil(ne):zp(ne),ne=Ng.offset(ne,(V.V-1)*7),V.y=ne.getUTCFullYear(),V.m=ne.getUTCMonth(),V.d=ne.getUTCDate()+(V.w+6)%7):(ne=E0(Lc(V.y,0,1)),ge=ne.getDay(),ne=ge>4||ge===0?Bp.ceil(ne):Bp(ne),ne=Lf.offset(ne,(V.V-1)*7),V.y=ne.getFullYear(),V.m=ne.getMonth(),V.d=ne.getDate()+(V.w+6)%7)}else("W"in V||"U"in V)&&("w"in V||(V.w="u"in V?V.u%7:"W"in V?1:0),ge="Z"in V?N0(Lc(V.y,0,1)).getUTCDay():E0(Lc(V.y,0,1)).getDay(),V.m=0,V.d="W"in V?(V.w+6)%7+V.W*7-(ge+5)%7:V.w+V.U*7-(ge+6)%7);return"Z"in V?(V.H+=V.Z/100|0,V.M+=V.Z%100,N0(V)):E0(V)}}function M(G,de,ie,V){for(var ee=0,ne=de.length,ge=ie.length,Ee,Pe;ee<ne;){if(V>=ge)return-1;if(Ee=de.charCodeAt(ee++),Ee===37){if(Ee=de.charAt(ee++),Pe=S[Ee in PC?de.charAt(ee++):Ee],!Pe||(V=Pe(G,ie,V))<0)return-1}else if(Ee!=ie.charCodeAt(V++))return-1}return V}function A(G,de,ie){var V=c.exec(de.slice(ie));return V?(G.p=d.get(V[0].toLowerCase()),ie+V[0].length):-1}function T(G,de,ie){var V=p.exec(de.slice(ie));return V?(G.w=g.get(V[0].toLowerCase()),ie+V[0].length):-1}function _(G,de,ie){var V=f.exec(de.slice(ie));return V?(G.w=h.get(V[0].toLowerCase()),ie+V[0].length):-1}function F(G,de,ie){var V=x.exec(de.slice(ie));return V?(G.m=k.get(V[0].toLowerCase()),ie+V[0].length):-1}function $(G,de,ie){var V=b.exec(de.slice(ie));return V?(G.m=v.get(V[0].toLowerCase()),ie+V[0].length):-1}function I(G,de,ie){return M(G,t,de,ie)}function R(G,de,ie){return M(G,r,de,ie)}function W(G,de,ie){return M(G,n,de,ie)}function B(G){return i[G.getDay()]}function L(G){return a[G.getDay()]}function q(G){return u[G.getMonth()]}function U(G){return s[G.getMonth()]}function H(G){return o[+(G.getHours()>=12)]}function X(G){return 1+~~(G.getMonth()/3)}function Y(G){return i[G.getUTCDay()]}function ae(G){return a[G.getUTCDay()]}function te(G){return u[G.getUTCMonth()]}function me(G){return s[G.getUTCMonth()]}function Q(G){return o[+(G.getUTCHours()>=12)]}function ue(G){return 1+~~(G.getUTCMonth()/3)}return{format:function(G){var de=C(G+="",E);return de.toString=function(){return G},de},parse:function(G){var de=O(G+="",!1);return de.toString=function(){return G},de},utcFormat:function(G){var de=C(G+="",j);return de.toString=function(){return G},de},utcParse:function(G){var de=O(G+="",!0);return de.toString=function(){return G},de}}}var PC={"-":"",_:" ",0:"0"},Pn=/^\s*\d+/,aQ=/^%/,iQ=/[\\^$*+?|[\]().{}]/g;function sr(e,t,r){var n=e<0?"-":"",o=(n?-e:e)+"",a=o.length;return n+(a<r?new Array(r-a+1).join(t)+o:o)}function sQ(e){return e.replace(iQ,"\\$&")}function Rc(e){return new RegExp("^(?:"+e.map(sQ).join("|")+")","i")}function Fc(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function lQ(e,t,r){var n=Pn.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function uQ(e,t,r){var n=Pn.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function cQ(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function dQ(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function fQ(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function AC(e,t,r){var n=Pn.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function TC(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function mQ(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function pQ(e,t,r){var n=Pn.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function hQ(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function MC(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function gQ(e,t,r){var n=Pn.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function _C(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function bQ(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function vQ(e,t,r){var n=Pn.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function yQ(e,t,r){var n=Pn.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function xQ(e,t,r){var n=Pn.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function kQ(e,t,r){var n=aQ.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function wQ(e,t,r){var n=Pn.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function jQ(e,t,r){var n=Pn.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function IC(e,t){return sr(e.getDate(),t,2)}function EQ(e,t){return sr(e.getHours(),t,2)}function NQ(e,t){return sr(e.getHours()%12||12,t,2)}function SQ(e,t){return sr(1+Lf.count(di(e),e),t,3)}function QM(e,t){return sr(e.getMilliseconds(),t,3)}function OQ(e,t){return QM(e,t)+"000"}function CQ(e,t){return sr(e.getMonth()+1,t,2)}function PQ(e,t){return sr(e.getMinutes(),t,2)}function AQ(e,t){return sr(e.getSeconds(),t,2)}function TQ(e){var t=e.getDay();return t===0?7:t}function MQ(e,t){return sr(Sg.count(di(e)-1,e),t,2)}function e_(e){var t=e.getDay();return t>=4||t===0?Ou(e):Ou.ceil(e)}function _Q(e,t){return e=e_(e),sr(Ou.count(di(e),e)+(di(e).getDay()===4),t,2)}function IQ(e){return e.getDay()}function DQ(e,t){return sr(Bp.count(di(e)-1,e),t,2)}function LQ(e,t){return sr(e.getFullYear()%100,t,2)}function RQ(e,t){return e=e_(e),sr(e.getFullYear()%100,t,2)}function FQ(e,t){return sr(e.getFullYear()%1e4,t,4)}function $Q(e,t){var r=e.getDay();return e=r>=4||r===0?Ou(e):Ou.ceil(e),sr(e.getFullYear()%1e4,t,4)}function BQ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+sr(t/60|0,"0",2)+sr(t%60,"0",2)}function DC(e,t){return sr(e.getUTCDate(),t,2)}function zQ(e,t){return sr(e.getUTCHours(),t,2)}function HQ(e,t){return sr(e.getUTCHours()%12||12,t,2)}function qQ(e,t){return sr(1+Ng.count(fi(e),e),t,3)}function t_(e,t){return sr(e.getUTCMilliseconds(),t,3)}function UQ(e,t){return t_(e,t)+"000"}function VQ(e,t){return sr(e.getUTCMonth()+1,t,2)}function WQ(e,t){return sr(e.getUTCMinutes(),t,2)}function KQ(e,t){return sr(e.getUTCSeconds(),t,2)}function YQ(e){var t=e.getUTCDay();return t===0?7:t}function GQ(e,t){return sr(Og.count(fi(e)-1,e),t,2)}function r_(e){var t=e.getUTCDay();return t>=4||t===0?Cu(e):Cu.ceil(e)}function XQ(e,t){return e=r_(e),sr(Cu.count(fi(e),e)+(fi(e).getUTCDay()===4),t,2)}function ZQ(e){return e.getUTCDay()}function JQ(e,t){return sr(zp.count(fi(e)-1,e),t,2)}function QQ(e,t){return sr(e.getUTCFullYear()%100,t,2)}function eee(e,t){return e=r_(e),sr(e.getUTCFullYear()%100,t,2)}function tee(e,t){return sr(e.getUTCFullYear()%1e4,t,4)}function ree(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Cu(e):Cu.ceil(e),sr(e.getUTCFullYear()%1e4,t,4)}function nee(){return"+0000"}function LC(){return"%"}function RC(e){return+e}function FC(e){return Math.floor(+e/1e3)}var _l,n_,o_;oee({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 oee(e){return _l=oQ(e),n_=_l.format,_l.parse,o_=_l.utcFormat,_l.utcParse,_l}function aee(e){return new Date(e)}function iee(e){return e instanceof Date?+e:+new Date(+e)}function WE(e,t,r,n,o,a,i,s,u,c){var d=ME(),f=d.invert,h=d.domain,p=c(".%L"),g=c(":%S"),b=c("%I:%M"),v=c("%I %p"),x=c("%a %d"),k=c("%b %d"),E=c("%B"),j=c("%Y");function S(C){return(u(C)<C?p:s(C)<C?g:i(C)<C?b:a(C)<C?v:n(C)<C?o(C)<C?x:k:r(C)<C?E:j)(C)}return d.invert=function(C){return new Date(f(C))},d.domain=function(C){return arguments.length?h(Array.from(C,iee)):h().map(aee)},d.ticks=function(C){var O=h();return e(O[0],O[O.length-1],C??10)},d.tickFormat=function(C,O){return O==null?S:c(O)},d.nice=function(C){var O=h();return(!C||typeof C.range!="function")&&(C=t(O[0],O[O.length-1],C??10)),C?h(UM(O,C)):d},d.copy=function(){return Df(d,WE(e,t,r,n,o,a,i,s,u,c))},d}function see(){return Uo.apply(WE(rQ,nQ,di,UE,Sg,Lf,HE,BE,Qs,n_).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function lee(){return Uo.apply(WE(eQ,tQ,fi,VE,Og,Ng,qE,zE,Qs,o_).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Cg(){var e=0,t=1,r,n,o,a,i=Xn,s=!1,u;function c(f){return f==null||isNaN(f=+f)?u:i(o===0?.5:(f=(a(f)-r)*o,s?Math.max(0,Math.min(1,f)):f))}c.domain=function(f){return arguments.length?([e,t]=f,r=a(e=+e),n=a(t=+t),o=r===n?0:1/(n-r),c):[e,t]},c.clamp=function(f){return arguments.length?(s=!!f,c):s},c.interpolator=function(f){return arguments.length?(i=f,c):i};function d(f){return function(h){var p,g;return arguments.length?([p,g]=h,i=f(p,g),c):[i(0),i(1)]}}return c.range=d(lc),c.rangeRound=d(TE),c.unknown=function(f){return arguments.length?(u=f,c):u},function(f){return a=f,r=f(e),n=f(t),o=r===n?0:1/(n-r),c}}function js(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function a_(){var e=ws(Cg()(Xn));return e.copy=function(){return js(e,a_())},xi.apply(e,arguments)}function i_(){var e=DE(Cg()).domain([1,10]);return e.copy=function(){return js(e,i_()).base(e.base())},xi.apply(e,arguments)}function s_(){var e=LE(Cg());return e.copy=function(){return js(e,s_()).constant(e.constant())},xi.apply(e,arguments)}function KE(){var e=RE(Cg());return e.copy=function(){return js(e,KE()).exponent(e.exponent())},xi.apply(e,arguments)}function uee(){return KE.apply(null,arguments).exponent(.5)}function l_(){var e=[],t=Xn;function r(n){if(n!=null&&!isNaN(n=+n))return t((_f(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let o of n)o!=null&&!isNaN(o=+o)&&e.push(o);return e.sort(es),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,o)=>t(o/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(o,a)=>GZ(e,a/n))},r.copy=function(){return l_(t).domain(e)},xi.apply(r,arguments)}function Pg(){var e=0,t=.5,r=1,n=1,o,a,i,s,u,c=Xn,d,f=!1,h;function p(b){return isNaN(b=+b)?h:(b=.5+((b=+d(b))-a)*(n*b<n*a?s:u),c(f?Math.max(0,Math.min(1,b)):b))}p.domain=function(b){return arguments.length?([e,t,r]=b,o=d(e=+e),a=d(t=+t),i=d(r=+r),s=o===a?0:.5/(a-o),u=a===i?0:.5/(i-a),n=a<o?-1:1,p):[e,t,r]},p.clamp=function(b){return arguments.length?(f=!!b,p):f},p.interpolator=function(b){return arguments.length?(c=b,p):c};function g(b){return function(v){var x,k,E;return arguments.length?([x,k,E]=v,c=kJ(b,[x,k,E]),p):[c(0),c(.5),c(1)]}}return p.range=g(lc),p.rangeRound=g(TE),p.unknown=function(b){return arguments.length?(h=b,p):h},function(b){return d=b,o=b(e),a=b(t),i=b(r),s=o===a?0:.5/(a-o),u=a===i?0:.5/(i-a),n=a<o?-1:1,p}}function u_(){var e=ws(Pg()(Xn));return e.copy=function(){return js(e,u_())},xi.apply(e,arguments)}function c_(){var e=DE(Pg()).domain([.1,1,10]);return e.copy=function(){return js(e,c_()).base(e.base())},xi.apply(e,arguments)}function d_(){var e=LE(Pg());return e.copy=function(){return js(e,d_()).constant(e.constant())},xi.apply(e,arguments)}function YE(){var e=RE(Pg());return e.copy=function(){return js(e,YE()).exponent(e.exponent())},xi.apply(e,arguments)}function cee(){return YE.apply(null,arguments).exponent(.5)}const $C=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Dd,scaleDiverging:u_,scaleDivergingLog:c_,scaleDivergingPow:YE,scaleDivergingSqrt:cee,scaleDivergingSymlog:d_,scaleIdentity:qM,scaleImplicit:Uw,scaleLinear:Fp,scaleLog:VM,scaleOrdinal:CE,scalePoint:pd,scalePow:FE,scaleQuantile:YM,scaleQuantize:GM,scaleRadial:KM,scaleSequential:a_,scaleSequentialLog:i_,scaleSequentialPow:KE,scaleSequentialQuantile:l_,scaleSequentialSqrt:uee,scaleSequentialSymlog:s_,scaleSqrt:UJ,scaleSymlog:WM,scaleThreshold:XM,scaleTime:see,scaleUtc:lee,tickFormat:HM},Symbol.toStringTag,{value:"Module"}));var S0,BC;function Ag(){if(BC)return S0;BC=1;var e=oc();function t(r,n,o){for(var a=-1,i=r.length;++a<i;){var s=r[a],u=n(s);if(u!=null&&(c===void 0?u===u&&!e(u):o(u,c)))var c=u,d=s}return d}return S0=t,S0}var O0,zC;function f_(){if(zC)return O0;zC=1;function e(t,r){return t>r}return O0=e,O0}var C0,HC;function dee(){if(HC)return C0;HC=1;var e=Ag(),t=f_(),r=sc();function n(o){return o&&o.length?e(o,r,t):void 0}return C0=n,C0}var fee=dee();const Vi=mr(fee);var P0,qC;function m_(){if(qC)return P0;qC=1;function e(t,r){return t<r}return P0=e,P0}var A0,UC;function mee(){if(UC)return A0;UC=1;var e=Ag(),t=m_(),r=sc();function n(o){return o&&o.length?e(o,r,t):void 0}return A0=n,A0}var pee=mee();const Tg=mr(pee);var T0,VC;function hee(){if(VC)return T0;VC=1;var e=dE(),t=La(),r=kM(),n=co();function o(a,i){var s=n(a)?e:r;return s(a,t(i,3))}return T0=o,T0}var M0,WC;function gee(){if(WC)return M0;WC=1;var e=yM(),t=hee();function r(n,o){return e(t(n,o),1)}return M0=r,M0}var bee=gee();const vee=mr(bee);var _0,KC;function yee(){if(KC)return _0;KC=1;var e=jE();function t(r,n){return e(r,n)}return _0=t,_0}var xee=yee();const cs=mr(xee);var uc=1e9,kee={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},XE,Vr=!0,$o="[DecimalError] ",ol=$o+"Invalid argument: ",GE=$o+"Exponent out of range: ",cc=Math.floor,Rs=Math.pow,wee=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,xo,Sn=1e7,Br=7,p_=9007199254740991,Hp=cc(p_/Br),dt={};dt.absoluteValue=dt.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};dt.comparedTo=dt.cmp=function(e){var t,r,n,o,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(n=a.d.length,o=e.d.length,t=0,r=n<o?n:o;t<r;++t)if(a.d[t]!==e.d[t])return a.d[t]>e.d[t]^a.s<0?1:-1;return n===o?0:n>o^a.s<0?1:-1};dt.decimalPlaces=dt.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*Br;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};dt.dividedBy=dt.div=function(e){return ti(this,new this.constructor(e))};dt.dividedToIntegerBy=dt.idiv=function(e){var t=this,r=t.constructor;return Tr(ti(t,new r(e),0,1),r.precision)};dt.equals=dt.eq=function(e){return!this.cmp(e)};dt.exponent=function(){return mn(this)};dt.greaterThan=dt.gt=function(e){return this.cmp(e)>0};dt.greaterThanOrEqualTo=dt.gte=function(e){return this.cmp(e)>=0};dt.isInteger=dt.isint=function(){return this.e>this.d.length-2};dt.isNegative=dt.isneg=function(){return this.s<0};dt.isPositive=dt.ispos=function(){return this.s>0};dt.isZero=function(){return this.s===0};dt.lessThan=dt.lt=function(e){return this.cmp(e)<0};dt.lessThanOrEqualTo=dt.lte=function(e){return this.cmp(e)<1};dt.logarithm=dt.log=function(e){var t,r=this,n=r.constructor,o=n.precision,a=o+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(xo))throw Error($o+"NaN");if(r.s<1)throw Error($o+(r.s?"NaN":"-Infinity"));return r.eq(xo)?new n(0):(Vr=!1,t=ti(Bd(r,a),Bd(e,a),a),Vr=!0,Tr(t,o))};dt.minus=dt.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?b_(t,e):h_(t,(e.s=-e.s,e))};dt.modulo=dt.mod=function(e){var t,r=this,n=r.constructor,o=n.precision;if(e=new n(e),!e.s)throw Error($o+"NaN");return r.s?(Vr=!1,t=ti(r,e,0,1).times(e),Vr=!0,r.minus(t)):Tr(new n(r),o)};dt.naturalExponential=dt.exp=function(){return g_(this)};dt.naturalLogarithm=dt.ln=function(){return Bd(this)};dt.negated=dt.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};dt.plus=dt.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?h_(t,e):b_(t,(e.s=-e.s,e))};dt.precision=dt.sd=function(e){var t,r,n,o=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ol+e);if(t=mn(o)+1,n=o.d.length-1,r=n*Br+1,n=o.d[n],n){for(;n%10==0;n/=10)r--;for(n=o.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};dt.squareRoot=dt.sqrt=function(){var e,t,r,n,o,a,i,s=this,u=s.constructor;if(s.s<1){if(!s.s)return new u(0);throw Error($o+"NaN")}for(e=mn(s),Vr=!1,o=Math.sqrt(+s),o==0||o==1/0?(t=da(s.d),(t.length+e)%2==0&&(t+="0"),o=Math.sqrt(t),e=cc((e+1)/2)-(e<0||e%2),o==1/0?t="5e"+e:(t=o.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new u(t)):n=new u(o.toString()),r=u.precision,o=i=r+3;;)if(a=n,n=a.plus(ti(s,a,i+2)).times(.5),da(a.d).slice(0,i)===(t=da(n.d)).slice(0,i)){if(t=t.slice(i-3,i+1),o==i&&t=="4999"){if(Tr(a,r+1,0),a.times(a).eq(s)){n=a;break}}else if(t!="9999")break;i+=4}return Vr=!0,Tr(n,r)};dt.times=dt.mul=function(e){var t,r,n,o,a,i,s,u,c,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,r=d.e+e.e,u=h.length,c=p.length,u<c&&(a=h,h=p,p=a,i=u,u=c,c=i),a=[],i=u+c,n=i;n--;)a.push(0);for(n=c;--n>=0;){for(t=0,o=u+n;o>n;)s=a[o]+p[n]*h[o-n-1]+t,a[o--]=s%Sn|0,t=s/Sn|0;a[o]=(a[o]+t)%Sn|0}for(;!a[--i];)a.pop();return t?++r:a.shift(),e.d=a,e.e=r,Vr?Tr(e,f.precision):e};dt.toDecimalPlaces=dt.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Ca(e,0,uc),t===void 0?t=n.rounding:Ca(t,0,8),Tr(r,e+mn(r)+1,t))};dt.toExponential=function(e,t){var r,n=this,o=n.constructor;return e===void 0?r=fl(n,!0):(Ca(e,0,uc),t===void 0?t=o.rounding:Ca(t,0,8),n=Tr(new o(n),e+1,t),r=fl(n,!0,e+1)),r};dt.toFixed=function(e,t){var r,n,o=this,a=o.constructor;return e===void 0?fl(o):(Ca(e,0,uc),t===void 0?t=a.rounding:Ca(t,0,8),n=Tr(new a(o),e+mn(o)+1,t),r=fl(n.abs(),!1,e+mn(n)+1),o.isneg()&&!o.isZero()?"-"+r:r)};dt.toInteger=dt.toint=function(){var e=this,t=e.constructor;return Tr(new t(e),mn(e)+1,t.rounding)};dt.toNumber=function(){return+this};dt.toPower=dt.pow=function(e){var t,r,n,o,a,i,s=this,u=s.constructor,c=12,d=+(e=new u(e));if(!e.s)return new u(xo);if(s=new u(s),!s.s){if(e.s<1)throw Error($o+"Infinity");return s}if(s.eq(xo))return s;if(n=u.precision,e.eq(xo))return Tr(s,n);if(t=e.e,r=e.d.length-1,i=t>=r,a=s.s,i){if((r=d<0?-d:d)<=p_){for(o=new u(xo),t=Math.ceil(n/Br+4),Vr=!1;r%2&&(o=o.times(s),GC(o.d,t)),r=cc(r/2),r!==0;)s=s.times(s),GC(s.d,t);return Vr=!0,e.s<0?new u(xo).div(o):Tr(o,n)}}else if(a<0)throw Error($o+"NaN");return a=a<0&&e.d[Math.max(t,r)]&1?-1:1,s.s=1,Vr=!1,o=e.times(Bd(s,n+c)),Vr=!0,o=g_(o),o.s=a,o};dt.toPrecision=function(e,t){var r,n,o=this,a=o.constructor;return e===void 0?(r=mn(o),n=fl(o,r<=a.toExpNeg||r>=a.toExpPos)):(Ca(e,1,uc),t===void 0?t=a.rounding:Ca(t,0,8),o=Tr(new a(o),e,t),r=mn(o),n=fl(o,e<=r||r<=a.toExpNeg,e)),n};dt.toSignificantDigits=dt.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Ca(e,1,uc),t===void 0?t=n.rounding:Ca(t,0,8)),Tr(new n(r),e,t)};dt.toString=dt.valueOf=dt.val=dt.toJSON=dt[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=mn(e),r=e.constructor;return fl(e,t<=r.toExpNeg||t>=r.toExpPos)};function h_(e,t){var r,n,o,a,i,s,u,c,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),Vr?Tr(t,f):t;if(u=e.d,c=t.d,i=e.e,o=t.e,u=u.slice(),a=i-o,a){for(a<0?(n=u,a=-a,s=c.length):(n=c,o=i,s=u.length),i=Math.ceil(f/Br),s=i>s?i+1:s+1,a>s&&(a=s,n.length=1),n.reverse();a--;)n.push(0);n.reverse()}for(s=u.length,a=c.length,s-a<0&&(a=s,n=c,c=u,u=n),r=0;a;)r=(u[--a]=u[a]+c[a]+r)/Sn|0,u[a]%=Sn;for(r&&(u.unshift(r),++o),s=u.length;u[--s]==0;)u.pop();return t.d=u,t.e=o,Vr?Tr(t,f):t}function Ca(e,t,r){if(e!==~~e||e<t||e>r)throw Error(ol+e)}function da(e){var t,r,n,o=e.length-1,a="",i=e[0];if(o>0){for(a+=i,t=1;t<o;t++)n=e[t]+"",r=Br-n.length,r&&(a+=$i(r)),a+=n;i=e[t],n=i+"",r=Br-n.length,r&&(a+=$i(r))}else if(i===0)return"0";for(;i%10===0;)i/=10;return a+i}var ti=function(){function e(n,o){var a,i=0,s=n.length;for(n=n.slice();s--;)a=n[s]*o+i,n[s]=a%Sn|0,i=a/Sn|0;return i&&n.unshift(i),n}function t(n,o,a,i){var s,u;if(a!=i)u=a>i?1:-1;else for(s=u=0;s<a;s++)if(n[s]!=o[s]){u=n[s]>o[s]?1:-1;break}return u}function r(n,o,a){for(var i=0;a--;)n[a]-=i,i=n[a]<o[a]?1:0,n[a]=i*Sn+n[a]-o[a];for(;!n[0]&&n.length>1;)n.shift()}return function(n,o,a,i){var s,u,c,d,f,h,p,g,b,v,x,k,E,j,S,C,O,M,A=n.constructor,T=n.s==o.s?1:-1,_=n.d,F=o.d;if(!n.s)return new A(n);if(!o.s)throw Error($o+"Division by zero");for(u=n.e-o.e,O=F.length,S=_.length,p=new A(T),g=p.d=[],c=0;F[c]==(_[c]||0);)++c;if(F[c]>(_[c]||0)&&--u,a==null?k=a=A.precision:i?k=a+(mn(n)-mn(o))+1:k=a,k<0)return new A(0);if(k=k/Br+2|0,c=0,O==1)for(d=0,F=F[0],k++;(c<S||d)&&k--;c++)E=d*Sn+(_[c]||0),g[c]=E/F|0,d=E%F|0;else{for(d=Sn/(F[0]+1)|0,d>1&&(F=e(F,d),_=e(_,d),O=F.length,S=_.length),j=O,b=_.slice(0,O),v=b.length;v<O;)b[v++]=0;M=F.slice(),M.unshift(0),C=F[0],F[1]>=Sn/2&&++C;do d=0,s=t(F,b,O,v),s<0?(x=b[0],O!=v&&(x=x*Sn+(b[1]||0)),d=x/C|0,d>1?(d>=Sn&&(d=Sn-1),f=e(F,d),h=f.length,v=b.length,s=t(f,b,h,v),s==1&&(d--,r(f,O<h?M:F,h))):(d==0&&(s=d=1),f=F.slice()),h=f.length,h<v&&f.unshift(0),r(b,f,v),s==-1&&(v=b.length,s=t(F,b,O,v),s<1&&(d++,r(b,O<v?M:F,v))),v=b.length):s===0&&(d++,b=[0]),g[c++]=d,s&&b[0]?b[v++]=_[j]||0:(b=[_[j]],v=1);while((j++<S||b[0]!==void 0)&&k--)}return g[0]||g.shift(),p.e=u,Tr(p,i?a+mn(p)+1:a)}}();function g_(e,t){var r,n,o,a,i,s,u=0,c=0,d=e.constructor,f=d.precision;if(mn(e)>16)throw Error(GE+mn(e));if(!e.s)return new d(xo);for(Vr=!1,s=f,i=new d(.03125);e.abs().gte(.1);)e=e.times(i),c+=5;for(n=Math.log(Rs(2,c))/Math.LN10*2+5|0,s+=n,r=o=a=new d(xo),d.precision=s;;){if(o=Tr(o.times(e),s),r=r.times(++u),i=a.plus(ti(o,r,s)),da(i.d).slice(0,s)===da(a.d).slice(0,s)){for(;c--;)a=Tr(a.times(a),s);return d.precision=f,t==null?(Vr=!0,Tr(a,f)):a}a=i}}function mn(e){for(var t=e.e*Br,r=e.d[0];r>=10;r/=10)t++;return t}function I0(e,t,r){if(t>e.LN10.sd())throw Vr=!0,r&&(e.precision=r),Error($o+"LN10 precision limit exceeded");return Tr(new e(e.LN10),t)}function $i(e){for(var t="";e--;)t+="0";return t}function Bd(e,t){var r,n,o,a,i,s,u,c,d,f=1,h=10,p=e,g=p.d,b=p.constructor,v=b.precision;if(p.s<1)throw Error($o+(p.s?"NaN":"-Infinity"));if(p.eq(xo))return new b(0);if(t==null?(Vr=!1,c=v):c=t,p.eq(10))return t==null&&(Vr=!0),I0(b,c);if(c+=h,b.precision=c,r=da(g),n=r.charAt(0),a=mn(p),Math.abs(a)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=da(p.d),n=r.charAt(0),f++;a=mn(p),n>1?(p=new b("0."+r),a++):p=new b(n+"."+r.slice(1))}else return u=I0(b,c+2,v).times(a+""),p=Bd(new b(n+"."+r.slice(1)),c-h).plus(u),b.precision=v,t==null?(Vr=!0,Tr(p,v)):p;for(s=i=p=ti(p.minus(xo),p.plus(xo),c),d=Tr(p.times(p),c),o=3;;){if(i=Tr(i.times(d),c),u=s.plus(ti(i,new b(o),c)),da(u.d).slice(0,c)===da(s.d).slice(0,c))return s=s.times(2),a!==0&&(s=s.plus(I0(b,c+2,v).times(a+""))),s=ti(s,new b(f),c),b.precision=v,t==null?(Vr=!0,Tr(s,v)):s;s=u,o+=2}}function YC(e,t){var r,n,o;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(o=t.length;t.charCodeAt(o-1)===48;)--o;if(t=t.slice(n,o),t){if(o-=n,r=r-n-1,e.e=cc(r/Br),e.d=[],n=(r+1)%Br,r<0&&(n+=Br),n<o){for(n&&e.d.push(+t.slice(0,n)),o-=Br;n<o;)e.d.push(+t.slice(n,n+=Br));t=t.slice(n),n=Br-t.length}else n-=o;for(;n--;)t+="0";if(e.d.push(+t),Vr&&(e.e>Hp||e.e<-Hp))throw Error(GE+r)}else e.s=0,e.e=0,e.d=[0];return e}function Tr(e,t,r){var n,o,a,i,s,u,c,d,f=e.d;for(i=1,a=f[0];a>=10;a/=10)i++;if(n=t-i,n<0)n+=Br,o=t,c=f[d=0];else{if(d=Math.ceil((n+1)/Br),a=f.length,d>=a)return e;for(c=a=f[d],i=1;a>=10;a/=10)i++;n%=Br,o=n-Br+i}if(r!==void 0&&(a=Rs(10,i-o-1),s=c/a%10|0,u=t<0||f[d+1]!==void 0||c%a,u=r<4?(s||u)&&(r==0||r==(e.s<0?3:2)):s>5||s==5&&(r==4||u||r==6&&(n>0?o>0?c/Rs(10,i-o):0:f[d-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return u?(a=mn(e),f.length=1,t=t-a-1,f[0]=Rs(10,(Br-t%Br)%Br),e.e=cc(-t/Br)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=d,a=1,d--):(f.length=d+1,a=Rs(10,Br-n),f[d]=o>0?(c/Rs(10,i-o)%Rs(10,o)|0)*a:0),u)for(;;)if(d==0){(f[0]+=a)==Sn&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=Sn)break;f[d--]=0,a=1}for(n=f.length;f[--n]===0;)f.pop();if(Vr&&(e.e>Hp||e.e<-Hp))throw Error(GE+mn(e));return e}function b_(e,t){var r,n,o,a,i,s,u,c,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),Vr?Tr(t,p):t;if(u=e.d,f=t.d,n=t.e,c=e.e,u=u.slice(),i=c-n,i){for(d=i<0,d?(r=u,i=-i,s=f.length):(r=f,n=c,s=u.length),o=Math.max(Math.ceil(p/Br),s)+2,i>o&&(i=o,r.length=1),r.reverse(),o=i;o--;)r.push(0);r.reverse()}else{for(o=u.length,s=f.length,d=o<s,d&&(s=o),o=0;o<s;o++)if(u[o]!=f[o]){d=u[o]<f[o];break}i=0}for(d&&(r=u,u=f,f=r,t.s=-t.s),s=u.length,o=f.length-s;o>0;--o)u[s++]=0;for(o=f.length;o>i;){if(u[--o]<f[o]){for(a=o;a&&u[--a]===0;)u[a]=Sn-1;--u[a],u[o]+=Sn}u[o]-=f[o]}for(;u[--s]===0;)u.pop();for(;u[0]===0;u.shift())--n;return u[0]?(t.d=u,t.e=n,Vr?Tr(t,p):t):new h(0)}function fl(e,t,r){var n,o=mn(e),a=da(e.d),i=a.length;return t?(r&&(n=r-i)>0?a=a.charAt(0)+"."+a.slice(1)+$i(n):i>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(o<0?"e":"e+")+o):o<0?(a="0."+$i(-o-1)+a,r&&(n=r-i)>0&&(a+=$i(n))):o>=i?(a+=$i(o+1-i),r&&(n=r-o-1)>0&&(a=a+"."+$i(n))):((n=o+1)<i&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-i)>0&&(o+1===i&&(a+="."),a+=$i(n))),e.s<0?"-"+a:a}function GC(e,t){if(e.length>t)return e.length=t,!0}function v_(e){var t,r,n;function o(a){var i=this;if(!(i instanceof o))return new o(a);if(i.constructor=o,a instanceof o){i.s=a.s,i.e=a.e,i.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(ol+a);if(a>0)i.s=1;else if(a<0)a=-a,i.s=-1;else{i.s=0,i.e=0,i.d=[0];return}if(a===~~a&&a<1e7){i.e=0,i.d=[a];return}return YC(i,a.toString())}else if(typeof a!="string")throw Error(ol+a);if(a.charCodeAt(0)===45?(a=a.slice(1),i.s=-1):i.s=1,wee.test(a))YC(i,a);else throw Error(ol+a)}if(o.prototype=dt,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.clone=v_,o.config=o.set=jee,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return o.config(e),o}function jee(e){if(!e||typeof e!="object")throw Error($o+"Object expected");var t,r,n,o=["precision",1,uc,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<o.length;t+=3)if((n=e[r=o[t]])!==void 0)if(cc(n)===n&&n>=o[t+1]&&n<=o[t+2])this[r]=n;else throw Error(ol+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(ol+r+": "+n);return this}var XE=v_(kee);xo=new XE(1);const wr=XE;function Eee(e){return Cee(e)||Oee(e)||See(e)||Nee()}function Nee(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
67
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function See(e,t){if(e){if(typeof e=="string")return Yw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Yw(e,t)}}function Oee(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Cee(e){if(Array.isArray(e))return Yw(e)}function Yw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Pee=function(e){return e},y_={},x_=function(e){return e===y_},XC=function(e){return function t(){return arguments.length===0||arguments.length===1&&x_(arguments.length<=0?void 0:arguments[0])?t:e.apply(void 0,arguments)}},Aee=function e(t,r){return t===1?r:XC(function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];var i=o.filter(function(s){return s!==y_}).length;return i>=t?r.apply(void 0,o):e(t-i,XC(function(){for(var s=arguments.length,u=new Array(s),c=0;c<s;c++)u[c]=arguments[c];var d=o.map(function(f){return x_(f)?u.shift():f});return r.apply(void 0,Eee(d).concat(u))}))})},Mg=function(e){return Aee(e.length,e)},Gw=function(e,t){for(var r=[],n=e;n<t;++n)r[n-e]=n;return r},Tee=Mg(function(e,t){return Array.isArray(t)?t.map(e):Object.keys(t).map(function(r){return t[r]}).map(e)}),Mee=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.length)return Pee;var n=t.reverse(),o=n[0],a=n.slice(1);return function(){return a.reduce(function(i,s){return s(i)},o.apply(void 0,arguments))}},Xw=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},k_=function(e){var t=null,r=null;return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return t&&o.every(function(i,s){return i===t[s]})||(t=o,r=e.apply(void 0,o)),r}};function _ee(e){var t;return e===0?t=1:t=Math.floor(new wr(e).abs().log(10).toNumber())+1,t}function Iee(e,t,r){for(var n=new wr(e),o=0,a=[];n.lt(t)&&o<1e5;)a.push(n.toNumber()),n=n.add(r),o++;return a}var Dee=Mg(function(e,t,r){var n=+e,o=+t;return n+r*(o-n)}),Lee=Mg(function(e,t,r){var n=t-+e;return n=n||1/0,(r-e)/n}),Ree=Mg(function(e,t,r){var n=t-+e;return n=n||1/0,Math.max(0,Math.min(1,(r-e)/n))});const _g={rangeStep:Iee,getDigitCount:_ee,interpolateNumber:Dee,uninterpolateNumber:Lee,uninterpolateTruncation:Ree};function Zw(e){return Bee(e)||$ee(e)||w_(e)||Fee()}function Fee(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
68
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $ee(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Bee(e){if(Array.isArray(e))return Jw(e)}function zd(e,t){return qee(e)||Hee(e,t)||w_(e,t)||zee()}function zee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
69
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w_(e,t){if(e){if(typeof e=="string")return Jw(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Jw(e,t)}}function Jw(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Hee(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var r=[],n=!0,o=!1,a=void 0;try{for(var i=e[Symbol.iterator](),s;!(n=(s=i.next()).done)&&(r.push(s.value),!(t&&r.length===t));n=!0);}catch(u){o=!0,a=u}finally{try{!n&&i.return!=null&&i.return()}finally{if(o)throw a}}return r}}function qee(e){if(Array.isArray(e))return e}function j_(e){var t=zd(e,2),r=t[0],n=t[1],o=r,a=n;return r>n&&(o=n,a=r),[o,a]}function E_(e,t,r){if(e.lte(0))return new wr(0);var n=_g.getDigitCount(e.toNumber()),o=new wr(10).pow(n),a=e.div(o),i=n!==1?.05:.1,s=new wr(Math.ceil(a.div(i).toNumber())).add(r).mul(i),u=s.mul(o);return t?u:new wr(Math.ceil(u))}function Uee(e,t,r){var n=1,o=new wr(e);if(!o.isint()&&r){var a=Math.abs(e);a<1?(n=new wr(10).pow(_g.getDigitCount(e)-1),o=new wr(Math.floor(o.div(n).toNumber())).mul(n)):a>1&&(o=new wr(Math.floor(e)))}else e===0?o=new wr(Math.floor((t-1)/2)):r||(o=new wr(Math.floor(e)));var i=Math.floor((t-1)/2),s=Mee(Tee(function(u){return o.add(new wr(u-i).mul(n)).toNumber()}),Gw);return s(0,t)}function N_(e,t,r,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(r-1)))return{step:new wr(0),tickMin:new wr(0),tickMax:new wr(0)};var a=E_(new wr(t).sub(e).div(r-1),n,o),i;e<=0&&t>=0?i=new wr(0):(i=new wr(e).add(t).div(2),i=i.sub(new wr(i).mod(a)));var s=Math.ceil(i.sub(e).div(a).toNumber()),u=Math.ceil(new wr(t).sub(i).div(a).toNumber()),c=s+u+1;return c>r?N_(e,t,r,n,o+1):(c<r&&(u=t>0?u+(r-c):u,s=t>0?s:s+(r-c)),{step:a,tickMin:i.sub(new wr(s).mul(a)),tickMax:i.add(new wr(u).mul(a))})}function Vee(e){var t=zd(e,2),r=t[0],n=t[1],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=Math.max(o,2),s=j_([r,n]),u=zd(s,2),c=u[0],d=u[1];if(c===-1/0||d===1/0){var f=d===1/0?[c].concat(Zw(Gw(0,o-1).map(function(){return 1/0}))):[].concat(Zw(Gw(0,o-1).map(function(){return-1/0})),[d]);return r>n?Xw(f):f}if(c===d)return Uee(c,o,a);var h=N_(c,d,i,a),p=h.step,g=h.tickMin,b=h.tickMax,v=_g.rangeStep(g,b.add(new wr(.1).mul(p)),p);return r>n?Xw(v):v}function Wee(e,t){var r=zd(e,2),n=r[0],o=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=j_([n,o]),s=zd(i,2),u=s[0],c=s[1];if(u===-1/0||c===1/0)return[n,o];if(u===c)return[u];var d=Math.max(t,2),f=E_(new wr(c).sub(u).div(d-1),a,0),h=[].concat(Zw(_g.rangeStep(new wr(u),new wr(c).sub(new wr(.99).mul(f)),f)),[c]);return n>o?Xw(h):h}var Kee=k_(Vee),Yee=k_(Wee),Gee="Invariant failed";function ml(e,t){throw new Error(Gee)}var Xee=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Pu(e){"@babel/helpers - typeof";return Pu=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},Pu(e)}function qp(){return qp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qp.apply(this,arguments)}function Zee(e,t){return tte(e)||ete(e,t)||Qee(e,t)||Jee()}function Jee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
70
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qee(e,t){if(e){if(typeof e=="string")return ZC(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ZC(e,t)}}function ZC(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ete(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function tte(e){if(Array.isArray(e))return e}function rte(e,t){if(e==null)return{};var r=nte(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nte(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function ote(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ate(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,C_(n.key),n)}}function ite(e,t,r){return t&&ate(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ste(e,t,r){return t=Up(t),lte(e,S_()?Reflect.construct(t,r||[],Up(e).constructor):t.apply(e,r))}function lte(e,t){if(t&&(Pu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ute(e)}function ute(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(S_=function(){return!!e})()}function Up(e){return Up=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Up(e)}function cte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qw(e,t)}function Qw(e,t){return Qw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Qw(e,t)}function O_(e,t,r){return t=C_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C_(e){var t=dte(e,"string");return Pu(t)=="symbol"?t:t+""}function dte(e,t){if(Pu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Pu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var dc=function(e){function t(){return ote(this,t),ste(this,t,arguments)}return cte(t,e),ite(t,[{key:"render",value:function(){var r=this.props,n=r.offset,o=r.layout,a=r.width,i=r.dataKey,s=r.data,u=r.dataPointFormatter,c=r.xAxis,d=r.yAxis,f=rte(r,Xee),h=ft(f,!1);this.props.direction==="x"&&c.type!=="number"&&ml();var p=s.map(function(g){var b=u(g,i),v=b.x,x=b.y,k=b.value,E=b.errorVal;if(!E)return null;var j=[],S,C;if(Array.isArray(E)){var O=Zee(E,2);S=O[0],C=O[1]}else S=C=E;if(o==="vertical"){var M=c.scale,A=x+n,T=A+a,_=A-a,F=M(k-S),$=M(k+C);j.push({x1:$,y1:T,x2:$,y2:_}),j.push({x1:F,y1:A,x2:$,y2:A}),j.push({x1:F,y1:T,x2:F,y2:_})}else if(o==="horizontal"){var I=d.scale,R=v+n,W=R-a,B=R+a,L=I(k-S),q=I(k+C);j.push({x1:W,y1:q,x2:B,y2:q}),j.push({x1:R,y1:L,x2:R,y2:q}),j.push({x1:W,y1:L,x2:B,y2:L})}return y.createElement(Ft,qp({className:"recharts-errorBar",key:"bar-".concat(j.map(function(U){return"".concat(U.x1,"-").concat(U.x2,"-").concat(U.y1,"-").concat(U.y2)}))},h),j.map(function(U){return y.createElement("line",qp({},U,{key:"line-".concat(U.x1,"-").concat(U.x2,"-").concat(U.y1,"-").concat(U.y2)}))}))});return y.createElement(Ft,{className:"recharts-errorBars"},p)}}])}(y.Component);O_(dc,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});O_(dc,"displayName","ErrorBar");function Hd(e){"@babel/helpers - typeof";return Hd=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},Hd(e)}function JC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ms(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?JC(Object(r),!0).forEach(function(n){fte(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):JC(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fte(e,t,r){return t=mte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mte(e){var t=pte(e,"string");return Hd(t)=="symbol"?t:t+""}function pte(e,t){if(Hd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var P_=function(e){var t=e.children,r=e.formattedGraphicalItems,n=e.legendWidth,o=e.legendContent,a=ho(t,ka);if(!a)return null;var i=ka.defaultProps,s=i!==void 0?Ms(Ms({},i),a.props):{},u;return a.props&&a.props.payload?u=a.props&&a.props.payload:o==="children"?u=(r||[]).reduce(function(c,d){var f=d.item,h=d.props,p=h.sectors||h.data||[];return c.concat(p.map(function(g){return{type:a.props.iconType||f.props.legendType,value:g.name,color:g.fill,payload:g}}))},[]):u=(r||[]).map(function(c){var d=c.item,f=d.type.defaultProps,h=f!==void 0?Ms(Ms({},f),d.props):{},p=h.dataKey,g=h.name,b=h.legendType,v=h.hide;return{inactive:v,dataKey:p,type:s.iconType||b||"square",color:ZE(d),value:g||p,payload:h}}),Ms(Ms(Ms({},s),ka.getWithHeight(a,n)),{},{payload:u,item:a})};function qd(e){"@babel/helpers - typeof";return qd=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},qd(e)}function QC(e){return vte(e)||bte(e)||gte(e)||hte()}function hte(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
71
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gte(e,t){if(e){if(typeof e=="string")return e2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e2(e,t)}}function bte(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vte(e){if(Array.isArray(e))return e2(e)}function e2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function e6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function on(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?e6(Object(r),!0).forEach(function(n){su(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):e6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function su(e,t,r){return t=yte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yte(e){var t=xte(e,"string");return qd(t)=="symbol"?t:t+""}function xte(e,t){if(qd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(qd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zr(e,t,r){return wt(e)||wt(t)?r:xn(t)?Co(e,t,r):kt(t)?t(e):r}function Qm(e,t,r,n){var o=vee(e,function(s){return zr(s,t)});if(r==="number"){var a=o.filter(function(s){return qe(s)||parseFloat(s)});return a.length?[Tg(a),Vi(a)]:[1/0,-1/0]}var i=n?o.filter(function(s){return!wt(s)}):o;return i.map(function(s){return xn(s)||s instanceof Date?s:""})}var kte=function(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=-1,i=(t=r?.length)!==null&&t!==void 0?t:0;if(i<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var s=o.range,u=0;u<i;u++){var c=u>0?n[u-1].coordinate:n[i-1].coordinate,d=n[u].coordinate,f=u>=i-1?n[0].coordinate:n[u+1].coordinate,h=void 0;if(Yn(d-c)!==Yn(f-d)){var p=[];if(Yn(f-d)===Yn(s[1]-s[0])){h=f;var g=d+s[1]-s[0];p[0]=Math.min(g,(g+c)/2),p[1]=Math.max(g,(g+c)/2)}else{h=c;var b=f+s[1]-s[0];p[0]=Math.min(d,(b+d)/2),p[1]=Math.max(d,(b+d)/2)}var v=[Math.min(d,(h+d)/2),Math.max(d,(h+d)/2)];if(e>v[0]&&e<=v[1]||e>=p[0]&&e<=p[1]){a=n[u].index;break}}else{var x=Math.min(c,f),k=Math.max(c,f);if(e>(x+d)/2&&e<=(k+d)/2){a=n[u].index;break}}}else for(var E=0;E<i;E++)if(E===0&&e<=(r[E].coordinate+r[E+1].coordinate)/2||E>0&&E<i-1&&e>(r[E].coordinate+r[E-1].coordinate)/2&&e<=(r[E].coordinate+r[E+1].coordinate)/2||E===i-1&&e>(r[E].coordinate+r[E-1].coordinate)/2){a=r[E].index;break}return a},ZE=function(e){var t,r=e,n=r.type.displayName,o=(t=e.type)!==null&&t!==void 0&&t.defaultProps?on(on({},e.type.defaultProps),e.props):e.props,a=o.stroke,i=o.fill,s;switch(n){case"Line":s=a;break;case"Area":case"Radar":s=a&&a!=="none"?a:i;break;default:s=i;break}return s},wte=function(e){var t=e.barSize,r=e.totalSize,n=e.stackGroups,o=n===void 0?{}:n;if(!o)return{};for(var a={},i=Object.keys(o),s=0,u=i.length;s<u;s++)for(var c=o[i[s]].stackGroups,d=Object.keys(c),f=0,h=d.length;f<h;f++){var p=c[d[f]],g=p.items,b=p.cateAxisId,v=g.filter(function(C){return ei(C.type).indexOf("Bar")>=0});if(v&&v.length){var x=v[0].type.defaultProps,k=x!==void 0?on(on({},x),v[0].props):v[0].props,E=k.barSize,j=k[b];a[j]||(a[j]=[]);var S=wt(E)?t:E;a[j].push({item:v[0],stackList:v.slice(1),barSize:wt(S)?void 0:Gn(S,r,0)})}}return a},jte=function(e){var t=e.barGap,r=e.barCategoryGap,n=e.bandSize,o=e.sizeList,a=o===void 0?[]:o,i=e.maxBarSize,s=a.length;if(s<1)return null;var u=Gn(t,n,0,!0),c,d=[];if(a[0].barSize===+a[0].barSize){var f=!1,h=n/s,p=a.reduce(function(E,j){return E+j.barSize||0},0);p+=(s-1)*u,p>=n&&(p-=(s-1)*u,u=0),p>=n&&h>0&&(f=!0,h*=.9,p=s*h);var g=(n-p)/2>>0,b={offset:g-u,size:0};c=a.reduce(function(E,j){var S={item:j.item,position:{offset:b.offset+b.size+u,size:f?h:j.barSize}},C=[].concat(QC(E),[S]);return b=C[C.length-1].position,j.stackList&&j.stackList.length&&j.stackList.forEach(function(O){C.push({item:O,position:b})}),C},d)}else{var v=Gn(r,n,0,!0);n-2*v-(s-1)*u<=0&&(u=0);var x=(n-2*v-(s-1)*u)/s;x>1&&(x>>=0);var k=i===+i?Math.min(x,i):x;c=a.reduce(function(E,j,S){var C=[].concat(QC(E),[{item:j.item,position:{offset:v+(x+u)*S+(x-k)/2,size:k}}]);return j.stackList&&j.stackList.length&&j.stackList.forEach(function(O){C.push({item:O,position:C[C.length-1].position})}),C},d)}return c},Ete=function(e,t,r,n){var o=r.children,a=r.width,i=r.margin,s=a-(i.left||0)-(i.right||0),u=P_({children:o,legendWidth:s});if(u){var c=n||{},d=c.width,f=c.height,h=u.align,p=u.verticalAlign,g=u.layout;if((g==="vertical"||g==="horizontal"&&p==="middle")&&h!=="center"&&qe(e[h]))return on(on({},e),{},su({},h,e[h]+(d||0)));if((g==="horizontal"||g==="vertical"&&h==="center")&&p!=="middle"&&qe(e[p]))return on(on({},e),{},su({},p,e[p]+(f||0)))}return e},Nte=function(e,t,r){return wt(t)?!0:e==="horizontal"?t==="yAxis":e==="vertical"||r==="x"?t==="xAxis":r==="y"?t==="yAxis":!0},A_=function(e,t,r,n,o){var a=t.props.children,i=Jn(a,dc).filter(function(u){return Nte(n,o,u.props.direction)});if(i&&i.length){var s=i.map(function(u){return u.props.dataKey});return e.reduce(function(u,c){var d=zr(c,r);if(wt(d))return u;var f=Array.isArray(d)?[Tg(d),Vi(d)]:[d,d],h=s.reduce(function(p,g){var b=zr(c,g,0),v=f[0]-Math.abs(Array.isArray(b)?b[0]:b),x=f[1]+Math.abs(Array.isArray(b)?b[1]:b);return[Math.min(v,p[0]),Math.max(x,p[1])]},[1/0,-1/0]);return[Math.min(h[0],u[0]),Math.max(h[1],u[1])]},[1/0,-1/0])}return null},Ste=function(e,t,r,n,o){var a=t.map(function(i){return A_(e,i,r,o,n)}).filter(function(i){return!wt(i)});return a&&a.length?a.reduce(function(i,s){return[Math.min(i[0],s[0]),Math.max(i[1],s[1])]},[1/0,-1/0]):null},T_=function(e,t,r,n,o){var a=t.map(function(s){var u=s.props.dataKey;return r==="number"&&u&&A_(e,s,u,n)||Qm(e,u,r,o)});if(r==="number")return a.reduce(function(s,u){return[Math.min(s[0],u[0]),Math.max(s[1],u[1])]},[1/0,-1/0]);var i={};return a.reduce(function(s,u){for(var c=0,d=u.length;c<d;c++)i[u[c]]||(i[u[c]]=!0,s.push(u[c]));return s},[])},M_=function(e,t){return e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis"},__=function(e,t,r,n){if(n)return e.map(function(s){return s.coordinate});var o,a,i=e.map(function(s){return s.coordinate===t&&(o=!0),s.coordinate===r&&(a=!0),s.coordinate});return o||i.push(t),a||i.push(r),i},Xa=function(e,t,r){if(!e)return null;var n=e.scale,o=e.duplicateDomain,a=e.type,i=e.range,s=e.realScaleType==="scaleBand"?n.bandwidth()/2:2,u=(t||r)&&a==="category"&&n.bandwidth?n.bandwidth()/s:0;if(u=e.axisType==="angleAxis"&&i?.length>=2?Yn(i[0]-i[1])*2*u:u,t&&(e.ticks||e.niceTicks)){var c=(e.ticks||e.niceTicks).map(function(d){var f=o?o.indexOf(d):d;return{coordinate:n(f)+u,value:d,offset:u}});return c.filter(function(d){return!ic(d.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(d,f){return{coordinate:n(d)+u,value:d,index:f,offset:u}}):n.ticks&&!r?n.ticks(e.tickCount).map(function(d){return{coordinate:n(d)+u,value:d,offset:u}}):n.domain().map(function(d,f){return{coordinate:n(d)+u,value:o?o[d]:d,index:f,offset:u}})},D0=new WeakMap,Tm=function(e,t){if(typeof t!="function")return e;D0.has(e)||D0.set(e,new WeakMap);var r=D0.get(e);if(r.has(t))return r.get(t);var n=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return r.set(t,n),n},I_=function(e,t,r){var n=e.scale,o=e.type,a=e.layout,i=e.axisType;if(n==="auto")return a==="radial"&&i==="radiusAxis"?{scale:Dd(),realScaleType:"band"}:a==="radial"&&i==="angleAxis"?{scale:Fp(),realScaleType:"linear"}:o==="category"&&t&&(t.indexOf("LineChart")>=0||t.indexOf("AreaChart")>=0||t.indexOf("ComposedChart")>=0&&!r)?{scale:pd(),realScaleType:"point"}:o==="category"?{scale:Dd(),realScaleType:"band"}:{scale:Fp(),realScaleType:"linear"};if(Tf(n)){var s="scale".concat(hg(n));return{scale:($C[s]||pd)(),realScaleType:$C[s]?s:"point"}}return kt(n)?{scale:n}:{scale:pd(),realScaleType:"point"}},t6=1e-4,D_=function(e){var t=e.domain();if(!(!t||t.length<=2)){var r=t.length,n=e.range(),o=Math.min(n[0],n[1])-t6,a=Math.max(n[0],n[1])+t6,i=e(t[0]),s=e(t[r-1]);(i<o||i>a||s<o||s>a)&&e.domain([t[0],t[r-1]])}},Ote=function(e,t){if(!e)return null;for(var r=0,n=e.length;r<n;r++)if(e[r].item===t)return e[r].position;return null},Cte=function(e,t){if(!t||t.length!==2||!qe(t[0])||!qe(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),o=[e[0],e[1]];return(!qe(e[0])||e[0]<r)&&(o[0]=r),(!qe(e[1])||e[1]>n)&&(o[1]=n),o[0]>n&&(o[0]=n),o[1]<r&&(o[1]=r),o},Pte=function(e){var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r<n;++r)for(var o=0,a=0,i=0;i<t;++i){var s=ic(e[i][r][1])?e[i][r][0]:e[i][r][1];s>=0?(e[i][r][0]=o,e[i][r][1]=o+s,o=e[i][r][1]):(e[i][r][0]=a,e[i][r][1]=a+s,a=e[i][r][1])}},Ate=function(e){var t=e.length;if(!(t<=0))for(var r=0,n=e[0].length;r<n;++r)for(var o=0,a=0;a<t;++a){var i=ic(e[a][r][1])?e[a][r][0]:e[a][r][1];i>=0?(e[a][r][0]=o,e[a][r][1]=o+i,o=e[a][r][1]):(e[a][r][0]=0,e[a][r][1]=0)}},Tte={sign:Pte,expand:vY,none:ku,silhouette:yY,wiggle:xY,positive:Ate},Mte=function(e,t,r){var n=t.map(function(i){return i.props.dataKey}),o=Tte[r],a=bY().keys(n).value(function(i,s){return+zr(i,s,0)}).order(Aw).offset(o);return a(e)},_te=function(e,t,r,n,o,a){if(!e)return null;var i=a?t.reverse():t,s={},u=i.reduce(function(d,f){var h,p=(h=f.type)!==null&&h!==void 0&&h.defaultProps?on(on({},f.type.defaultProps),f.props):f.props,g=p.stackId,b=p.hide;if(b)return d;var v=p[r],x=d[v]||{hasStack:!1,stackGroups:{}};if(xn(g)){var k=x.stackGroups[g]||{numericAxisId:r,cateAxisId:n,items:[]};k.items.push(f),x.hasStack=!0,x.stackGroups[g]=k}else x.stackGroups[xs("_stackId_")]={numericAxisId:r,cateAxisId:n,items:[f]};return on(on({},d),{},su({},v,x))},s),c={};return Object.keys(u).reduce(function(d,f){var h=u[f];if(h.hasStack){var p={};h.stackGroups=Object.keys(h.stackGroups).reduce(function(g,b){var v=h.stackGroups[b];return on(on({},g),{},su({},b,{numericAxisId:r,cateAxisId:n,items:v.items,stackedData:Mte(e,v.items,o)}))},p)}return on(on({},d),{},su({},f,h))},c)},L_=function(e,t){var r=t.realScaleType,n=t.type,o=t.tickCount,a=t.originalDomain,i=t.allowDecimals,s=r||t.scale;if(s!=="auto"&&s!=="linear")return null;if(o&&n==="number"&&a&&(a[0]==="auto"||a[1]==="auto")){var u=e.domain();if(!u.length)return null;var c=Kee(u,o,i);return e.domain([Tg(c),Vi(c)]),{niceTicks:c}}if(o&&n==="number"){var d=e.domain(),f=Yee(d,o,i);return{niceTicks:f}}return null};function Au(e){var t=e.axis,r=e.ticks,n=e.bandSize,o=e.entry,a=e.index,i=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!wt(o[t.dataKey])){var s=xp(r,"value",o[t.dataKey]);if(s)return s.coordinate+n/2}return r[a]?r[a].coordinate+n/2:null}var u=zr(o,wt(i)?t.dataKey:i);return wt(u)?null:t.scale(u)}var r6=function(e){var t=e.axis,r=e.ticks,n=e.offset,o=e.bandSize,a=e.entry,i=e.index;if(t.type==="category")return r[i]?r[i].coordinate+n:null;var s=zr(a,t.dataKey,t.domain[i]);return wt(s)?null:t.scale(s)-o/2+n},Ite=function(e){var t=e.numericAxis,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return n<=0&&o>=0?0:o<0?o:n}return r[0]},Dte=function(e,t){var r,n=(r=e.type)!==null&&r!==void 0&&r.defaultProps?on(on({},e.type.defaultProps),e.props):e.props,o=n.stackId;if(xn(o)){var a=t[o];if(a){var i=a.items.indexOf(e);return i>=0?a.stackedData[i]:null}}return null},Lte=function(e){return e.reduce(function(t,r){return[Tg(r.concat([t[0]]).filter(qe)),Vi(r.concat([t[1]]).filter(qe))]},[1/0,-1/0])},R_=function(e,t,r){return Object.keys(e).reduce(function(n,o){var a=e[o],i=a.stackedData,s=i.reduce(function(u,c){var d=Lte(c.slice(t,r+1));return[Math.min(u[0],d[0]),Math.max(u[1],d[1])]},[1/0,-1/0]);return[Math.min(s[0],n[0]),Math.max(s[1],n[1])]},[1/0,-1/0]).map(function(n){return n===1/0||n===-1/0?0:n})},n6=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,o6=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,t2=function(e,t,r){if(kt(e))return e(t,r);if(!Array.isArray(e))return t;var n=[];if(qe(e[0]))n[0]=r?e[0]:Math.min(e[0],t[0]);else if(n6.test(e[0])){var o=+n6.exec(e[0])[1];n[0]=t[0]-o}else kt(e[0])?n[0]=e[0](t[0]):n[0]=t[0];if(qe(e[1]))n[1]=r?e[1]:Math.max(e[1],t[1]);else if(o6.test(e[1])){var a=+o6.exec(e[1])[1];n[1]=t[1]+a}else kt(e[1])?n[1]=e[1](t[1]):n[1]=t[1];return n},Vp=function(e,t,r){if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var o=NE(t,function(d){return d.coordinate}),a=1/0,i=1,s=o.length;i<s;i++){var u=o[i],c=o[i-1];a=Math.min((u.coordinate||0)-(c.coordinate||0),a)}return a===1/0?0:a}return r?void 0:0},a6=function(e,t,r){return!e||!e.length||cs(e,Co(r,"type.defaultProps.domain"))?t:e},F_=function(e,t){var r=e.type.defaultProps?on(on({},e.type.defaultProps),e.props):e.props,n=r.dataKey,o=r.name,a=r.unit,i=r.formatter,s=r.tooltipType,u=r.chartType,c=r.hide;return on(on({},ft(e,!1)),{},{dataKey:n,unit:a,formatter:i,name:o||n,color:ZE(e),value:zr(t,n),type:s,payload:t,chartType:u,hide:c})};function Ud(e){"@babel/helpers - typeof";return Ud=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},Ud(e)}function i6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Wa(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?i6(Object(r),!0).forEach(function(n){$_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $_(e,t,r){return t=Rte(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rte(e){var t=Fte(e,"string");return Ud(t)=="symbol"?t:t+""}function Fte(e,t){if(Ud(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ud(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $te(e,t){return qte(e)||Hte(e,t)||zte(e,t)||Bte()}function Bte(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
72
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zte(e,t){if(e){if(typeof e=="string")return s6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s6(e,t)}}function s6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Hte(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function qte(e){if(Array.isArray(e))return e}var Wp=Math.PI/180,Ute=function(e){return e*180/Math.PI},Ir=function(e,t,r,n){return{x:e+Math.cos(-Wp*n)*r,y:t+Math.sin(-Wp*n)*r}},B_=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(t-(r.top||0)-(r.bottom||0)))/2},Vte=function(e,t,r,n,o){var a=e.width,i=e.height,s=e.startAngle,u=e.endAngle,c=Gn(e.cx,a,a/2),d=Gn(e.cy,i,i/2),f=B_(a,i,r),h=Gn(e.innerRadius,f,0),p=Gn(e.outerRadius,f,f*.8),g=Object.keys(t);return g.reduce(function(b,v){var x=t[v],k=x.domain,E=x.reversed,j;if(wt(x.range))n==="angleAxis"?j=[s,u]:n==="radiusAxis"&&(j=[h,p]),E&&(j=[j[1],j[0]]);else{j=x.range;var S=j,C=$te(S,2);s=C[0],u=C[1]}var O=I_(x,o),M=O.realScaleType,A=O.scale;A.domain(k).range(j),D_(A);var T=L_(A,Wa(Wa({},x),{},{realScaleType:M})),_=Wa(Wa(Wa({},x),T),{},{range:j,radius:p,realScaleType:M,scale:A,cx:c,cy:d,innerRadius:h,outerRadius:p,startAngle:s,endAngle:u});return Wa(Wa({},b),{},$_({},v,_))},{})},Wte=function(e,t){var r=e.x,n=e.y,o=t.x,a=t.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(n-a,2))},Kte=function(e,t){var r=e.x,n=e.y,o=t.cx,a=t.cy,i=Wte({x:r,y:n},{x:o,y:a});if(i<=0)return{radius:i};var s=(r-o)/i,u=Math.acos(s);return n>a&&(u=2*Math.PI-u),{radius:i,angle:Ute(u),angleInRadian:u}},Yte=function(e){var t=e.startAngle,r=e.endAngle,n=Math.floor(t/360),o=Math.floor(r/360),a=Math.min(n,o);return{startAngle:t-a*360,endAngle:r-a*360}},Gte=function(e,t){var r=t.startAngle,n=t.endAngle,o=Math.floor(r/360),a=Math.floor(n/360),i=Math.min(o,a);return e+i*360},l6=function(e,t){var r=e.x,n=e.y,o=Kte({x:r,y:n},t),a=o.radius,i=o.angle,s=t.innerRadius,u=t.outerRadius;if(a<s||a>u)return!1;if(a===0)return!0;var c=Yte(t),d=c.startAngle,f=c.endAngle,h=i,p;if(d<=f){for(;h>f;)h-=360;for(;h<d;)h+=360;p=h>=d&&h<=f}else{for(;h>d;)h-=360;for(;h<f;)h+=360;p=h>=f&&h<=d}return p?Wa(Wa({},t),{},{radius:a,angle:Gte(h,t)}):null},z_=function(e){return!m.isValidElement(e)&&!kt(e)&&typeof e!="boolean"?e.className:""};function Vd(e){"@babel/helpers - typeof";return Vd=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},Vd(e)}var Xte=["offset"];function Zte(e){return tre(e)||ere(e)||Qte(e)||Jte()}function Jte(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
73
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qte(e,t){if(e){if(typeof e=="string")return r2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return r2(e,t)}}function ere(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tre(e){if(Array.isArray(e))return r2(e)}function r2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function rre(e,t){if(e==null)return{};var r=nre(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function nre(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function u6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function hn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?u6(Object(r),!0).forEach(function(n){ore(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ore(e,t,r){return t=are(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function are(e){var t=ire(e,"string");return Vd(t)=="symbol"?t:t+""}function ire(e,t){if(Vd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Vd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wd(){return Wd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Wd.apply(this,arguments)}var sre=function(e){var t=e.value,r=e.formatter,n=wt(e.children)?t:e.children;return kt(r)?r(n):n},lre=function(e,t){var r=Yn(t-e),n=Math.min(Math.abs(t-e),360);return r*n},ure=function(e,t,r){var n=e.position,o=e.viewBox,a=e.offset,i=e.className,s=o,u=s.cx,c=s.cy,d=s.innerRadius,f=s.outerRadius,h=s.startAngle,p=s.endAngle,g=s.clockWise,b=(d+f)/2,v=lre(h,p),x=v>=0?1:-1,k,E;n==="insideStart"?(k=h+x*a,E=g):n==="insideEnd"?(k=p-x*a,E=!g):n==="end"&&(k=p+x*a,E=g),E=v<=0?E:!E;var j=Ir(u,c,b,k),S=Ir(u,c,b,k+(E?1:-1)*359),C="M".concat(j.x,",").concat(j.y,`
74
+ A`).concat(b,",").concat(b,",0,1,").concat(E?0:1,`,
75
+ `).concat(S.x,",").concat(S.y),O=wt(e.id)?xs("recharts-radial-line-"):e.id;return y.createElement("text",Wd({},r,{dominantBaseline:"central",className:Dt("recharts-radial-bar-label",i)}),y.createElement("defs",null,y.createElement("path",{id:O,d:C})),y.createElement("textPath",{xlinkHref:"#".concat(O)},t))},cre=function(e){var t=e.viewBox,r=e.offset,n=e.position,o=t,a=o.cx,i=o.cy,s=o.innerRadius,u=o.outerRadius,c=o.startAngle,d=o.endAngle,f=(c+d)/2;if(n==="outside"){var h=Ir(a,i,u+r,f),p=h.x,g=h.y;return{x:p,y:g,textAnchor:p>=a?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:a,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:a,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:a,y:i,textAnchor:"middle",verticalAnchor:"end"};var b=(s+u)/2,v=Ir(a,i,b,f),x=v.x,k=v.y;return{x,y:k,textAnchor:"middle",verticalAnchor:"middle"}},dre=function(e){var t=e.viewBox,r=e.parentViewBox,n=e.offset,o=e.position,a=t,i=a.x,s=a.y,u=a.width,c=a.height,d=c>=0?1:-1,f=d*n,h=d>0?"end":"start",p=d>0?"start":"end",g=u>=0?1:-1,b=g*n,v=g>0?"end":"start",x=g>0?"start":"end";if(o==="top"){var k={x:i+u/2,y:s-d*n,textAnchor:"middle",verticalAnchor:h};return hn(hn({},k),r?{height:Math.max(s-r.y,0),width:u}:{})}if(o==="bottom"){var E={x:i+u/2,y:s+c+f,textAnchor:"middle",verticalAnchor:p};return hn(hn({},E),r?{height:Math.max(r.y+r.height-(s+c),0),width:u}:{})}if(o==="left"){var j={x:i-b,y:s+c/2,textAnchor:v,verticalAnchor:"middle"};return hn(hn({},j),r?{width:Math.max(j.x-r.x,0),height:c}:{})}if(o==="right"){var S={x:i+u+b,y:s+c/2,textAnchor:x,verticalAnchor:"middle"};return hn(hn({},S),r?{width:Math.max(r.x+r.width-S.x,0),height:c}:{})}var C=r?{width:u,height:c}:{};return o==="insideLeft"?hn({x:i+b,y:s+c/2,textAnchor:x,verticalAnchor:"middle"},C):o==="insideRight"?hn({x:i+u-b,y:s+c/2,textAnchor:v,verticalAnchor:"middle"},C):o==="insideTop"?hn({x:i+u/2,y:s+f,textAnchor:"middle",verticalAnchor:p},C):o==="insideBottom"?hn({x:i+u/2,y:s+c-f,textAnchor:"middle",verticalAnchor:h},C):o==="insideTopLeft"?hn({x:i+b,y:s+f,textAnchor:x,verticalAnchor:p},C):o==="insideTopRight"?hn({x:i+u-b,y:s+f,textAnchor:v,verticalAnchor:p},C):o==="insideBottomLeft"?hn({x:i+b,y:s+c-f,textAnchor:x,verticalAnchor:h},C):o==="insideBottomRight"?hn({x:i+u-b,y:s+c-f,textAnchor:v,verticalAnchor:h},C):ac(o)&&(qe(o.x)||Zs(o.x))&&(qe(o.y)||Zs(o.y))?hn({x:i+Gn(o.x,u),y:s+Gn(o.y,c),textAnchor:"end",verticalAnchor:"end"},C):hn({x:i+u/2,y:s+c/2,textAnchor:"middle",verticalAnchor:"middle"},C)},fre=function(e){return"cx"in e&&qe(e.cx)};function jr(e){var t=e.offset,r=t===void 0?5:t,n=rre(e,Xte),o=hn({offset:r},n),a=o.viewBox,i=o.position,s=o.value,u=o.children,c=o.content,d=o.className,f=d===void 0?"":d,h=o.textBreakAll;if(!a||wt(s)&&wt(u)&&!m.isValidElement(c)&&!kt(c))return null;if(m.isValidElement(c))return m.cloneElement(c,o);var p;if(kt(c)){if(p=m.createElement(c,o),m.isValidElement(p))return p}else p=sre(o);var g=fre(a),b=ft(o,!0);if(g&&(i==="insideStart"||i==="insideEnd"||i==="end"))return ure(o,p,b);var v=g?cre(o):dre(o);return y.createElement(dl,Wd({className:Dt("recharts-label",f)},b,v,{breakAll:h}),p)}jr.displayName="Label";var H_=function(e){var t=e.cx,r=e.cy,n=e.angle,o=e.startAngle,a=e.endAngle,i=e.r,s=e.radius,u=e.innerRadius,c=e.outerRadius,d=e.x,f=e.y,h=e.top,p=e.left,g=e.width,b=e.height,v=e.clockWise,x=e.labelViewBox;if(x)return x;if(qe(g)&&qe(b)){if(qe(d)&&qe(f))return{x:d,y:f,width:g,height:b};if(qe(h)&&qe(p))return{x:h,y:p,width:g,height:b}}return qe(d)&&qe(f)?{x:d,y:f,width:0,height:0}:qe(t)&&qe(r)?{cx:t,cy:r,startAngle:o||n||0,endAngle:a||n||0,innerRadius:u||0,outerRadius:c||s||i||0,clockWise:v}:e.viewBox?e.viewBox:{}},mre=function(e,t){return e?e===!0?y.createElement(jr,{key:"label-implicit",viewBox:t}):xn(e)?y.createElement(jr,{key:"label-implicit",viewBox:t,value:e}):m.isValidElement(e)?e.type===jr?m.cloneElement(e,{key:"label-implicit",viewBox:t}):y.createElement(jr,{key:"label-implicit",content:e,viewBox:t}):kt(e)?y.createElement(jr,{key:"label-implicit",content:e,viewBox:t}):ac(e)?y.createElement(jr,Wd({viewBox:t},e,{key:"label-implicit"})):null:null},pre=function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,o=H_(e),a=Jn(n,jr).map(function(s,u){return m.cloneElement(s,{viewBox:t||o,key:"label-".concat(u)})});if(!r)return a;var i=mre(e.label,t||o);return[i].concat(Zte(a))};jr.parseViewBox=H_;jr.renderCallByParent=pre;var L0,c6;function hre(){if(c6)return L0;c6=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return L0=e,L0}var gre=hre();const bre=mr(gre);function Kd(e){"@babel/helpers - typeof";return Kd=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},Kd(e)}var vre=["valueAccessor"],yre=["data","dataKey","clockWise","id","textBreakAll"];function xre(e){return Ere(e)||jre(e)||wre(e)||kre()}function kre(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
76
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wre(e,t){if(e){if(typeof e=="string")return n2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n2(e,t)}}function jre(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ere(e){if(Array.isArray(e))return n2(e)}function n2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kp(){return Kp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kp.apply(this,arguments)}function d6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function f6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?d6(Object(r),!0).forEach(function(n){Nre(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Nre(e,t,r){return t=Sre(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sre(e){var t=Ore(e,"string");return Kd(t)=="symbol"?t:t+""}function Ore(e,t){if(Kd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Kd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function m6(e,t){if(e==null)return{};var r=Cre(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Cre(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Pre=function(e){return Array.isArray(e.value)?bre(e.value):e.value};function Qo(e){var t=e.valueAccessor,r=t===void 0?Pre:t,n=m6(e,vre),o=n.data,a=n.dataKey,i=n.clockWise,s=n.id,u=n.textBreakAll,c=m6(n,yre);return!o||!o.length?null:y.createElement(Ft,{className:"recharts-label-list"},o.map(function(d,f){var h=wt(a)?r(d,f):zr(d&&d.payload,a),p=wt(s)?{}:{id:"".concat(s,"-").concat(f)};return y.createElement(jr,Kp({},ft(d,!0),c,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:u,viewBox:jr.parseViewBox(wt(i)?d:f6(f6({},d),{},{clockWise:i})),key:"label-".concat(f),index:f}))}))}Qo.displayName="LabelList";function Are(e,t){return e?e===!0?y.createElement(Qo,{key:"labelList-implicit",data:t}):y.isValidElement(e)||kt(e)?y.createElement(Qo,{key:"labelList-implicit",data:t,content:e}):ac(e)?y.createElement(Qo,Kp({data:t},e,{key:"labelList-implicit"})):null:null}function Tre(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var n=e.children,o=Jn(n,Qo).map(function(i,s){return m.cloneElement(i,{data:t,key:"labelList-".concat(s)})});if(!r)return o;var a=Are(e.label,t);return[a].concat(xre(o))}Qo.renderCallByParent=Tre;function Yd(e){"@babel/helpers - typeof";return Yd=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},Yd(e)}function o2(){return o2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o2.apply(this,arguments)}function p6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function h6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?p6(Object(r),!0).forEach(function(n){Mre(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Mre(e,t,r){return t=_re(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _re(e){var t=Ire(e,"string");return Yd(t)=="symbol"?t:t+""}function Ire(e,t){if(Yd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Yd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Dre=function(e,t){var r=Yn(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},Mm=function(e){var t=e.cx,r=e.cy,n=e.radius,o=e.angle,a=e.sign,i=e.isExternal,s=e.cornerRadius,u=e.cornerIsExternal,c=s*(i?1:-1)+n,d=Math.asin(s/c)/Wp,f=u?o:o+a*d,h=Ir(t,r,c,f),p=Ir(t,r,n,f),g=u?o-a*d:o,b=Ir(t,r,c*Math.cos(d*Wp),g);return{center:h,circleTangency:p,lineTangency:b,theta:d}},q_=function(e){var t=e.cx,r=e.cy,n=e.innerRadius,o=e.outerRadius,a=e.startAngle,i=e.endAngle,s=Dre(a,i),u=a+s,c=Ir(t,r,o,a),d=Ir(t,r,o,u),f="M ".concat(c.x,",").concat(c.y,`
77
+ A `).concat(o,",").concat(o,`,0,
78
+ `).concat(+(Math.abs(s)>180),",").concat(+(a>u),`,
79
+ `).concat(d.x,",").concat(d.y,`
80
+ `);if(n>0){var h=Ir(t,r,n,a),p=Ir(t,r,n,u);f+="L ".concat(p.x,",").concat(p.y,`
81
+ A `).concat(n,",").concat(n,`,0,
82
+ `).concat(+(Math.abs(s)>180),",").concat(+(a<=u),`,
83
+ `).concat(h.x,",").concat(h.y," Z")}else f+="L ".concat(t,",").concat(r," Z");return f},Lre=function(e){var t=e.cx,r=e.cy,n=e.innerRadius,o=e.outerRadius,a=e.cornerRadius,i=e.forceCornerRadius,s=e.cornerIsExternal,u=e.startAngle,c=e.endAngle,d=Yn(c-u),f=Mm({cx:t,cy:r,radius:o,angle:u,sign:d,cornerRadius:a,cornerIsExternal:s}),h=f.circleTangency,p=f.lineTangency,g=f.theta,b=Mm({cx:t,cy:r,radius:o,angle:c,sign:-d,cornerRadius:a,cornerIsExternal:s}),v=b.circleTangency,x=b.lineTangency,k=b.theta,E=s?Math.abs(u-c):Math.abs(u-c)-g-k;if(E<0)return i?"M ".concat(p.x,",").concat(p.y,`
84
+ a`).concat(a,",").concat(a,",0,0,1,").concat(a*2,`,0
85
+ a`).concat(a,",").concat(a,",0,0,1,").concat(-a*2,`,0
86
+ `):q_({cx:t,cy:r,innerRadius:n,outerRadius:o,startAngle:u,endAngle:c});var j="M ".concat(p.x,",").concat(p.y,`
87
+ A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(h.x,",").concat(h.y,`
88
+ A`).concat(o,",").concat(o,",0,").concat(+(E>180),",").concat(+(d<0),",").concat(v.x,",").concat(v.y,`
89
+ A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(x.x,",").concat(x.y,`
90
+ `);if(n>0){var S=Mm({cx:t,cy:r,radius:n,angle:u,sign:d,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),C=S.circleTangency,O=S.lineTangency,M=S.theta,A=Mm({cx:t,cy:r,radius:n,angle:c,sign:-d,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),T=A.circleTangency,_=A.lineTangency,F=A.theta,$=s?Math.abs(u-c):Math.abs(u-c)-M-F;if($<0&&a===0)return"".concat(j,"L").concat(t,",").concat(r,"Z");j+="L".concat(_.x,",").concat(_.y,`
91
+ A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(T.x,",").concat(T.y,`
92
+ A`).concat(n,",").concat(n,",0,").concat(+($>180),",").concat(+(d>0),",").concat(C.x,",").concat(C.y,`
93
+ A`).concat(a,",").concat(a,",0,0,").concat(+(d<0),",").concat(O.x,",").concat(O.y,"Z")}else j+="L".concat(t,",").concat(r,"Z");return j},Rre={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},JE=function(e){var t=h6(h6({},Rre),e),r=t.cx,n=t.cy,o=t.innerRadius,a=t.outerRadius,i=t.cornerRadius,s=t.forceCornerRadius,u=t.cornerIsExternal,c=t.startAngle,d=t.endAngle,f=t.className;if(a<o||c===d)return null;var h=Dt("recharts-sector",f),p=a-o,g=Gn(i,p,0,!0),b;return g>0&&Math.abs(c-d)<360?b=Lre({cx:r,cy:n,innerRadius:o,outerRadius:a,cornerRadius:Math.min(g,p/2),forceCornerRadius:s,cornerIsExternal:u,startAngle:c,endAngle:d}):b=q_({cx:r,cy:n,innerRadius:o,outerRadius:a,startAngle:c,endAngle:d}),y.createElement("path",o2({},ft(t,!0),{className:h,d:b,role:"img"}))};function Gd(e){"@babel/helpers - typeof";return Gd=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},Gd(e)}function a2(){return a2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a2.apply(this,arguments)}function g6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function b6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?g6(Object(r),!0).forEach(function(n){Fre(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fre(e,t,r){return t=$re(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $re(e){var t=Bre(e,"string");return Gd(t)=="symbol"?t:t+""}function Bre(e,t){if(Gd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Gd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var v6={curveBasisClosed:iY,curveBasisOpen:sY,curveBasis:aY,curveBumpX:VK,curveBumpY:WK,curveLinearClosed:lY,curveLinear:bg,curveMonotoneX:uY,curveMonotoneY:cY,curveNatural:dY,curveStep:fY,curveStepAfter:pY,curveStepBefore:mY},_m=function(e){return e.x===+e.x&&e.y===+e.y},$c=function(e){return e.x},Bc=function(e){return e.y},zre=function(e,t){if(kt(e))return e;var r="curve".concat(hg(e));return(r==="curveMonotone"||r==="curveBump")&&t?v6["".concat(r).concat(t==="vertical"?"Y":"X")]:v6[r]||bg},Hre=function(e){var t=e.type,r=t===void 0?"linear":t,n=e.points,o=n===void 0?[]:n,a=e.baseLine,i=e.layout,s=e.connectNulls,u=s===void 0?!1:s,c=zre(r,i),d=u?o.filter(function(g){return _m(g)}):o,f;if(Array.isArray(a)){var h=u?a.filter(function(g){return _m(g)}):a,p=d.map(function(g,b){return b6(b6({},g),{},{base:h[b]})});return i==="vertical"?f=Em().y(Bc).x1($c).x0(function(g){return g.base.x}):f=Em().x($c).y1(Bc).y0(function(g){return g.base.y}),f.defined(_m).curve(c),f(p)}return i==="vertical"&&qe(a)?f=Em().y(Bc).x1($c).x0(a):qe(a)?f=Em().x($c).y1(Bc).y0(a):f=HT().x($c).y(Bc),f.defined(_m).curve(c),f(d)},ts=function(e){var t=e.className,r=e.points,n=e.path,o=e.pathRef;if((!r||!r.length)&&!n)return null;var a=r&&r.length?Hre(e):n;return y.createElement("path",a2({},ft(e,!1),kp(e),{className:Dt("recharts-curve",t),d:a,ref:o}))},R0={exports:{}},F0,y6;function qre(){if(y6)return F0;y6=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return F0=e,F0}var $0,x6;function Ure(){if(x6)return $0;x6=1;var e=qre();function t(){}function r(){}return r.resetWarningCache=t,$0=function(){function n(i,s,u,c,d,f){if(f!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}n.isRequired=n;function o(){return n}var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return a.PropTypes=a,a},$0}var k6;function Vre(){return k6||(k6=1,R0.exports=Ure()()),R0.exports}var Wre=Vre();const fr=mr(Wre);var Kre=Object.getOwnPropertyNames,Yre=Object.getOwnPropertySymbols,Gre=Object.prototype.hasOwnProperty;function w6(e,t){return function(r,n,o){return e(r,n,o)&&t(r,n,o)}}function Im(e){return function(t,r,n){if(!t||!r||typeof t!="object"||typeof r!="object")return e(t,r,n);var o=n.cache,a=o.get(t),i=o.get(r);if(a&&i)return a===r&&i===t;o.set(t,r),o.set(r,t);var s=e(t,r,n);return o.delete(t),o.delete(r),s}}function j6(e){return Kre(e).concat(Yre(e))}var Xre=Object.hasOwn||function(e,t){return Gre.call(e,t)};function wl(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var Zre="__v",Jre="__o",Qre="_owner",E6=Object.getOwnPropertyDescriptor,N6=Object.keys;function ene(e,t,r){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(!r.equals(e[n],t[n],n,n,e,t,r))return!1;return!0}function tne(e,t){return wl(e.getTime(),t.getTime())}function rne(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function nne(e,t){return e===t}function S6(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var o=new Array(n),a=e.entries(),i,s,u=0;(i=a.next())&&!i.done;){for(var c=t.entries(),d=!1,f=0;(s=c.next())&&!s.done;){if(o[f]){f++;continue}var h=i.value,p=s.value;if(r.equals(h[0],p[0],u,f,e,t,r)&&r.equals(h[1],p[1],h[0],p[0],e,t,r)){d=o[f]=!0;break}f++}if(!d)return!1;u++}return!0}var one=wl;function ane(e,t,r){var n=N6(e),o=n.length;if(N6(t).length!==o)return!1;for(;o-- >0;)if(!U_(e,t,r,n[o]))return!1;return!0}function zc(e,t,r){var n=j6(e),o=n.length;if(j6(t).length!==o)return!1;for(var a,i,s;o-- >0;)if(a=n[o],!U_(e,t,r,a)||(i=E6(e,a),s=E6(t,a),(i||s)&&(!i||!s||i.configurable!==s.configurable||i.enumerable!==s.enumerable||i.writable!==s.writable)))return!1;return!0}function ine(e,t){return wl(e.valueOf(),t.valueOf())}function sne(e,t){return e.source===t.source&&e.flags===t.flags}function O6(e,t,r){var n=e.size;if(n!==t.size)return!1;if(!n)return!0;for(var o=new Array(n),a=e.values(),i,s;(i=a.next())&&!i.done;){for(var u=t.values(),c=!1,d=0;(s=u.next())&&!s.done;){if(!o[d]&&r.equals(i.value,s.value,i.value,s.value,e,t,r)){c=o[d]=!0;break}d++}if(!c)return!1}return!0}function lne(e,t){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(e[r]!==t[r])return!1;return!0}function une(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 U_(e,t,r,n){return(n===Qre||n===Jre||n===Zre)&&(e.$$typeof||t.$$typeof)?!0:Xre(t,n)&&r.equals(e[n],t[n],n,n,e,t,r)}var cne="[object Arguments]",dne="[object Boolean]",fne="[object Date]",mne="[object Error]",pne="[object Map]",hne="[object Number]",gne="[object Object]",bne="[object RegExp]",vne="[object Set]",yne="[object String]",xne="[object URL]",kne=Array.isArray,C6=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,P6=Object.assign,wne=Object.prototype.toString.call.bind(Object.prototype.toString);function jne(e){var t=e.areArraysEqual,r=e.areDatesEqual,n=e.areErrorsEqual,o=e.areFunctionsEqual,a=e.areMapsEqual,i=e.areNumbersEqual,s=e.areObjectsEqual,u=e.arePrimitiveWrappersEqual,c=e.areRegExpsEqual,d=e.areSetsEqual,f=e.areTypedArraysEqual,h=e.areUrlsEqual;return function(p,g,b){if(p===g)return!0;if(p==null||g==null)return!1;var v=typeof p;if(v!==typeof g)return!1;if(v!=="object")return v==="number"?i(p,g,b):v==="function"?o(p,g,b):!1;var x=p.constructor;if(x!==g.constructor)return!1;if(x===Object)return s(p,g,b);if(kne(p))return t(p,g,b);if(C6!=null&&C6(p))return f(p,g,b);if(x===Date)return r(p,g,b);if(x===RegExp)return c(p,g,b);if(x===Map)return a(p,g,b);if(x===Set)return d(p,g,b);var k=wne(p);return k===fne?r(p,g,b):k===bne?c(p,g,b):k===pne?a(p,g,b):k===vne?d(p,g,b):k===gne?typeof p.then!="function"&&typeof g.then!="function"&&s(p,g,b):k===xne?h(p,g,b):k===mne?n(p,g,b):k===cne?s(p,g,b):k===dne||k===hne||k===yne?u(p,g,b):!1}}function Ene(e){var t=e.circular,r=e.createCustomConfig,n=e.strict,o={areArraysEqual:n?zc:ene,areDatesEqual:tne,areErrorsEqual:rne,areFunctionsEqual:nne,areMapsEqual:n?w6(S6,zc):S6,areNumbersEqual:one,areObjectsEqual:n?zc:ane,arePrimitiveWrappersEqual:ine,areRegExpsEqual:sne,areSetsEqual:n?w6(O6,zc):O6,areTypedArraysEqual:n?zc:lne,areUrlsEqual:une};if(r&&(o=P6({},o,r(o))),t){var a=Im(o.areArraysEqual),i=Im(o.areMapsEqual),s=Im(o.areObjectsEqual),u=Im(o.areSetsEqual);o=P6({},o,{areArraysEqual:a,areMapsEqual:i,areObjectsEqual:s,areSetsEqual:u})}return o}function Nne(e){return function(t,r,n,o,a,i,s){return e(t,r,s)}}function Sne(e){var t=e.circular,r=e.comparator,n=e.createState,o=e.equals,a=e.strict;if(n)return function(s,u){var c=n(),d=c.cache,f=d===void 0?t?new WeakMap:void 0:d,h=c.meta;return r(s,u,{cache:f,equals:o,meta:h,strict:a})};if(t)return function(s,u){return r(s,u,{cache:new WeakMap,equals:o,meta:void 0,strict:a})};var i={cache:void 0,equals:o,meta:void 0,strict:a};return function(s,u){return r(s,u,i)}}var One=Es();Es({strict:!0});Es({circular:!0});Es({circular:!0,strict:!0});Es({createInternalComparator:function(){return wl}});Es({strict:!0,createInternalComparator:function(){return wl}});Es({circular:!0,createInternalComparator:function(){return wl}});Es({circular:!0,createInternalComparator:function(){return wl},strict:!0});function Es(e){e===void 0&&(e={});var t=e.circular,r=t===void 0?!1:t,n=e.createInternalComparator,o=e.createState,a=e.strict,i=a===void 0?!1:a,s=Ene(e),u=jne(s),c=n?n(u):Nne(u);return Sne({circular:r,comparator:u,createState:o,equals:c,strict:i})}function Cne(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function A6(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=-1,n=function o(a){r<0&&(r=a),a-r>t?(e(a),r=-1):Cne(o)};requestAnimationFrame(n)}function i2(e){"@babel/helpers - typeof";return i2=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},i2(e)}function Pne(e){return _ne(e)||Mne(e)||Tne(e)||Ane()}function Ane(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
94
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tne(e,t){if(e){if(typeof e=="string")return T6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return T6(e,t)}}function T6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Mne(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _ne(e){if(Array.isArray(e))return e}function Ine(){var e={},t=function(){return null},r=!1,n=function o(a){if(!r){if(Array.isArray(a)){if(!a.length)return;var i=a,s=Pne(i),u=s[0],c=s.slice(1);if(typeof u=="number"){A6(o.bind(null,c),u);return}o(u),A6(o.bind(null,c));return}i2(a)==="object"&&(e=a,t(e)),typeof a=="function"&&a()}};return{stop:function(){r=!0},start:function(o){r=!1,n(o)},subscribe:function(o){return t=o,function(){t=function(){return null}}}}}function Xd(e){"@babel/helpers - typeof";return Xd=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},Xd(e)}function M6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function _6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?M6(Object(r),!0).forEach(function(n){V_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function V_(e,t,r){return t=Dne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dne(e){var t=Lne(e,"string");return Xd(t)==="symbol"?t:String(t)}function Lne(e,t){if(Xd(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Xd(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Rne=function(e,t){return[Object.keys(e),Object.keys(t)].reduce(function(r,n){return r.filter(function(o){return n.includes(o)})})},Fne=function(e){return e},$ne=function(e){return e.replace(/([A-Z])/g,function(t){return"-".concat(t.toLowerCase())})},hd=function(e,t){return Object.keys(t).reduce(function(r,n){return _6(_6({},r),{},V_({},n,e(n,t[n])))},{})},I6=function(e,t,r){return e.map(function(n){return"".concat($ne(n)," ").concat(t,"ms ").concat(r)}).join(",")};function Bne(e,t){return qne(e)||Hne(e,t)||W_(e,t)||zne()}function zne(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
95
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hne(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function qne(e){if(Array.isArray(e))return e}function Une(e){return Kne(e)||Wne(e)||W_(e)||Vne()}function Vne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
96
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function W_(e,t){if(e){if(typeof e=="string")return s2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s2(e,t)}}function Wne(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Kne(e){if(Array.isArray(e))return s2(e)}function s2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Yp=1e-4,K_=function(e,t){return[0,3*e,3*t-6*e,3*e-3*t+1]},Y_=function(e,t){return e.map(function(r,n){return r*Math.pow(t,n)}).reduce(function(r,n){return r+n})},D6=function(e,t){return function(r){var n=K_(e,t);return Y_(n,r)}},Yne=function(e,t){return function(r){var n=K_(e,t),o=[].concat(Une(n.map(function(a,i){return a*i}).slice(1)),[0]);return Y_(o,r)}},L6=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t[0],o=t[1],a=t[2],i=t[3];if(t.length===1)switch(t[0]){case"linear":n=0,o=0,a=1,i=1;break;case"ease":n=.25,o=.1,a=.25,i=1;break;case"ease-in":n=.42,o=0,a=1,i=1;break;case"ease-out":n=.42,o=0,a=.58,i=1;break;case"ease-in-out":n=0,o=0,a=.58,i=1;break;default:{var s=t[0].split("(");if(s[0]==="cubic-bezier"&&s[1].split(")")[0].split(",").length===4){var u=s[1].split(")")[0].split(",").map(function(b){return parseFloat(b)}),c=Bne(u,4);n=c[0],o=c[1],a=c[2],i=c[3]}}}var d=D6(n,a),f=D6(o,i),h=Yne(n,a),p=function(b){return b>1?1:b<0?0:b},g=function(b){for(var v=b>1?1:b,x=v,k=0;k<8;++k){var E=d(x)-v,j=h(x);if(Math.abs(E-v)<Yp||j<Yp)return f(x);x=p(x-E/j)}return f(x)};return g.isStepper=!1,g},Gne=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,r=t===void 0?100:t,n=e.damping,o=n===void 0?8:n,a=e.dt,i=a===void 0?17:a,s=function(u,c,d){var f=-(u-c)*r,h=d*o,p=d+(f-h)*i/1e3,g=d*i/1e3+u;return Math.abs(g-c)<Yp&&Math.abs(p)<Yp?[c,0]:[g,p]};return s.isStepper=!0,s.dt=i,s},Xne=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t[0];if(typeof n=="string")switch(n){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return L6(n);case"spring":return Gne();default:if(n.split("(")[0]==="cubic-bezier")return L6(n)}return typeof n=="function"?n:null};function Zd(e){"@babel/helpers - typeof";return Zd=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},Zd(e)}function R6(e){return Qne(e)||Jne(e)||G_(e)||Zne()}function Zne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
97
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jne(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Qne(e){if(Array.isArray(e))return u2(e)}function F6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Tn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?F6(Object(r),!0).forEach(function(n){l2(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function l2(e,t,r){return t=eoe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eoe(e){var t=toe(e,"string");return Zd(t)==="symbol"?t:String(t)}function toe(e,t){if(Zd(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Zd(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function roe(e,t){return aoe(e)||ooe(e,t)||G_(e,t)||noe()}function noe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
98
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G_(e,t){if(e){if(typeof e=="string")return u2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return u2(e,t)}}function u2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ooe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function aoe(e){if(Array.isArray(e))return e}var Gp=function(e,t,r){return e+(t-e)*r},c2=function(e){var t=e.from,r=e.to;return t!==r},ioe=function e(t,r,n){var o=hd(function(a,i){if(c2(i)){var s=t(i.from,i.to,i.velocity),u=roe(s,2),c=u[0],d=u[1];return Tn(Tn({},i),{},{from:c,velocity:d})}return i},r);return n<1?hd(function(a,i){return c2(i)?Tn(Tn({},i),{},{velocity:Gp(i.velocity,o[a].velocity,n),from:Gp(i.from,o[a].from,n)}):i},r):e(t,o,n-1)};const soe=function(e,t,r,n,o){var a=Rne(e,t),i=a.reduce(function(v,x){return Tn(Tn({},v),{},l2({},x,[e[x],t[x]]))},{}),s=a.reduce(function(v,x){return Tn(Tn({},v),{},l2({},x,{from:e[x],velocity:0,to:t[x]}))},{}),u=-1,c,d,f=function(){return null},h=function(){return hd(function(v,x){return x.from},s)},p=function(){return!Object.values(s).filter(c2).length},g=function(v){c||(c=v);var x=v-c,k=x/r.dt;s=ioe(r,s,k),o(Tn(Tn(Tn({},e),t),h())),c=v,p()||(u=requestAnimationFrame(f))},b=function(v){d||(d=v);var x=(v-d)/n,k=hd(function(j,S){return Gp.apply(void 0,R6(S).concat([r(x)]))},i);if(o(Tn(Tn(Tn({},e),t),k)),x<1)u=requestAnimationFrame(f);else{var E=hd(function(j,S){return Gp.apply(void 0,R6(S).concat([r(1)]))},i);o(Tn(Tn(Tn({},e),t),E))}};return f=r.isStepper?g:b,function(){return requestAnimationFrame(f),function(){cancelAnimationFrame(u)}}};function Tu(e){"@babel/helpers - typeof";return Tu=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},Tu(e)}var loe=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function uoe(e,t){if(e==null)return{};var r=coe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function coe(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}function B0(e){return poe(e)||moe(e)||foe(e)||doe()}function doe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
99
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function foe(e,t){if(e){if(typeof e=="string")return d2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d2(e,t)}}function moe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function poe(e){if(Array.isArray(e))return d2(e)}function d2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ko(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$6(Object(r),!0).forEach(function(n){id(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function id(e,t,r){return t=X_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hoe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function goe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,X_(n.key),n)}}function boe(e,t,r){return t&&goe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function X_(e){var t=voe(e,"string");return Tu(t)==="symbol"?t:String(t)}function voe(e,t){if(Tu(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Tu(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yoe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f2(e,t)}function f2(e,t){return f2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},f2(e,t)}function xoe(e){var t=koe();return function(){var r=Xp(e),n;if(t){var o=Xp(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m2(this,n)}}function m2(e,t){if(t&&(Tu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return p2(e)}function p2(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function koe(){if(typeof Reflect>"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 Xp(e){return Xp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xp(e)}var Bo=function(e){yoe(r,e);var t=xoe(r);function r(n,o){var a;hoe(this,r),a=t.call(this,n,o);var i=a.props,s=i.isActive,u=i.attributeName,c=i.from,d=i.to,f=i.steps,h=i.children,p=i.duration;if(a.handleStyleChange=a.handleStyleChange.bind(p2(a)),a.changeStyle=a.changeStyle.bind(p2(a)),!s||p<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:d}),m2(a);if(f&&f.length)a.state={style:f[0].style};else if(c){if(typeof h=="function")return a.state={style:c},m2(a);a.state={style:u?id({},u,c):c}}else a.state={style:{}};return a}return boe(r,[{key:"componentDidMount",value:function(){var n=this.props,o=n.isActive,a=n.canBegin;this.mounted=!0,!(!o||!a)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(n){var o=this.props,a=o.isActive,i=o.canBegin,s=o.attributeName,u=o.shouldReAnimate,c=o.to,d=o.from,f=this.state.style;if(i){if(!a){var h={style:s?id({},s,c):c};this.state&&f&&(s&&f[s]!==c||!s&&f!==c)&&this.setState(h);return}if(!(One(n.to,c)&&n.canBegin&&n.isActive)){var p=!n.canBegin||!n.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var g=p||u?d:n.to;if(this.state&&f){var b={style:s?id({},s,g):g};(s&&f[s]!==g||!s&&f!==g)&&this.setState(b)}this.runAnimation(Ko(Ko({},this.props),{},{from:g,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var n=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),n&&n()}},{key:"handleStyleChange",value:function(n){this.changeStyle(n)}},{key:"changeStyle",value:function(n){this.mounted&&this.setState({style:n})}},{key:"runJSAnimation",value:function(n){var o=this,a=n.from,i=n.to,s=n.duration,u=n.easing,c=n.begin,d=n.onAnimationEnd,f=n.onAnimationStart,h=soe(a,i,Xne(u),s,this.changeStyle),p=function(){o.stopJSAnimation=h()};this.manager.start([f,c,p,s,d])}},{key:"runStepAnimation",value:function(n){var o=this,a=n.steps,i=n.begin,s=n.onAnimationStart,u=a[0],c=u.style,d=u.duration,f=d===void 0?0:d,h=function(p,g,b){if(b===0)return p;var v=g.duration,x=g.easing,k=x===void 0?"ease":x,E=g.style,j=g.properties,S=g.onAnimationEnd,C=b>0?a[b-1]:g,O=j||Object.keys(E);if(typeof k=="function"||k==="spring")return[].concat(B0(p),[o.runJSAnimation.bind(o,{from:C.style,to:E,duration:v,easing:k}),v]);var M=I6(O,v,k),A=Ko(Ko(Ko({},C.style),E),{},{transition:M});return[].concat(B0(p),[A,v,S]).filter(Fne)};return this.manager.start([s].concat(B0(a.reduce(h,[c,Math.max(f,i)])),[n.onAnimationEnd]))}},{key:"runAnimation",value:function(n){this.manager||(this.manager=Ine());var o=n.begin,a=n.duration,i=n.attributeName,s=n.to,u=n.easing,c=n.onAnimationStart,d=n.onAnimationEnd,f=n.steps,h=n.children,p=this.manager;if(this.unSubscribe=p.subscribe(this.handleStyleChange),typeof u=="function"||typeof h=="function"||u==="spring"){this.runJSAnimation(n);return}if(f.length>1){this.runStepAnimation(n);return}var g=i?id({},i,s):s,b=I6(Object.keys(g),a,u);p.start([c,o,Ko(Ko({},g),{},{transition:b}),a,d])}},{key:"render",value:function(){var n=this.props,o=n.children;n.begin;var a=n.duration;n.attributeName,n.easing;var i=n.isActive;n.steps,n.from,n.to,n.canBegin,n.onAnimationEnd,n.shouldReAnimate,n.onAnimationReStart;var s=uoe(n,loe),u=m.Children.count(o),c=this.state.style;if(typeof o=="function")return o(c);if(!i||u===0||a<=0)return o;var d=function(f){var h=f.props,p=h.style,g=p===void 0?{}:p,b=h.className,v=m.cloneElement(f,Ko(Ko({},s),{},{style:Ko(Ko({},g),c),className:b}));return v};return u===1?d(m.Children.only(o)):y.createElement("div",null,m.Children.map(o,function(f){return d(f)}))}}]),r}(m.PureComponent);Bo.displayName="Animate";Bo.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Bo.propTypes={from:fr.oneOfType([fr.object,fr.string]),to:fr.oneOfType([fr.object,fr.string]),attributeName:fr.string,duration:fr.number,begin:fr.number,easing:fr.oneOfType([fr.string,fr.func]),steps:fr.arrayOf(fr.shape({duration:fr.number.isRequired,style:fr.object.isRequired,easing:fr.oneOfType([fr.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),fr.func]),properties:fr.arrayOf("string"),onAnimationEnd:fr.func})),children:fr.oneOfType([fr.node,fr.func]),isActive:fr.bool,canBegin:fr.bool,onAnimationEnd:fr.func,shouldReAnimate:fr.bool,onAnimationStart:fr.func,onAnimationReStart:fr.func};function Jd(e){"@babel/helpers - typeof";return Jd=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},Jd(e)}function Zp(){return Zp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zp.apply(this,arguments)}function woe(e,t){return Soe(e)||Noe(e,t)||Eoe(e,t)||joe()}function joe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
100
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eoe(e,t){if(e){if(typeof e=="string")return B6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B6(e,t)}}function B6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Noe(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function Soe(e){if(Array.isArray(e))return e}function z6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function H6(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?z6(Object(r),!0).forEach(function(n){Ooe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ooe(e,t,r){return t=Coe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Coe(e){var t=Poe(e,"string");return Jd(t)=="symbol"?t:t+""}function Poe(e,t){if(Jd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Jd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var q6=function(e,t,r,n,o){var a=Math.min(Math.abs(r)/2,Math.abs(n)/2),i=n>=0?1:-1,s=r>=0?1:-1,u=n>=0&&r>=0||n<0&&r<0?1:0,c;if(a>0&&o instanceof Array){for(var d=[0,0,0,0],f=0,h=4;f<h;f++)d[f]=o[f]>a?a:o[f];c="M".concat(e,",").concat(t+i*d[0]),d[0]>0&&(c+="A ".concat(d[0],",").concat(d[0],",0,0,").concat(u,",").concat(e+s*d[0],",").concat(t)),c+="L ".concat(e+r-s*d[1],",").concat(t),d[1]>0&&(c+="A ".concat(d[1],",").concat(d[1],",0,0,").concat(u,`,
101
+ `).concat(e+r,",").concat(t+i*d[1])),c+="L ".concat(e+r,",").concat(t+n-i*d[2]),d[2]>0&&(c+="A ".concat(d[2],",").concat(d[2],",0,0,").concat(u,`,
102
+ `).concat(e+r-s*d[2],",").concat(t+n)),c+="L ".concat(e+s*d[3],",").concat(t+n),d[3]>0&&(c+="A ".concat(d[3],",").concat(d[3],",0,0,").concat(u,`,
103
+ `).concat(e,",").concat(t+n-i*d[3])),c+="Z"}else if(a>0&&o===+o&&o>0){var p=Math.min(a,o);c="M ".concat(e,",").concat(t+i*p,`
104
+ A `).concat(p,",").concat(p,",0,0,").concat(u,",").concat(e+s*p,",").concat(t,`
105
+ L `).concat(e+r-s*p,",").concat(t,`
106
+ A `).concat(p,",").concat(p,",0,0,").concat(u,",").concat(e+r,",").concat(t+i*p,`
107
+ L `).concat(e+r,",").concat(t+n-i*p,`
108
+ A `).concat(p,",").concat(p,",0,0,").concat(u,",").concat(e+r-s*p,",").concat(t+n,`
109
+ L `).concat(e+s*p,",").concat(t+n,`
110
+ A `).concat(p,",").concat(p,",0,0,").concat(u,",").concat(e,",").concat(t+n-i*p," Z")}else c="M ".concat(e,",").concat(t," h ").concat(r," v ").concat(n," h ").concat(-r," Z");return c},Aoe=function(e,t){if(!e||!t)return!1;var r=e.x,n=e.y,o=t.x,a=t.y,i=t.width,s=t.height;if(Math.abs(i)>0&&Math.abs(s)>0){var u=Math.min(o,o+i),c=Math.max(o,o+i),d=Math.min(a,a+s),f=Math.max(a,a+s);return r>=u&&r<=c&&n>=d&&n<=f}return!1},Toe={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},QE=function(e){var t=H6(H6({},Toe),e),r=m.useRef(),n=m.useState(-1),o=woe(n,2),a=o[0],i=o[1];m.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var E=r.current.getTotalLength();E&&i(E)}catch{}},[]);var s=t.x,u=t.y,c=t.width,d=t.height,f=t.radius,h=t.className,p=t.animationEasing,g=t.animationDuration,b=t.animationBegin,v=t.isAnimationActive,x=t.isUpdateAnimationActive;if(s!==+s||u!==+u||c!==+c||d!==+d||c===0||d===0)return null;var k=Dt("recharts-rectangle",h);return x?y.createElement(Bo,{canBegin:a>0,from:{width:c,height:d,x:s,y:u},to:{width:c,height:d,x:s,y:u},duration:g,animationEasing:p,isActive:x},function(E){var j=E.width,S=E.height,C=E.x,O=E.y;return y.createElement(Bo,{canBegin:a>0,from:"0px ".concat(a===-1?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:g,isActive:v,easing:p},y.createElement("path",Zp({},ft(t,!0),{className:k,d:q6(C,O,j,S,f),ref:r})))}):y.createElement("path",Zp({},ft(t,!0),{className:k,d:q6(s,u,c,d,f)}))},Moe=["points","className","baseLinePoints","connectNulls"];function Kl(){return Kl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Kl.apply(this,arguments)}function _oe(e,t){if(e==null)return{};var r=Ioe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Ioe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function U6(e){return Foe(e)||Roe(e)||Loe(e)||Doe()}function Doe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
111
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Loe(e,t){if(e){if(typeof e=="string")return h2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h2(e,t)}}function Roe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Foe(e){if(Array.isArray(e))return h2(e)}function h2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var V6=function(e){return e&&e.x===+e.x&&e.y===+e.y},$oe=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=[[]];return e.forEach(function(r){V6(r)?t[t.length-1].push(r):t[t.length-1].length>0&&t.push([])}),V6(e[0])&&t[t.length-1].push(e[0]),t[t.length-1].length<=0&&(t=t.slice(0,-1)),t},gd=function(e,t){var r=$oe(e);t&&(r=[r.reduce(function(o,a){return[].concat(U6(o),U6(a))},[])]);var n=r.map(function(o){return o.reduce(function(a,i,s){return"".concat(a).concat(s===0?"M":"L").concat(i.x,",").concat(i.y)},"")}).join("");return r.length===1?"".concat(n,"Z"):n},Boe=function(e,t,r){var n=gd(e,r);return"".concat(n.slice(-1)==="Z"?n.slice(0,-1):n,"L").concat(gd(t.reverse(),r).slice(1))},zoe=function(e){var t=e.points,r=e.className,n=e.baseLinePoints,o=e.connectNulls,a=_oe(e,Moe);if(!t||!t.length)return null;var i=Dt("recharts-polygon",r);if(n&&n.length){var s=a.stroke&&a.stroke!=="none",u=Boe(t,n,o);return y.createElement("g",{className:i},y.createElement("path",Kl({},ft(a,!0),{fill:u.slice(-1)==="Z"?a.fill:"none",stroke:"none",d:u})),s?y.createElement("path",Kl({},ft(a,!0),{fill:"none",d:gd(t,o)})):null,s?y.createElement("path",Kl({},ft(a,!0),{fill:"none",d:gd(n,o)})):null)}var c=gd(t,o);return y.createElement("path",Kl({},ft(a,!0),{fill:c.slice(-1)==="Z"?a.fill:"none",className:i,d:c}))};function g2(){return g2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g2.apply(this,arguments)}var Pa=function(e){var t=e.cx,r=e.cy,n=e.r,o=e.className,a=Dt("recharts-dot",o);return t===+t&&r===+r&&n===+n?y.createElement("circle",g2({},ft(e,!1),kp(e),{className:a,cx:t,cy:r,r:n})):null};function Qd(e){"@babel/helpers - typeof";return Qd=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},Qd(e)}var Hoe=["x","y","top","left","width","height","className"];function b2(){return b2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},b2.apply(this,arguments)}function W6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function qoe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?W6(Object(r),!0).forEach(function(n){Uoe(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Uoe(e,t,r){return t=Voe(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Voe(e){var t=Woe(e,"string");return Qd(t)=="symbol"?t:t+""}function Woe(e,t){if(Qd(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Qd(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Koe(e,t){if(e==null)return{};var r=Yoe(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Yoe(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Goe=function(e,t,r,n,o,a){return"M".concat(e,",").concat(o,"v").concat(n,"M").concat(a,",").concat(t,"h").concat(r)},Xoe=function(e){var t=e.x,r=t===void 0?0:t,n=e.y,o=n===void 0?0:n,a=e.top,i=a===void 0?0:a,s=e.left,u=s===void 0?0:s,c=e.width,d=c===void 0?0:c,f=e.height,h=f===void 0?0:f,p=e.className,g=Koe(e,Hoe),b=qoe({x:r,y:o,top:i,left:u,width:d,height:h},g);return!qe(r)||!qe(o)||!qe(d)||!qe(h)||!qe(i)||!qe(u)?null:y.createElement("path",b2({},ft(b,!0),{className:Dt("recharts-cross",p),d:Goe(r,o,d,h,i,u)}))},z0,K6;function Zoe(){if(K6)return z0;K6=1;var e=Ag(),t=f_(),r=La();function n(o,a){return o&&o.length?e(o,r(a,2),t):void 0}return z0=n,z0}var Joe=Zoe();const Qoe=mr(Joe);var H0,Y6;function eae(){if(Y6)return H0;Y6=1;var e=Ag(),t=La(),r=m_();function n(o,a){return o&&o.length?e(o,t(a,2),r):void 0}return H0=n,H0}var tae=eae();const rae=mr(tae);var nae=["cx","cy","angle","ticks","axisLine"],oae=["ticks","tick","angle","tickFormatter","stroke"];function Mu(e){"@babel/helpers - typeof";return Mu=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},Mu(e)}function bd(){return bd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bd.apply(this,arguments)}function G6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function _s(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?G6(Object(r),!0).forEach(function(n){Ig(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function X6(e,t){if(e==null)return{};var r=aae(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function aae(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function iae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z6(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,J_(n.key),n)}}function sae(e,t,r){return t&&Z6(e.prototype,t),r&&Z6(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function lae(e,t,r){return t=Jp(t),uae(e,Z_()?Reflect.construct(t,r||[],Jp(e).constructor):t.apply(e,r))}function uae(e,t){if(t&&(Mu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cae(e)}function cae(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Z_=function(){return!!e})()}function Jp(e){return Jp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Jp(e)}function dae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v2(e,t)}function v2(e,t){return v2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},v2(e,t)}function Ig(e,t,r){return t=J_(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J_(e){var t=fae(e,"string");return Mu(t)=="symbol"?t:t+""}function fae(e,t){if(Mu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Mu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Dg=function(e){function t(){return iae(this,t),lae(this,t,arguments)}return dae(t,e),sae(t,[{key:"getTickValueCoord",value:function(r){var n=r.coordinate,o=this.props,a=o.angle,i=o.cx,s=o.cy;return Ir(i,s,n,a)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,n;switch(r){case"left":n="end";break;case"right":n="start";break;default:n="middle";break}return n}},{key:"getViewBox",value:function(){var r=this.props,n=r.cx,o=r.cy,a=r.angle,i=r.ticks,s=Qoe(i,function(c){return c.coordinate||0}),u=rae(i,function(c){return c.coordinate||0});return{cx:n,cy:o,startAngle:a,endAngle:a,innerRadius:u.coordinate||0,outerRadius:s.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,n=r.cx,o=r.cy,a=r.angle,i=r.ticks,s=r.axisLine,u=X6(r,nae),c=i.reduce(function(p,g){return[Math.min(p[0],g.coordinate),Math.max(p[1],g.coordinate)]},[1/0,-1/0]),d=Ir(n,o,c[0],a),f=Ir(n,o,c[1],a),h=_s(_s(_s({},ft(u,!1)),{},{fill:"none"},ft(s,!1)),{},{x1:d.x,y1:d.y,x2:f.x,y2:f.y});return y.createElement("line",bd({className:"recharts-polar-radius-axis-line"},h))}},{key:"renderTicks",value:function(){var r=this,n=this.props,o=n.ticks,a=n.tick,i=n.angle,s=n.tickFormatter,u=n.stroke,c=X6(n,oae),d=this.getTickTextAnchor(),f=ft(c,!1),h=ft(a,!1),p=o.map(function(g,b){var v=r.getTickValueCoord(g),x=_s(_s(_s(_s({textAnchor:d,transform:"rotate(".concat(90-i,", ").concat(v.x,", ").concat(v.y,")")},f),{},{stroke:"none",fill:u},h),{},{index:b},v),{},{payload:g});return y.createElement(Ft,bd({className:Dt("recharts-polar-radius-axis-tick",z_(a)),key:"tick-".concat(g.coordinate)},us(r.props,g,b)),t.renderTickItem(a,x,s?s(g.value,b):g.value))});return y.createElement(Ft,{className:"recharts-polar-radius-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,n=r.ticks,o=r.axisLine,a=r.tick;return!n||!n.length?null:y.createElement(Ft,{className:Dt("recharts-polar-radius-axis",this.props.className)},o&&this.renderAxisLine(),a&&this.renderTicks(),jr.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,n,o){var a;return y.isValidElement(r)?a=y.cloneElement(r,n):kt(r)?a=r(n):a=y.createElement(dl,bd({},n,{className:"recharts-polar-radius-axis-tick-value"}),o),a}}])}(m.PureComponent);Ig(Dg,"displayName","PolarRadiusAxis");Ig(Dg,"axisType","radiusAxis");Ig(Dg,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function _u(e){"@babel/helpers - typeof";return _u=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},_u(e)}function Hs(){return Hs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Hs.apply(this,arguments)}function J6(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Is(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?J6(Object(r),!0).forEach(function(n){Lg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J6(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mae(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Q6(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,eI(n.key),n)}}function pae(e,t,r){return t&&Q6(e.prototype,t),r&&Q6(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hae(e,t,r){return t=Qp(t),gae(e,Q_()?Reflect.construct(t,r||[],Qp(e).constructor):t.apply(e,r))}function gae(e,t){if(t&&(_u(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return bae(e)}function bae(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Q_(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Q_=function(){return!!e})()}function Qp(e){return Qp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qp(e)}function vae(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y2(e,t)}function y2(e,t){return y2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},y2(e,t)}function Lg(e,t,r){return t=eI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eI(e){var t=yae(e,"string");return _u(t)=="symbol"?t:t+""}function yae(e,t){if(_u(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(_u(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var xae=Math.PI/180,kae=1e-5,Rg=function(e){function t(){return mae(this,t),hae(this,t,arguments)}return vae(t,e),pae(t,[{key:"getTickLineCoord",value:function(r){var n=this.props,o=n.cx,a=n.cy,i=n.radius,s=n.orientation,u=n.tickSize,c=u||8,d=Ir(o,a,i,r.coordinate),f=Ir(o,a,i+(s==="inner"?-1:1)*c,r.coordinate);return{x1:d.x,y1:d.y,x2:f.x,y2:f.y}}},{key:"getTickTextAnchor",value:function(r){var n=this.props.orientation,o=Math.cos(-r.coordinate*xae),a;return o>kae?a=n==="outer"?"start":"end":o<-1e-5?a=n==="outer"?"end":"start":a="middle",a}},{key:"renderAxisLine",value:function(){var r=this.props,n=r.cx,o=r.cy,a=r.radius,i=r.axisLine,s=r.axisLineType,u=Is(Is({},ft(this.props,!1)),{},{fill:"none"},ft(i,!1));if(s==="circle")return y.createElement(Pa,Hs({className:"recharts-polar-angle-axis-line"},u,{cx:n,cy:o,r:a}));var c=this.props.ticks,d=c.map(function(f){return Ir(n,o,a,f.coordinate)});return y.createElement(zoe,Hs({className:"recharts-polar-angle-axis-line"},u,{points:d}))}},{key:"renderTicks",value:function(){var r=this,n=this.props,o=n.ticks,a=n.tick,i=n.tickLine,s=n.tickFormatter,u=n.stroke,c=ft(this.props,!1),d=ft(a,!1),f=Is(Is({},c),{},{fill:"none"},ft(i,!1)),h=o.map(function(p,g){var b=r.getTickLineCoord(p),v=r.getTickTextAnchor(p),x=Is(Is(Is({textAnchor:v},c),{},{stroke:"none",fill:u},d),{},{index:g,payload:p,x:b.x2,y:b.y2});return y.createElement(Ft,Hs({className:Dt("recharts-polar-angle-axis-tick",z_(a)),key:"tick-".concat(p.coordinate)},us(r.props,p,g)),i&&y.createElement("line",Hs({className:"recharts-polar-angle-axis-tick-line"},f,b)),a&&t.renderTickItem(a,x,s?s(p.value,g):p.value))});return y.createElement(Ft,{className:"recharts-polar-angle-axis-ticks"},h)}},{key:"render",value:function(){var r=this.props,n=r.ticks,o=r.radius,a=r.axisLine;return o<=0||!n||!n.length?null:y.createElement(Ft,{className:Dt("recharts-polar-angle-axis",this.props.className)},a&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,n,o){var a;return y.isValidElement(r)?a=y.cloneElement(r,n):kt(r)?a=r(n):a=y.createElement(dl,Hs({},n,{className:"recharts-polar-angle-axis-tick-value"}),o),a}}])}(m.PureComponent);Lg(Rg,"displayName","PolarAngleAxis");Lg(Rg,"axisType","angleAxis");Lg(Rg,"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 q0,eP;function wae(){if(eP)return q0;eP=1;var e=dM(),t=e(Object.getPrototypeOf,Object);return q0=t,q0}var U0,tP;function jae(){if(tP)return U0;tP=1;var e=bi(),t=wae(),r=vi(),n="[object Object]",o=Function.prototype,a=Object.prototype,i=o.toString,s=a.hasOwnProperty,u=i.call(Object);function c(d){if(!r(d)||e(d)!=n)return!1;var f=t(d);if(f===null)return!0;var h=s.call(f,"constructor")&&f.constructor;return typeof h=="function"&&h instanceof h&&i.call(h)==u}return U0=c,U0}var Eae=jae();const Nae=mr(Eae);var V0,rP;function Sae(){if(rP)return V0;rP=1;var e=bi(),t=vi(),r="[object Boolean]";function n(o){return o===!0||o===!1||t(o)&&e(o)==r}return V0=n,V0}var Oae=Sae();const Cae=mr(Oae);function ef(e){"@babel/helpers - typeof";return ef=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},ef(e)}function eh(){return eh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},eh.apply(this,arguments)}function Pae(e,t){return _ae(e)||Mae(e,t)||Tae(e,t)||Aae()}function Aae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
112
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tae(e,t){if(e){if(typeof e=="string")return nP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nP(e,t)}}function nP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Mae(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function _ae(e){if(Array.isArray(e))return e}function oP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function aP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?oP(Object(r),!0).forEach(function(n){Iae(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Iae(e,t,r){return t=Dae(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dae(e){var t=Lae(e,"string");return ef(t)=="symbol"?t:t+""}function Lae(e,t){if(ef(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(ef(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iP=function(e,t,r,n,o){var a=r-n,i;return i="M ".concat(e,",").concat(t),i+="L ".concat(e+r,",").concat(t),i+="L ".concat(e+r-a/2,",").concat(t+o),i+="L ".concat(e+r-a/2-n,",").concat(t+o),i+="L ".concat(e,",").concat(t," Z"),i},Rae={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Fae=function(e){var t=aP(aP({},Rae),e),r=m.useRef(),n=m.useState(-1),o=Pae(n,2),a=o[0],i=o[1];m.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var k=r.current.getTotalLength();k&&i(k)}catch{}},[]);var s=t.x,u=t.y,c=t.upperWidth,d=t.lowerWidth,f=t.height,h=t.className,p=t.animationEasing,g=t.animationDuration,b=t.animationBegin,v=t.isUpdateAnimationActive;if(s!==+s||u!==+u||c!==+c||d!==+d||f!==+f||c===0&&d===0||f===0)return null;var x=Dt("recharts-trapezoid",h);return v?y.createElement(Bo,{canBegin:a>0,from:{upperWidth:0,lowerWidth:0,height:f,x:s,y:u},to:{upperWidth:c,lowerWidth:d,height:f,x:s,y:u},duration:g,animationEasing:p,isActive:v},function(k){var E=k.upperWidth,j=k.lowerWidth,S=k.height,C=k.x,O=k.y;return y.createElement(Bo,{canBegin:a>0,from:"0px ".concat(a===-1?1:a,"px"),to:"".concat(a,"px 0px"),attributeName:"strokeDasharray",begin:b,duration:g,easing:p},y.createElement("path",eh({},ft(t,!0),{className:x,d:iP(C,O,E,j,S),ref:r})))}):y.createElement("g",null,y.createElement("path",eh({},ft(t,!0),{className:x,d:iP(s,u,c,d,f)})))},$ae=["option","shapeType","propTransformer","activeClassName","isActive"];function tf(e){"@babel/helpers - typeof";return tf=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},tf(e)}function Bae(e,t){if(e==null)return{};var r=zae(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function zae(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function sP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function th(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sP(Object(r),!0).forEach(function(n){Hae(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Hae(e,t,r){return t=qae(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qae(e){var t=Uae(e,"string");return tf(t)=="symbol"?t:t+""}function Uae(e,t){if(tf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(tf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vae(e,t){return th(th({},t),e)}function Wae(e,t){return e==="symbols"}function lP(e){var t=e.shapeType,r=e.elementProps;switch(t){case"rectangle":return y.createElement(QE,r);case"trapezoid":return y.createElement(Fae,r);case"sector":return y.createElement(JE,r);case"symbols":if(Wae(t))return y.createElement(yg,r);break;default:return null}}function Kae(e){return m.isValidElement(e)?e.props:e}function rh(e){var t=e.option,r=e.shapeType,n=e.propTransformer,o=n===void 0?Vae:n,a=e.activeClassName,i=a===void 0?"recharts-active-shape":a,s=e.isActive,u=Bae(e,$ae),c;if(m.isValidElement(t))c=m.cloneElement(t,th(th({},u),Kae(t)));else if(kt(t))c=t(u);else if(Nae(t)&&!Cae(t)){var d=o(t,u);c=y.createElement(lP,{shapeType:r,elementProps:d})}else{var f=u;c=y.createElement(lP,{shapeType:r,elementProps:f})}return s?y.createElement(Ft,{className:i},c):c}function Fg(e,t){return t!=null&&"trapezoids"in e.props}function $g(e,t){return t!=null&&"sectors"in e.props}function rf(e,t){return t!=null&&"points"in e.props}function Yae(e,t){var r,n,o=e.x===(t==null||(r=t.labelViewBox)===null||r===void 0?void 0:r.x)||e.x===t.x,a=e.y===(t==null||(n=t.labelViewBox)===null||n===void 0?void 0:n.y)||e.y===t.y;return o&&a}function Gae(e,t){var r=e.endAngle===t.endAngle,n=e.startAngle===t.startAngle;return r&&n}function Xae(e,t){var r=e.x===t.x,n=e.y===t.y,o=e.z===t.z;return r&&n&&o}function Zae(e,t){var r;return Fg(e,t)?r=Yae:$g(e,t)?r=Gae:rf(e,t)&&(r=Xae),r}function Jae(e,t){var r;return Fg(e,t)?r="trapezoids":$g(e,t)?r="sectors":rf(e,t)&&(r="points"),r}function Qae(e,t){if(Fg(e,t)){var r;return(r=t.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}if($g(e,t)){var n;return(n=t.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}return rf(e,t)?t.payload:{}}function eie(e){var t=e.activeTooltipItem,r=e.graphicalItem,n=e.itemData,o=Jae(r,t),a=Qae(r,t),i=n.filter(function(u,c){var d=cs(a,u),f=r.props[o].filter(function(g){var b=Zae(r,t);return b(g,t)}),h=r.props[o].indexOf(f[f.length-1]),p=c===h;return d&&p}),s=n.indexOf(i[i.length-1]);return s}var ep;function Iu(e){"@babel/helpers - typeof";return Iu=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},Iu(e)}function Yl(){return Yl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yl.apply(this,arguments)}function uP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function _r(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uP(Object(r),!0).forEach(function(n){Lo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,rI(n.key),n)}}function rie(e,t,r){return t&&cP(e.prototype,t),r&&cP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nie(e,t,r){return t=nh(t),oie(e,tI()?Reflect.construct(t,r||[],nh(e).constructor):t.apply(e,r))}function oie(e,t){if(t&&(Iu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aie(e)}function aie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tI=function(){return!!e})()}function nh(e){return nh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},nh(e)}function iie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x2(e,t)}function x2(e,t){return x2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},x2(e,t)}function Lo(e,t,r){return t=rI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rI(e){var t=sie(e,"string");return Iu(t)=="symbol"?t:t+""}function sie(e,t){if(Iu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Iu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ki=function(e){function t(r){var n;return tie(this,t),n=nie(this,t,[r]),Lo(n,"pieRef",null),Lo(n,"sectorRefs",[]),Lo(n,"id",xs("recharts-pie-")),Lo(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),kt(o)&&o()}),Lo(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),kt(o)&&o()}),n.state={isAnimationFinished:!r.isAnimationActive,prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,sectorToFocus:0},n}return iie(t,e),rie(t,[{key:"isActiveIndex",value:function(r){var n=this.props.activeIndex;return Array.isArray(n)?n.indexOf(r)!==-1:r===n}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var n=this.props.isAnimationActive;if(n&&!this.state.isAnimationFinished)return null;var o=this.props,a=o.label,i=o.labelLine,s=o.dataKey,u=o.valueKey,c=ft(this.props,!1),d=ft(a,!1),f=ft(i,!1),h=a&&a.offsetRadius||20,p=r.map(function(g,b){var v=(g.startAngle+g.endAngle)/2,x=Ir(g.cx,g.cy,g.outerRadius+h,v),k=_r(_r(_r(_r({},c),g),{},{stroke:"none"},d),{},{index:b,textAnchor:t.getTextAnchor(x.x,g.cx)},x),E=_r(_r(_r(_r({},c),g),{},{fill:"none",stroke:g.fill},f),{},{index:b,points:[Ir(g.cx,g.cy,g.outerRadius,v),x]}),j=s;return wt(s)&&wt(u)?j="value":wt(s)&&(j=u),y.createElement(Ft,{key:"label-".concat(g.startAngle,"-").concat(g.endAngle,"-").concat(g.midAngle,"-").concat(b)},i&&t.renderLabelLineItem(i,E,"line"),t.renderLabelItem(a,k,zr(g,j)))});return y.createElement(Ft,{className:"recharts-pie-labels"},p)}},{key:"renderSectorsStatically",value:function(r){var n=this,o=this.props,a=o.activeShape,i=o.blendStroke,s=o.inactiveShape;return r.map(function(u,c){if(u?.startAngle===0&&u?.endAngle===0&&r.length!==1)return null;var d=n.isActiveIndex(c),f=s&&n.hasActiveIndex()?s:null,h=d?a:f,p=_r(_r({},u),{},{stroke:i?u.fill:u.stroke,tabIndex:-1});return y.createElement(Ft,Yl({ref:function(g){g&&!n.sectorRefs.includes(g)&&n.sectorRefs.push(g)},tabIndex:-1,className:"recharts-pie-sector"},us(n.props,u,c),{key:"sector-".concat(u?.startAngle,"-").concat(u?.endAngle,"-").concat(u.midAngle,"-").concat(c)}),y.createElement(rh,Yl({option:h,isActive:d,shapeType:"sector"},p)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,n=this.props,o=n.sectors,a=n.isAnimationActive,i=n.animationBegin,s=n.animationDuration,u=n.animationEasing,c=n.animationId,d=this.state,f=d.prevSectors,h=d.prevIsAnimationActive;return y.createElement(Bo,{begin:i,duration:s,isActive:a,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(c,"-").concat(h),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(p){var g=p.t,b=[],v=o&&o[0],x=v.startAngle;return o.forEach(function(k,E){var j=f&&f[E],S=E>0?Co(k,"paddingAngle",0):0;if(j){var C=Zr(j.endAngle-j.startAngle,k.endAngle-k.startAngle),O=_r(_r({},k),{},{startAngle:x+S,endAngle:x+C(g)+S});b.push(O),x=O.endAngle}else{var M=k.endAngle,A=k.startAngle,T=Zr(0,M-A),_=T(g),F=_r(_r({},k),{},{startAngle:x+S,endAngle:x+_+S});b.push(F),x=F.endAngle}}),y.createElement(Ft,null,r.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(r){var n=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var a=++n.state.sectorToFocus%n.sectorRefs.length;n.sectorRefs[a].focus(),n.setState({sectorToFocus:a});break}case"ArrowRight":{var i=--n.state.sectorToFocus<0?n.sectorRefs.length-1:n.state.sectorToFocus%n.sectorRefs.length;n.sectorRefs[i].focus(),n.setState({sectorToFocus:i});break}case"Escape":{n.sectorRefs[n.state.sectorToFocus].blur(),n.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,n=r.sectors,o=r.isAnimationActive,a=this.state.prevSectors;return o&&n&&n.length&&(!a||!cs(a,n))?this.renderSectorsWithAnimation():this.renderSectorsStatically(n)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,n=this.props,o=n.hide,a=n.sectors,i=n.className,s=n.label,u=n.cx,c=n.cy,d=n.innerRadius,f=n.outerRadius,h=n.isAnimationActive,p=this.state.isAnimationFinished;if(o||!a||!a.length||!qe(u)||!qe(c)||!qe(d)||!qe(f))return null;var g=Dt("recharts-pie",i);return y.createElement(Ft,{tabIndex:this.props.rootTabIndex,className:g,ref:function(b){r.pieRef=b}},this.renderSectors(),s&&this.renderLabels(a),jr.renderCallByParent(this.props,null,!1),(!h||p)&&Qo.renderCallByParent(this.props,a,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return n.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:n.curSectors,isAnimationFinished:!0}:r.sectors!==n.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,n){return r>n?"start":r<n?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,n,o){if(y.isValidElement(r))return y.cloneElement(r,n);if(kt(r))return r(n);var a=Dt("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return y.createElement(ts,Yl({},n,{key:o,type:"linear",className:a}))}},{key:"renderLabelItem",value:function(r,n,o){if(y.isValidElement(r))return y.cloneElement(r,n);var a=o;if(kt(r)&&(a=r(n),y.isValidElement(a)))return a;var i=Dt("recharts-pie-label-text",typeof r!="boolean"&&!kt(r)?r.className:"");return y.createElement(dl,Yl({},n,{alignmentBaseline:"middle",className:i}),a)}}])}(m.PureComponent);ep=ki;Lo(ki,"displayName","Pie");Lo(ki,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!yi.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});Lo(ki,"parseDeltaAngle",function(e,t){var r=Yn(t-e),n=Math.min(Math.abs(t-e),360);return r*n});Lo(ki,"getRealPieData",function(e){var t=e.data,r=e.children,n=ft(e,!1),o=Jn(r,jg);return t&&t.length?t.map(function(a,i){return _r(_r(_r({payload:a},n),a),o&&o[i]&&o[i].props)}):o&&o.length?o.map(function(a){return _r(_r({},n),a.props)}):[]});Lo(ki,"parseCoordinateOfPie",function(e,t){var r=t.top,n=t.left,o=t.width,a=t.height,i=B_(o,a),s=n+Gn(e.cx,o,o/2),u=r+Gn(e.cy,a,a/2),c=Gn(e.innerRadius,i,0),d=Gn(e.outerRadius,i,i*.8),f=e.maxRadius||Math.sqrt(o*o+a*a)/2;return{cx:s,cy:u,innerRadius:c,outerRadius:d,maxRadius:f}});Lo(ki,"getComposedData",function(e){var t=e.item,r=e.offset,n=t.type.defaultProps!==void 0?_r(_r({},t.type.defaultProps),t.props):t.props,o=ep.getRealPieData(n);if(!o||!o.length)return null;var a=n.cornerRadius,i=n.startAngle,s=n.endAngle,u=n.paddingAngle,c=n.dataKey,d=n.nameKey,f=n.valueKey,h=n.tooltipType,p=Math.abs(n.minAngle),g=ep.parseCoordinateOfPie(n,r),b=ep.parseDeltaAngle(i,s),v=Math.abs(b),x=c;wt(c)&&wt(f)?(Jo(!1,`Use "dataKey" to specify the value of pie,
113
+ the props "valueKey" will be deprecated in 1.1.0`),x="value"):wt(c)&&(Jo(!1,`Use "dataKey" to specify the value of pie,
114
+ the props "valueKey" will be deprecated in 1.1.0`),x=f);var k=o.filter(function(M){return zr(M,x,0)!==0}).length,E=(v>=360?k:k-1)*u,j=v-k*p-E,S=o.reduce(function(M,A){var T=zr(A,x,0);return M+(qe(T)?T:0)},0),C;if(S>0){var O;C=o.map(function(M,A){var T=zr(M,x,0),_=zr(M,d,A),F=(qe(T)?T:0)/S,$;A?$=O.endAngle+Yn(b)*u*(T!==0?1:0):$=i;var I=$+Yn(b)*((T!==0?p:0)+F*j),R=($+I)/2,W=(g.innerRadius+g.outerRadius)/2,B=[{name:_,value:T,payload:M,dataKey:x,type:h}],L=Ir(g.cx,g.cy,W,R);return O=_r(_r(_r({percent:F,cornerRadius:a,name:_,tooltipPayload:B,midAngle:R,middleRadius:W,tooltipPosition:L},M),g),{},{value:zr(M,x),startAngle:$,endAngle:I,payload:M,paddingAngle:Yn(b)*u}),O})}return _r(_r({},g),{},{sectors:C,data:o})});var W0,dP;function lie(){if(dP)return W0;dP=1;var e=Math.ceil,t=Math.max;function r(n,o,a,i){for(var s=-1,u=t(e((o-n)/(a||1)),0),c=Array(u);u--;)c[i?u:++s]=n,n+=a;return c}return W0=r,W0}var K0,fP;function nI(){if(fP)return K0;fP=1;var e=OM(),t=1/0,r=17976931348623157e292;function n(o){if(!o)return o===0?o:0;if(o=e(o),o===t||o===-1/0){var a=o<0?-1:1;return a*r}return o===o?o:0}return K0=n,K0}var Y0,mP;function uie(){if(mP)return Y0;mP=1;var e=lie(),t=wg(),r=nI();function n(o){return function(a,i,s){return s&&typeof s!="number"&&t(a,i,s)&&(i=s=void 0),a=r(a),i===void 0?(i=a,a=0):i=r(i),s=s===void 0?a<i?1:-1:r(s),e(a,i,s,o)}}return Y0=n,Y0}var G0,pP;function cie(){if(pP)return G0;pP=1;var e=uie(),t=e();return G0=t,G0}var die=cie();const oh=mr(die);function nf(e){"@babel/helpers - typeof";return nf=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},nf(e)}function hP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function gP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hP(Object(r),!0).forEach(function(n){oI(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function oI(e,t,r){return t=fie(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fie(e){var t=mie(e,"string");return nf(t)=="symbol"?t:t+""}function mie(e,t){if(nf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(nf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var pie=["Webkit","Moz","O","ms"],hie=function(e,t){var r=e.replace(/(\w)/,function(o){return o.toUpperCase()}),n=pie.reduce(function(o,a){return gP(gP({},o),{},oI({},a+r,t))},{});return n[e]=t,n};function Du(e){"@babel/helpers - typeof";return Du=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},Du(e)}function ah(){return ah=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ah.apply(this,arguments)}function bP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function X0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bP(Object(r),!0).forEach(function(n){po(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,iI(n.key),n)}}function bie(e,t,r){return t&&vP(e.prototype,t),r&&vP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function vie(e,t,r){return t=ih(t),yie(e,aI()?Reflect.construct(t,r||[],ih(e).constructor):t.apply(e,r))}function yie(e,t){if(t&&(Du(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xie(e)}function xie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function aI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(aI=function(){return!!e})()}function ih(e){return ih=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ih(e)}function kie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k2(e,t)}function k2(e,t){return k2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},k2(e,t)}function po(e,t,r){return t=iI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iI(e){var t=wie(e,"string");return Du(t)=="symbol"?t:t+""}function wie(e,t){if(Du(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Du(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var jie=function(e){var t=e.data,r=e.startIndex,n=e.endIndex,o=e.x,a=e.width,i=e.travellerWidth;if(!t||!t.length)return{};var s=t.length,u=pd().domain(oh(0,s)).range([o,o+a-i]),c=u.domain().map(function(d){return u(d)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:u(r),endX:u(n),scale:u,scaleValues:c}},yP=function(e){return e.changedTouches&&!!e.changedTouches.length},Lu=function(e){function t(r){var n;return gie(this,t),n=vie(this,t,[r]),po(n,"handleDrag",function(o){n.leaveTimer&&(clearTimeout(n.leaveTimer),n.leaveTimer=null),n.state.isTravellerMoving?n.handleTravellerMove(o):n.state.isSlideMoving&&n.handleSlideDrag(o)}),po(n,"handleTouchMove",function(o){o.changedTouches!=null&&o.changedTouches.length>0&&n.handleDrag(o.changedTouches[0])}),po(n,"handleDragEnd",function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var o=n.props,a=o.endIndex,i=o.onDragEnd,s=o.startIndex;i?.({endIndex:a,startIndex:s})}),n.detachDragEndListener()}),po(n,"handleLeaveWrapper",function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),po(n,"handleEnterSlideOrTraveller",function(){n.setState({isTextActive:!0})}),po(n,"handleLeaveSlideOrTraveller",function(){n.setState({isTextActive:!1})}),po(n,"handleSlideDragStart",function(o){var a=yP(o)?o.changedTouches[0]:o;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,"startX"),endX:n.handleTravellerDragStart.bind(n,"endX")},n.state={},n}return kie(t,e),bie(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var n=r.startX,o=r.endX,a=this.state.scaleValues,i=this.props,s=i.gap,u=i.data,c=u.length-1,d=Math.min(n,o),f=Math.max(n,o),h=t.getIndexInRange(a,d),p=t.getIndexInRange(a,f);return{startIndex:h-h%s,endIndex:p===c?c:p-p%s}}},{key:"getTextOfTick",value:function(r){var n=this.props,o=n.data,a=n.tickFormatter,i=n.dataKey,s=zr(o[r],i,r);return kt(a)?a(s,r):s}},{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 n=this.state,o=n.slideMoveStartX,a=n.startX,i=n.endX,s=this.props,u=s.x,c=s.width,d=s.travellerWidth,f=s.startIndex,h=s.endIndex,p=s.onChange,g=r.pageX-o;g>0?g=Math.min(g,u+c-d-i,u+c-d-a):g<0&&(g=Math.max(g,u-a,u-i));var b=this.getIndex({startX:a+g,endX:i+g});(b.startIndex!==f||b.endIndex!==h)&&p&&p(b),this.setState({startX:a+g,endX:i+g,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,n){var o=yP(n)?n.changedTouches[0]:n;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var n=this.state,o=n.brushMoveStartX,a=n.movingTravellerId,i=n.endX,s=n.startX,u=this.state[a],c=this.props,d=c.x,f=c.width,h=c.travellerWidth,p=c.onChange,g=c.gap,b=c.data,v={startX:this.state.startX,endX:this.state.endX},x=r.pageX-o;x>0?x=Math.min(x,d+f-h-u):x<0&&(x=Math.max(x,d-u)),v[a]=u+x;var k=this.getIndex(v),E=k.startIndex,j=k.endIndex,S=function(){var C=b.length-1;return a==="startX"&&(i>s?E%g===0:j%g===0)||i<s&&j===C||a==="endX"&&(i>s?j%g===0:E%g===0)||i>s&&j===C};this.setState(po(po({},a,u+x),"brushMoveStartX",r.pageX),function(){p&&S()&&p(k)})}},{key:"handleTravellerMoveKeyboard",value:function(r,n){var o=this,a=this.state,i=a.scaleValues,s=a.startX,u=a.endX,c=this.state[n],d=i.indexOf(c);if(d!==-1){var f=d+r;if(!(f===-1||f>=i.length)){var h=i[f];n==="startX"&&h>=u||n==="endX"&&h<=s||this.setState(po({},n,h),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,n=r.x,o=r.y,a=r.width,i=r.height,s=r.fill,u=r.stroke;return y.createElement("rect",{stroke:u,fill:s,x:n,y:o,width:a,height:i})}},{key:"renderPanorama",value:function(){var r=this.props,n=r.x,o=r.y,a=r.width,i=r.height,s=r.data,u=r.children,c=r.padding,d=m.Children.only(u);return d?y.cloneElement(d,{x:n,y:o,width:a,height:i,margin:c,compact:!0,data:s}):null}},{key:"renderTravellerLayer",value:function(r,n){var o,a,i=this,s=this.props,u=s.y,c=s.travellerWidth,d=s.height,f=s.traveller,h=s.ariaLabel,p=s.data,g=s.startIndex,b=s.endIndex,v=Math.max(r,this.props.x),x=X0(X0({},ft(this.props,!1)),{},{x:v,y:u,width:c,height:d}),k=h||"Min value: ".concat((o=p[g])===null||o===void 0?void 0:o.name,", Max value: ").concat((a=p[b])===null||a===void 0?void 0:a.name);return y.createElement(Ft,{tabIndex:0,role:"slider","aria-label":k,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(E){["ArrowLeft","ArrowRight"].includes(E.key)&&(E.preventDefault(),E.stopPropagation(),i.handleTravellerMoveKeyboard(E.key==="ArrowRight"?1:-1,n))},onFocus:function(){i.setState({isTravellerFocused:!0})},onBlur:function(){i.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(f,x))}},{key:"renderSlide",value:function(r,n){var o=this.props,a=o.y,i=o.height,s=o.stroke,u=o.travellerWidth,c=Math.min(r,n)+u,d=Math.max(Math.abs(n-r)-u,0);return y.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:s,fillOpacity:.2,x:c,y:a,width:d,height:i})}},{key:"renderText",value:function(){var r=this.props,n=r.startIndex,o=r.endIndex,a=r.y,i=r.height,s=r.travellerWidth,u=r.stroke,c=this.state,d=c.startX,f=c.endX,h=5,p={pointerEvents:"none",fill:u};return y.createElement(Ft,{className:"recharts-brush-texts"},y.createElement(dl,ah({textAnchor:"end",verticalAnchor:"middle",x:Math.min(d,f)-h,y:a+i/2},p),this.getTextOfTick(n)),y.createElement(dl,ah({textAnchor:"start",verticalAnchor:"middle",x:Math.max(d,f)+s+h,y:a+i/2},p),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,n=r.data,o=r.className,a=r.children,i=r.x,s=r.y,u=r.width,c=r.height,d=r.alwaysShowText,f=this.state,h=f.startX,p=f.endX,g=f.isTextActive,b=f.isSlideMoving,v=f.isTravellerMoving,x=f.isTravellerFocused;if(!n||!n.length||!qe(i)||!qe(s)||!qe(u)||!qe(c)||u<=0||c<=0)return null;var k=Dt("recharts-brush",o),E=y.Children.count(a)===1,j=hie("userSelect","none");return y.createElement(Ft,{className:k,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:j},this.renderBackground(),E&&this.renderPanorama(),this.renderSlide(h,p),this.renderTravellerLayer(h,"startX"),this.renderTravellerLayer(p,"endX"),(g||b||v||x||d)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var n=r.x,o=r.y,a=r.width,i=r.height,s=r.stroke,u=Math.floor(o+i/2)-1;return y.createElement(y.Fragment,null,y.createElement("rect",{x:n,y:o,width:a,height:i,fill:s,stroke:"none"}),y.createElement("line",{x1:n+1,y1:u,x2:n+a-1,y2:u,fill:"none",stroke:"#fff"}),y.createElement("line",{x1:n+1,y1:u+2,x2:n+a-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,n){var o;return y.isValidElement(r)?o=y.cloneElement(r,n):kt(r)?o=r(n):o=t.renderDefaultTraveller(n),o}},{key:"getDerivedStateFromProps",value:function(r,n){var o=r.data,a=r.width,i=r.x,s=r.travellerWidth,u=r.updateId,c=r.startIndex,d=r.endIndex;if(o!==n.prevData||u!==n.prevUpdateId)return X0({prevData:o,prevTravellerWidth:s,prevUpdateId:u,prevX:i,prevWidth:a},o&&o.length?jie({data:o,width:a,x:i,travellerWidth:s,startIndex:c,endIndex:d}):{scale:null,scaleValues:null});if(n.scale&&(a!==n.prevWidth||i!==n.prevX||s!==n.prevTravellerWidth)){n.scale.range([i,i+a-s]);var f=n.scale.domain().map(function(h){return n.scale(h)});return{prevData:o,prevTravellerWidth:s,prevUpdateId:u,prevX:i,prevWidth:a,startX:n.scale(r.startIndex),endX:n.scale(r.endIndex),scaleValues:f}}return null}},{key:"getIndexInRange",value:function(r,n){for(var o=r.length,a=0,i=o-1;i-a>1;){var s=Math.floor((a+i)/2);r[s]>n?i=s:a=s}return n>=r[i]?i:a}}])}(m.PureComponent);po(Lu,"displayName","Brush");po(Lu,"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 Z0,xP;function Eie(){if(xP)return Z0;xP=1;var e=EE();function t(r,n){var o;return e(r,function(a,i,s){return o=n(a,i,s),!o}),!!o}return Z0=t,Z0}var J0,kP;function Nie(){if(kP)return J0;kP=1;var e=oM(),t=La(),r=Eie(),n=co(),o=wg();function a(i,s,u){var c=n(i)?e:r;return u&&o(i,s,u)&&(s=void 0),c(i,t(s,3))}return J0=a,J0}var Sie=Nie();const Oie=mr(Sie);var ja=function(e,t){var r=e.alwaysShow,n=e.ifOverflow;return r&&(n="extendDomain"),n===t},Q0,wP;function Cie(){if(wP)return Q0;wP=1;var e=wM();function t(r,n,o){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:o,writable:!0}):r[n]=o}return Q0=t,Q0}var ek,jP;function Pie(){if(jP)return ek;jP=1;var e=Cie(),t=xM(),r=La();function n(o,a){var i={};return a=r(a,3),t(o,function(s,u,c){e(i,u,a(s,u,c))}),i}return ek=n,ek}var Aie=Pie();const Tie=mr(Aie);var tk,EP;function Mie(){if(EP)return tk;EP=1;function e(t,r){for(var n=-1,o=t==null?0:t.length;++n<o;)if(!r(t[n],n,t))return!1;return!0}return tk=e,tk}var rk,NP;function _ie(){if(NP)return rk;NP=1;var e=EE();function t(r,n){var o=!0;return e(r,function(a,i,s){return o=!!n(a,i,s),o}),o}return rk=t,rk}var nk,SP;function Iie(){if(SP)return nk;SP=1;var e=Mie(),t=_ie(),r=La(),n=co(),o=wg();function a(i,s,u){var c=n(i)?e:t;return u&&o(i,s,u)&&(s=void 0),c(i,r(s,3))}return nk=a,nk}var Die=Iie();const sI=mr(Die);var Lie=["x","y"];function of(e){"@babel/helpers - typeof";return of=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},of(e)}function w2(){return w2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w2.apply(this,arguments)}function OP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Hc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?OP(Object(r),!0).forEach(function(n){Rie(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):OP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rie(e,t,r){return t=Fie(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fie(e){var t=$ie(e,"string");return of(t)=="symbol"?t:t+""}function $ie(e,t){if(of(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(of(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bie(e,t){if(e==null)return{};var r=zie(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function zie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Hie(e,t){var r=e.x,n=e.y,o=Bie(e,Lie),a="".concat(r),i=parseInt(a,10),s="".concat(n),u=parseInt(s,10),c="".concat(t.height||o.height),d=parseInt(c,10),f="".concat(t.width||o.width),h=parseInt(f,10);return Hc(Hc(Hc(Hc(Hc({},t),o),i?{x:i}:{}),u?{y:u}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function CP(e){return y.createElement(rh,w2({shapeType:"rectangle",propTransformer:Hie,activeClassName:"recharts-active-bar"},e))}var qie=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,n){if(typeof e=="number")return e;var o=typeof r=="number";return o?e(r,n):(o||ml(),t)}},Uie=["value","background"],lI;function Ru(e){"@babel/helpers - typeof";return Ru=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},Ru(e)}function Vie(e,t){if(e==null)return{};var r=Wie(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Wie(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function sh(){return sh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sh.apply(this,arguments)}function PP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function cn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?PP(Object(r),!0).forEach(function(n){Wi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function AP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,cI(n.key),n)}}function Yie(e,t,r){return t&&AP(e.prototype,t),r&&AP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Gie(e,t,r){return t=lh(t),Xie(e,uI()?Reflect.construct(t,r||[],lh(e).constructor):t.apply(e,r))}function Xie(e,t){if(t&&(Ru(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Zie(e)}function Zie(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function uI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(uI=function(){return!!e})()}function lh(e){return lh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},lh(e)}function Jie(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&j2(e,t)}function j2(e,t){return j2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},j2(e,t)}function Wi(e,t,r){return t=cI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cI(e){var t=Qie(e,"string");return Ru(t)=="symbol"?t:t+""}function Qie(e,t){if(Ru(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ru(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ns=function(e){function t(){var r;Kie(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=Gie(this,t,[].concat(o)),Wi(r,"state",{isAnimationFinished:!1}),Wi(r,"id",xs("recharts-bar-")),Wi(r,"handleAnimationEnd",function(){var i=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),i&&i()}),Wi(r,"handleAnimationStart",function(){var i=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),i&&i()}),r}return Jie(t,e),Yie(t,[{key:"renderRectanglesStatically",value:function(r){var n=this,o=this.props,a=o.shape,i=o.dataKey,s=o.activeIndex,u=o.activeBar,c=ft(this.props,!1);return r&&r.map(function(d,f){var h=f===s,p=h?u:a,g=cn(cn(cn({},c),d),{},{isActive:h,option:p,index:f,dataKey:i,onAnimationStart:n.handleAnimationStart,onAnimationEnd:n.handleAnimationEnd});return y.createElement(Ft,sh({className:"recharts-bar-rectangle"},us(n.props,d,f),{key:"rectangle-".concat(d?.x,"-").concat(d?.y,"-").concat(d?.value,"-").concat(f)}),y.createElement(CP,g))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,n=this.props,o=n.data,a=n.layout,i=n.isAnimationActive,s=n.animationBegin,u=n.animationDuration,c=n.animationEasing,d=n.animationId,f=this.state.prevData;return y.createElement(Bo,{begin:s,duration:u,isActive:i,easing:c,from:{t:0},to:{t:1},key:"bar-".concat(d),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(h){var p=h.t,g=o.map(function(b,v){var x=f&&f[v];if(x){var k=Zr(x.x,b.x),E=Zr(x.y,b.y),j=Zr(x.width,b.width),S=Zr(x.height,b.height);return cn(cn({},b),{},{x:k(p),y:E(p),width:j(p),height:S(p)})}if(a==="horizontal"){var C=Zr(0,b.height),O=C(p);return cn(cn({},b),{},{y:b.y+b.height-O,height:O})}var M=Zr(0,b.width),A=M(p);return cn(cn({},b),{},{width:A})});return y.createElement(Ft,null,r.renderRectanglesStatically(g))})}},{key:"renderRectangles",value:function(){var r=this.props,n=r.data,o=r.isAnimationActive,a=this.state.prevData;return o&&n&&n.length&&(!a||!cs(a,n))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(n)}},{key:"renderBackground",value:function(){var r=this,n=this.props,o=n.data,a=n.dataKey,i=n.activeIndex,s=ft(this.props.background,!1);return o.map(function(u,c){u.value;var d=u.background,f=Vie(u,Uie);if(!d)return null;var h=cn(cn(cn(cn(cn({},f),{},{fill:"#eee"},d),s),us(r.props,u,c)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:a,index:c,className:"recharts-bar-background-rectangle"});return y.createElement(CP,sh({key:"background-bar-".concat(c),option:r.props.background,isActive:c===i},h))})}},{key:"renderErrorBar",value:function(r,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,a=o.data,i=o.xAxis,s=o.yAxis,u=o.layout,c=o.children,d=Jn(c,dc);if(!d)return null;var f=u==="vertical"?a[0].height/2:a[0].width/2,h=function(g,b){var v=Array.isArray(g.value)?g.value[1]:g.value;return{x:g.x,y:g.y,value:v,errorVal:zr(g,b)}},p={clipPath:r?"url(#clipPath-".concat(n,")"):null};return y.createElement(Ft,p,d.map(function(g){return y.cloneElement(g,{key:"error-bar-".concat(n,"-").concat(g.props.dataKey),data:a,xAxis:i,yAxis:s,layout:u,offset:f,dataPointFormatter:h})}))}},{key:"render",value:function(){var r=this.props,n=r.hide,o=r.data,a=r.className,i=r.xAxis,s=r.yAxis,u=r.left,c=r.top,d=r.width,f=r.height,h=r.isAnimationActive,p=r.background,g=r.id;if(n||!o||!o.length)return null;var b=this.state.isAnimationFinished,v=Dt("recharts-bar",a),x=i&&i.allowDataOverflow,k=s&&s.allowDataOverflow,E=x||k,j=wt(g)?this.id:g;return y.createElement(Ft,{className:v},x||k?y.createElement("defs",null,y.createElement("clipPath",{id:"clipPath-".concat(j)},y.createElement("rect",{x:x?u:u-d/2,y:k?c:c-f/2,width:x?d:d*2,height:k?f:f*2}))):null,y.createElement(Ft,{className:"recharts-bar-rectangles",clipPath:E?"url(#clipPath-".concat(j,")"):null},p?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(E,j),(!h||b)&&Qo.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:n.curData}:r.data!==n.curData?{curData:r.data}:null}}])}(m.PureComponent);lI=Ns;Wi(Ns,"displayName","Bar");Wi(Ns,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!yi.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});Wi(Ns,"getComposedData",function(e){var t=e.props,r=e.item,n=e.barPosition,o=e.bandSize,a=e.xAxis,i=e.yAxis,s=e.xAxisTicks,u=e.yAxisTicks,c=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=Ote(n,r);if(!p)return null;var g=t.layout,b=r.type.defaultProps,v=b!==void 0?cn(cn({},b),r.props):r.props,x=v.dataKey,k=v.children,E=v.minPointSize,j=g==="horizontal"?i:a,S=c?j.scale.domain():null,C=Ite({numericAxis:j}),O=Jn(k,jg),M=f.map(function(A,T){var _,F,$,I,R,W;c?_=Cte(c[d+T],S):(_=zr(A,x),Array.isArray(_)||(_=[C,_]));var B=qie(E,lI.defaultProps.minPointSize)(_[1],T);if(g==="horizontal"){var L,q=[i.scale(_[0]),i.scale(_[1])],U=q[0],H=q[1];F=r6({axis:a,ticks:s,bandSize:o,offset:p.offset,entry:A,index:T}),$=(L=H??U)!==null&&L!==void 0?L:void 0,I=p.size;var X=U-H;if(R=Number.isNaN(X)?0:X,W={x:F,y:i.y,width:I,height:i.height},Math.abs(B)>0&&Math.abs(R)<Math.abs(B)){var Y=Yn(R||B)*(Math.abs(B)-Math.abs(R));$-=Y,R+=Y}}else{var ae=[a.scale(_[0]),a.scale(_[1])],te=ae[0],me=ae[1];if(F=te,$=r6({axis:i,ticks:u,bandSize:o,offset:p.offset,entry:A,index:T}),I=me-te,R=p.size,W={x:a.x,y:$,width:a.width,height:R},Math.abs(B)>0&&Math.abs(I)<Math.abs(B)){var Q=Yn(I||B)*(Math.abs(B)-Math.abs(I));I+=Q}}return cn(cn(cn({},A),{},{x:F,y:$,width:I,height:R,value:c?_:_[1],payload:A,background:W},O&&O[T]&&O[T].props),{},{tooltipPayload:[F_(r,A)],tooltipPosition:{x:F+I/2,y:$+R/2}})});return cn({data:M,layout:g},h)});function af(e){"@babel/helpers - typeof";return af=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},af(e)}function ese(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function TP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,dI(n.key),n)}}function tse(e,t,r){return t&&TP(e.prototype,t),r&&TP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function MP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Go(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?MP(Object(r),!0).forEach(function(n){Bg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Bg(e,t,r){return t=dI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dI(e){var t=rse(e,"string");return af(t)=="symbol"?t:t+""}function rse(e,t){if(af(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(af(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var zg=function(e,t,r,n,o){var a=e.width,i=e.height,s=e.layout,u=e.children,c=Object.keys(t),d={left:r.left,leftMirror:r.left,right:a-r.right,rightMirror:a-r.right,top:r.top,topMirror:r.top,bottom:i-r.bottom,bottomMirror:i-r.bottom},f=!!ho(u,Ns);return c.reduce(function(h,p){var g=t[p],b=g.orientation,v=g.domain,x=g.padding,k=x===void 0?{}:x,E=g.mirror,j=g.reversed,S="".concat(b).concat(E?"Mirror":""),C,O,M,A,T;if(g.type==="number"&&(g.padding==="gap"||g.padding==="no-gap")){var _=v[1]-v[0],F=1/0,$=g.categoricalDomain.sort();if($.forEach(function(Y,ae){ae>0&&(F=Math.min((Y||0)-($[ae-1]||0),F))}),Number.isFinite(F)){var I=F/_,R=g.layout==="vertical"?r.height:r.width;if(g.padding==="gap"&&(C=I*R/2),g.padding==="no-gap"){var W=Gn(e.barCategoryGap,I*R),B=I*R/2;C=B-W-(B-W)/R*W}}}n==="xAxis"?O=[r.left+(k.left||0)+(C||0),r.left+r.width-(k.right||0)-(C||0)]:n==="yAxis"?O=s==="horizontal"?[r.top+r.height-(k.bottom||0),r.top+(k.top||0)]:[r.top+(k.top||0)+(C||0),r.top+r.height-(k.bottom||0)-(C||0)]:O=g.range,j&&(O=[O[1],O[0]]);var L=I_(g,o,f),q=L.scale,U=L.realScaleType;q.domain(v).range(O),D_(q);var H=L_(q,Go(Go({},g),{},{realScaleType:U}));n==="xAxis"?(T=b==="top"&&!E||b==="bottom"&&E,M=r.left,A=d[S]-T*g.height):n==="yAxis"&&(T=b==="left"&&!E||b==="right"&&E,M=d[S]-T*g.width,A=r.top);var X=Go(Go(Go({},g),H),{},{realScaleType:U,x:M,y:A,scale:q,width:n==="xAxis"?r.width:g.width,height:n==="yAxis"?r.height:g.height});return X.bandSize=Vp(X,H),!g.hide&&n==="xAxis"?d[S]+=(T?-1:1)*X.height:g.hide||(d[S]+=(T?-1:1)*X.width),Go(Go({},h),{},Bg({},p,X))},{})},fI=function(e,t){var r=e.x,n=e.y,o=t.x,a=t.y;return{x:Math.min(r,o),y:Math.min(n,a),width:Math.abs(o-r),height:Math.abs(a-n)}},nse=function(e){var t=e.x1,r=e.y1,n=e.x2,o=e.y2;return fI({x:t,y:r},{x:n,y:o})},mI=function(){function e(t){ese(this,e),this.scale=t}return tse(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(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.bandAware,o=r.position;if(t!==void 0){if(o)switch(o){case"start":return this.scale(t);case"middle":{var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+a}case"end":{var i=this.bandwidth?this.bandwidth():0;return this.scale(t)+i}default:return this.scale(t)}if(n){var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(t)+s}return this.scale(t)}}},{key:"isInRange",value:function(t){var r=this.range(),n=r[0],o=r[r.length-1];return n<=o?t>=n&&t<=o:t>=o&&t<=n}}],[{key:"create",value:function(t){return new e(t)}}])}();Bg(mI,"EPS",1e-4);var eN=function(e){var t=Object.keys(e).reduce(function(r,n){return Go(Go({},r),{},Bg({},n,mI.create(e[n])))},{});return Go(Go({},t),{},{apply:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.bandAware,a=n.position;return Tie(r,function(i,s){return t[s].apply(i,{bandAware:o,position:a})})},isInRange:function(r){return sI(r,function(n,o){return t[o].isInRange(n)})}})};function ose(e){return(e%180+180)%180}var ase=function(e){var t=e.width,r=e.height,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=ose(n),a=o*Math.PI/180,i=Math.atan(r/t),s=a>i&&a<Math.PI-i?r/Math.sin(a):t/Math.cos(a);return Math.abs(s)},ok,_P;function ise(){if(_P)return ok;_P=1;var e=La(),t=Mf(),r=xg();function n(o){return function(a,i,s){var u=Object(a);if(!t(a)){var c=e(i,3);a=r(a),i=function(f){return c(u[f],f,u)}}var d=o(a,i,s);return d>-1?u[c?a[d]:d]:void 0}}return ok=n,ok}var ak,IP;function sse(){if(IP)return ak;IP=1;var e=nI();function t(r){var n=e(r),o=n%1;return n===n?o?n-o:n:0}return ak=t,ak}var ik,DP;function lse(){if(DP)return ik;DP=1;var e=hM(),t=La(),r=sse(),n=Math.max;function o(a,i,s){var u=a==null?0:a.length;if(!u)return-1;var c=s==null?0:r(s);return c<0&&(c=n(u+c,0)),e(a,t(i,3),c)}return ik=o,ik}var sk,LP;function use(){if(LP)return sk;LP=1;var e=ise(),t=lse(),r=e(t);return sk=r,sk}var cse=use();const dse=mr(cse);var fse=AT();const mse=mr(fse);var pse=mse(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("")}),tN=m.createContext(void 0),rN=m.createContext(void 0),pI=m.createContext(void 0),hI=m.createContext({}),gI=m.createContext(void 0),bI=m.createContext(0),vI=m.createContext(0),RP=function(e){var t=e.state,r=t.xAxisMap,n=t.yAxisMap,o=t.offset,a=e.clipPathId,i=e.children,s=e.width,u=e.height,c=pse(o);return y.createElement(tN.Provider,{value:r},y.createElement(rN.Provider,{value:n},y.createElement(hI.Provider,{value:o},y.createElement(pI.Provider,{value:c},y.createElement(gI.Provider,{value:a},y.createElement(bI.Provider,{value:u},y.createElement(vI.Provider,{value:s},i)))))))},hse=function(){return m.useContext(gI)},yI=function(e){var t=m.useContext(tN);t==null&&ml();var r=t[e];return r==null&&ml(),r},gse=function(){var e=m.useContext(tN);return Hi(e)},bse=function(){var e=m.useContext(rN),t=dse(e,function(r){return sI(r.domain,Number.isFinite)});return t||Hi(e)},xI=function(e){var t=m.useContext(rN);t==null&&ml();var r=t[e];return r==null&&ml(),r},vse=function(){var e=m.useContext(pI);return e},yse=function(){return m.useContext(hI)},nN=function(){return m.useContext(vI)},oN=function(){return m.useContext(bI)};function Fu(e){"@babel/helpers - typeof";return Fu=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},Fu(e)}function xse(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kse(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,wI(n.key),n)}}function wse(e,t,r){return t&&kse(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function jse(e,t,r){return t=uh(t),Ese(e,kI()?Reflect.construct(t,r||[],uh(e).constructor):t.apply(e,r))}function Ese(e,t){if(t&&(Fu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nse(e)}function Nse(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(kI=function(){return!!e})()}function uh(e){return uh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uh(e)}function Sse(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&E2(e,t)}function E2(e,t){return E2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},E2(e,t)}function FP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function $P(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?FP(Object(r),!0).forEach(function(n){aN(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aN(e,t,r){return t=wI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wI(e){var t=Ose(e,"string");return Fu(t)=="symbol"?t:t+""}function Ose(e,t){if(Fu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Fu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Cse(e,t){return Mse(e)||Tse(e,t)||Ase(e,t)||Pse()}function Pse(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
115
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ase(e,t){if(e){if(typeof e=="string")return BP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return BP(e,t)}}function BP(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Tse(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function Mse(e){if(Array.isArray(e))return e}function N2(){return N2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},N2.apply(this,arguments)}var _se=function(e,t){var r;return y.isValidElement(e)?r=y.cloneElement(e,t):kt(e)?r=e(t):r=y.createElement("line",N2({},t,{className:"recharts-reference-line-line"})),r},Ise=function(e,t,r,n,o,a,i,s,u){var c=o.x,d=o.y,f=o.width,h=o.height;if(r){var p=u.y,g=e.y.apply(p,{position:a});if(ja(u,"discard")&&!e.y.isInRange(g))return null;var b=[{x:c+f,y:g},{x:c,y:g}];return s==="left"?b.reverse():b}if(t){var v=u.x,x=e.x.apply(v,{position:a});if(ja(u,"discard")&&!e.x.isInRange(x))return null;var k=[{x,y:d+h},{x,y:d}];return i==="top"?k.reverse():k}if(n){var E=u.segment,j=E.map(function(S){return e.apply(S,{position:a})});return ja(u,"discard")&&Oie(j,function(S){return!e.isInRange(S)})?null:j}return null};function Dse(e){var t=e.x,r=e.y,n=e.segment,o=e.xAxisId,a=e.yAxisId,i=e.shape,s=e.className,u=e.alwaysShow,c=hse(),d=yI(o),f=xI(a),h=vse();if(!c||!h)return null;Jo(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var p=eN({x:d.scale,y:f.scale}),g=xn(t),b=xn(r),v=n&&n.length===2,x=Ise(p,g,b,v,h,e.position,d.orientation,f.orientation,e);if(!x)return null;var k=Cse(x,2),E=k[0],j=E.x,S=E.y,C=k[1],O=C.x,M=C.y,A=ja(e,"hidden")?"url(#".concat(c,")"):void 0,T=$P($P({clipPath:A},ft(e,!0)),{},{x1:j,y1:S,x2:O,y2:M});return y.createElement(Ft,{className:Dt("recharts-reference-line",s)},_se(i,T),jr.renderCallByParent(e,nse({x1:j,y1:S,x2:O,y2:M})))}var iN=function(e){function t(){return xse(this,t),jse(this,t,arguments)}return Sse(t,e),wse(t,[{key:"render",value:function(){return y.createElement(Dse,this.props)}}])}(y.Component);aN(iN,"displayName","ReferenceLine");aN(iN,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function S2(){return S2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},S2.apply(this,arguments)}function $u(e){"@babel/helpers - typeof";return $u=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},$u(e)}function zP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function HP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zP(Object(r),!0).forEach(function(n){Hg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Lse(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rse(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,EI(n.key),n)}}function Fse(e,t,r){return t&&Rse(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $se(e,t,r){return t=ch(t),Bse(e,jI()?Reflect.construct(t,r||[],ch(e).constructor):t.apply(e,r))}function Bse(e,t){if(t&&($u(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zse(e)}function zse(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function jI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(jI=function(){return!!e})()}function ch(e){return ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ch(e)}function Hse(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O2(e,t)}function O2(e,t){return O2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},O2(e,t)}function Hg(e,t,r){return t=EI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function EI(e){var t=qse(e,"string");return $u(t)=="symbol"?t:t+""}function qse(e,t){if($u(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if($u(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Use=function(e){var t=e.x,r=e.y,n=e.xAxis,o=e.yAxis,a=eN({x:n.scale,y:o.scale}),i=a.apply({x:t,y:r},{bandAware:!0});return ja(e,"discard")&&!a.isInRange(i)?null:i},qg=function(e){function t(){return Lse(this,t),$se(this,t,arguments)}return Hse(t,e),Fse(t,[{key:"render",value:function(){var r=this.props,n=r.x,o=r.y,a=r.r,i=r.alwaysShow,s=r.clipPathId,u=xn(n),c=xn(o);if(Jo(i===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!u||!c)return null;var d=Use(this.props);if(!d)return null;var f=d.x,h=d.y,p=this.props,g=p.shape,b=p.className,v=ja(this.props,"hidden")?"url(#".concat(s,")"):void 0,x=HP(HP({clipPath:v},ft(this.props,!0)),{},{cx:f,cy:h});return y.createElement(Ft,{className:Dt("recharts-reference-dot",b)},t.renderDot(g,x),jr.renderCallByParent(this.props,{x:f-a,y:h-a,width:2*a,height:2*a}))}}])}(y.Component);Hg(qg,"displayName","ReferenceDot");Hg(qg,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});Hg(qg,"renderDot",function(e,t){var r;return y.isValidElement(e)?r=y.cloneElement(e,t):kt(e)?r=e(t):r=y.createElement(Pa,S2({},t,{cx:t.cx,cy:t.cy,className:"recharts-reference-dot-dot"})),r});function C2(){return C2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},C2.apply(this,arguments)}function Bu(e){"@babel/helpers - typeof";return Bu=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},Bu(e)}function qP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function UP(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?qP(Object(r),!0).forEach(function(n){Ug(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vse(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wse(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,SI(n.key),n)}}function Kse(e,t,r){return t&&Wse(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yse(e,t,r){return t=dh(t),Gse(e,NI()?Reflect.construct(t,r||[],dh(e).constructor):t.apply(e,r))}function Gse(e,t){if(t&&(Bu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xse(e)}function Xse(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function NI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(NI=function(){return!!e})()}function dh(e){return dh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},dh(e)}function Zse(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P2(e,t)}function P2(e,t){return P2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},P2(e,t)}function Ug(e,t,r){return t=SI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function SI(e){var t=Jse(e,"string");return Bu(t)=="symbol"?t:t+""}function Jse(e,t){if(Bu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Bu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Qse=function(e,t,r,n,o){var a=o.x1,i=o.x2,s=o.y1,u=o.y2,c=o.xAxis,d=o.yAxis;if(!c||!d)return null;var f=eN({x:c.scale,y:d.scale}),h={x:e?f.x.apply(a,{position:"start"}):f.x.rangeMin,y:r?f.y.apply(s,{position:"start"}):f.y.rangeMin},p={x:t?f.x.apply(i,{position:"end"}):f.x.rangeMax,y:n?f.y.apply(u,{position:"end"}):f.y.rangeMax};return ja(o,"discard")&&(!f.isInRange(h)||!f.isInRange(p))?null:fI(h,p)},Vg=function(e){function t(){return Vse(this,t),Yse(this,t,arguments)}return Zse(t,e),Kse(t,[{key:"render",value:function(){var r=this.props,n=r.x1,o=r.x2,a=r.y1,i=r.y2,s=r.className,u=r.alwaysShow,c=r.clipPathId;Jo(u===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var d=xn(n),f=xn(o),h=xn(a),p=xn(i),g=this.props.shape;if(!d&&!f&&!h&&!p&&!g)return null;var b=Qse(d,f,h,p,this.props);if(!b&&!g)return null;var v=ja(this.props,"hidden")?"url(#".concat(c,")"):void 0;return y.createElement(Ft,{className:Dt("recharts-reference-area",s)},t.renderRect(g,UP(UP({clipPath:v},ft(this.props,!0)),b)),jr.renderCallByParent(this.props,b))}}])}(y.Component);Ug(Vg,"displayName","ReferenceArea");Ug(Vg,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});Ug(Vg,"renderRect",function(e,t){var r;return y.isValidElement(e)?r=y.cloneElement(e,t):kt(e)?r=e(t):r=y.createElement(QE,C2({},t,{className:"recharts-reference-area-rect"})),r});function OI(e,t,r){if(t<1)return[];if(t===1&&r===void 0)return e;for(var n=[],o=0;o<e.length;o+=t)n.push(e[o]);return n}function ele(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return ase(n,r)}function tle(e,t,r){var n=r==="width",o=e.x,a=e.y,i=e.width,s=e.height;return t===1?{start:n?o:a,end:n?o+i:a+s}:{start:n?o+i:a+s,end:n?o:a}}function fh(e,t,r,n,o){if(e*t<e*n||e*t>e*o)return!1;var a=r();return e*(t-e*a/2-n)>=0&&e*(t+e*a/2-o)<=0}function rle(e,t){return OI(e,t+1)}function nle(e,t,r,n,o){for(var a=(n||[]).slice(),i=t.start,s=t.end,u=0,c=1,d=i,f=function(){var p=n?.[u];if(p===void 0)return{v:OI(n,c)};var g=u,b,v=function(){return b===void 0&&(b=r(p,g)),b},x=p.coordinate,k=u===0||fh(e,x,v,d,s);k||(u=0,d=i,c+=1),k&&(d=x+e*(v()/2+o),u+=c)},h;c<=a.length;)if(h=f(),h)return h.v;return[]}function sf(e){"@babel/helpers - typeof";return sf=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},sf(e)}function VP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Fn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?VP(Object(r),!0).forEach(function(n){ole(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):VP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ole(e,t,r){return t=ale(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ale(e){var t=ile(e,"string");return sf(t)=="symbol"?t:t+""}function ile(e,t){if(sf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(sf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sle(e,t,r,n,o){for(var a=(n||[]).slice(),i=a.length,s=t.start,u=t.end,c=function(f){var h=a[f],p,g=function(){return p===void 0&&(p=r(h,f)),p};if(f===i-1){var b=e*(h.coordinate+e*g()/2-u);a[f]=h=Fn(Fn({},h),{},{tickCoord:b>0?h.coordinate-b*e:h.coordinate})}else a[f]=h=Fn(Fn({},h),{},{tickCoord:h.coordinate});var v=fh(e,h.tickCoord,g,s,u);v&&(u=h.tickCoord-e*(g()/2+o),a[f]=Fn(Fn({},h),{},{isShow:!0}))},d=i-1;d>=0;d--)c(d);return a}function lle(e,t,r,n,o,a){var i=(n||[]).slice(),s=i.length,u=t.start,c=t.end;if(a){var d=n[s-1],f=r(d,s-1),h=e*(d.coordinate+e*f/2-c);i[s-1]=d=Fn(Fn({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=fh(e,d.tickCoord,function(){return f},u,c);p&&(c=d.tickCoord-e*(f/2+o),i[s-1]=Fn(Fn({},d),{},{isShow:!0}))}for(var g=a?s-1:s,b=function(x){var k=i[x],E,j=function(){return E===void 0&&(E=r(k,x)),E};if(x===0){var S=e*(k.coordinate-e*j()/2-u);i[x]=k=Fn(Fn({},k),{},{tickCoord:S<0?k.coordinate-S*e:k.coordinate})}else i[x]=k=Fn(Fn({},k),{},{tickCoord:k.coordinate});var C=fh(e,k.tickCoord,j,u,c);C&&(u=k.tickCoord+e*(j()/2+o),i[x]=Fn(Fn({},k),{},{isShow:!0}))},v=0;v<g;v++)b(v);return i}function sN(e,t,r){var n=e.tick,o=e.ticks,a=e.viewBox,i=e.minTickGap,s=e.orientation,u=e.interval,c=e.tickFormatter,d=e.unit,f=e.angle;if(!o||!o.length||!n)return[];if(qe(u)||yi.isSsr)return rle(o,typeof u=="number"&&qe(u)?u:0);var h=[],p=s==="top"||s==="bottom"?"width":"height",g=d&&p==="width"?md(d,{fontSize:t,letterSpacing:r}):{width:0,height:0},b=function(k,E){var j=kt(c)?c(k.value,E):k.value;return p==="width"?ele(md(j,{fontSize:t,letterSpacing:r}),g,f):md(j,{fontSize:t,letterSpacing:r})[p]},v=o.length>=2?Yn(o[1].coordinate-o[0].coordinate):1,x=tle(a,v,p);return u==="equidistantPreserveStart"?nle(v,x,b,o,i):(u==="preserveStart"||u==="preserveStartEnd"?h=lle(v,x,b,o,i,u==="preserveStartEnd"):h=sle(v,x,b,o,i),h.filter(function(k){return k.isShow}))}var ule=["viewBox"],cle=["viewBox"],dle=["ticks"];function zu(e){"@babel/helpers - typeof";return zu=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},zu(e)}function Gl(){return Gl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gl.apply(this,arguments)}function WP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Vn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?WP(Object(r),!0).forEach(function(n){lN(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function lk(e,t){if(e==null)return{};var r=fle(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function fle(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function mle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,PI(n.key),n)}}function ple(e,t,r){return t&&KP(e.prototype,t),r&&KP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function hle(e,t,r){return t=mh(t),gle(e,CI()?Reflect.construct(t,r||[],mh(e).constructor):t.apply(e,r))}function gle(e,t){if(t&&(zu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ble(e)}function ble(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function CI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(CI=function(){return!!e})()}function mh(e){return mh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},mh(e)}function vle(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A2(e,t)}function A2(e,t){return A2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},A2(e,t)}function lN(e,t,r){return t=PI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function PI(e){var t=yle(e,"string");return zu(t)=="symbol"?t:t+""}function yle(e,t){if(zu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(zu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var fc=function(e){function t(r){var n;return mle(this,t),n=hle(this,t,[r]),n.state={fontSize:"",letterSpacing:""},n}return vle(t,e),ple(t,[{key:"shouldComponentUpdate",value:function(r,n){var o=r.viewBox,a=lk(r,ule),i=this.props,s=i.viewBox,u=lk(i,cle);return!au(o,s)||!au(a,u)||!au(n,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var n=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];n&&this.setState({fontSize:window.getComputedStyle(n).fontSize,letterSpacing:window.getComputedStyle(n).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var n=this.props,o=n.x,a=n.y,i=n.width,s=n.height,u=n.orientation,c=n.tickSize,d=n.mirror,f=n.tickMargin,h,p,g,b,v,x,k=d?-1:1,E=r.tickSize||c,j=qe(r.tickCoord)?r.tickCoord:r.coordinate;switch(u){case"top":h=p=r.coordinate,b=a+ +!d*s,g=b-k*E,x=g-k*f,v=j;break;case"left":g=b=r.coordinate,p=o+ +!d*i,h=p-k*E,v=h-k*f,x=j;break;case"right":g=b=r.coordinate,p=o+ +d*i,h=p+k*E,v=h+k*f,x=j;break;default:h=p=r.coordinate,b=a+ +d*s,g=b+k*E,x=g+k*f,v=j;break}return{line:{x1:h,y1:g,x2:p,y2:b},tick:{x:v,y:x}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,n=r.orientation,o=r.mirror,a;switch(n){case"left":a=o?"start":"end";break;case"right":a=o?"end":"start";break;default:a="middle";break}return a}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,n=r.orientation,o=r.mirror,a="end";switch(n){case"left":case"right":a="middle";break;case"top":a=o?"start":"end";break;default:a=o?"end":"start";break}return a}},{key:"renderAxisLine",value:function(){var r=this.props,n=r.x,o=r.y,a=r.width,i=r.height,s=r.orientation,u=r.mirror,c=r.axisLine,d=Vn(Vn(Vn({},ft(this.props,!1)),ft(c,!1)),{},{fill:"none"});if(s==="top"||s==="bottom"){var f=+(s==="top"&&!u||s==="bottom"&&u);d=Vn(Vn({},d),{},{x1:n,y1:o+f*i,x2:n+a,y2:o+f*i})}else{var h=+(s==="left"&&!u||s==="right"&&u);d=Vn(Vn({},d),{},{x1:n+h*a,y1:o,x2:n+h*a,y2:o+i})}return y.createElement("line",Gl({},d,{className:Dt("recharts-cartesian-axis-line",Co(c,"className"))}))}},{key:"renderTicks",value:function(r,n,o){var a=this,i=this.props,s=i.tickLine,u=i.stroke,c=i.tick,d=i.tickFormatter,f=i.unit,h=sN(Vn(Vn({},this.props),{},{ticks:r}),n,o),p=this.getTickTextAnchor(),g=this.getTickVerticalAnchor(),b=ft(this.props,!1),v=ft(c,!1),x=Vn(Vn({},b),{},{fill:"none"},ft(s,!1)),k=h.map(function(E,j){var S=a.getTickLineCoord(E),C=S.line,O=S.tick,M=Vn(Vn(Vn(Vn({textAnchor:p,verticalAnchor:g},b),{},{stroke:"none",fill:u},v),O),{},{index:j,payload:E,visibleTicksCount:h.length,tickFormatter:d});return y.createElement(Ft,Gl({className:"recharts-cartesian-axis-tick",key:"tick-".concat(E.value,"-").concat(E.coordinate,"-").concat(E.tickCoord)},us(a.props,E,j)),s&&y.createElement("line",Gl({},x,C,{className:Dt("recharts-cartesian-axis-tick-line",Co(s,"className"))})),c&&t.renderTickItem(c,M,"".concat(kt(d)?d(E.value,j):E.value).concat(f||"")))});return y.createElement("g",{className:"recharts-cartesian-axis-ticks"},k)}},{key:"render",value:function(){var r=this,n=this.props,o=n.axisLine,a=n.width,i=n.height,s=n.ticksGenerator,u=n.className,c=n.hide;if(c)return null;var d=this.props,f=d.ticks,h=lk(d,dle),p=f;return kt(s)&&(p=f&&f.length>0?s(this.props):s(h)),a<=0||i<=0||!p||!p.length?null:y.createElement(Ft,{className:Dt("recharts-cartesian-axis",u),ref:function(g){r.layerReference=g}},o&&this.renderAxisLine(),this.renderTicks(p,this.state.fontSize,this.state.letterSpacing),jr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,n,o){var a;return y.isValidElement(r)?a=y.cloneElement(r,n):kt(r)?a=r(n):a=y.createElement(dl,Gl({},n,{className:"recharts-cartesian-axis-tick-value"}),o),a}}])}(m.Component);lN(fc,"displayName","CartesianAxis");lN(fc,"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 xle=["x1","y1","x2","y2","key"],kle=["offset"];function pl(e){"@babel/helpers - typeof";return pl=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},pl(e)}function YP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Bn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?YP(Object(r),!0).forEach(function(n){wle(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):YP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wle(e,t,r){return t=jle(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jle(e){var t=Ele(e,"string");return pl(t)=="symbol"?t:t+""}function Ele(e,t){if(pl(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(pl(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function el(){return el=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},el.apply(this,arguments)}function GP(e,t){if(e==null)return{};var r=Nle(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Nle(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var Sle=function(e){var t=e.fill;if(!t||t==="none")return null;var r=e.fillOpacity,n=e.x,o=e.y,a=e.width,i=e.height,s=e.ry;return y.createElement("rect",{x:n,y:o,ry:s,width:a,height:i,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function AI(e,t){var r;if(y.isValidElement(e))r=y.cloneElement(e,t);else if(kt(e))r=e(t);else{var n=t.x1,o=t.y1,a=t.x2,i=t.y2,s=t.key,u=GP(t,xle),c=ft(u,!1);c.offset;var d=GP(c,kle);r=y.createElement("line",el({},d,{x1:n,y1:o,x2:a,y2:i,fill:"none",key:s}))}return r}function Ole(e){var t=e.x,r=e.width,n=e.horizontal,o=n===void 0?!0:n,a=e.horizontalPoints;if(!o||!a||!a.length)return null;var i=a.map(function(s,u){var c=Bn(Bn({},e),{},{x1:t,y1:s,x2:t+r,y2:s,key:"line-".concat(u),index:u});return AI(o,c)});return y.createElement("g",{className:"recharts-cartesian-grid-horizontal"},i)}function Cle(e){var t=e.y,r=e.height,n=e.vertical,o=n===void 0?!0:n,a=e.verticalPoints;if(!o||!a||!a.length)return null;var i=a.map(function(s,u){var c=Bn(Bn({},e),{},{x1:s,y1:t,x2:s,y2:t+r,key:"line-".concat(u),index:u});return AI(o,c)});return y.createElement("g",{className:"recharts-cartesian-grid-vertical"},i)}function Ple(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,o=e.y,a=e.width,i=e.height,s=e.horizontalPoints,u=e.horizontal,c=u===void 0?!0:u;if(!c||!t||!t.length)return null;var d=s.map(function(h){return Math.round(h+o-o)}).sort(function(h,p){return h-p});o!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],b=g?o+i-h:d[p+1]-h;if(b<=0)return null;var v=p%t.length;return y.createElement("rect",{key:"react-".concat(p),y:h,x:n,height:b,width:a,stroke:"none",fill:t[v],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return y.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Ale(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,o=e.fillOpacity,a=e.x,i=e.y,s=e.width,u=e.height,c=e.verticalPoints;if(!r||!n||!n.length)return null;var d=c.map(function(h){return Math.round(h+a-a)}).sort(function(h,p){return h-p});a!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],b=g?a+s-h:d[p+1]-h;if(b<=0)return null;var v=p%n.length;return y.createElement("rect",{key:"react-".concat(p),x:h,y:i,width:b,height:u,stroke:"none",fill:n[v],fillOpacity:o,className:"recharts-cartesian-grid-bg"})});return y.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Tle=function(e,t){var r=e.xAxis,n=e.width,o=e.height,a=e.offset;return __(sN(Bn(Bn(Bn({},fc.defaultProps),r),{},{ticks:Xa(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),a.left,a.left+a.width,t)},Mle=function(e,t){var r=e.yAxis,n=e.width,o=e.height,a=e.offset;return __(sN(Bn(Bn(Bn({},fc.defaultProps),r),{},{ticks:Xa(r,!0),viewBox:{x:0,y:0,width:n,height:o}})),a.top,a.top+a.height,t)},Il={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Rf(e){var t,r,n,o,a,i,s=nN(),u=oN(),c=yse(),d=Bn(Bn({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:Il.stroke,fill:(r=e.fill)!==null&&r!==void 0?r:Il.fill,horizontal:(n=e.horizontal)!==null&&n!==void 0?n:Il.horizontal,horizontalFill:(o=e.horizontalFill)!==null&&o!==void 0?o:Il.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:Il.vertical,verticalFill:(i=e.verticalFill)!==null&&i!==void 0?i:Il.verticalFill,x:qe(e.x)?e.x:c.left,y:qe(e.y)?e.y:c.top,width:qe(e.width)?e.width:c.width,height:qe(e.height)?e.height:c.height}),f=d.x,h=d.y,p=d.width,g=d.height,b=d.syncWithTicks,v=d.horizontalValues,x=d.verticalValues,k=gse(),E=bse();if(!qe(p)||p<=0||!qe(g)||g<=0||!qe(f)||f!==+f||!qe(h)||h!==+h)return null;var j=d.verticalCoordinatesGenerator||Tle,S=d.horizontalCoordinatesGenerator||Mle,C=d.horizontalPoints,O=d.verticalPoints;if((!C||!C.length)&&kt(S)){var M=v&&v.length,A=S({yAxis:E?Bn(Bn({},E),{},{ticks:M?v:E.ticks}):void 0,width:s,height:u,offset:c},M?!0:b);Jo(Array.isArray(A),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(pl(A),"]")),Array.isArray(A)&&(C=A)}if((!O||!O.length)&&kt(j)){var T=x&&x.length,_=j({xAxis:k?Bn(Bn({},k),{},{ticks:T?x:k.ticks}):void 0,width:s,height:u,offset:c},T?!0:b);Jo(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(pl(_),"]")),Array.isArray(_)&&(O=_)}return y.createElement("g",{className:"recharts-cartesian-grid"},y.createElement(Sle,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),y.createElement(Ole,el({},d,{offset:c,horizontalPoints:C,xAxis:k,yAxis:E})),y.createElement(Cle,el({},d,{offset:c,verticalPoints:O,xAxis:k,yAxis:E})),y.createElement(Ple,el({},d,{horizontalPoints:C})),y.createElement(Ale,el({},d,{verticalPoints:O})))}Rf.displayName="CartesianGrid";var _le=["type","layout","connectNulls","ref"],Ile=["key"];function Hu(e){"@babel/helpers - typeof";return Hu=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},Hu(e)}function XP(e,t){if(e==null)return{};var r=Dle(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Dle(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function vd(){return vd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vd.apply(this,arguments)}function ZP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function mo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ZP(Object(r),!0).forEach(function(n){Xo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Dl(e){return $le(e)||Fle(e)||Rle(e)||Lle()}function Lle(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
116
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rle(e,t){if(e){if(typeof e=="string")return T2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return T2(e,t)}}function Fle(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function $le(e){if(Array.isArray(e))return T2(e)}function T2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ble(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function JP(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,MI(n.key),n)}}function zle(e,t,r){return t&&JP(e.prototype,t),r&&JP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hle(e,t,r){return t=ph(t),qle(e,TI()?Reflect.construct(t,r||[],ph(e).constructor):t.apply(e,r))}function qle(e,t){if(t&&(Hu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ule(e)}function Ule(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function TI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(TI=function(){return!!e})()}function ph(e){return ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ph(e)}function Vle(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&M2(e,t)}function M2(e,t){return M2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},M2(e,t)}function Xo(e,t,r){return t=MI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function MI(e){var t=Wle(e,"string");return Hu(t)=="symbol"?t:t+""}function Wle(e,t){if(Hu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var ds=function(e){function t(){var r;Ble(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=Hle(this,t,[].concat(o)),Xo(r,"state",{isAnimationFinished:!0,totalLength:0}),Xo(r,"generateSimpleStrokeDasharray",function(i,s){return"".concat(s,"px ").concat(i-s,"px")}),Xo(r,"getStrokeDasharray",function(i,s,u){var c=u.reduce(function(x,k){return x+k});if(!c)return r.generateSimpleStrokeDasharray(s,i);for(var d=Math.floor(i/c),f=i%c,h=s-i,p=[],g=0,b=0;g<u.length;b+=u[g],++g)if(b+u[g]>f){p=[].concat(Dl(u.slice(0,g)),[f-b]);break}var v=p.length%2===0?[0,h]:[h];return[].concat(Dl(t.repeat(u,d)),Dl(p),v).map(function(x){return"".concat(x,"px")}).join(", ")}),Xo(r,"id",xs("recharts-line-")),Xo(r,"pathRef",function(i){r.mainCurve=i}),Xo(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0}),r.props.onAnimationEnd&&r.props.onAnimationEnd()}),Xo(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1}),r.props.onAnimationStart&&r.props.onAnimationStart()}),r}return Vle(t,e),zle(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,n){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,a=o.points,i=o.xAxis,s=o.yAxis,u=o.layout,c=o.children,d=Jn(c,dc);if(!d)return null;var f=function(p,g){return{x:p.x,y:p.y,value:p.value,errorVal:zr(p.payload,g)}},h={clipPath:r?"url(#clipPath-".concat(n,")"):null};return y.createElement(Ft,h,d.map(function(p){return y.cloneElement(p,{key:"bar-".concat(p.props.dataKey),data:a,xAxis:i,yAxis:s,layout:u,dataPointFormatter:f})}))}},{key:"renderDots",value:function(r,n,o){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var i=this.props,s=i.dot,u=i.points,c=i.dataKey,d=ft(this.props,!1),f=ft(s,!0),h=u.map(function(g,b){var v=mo(mo(mo({key:"dot-".concat(b),r:3},d),f),{},{index:b,cx:g.x,cy:g.y,value:g.value,dataKey:c,payload:g.payload,points:u});return t.renderDotItem(s,v)}),p={clipPath:r?"url(#clipPath-".concat(n?"":"dots-").concat(o,")"):null};return y.createElement(Ft,vd({className:"recharts-line-dots",key:"dots"},p),h)}},{key:"renderCurveStatically",value:function(r,n,o,a){var i=this.props,s=i.type,u=i.layout,c=i.connectNulls;i.ref;var d=XP(i,_le),f=mo(mo(mo({},ft(d,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:n?"url(#clipPath-".concat(o,")"):null,points:r},a),{},{type:s,layout:u,connectNulls:c});return y.createElement(ts,vd({},f,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,n){var o=this,a=this.props,i=a.points,s=a.strokeDasharray,u=a.isAnimationActive,c=a.animationBegin,d=a.animationDuration,f=a.animationEasing,h=a.animationId,p=a.animateNewValues,g=a.width,b=a.height,v=this.state,x=v.prevPoints,k=v.totalLength;return y.createElement(Bo,{begin:c,duration:d,isActive:u,easing:f,from:{t:0},to:{t:1},key:"line-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(E){var j=E.t;if(x){var S=x.length/i.length,C=i.map(function(_,F){var $=Math.floor(F*S);if(x[$]){var I=x[$],R=Zr(I.x,_.x),W=Zr(I.y,_.y);return mo(mo({},_),{},{x:R(j),y:W(j)})}if(p){var B=Zr(g*2,_.x),L=Zr(b/2,_.y);return mo(mo({},_),{},{x:B(j),y:L(j)})}return mo(mo({},_),{},{x:_.x,y:_.y})});return o.renderCurveStatically(C,r,n)}var O=Zr(0,k),M=O(j),A;if(s){var T="".concat(s).split(/[,\s]+/gim).map(function(_){return parseFloat(_)});A=o.getStrokeDasharray(M,k,T)}else A=o.generateSimpleStrokeDasharray(k,M);return o.renderCurveStatically(i,r,n,{strokeDasharray:A})})}},{key:"renderCurve",value:function(r,n){var o=this.props,a=o.points,i=o.isAnimationActive,s=this.state,u=s.prevPoints,c=s.totalLength;return i&&a&&a.length&&(!u&&c>0||!cs(u,a))?this.renderCurveWithAnimation(r,n):this.renderCurveStatically(a,r,n)}},{key:"render",value:function(){var r,n=this.props,o=n.hide,a=n.dot,i=n.points,s=n.className,u=n.xAxis,c=n.yAxis,d=n.top,f=n.left,h=n.width,p=n.height,g=n.isAnimationActive,b=n.id;if(o||!i||!i.length)return null;var v=this.state.isAnimationFinished,x=i.length===1,k=Dt("recharts-line",s),E=u&&u.allowDataOverflow,j=c&&c.allowDataOverflow,S=E||j,C=wt(b)?this.id:b,O=(r=ft(a,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},M=O.r,A=M===void 0?3:M,T=O.strokeWidth,_=T===void 0?2:T,F=DT(a)?a:{},$=F.clipDot,I=$===void 0?!0:$,R=A*2+_;return y.createElement(Ft,{className:k},E||j?y.createElement("defs",null,y.createElement("clipPath",{id:"clipPath-".concat(C)},y.createElement("rect",{x:E?f:f-h/2,y:j?d:d-p/2,width:E?h:h*2,height:j?p:p*2})),!I&&y.createElement("clipPath",{id:"clipPath-dots-".concat(C)},y.createElement("rect",{x:f-R/2,y:d-R/2,width:h+R,height:p+R}))):null,!x&&this.renderCurve(S,C),this.renderErrorBar(S,C),(x||a)&&this.renderDots(S,I,C),(!g||v)&&Qo.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:n.curPoints}:r.points!==n.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,n){for(var o=r.length%2!==0?[].concat(Dl(r),[0]):r,a=[],i=0;i<n;++i)a=[].concat(Dl(a),Dl(o));return a}},{key:"renderDotItem",value:function(r,n){var o;if(y.isValidElement(r))o=y.cloneElement(r,n);else if(kt(r))o=r(n);else{var a=n.key,i=XP(n,Ile),s=Dt("recharts-line-dot",typeof r!="boolean"?r.className:"");o=y.createElement(Pa,vd({key:a},i,{className:s}))}return o}}])}(m.PureComponent);Xo(ds,"displayName","Line");Xo(ds,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!yi.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Xo(ds,"getComposedData",function(e){var t=e.props,r=e.xAxis,n=e.yAxis,o=e.xAxisTicks,a=e.yAxisTicks,i=e.dataKey,s=e.bandSize,u=e.displayedData,c=e.offset,d=t.layout,f=u.map(function(h,p){var g=zr(h,i);return d==="horizontal"?{x:Au({axis:r,ticks:o,bandSize:s,entry:h,index:p}),y:wt(g)?null:n.scale(g),value:g,payload:h}:{x:wt(g)?null:r.scale(g),y:Au({axis:n,ticks:a,bandSize:s,entry:h,index:p}),value:g,payload:h}});return mo({points:f,layout:d},c)});var Kle=["layout","type","stroke","connectNulls","isRange","ref"],Yle=["key"],_I;function qu(e){"@babel/helpers - typeof";return qu=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},qu(e)}function II(e,t){if(e==null)return{};var r=Gle(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Gle(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function tl(){return tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},tl.apply(this,arguments)}function QP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ri(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?QP(Object(r),!0).forEach(function(n){fa(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Xle(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function e7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,LI(n.key),n)}}function Zle(e,t,r){return t&&e7(e.prototype,t),r&&e7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Jle(e,t,r){return t=hh(t),Qle(e,DI()?Reflect.construct(t,r||[],hh(e).constructor):t.apply(e,r))}function Qle(e,t){if(t&&(qu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eue(e)}function eue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function DI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DI=function(){return!!e})()}function hh(e){return hh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hh(e)}function tue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_2(e,t)}function _2(e,t){return _2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},_2(e,t)}function fa(e,t,r){return t=LI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function LI(e){var t=rue(e,"string");return qu(t)=="symbol"?t:t+""}function rue(e,t){if(qu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(qu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var wi=function(e){function t(){var r;Xle(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=Jle(this,t,[].concat(o)),fa(r,"state",{isAnimationFinished:!0}),fa(r,"id",xs("recharts-area-")),fa(r,"handleAnimationEnd",function(){var i=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),kt(i)&&i()}),fa(r,"handleAnimationStart",function(){var i=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),kt(i)&&i()}),r}return tue(t,e),Zle(t,[{key:"renderDots",value:function(r,n,o){var a=this.props.isAnimationActive,i=this.state.isAnimationFinished;if(a&&!i)return null;var s=this.props,u=s.dot,c=s.points,d=s.dataKey,f=ft(this.props,!1),h=ft(u,!0),p=c.map(function(b,v){var x=Ri(Ri(Ri({key:"dot-".concat(v),r:3},f),h),{},{index:v,cx:b.x,cy:b.y,dataKey:d,value:b.value,payload:b.payload,points:c});return t.renderDotItem(u,x)}),g={clipPath:r?"url(#clipPath-".concat(n?"":"dots-").concat(o,")"):null};return y.createElement(Ft,tl({className:"recharts-area-dots"},g),p)}},{key:"renderHorizontalRect",value:function(r){var n=this.props,o=n.baseLine,a=n.points,i=n.strokeWidth,s=a[0].x,u=a[a.length-1].x,c=r*Math.abs(s-u),d=Vi(a.map(function(f){return f.y||0}));return qe(o)&&typeof o=="number"?d=Math.max(o,d):o&&Array.isArray(o)&&o.length&&(d=Math.max(Vi(o.map(function(f){return f.y||0})),d)),qe(d)?y.createElement("rect",{x:s<u?s:s-c,y:0,width:c,height:Math.floor(d+(i?parseInt("".concat(i),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var n=this.props,o=n.baseLine,a=n.points,i=n.strokeWidth,s=a[0].y,u=a[a.length-1].y,c=r*Math.abs(s-u),d=Vi(a.map(function(f){return f.x||0}));return qe(o)&&typeof o=="number"?d=Math.max(o,d):o&&Array.isArray(o)&&o.length&&(d=Math.max(Vi(o.map(function(f){return f.x||0})),d)),qe(d)?y.createElement("rect",{x:0,y:s<u?s:s-c,width:d+(i?parseInt("".concat(i),10):1),height:Math.floor(c)}):null}},{key:"renderClipRect",value:function(r){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,n,o,a){var i=this.props,s=i.layout,u=i.type,c=i.stroke,d=i.connectNulls,f=i.isRange;i.ref;var h=II(i,Kle);return y.createElement(Ft,{clipPath:o?"url(#clipPath-".concat(a,")"):null},y.createElement(ts,tl({},ft(h,!0),{points:r,connectNulls:d,type:u,baseLine:n,layout:s,stroke:"none",className:"recharts-area-area"})),c!=="none"&&y.createElement(ts,tl({},ft(this.props,!1),{className:"recharts-area-curve",layout:s,type:u,connectNulls:d,fill:"none",points:r})),c!=="none"&&f&&y.createElement(ts,tl({},ft(this.props,!1),{className:"recharts-area-curve",layout:s,type:u,connectNulls:d,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(r,n){var o=this,a=this.props,i=a.points,s=a.baseLine,u=a.isAnimationActive,c=a.animationBegin,d=a.animationDuration,f=a.animationEasing,h=a.animationId,p=this.state,g=p.prevPoints,b=p.prevBaseLine;return y.createElement(Bo,{begin:c,duration:d,isActive:u,easing:f,from:{t:0},to:{t:1},key:"area-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(v){var x=v.t;if(g){var k=g.length/i.length,E=i.map(function(O,M){var A=Math.floor(M*k);if(g[A]){var T=g[A],_=Zr(T.x,O.x),F=Zr(T.y,O.y);return Ri(Ri({},O),{},{x:_(x),y:F(x)})}return O}),j;if(qe(s)&&typeof s=="number"){var S=Zr(b,s);j=S(x)}else if(wt(s)||ic(s)){var C=Zr(b,0);j=C(x)}else j=s.map(function(O,M){var A=Math.floor(M*k);if(b[A]){var T=b[A],_=Zr(T.x,O.x),F=Zr(T.y,O.y);return Ri(Ri({},O),{},{x:_(x),y:F(x)})}return O});return o.renderAreaStatically(E,j,r,n)}return y.createElement(Ft,null,y.createElement("defs",null,y.createElement("clipPath",{id:"animationClipPath-".concat(n)},o.renderClipRect(x))),y.createElement(Ft,{clipPath:"url(#animationClipPath-".concat(n,")")},o.renderAreaStatically(i,s,r,n)))})}},{key:"renderArea",value:function(r,n){var o=this.props,a=o.points,i=o.baseLine,s=o.isAnimationActive,u=this.state,c=u.prevPoints,d=u.prevBaseLine,f=u.totalLength;return s&&a&&a.length&&(!c&&f>0||!cs(c,a)||!cs(d,i))?this.renderAreaWithAnimation(r,n):this.renderAreaStatically(a,i,r,n)}},{key:"render",value:function(){var r,n=this.props,o=n.hide,a=n.dot,i=n.points,s=n.className,u=n.top,c=n.left,d=n.xAxis,f=n.yAxis,h=n.width,p=n.height,g=n.isAnimationActive,b=n.id;if(o||!i||!i.length)return null;var v=this.state.isAnimationFinished,x=i.length===1,k=Dt("recharts-area",s),E=d&&d.allowDataOverflow,j=f&&f.allowDataOverflow,S=E||j,C=wt(b)?this.id:b,O=(r=ft(a,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},M=O.r,A=M===void 0?3:M,T=O.strokeWidth,_=T===void 0?2:T,F=DT(a)?a:{},$=F.clipDot,I=$===void 0?!0:$,R=A*2+_;return y.createElement(Ft,{className:k},E||j?y.createElement("defs",null,y.createElement("clipPath",{id:"clipPath-".concat(C)},y.createElement("rect",{x:E?c:c-h/2,y:j?u:u-p/2,width:E?h:h*2,height:j?p:p*2})),!I&&y.createElement("clipPath",{id:"clipPath-dots-".concat(C)},y.createElement("rect",{x:c-R/2,y:u-R/2,width:h+R,height:p+R}))):null,x?null:this.renderArea(S,C),(a||x)&&this.renderDots(S,I,C),(!g||v)&&Qo.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:r.points!==n.curPoints||r.baseLine!==n.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(m.PureComponent);_I=wi;fa(wi,"displayName","Area");fa(wi,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!yi.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});fa(wi,"getBaseValue",function(e,t,r,n){var o=e.layout,a=e.baseValue,i=t.props.baseValue,s=i??a;if(qe(s)&&typeof s=="number")return s;var u=o==="horizontal"?n:r,c=u.scale.domain();if(u.type==="number"){var d=Math.max(c[0],c[1]),f=Math.min(c[0],c[1]);return s==="dataMin"?f:s==="dataMax"||d<0?d:Math.max(Math.min(c[0],c[1]),0)}return s==="dataMin"?c[0]:s==="dataMax"?c[1]:c[0]});fa(wi,"getComposedData",function(e){var t=e.props,r=e.item,n=e.xAxis,o=e.yAxis,a=e.xAxisTicks,i=e.yAxisTicks,s=e.bandSize,u=e.dataKey,c=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=t.layout,g=c&&c.length,b=_I.getBaseValue(t,r,n,o),v=p==="horizontal",x=!1,k=f.map(function(j,S){var C;g?C=c[d+S]:(C=zr(j,u),Array.isArray(C)?x=!0:C=[b,C]);var O=C[1]==null||g&&zr(j,u)==null;return v?{x:Au({axis:n,ticks:a,bandSize:s,entry:j,index:S}),y:O?null:o.scale(C[1]),value:C,payload:j}:{x:O?null:n.scale(C[1]),y:Au({axis:o,ticks:i,bandSize:s,entry:j,index:S}),value:C,payload:j}}),E;return g||x?E=k.map(function(j){var S=Array.isArray(j.value)?j.value[0]:null;return v?{x:j.x,y:S!=null&&j.y!=null?o.scale(S):null}:{x:S!=null?n.scale(S):null,y:j.y}}):E=v?o.scale(b):n.scale(b),Ri({points:k,baseLine:E,layout:p,isRange:x},h)});fa(wi,"renderDotItem",function(e,t){var r;if(y.isValidElement(e))r=y.cloneElement(e,t);else if(kt(e))r=e(t);else{var n=Dt("recharts-area-dot",typeof e!="boolean"?e.className:""),o=t.key,a=II(t,Yle);r=y.createElement(Pa,tl({},a,{key:o,className:n}))}return r});function Uu(e){"@babel/helpers - typeof";return Uu=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},Uu(e)}function nue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,$I(n.key),n)}}function aue(e,t,r){return t&&oue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function iue(e,t,r){return t=gh(t),sue(e,RI()?Reflect.construct(t,r||[],gh(e).constructor):t.apply(e,r))}function sue(e,t){if(t&&(Uu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lue(e)}function lue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function RI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RI=function(){return!!e})()}function gh(e){return gh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gh(e)}function uue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&I2(e,t)}function I2(e,t){return I2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},I2(e,t)}function FI(e,t,r){return t=$I(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $I(e){var t=cue(e,"string");return Uu(t)=="symbol"?t:t+""}function cue(e,t){if(Uu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Uu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Ff=function(e){function t(){return nue(this,t),iue(this,t,arguments)}return uue(t,e),aue(t,[{key:"render",value:function(){return null}}])}(y.Component);FI(Ff,"displayName","ZAxis");FI(Ff,"defaultProps",{zAxisId:0,range:[64,64],scale:"auto",type:"number"});var due=["option","isActive"];function yd(){return yd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},yd.apply(this,arguments)}function fue(e,t){if(e==null)return{};var r=mue(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function mue(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function pue(e){var t=e.option,r=e.isActive,n=fue(e,due);return typeof t=="string"?y.createElement(rh,yd({option:y.createElement(yg,yd({type:t},n)),isActive:r,shapeType:"symbols"},n)):y.createElement(rh,yd({option:t,isActive:r,shapeType:"symbols"},n))}function Vu(e){"@babel/helpers - typeof";return Vu=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},Vu(e)}function xd(){return xd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xd.apply(this,arguments)}function t7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Io(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?t7(Object(r),!0).forEach(function(n){Ki(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r7(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,zI(n.key),n)}}function gue(e,t,r){return t&&r7(e.prototype,t),r&&r7(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function bue(e,t,r){return t=bh(t),vue(e,BI()?Reflect.construct(t,r||[],bh(e).constructor):t.apply(e,r))}function vue(e,t){if(t&&(Vu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yue(e)}function yue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function BI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(BI=function(){return!!e})()}function bh(e){return bh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bh(e)}function xue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&D2(e,t)}function D2(e,t){return D2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},D2(e,t)}function Ki(e,t,r){return t=zI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zI(e){var t=kue(e,"string");return Vu(t)=="symbol"?t:t+""}function kue(e,t){if(Vu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Vu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var $f=function(e){function t(){var r;hue(this,t);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return r=bue(this,t,[].concat(o)),Ki(r,"state",{isAnimationFinished:!1}),Ki(r,"handleAnimationEnd",function(){r.setState({isAnimationFinished:!0})}),Ki(r,"handleAnimationStart",function(){r.setState({isAnimationFinished:!1})}),Ki(r,"id",xs("recharts-scatter-")),r}return xue(t,e),gue(t,[{key:"renderSymbolsStatically",value:function(r){var n=this,o=this.props,a=o.shape,i=o.activeShape,s=o.activeIndex,u=ft(this.props,!1);return r.map(function(c,d){var f=s===d,h=f?i:a,p=Io(Io({},u),c);return y.createElement(Ft,xd({className:"recharts-scatter-symbol",key:"symbol-".concat(c?.cx,"-").concat(c?.cy,"-").concat(c?.size,"-").concat(d)},us(n.props,c,d),{role:"img"}),y.createElement(pue,xd({option:h,isActive:f,key:"symbol-".concat(d)},p)))})}},{key:"renderSymbolsWithAnimation",value:function(){var r=this,n=this.props,o=n.points,a=n.isAnimationActive,i=n.animationBegin,s=n.animationDuration,u=n.animationEasing,c=n.animationId,d=this.state.prevPoints;return y.createElement(Bo,{begin:i,duration:s,isActive:a,easing:u,from:{t:0},to:{t:1},key:"pie-".concat(c),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(f){var h=f.t,p=o.map(function(g,b){var v=d&&d[b];if(v){var x=Zr(v.cx,g.cx),k=Zr(v.cy,g.cy),E=Zr(v.size,g.size);return Io(Io({},g),{},{cx:x(h),cy:k(h),size:E(h)})}var j=Zr(0,g.size);return Io(Io({},g),{},{size:j(h)})});return y.createElement(Ft,null,r.renderSymbolsStatically(p))})}},{key:"renderSymbols",value:function(){var r=this.props,n=r.points,o=r.isAnimationActive,a=this.state.prevPoints;return o&&n&&n.length&&(!a||!cs(a,n))?this.renderSymbolsWithAnimation():this.renderSymbolsStatically(n)}},{key:"renderErrorBar",value:function(){var r=this.props.isAnimationActive;if(r&&!this.state.isAnimationFinished)return null;var n=this.props,o=n.points,a=n.xAxis,i=n.yAxis,s=n.children,u=Jn(s,dc);return u?u.map(function(c,d){var f=c.props,h=f.direction,p=f.dataKey;return y.cloneElement(c,{key:"".concat(h,"-").concat(p,"-").concat(o[d]),data:o,xAxis:a,yAxis:i,layout:h==="x"?"vertical":"horizontal",dataPointFormatter:function(g,b){return{x:g.cx,y:g.cy,value:h==="x"?+g.node.x:+g.node.y,errorVal:zr(g,b)}}})}):null}},{key:"renderLine",value:function(){var r=this.props,n=r.points,o=r.line,a=r.lineType,i=r.lineJointType,s=ft(this.props,!1),u=ft(o,!1),c,d;if(a==="joint")c=n.map(function(k){return{x:k.cx,y:k.cy}});else if(a==="fitting"){var f=gK(n),h=f.xmin,p=f.xmax,g=f.a,b=f.b,v=function(k){return g*k+b};c=[{x:h,y:v(h)},{x:p,y:v(p)}]}var x=Io(Io(Io({},s),{},{fill:"none",stroke:s&&s.fill},u),{},{points:c});return y.isValidElement(o)?d=y.cloneElement(o,x):kt(o)?d=o(x):d=y.createElement(ts,xd({},x,{type:i})),y.createElement(Ft,{className:"recharts-scatter-line",key:"recharts-scatter-line"},d)}},{key:"render",value:function(){var r=this.props,n=r.hide,o=r.points,a=r.line,i=r.className,s=r.xAxis,u=r.yAxis,c=r.left,d=r.top,f=r.width,h=r.height,p=r.id,g=r.isAnimationActive;if(n||!o||!o.length)return null;var b=this.state.isAnimationFinished,v=Dt("recharts-scatter",i),x=s&&s.allowDataOverflow,k=u&&u.allowDataOverflow,E=x||k,j=wt(p)?this.id:p;return y.createElement(Ft,{className:v,clipPath:E?"url(#clipPath-".concat(j,")"):null},x||k?y.createElement("defs",null,y.createElement("clipPath",{id:"clipPath-".concat(j)},y.createElement("rect",{x:x?c:c-f/2,y:k?d:d-h/2,width:x?f:f*2,height:k?h:h*2}))):null,a&&this.renderLine(),this.renderErrorBar(),y.createElement(Ft,{key:"recharts-scatter-symbols"},this.renderSymbols()),(!g||b)&&Qo.renderCallByParent(this.props,o))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:n.curPoints}:r.points!==n.curPoints?{curPoints:r.points}:null}}])}(m.PureComponent);Ki($f,"displayName","Scatter");Ki($f,"defaultProps",{xAxisId:0,yAxisId:0,zAxisId:0,legendType:"circle",lineType:"joint",lineJointType:"linear",data:[],shape:"circle",hide:!1,isAnimationActive:!yi.isSsr,animationBegin:0,animationDuration:400,animationEasing:"linear"});Ki($f,"getComposedData",function(e){var t=e.xAxis,r=e.yAxis,n=e.zAxis,o=e.item,a=e.displayedData,i=e.xAxisTicks,s=e.yAxisTicks,u=e.offset,c=o.props.tooltipType,d=Jn(o.props.children,jg),f=wt(t.dataKey)?o.props.dataKey:t.dataKey,h=wt(r.dataKey)?o.props.dataKey:r.dataKey,p=n&&n.dataKey,g=n?n.range:Ff.defaultProps.range,b=g&&g[0],v=t.scale.bandwidth?t.scale.bandwidth():0,x=r.scale.bandwidth?r.scale.bandwidth():0,k=a.map(function(E,j){var S=zr(E,f),C=zr(E,h),O=!wt(p)&&zr(E,p)||"-",M=[{name:wt(t.dataKey)?o.props.name:t.name||t.dataKey,unit:t.unit||"",value:S,payload:E,dataKey:f,type:c},{name:wt(r.dataKey)?o.props.name:r.name||r.dataKey,unit:r.unit||"",value:C,payload:E,dataKey:h,type:c}];O!=="-"&&M.push({name:n.name||n.dataKey,unit:n.unit||"",value:O,payload:E,dataKey:p,type:c});var A=Au({axis:t,ticks:i,bandSize:v,entry:E,index:j,dataKey:f}),T=Au({axis:r,ticks:s,bandSize:x,entry:E,index:j,dataKey:h}),_=O!=="-"?n.scale(O):b,F=Math.sqrt(Math.max(_,0)/Math.PI);return Io(Io({},E),{},{cx:A,cy:T,x:A-F,y:T-F,xAxis:t,yAxis:r,zAxis:n,width:2*F,height:2*F,size:_,node:{x:S,y:C,z:O},tooltipPayload:M,tooltipPosition:{x:A,y:T},payload:E},d&&d[j]&&d[j].props)});return Io({points:k},u)});function Wu(e){"@babel/helpers - typeof";return Wu=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},Wu(e)}function wue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,UI(n.key),n)}}function Eue(e,t,r){return t&&jue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Nue(e,t,r){return t=vh(t),Sue(e,HI()?Reflect.construct(t,r||[],vh(e).constructor):t.apply(e,r))}function Sue(e,t){if(t&&(Wu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Oue(e)}function Oue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function HI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HI=function(){return!!e})()}function vh(e){return vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},vh(e)}function Cue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&L2(e,t)}function L2(e,t){return L2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},L2(e,t)}function qI(e,t,r){return t=UI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function UI(e){var t=Pue(e,"string");return Wu(t)=="symbol"?t:t+""}function Pue(e,t){if(Wu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Wu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function R2(){return R2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},R2.apply(this,arguments)}function Aue(e){var t=e.xAxisId,r=nN(),n=oN(),o=yI(t);return o==null?null:y.createElement(fc,R2({},o,{className:Dt("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(a){return Xa(a,!0)}}))}var io=function(e){function t(){return wue(this,t),Nue(this,t,arguments)}return Cue(t,e),Eue(t,[{key:"render",value:function(){return y.createElement(Aue,this.props)}}])}(y.Component);qI(io,"displayName","XAxis");qI(io,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function Ku(e){"@babel/helpers - typeof";return Ku=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},Ku(e)}function Tue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,KI(n.key),n)}}function _ue(e,t,r){return t&&Mue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Iue(e,t,r){return t=yh(t),Due(e,VI()?Reflect.construct(t,r||[],yh(e).constructor):t.apply(e,r))}function Due(e,t){if(t&&(Ku(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Lue(e)}function Lue(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function VI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VI=function(){return!!e})()}function yh(e){return yh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},yh(e)}function Rue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F2(e,t)}function F2(e,t){return F2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},F2(e,t)}function WI(e,t,r){return t=KI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function KI(e){var t=Fue(e,"string");return Ku(t)=="symbol"?t:t+""}function Fue(e,t){if(Ku(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Ku(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function $2(){return $2=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$2.apply(this,arguments)}var $ue=function(e){var t=e.yAxisId,r=nN(),n=oN(),o=xI(t);return o==null?null:y.createElement(fc,$2({},o,{className:Dt("recharts-".concat(o.axisType," ").concat(o.axisType),o.className),viewBox:{x:0,y:0,width:r,height:n},ticksGenerator:function(a){return Xa(a,!0)}}))},so=function(e){function t(){return Tue(this,t),Iue(this,t,arguments)}return Rue(t,e),_ue(t,[{key:"render",value:function(){return y.createElement($ue,this.props)}}])}(y.Component);WI(so,"displayName","YAxis");WI(so,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function n7(e){return que(e)||Hue(e)||zue(e)||Bue()}function Bue(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
117
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zue(e,t){if(e){if(typeof e=="string")return B2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B2(e,t)}}function Hue(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function que(e){if(Array.isArray(e))return B2(e)}function B2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var z2=function(e,t,r,n,o){var a=Jn(e,iN),i=Jn(e,qg),s=[].concat(n7(a),n7(i)),u=Jn(e,Vg),c="".concat(n,"Id"),d=n[0],f=t;if(s.length&&(f=s.reduce(function(g,b){if(b.props[c]===r&&ja(b.props,"extendDomain")&&qe(b.props[d])){var v=b.props[d];return[Math.min(g[0],v),Math.max(g[1],v)]}return g},f)),u.length){var h="".concat(d,"1"),p="".concat(d,"2");f=u.reduce(function(g,b){if(b.props[c]===r&&ja(b.props,"extendDomain")&&qe(b.props[h])&&qe(b.props[p])){var v=b.props[h],x=b.props[p];return[Math.min(g[0],v,x),Math.max(g[1],v,x)]}return g},f)}return o&&o.length&&(f=o.reduce(function(g,b){return qe(b)?[Math.min(g[0],b),Math.max(g[1],b)]:g},f)),f},o7={exports:{}},a7;function Uue(){return a7||(a7=1,function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function o(u,c,d){this.fn=u,this.context=c,this.once=d||!1}function a(u,c,d,f,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new o(d,f||u,h),g=r?r+c:c;return u._events[g]?u._events[g].fn?u._events[g]=[u._events[g],p]:u._events[g].push(p):(u._events[g]=p,u._eventsCount++),u}function i(u,c){--u._eventsCount===0?u._events=new n:delete u._events[c]}function s(){this._events=new n,this._eventsCount=0}s.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)t.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},s.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var f=0,h=d.length,p=new Array(h);f<h;f++)p[f]=d[f].fn;return p},s.prototype.listenerCount=function(u){var c=r?r+u:u,d=this._events[c];return d?d.fn?1:d.length:0},s.prototype.emit=function(u,c,d,f,h,p){var g=r?r+u:u;if(!this._events[g])return!1;var b=this._events[g],v=arguments.length,x,k;if(b.fn){switch(b.once&&this.removeListener(u,b.fn,void 0,!0),v){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,c),!0;case 3:return b.fn.call(b.context,c,d),!0;case 4:return b.fn.call(b.context,c,d,f),!0;case 5:return b.fn.call(b.context,c,d,f,h),!0;case 6:return b.fn.call(b.context,c,d,f,h,p),!0}for(k=1,x=new Array(v-1);k<v;k++)x[k-1]=arguments[k];b.fn.apply(b.context,x)}else{var E=b.length,j;for(k=0;k<E;k++)switch(b[k].once&&this.removeListener(u,b[k].fn,void 0,!0),v){case 1:b[k].fn.call(b[k].context);break;case 2:b[k].fn.call(b[k].context,c);break;case 3:b[k].fn.call(b[k].context,c,d);break;case 4:b[k].fn.call(b[k].context,c,d,f);break;default:if(!x)for(j=1,x=new Array(v-1);j<v;j++)x[j-1]=arguments[j];b[k].fn.apply(b[k].context,x)}}return!0},s.prototype.on=function(u,c,d){return a(this,u,c,d,!1)},s.prototype.once=function(u,c,d){return a(this,u,c,d,!0)},s.prototype.removeListener=function(u,c,d,f){var h=r?r+u:u;if(!this._events[h])return this;if(!c)return i(this,h),this;var p=this._events[h];if(p.fn)p.fn===c&&(!f||p.once)&&(!d||p.context===d)&&i(this,h);else{for(var g=0,b=[],v=p.length;g<v;g++)(p[g].fn!==c||f&&!p[g].once||d&&p[g].context!==d)&&b.push(p[g]);b.length?this._events[h]=b.length===1?b[0]:b:i(this,h)}return this},s.prototype.removeAllListeners=function(u){var c;return u?(c=r?r+u:u,this._events[c]&&i(this,c)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(o7)),o7.exports}var Vue=Uue();const Wue=mr(Vue);var uk=new Wue,ck="recharts.syncMouseEvents";function lf(e){"@babel/helpers - typeof";return lf=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},lf(e)}function Kue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,YI(n.key),n)}}function Gue(e,t,r){return t&&Yue(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function dk(e,t,r){return t=YI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function YI(e){var t=Xue(e,"string");return lf(t)=="symbol"?t:t+""}function Xue(e,t){if(lf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(lf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var Zue=function(){function e(){Kue(this,e),dk(this,"activeIndex",0),dk(this,"coordinateList",[]),dk(this,"layout","horizontal")}return Gue(e,[{key:"setDetails",value:function(t){var r,n=t.coordinateList,o=n===void 0?null:n,a=t.container,i=a===void 0?null:a,s=t.layout,u=s===void 0?null:s,c=t.offset,d=c===void 0?null:c,f=t.mouseHandlerCallback,h=f===void 0?null:f;this.coordinateList=(r=o??this.coordinateList)!==null&&r!==void 0?r:[],this.container=i??this.container,this.layout=u??this.layout,this.offset=d??this.offset,this.mouseHandlerCallback=h??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(t){if(this.coordinateList.length!==0)switch(t.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(t){this.activeIndex=t}},{key:"spoofMouse",value:function(){var t,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var n=this.container.getBoundingClientRect(),o=n.x,a=n.y,i=n.height,s=this.coordinateList[this.activeIndex].coordinate,u=((t=window)===null||t===void 0?void 0:t.scrollX)||0,c=((r=window)===null||r===void 0?void 0:r.scrollY)||0,d=o+s+u,f=a+this.offset.top+i/2+c;this.mouseHandlerCallback({pageX:d,pageY:f})}}}])}();function Jue(e,t,r){if(r==="number"&&t===!0&&Array.isArray(e)){var n=e?.[0],o=e?.[1];if(n&&o&&qe(n)&&qe(o))return!0}return!1}function Que(e,t,r,n){var o=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-o:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-o,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function GI(e){var t=e.cx,r=e.cy,n=e.radius,o=e.startAngle,a=e.endAngle,i=Ir(t,r,n,o),s=Ir(t,r,n,a);return{points:[i,s],cx:t,cy:r,radius:n,startAngle:o,endAngle:a}}function ece(e,t,r){var n,o,a,i;if(e==="horizontal")n=t.x,a=n,o=r.top,i=r.top+r.height;else if(e==="vertical")o=t.y,i=o,n=r.left,a=r.left+r.width;else if(t.cx!=null&&t.cy!=null)if(e==="centric"){var s=t.cx,u=t.cy,c=t.innerRadius,d=t.outerRadius,f=t.angle,h=Ir(s,u,c,f),p=Ir(s,u,d,f);n=h.x,o=h.y,a=p.x,i=p.y}else return GI(t);return[{x:n,y:o},{x:a,y:i}]}function uf(e){"@babel/helpers - typeof";return uf=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},uf(e)}function i7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Dm(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?i7(Object(r),!0).forEach(function(n){tce(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tce(e,t,r){return t=rce(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rce(e){var t=nce(e,"string");return uf(t)=="symbol"?t:t+""}function nce(e,t){if(uf(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(uf(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oce(e){var t,r,n=e.element,o=e.tooltipEventType,a=e.isActive,i=e.activeCoordinate,s=e.activePayload,u=e.offset,c=e.activeTooltipIndex,d=e.tooltipAxisBandSize,f=e.layout,h=e.chartName,p=(t=n.props.cursor)!==null&&t!==void 0?t:(r=n.type.defaultProps)===null||r===void 0?void 0:r.cursor;if(!n||!p||!a||!i||h!=="ScatterChart"&&o!=="axis")return null;var g,b=ts;if(h==="ScatterChart")g=i,b=Xoe;else if(h==="BarChart")g=Que(f,i,u,d),b=QE;else if(f==="radial"){var v=GI(i),x=v.cx,k=v.cy,E=v.radius,j=v.startAngle,S=v.endAngle;g={cx:x,cy:k,startAngle:j,endAngle:S,innerRadius:E,outerRadius:E},b=JE}else g={points:ece(f,i,u)},b=ts;var C=Dm(Dm(Dm(Dm({stroke:"#ccc",pointerEvents:"none"},u),g),ft(p,!1)),{},{payload:s,payloadIndex:c,className:Dt("recharts-tooltip-cursor",p.className)});return m.isValidElement(p)?m.cloneElement(p,C):m.createElement(b,C)}var ace=["item"],ice=["children","className","width","height","style","compact","title","desc"];function Yu(e){"@babel/helpers - typeof";return Yu=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},Yu(e)}function Xl(){return Xl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xl.apply(this,arguments)}function s7(e,t){return uce(e)||lce(e,t)||ZI(e,t)||sce()}function sce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
118
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lce(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,a,i,s=[],u=!0,c=!1;try{if(a=(r=r.call(e)).next,t!==0)for(;!(u=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(d){c=!0,o=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw o}}return s}}function uce(e){if(Array.isArray(e))return e}function l7(e,t){if(e==null)return{};var r=cce(e,t),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function cce(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function dce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fce(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,JI(n.key),n)}}function mce(e,t,r){return t&&fce(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function pce(e,t,r){return t=xh(t),hce(e,XI()?Reflect.construct(t,r||[],xh(e).constructor):t.apply(e,r))}function hce(e,t){if(t&&(Yu(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gce(e)}function gce(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function XI(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XI=function(){return!!e})()}function xh(e){return xh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xh(e)}function bce(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&H2(e,t)}function H2(e,t){return H2=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},H2(e,t)}function Gu(e){return xce(e)||yce(e)||ZI(e)||vce()}function vce(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
119
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZI(e,t){if(e){if(typeof e=="string")return q2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q2(e,t)}}function yce(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xce(e){if(Array.isArray(e))return q2(e)}function q2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u7(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ce(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?u7(Object(r),!0).forEach(function(n){Nt(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u7(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Nt(e,t,r){return t=JI(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JI(e){var t=kce(e,"string");return Yu(t)=="symbol"?t:t+""}function kce(e,t){if(Yu(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(Yu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var wce={xAxis:["bottom","top"],yAxis:["left","right"]},jce={width:"100%",height:"100%"},QI={x:0,y:0};function Lm(e){return e}var Ece=function(e,t){return t==="horizontal"?e.x:t==="vertical"?e.y:t==="centric"?e.angle:e.radius},Nce=function(e,t,r,n){var o=t.find(function(c){return c&&c.index===r});if(o){if(e==="horizontal")return{x:o.coordinate,y:n.y};if(e==="vertical")return{x:n.x,y:o.coordinate};if(e==="centric"){var a=o.coordinate,i=n.radius;return Ce(Ce(Ce({},n),Ir(n.cx,n.cy,i,a)),{},{angle:a,radius:i})}var s=o.coordinate,u=n.angle;return Ce(Ce(Ce({},n),Ir(n.cx,n.cy,s,u)),{},{angle:u,radius:s})}return QI},Wg=function(e,t){var r=t.graphicalItems,n=t.dataStartIndex,o=t.dataEndIndex,a=(r??[]).reduce(function(i,s){var u=s.props.data;return u&&u.length?[].concat(Gu(i),Gu(u)):i},[]);return a.length>0?a:e&&e.length&&qe(n)&&qe(o)?e.slice(n,o+1):[]};function eD(e){return e==="number"?[0,"auto"]:void 0}var U2=function(e,t,r,n){var o=e.graphicalItems,a=e.tooltipAxis,i=Wg(t,e);return r<0||!o||!o.length||r>=i.length?null:o.reduce(function(s,u){var c,d=(c=u.props.data)!==null&&c!==void 0?c:t;d&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(d=d.slice(e.dataStartIndex,e.dataEndIndex+1));var f;if(a.dataKey&&!a.allowDuplicatedCategory){var h=d===void 0?i:d;f=xp(h,a.dataKey,n)}else f=d&&d[r]||i[r];return f?[].concat(Gu(s),[F_(u,f)]):s},[])},c7=function(e,t,r,n){var o=n||{x:e.chartX,y:e.chartY},a=Ece(o,r),i=e.orderedTooltipTicks,s=e.tooltipAxis,u=e.tooltipTicks,c=kte(a,i,u,s);if(c>=0&&u){var d=u[c]&&u[c].value,f=U2(e,t,c,d),h=Nce(r,i,c,o);return{activeTooltipIndex:c,activeLabel:d,activePayload:f,activeCoordinate:h}}return null},Sce=function(e,t){var r=t.axes,n=t.graphicalItems,o=t.axisType,a=t.axisIdKey,i=t.stackGroups,s=t.dataStartIndex,u=t.dataEndIndex,c=e.layout,d=e.children,f=e.stackOffset,h=M_(c,o);return r.reduce(function(p,g){var b,v=g.type.defaultProps!==void 0?Ce(Ce({},g.type.defaultProps),g.props):g.props,x=v.type,k=v.dataKey,E=v.allowDataOverflow,j=v.allowDuplicatedCategory,S=v.scale,C=v.ticks,O=v.includeHidden,M=v[a];if(p[M])return p;var A=Wg(e.data,{graphicalItems:n.filter(function(H){var X,Y=a in H.props?H.props[a]:(X=H.type.defaultProps)===null||X===void 0?void 0:X[a];return Y===M}),dataStartIndex:s,dataEndIndex:u}),T=A.length,_,F,$;Jue(v.domain,E,x)&&(_=t2(v.domain,null,E),h&&(x==="number"||S!=="auto")&&($=Qm(A,k,"category")));var I=eD(x);if(!_||_.length===0){var R,W=(R=v.domain)!==null&&R!==void 0?R:I;if(k){if(_=Qm(A,k,x),x==="category"&&h){var B=hK(_);j&&B?(F=_,_=oh(0,T)):j||(_=a6(W,_,g).reduce(function(H,X){return H.indexOf(X)>=0?H:[].concat(Gu(H),[X])},[]))}else if(x==="category")j?_=_.filter(function(H){return H!==""&&!wt(H)}):_=a6(W,_,g).reduce(function(H,X){return H.indexOf(X)>=0||X===""||wt(X)?H:[].concat(Gu(H),[X])},[]);else if(x==="number"){var L=Ste(A,n.filter(function(H){var X,Y,ae=a in H.props?H.props[a]:(X=H.type.defaultProps)===null||X===void 0?void 0:X[a],te="hide"in H.props?H.props.hide:(Y=H.type.defaultProps)===null||Y===void 0?void 0:Y.hide;return ae===M&&(O||!te)}),k,o,c);L&&(_=L)}h&&(x==="number"||S!=="auto")&&($=Qm(A,k,"category"))}else h?_=oh(0,T):i&&i[M]&&i[M].hasStack&&x==="number"?_=f==="expand"?[0,1]:R_(i[M].stackGroups,s,u):_=T_(A,n.filter(function(H){var X=a in H.props?H.props[a]:H.type.defaultProps[a],Y="hide"in H.props?H.props.hide:H.type.defaultProps.hide;return X===M&&(O||!Y)}),x,c,!0);if(x==="number")_=z2(d,_,M,o,C),W&&(_=t2(W,_,E));else if(x==="category"&&W){var q=W,U=_.every(function(H){return q.indexOf(H)>=0});U&&(_=q)}}return Ce(Ce({},p),{},Nt({},M,Ce(Ce({},v),{},{axisType:o,domain:_,categoricalDomain:$,duplicateDomain:F,originalDomain:(b=v.domain)!==null&&b!==void 0?b:I,isCategorical:h,layout:c})))},{})},Oce=function(e,t){var r=t.graphicalItems,n=t.Axis,o=t.axisType,a=t.axisIdKey,i=t.stackGroups,s=t.dataStartIndex,u=t.dataEndIndex,c=e.layout,d=e.children,f=Wg(e.data,{graphicalItems:r,dataStartIndex:s,dataEndIndex:u}),h=f.length,p=M_(c,o),g=-1;return r.reduce(function(b,v){var x=v.type.defaultProps!==void 0?Ce(Ce({},v.type.defaultProps),v.props):v.props,k=x[a],E=eD("number");if(!b[k]){g++;var j;return p?j=oh(0,h):i&&i[k]&&i[k].hasStack?(j=R_(i[k].stackGroups,s,u),j=z2(d,j,k,o)):(j=t2(E,T_(f,r.filter(function(S){var C,O,M=a in S.props?S.props[a]:(C=S.type.defaultProps)===null||C===void 0?void 0:C[a],A="hide"in S.props?S.props.hide:(O=S.type.defaultProps)===null||O===void 0?void 0:O.hide;return M===k&&!A}),"number",c),n.defaultProps.allowDataOverflow),j=z2(d,j,k,o)),Ce(Ce({},b),{},Nt({},k,Ce(Ce({axisType:o},n.defaultProps),{},{hide:!0,orientation:Co(wce,"".concat(o,".").concat(g%2),null),domain:j,originalDomain:E,isCategorical:p,layout:c})))}return b},{})},Cce=function(e,t){var r=t.axisType,n=r===void 0?"xAxis":r,o=t.AxisComp,a=t.graphicalItems,i=t.stackGroups,s=t.dataStartIndex,u=t.dataEndIndex,c=e.children,d="".concat(n,"Id"),f=Jn(c,o),h={};return f&&f.length?h=Sce(e,{axes:f,graphicalItems:a,axisType:n,axisIdKey:d,stackGroups:i,dataStartIndex:s,dataEndIndex:u}):a&&a.length&&(h=Oce(e,{Axis:o,graphicalItems:a,axisType:n,axisIdKey:d,stackGroups:i,dataStartIndex:s,dataEndIndex:u})),h},Pce=function(e){var t=Hi(e),r=Xa(t,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:NE(r,function(n){return n.coordinate}),tooltipAxis:t,tooltipAxisBandSize:Vp(t,r)}},d7=function(e){var t=e.children,r=e.defaultShowTooltip,n=ho(t,Lu),o=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),n&&n.props&&(n.props.startIndex>=0&&(o=n.props.startIndex),n.props.endIndex>=0&&(a=n.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!r}},Ace=function(e){return!e||!e.length?!1:e.some(function(t){var r=ei(t&&t.type);return r&&r.indexOf("Bar")>=0})},f7=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Tce=function(e,t){var r=e.props,n=e.graphicalItems,o=e.xAxisMap,a=o===void 0?{}:o,i=e.yAxisMap,s=i===void 0?{}:i,u=r.width,c=r.height,d=r.children,f=r.margin||{},h=ho(d,Lu),p=ho(d,ka),g=Object.keys(s).reduce(function(j,S){var C=s[S],O=C.orientation;return!C.mirror&&!C.hide?Ce(Ce({},j),{},Nt({},O,j[O]+C.width)):j},{left:f.left||0,right:f.right||0}),b=Object.keys(a).reduce(function(j,S){var C=a[S],O=C.orientation;return!C.mirror&&!C.hide?Ce(Ce({},j),{},Nt({},O,Co(j,"".concat(O))+C.height)):j},{top:f.top||0,bottom:f.bottom||0}),v=Ce(Ce({},b),g),x=v.bottom;h&&(v.bottom+=h.props.height||Lu.defaultProps.height),p&&t&&(v=Ete(v,n,r,t));var k=u-v.left-v.right,E=c-v.top-v.bottom;return Ce(Ce({brushBottom:x},v),{},{width:Math.max(k,0),height:Math.max(E,0)})},Mce=function(e,t){if(t==="xAxis")return e[t].width;if(t==="yAxis")return e[t].height},Bf=function(e){var t=e.chartName,r=e.GraphicalChild,n=e.defaultTooltipEventType,o=n===void 0?"axis":n,a=e.validateTooltipEventTypes,i=a===void 0?["axis"]:a,s=e.axisComponents,u=e.legendContent,c=e.formatAxisMap,d=e.defaultProps,f=function(b,v){var x=v.graphicalItems,k=v.stackGroups,E=v.offset,j=v.updateId,S=v.dataStartIndex,C=v.dataEndIndex,O=b.barSize,M=b.layout,A=b.barGap,T=b.barCategoryGap,_=b.maxBarSize,F=f7(M),$=F.numericAxisName,I=F.cateAxisName,R=Ace(x),W=[];return x.forEach(function(B,L){var q=Wg(b.data,{graphicalItems:[B],dataStartIndex:S,dataEndIndex:C}),U=B.type.defaultProps!==void 0?Ce(Ce({},B.type.defaultProps),B.props):B.props,H=U.dataKey,X=U.maxBarSize,Y=U["".concat($,"Id")],ae=U["".concat(I,"Id")],te={},me=s.reduce(function(nt,Me){var ot=v["".concat(Me.axisType,"Map")],Ge=U["".concat(Me.axisType,"Id")];ot&&ot[Ge]||Me.axisType==="zAxis"||ml();var at=ot[Ge];return Ce(Ce({},nt),{},Nt(Nt({},Me.axisType,at),"".concat(Me.axisType,"Ticks"),Xa(at)))},te),Q=me[I],ue=me["".concat(I,"Ticks")],G=k&&k[Y]&&k[Y].hasStack&&Dte(B,k[Y].stackGroups),de=ei(B.type).indexOf("Bar")>=0,ie=Vp(Q,ue),V=[],ee=R&&wte({barSize:O,stackGroups:k,totalSize:Mce(me,I)});if(de){var ne,ge,Ee=wt(X)?_:X,Pe=(ne=(ge=Vp(Q,ue,!0))!==null&&ge!==void 0?ge:Ee)!==null&&ne!==void 0?ne:0;V=jte({barGap:A,barCategoryGap:T,bandSize:Pe!==ie?Pe:ie,sizeList:ee[ae],maxBarSize:Ee}),Pe!==ie&&(V=V.map(function(nt){return Ce(Ce({},nt),{},{position:Ce(Ce({},nt.position),{},{offset:nt.position.offset-Pe/2})})}))}var Ie=B&&B.type&&B.type.getComposedData;Ie&&W.push({props:Ce(Ce({},Ie(Ce(Ce({},me),{},{displayedData:q,props:b,dataKey:H,item:B,bandSize:ie,barPosition:V,offset:E,stackedData:G,layout:M,dataStartIndex:S,dataEndIndex:C}))),{},Nt(Nt(Nt({key:B.key||"item-".concat(L)},$,me[$]),I,me[I]),"animationId",j)),childIndex:OK(B,b.children),item:B})}),W},h=function(b,v){var x=b.props,k=b.dataStartIndex,E=b.dataEndIndex,j=b.updateId;if(!x4({props:x}))return null;var S=x.children,C=x.layout,O=x.stackOffset,M=x.data,A=x.reverseStackOrder,T=f7(C),_=T.numericAxisName,F=T.cateAxisName,$=Jn(S,r),I=_te(M,$,"".concat(_,"Id"),"".concat(F,"Id"),O,A),R=s.reduce(function(U,H){var X="".concat(H.axisType,"Map");return Ce(Ce({},U),{},Nt({},X,Cce(x,Ce(Ce({},H),{},{graphicalItems:$,stackGroups:H.axisType===_&&I,dataStartIndex:k,dataEndIndex:E}))))},{}),W=Tce(Ce(Ce({},R),{},{props:x,graphicalItems:$}),v?.legendBBox);Object.keys(R).forEach(function(U){R[U]=c(x,R[U],W,U.replace("Map",""),t)});var B=R["".concat(F,"Map")],L=Pce(B),q=f(x,Ce(Ce({},R),{},{dataStartIndex:k,dataEndIndex:E,updateId:j,graphicalItems:$,stackGroups:I,offset:W}));return Ce(Ce({formattedGraphicalItems:q,graphicalItems:$,offset:W,stackGroups:I},L),R)},p=function(b){function v(x){var k,E,j;return dce(this,v),j=pce(this,v,[x]),Nt(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Nt(j,"accessibilityManager",new Zue),Nt(j,"handleLegendBBoxUpdate",function(S){if(S){var C=j.state,O=C.dataStartIndex,M=C.dataEndIndex,A=C.updateId;j.setState(Ce({legendBBox:S},h({props:j.props,dataStartIndex:O,dataEndIndex:M,updateId:A},Ce(Ce({},j.state),{},{legendBBox:S}))))}}),Nt(j,"handleReceiveSyncEvent",function(S,C,O){if(j.props.syncId===S){if(O===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(C)}}),Nt(j,"handleBrushChange",function(S){var C=S.startIndex,O=S.endIndex;if(C!==j.state.dataStartIndex||O!==j.state.dataEndIndex){var M=j.state.updateId;j.setState(function(){return Ce({dataStartIndex:C,dataEndIndex:O},h({props:j.props,dataStartIndex:C,dataEndIndex:O,updateId:M},j.state))}),j.triggerSyncEvent({dataStartIndex:C,dataEndIndex:O})}}),Nt(j,"handleMouseEnter",function(S){var C=j.getMouseInfo(S);if(C){var O=Ce(Ce({},C),{},{isTooltipActive:!0});j.setState(O),j.triggerSyncEvent(O);var M=j.props.onMouseEnter;kt(M)&&M(O,S)}}),Nt(j,"triggeredAfterMouseMove",function(S){var C=j.getMouseInfo(S),O=C?Ce(Ce({},C),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(O),j.triggerSyncEvent(O);var M=j.props.onMouseMove;kt(M)&&M(O,S)}),Nt(j,"handleItemMouseEnter",function(S){j.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),Nt(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),Nt(j,"handleMouseMove",function(S){S.persist(),j.throttleTriggeredAfterMouseMove(S)}),Nt(j,"handleMouseLeave",function(S){j.throttleTriggeredAfterMouseMove.cancel();var C={isTooltipActive:!1};j.setState(C),j.triggerSyncEvent(C);var O=j.props.onMouseLeave;kt(O)&&O(C,S)}),Nt(j,"handleOuterEvent",function(S){var C=SK(S),O=Co(j.props,"".concat(C));if(C&&kt(O)){var M,A;/.*touch.*/i.test(C)?A=j.getMouseInfo(S.changedTouches[0]):A=j.getMouseInfo(S),O((M=A)!==null&&M!==void 0?M:{},S)}}),Nt(j,"handleClick",function(S){var C=j.getMouseInfo(S);if(C){var O=Ce(Ce({},C),{},{isTooltipActive:!0});j.setState(O),j.triggerSyncEvent(O);var M=j.props.onClick;kt(M)&&M(O,S)}}),Nt(j,"handleMouseDown",function(S){var C=j.props.onMouseDown;if(kt(C)){var O=j.getMouseInfo(S);C(O,S)}}),Nt(j,"handleMouseUp",function(S){var C=j.props.onMouseUp;if(kt(C)){var O=j.getMouseInfo(S);C(O,S)}}),Nt(j,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),Nt(j,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseDown(S.changedTouches[0])}),Nt(j,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseUp(S.changedTouches[0])}),Nt(j,"handleDoubleClick",function(S){var C=j.props.onDoubleClick;if(kt(C)){var O=j.getMouseInfo(S);C(O,S)}}),Nt(j,"handleContextMenu",function(S){var C=j.props.onContextMenu;if(kt(C)){var O=j.getMouseInfo(S);C(O,S)}}),Nt(j,"triggerSyncEvent",function(S){j.props.syncId!==void 0&&uk.emit(ck,j.props.syncId,S,j.eventEmitterSymbol)}),Nt(j,"applySyncEvent",function(S){var C=j.props,O=C.layout,M=C.syncMethod,A=j.state.updateId,T=S.dataStartIndex,_=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)j.setState(Ce({dataStartIndex:T,dataEndIndex:_},h({props:j.props,dataStartIndex:T,dataEndIndex:_,updateId:A},j.state)));else if(S.activeTooltipIndex!==void 0){var F=S.chartX,$=S.chartY,I=S.activeTooltipIndex,R=j.state,W=R.offset,B=R.tooltipTicks;if(!W)return;if(typeof M=="function")I=M(B,S);else if(M==="value"){I=-1;for(var L=0;L<B.length;L++)if(B[L].value===S.activeLabel){I=L;break}}var q=Ce(Ce({},W),{},{x:W.left,y:W.top}),U=Math.min(F,q.x+q.width),H=Math.min($,q.y+q.height),X=B[I]&&B[I].value,Y=U2(j.state,j.props.data,I),ae=B[I]?{x:O==="horizontal"?B[I].coordinate:U,y:O==="horizontal"?H:B[I].coordinate}:QI;j.setState(Ce(Ce({},S),{},{activeLabel:X,activeCoordinate:ae,activePayload:Y,activeTooltipIndex:I}))}else j.setState(S)}),Nt(j,"renderCursor",function(S){var C,O=j.state,M=O.isTooltipActive,A=O.activeCoordinate,T=O.activePayload,_=O.offset,F=O.activeTooltipIndex,$=O.tooltipAxisBandSize,I=j.getTooltipEventType(),R=(C=S.props.active)!==null&&C!==void 0?C:M,W=j.props.layout,B=S.key||"_recharts-cursor";return y.createElement(oce,{key:B,activeCoordinate:A,activePayload:T,activeTooltipIndex:F,chartName:t,element:S,isActive:R,layout:W,offset:_,tooltipAxisBandSize:$,tooltipEventType:I})}),Nt(j,"renderPolarAxis",function(S,C,O){var M=Co(S,"type.axisType"),A=Co(j.state,"".concat(M,"Map")),T=S.type.defaultProps,_=T!==void 0?Ce(Ce({},T),S.props):S.props,F=A&&A[_["".concat(M,"Id")]];return m.cloneElement(S,Ce(Ce({},F),{},{className:Dt(M,F.className),key:S.key||"".concat(C,"-").concat(O),ticks:Xa(F,!0)}))}),Nt(j,"renderPolarGrid",function(S){var C=S.props,O=C.radialLines,M=C.polarAngles,A=C.polarRadius,T=j.state,_=T.radiusAxisMap,F=T.angleAxisMap,$=Hi(_),I=Hi(F),R=I.cx,W=I.cy,B=I.innerRadius,L=I.outerRadius;return m.cloneElement(S,{polarAngles:Array.isArray(M)?M:Xa(I,!0).map(function(q){return q.coordinate}),polarRadius:Array.isArray(A)?A:Xa($,!0).map(function(q){return q.coordinate}),cx:R,cy:W,innerRadius:B,outerRadius:L,key:S.key||"polar-grid",radialLines:O})}),Nt(j,"renderLegend",function(){var S=j.state.formattedGraphicalItems,C=j.props,O=C.children,M=C.width,A=C.height,T=j.props.margin||{},_=M-(T.left||0)-(T.right||0),F=P_({children:O,formattedGraphicalItems:S,legendWidth:_,legendContent:u});if(!F)return null;var $=F.item,I=l7(F,ace);return m.cloneElement($,Ce(Ce({},I),{},{chartWidth:M,chartHeight:A,margin:T,onBBoxUpdate:j.handleLegendBBoxUpdate}))}),Nt(j,"renderTooltip",function(){var S,C=j.props,O=C.children,M=C.accessibilityLayer,A=ho(O,to);if(!A)return null;var T=j.state,_=T.isTooltipActive,F=T.activeCoordinate,$=T.activePayload,I=T.activeLabel,R=T.offset,W=(S=A.props.active)!==null&&S!==void 0?S:_;return m.cloneElement(A,{viewBox:Ce(Ce({},R),{},{x:R.left,y:R.top}),active:W,label:I,payload:W?$:[],coordinate:F,accessibilityLayer:M})}),Nt(j,"renderBrush",function(S){var C=j.props,O=C.margin,M=C.data,A=j.state,T=A.offset,_=A.dataStartIndex,F=A.dataEndIndex,$=A.updateId;return m.cloneElement(S,{key:S.key||"_recharts-brush",onChange:Tm(j.handleBrushChange,S.props.onChange),data:M,x:qe(S.props.x)?S.props.x:T.left,y:qe(S.props.y)?S.props.y:T.top+T.height+T.brushBottom-(O.bottom||0),width:qe(S.props.width)?S.props.width:T.width,startIndex:_,endIndex:F,updateId:"brush-".concat($)})}),Nt(j,"renderReferenceElement",function(S,C,O){if(!S)return null;var M=j,A=M.clipPathId,T=j.state,_=T.xAxisMap,F=T.yAxisMap,$=T.offset,I=S.type.defaultProps||{},R=S.props,W=R.xAxisId,B=W===void 0?I.xAxisId:W,L=R.yAxisId,q=L===void 0?I.yAxisId:L;return m.cloneElement(S,{key:S.key||"".concat(C,"-").concat(O),xAxis:_[B],yAxis:F[q],viewBox:{x:$.left,y:$.top,width:$.width,height:$.height},clipPathId:A})}),Nt(j,"renderActivePoints",function(S){var C=S.item,O=S.activePoint,M=S.basePoint,A=S.childIndex,T=S.isRange,_=[],F=C.props.key,$=C.item.type.defaultProps!==void 0?Ce(Ce({},C.item.type.defaultProps),C.item.props):C.item.props,I=$.activeDot,R=$.dataKey,W=Ce(Ce({index:A,dataKey:R,cx:O.x,cy:O.y,r:4,fill:ZE(C.item),strokeWidth:2,stroke:"#fff",payload:O.payload,value:O.value},ft(I,!1)),kp(I));return _.push(v.renderActiveDot(I,W,"".concat(F,"-activePoint-").concat(A))),M?_.push(v.renderActiveDot(I,Ce(Ce({},W),{},{cx:M.x,cy:M.y}),"".concat(F,"-basePoint-").concat(A))):T&&_.push(null),_}),Nt(j,"renderGraphicChild",function(S,C,O){var M=j.filterFormatItem(S,C,O);if(!M)return null;var A=j.getTooltipEventType(),T=j.state,_=T.isTooltipActive,F=T.tooltipAxis,$=T.activeTooltipIndex,I=T.activeLabel,R=j.props.children,W=ho(R,to),B=M.props,L=B.points,q=B.isRange,U=B.baseLine,H=M.item.type.defaultProps!==void 0?Ce(Ce({},M.item.type.defaultProps),M.item.props):M.item.props,X=H.activeDot,Y=H.hide,ae=H.activeBar,te=H.activeShape,me=!!(!Y&&_&&W&&(X||ae||te)),Q={};A!=="axis"&&W&&W.props.trigger==="click"?Q={onClick:Tm(j.handleItemMouseEnter,S.props.onClick)}:A!=="axis"&&(Q={onMouseLeave:Tm(j.handleItemMouseLeave,S.props.onMouseLeave),onMouseEnter:Tm(j.handleItemMouseEnter,S.props.onMouseEnter)});var ue=m.cloneElement(S,Ce(Ce({},M.props),Q));function G(ot){return typeof F.dataKey=="function"?F.dataKey(ot.payload):null}if(me)if($>=0){var de,ie;if(F.dataKey&&!F.allowDuplicatedCategory){var V=typeof F.dataKey=="function"?G:"payload.".concat(F.dataKey.toString());de=xp(L,V,I),ie=q&&U&&xp(U,V,I)}else de=L?.[$],ie=q&&U&&U[$];if(te||ae){var ee=S.props.activeIndex!==void 0?S.props.activeIndex:$;return[m.cloneElement(S,Ce(Ce(Ce({},M.props),Q),{},{activeIndex:ee})),null,null]}if(!wt(de))return[ue].concat(Gu(j.renderActivePoints({item:M,activePoint:de,basePoint:ie,childIndex:$,isRange:q})))}else{var ne,ge=(ne=j.getItemByXY(j.state.activeCoordinate))!==null&&ne!==void 0?ne:{graphicalItem:ue},Ee=ge.graphicalItem,Pe=Ee.item,Ie=Pe===void 0?S:Pe,nt=Ee.childIndex,Me=Ce(Ce(Ce({},M.props),Q),{},{activeIndex:nt});return[m.cloneElement(Ie,Me),null,null]}return q?[ue,null,null]:[ue,null]}),Nt(j,"renderCustomized",function(S,C,O){return m.cloneElement(S,Ce(Ce({key:"recharts-customized-".concat(O)},j.props),j.state))}),Nt(j,"renderMap",{CartesianGrid:{handler:Lm,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:Lm},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:Lm},YAxis:{handler:Lm},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((k=x.id)!==null&&k!==void 0?k:xs("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=CM(j.triggeredAfterMouseMove,(E=x.throttleDelay)!==null&&E!==void 0?E:1e3/60),j.state={},j}return bce(v,b),mce(v,[{key:"componentDidMount",value:function(){var x,k;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,k=x.children,E=x.data,j=x.height,S=x.layout,C=ho(k,to);if(C){var O=C.props.defaultIndex;if(!(typeof O!="number"||O<0||O>this.state.tooltipTicks.length-1)){var M=this.state.tooltipTicks[O]&&this.state.tooltipTicks[O].value,A=U2(this.state,E,O,M),T=this.state.tooltipTicks[O].coordinate,_=(this.state.offset.top+j)/2,F=S==="horizontal",$=F?{x:T,y:_}:{y:T,x:_},I=this.state.formattedGraphicalItems.find(function(W){var B=W.item;return B.type.name==="Scatter"});I&&($=Ce(Ce({},$),I.props.points[O].tooltipPosition),A=I.props.points[O].tooltipPayload);var R={activeTooltipIndex:O,isTooltipActive:!0,activeLabel:M,activePayload:A,activeCoordinate:$};this.setState(R),this.renderCursor(C),this.accessibilityManager.setIndex(O)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,k){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==k.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var E,j;this.accessibilityManager.setDetails({offset:{left:(E=this.props.margin.left)!==null&&E!==void 0?E:0,top:(j=this.props.margin.top)!==null&&j!==void 0?j:0}})}return null}},{key:"componentDidUpdate",value:function(x){jw([ho(x.children,to)],[ho(this.props.children,to)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=ho(this.props.children,to);if(x&&typeof x.props.shared=="boolean"){var k=x.props.shared?"axis":"item";return i.indexOf(k)>=0?k:o}return o}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var k=this.container,E=k.getBoundingClientRect(),j=mZ(E),S={chartX:Math.round(x.pageX-j.left),chartY:Math.round(x.pageY-j.top)},C=E.width/k.offsetWidth||1,O=this.inRange(S.chartX,S.chartY,C);if(!O)return null;var M=this.state,A=M.xAxisMap,T=M.yAxisMap,_=this.getTooltipEventType(),F=c7(this.state,this.props.data,this.props.layout,O);if(_!=="axis"&&A&&T){var $=Hi(A).scale,I=Hi(T).scale,R=$&&$.invert?$.invert(S.chartX):null,W=I&&I.invert?I.invert(S.chartY):null;return Ce(Ce({},S),{},{xValue:R,yValue:W},F)}return F?Ce(Ce({},S),F):null}},{key:"inRange",value:function(x,k){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,j=this.props.layout,S=x/E,C=k/E;if(j==="horizontal"||j==="vertical"){var O=this.state.offset,M=S>=O.left&&S<=O.left+O.width&&C>=O.top&&C<=O.top+O.height;return M?{x:S,y:C}:null}var A=this.state,T=A.angleAxisMap,_=A.radiusAxisMap;if(T&&_){var F=Hi(T);return l6({x:S,y:C},F)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,k=this.getTooltipEventType(),E=ho(x,to),j={};E&&k==="axis"&&(E.props.trigger==="click"?j={onClick:this.handleClick}:j={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 S=kp(this.props,this.handleOuterEvent);return Ce(Ce({},S),j)}},{key:"addListener",value:function(){uk.on(ck,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){uk.removeListener(ck,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,k,E){for(var j=this.state.formattedGraphicalItems,S=0,C=j.length;S<C;S++){var O=j[S];if(O.item===x||O.props.key===x.key||k===ei(O.item.type)&&E===O.childIndex)return O}return null}},{key:"renderClipPath",value:function(){var x=this.clipPathId,k=this.state.offset,E=k.left,j=k.top,S=k.height,C=k.width;return y.createElement("defs",null,y.createElement("clipPath",{id:x},y.createElement("rect",{x:E,y:j,height:S,width:C})))}},{key:"getXScales",value:function(){var x=this.state.xAxisMap;return x?Object.entries(x).reduce(function(k,E){var j=s7(E,2),S=j[0],C=j[1];return Ce(Ce({},k),{},Nt({},S,C.scale))},{}):null}},{key:"getYScales",value:function(){var x=this.state.yAxisMap;return x?Object.entries(x).reduce(function(k,E){var j=s7(E,2),S=j[0],C=j[1];return Ce(Ce({},k),{},Nt({},S,C.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(x){var k;return(k=this.state.xAxisMap)===null||k===void 0||(k=k[x])===null||k===void 0?void 0:k.scale}},{key:"getYScaleByAxisId",value:function(x){var k;return(k=this.state.yAxisMap)===null||k===void 0||(k=k[x])===null||k===void 0?void 0:k.scale}},{key:"getItemByXY",value:function(x){var k=this.state,E=k.formattedGraphicalItems,j=k.activeItem;if(E&&E.length)for(var S=0,C=E.length;S<C;S++){var O=E[S],M=O.props,A=O.item,T=A.type.defaultProps!==void 0?Ce(Ce({},A.type.defaultProps),A.props):A.props,_=ei(A.type);if(_==="Bar"){var F=(M.data||[]).find(function(W){return Aoe(x,W)});if(F)return{graphicalItem:O,payload:F}}else if(_==="RadialBar"){var $=(M.data||[]).find(function(W){return l6(x,W)});if($)return{graphicalItem:O,payload:$}}else if(Fg(O,j)||$g(O,j)||rf(O,j)){var I=eie({graphicalItem:O,activeTooltipItem:j,itemData:T.data}),R=T.activeIndex===void 0?I:T.activeIndex;return{graphicalItem:Ce(Ce({},O),{},{childIndex:R}),payload:rf(O,j)?T.data[I]:O.props.data[I]}}}return null}},{key:"render",value:function(){var x=this;if(!x4(this))return null;var k=this.props,E=k.children,j=k.className,S=k.width,C=k.height,O=k.style,M=k.compact,A=k.title,T=k.desc,_=l7(k,ice),F=ft(_,!1);if(M)return y.createElement(RP,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},y.createElement(Nw,Xl({},F,{width:S,height:C,title:A,desc:T}),this.renderClipPath(),w4(E,this.renderMap)));if(this.props.accessibilityLayer){var $,I;F.tabIndex=($=this.props.tabIndex)!==null&&$!==void 0?$:0,F.role=(I=this.props.role)!==null&&I!==void 0?I:"application",F.onKeyDown=function(W){x.accessibilityManager.keyboardEvent(W)},F.onFocus=function(){x.accessibilityManager.focus()}}var R=this.parseEventsOfWrapper();return y.createElement(RP,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},y.createElement("div",Xl({className:Dt("recharts-wrapper",j),style:Ce({position:"relative",cursor:"default",width:S,height:C},O)},R,{ref:function(W){x.container=W}}),y.createElement(Nw,Xl({},F,{width:S,height:C,title:A,desc:T,style:jce}),this.renderClipPath(),w4(E,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(m.Component);Nt(p,"displayName",t),Nt(p,"defaultProps",Ce({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},d)),Nt(p,"getDerivedStateFromProps",function(b,v){var x=b.dataKey,k=b.data,E=b.children,j=b.width,S=b.height,C=b.layout,O=b.stackOffset,M=b.margin,A=v.dataStartIndex,T=v.dataEndIndex;if(v.updateId===void 0){var _=d7(b);return Ce(Ce(Ce({},_),{},{updateId:0},h(Ce(Ce({props:b},_),{},{updateId:0}),v)),{},{prevDataKey:x,prevData:k,prevWidth:j,prevHeight:S,prevLayout:C,prevStackOffset:O,prevMargin:M,prevChildren:E})}if(x!==v.prevDataKey||k!==v.prevData||j!==v.prevWidth||S!==v.prevHeight||C!==v.prevLayout||O!==v.prevStackOffset||!au(M,v.prevMargin)){var F=d7(b),$={chartX:v.chartX,chartY:v.chartY,isTooltipActive:v.isTooltipActive},I=Ce(Ce({},c7(v,k,C)),{},{updateId:v.updateId+1}),R=Ce(Ce(Ce({},F),$),I);return Ce(Ce(Ce({},R),h(Ce({props:b},R),v)),{},{prevDataKey:x,prevData:k,prevWidth:j,prevHeight:S,prevLayout:C,prevStackOffset:O,prevMargin:M,prevChildren:E})}if(!jw(E,v.prevChildren)){var W,B,L,q,U=ho(E,Lu),H=U&&(W=(B=U.props)===null||B===void 0?void 0:B.startIndex)!==null&&W!==void 0?W:A,X=U&&(L=(q=U.props)===null||q===void 0?void 0:q.endIndex)!==null&&L!==void 0?L:T,Y=H!==A||X!==T,ae=!wt(k),te=ae&&!Y?v.updateId:v.updateId+1;return Ce(Ce({updateId:te},h(Ce(Ce({props:b},v),{},{updateId:te,dataStartIndex:H,dataEndIndex:X}),v)),{},{prevChildren:E,dataStartIndex:H,dataEndIndex:X})}return null}),Nt(p,"renderActiveDot",function(b,v,x){var k;return m.isValidElement(b)?k=m.cloneElement(b,v):kt(b)?k=b(v):k=y.createElement(Pa,v),y.createElement(Ft,{className:"recharts-active-dot",key:x},k)});var g=m.forwardRef(function(b,v){return y.createElement(p,Xl({},b,{ref:v}))});return g.displayName=p.displayName,g},tD=Bf({chartName:"LineChart",GraphicalChild:ds,axisComponents:[{axisType:"xAxis",AxisComp:io},{axisType:"yAxis",AxisComp:so}],formatAxisMap:zg}),rD=Bf({chartName:"BarChart",GraphicalChild:Ns,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:io},{axisType:"yAxis",AxisComp:so}],formatAxisMap:zg}),_ce=Bf({chartName:"PieChart",GraphicalChild:ki,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Rg},{axisType:"radiusAxis",AxisComp:Dg}],formatAxisMap:Vte,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),Ice=Bf({chartName:"ScatterChart",GraphicalChild:$f,defaultTooltipEventType:"item",validateTooltipEventTypes:["item"],axisComponents:[{axisType:"xAxis",AxisComp:io},{axisType:"yAxis",AxisComp:so},{axisType:"zAxis",AxisComp:Ff}],formatAxisMap:zg}),nD=Bf({chartName:"AreaChart",GraphicalChild:wi,axisComponents:[{axisType:"xAxis",AxisComp:io},{axisType:"yAxis",AxisComp:so}],formatAxisMap:zg});const Dce=e=>{m.useEffect(()=>{const t=()=>{e()};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[e])},Ar={Increase:"increase",ModerateIncrease:"moderateIncrease",Decrease:"decrease",ModerateDecrease:"moderateDecrease",Unchanged:"unchanged"},et={Slate:"slate",Gray:"gray",Zinc:"zinc",Neutral:"neutral",Stone:"stone",Red:"red",Orange:"orange",Amber:"amber",Yellow:"yellow",Lime:"lime",Green:"green",Emerald:"emerald",Teal:"teal",Cyan:"cyan",Sky:"sky",Blue:"blue",Indigo:"indigo",Violet:"violet",Purple:"purple",Fuchsia:"fuchsia",Pink:"pink",Rose:"rose"},Kg={SM:"sm"},lu={Left:"left",Right:"right"},m7={Top:"top",Bottom:"bottom"},He={background:500,darkBackground:600,border:500,darkBorder:700,ring:300,iconRing:500,lightText:400,text:500,iconText:600,darkText:700},Ra=[et.Blue,et.Cyan,et.Sky,et.Indigo,et.Violet,et.Purple,et.Fuchsia,et.Slate,et.Gray,et.Zinc,et.Neutral,et.Stone,et.Red,et.Orange,et.Amber,et.Yellow,et.Lime,et.Green,et.Emerald,et.Teal,et.Pink,et.Rose],uN="-",Lce=e=>{const t=Fce(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const a=o.split(uN);return a[0]===""&&a.length!==1&&a.shift(),oD(a,t)||Rce(o)},getConflictingClassGroupIds:(o,a)=>{const i=r[o]||[];return a&&n[o]?[...i,...n[o]]:i}}},oD=(e,t)=>{var r;if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),a=o?oD(e.slice(1),o):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(uN);return(r=t.validators.find(({validator:s})=>s(i)))==null?void 0:r.classGroupId},p7=/^\[(.+)\]$/,Rce=e=>{if(p7.test(e)){const t=p7.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},Fce=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return Bce(Object.entries(e.classGroups),r).forEach(([o,a])=>{V2(a,n,o,t)}),n},V2=(e,t,r,n)=>{e.forEach(o=>{if(typeof o=="string"){const a=o===""?t:h7(t,o);a.classGroupId=r;return}if(typeof o=="function"){if($ce(o)){V2(o(n),t,r,n);return}t.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([a,i])=>{V2(i,h7(t,a),r,n)})})},h7=(e,t)=>{let r=e;return t.split(uN).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},$ce=e=>e.isThemeGetter,Bce=(e,t)=>t?e.map(([r,n])=>{const o=n.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([i,s])=>[t+i,s])):a);return[r,o]}):e,zce=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const o=(a,i)=>{r.set(a,i),t++,t>e&&(t=0,n=r,r=new Map)};return{get(a){let i=r.get(a);if(i!==void 0)return i;if((i=n.get(a))!==void 0)return o(a,i),i},set(a,i){r.has(a)?r.set(a,i):o(a,i)}}},aD="!",Hce=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,o=t[0],a=t.length,i=s=>{const u=[];let c=0,d=0,f;for(let v=0;v<s.length;v++){let x=s[v];if(c===0){if(x===o&&(n||s.slice(v,v+a)===t)){u.push(s.slice(d,v)),d=v+a;continue}if(x==="/"){f=v;continue}}x==="["?c++:x==="]"&&c--}const h=u.length===0?s:s.substring(d),p=h.startsWith(aD),g=p?h.substring(1):h,b=f&&f>d?f-d:void 0;return{modifiers:u,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:b}};return r?s=>r({className:s,parseClassName:i}):i},qce=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},Uce=e=>({cache:zce(e.cacheSize),parseClassName:Hce(e),...Lce(e)}),Vce=/\s+/,Wce=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o}=t,a=[],i=e.trim().split(Vce);let s="";for(let u=i.length-1;u>=0;u-=1){const c=i[u],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=r(c);let g=!!p,b=n(g?h.substring(0,p):h);if(!b){if(!g){s=c+(s.length>0?" "+s:s);continue}if(b=n(h),!b){s=c+(s.length>0?" "+s:s);continue}g=!1}const v=qce(d).join(":"),x=f?v+aD:v,k=x+b;if(a.includes(k))continue;a.push(k);const E=o(b,g);for(let j=0;j<E.length;++j){const S=E[j];a.push(x+S)}s=c+(s.length>0?" "+s:s)}return s};function Kce(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=iD(t))&&(n&&(n+=" "),n+=r);return n}const iD=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=iD(e[n]))&&(r&&(r+=" "),r+=t);return r};function g7(e,...t){let r,n,o,a=i;function i(u){const c=t.reduce((d,f)=>f(d),e());return r=Uce(c),n=r.cache.get,o=r.cache.set,a=s,s(u)}function s(u){const c=n(u);if(c)return c;const d=Wce(u,r);return o(u,d),d}return function(){return a(Kce.apply(null,arguments))}}const Fr=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},sD=/^\[(?:([a-z-]+):)?(.+)\]$/i,Yce=/^\d+\/\d+$/,Gce=new Set(["px","full","screen"]),Xce=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zce=/\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$/,Jce=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Qce=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ede=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qa=e=>uu(e)||Gce.has(e)||Yce.test(e),Mi=e=>mc(e,"length",lde),uu=e=>!!e&&!Number.isNaN(Number(e)),fk=e=>mc(e,"number",uu),qc=e=>!!e&&Number.isInteger(Number(e)),tde=e=>e.endsWith("%")&&uu(e.slice(0,-1)),zt=e=>sD.test(e),_i=e=>Xce.test(e),rde=new Set(["length","size","percentage"]),nde=e=>mc(e,rde,lD),ode=e=>mc(e,"position",lD),ade=new Set(["image","url"]),ide=e=>mc(e,ade,cde),sde=e=>mc(e,"",ude),Uc=()=>!0,mc=(e,t,r)=>{const n=sD.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},lde=e=>Zce.test(e)&&!Jce.test(e),lD=()=>!1,ude=e=>Qce.test(e),cde=e=>ede.test(e),b7=()=>{const e=Fr("colors"),t=Fr("spacing"),r=Fr("blur"),n=Fr("brightness"),o=Fr("borderColor"),a=Fr("borderRadius"),i=Fr("borderSpacing"),s=Fr("borderWidth"),u=Fr("contrast"),c=Fr("grayscale"),d=Fr("hueRotate"),f=Fr("invert"),h=Fr("gap"),p=Fr("gradientColorStops"),g=Fr("gradientColorStopPositions"),b=Fr("inset"),v=Fr("margin"),x=Fr("opacity"),k=Fr("padding"),E=Fr("saturate"),j=Fr("scale"),S=Fr("sepia"),C=Fr("skew"),O=Fr("space"),M=Fr("translate"),A=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto",zt,t],F=()=>[zt,t],$=()=>["",qa,Mi],I=()=>["auto",uu,zt],R=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],W=()=>["solid","dashed","dotted","double","none"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],q=()=>["","0",zt],U=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[uu,zt];return{cacheSize:500,separator:":",theme:{colors:[Uc],spacing:[qa,Mi],blur:["none","",_i,zt],brightness:H(),borderColor:[e],borderRadius:["none","","full",_i,zt],borderSpacing:F(),borderWidth:$(),contrast:H(),grayscale:q(),hueRotate:H(),invert:q(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[tde,Mi],inset:_(),margin:_(),opacity:H(),padding:F(),saturate:H(),scale:H(),sepia:q(),skew:H(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",zt]}],container:["container"],columns:[{columns:[_i]}],"break-after":[{"break-after":U()}],"break-before":[{"break-before":U()}],"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"],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:[...R(),zt]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[b]}],"inset-x":[{"inset-x":[b]}],"inset-y":[{"inset-y":[b]}],start:[{start:[b]}],end:[{end:[b]}],top:[{top:[b]}],right:[{right:[b]}],bottom:[{bottom:[b]}],left:[{left:[b]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qc,zt]}],basis:[{basis:_()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",zt]}],grow:[{grow:q()}],shrink:[{shrink:q()}],order:[{order:["first","last","none",qc,zt]}],"grid-cols":[{"grid-cols":[Uc]}],"col-start-end":[{col:["auto",{span:["full",qc,zt]},zt]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[Uc]}],"row-start-end":[{row:["auto",{span:[qc,zt]},zt]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",zt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",zt]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[k]}],px:[{px:[k]}],py:[{py:[k]}],ps:[{ps:[k]}],pe:[{pe:[k]}],pt:[{pt:[k]}],pr:[{pr:[k]}],pb:[{pb:[k]}],pl:[{pl:[k]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",zt,t]}],"min-w":[{"min-w":[zt,t,"min","max","fit"]}],"max-w":[{"max-w":[zt,t,"none","full","min","max","fit","prose",{screen:[_i]},_i]}],h:[{h:[zt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[zt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[zt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[zt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",_i,Mi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fk]}],"font-family":[{font:[Uc]}],"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:["tighter","tight","normal","wide","wider","widest",zt]}],"line-clamp":[{"line-clamp":["none",uu,fk]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",qa,zt]}],"list-image":[{"list-image":["none",zt]}],"list-style-type":[{list:["none","disc","decimal",zt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...W(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",qa,Mi]}],"underline-offset":[{"underline-offset":["auto",qa,zt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",zt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",zt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...R(),ode]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",nde]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},ide]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...W(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:W()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...W()]}],"outline-offset":[{"outline-offset":[qa,zt]}],"outline-w":[{outline:[qa,Mi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[qa,Mi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",_i,sde]}],"shadow-color":[{shadow:[Uc]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...B(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":B()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",_i,zt]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[E]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",zt]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",zt]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",zt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[qc,zt]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",zt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",zt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"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",zt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[qa,Mi,fk]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},dde=(e,{cacheSize:t,prefix:r,separator:n,experimentalParseClassName:o,extend:a={},override:i={}})=>{sd(e,"cacheSize",t),sd(e,"prefix",r),sd(e,"separator",n),sd(e,"experimentalParseClassName",o);for(const s in i)fde(e[s],i[s]);for(const s in a)mde(e[s],a[s]);return e},sd=(e,t,r)=>{r!==void 0&&(e[t]=r)},fde=(e,t)=>{if(t)for(const r in t)sd(e,r,t[r])},mde=(e,t)=>{if(t)for(const r in t){const n=t[r];n!==void 0&&(e[r]=(e[r]||[]).concat(n))}},pde=(e,...t)=>typeof e=="function"?g7(b7,e,...t):g7(()=>dde(b7(),e),...t),Z=pde({extend:{classGroups:{shadow:[{shadow:[{tremor:["input","card","dropdown"],"dark-tremor":["input","card","dropdown"]}]}],rounded:[{rounded:[{tremor:["small","default","full"],"dark-tremor":["small","default","full"]}]}],"font-size":[{text:[{tremor:["default","title","metric"],"dark-tremor":["default","title","metric"]}]}]}}}),hde=["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],gde=e=>hde.includes(e),uD=(e,t)=>{if(t||e===Ar.Unchanged)return e;switch(e){case Ar.Increase:return Ar.Decrease;case Ar.ModerateIncrease:return Ar.ModerateDecrease;case Ar.Decrease:return Ar.Increase;case Ar.ModerateDecrease:return Ar.ModerateIncrease}return""},Ea=e=>e.toString(),cN=e=>e.reduce((t,r)=>t+r,0),bde=(e,t)=>{for(let r=0;r<t.length;r++)if(t[r]===e)return!0;return!1};function ji(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function xt(e){return t=>`tremor-${e}-${t}`}function Fe(e,t){const r=gde(e);if(e==="white"||e==="black"||e==="transparent"||!t||!r){const n=(o=>o.includes("#")||o.includes("--")||o.includes("rgb"))(e)?`[${e}]`:e;return{bgColor:`bg-${n} dark:bg-${n}`,hoverBgColor:`hover:bg-${n} dark:hover:bg-${n}`,selectBgColor:`data-[selected]:bg-${n} dark:data-[selected]:bg-${n}`,textColor:`text-${n} dark:text-${n}`,selectTextColor:`data-[selected]:text-${n} dark:data-[selected]:text-${n}`,hoverTextColor:`hover:text-${n} dark:hover:text-${n}`,borderColor:`border-${n} dark:border-${n}`,selectBorderColor:`data-[selected]:border-${n} dark:data-[selected]:border-${n}`,hoverBorderColor:`hover:border-${n} dark:hover:border-${n}`,ringColor:`ring-${n} dark:ring-${n}`,strokeColor:`stroke-${n} dark:stroke-${n}`,fillColor:`fill-${n} dark:fill-${n}`}}return{bgColor:`bg-${e}-${t} dark:bg-${e}-${t}`,selectBgColor:`data-[selected]:bg-${e}-${t} dark:data-[selected]:bg-${e}-${t}`,hoverBgColor:`hover:bg-${e}-${t} dark:hover:bg-${e}-${t}`,textColor:`text-${e}-${t} dark:text-${e}-${t}`,selectTextColor:`data-[selected]:text-${e}-${t} dark:data-[selected]:text-${e}-${t}`,hoverTextColor:`hover:text-${e}-${t} dark:hover:text-${e}-${t}`,borderColor:`border-${e}-${t} dark:border-${e}-${t}`,selectBorderColor:`data-[selected]:border-${e}-${t} dark:data-[selected]:border-${e}-${t}`,hoverBorderColor:`hover:border-${e}-${t} dark:hover:border-${e}-${t}`,ringColor:`ring-${e}-${t} dark:ring-${e}-${t}`,strokeColor:`stroke-${e}-${t} dark:stroke-${e}-${t}`,fillColor:`fill-${e}-${t} dark:fill-${e}-${t}`}}const vde=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),y.createElement("path",{d:"M8 12L14 6V18L8 12Z"}))},yde=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),y.createElement("path",{d:"M16 12L10 18V6L16 12Z"}))},dN=xt("Legend"),xde=({name:e,color:t,onClick:r,activeLegend:n})=>{const o=!!r;return y.createElement("li",{className:Z(dN("legendItem"),"group inline-flex items-center px-2 py-0.5 rounded-tremor-small transition whitespace-nowrap",o?"cursor-pointer":"cursor-default","text-tremor-content",o?"hover:bg-tremor-background-subtle":"","dark:text-dark-tremor-content",o?"dark:hover:bg-dark-tremor-background-subtle":""),onClick:a=>{a.stopPropagation(),r?.(e,t)}},y.createElement("svg",{className:Z("flex-none h-2 w-2 mr-1.5",Fe(t,He.text).textColor,n&&n!==e?"opacity-40":"opacity-100"),fill:"currentColor",viewBox:"0 0 8 8"},y.createElement("circle",{cx:4,cy:4,r:4})),y.createElement("p",{className:Z("whitespace-nowrap truncate text-tremor-default","text-tremor-content",o?"group-hover:text-tremor-content-emphasis":"","dark:text-dark-tremor-content",n&&n!==e?"opacity-40":"opacity-100",o?"dark:group-hover:text-dark-tremor-content-emphasis":"")},e))},v7=({icon:e,onClick:t,disabled:r})=>{const n=e,[o,a]=y.useState(!1),i=y.useRef(null);return y.useEffect(()=>(o?i.current=setInterval(()=>{t?.()},300):clearInterval(i.current),()=>clearInterval(i.current)),[o,t]),m.useEffect(()=>{r&&(clearInterval(i.current),a(!1))},[r]),y.createElement("button",{type:"button",className:Z(dN("legendSliderButton"),"w-5 group inline-flex items-center truncate rounded-tremor-small transition",r?"cursor-not-allowed":"cursor-pointer",r?"text-tremor-content-subtle":"text-tremor-content hover:text-tremor-content-emphasis hover:bg-tremor-background-subtle",r?"dark:text-dark-tremor-subtle":"dark:text-dark-tremor dark:hover:text-tremor-content-emphasis dark:hover:bg-dark-tremor-background-subtle"),disabled:r,onClick:s=>{s.stopPropagation(),t?.()},onMouseDown:s=>{s.stopPropagation(),a(!0)},onMouseUp:s=>{s.stopPropagation(),a(!1)}},y.createElement(n,{className:"w-full"}))},cD=y.forwardRef((e,t)=>{const{categories:r,colors:n=Ra,className:o,onClickLegendItem:a,activeLegend:i,enableLegendSlider:s=!1}=e,u=Re(e,["categories","colors","className","onClickLegendItem","activeLegend","enableLegendSlider"]),c=y.useRef(null),d=y.useRef(null),[f,h]=y.useState(null),[p,g]=y.useState(null),b=y.useRef(null),v=m.useCallback(()=>{const j=c?.current;if(!j)return;const S=j.scrollLeft>0,C=j.scrollWidth-j.clientWidth>j.scrollLeft;h({left:S,right:C})},[h]),x=m.useCallback(j=>{var S,C;const O=c?.current,M=d?.current,A=(S=O?.clientWidth)!==null&&S!==void 0?S:0,T=(C=M?.clientWidth)!==null&&C!==void 0?C:0;O&&s&&(O.scrollTo({left:j==="left"?O.scrollLeft-A+T:O.scrollLeft+A-T,behavior:"smooth"}),setTimeout(()=>{v()},400))},[s,v]);y.useEffect(()=>{const j=S=>{S==="ArrowLeft"?x("left"):S==="ArrowRight"&&x("right")};return p?(j(p),b.current=setInterval(()=>{j(p)},300)):clearInterval(b.current),()=>clearInterval(b.current)},[p,x]);const k=j=>{j.stopPropagation(),j.key!=="ArrowLeft"&&j.key!=="ArrowRight"||(j.preventDefault(),g(j.key))},E=j=>{j.stopPropagation(),g(null)};return y.useEffect(()=>{const j=c?.current;return s&&(v(),j?.addEventListener("keydown",k),j?.addEventListener("keyup",E)),()=>{j?.removeEventListener("keydown",k),j?.removeEventListener("keyup",E)}},[v,s]),y.createElement("ol",Object.assign({ref:t,className:Z(dN("root"),"relative overflow-hidden",o)},u),y.createElement("div",{ref:c,tabIndex:0,className:Z("h-full flex",s?f!=null&&f.right||f!=null&&f.left?"pl-4 pr-12 items-center overflow-auto snap-mandatory [&::-webkit-scrollbar]:hidden [scrollbar-width:none]":"":"flex-wrap")},r.map((j,S)=>y.createElement(xde,{key:`item-${S}`,name:j,color:n[S%n.length],onClick:a,activeLegend:i}))),s&&(f!=null&&f.right||f!=null&&f.left)?y.createElement(y.Fragment,null,y.createElement("div",{className:Z("bg-tremor-background","dark:bg-dark-tremor-background","absolute flex top-0 pr-1 bottom-0 right-0 items-center justify-center h-full"),ref:d},y.createElement(v7,{icon:vde,onClick:()=>{g(null),x("left")},disabled:!(f!=null&&f.left)}),y.createElement(v7,{icon:yde,onClick:()=>{g(null),x("right")},disabled:!(f!=null&&f.right)}))):null)});cD.displayName="Legend";const Yg=({payload:e},t,r,n,o,a)=>{const i=m.useRef(null);Dce(()=>{var u,c;r((c=(u=i.current)===null||u===void 0?void 0:u.clientHeight)?Number(c)+20:60)});const s=e.filter(u=>u.type!=="none");return y.createElement("div",{ref:i,className:"flex items-center justify-end"},y.createElement(cD,{categories:s.map(u=>u.value),colors:s.map(u=>t.get(u.value)),onClickLegendItem:o,activeLegend:n,enableLegendSlider:a}))},fN=({children:e})=>y.createElement("div",{className:Z("rounded-tremor-default text-tremor-default border","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border")},e),mN=({value:e,name:t,color:r})=>y.createElement("div",{className:"flex items-center justify-between space-x-8"},y.createElement("div",{className:"flex items-center space-x-2"},y.createElement("span",{className:Z("shrink-0 rounded-tremor-full border-2 h-3 w-3","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",Fe(r,He.background).bgColor)}),y.createElement("p",{className:Z("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},t)),y.createElement("p",{className:Z("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e)),pN=({active:e,payload:t,label:r,categoryColors:n,valueFormatter:o})=>{if(e&&t){const a=t.filter(i=>i.type!=="none");return y.createElement(fN,null,y.createElement("div",{className:Z("border-tremor-border border-b px-4 py-2","dark:border-dark-tremor-border")},y.createElement("p",{className:Z("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},r)),y.createElement("div",{className:Z("px-4 py-2 space-y-1")},a.map(({value:i,name:s},u)=>{var c;return y.createElement(mN,{key:`id-${u}`,value:o(i),name:s,color:(c=n.get(s))!==null&&c!==void 0?c:et.Blue})})))}return null},Ei=({className:e,noDataText:t="No data"})=>y.createElement("div",{className:Z("flex items-center justify-center w-full h-full border border-dashed rounded-tremor-default","border-tremor-border","dark:border-dark-tremor-border",e)},y.createElement("p",{className:Z("text-tremor-content text-tremor-default","dark:text-dark-tremor-content")},t)),jl=(e,t)=>{const r=new Map;return e.forEach((n,o)=>{r.set(n,t[o%t.length])}),r},fs=(e,t,r)=>[e?"auto":t??0,r??"auto"],kde=(e,t)=>{if(!t)return[];const r=new Set;return e.forEach(n=>{r.add(n[t])}),Array.from(r)};function cf(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const o of r)if(!n.includes(o)||!cf(e[o],t[o]))return!1;return!0}function cu(e,t){const r=[];for(const n of e)if(Object.prototype.hasOwnProperty.call(n,t)&&(r.push(n[t]),r.length>1))return!1;return!0}const df=y.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:o,stack:a=!1,colors:i=Ra,valueFormatter:s=Ea,startEndOnly:u=!1,showXAxis:c=!0,showYAxis:d=!0,yAxisWidth:f=56,intervalType:h="equidistantPreserveStart",showAnimation:p=!1,animationDuration:g=900,showTooltip:b=!0,showLegend:v=!0,showGridLines:x=!0,showGradient:k=!0,autoMinValue:E=!1,curveType:j="linear",minValue:S,maxValue:C,connectNulls:O=!1,allowDecimals:M=!0,noDataText:A,className:T,onValueChange:_,enableLegendSlider:F=!1,customTooltip:$,rotateLabelX:I,padding:R=!c&&!d||u&&!d?{left:0,right:0}:{left:20,right:20},tickGap:W=5,xAxisLabel:B,yAxisLabel:L}=e,q=Re(e,["data","categories","index","stack","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","showAnimation","animationDuration","showTooltip","showLegend","showGridLines","showGradient","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),U=$,[H,X]=m.useState(60),[Y,ae]=m.useState(void 0),[te,me]=m.useState(void 0),Q=jl(n,i),ue=fs(E,S,C),G=!!_;function de(ie){G&&(ie===te&&!Y||cu(r,ie)&&Y&&Y.dataKey===ie?(me(void 0),_?.(null)):(me(ie),_?.({eventType:"category",categoryClicked:ie})),ae(void 0))}return y.createElement("div",Object.assign({ref:t,className:Z("w-full h-80",T)},q),y.createElement(ks,{className:"h-full w-full"},r!=null&&r.length?y.createElement(nD,{data:r,onClick:G&&(te||Y)?()=>{ae(void 0),me(void 0),_?.(null)}:void 0,margin:{bottom:B?30:void 0,left:L?20:void 0,right:L?5:void 0,top:5}},x?y.createElement(Rf,{className:Z("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,y.createElement(io,{padding:R,hide:!c,dataKey:o,tick:{transform:"translate(0, 6)"},ticks:u?[r[0][o],r[r.length-1][o]]:void 0,fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),interval:u?"preserveStartEnd":h,tickLine:!1,axisLine:!1,minTickGap:W,angle:I?.angle,dy:I?.verticalShift,height:I?.xAxisHeight},B&&y.createElement(jr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},B)),y.createElement(so,{width:f,hide:!d,axisLine:!1,tickLine:!1,type:"number",domain:ue,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:s,allowDecimals:M},L&&y.createElement(jr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},L)),y.createElement(to,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:b?({active:ie,payload:V,label:ee})=>U?y.createElement(U,{payload:V?.map(ne=>{var ge;return Object.assign(Object.assign({},ne),{color:(ge=Q.get(ne.dataKey))!==null&&ge!==void 0?ge:et.Gray})}),active:ie,label:ee}):y.createElement(pN,{active:ie,payload:V,label:ee,valueFormatter:s,categoryColors:Q}):y.createElement(y.Fragment,null),position:{y:0}}),v?y.createElement(ka,{verticalAlign:"top",height:H,content:({payload:ie})=>Yg({payload:ie},Q,X,te,G?V=>de(V):void 0,F)}):null,n.map(ie=>{var V,ee,ne;const ge=((V=Q.get(ie))!==null&&V!==void 0?V:et.Gray).replace("#","");return y.createElement("defs",{key:ie},k?y.createElement("linearGradient",{className:Fe((ee=Q.get(ie))!==null&&ee!==void 0?ee:et.Gray,He.text).textColor,id:ge,x1:"0",y1:"0",x2:"0",y2:"1"},y.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:Y||te&&te!==ie?.15:.4}),y.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):y.createElement("linearGradient",{className:Fe((ne=Q.get(ie))!==null&&ne!==void 0?ne:et.Gray,He.text).textColor,id:ge,x1:"0",y1:"0",x2:"0",y2:"1"},y.createElement("stop",{stopColor:"currentColor",stopOpacity:Y||te&&te!==ie?.1:.3})))}),n.map(ie=>{var V,ee;const ne=((V=Q.get(ie))!==null&&V!==void 0?V:et.Gray).replace("#","");return y.createElement(wi,{className:Fe((ee=Q.get(ie))!==null&&ee!==void 0?ee:et.Gray,He.text).strokeColor,strokeOpacity:Y||te&&te!==ie?.3:1,activeDot:ge=>{var Ee;const{cx:Pe,cy:Ie,stroke:nt,strokeLinecap:Me,strokeLinejoin:ot,strokeWidth:Ge,dataKey:at}=ge;return y.createElement(Pa,{className:Z("stroke-tremor-background dark:stroke-dark-tremor-background",_?"cursor-pointer":"",Fe((Ee=Q.get(at))!==null&&Ee!==void 0?Ee:et.Gray,He.text).fillColor),cx:Pe,cy:Ie,r:5,fill:"",stroke:nt,strokeLinecap:Me,strokeLinejoin:ot,strokeWidth:Ge,onClick:(mt,Ke)=>function(pt,jt){jt.stopPropagation(),G&&(pt.index===Y?.index&&pt.dataKey===Y?.dataKey||cu(r,pt.dataKey)&&te&&te===pt.dataKey?(me(void 0),ae(void 0),_?.(null)):(me(pt.dataKey),ae({index:pt.index,dataKey:pt.dataKey}),_?.(Object.assign({eventType:"dot",categoryClicked:pt.dataKey},pt.payload))))}(ge,Ke)})},dot:ge=>{var Ee;const{stroke:Pe,strokeLinecap:Ie,strokeLinejoin:nt,strokeWidth:Me,cx:ot,cy:Ge,dataKey:at,index:mt}=ge;return cu(r,ie)&&!(Y||te&&te!==ie)||Y?.index===mt&&Y?.dataKey===ie?y.createElement(Pa,{key:mt,cx:ot,cy:Ge,r:5,stroke:Pe,fill:"",strokeLinecap:Ie,strokeLinejoin:nt,strokeWidth:Me,className:Z("stroke-tremor-background dark:stroke-dark-tremor-background",_?"cursor-pointer":"",Fe((Ee=Q.get(at))!==null&&Ee!==void 0?Ee:et.Gray,He.text).fillColor)}):y.createElement(m.Fragment,{key:mt})},key:ie,name:ie,type:j,dataKey:ie,stroke:"",fill:`url(#${ne})`,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:p,animationDuration:g,stackId:a?"a":void 0,connectNulls:O})}),_?n.map(ie=>y.createElement(ds,{className:Z("cursor-pointer"),strokeOpacity:0,key:ie,name:ie,type:j,dataKey:ie,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:O,onClick:(V,ee)=>{ee.stopPropagation();const{name:ne}=V;de(ne)}})):null):y.createElement(Ei,{noDataText:A})))});df.displayName="AreaChart";const kh=y.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:o,colors:a=Ra,valueFormatter:i=Ea,layout:s="horizontal",stack:u=!1,relative:c=!1,startEndOnly:d=!1,animationDuration:f=900,showAnimation:h=!1,showXAxis:p=!0,showYAxis:g=!0,yAxisWidth:b=56,intervalType:v="equidistantPreserveStart",showTooltip:x=!0,showLegend:k=!0,showGridLines:E=!0,autoMinValue:j=!1,minValue:S,maxValue:C,allowDecimals:O=!0,noDataText:M,onValueChange:A,enableLegendSlider:T=!1,customTooltip:_,rotateLabelX:F,barCategoryGap:$,tickGap:I=5,xAxisLabel:R,yAxisLabel:W,className:B,padding:L=p||g?{left:20,right:20}:{left:0,right:0}}=e,q=Re(e,["data","categories","index","colors","valueFormatter","layout","stack","relative","startEndOnly","animationDuration","showAnimation","showXAxis","showYAxis","yAxisWidth","intervalType","showTooltip","showLegend","showGridLines","autoMinValue","minValue","maxValue","allowDecimals","noDataText","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","barCategoryGap","tickGap","xAxisLabel","yAxisLabel","className","padding"]),U=_,[H,X]=m.useState(60),Y=jl(n,a),[ae,te]=y.useState(void 0),[me,Q]=m.useState(void 0),ue=!!A;function G(ie,V,ee){var ne,ge,Ee,Pe;ee.stopPropagation(),A&&(cf(ae,Object.assign(Object.assign({},ie.payload),{value:ie.value}))?(Q(void 0),te(void 0),A?.(null)):(Q((ge=(ne=ie.tooltipPayload)===null||ne===void 0?void 0:ne[0])===null||ge===void 0?void 0:ge.dataKey),te(Object.assign(Object.assign({},ie.payload),{value:ie.value})),A?.(Object.assign({eventType:"bar",categoryClicked:(Pe=(Ee=ie.tooltipPayload)===null||Ee===void 0?void 0:Ee[0])===null||Pe===void 0?void 0:Pe.dataKey},ie.payload))))}const de=fs(j,S,C);return y.createElement("div",Object.assign({ref:t,className:Z("w-full h-80",B)},q),y.createElement(ks,{className:"h-full w-full"},r!=null&&r.length?y.createElement(rD,{barCategoryGap:$,data:r,stackOffset:u?"sign":c?"expand":"none",layout:s==="vertical"?"vertical":"horizontal",onClick:ue&&(me||ae)?()=>{te(void 0),Q(void 0),A?.(null)}:void 0,margin:{bottom:R?30:void 0,left:W?20:void 0,right:W?5:void 0,top:5}},E?y.createElement(Rf,{className:Z("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:s!=="vertical",vertical:s==="vertical"}):null,s!=="vertical"?y.createElement(io,{padding:L,hide:!p,dataKey:o,interval:d?"preserveStartEnd":v,tick:{transform:"translate(0, 6)"},ticks:d?[r[0][o],r[r.length-1][o]]:void 0,fill:"",stroke:"",className:Z("mt-4 text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,angle:F?.angle,dy:F?.verticalShift,height:F?.xAxisHeight,minTickGap:I},R&&y.createElement(jr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},R)):y.createElement(io,{hide:!p,type:"number",tick:{transform:"translate(-3, 0)"},domain:de,fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,tickFormatter:i,minTickGap:I,allowDecimals:O,angle:F?.angle,dy:F?.verticalShift,height:F?.xAxisHeight},R&&y.createElement(jr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},R)),s!=="vertical"?y.createElement(so,{width:b,hide:!g,axisLine:!1,tickLine:!1,type:"number",domain:de,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:c?ie=>`${(100*ie).toString()} %`:i,allowDecimals:O},W&&y.createElement(jr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},W)):y.createElement(so,{width:b,hide:!g,dataKey:o,axisLine:!1,tickLine:!1,ticks:d?[r[0][o],r[r.length-1][o]]:void 0,type:"category",interval:"preserveStartEnd",tick:{transform:"translate(0, 6)"},fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content")},W&&y.createElement(jr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},W)),y.createElement(to,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{fill:"#d1d5db",opacity:"0.15"},content:x?({active:ie,payload:V,label:ee})=>U?y.createElement(U,{payload:V?.map(ne=>{var ge;return Object.assign(Object.assign({},ne),{color:(ge=Y.get(ne.dataKey))!==null&&ge!==void 0?ge:et.Gray})}),active:ie,label:ee}):y.createElement(pN,{active:ie,payload:V,label:ee,valueFormatter:i,categoryColors:Y}):y.createElement(y.Fragment,null),position:{y:0}}),k?y.createElement(ka,{verticalAlign:"top",height:H,content:({payload:ie})=>Yg({payload:ie},Y,X,me,ue?V=>{return ee=V,void(ue&&(ee!==me||ae?(Q(ee),A?.({eventType:"category",categoryClicked:ee})):(Q(void 0),A?.(null)),te(void 0)));var ee}:void 0,T)}):null,n.map(ie=>{var V;return y.createElement(Ns,{className:Z(Fe((V=Y.get(ie))!==null&&V!==void 0?V:et.Gray,He.background).fillColor,A?"cursor-pointer":""),key:ie,name:ie,type:"linear",stackId:u||c?"a":void 0,dataKey:ie,fill:"",isAnimationActive:h,animationDuration:f,shape:ee=>((ne,ge,Ee,Pe)=>{const{fillOpacity:Ie,name:nt,payload:Me,value:ot}=ne;let{x:Ge,width:at,y:mt,height:Ke}=ne;return Pe==="horizontal"&&Ke<0?(mt+=Ke,Ke=Math.abs(Ke)):Pe==="vertical"&&at<0&&(Ge+=at,at=Math.abs(at)),y.createElement("rect",{x:Ge,y:mt,width:at,height:Ke,opacity:ge||Ee&&Ee!==nt?cf(ge,Object.assign(Object.assign({},Me),{value:ot}))?Ie:.3:Ie})})(ee,ae,me,s),onClick:G})})):y.createElement(Ei,{noDataText:M})))});kh.displayName="BarChart";const wde=({active:e,payload:t,valueFormatter:r})=>{if(e&&t!=null&&t[0]){const n=t?.[0];return y.createElement(fN,null,y.createElement("div",{className:Z("px-4 py-2")},y.createElement(mN,{value:r(n.value),name:n.name,color:n.payload.color})))}return null},jde=(e,t)=>e.map((r,n)=>{const o=n<t.length?t[n]:et.Gray;return Object.assign(Object.assign({},r),{color:o,className:Fe(o??et.Gray,He.background).fillColor,fill:""})}),Ede=(e,t,r,n)=>e||t(((o,a)=>cN(o.map(i=>i[a])))(r,n)),Nde=e=>{const{cx:t,cy:r,innerRadius:n,outerRadius:o,startAngle:a,endAngle:i,className:s}=e;return y.createElement("g",null,y.createElement(JE,{cx:t,cy:r,innerRadius:n,outerRadius:o,startAngle:a,endAngle:i,className:s,fill:"",opacity:.3,style:{outline:"none"}}))},dD=y.forwardRef((e,t)=>{const{data:r=[],category:n="value",index:o="name",colors:a=Ra,variant:i="donut",valueFormatter:s=Ea,label:u,showLabel:c=!0,animationDuration:d=900,showAnimation:f=!1,showTooltip:h=!0,noDataText:p,onValueChange:g,customTooltip:b,className:v}=e,x=Re(e,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","noDataText","onValueChange","customTooltip","className"]),k=b,E=i=="donut",j=Ede(u,s,r,n),[S,C]=y.useState(void 0),O=!!g;return m.useEffect(()=>{const M=document.querySelectorAll(".recharts-pie-sector");M&&M.forEach(A=>{A.setAttribute("style","outline: none")})},[S]),y.createElement("div",Object.assign({ref:t,className:Z("w-full h-40",v)},x),y.createElement(ks,{className:"h-full w-full"},r!=null&&r.length?y.createElement(_ce,{onClick:O&&S?()=>{C(void 0),g?.(null)}:void 0,margin:{top:0,left:0,right:0,bottom:0}},c&&E?y.createElement("text",{className:Z("fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis"),x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle"},j):null,y.createElement(ki,{className:Z("stroke-tremor-background dark:stroke-dark-tremor-background",g?"cursor-pointer":"cursor-default"),data:jde(r,a),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:E?"75%":"0%",outerRadius:"100%",stroke:"",strokeLinejoin:"round",dataKey:n,nameKey:o,isAnimationActive:f,animationDuration:d,onClick:function(M,A,T){T.stopPropagation(),O&&(S===A?(C(void 0),g?.(null)):(C(A),g?.(Object.assign({eventType:"slice"},M.payload.payload))))},activeIndex:S,inactiveShape:Nde,style:{outline:"none"}}),y.createElement(to,{wrapperStyle:{outline:"none"},isAnimationActive:!1,content:h?({active:M,payload:A})=>{var T;return k?y.createElement(k,{payload:A?.map(_=>{var F,$,I;return Object.assign(Object.assign({},_),{color:(I=($=(F=A?.[0])===null||F===void 0?void 0:F.payload)===null||$===void 0?void 0:$.color)!==null&&I!==void 0?I:et.Gray})}),active:M,label:(T=A?.[0])===null||T===void 0?void 0:T.name}):y.createElement(wde,{active:M,payload:A,valueFormatter:s})}:y.createElement(y.Fragment,null)})):y.createElement(Ei,{noDataText:p})))});dD.displayName="DonutChart";const fD=y.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:o,colors:a=Ra,valueFormatter:i=Ea,startEndOnly:s=!1,showXAxis:u=!0,showYAxis:c=!0,yAxisWidth:d=56,intervalType:f="equidistantPreserveStart",animationDuration:h=900,showAnimation:p=!1,showTooltip:g=!0,showLegend:b=!0,showGridLines:v=!0,autoMinValue:x=!1,curveType:k="linear",minValue:E,maxValue:j,connectNulls:S=!1,allowDecimals:C=!0,noDataText:O,className:M,onValueChange:A,enableLegendSlider:T=!1,customTooltip:_,rotateLabelX:F,padding:$=u||c?{left:20,right:20}:{left:0,right:0},tickGap:I=5,xAxisLabel:R,yAxisLabel:W}=e,B=Re(e,["data","categories","index","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","noDataText","className","onValueChange","enableLegendSlider","customTooltip","rotateLabelX","padding","tickGap","xAxisLabel","yAxisLabel"]),L=_,[q,U]=m.useState(60),[H,X]=m.useState(void 0),[Y,ae]=m.useState(void 0),te=jl(n,a),me=fs(x,E,j),Q=!!A;function ue(G){Q&&(G===Y&&!H||cu(r,G)&&H&&H.dataKey===G?(ae(void 0),A?.(null)):(ae(G),A?.({eventType:"category",categoryClicked:G})),X(void 0))}return y.createElement("div",Object.assign({ref:t,className:Z("w-full h-80",M)},B),y.createElement(ks,{className:"h-full w-full"},r!=null&&r.length?y.createElement(tD,{data:r,onClick:Q&&(Y||H)?()=>{X(void 0),ae(void 0),A?.(null)}:void 0,margin:{bottom:R?30:void 0,left:W?20:void 0,right:W?5:void 0,top:5}},v?y.createElement(Rf,{className:Z("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!1}):null,y.createElement(io,{padding:$,hide:!u,dataKey:o,interval:s?"preserveStartEnd":f,tick:{transform:"translate(0, 6)"},ticks:s?[r[0][o],r[r.length-1][o]]:void 0,fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,axisLine:!1,minTickGap:I,angle:F?.angle,dy:F?.verticalShift,height:F?.xAxisHeight},R&&y.createElement(jr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},R)),y.createElement(so,{width:d,hide:!c,axisLine:!1,tickLine:!1,type:"number",domain:me,tick:{transform:"translate(-3, 0)"},fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickFormatter:i,allowDecimals:C},W&&y.createElement(jr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},W)),y.createElement(to,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:g?({active:G,payload:de,label:ie})=>L?y.createElement(L,{payload:de?.map(V=>{var ee;return Object.assign(Object.assign({},V),{color:(ee=te.get(V.dataKey))!==null&&ee!==void 0?ee:et.Gray})}),active:G,label:ie}):y.createElement(pN,{active:G,payload:de,label:ie,valueFormatter:i,categoryColors:te}):y.createElement(y.Fragment,null),position:{y:0}}),b?y.createElement(ka,{verticalAlign:"top",height:q,content:({payload:G})=>Yg({payload:G},te,U,Y,Q?de=>ue(de):void 0,T)}):null,n.map(G=>{var de;return y.createElement(ds,{className:Z(Fe((de=te.get(G))!==null&&de!==void 0?de:et.Gray,He.text).strokeColor),strokeOpacity:H||Y&&Y!==G?.3:1,activeDot:ie=>{var V;const{cx:ee,cy:ne,stroke:ge,strokeLinecap:Ee,strokeLinejoin:Pe,strokeWidth:Ie,dataKey:nt}=ie;return y.createElement(Pa,{className:Z("stroke-tremor-background dark:stroke-dark-tremor-background",A?"cursor-pointer":"",Fe((V=te.get(nt))!==null&&V!==void 0?V:et.Gray,He.text).fillColor),cx:ee,cy:ne,r:5,fill:"",stroke:ge,strokeLinecap:Ee,strokeLinejoin:Pe,strokeWidth:Ie,onClick:(Me,ot)=>function(Ge,at){at.stopPropagation(),Q&&(Ge.index===H?.index&&Ge.dataKey===H?.dataKey||cu(r,Ge.dataKey)&&Y&&Y===Ge.dataKey?(ae(void 0),X(void 0),A?.(null)):(ae(Ge.dataKey),X({index:Ge.index,dataKey:Ge.dataKey}),A?.(Object.assign({eventType:"dot",categoryClicked:Ge.dataKey},Ge.payload))))}(ie,ot)})},dot:ie=>{var V;const{stroke:ee,strokeLinecap:ne,strokeLinejoin:ge,strokeWidth:Ee,cx:Pe,cy:Ie,dataKey:nt,index:Me}=ie;return cu(r,G)&&!(H||Y&&Y!==G)||H?.index===Me&&H?.dataKey===G?y.createElement(Pa,{key:Me,cx:Pe,cy:Ie,r:5,stroke:ee,fill:"",strokeLinecap:ne,strokeLinejoin:ge,strokeWidth:Ee,className:Z("stroke-tremor-background dark:stroke-dark-tremor-background",A?"cursor-pointer":"",Fe((V=te.get(nt))!==null&&V!==void 0?V:et.Gray,He.text).fillColor)}):y.createElement(m.Fragment,{key:Me})},key:G,name:G,type:k,dataKey:G,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:p,animationDuration:h,connectNulls:S})}),A?n.map(G=>y.createElement(ds,{className:Z("cursor-pointer"),strokeOpacity:0,key:G,name:G,type:k,dataKey:G,stroke:"transparent",fill:"transparent",legendType:"none",tooltipType:"none",strokeWidth:12,connectNulls:S,onClick:(de,ie)=>{ie.stopPropagation();const{name:V}=de;ue(V)}})):null):y.createElement(Ei,{noDataText:O})))});fD.displayName="LineChart";const Sde=({children:e})=>y.createElement("div",{className:Z("rounded-tremor-default text-tremor-default border","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border")},e),Ode=({value:e,name:t})=>y.createElement("div",{className:"flex items-center justify-between space-x-8"},y.createElement("div",{className:"flex items-center space-x-2"},y.createElement("p",{className:Z("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},t)),y.createElement("p",{className:Z("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e)),Cde=({label:e,active:t,payload:r,valueFormatter:n,axis:o,category:a,categoryColors:i})=>{var s,u;return t&&r?y.createElement(Sde,null,y.createElement("div",{className:Z("flex items-center space-x-2 border-b px-4 py-2","border-tremor-border","dark:border-dark-tremor-border")},y.createElement("span",{className:Z("shrink-0 rounded-tremor-full border-2 h-3 w-3","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",Fe(a&&(u=i.get((s=r?.[0])===null||s===void 0?void 0:s.payload[a]))!==null&&u!==void 0?u:et.Blue,He.background).bgColor)}),y.createElement("p",{className:Z("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},e)),y.createElement("div",{className:Z("px-4 py-2 space-y-1")},r.map(({value:c,name:d},f)=>{var h,p;const g=(h=Object.keys(o).find(v=>o[v]===d))!==null&&h!==void 0?h:"",b=(p=n[g])!==null&&p!==void 0?p:Ea;return y.createElement(Ode,{key:`id-${f}`,value:n&&b?b(c):`${c}`,name:d})}))):null},Pde=y.forwardRef((e,t)=>{const{data:r=[],x:n,y:o,size:a,category:i,colors:s=Ra,showOpacity:u=!1,sizeRange:c=[1,1e3],valueFormatter:d={x:Ea,y:Ea,size:Ea},startEndOnly:f=!1,showXAxis:h=!0,showYAxis:p=!0,yAxisWidth:g=56,intervalType:b="equidistantPreserveStart",animationDuration:v=900,showAnimation:x=!1,showTooltip:k=!0,showLegend:E=!0,showGridLines:j=!0,autoMinXValue:S=!1,minXValue:C,maxXValue:O,autoMinYValue:M=!1,minYValue:A,maxYValue:T,allowDecimals:_=!0,noDataText:F,onValueChange:$,customTooltip:I,rotateLabelX:R,className:W,enableLegendSlider:B=!1,tickGap:L=5,xAxisLabel:q,yAxisLabel:U}=e,H=Re(e,["data","x","y","size","category","colors","showOpacity","sizeRange","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","intervalType","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinXValue","minXValue","maxXValue","autoMinYValue","minYValue","maxYValue","allowDecimals","noDataText","onValueChange","customTooltip","rotateLabelX","className","enableLegendSlider","tickGap","xAxisLabel","yAxisLabel"]),X=I,[Y,ae]=m.useState(60),[te,me]=y.useState(void 0),[Q,ue]=m.useState(void 0),G=!!$;function de(ge,Ee,Pe){Pe.stopPropagation(),G&&(cf(te,ge.node)?(ue(void 0),me(void 0),$?.(null)):(me(ge.node),ue(ge.payload[i]),$?.(Object.assign({eventType:"bubble",categoryClicked:ge.payload[i]},ge.payload))))}const ie=kde(r,i),V=jl(ie,s),ee=fs(S,C,O),ne=fs(M,A,T);return y.createElement("div",Object.assign({ref:t,className:Z("w-full h-80",W)},H),y.createElement(ks,{className:"h-full w-full"},r!=null&&r.length?y.createElement(Ice,{onClick:G&&(Q||te)?()=>{me(void 0),ue(void 0),$?.(null)}:void 0,margin:{bottom:q?20:void 0,left:20,right:20,top:5}},j?y.createElement(Rf,{className:Z("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border"),horizontal:!0,vertical:!0}):null,n?y.createElement(io,{hide:!h,dataKey:n,interval:f?"preserveStartEnd":b,tick:{transform:"translate(0, 6)"},ticks:f?[r[0][n],r[r.length-1][n]]:void 0,type:"number",name:n,fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),tickLine:!1,tickFormatter:d.x,axisLine:!1,minTickGap:L,domain:ee,allowDataOverflow:!0,angle:R?.angle,dy:R?.verticalShift,height:R?.xAxisHeight},q&&y.createElement(jr,{position:"insideBottom",offset:-20,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},q)):null,o?y.createElement(so,{width:g,hide:!p,axisLine:!1,tickLine:!1,dataKey:o,type:"number",name:o,domain:ne,tick:{transform:"translate(-3, 0)"},tickFormatter:d.y,fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content"),allowDecimals:_,allowDataOverflow:!0},U&&y.createElement(jr,{position:"insideLeft",style:{textAnchor:"middle"},angle:-90,offset:-15,className:"fill-tremor-content-emphasis text-tremor-default font-medium dark:fill-dark-tremor-content-emphasis"},U)):null,y.createElement(to,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:k?({active:ge,payload:Ee,label:Pe})=>{var Ie,nt;const Me=i?(nt=(Ie=Ee?.[0])===null||Ie===void 0?void 0:Ie.payload)===null||nt===void 0?void 0:nt[i]:Pe;return X?y.createElement(X,{payload:Ee?.map(ot=>{var Ge;return Object.assign(Object.assign({},ot),{color:(Ge=V.get(Me))!==null&&Ge!==void 0?Ge:et.Gray})}),active:ge,label:Me}):y.createElement(Cde,{active:ge,payload:Ee,label:Me,valueFormatter:d,axis:{x:n,y:o,size:a},category:i,categoryColors:V})}:y.createElement(y.Fragment,null)}),a?y.createElement(Ff,{dataKey:a,type:"number",range:c,name:a}):null,ie.map(ge=>{var Ee,Pe;return y.createElement($f,{className:Z(Fe((Ee=V.get(ge))!==null&&Ee!==void 0?Ee:et.Gray,He.text).fillColor,u?Fe((Pe=V.get(ge))!==null&&Pe!==void 0?Pe:et.Gray,He.text).strokeColor:"",$?"cursor-pointer":""),fill:`url(#${V.get(ge)})`,fillOpacity:u?.7:1,key:ge,name:ge,data:i?r.filter(Ie=>Ie[i]===ge):r,isAnimationActive:x,animationDuration:v,shape:Ie=>((nt,Me,ot)=>{const{cx:Ge,cy:at,width:mt,node:Ke,fillOpacity:pt,name:jt}=nt;return y.createElement(Pa,{cx:Ge,cy:at,r:mt/2,opacity:Me||ot&&ot!==jt?cf(Me,Ke)?pt:.3:pt})})(Ie,te,Q),onClick:de})}),E?y.createElement(ka,{verticalAlign:"top",height:Y,content:({payload:ge})=>Yg({payload:ge},V,ae,Q,G?Ee=>{return Pe=Ee,void(G&&(Pe!==Q||te?(ue(Pe),$?.({eventType:"category",categoryClicked:Pe})):(ue(void 0),$?.(null)),me(void 0)));var Pe}:void 0,B)}):null):y.createElement(Ei,{noDataText:F})))});Pde.displayName="ScatterChart";const mD=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M16.1716 10.9999L10.8076 5.63589L12.2218 4.22168L20 11.9999L12.2218 19.778L10.8076 18.3638L16.1716 12.9999H4V10.9999H16.1716Z"}))},Ade=["100%","75%","50%","25%","0%"],Tde=y.forwardRef((e,t)=>{var r,n;const{data:o,evolutionGradient:a=!1,gradient:i=!0,valueFormatter:s=Ea,className:u,calculateFrom:c="first",color:d,variant:f="base",showGridLines:h=!0,showYAxis:p=c!=="previous",showXAxis:g=!0,showArrow:b=!0,xAxisLabel:v="",yAxisLabel:x="",yAxisPadding:k=p?x?70:45:0,showTooltip:E=!0,onValueChange:j,customTooltip:S,noDataText:C,rotateLabelX:O,barGap:M="20%"}=e,A=Re(e,["data","evolutionGradient","gradient","valueFormatter","className","calculateFrom","color","variant","showGridLines","showYAxis","showXAxis","showArrow","xAxisLabel","yAxisLabel","yAxisPadding","showTooltip","onValueChange","customTooltip","noDataText","rotateLabelX","barGap"]),T=g&&v?25:15,_=S,F=y.useRef(null),$=y.useRef(null),[I,R]=y.useState(0),[W,B]=y.useState(0),[L,q]=y.useState({x:0,y:0}),[U,H]=y.useState(void 0),X=!!j,Y=y.useMemo(()=>Math.max(...o.map(V=>V.value)),[o]),ae=I-10-k,te=y.useMemo(()=>{if(typeof M=="number")return M;if(typeof M=="string"&&M.endsWith("%")){const V=parseFloat(M.slice(0,-1));return ae*V/100/(o.length-1)}return console.error('Invalid barGap value. It must be a number or a percentage string (e.g., "10%").'),30},[ae,o.length,M]),me=y.useMemo(()=>(ae-(o.length-1)*te-te)/o.length,[ae,te,o.length]),Q=W-10-(g?(O?.xAxisHeight||T)+(g&&v?30:10):0),ue=c==="previous",G=f==="center";y.useLayoutEffect(()=>{const V=()=>{if(F.current){const ee=F.current.getBoundingClientRect();R(ee.width),B(ee.height)}};return V(),window.addEventListener("resize",V),()=>{window.removeEventListener("resize",V)}},[u]),y.useEffect(()=>{const V=()=>{if($.current){const ee=$.current.getBoundingClientRect();ee.right>window.innerWidth&&($.current.style.left=I-ee.width+"px")}};return V(),window.addEventListener("resize",V),()=>{window.removeEventListener("resize",V)}},[L,I]);const de=y.useMemo(()=>Q<=0?[]:o.reduce((V,ee,ne)=>{var ge,Ee,Pe,Ie;const nt=V[ne-1],Me=ee.value,ot=ue&&(ge=nt?.value)!==null&&ge!==void 0?ge:Y,Ge=ue&&(Ee=nt?.barHeight)!==null&&Ee!==void 0?Ee:Q,at=Me/ot,mt=at*Ge,Ke=ne*(me+te)+.5*te,pt=Ge-mt+(ue?Q-((Pe=nt?.barHeight)!==null&&Pe!==void 0?Pe:Q):0),jt=(Ie=o[ne+1])===null||Ie===void 0?void 0:Ie.value,Ze=jt/ot,$e=Ze*Ge,ut=(ne+1)*(me+te)+.5*te;return V.push({value:Me,normalizedValue:at,name:ee.name,startX:Ke,startY:pt,barHeight:mt,nextValue:jt,nextNormalizedValue:Ze,nextBarHeight:$e,nextStartX:ut}),V},[]),[o,Q,ue,me,te,Y]),ie=V=>{var ee;const ne=(ee=F.current)===null||ee===void 0?void 0:ee.getBoundingClientRect();if(!ne)return;const ge=ne.x,Ee=ne.y+window.scrollY,Pe=ge+window.scrollX+k+5,Ie=Pe+(ne.width-k-5),nt=Ee+(ne.height-5-(g?T:0));if(V.pageX<Pe||V.pageX>Ie||V.pageY<Ee||V.pageY>nt)return console.log("out of bounds"),q({x:0,y:0});const Me=V.pageX-ge-me/2-k-5,ot=de.reduce((at,mt)=>Math.abs(mt.startX-Me)<Math.abs(at.startX-Me)?mt:at),Ge=de.findIndex(at=>at===ot);q({x:ot.startX,y:ot.startY,data:{dataKey:ot.name,name:ot.name,value:ot.value,color:d??et.Blue,className:Z(Fe(d??et.Blue,He.text).textColor,X?"cursor-pointer":"cursor-default"),fill:"",payload:ot},index:Ge})};return y.createElement("div",Object.assign({ref:t,className:Z("tremor-wrapper relative w-full h-80",u)},A),o!=null&&o.length?y.createElement(y.Fragment,null,y.createElement("svg",{ref:F,xmlns:"http://www.w3.org/2000/svg",className:Z("w-full h-full"),onMouseMove:V=>{const ee={clientX:V.clientX,clientY:V.clientY,pageX:V.pageX,pageY:V.pageY};ie(ee)},onTouchMove:V=>{const ee=V.touches[0];ie(ee)},onMouseLeave:()=>q({x:0,y:0}),onTouchEnd:()=>q({x:0,y:0})},Ade.map((V,ee)=>y.createElement(y.Fragment,{key:`y-axis-${ee}`},h?y.createElement("line",{x1:k+5,y1:ee*Q/4+5,x2:I-5,y2:ee*Q/4+5,stroke:"currentColor",className:Z("stroke-1","stroke-tremor-border","dark:stroke-dark-tremor-border")}):null,y.createElement("text",{x:k-10+5,y:ee*Q/4+5+5,textAnchor:"end",fill:"",stroke:"",className:Z("text-tremor-label","fill-tremor-content","dark:fill-dark-tremor-content")},V))),de.map((V,ee)=>{var ne,ge;return y.createElement("g",{key:`bar-${ee}`},y.createElement("rect",{x:V.startX-.5*te+5+k,y:5,width:me+te,height:Q,fill:"currentColor",className:Z("z-0",L.index===ee?"text-[#d1d5db]/15":"text-transparent")}),i?y.createElement("rect",{x:V.startX+5+k,y:Q-(ue&&((ne=de[ee-1])===null||ne===void 0?void 0:ne.barHeight)||Q)+5,width:me,height:(Q-V.barHeight-(ue&&Q-((ge=de[ee-1])===null||ge===void 0?void 0:ge.barHeight)||0))/(G?2:1),fill:"url(#base-gradient)",className:Z(U&&U.index!==ee?"opacity-30":"")}):null,y.createElement("rect",{x:V.startX+5+k,y:(G?Q/2-V.barHeight/2:V.startY)+5,width:me,height:V.barHeight,fill:"currentColor",className:Z(Fe(d??et.Blue,He.text).textColor,U&&U.index!==ee?"opacity-30":"",X?"cursor-pointer":"cursor-default"),onClick:Ee=>function(Pe,Ie,nt){nt.stopPropagation(),X&&(Ie===U?.index?(H(void 0),j(void 0)):(H({data:Pe,index:Ie}),j({eventType:"bar",categoryClicked:Pe.name,[Pe.name]:Pe.value,percentage:Pe.normalizedValue})))}(V,ee,Ee)}),i&&G?y.createElement("rect",{x:V.startX+5+k,y:Q/2+V.barHeight/2+5,width:me,height:(Q-V.barHeight)/2,fill:"url(#base-gradient-revert)",className:Z(U&&U.index!==ee?"opacity-30":"")}):null,g?y.createElement("foreignObject",{x:V.startX+5+k,y:Q+5+10,width:me,height:O?.xAxisHeight||T,transform:O?`rotate(${O?.angle}, ${V.startX+me/2+5+k}, ${Q+(O?.xAxisHeight||T)/2+5+(O?.verticalShift||0)})`:void 0},y.createElement("div",{className:Z("truncate text-center !text-tremor-label","text-tremor-content","dark:text-dark-tremor-content"),title:V.name},V.name)):null)}),de.map((V,ee)=>y.createElement(y.Fragment,{key:`gradient-${ee}`},ee<o.length-1&&a?y.createElement(y.Fragment,null,G?y.createElement(y.Fragment,null,y.createElement("polygon",{points:`
120
+ ${V.startX+me+5+k}, ${Q/2+V.nextBarHeight/4+5}
121
+ ${V.nextStartX+5+k}, ${Q/2+V.nextBarHeight/4+5}
122
+ ${V.nextStartX+5+k}, ${Q/2-V.nextBarHeight/2+5}
123
+ ${V.startX+me+5+k}, ${Q/2-V.barHeight/2+5}
124
+ `,fill:"url(#base-gradient)",className:Z("z-10",U&&U.index!==ee?"opacity-30":"")}),y.createElement("polygon",{points:`
125
+ ${V.startX+me+5+k}, ${Q/2+V.barHeight/2+5}
126
+ ${V.nextStartX+5+k}, ${Q/2+V.nextBarHeight/2+5}
127
+ ${V.nextStartX+5+k}, ${Q/2-V.nextBarHeight/4+5}
128
+ ${V.startX+me+5+k}, ${Q/2-V.nextBarHeight/4+5}
129
+ `,fill:"url(#base-gradient-revert)",className:Z("z-10",U&&U.index!==ee?"opacity-30":"")})):y.createElement("polygon",{points:`
130
+ ${V.startX+me+5+k}, ${V.startY+5}
131
+ ${V.nextStartX+5+k}, ${Q-V.nextBarHeight+5}
132
+ ${V.nextStartX+5+k}, ${Q+5}
133
+ ${V.startX+me+5+k}, ${Q+5}
134
+ `,fill:"url(#base-gradient)",className:Z("z-10",U&&U.index!==ee?"opacity-30":"")})):null,ee<o.length-1&&g&&b&&te>=14?y.createElement("foreignObject",{x:V.startX+me+5+k-6+te/2,y:Q+5+11,width:12,height:O?.xAxisHeight||T},y.createElement("div",{className:Z("text-tremor-content","dark:text-dark-tremor-content")},y.createElement(mD,{className:"size-3.5 shrink-0"}))):null)),y.createElement("linearGradient",{id:"base-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",className:Z(Fe(d??et.Blue,He.text).textColor)},y.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:.4}),y.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})),y.createElement("linearGradient",{id:"base-gradient-revert",x1:"0%",y1:"0%",x2:"0%",y2:"100%",className:Z(Fe(d??et.Blue,He.text).textColor)},y.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:0}),y.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:.4})),g&&v?y.createElement("text",{x:I/2+k/2,y:Q+5+50,style:{textAnchor:"middle"},fill:"",stroke:"",className:Z("text-tremor-default cursor-default font-medium","fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis")},v):null,p&&x?y.createElement("text",{x:-5,y:Q/2+10,textAnchor:"middle",style:{textAnchor:"middle"},transform:`rotate(-90, 0, ${Q/2})`,fill:"",stroke:"",className:Z("text-tremor-default cursor-default font-medium","fill-tremor-content-emphasis","dark:fill-dark-tremor-content-emphasis")},x):null),E?y.createElement("div",{ref:$,className:Z("absolute top-0 pointer-events-none",L.data?"visible":"hidden"),tabIndex:-1,role:"dialog",style:{left:L.x+.66*me}},_?y.createElement(_,{payload:L.data?[L.data]:[],active:!!L.data,label:(r=L.data)===null||r===void 0?void 0:r.name}):y.createElement(fN,null,y.createElement("div",{className:Z("border-tremor-border border-b px-4 py-2","dark:border-dark-tremor-border")},y.createElement("p",{className:Z("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},(n=L?.data)===null||n===void 0?void 0:n.name)),y.createElement("div",{className:Z("px-4 py-2 space-y-1")},L.data?y.createElement(mN,{value:s(L.data.value),name:`${(100*L.data.payload.normalizedValue).toFixed(2)}%`,color:d??et.Blue}):null))):null):y.createElement(Ei,{noDataText:C}))});Tde.displayName="FunnelChart";var tp=typeof document<"u"?m.useLayoutEffect:m.useEffect;function wh(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 r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!wh(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const a=o[n];if(!(a==="_owner"&&e.$$typeof)&&!wh(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function y7(e){const t=m.useRef(e);return tp(()=>{t.current=e}),t}function Mde(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,whileElementsMounted:a,open:i}=e,[s,u]=m.useState({x:null,y:null,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[c,d]=m.useState(n);wh(c,n)||d(n);const f=m.useRef(null),h=m.useRef(null),p=m.useRef(s),g=y7(a),b=y7(o),[v,x]=m.useState(null),[k,E]=m.useState(null),j=m.useCallback(T=>{f.current!==T&&(f.current=T,x(T))},[]),S=m.useCallback(T=>{h.current!==T&&(h.current=T,E(T))},[]),C=m.useCallback(()=>{if(!f.current||!h.current)return;const T={placement:t,strategy:r,middleware:c};b.current&&(T.platform=b.current),Rj(f.current,h.current,T).then(_=>{const F={..._,isPositioned:!0};O.current&&!wh(p.current,F)&&(p.current=F,nr.flushSync(()=>{u(F)}))})},[c,t,r,b]);tp(()=>{i===!1&&p.current.isPositioned&&(p.current.isPositioned=!1,u(T=>({...T,isPositioned:!1})))},[i]);const O=m.useRef(!1);tp(()=>(O.current=!0,()=>{O.current=!1}),[]),tp(()=>{if(v&&k){if(g.current)return g.current(v,k,C);C()}},[v,k,C,g]);const M=m.useMemo(()=>({reference:f,floating:h,setReference:j,setFloating:S}),[j,S]),A=m.useMemo(()=>({reference:v,floating:k}),[v,k]);return m.useMemo(()=>({...s,update:C,refs:M,elements:A,reference:j,floating:S}),[s,C,M,A,j,S])}var ff=typeof document<"u"?m.useLayoutEffect:m.useEffect;let mk=!1,_de=0;const x7=()=>"floating-ui-"+_de++;function Ide(){const[e,t]=m.useState(()=>mk?x7():void 0);return ff(()=>{e==null&&t(x7())},[]),m.useEffect(()=>{mk||(mk=!0)},[]),e}const Dde=m.useId,k7=Dde||Ide;function Lde(){const e=new Map;return{emit(t,r){var n;(n=e.get(t))==null||n.forEach(o=>o(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){e.set(t,(e.get(t)||[]).filter(n=>n!==r))}}}const Rde=m.createContext(null),Fde=m.createContext(null),pD=()=>{var e;return((e=m.useContext(Rde))==null?void 0:e.id)||null},hN=()=>m.useContext(Fde);function Yi(e){return e?.ownerDocument||document}function $de(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Bde(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:r,version:n}=t;return r+"/"+n}).join(" "):navigator.userAgent}function gN(e){return Yi(e).defaultView||window}function ma(e){return e?e instanceof gN(e).Element:!1}function hD(e){return e?e instanceof gN(e).HTMLElement:!1}function zde(e){if(typeof ShadowRoot>"u")return!1;const t=gN(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Hde(e){if(e.mozInputSource===0&&e.isTrusted)return!0;const t=/Android/i;return(t.test($de())||t.test(Bde()))&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function qde(e){return e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType!=="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function gD(e,t){const r=["mouse","pen"];return r.push("",void 0),r.includes(e)}function w7(e){const t=m.useRef(e);return ff(()=>{t.current=e}),t}const j7="data-floating-ui-safe-polygon";function pk(e,t,r){return r&&!gD(r)?0:typeof e=="number"?e:e?.[t]}const Ude=function(e,t){let{enabled:r=!0,delay:n=0,handleClose:o=null,mouseOnly:a=!1,restMs:i=0,move:s=!0}=t===void 0?{}:t;const{open:u,onOpenChange:c,dataRef:d,events:f,elements:{domReference:h,floating:p},refs:g}=e,b=hN(),v=pD(),x=w7(o),k=w7(n),E=m.useRef(),j=m.useRef(),S=m.useRef(),C=m.useRef(),O=m.useRef(!0),M=m.useRef(!1),A=m.useRef(()=>{}),T=m.useCallback(()=>{var I;const R=(I=d.current.openEvent)==null?void 0:I.type;return R?.includes("mouse")&&R!=="mousedown"},[d]);m.useEffect(()=>{if(!r)return;function I(){clearTimeout(j.current),clearTimeout(C.current),O.current=!0}return f.on("dismiss",I),()=>{f.off("dismiss",I)}},[r,f]),m.useEffect(()=>{if(!r||!x.current||!u)return;function I(){T()&&c(!1)}const R=Yi(p).documentElement;return R.addEventListener("mouseleave",I),()=>{R.removeEventListener("mouseleave",I)}},[p,u,c,r,x,d,T]);const _=m.useCallback(function(I){I===void 0&&(I=!0);const R=pk(k.current,"close",E.current);R&&!S.current?(clearTimeout(j.current),j.current=setTimeout(()=>c(!1),R)):I&&(clearTimeout(j.current),c(!1))},[k,c]),F=m.useCallback(()=>{A.current(),S.current=void 0},[]),$=m.useCallback(()=>{if(M.current){const I=Yi(g.floating.current).body;I.style.pointerEvents="",I.removeAttribute(j7),M.current=!1}},[g]);return m.useEffect(()=>{if(!r)return;function I(){return d.current.openEvent?["click","mousedown"].includes(d.current.openEvent.type):!1}function R(L){if(clearTimeout(j.current),O.current=!1,a&&!gD(E.current)||i>0&&pk(k.current,"open")===0)return;d.current.openEvent=L;const q=pk(k.current,"open",E.current);q?j.current=setTimeout(()=>{c(!0)},q):c(!0)}function W(L){if(I())return;A.current();const q=Yi(p);if(clearTimeout(C.current),x.current){u||clearTimeout(j.current),S.current=x.current({...e,tree:b,x:L.clientX,y:L.clientY,onClose(){$(),F(),_()}});const U=S.current;q.addEventListener("mousemove",U),A.current=()=>{q.removeEventListener("mousemove",U)};return}_()}function B(L){I()||x.current==null||x.current({...e,tree:b,x:L.clientX,y:L.clientY,onClose(){$(),F(),_()}})(L)}if(ma(h)){const L=h;return u&&L.addEventListener("mouseleave",B),p?.addEventListener("mouseleave",B),s&&L.addEventListener("mousemove",R,{once:!0}),L.addEventListener("mouseenter",R),L.addEventListener("mouseleave",W),()=>{u&&L.removeEventListener("mouseleave",B),p?.removeEventListener("mouseleave",B),s&&L.removeEventListener("mousemove",R),L.removeEventListener("mouseenter",R),L.removeEventListener("mouseleave",W)}}},[h,p,r,e,a,i,s,_,F,$,c,u,b,k,x,d]),ff(()=>{var I;if(r&&u&&(I=x.current)!=null&&I.__options.blockPointerEvents&&T()){const B=Yi(p).body;if(B.setAttribute(j7,""),B.style.pointerEvents="none",M.current=!0,ma(h)&&p){var R,W;const L=h,q=b==null||(R=b.nodesRef.current.find(U=>U.id===v))==null||(W=R.context)==null?void 0:W.elements.floating;return q&&(q.style.pointerEvents=""),L.style.pointerEvents="auto",p.style.pointerEvents="auto",()=>{L.style.pointerEvents="",p.style.pointerEvents=""}}}},[r,u,v,p,h,b,x,d,T]),ff(()=>{u||(E.current=void 0,F(),$())},[u,F,$]),m.useEffect(()=>()=>{F(),clearTimeout(j.current),clearTimeout(C.current),$()},[r,F,$]),m.useMemo(()=>{if(!r)return{};function I(R){E.current=R.pointerType}return{reference:{onPointerDown:I,onPointerEnter:I,onMouseMove(){u||i===0||(clearTimeout(C.current),C.current=setTimeout(()=>{O.current||c(!0)},i))}},floating:{onMouseEnter(){clearTimeout(j.current)},onMouseLeave(){f.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),_(!1)}}}},[f,r,i,u,c,_])};function Vde(e){let t=e.activeElement;for(;((r=t)==null||(n=r.shadowRoot)==null?void 0:n.activeElement)!=null;){var r,n;t=t.shadowRoot.activeElement}return t}function E7(e,t){if(!e||!t)return!1;const r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&zde(r)){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}return!1}function hk(e,t){let r=e.filter(o=>{var a;return o.parentId===t&&((a=o.context)==null?void 0:a.open)})||[],n=r;for(;n.length;)n=e.filter(o=>{var a;return(a=n)==null?void 0:a.some(i=>{var s;return o.parentId===i.id&&((s=o.context)==null?void 0:s.open)})})||[],r=r.concat(n);return r}function Wde(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Kde=m.useInsertionEffect,Yde=Kde||(e=>e());function bD(e){const t=m.useRef(()=>{});return Yde(()=>{t.current=e}),m.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function rp(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const r=e;return r.target!=null&&t.contains(r.target)}const Gde={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Xde={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Zde=function(e){var t,r;return e===void 0&&(e=!0),{escapeKeyBubbles:typeof e=="boolean"?e:(t=e.escapeKey)!=null?t:!0,outsidePressBubbles:typeof e=="boolean"?e:(r=e.outsidePress)!=null?r:!0}},Jde=function(e,t){let{open:r,onOpenChange:n,events:o,nodeId:a,elements:{reference:i,domReference:s,floating:u},dataRef:c}=e,{enabled:d=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:p="pointerdown",referencePress:g=!1,referencePressEvent:b="pointerdown",ancestorScroll:v=!1,bubbles:x=!0}={};const k=hN(),E=pD()!=null,j=bD(typeof h=="function"?h:()=>!1),S=typeof h=="function"?j:h,C=m.useRef(!1),{escapeKeyBubbles:O,outsidePressBubbles:M}=Zde(x);return m.useEffect(()=>{if(!r||!d)return;c.current.__escapeKeyBubbles=O,c.current.__outsidePressBubbles=M;function A(I){if(I.key==="Escape"){const R=k?hk(k.nodesRef.current,a):[];if(R.length>0){let W=!0;if(R.forEach(B=>{var L;if((L=B.context)!=null&&L.open&&!B.context.dataRef.current.__escapeKeyBubbles){W=!1;return}}),!W)return}o.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),n(!1)}}function T(I){const R=C.current;if(C.current=!1,R||typeof S=="function"&&!S(I))return;const W=Wde(I);if(hD(W)&&u){const q=u.ownerDocument.defaultView||window,U=W.scrollWidth>W.clientWidth,H=W.scrollHeight>W.clientHeight;let X=H&&I.offsetX>W.clientWidth;if(H&&q.getComputedStyle(W).direction==="rtl"&&(X=I.offsetX<=W.offsetWidth-W.clientWidth),X||U&&I.offsetY>W.clientHeight)return}const B=k&&hk(k.nodesRef.current,a).some(q=>{var U;return rp(I,(U=q.context)==null?void 0:U.elements.floating)});if(rp(I,u)||rp(I,s)||B)return;const L=k?hk(k.nodesRef.current,a):[];if(L.length>0){let q=!0;if(L.forEach(U=>{var H;if((H=U.context)!=null&&H.open&&!U.context.dataRef.current.__outsidePressBubbles){q=!1;return}}),!q)return}o.emit("dismiss",{type:"outsidePress",data:{returnFocus:E?{preventScroll:!0}:Hde(I)||qde(I)}}),n(!1)}function _(){n(!1)}const F=Yi(u);f&&F.addEventListener("keydown",A),S&&F.addEventListener(p,T);let $=[];return v&&(ma(s)&&($=Ji(s)),ma(u)&&($=$.concat(Ji(u))),!ma(i)&&i&&i.contextElement&&($=$.concat(Ji(i.contextElement)))),$=$.filter(I=>{var R;return I!==((R=F.defaultView)==null?void 0:R.visualViewport)}),$.forEach(I=>{I.addEventListener("scroll",_,{passive:!0})}),()=>{f&&F.removeEventListener("keydown",A),S&&F.removeEventListener(p,T),$.forEach(I=>{I.removeEventListener("scroll",_)})}},[c,u,s,i,f,S,p,o,k,a,r,n,v,d,O,M,E]),m.useEffect(()=>{C.current=!1},[S,p]),m.useMemo(()=>d?{reference:{[Gde[b]]:()=>{g&&(o.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),n(!1))}},floating:{[Xde[p]]:()=>{C.current=!0}}}:{},[d,o,g,p,b,n])},Qde=function(e,t){let{open:r,onOpenChange:n,dataRef:o,events:a,refs:i,elements:{floating:s,domReference:u}}=e,{enabled:c=!0,keyboardOnly:d=!0}={};const f=m.useRef(""),h=m.useRef(!1),p=m.useRef();return m.useEffect(()=>{if(!c)return;const g=Yi(s).defaultView||window;function b(){!r&&hD(u)&&u===Vde(Yi(u))&&(h.current=!0)}return g.addEventListener("blur",b),()=>{g.removeEventListener("blur",b)}},[s,u,r,c]),m.useEffect(()=>{if(!c)return;function g(b){(b.type==="referencePress"||b.type==="escapeKey")&&(h.current=!0)}return a.on("dismiss",g),()=>{a.off("dismiss",g)}},[a,c]),m.useEffect(()=>()=>{clearTimeout(p.current)},[]),m.useMemo(()=>c?{reference:{onPointerDown(g){let{pointerType:b}=g;f.current=b,h.current=!!(b&&d)},onMouseLeave(){h.current=!1},onFocus(g){var b;h.current||g.type==="focus"&&((b=o.current.openEvent)==null?void 0:b.type)==="mousedown"&&o.current.openEvent&&rp(o.current.openEvent,u)||(o.current.openEvent=g.nativeEvent,n(!0))},onBlur(g){h.current=!1;const b=g.relatedTarget,v=ma(b)&&b.hasAttribute("data-floating-ui-focus-guard")&&b.getAttribute("data-type")==="outside";p.current=setTimeout(()=>{E7(i.floating.current,b)||E7(u,b)||v||n(!1)})}}}:{},[c,d,u,i,o,n])},efe=function(e,t){let{open:r}=e,{enabled:n=!0,role:o="dialog"}=t===void 0?{}:t;const a=k7(),i=k7();return m.useMemo(()=>{const s={id:a,role:o};return n?o==="tooltip"?{reference:{"aria-describedby":r?a:void 0},floating:s}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":o==="alertdialog"?"dialog":o,"aria-controls":r?a:void 0,...o==="listbox"&&{role:"combobox"},...o==="menu"&&{id:i}},floating:{...s,...o==="menu"&&{"aria-labelledby":i}}}:{}},[n,o,r,a,i])};function tfe(e){e===void 0&&(e={});const{open:t=!1,onOpenChange:r,nodeId:n}=e,o=Mde(e),a=hN(),i=m.useRef(null),s=m.useRef({}),u=m.useState(()=>Lde())[0],[c,d]=m.useState(null),f=m.useCallback(x=>{const k=ma(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),contextElement:x}:x;o.refs.setReference(k)},[o.refs]),h=m.useCallback(x=>{(ma(x)||x===null)&&(i.current=x,d(x)),(ma(o.refs.reference.current)||o.refs.reference.current===null||x!==null&&!ma(x))&&o.refs.setReference(x)},[o.refs]),p=m.useMemo(()=>({...o.refs,setReference:h,setPositionReference:f,domReference:i}),[o.refs,h,f]),g=m.useMemo(()=>({...o.elements,domReference:c}),[o.elements,c]),b=bD(r),v=m.useMemo(()=>({...o,refs:p,elements:g,dataRef:s,nodeId:n,events:u,open:t,onOpenChange:b}),[o,n,u,t,b,p,g]);return ff(()=>{const x=a?.nodesRef.current.find(k=>k.id===n);x&&(x.context=v)}),m.useMemo(()=>({...o,context:v,refs:p,reference:h,positionReference:f}),[o,p,v,h,f])}function gk(e,t,r){const n=new Map;return{...r==="floating"&&{tabIndex:-1},...e,...t.map(o=>o?o[r]:null).concat(e).reduce((o,a)=>(a&&Object.entries(a).forEach(i=>{let[s,u]=i;if(s.indexOf("on")===0){if(n.has(s)||n.set(s,[]),typeof u=="function"){var c;(c=n.get(s))==null||c.push(u),o[s]=function(){for(var d,f=arguments.length,h=new Array(f),p=0;p<f;p++)h[p]=arguments[p];(d=n.get(s))==null||d.forEach(g=>g(...h))}}}else o[s]=u}),o),{})}}const rfe=function(e){e===void 0&&(e=[]);const t=e,r=m.useCallback(a=>gk(a,e,"reference"),t),n=m.useCallback(a=>gk(a,e,"floating"),t),o=m.useCallback(a=>gk(a,e,"item"),e.map(a=>a?.item));return m.useMemo(()=>({getReferenceProps:r,getFloatingProps:n,getItemProps:o}),[r,n,o])},zo=e=>{const[t,r]=m.useState(!1),[n,o]=m.useState(),{x:a,y:i,refs:s,strategy:u,context:c}=tfe({open:t,onOpenChange:v=>{if(v&&e){const x=setTimeout(()=>{r(v)},e);o(x)}else clearTimeout(n),r(v)},placement:"top",whileElementsMounted:Kh,middleware:[Ij(5),Lj({fallbackAxisSideDirection:"start"}),Dj()]}),d=Ude(c,{move:!1}),f=Qde(c),h=Jde(c),p=efe(c,{role:"tooltip"}),{getReferenceProps:g,getFloatingProps:b}=rfe([d,f,h,p]);return{tooltipProps:{open:t,x:a,y:i,refs:s,strategy:u,getFloatingProps:b},getReferenceProps:g}},Po=({text:e,open:t,x:r,y:n,refs:o,strategy:a,getFloatingProps:i})=>t&&e?y.createElement("div",Object.assign({className:Z("max-w-xs text-sm z-20 rounded-tremor-default opacity-100 px-2.5 py-1","text-white bg-tremor-background-emphasis","dark:text-tremor-content-emphasis dark:bg-white"),ref:o.setFloating,style:{position:a,top:n??0,left:r??0}},i()),e):null;Po.displayName="Tooltip";const bk={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},N7={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},vk=xt("Badge"),Ht=y.forwardRef((e,t)=>{const{color:r,icon:n,size:o=Kg.SM,tooltip:a,className:i,children:s}=e,u=Re(e,["color","icon","size","tooltip","className","children"]),c=n||null,{tooltipProps:d,getReferenceProps:f}=zo();return y.createElement("span",Object.assign({ref:ji([t,d.refs.setReference]),className:Z(vk("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",r?Z(Fe(r,He.background).bgColor,Fe(r,He.iconText).textColor,Fe(r,He.iconRing).ringColor,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60"):Z("bg-tremor-brand-faint text-tremor-brand-emphasis ring-tremor-brand/20","dark:bg-dark-tremor-brand-muted/50 dark:text-dark-tremor-brand dark:ring-dark-tremor-subtle/20"),bk[o].paddingX,bk[o].paddingY,bk[o].fontSize,i)},f,u),y.createElement(Po,Object.assign({text:a},d)),c?y.createElement(c,{className:Z(vk("icon"),"shrink-0 -ml-1 mr-1.5",N7[o].height,N7[o].width)}):null,y.createElement("span",{className:Z(vk("text"),"whitespace-nowrap")},s))});Ht.displayName="Badge";const nfe=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M13.0001 16.1716L18.3641 10.8076L19.7783 12.2218L12.0001 20L4.22192 12.2218L5.63614 10.8076L11.0001 16.1716V4H13.0001V16.1716Z"}))},ofe=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M14.5895 16.0032L5.98291 7.39664L7.39712 5.98242L16.0037 14.589V7.00324H18.0037V18.0032H7.00373V16.0032H14.5895Z"}))},afe=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M13.0001 7.82843V20H11.0001V7.82843L5.63614 13.1924L4.22192 11.7782L12.0001 4L19.7783 11.7782L18.3641 13.1924L13.0001 7.82843Z"}))},ife=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z"}))},sfe={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-1",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-1.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-lg"},xl:{paddingX:"px-3.5",paddingY:"py-1.5",fontSize:"text-xl"}},lfe={xs:{paddingX:"px-2",paddingY:"py-0.5",fontSize:"text-xs"},sm:{paddingX:"px-2.5",paddingY:"py-0.5",fontSize:"text-sm"},md:{paddingX:"px-3",paddingY:"py-0.5",fontSize:"text-md"},lg:{paddingX:"px-3.5",paddingY:"py-0.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-1",fontSize:"text-xl"}},S7={xs:{height:"h-4",width:"w-4"},sm:{height:"h-4",width:"w-4"},md:{height:"h-4",width:"w-4"},lg:{height:"h-5",width:"w-5"},xl:{height:"h-6",width:"w-6"}},yk={[Ar.Increase]:{bgColor:Fe(et.Emerald,He.background).bgColor,textColor:Fe(et.Emerald,He.iconText).textColor,ringColor:Fe(et.Emerald,He.iconRing).ringColor},[Ar.ModerateIncrease]:{bgColor:Fe(et.Emerald,He.background).bgColor,textColor:Fe(et.Emerald,He.iconText).textColor,ringColor:Fe(et.Emerald,He.iconRing).ringColor},[Ar.Decrease]:{bgColor:Fe(et.Red,He.background).bgColor,textColor:Fe(et.Red,He.iconText).textColor,ringColor:Fe(et.Red,He.iconRing).ringColor},[Ar.ModerateDecrease]:{bgColor:Fe(et.Red,He.background).bgColor,textColor:Fe(et.Red,He.iconText).textColor,ringColor:Fe(et.Red,He.iconRing).ringColor},[Ar.Unchanged]:{bgColor:Fe(et.Orange,He.background).bgColor,textColor:Fe(et.Orange,He.iconText).textColor,ringColor:Fe(et.Orange,He.iconRing).ringColor}},ufe={[Ar.Increase]:afe,[Ar.ModerateIncrease]:ife,[Ar.Decrease]:nfe,[Ar.ModerateDecrease]:ofe,[Ar.Unchanged]:mD},xk=xt("BadgeDelta"),cfe=y.forwardRef((e,t)=>{const{deltaType:r=Ar.Increase,isIncreasePositive:n=!0,size:o=Kg.SM,tooltip:a,children:i,className:s}=e,u=Re(e,["deltaType","isIncreasePositive","size","tooltip","children","className"]),c=ufe[r],d=uD(r,n),f=i?lfe:sfe,{tooltipProps:h,getReferenceProps:p}=zo();return y.createElement("span",Object.assign({ref:ji([t,h.refs.setReference]),className:Z(xk("root"),"w-max shrink-0 inline-flex justify-center items-center cursor-default rounded-tremor-small ring-1 ring-inset",yk[d].bgColor,yk[d].textColor,yk[d].ringColor,f[o].paddingX,f[o].paddingY,f[o].fontSize,"bg-opacity-10 ring-opacity-20","dark:bg-opacity-5 dark:ring-opacity-60",s)},p,u),y.createElement(Po,Object.assign({text:a},h)),y.createElement(c,{className:Z(xk("icon"),"shrink-0",i?Z("-ml-1 mr-1.5"):S7[o].height,S7[o].width)}),i?y.createElement("span",{className:Z(xk("text"),"whitespace-nowrap")},i):null)});cfe.displayName="BadgeDelta";const O7={xs:{paddingX:"px-1.5",paddingY:"py-1.5"},sm:{paddingX:"px-1.5",paddingY:"py-1.5"},md:{paddingX:"px-2",paddingY:"py-2"},lg:{paddingX:"px-2",paddingY:"py-2"},xl:{paddingX:"px-2.5",paddingY:"py-2.5"}},C7={xs:{height:"h-3",width:"w-3"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-7",width:"w-7"},xl:{height:"h-9",width:"w-9"}},Rm={simple:{rounded:"",border:"",ring:"",shadow:""},light:{rounded:"rounded-tremor-default",border:"",ring:"",shadow:""},shadow:{rounded:"rounded-tremor-default",border:"border",ring:"",shadow:"shadow-tremor-card dark:shadow-dark-tremor-card"},solid:{rounded:"rounded-tremor-default",border:"border-2",ring:"ring-1",shadow:""},outlined:{rounded:"rounded-tremor-default",border:"border",ring:"ring-2",shadow:""}},dfe=(e,t)=>{switch(e){case"simple":return{textColor:t?Fe(t,He.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:"",borderColor:"",ringColor:""};case"light":return{textColor:t?Fe(t,He.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?Z(Fe(t,He.background).bgColor,"bg-opacity-20"):"bg-tremor-brand-muted dark:bg-dark-tremor-brand-muted",borderColor:"",ringColor:""};case"shadow":return{textColor:t?Fe(t,He.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?Z(Fe(t,He.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:"border-tremor-border dark:border-dark-tremor-border",ringColor:""};case"solid":return{textColor:t?Fe(t,He.text).textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?Z(Fe(t,He.background).bgColor,"bg-opacity-20"):"bg-tremor-brand dark:bg-dark-tremor-brand",borderColor:"border-tremor-brand-inverted dark:border-dark-tremor-brand-inverted",ringColor:"ring-tremor-ring dark:ring-dark-tremor-ring"};case"outlined":return{textColor:t?Fe(t,He.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",bgColor:t?Z(Fe(t,He.background).bgColor,"bg-opacity-20"):"bg-tremor-background dark:bg-dark-tremor-background",borderColor:t?Fe(t,He.ring).borderColor:"border-tremor-brand-subtle dark:border-dark-tremor-brand-subtle",ringColor:t?Z(Fe(t,He.ring).ringColor,"ring-opacity-40"):"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}}},P7=xt("Icon"),ffe={Simple:"simple"},vD=y.forwardRef((e,t)=>{const{icon:r,variant:n=ffe.Simple,tooltip:o,size:a=Kg.SM,color:i,className:s}=e,u=Re(e,["icon","variant","tooltip","size","color","className"]),c=r,d=dfe(n,i),{tooltipProps:f,getReferenceProps:h}=zo();return y.createElement("span",Object.assign({ref:ji([t,f.refs.setReference]),className:Z(P7("root"),"inline-flex shrink-0 items-center justify-center",d.bgColor,d.textColor,d.borderColor,d.ringColor,Rm[n].rounded,Rm[n].border,Rm[n].shadow,Rm[n].ring,O7[a].paddingX,O7[a].paddingY,s)},h,u),y.createElement(Po,Object.assign({text:o},f)),y.createElement(c,{className:Z(P7("icon"),"shrink-0",C7[a].height,C7[a].width)}))});vD.displayName="Icon";const W2=0,K2=1,jh=2,Eh=3,Nh=4,mfe=5,yD=6,pfe=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],xD=e=>({_s:e,status:pfe[e],isEnter:e<Eh,isMounted:e!==yD,isResolved:e===jh||e>Nh}),Y2=e=>e?yD:mfe,hfe=(e,t)=>{switch(e){case K2:case W2:return jh;case Nh:case Eh:return Y2(t)}},gfe=e=>typeof e=="object"?[e.enter,e.exit]:[e,e],bfe=(e,t)=>setTimeout(()=>{isNaN(document.body.offsetTop)||e(t+1)},0),A7=(e,t,r,n,o)=>{clearTimeout(n.current);const a=xD(e);t(a),r.current=a,o&&o({current:a})},vfe=({enter:e=!0,exit:t=!0,preEnter:r,preExit:n,timeout:o,initialEntered:a,mountOnEnter:i,unmountOnExit:s,onStateChange:u}={})=>{const[c,d]=m.useState(()=>xD(a?jh:Y2(i))),f=m.useRef(c),h=m.useRef(),[p,g]=gfe(o),b=m.useCallback(()=>{const x=hfe(f.current._s,s);x&&A7(x,d,f,h,u)},[u,s]),v=m.useCallback(x=>{const k=j=>{switch(A7(j,d,f,h,u),j){case K2:p>=0&&(h.current=setTimeout(b,p));break;case Nh:g>=0&&(h.current=setTimeout(b,g));break;case W2:case Eh:h.current=bfe(k,j);break}},E=f.current.isEnter;typeof x!="boolean"&&(x=!E),x?!E&&k(e?r?W2:K2:jh):E&&k(t?n?Eh:Nh:Y2(s))},[b,u,e,t,r,n,p,g,s]);return[c,v,b]},yfe=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"}),y.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),y.createElement("path",{d:"M18.364 5.636L16.95 7.05A7 7 0 1 0 19 12h2a9 9 0 1 1-2.636-6.364z"}))},T7={xs:{height:"h-4",width:"w-4"},sm:{height:"h-5",width:"w-5"},md:{height:"h-5",width:"w-5"},lg:{height:"h-6",width:"w-6"},xl:{height:"h-6",width:"w-6"}},xfe=e=>e!=="light"?{xs:{paddingX:"px-2.5",paddingY:"py-1.5",fontSize:"text-xs"},sm:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-sm"},md:{paddingX:"px-4",paddingY:"py-2",fontSize:"text-md"},lg:{paddingX:"px-4",paddingY:"py-2.5",fontSize:"text-lg"},xl:{paddingX:"px-4",paddingY:"py-3",fontSize:"text-xl"}}:{xs:{paddingX:"",paddingY:"",fontSize:"text-xs"},sm:{paddingX:"",paddingY:"",fontSize:"text-sm"},md:{paddingX:"",paddingY:"",fontSize:"text-md"},lg:{paddingX:"",paddingY:"",fontSize:"text-lg"},xl:{paddingX:"",paddingY:"",fontSize:"text-xl"}},Fm=(e,t)=>{switch(e){case"primary":return{textColor:t?Fe("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",hoverTextColor:t?Fe("white").textColor:"text-tremor-brand-inverted dark:text-dark-tremor-brand-inverted",bgColor:t?Fe(t,He.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",hoverBgColor:t?Fe(t,He.darkBackground).hoverBgColor:"hover:bg-tremor-brand-emphasis dark:hover:bg-dark-tremor-brand-emphasis",borderColor:t?Fe(t,He.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",hoverBorderColor:t?Fe(t,He.darkBorder).hoverBorderColor:"hover:border-tremor-brand-emphasis dark:hover:border-dark-tremor-brand-emphasis"};case"secondary":return{textColor:t?Fe(t,He.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?Fe(t,He.text).textColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:Fe("transparent").bgColor,hoverBgColor:t?Z(Fe(t,He.background).hoverBgColor,"hover:bg-opacity-20 dark:hover:bg-opacity-20"):"hover:bg-tremor-brand-faint dark:hover:bg-dark-tremor-brand-faint",borderColor:t?Fe(t,He.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand"};case"light":return{textColor:t?Fe(t,He.text).textColor:"text-tremor-brand dark:text-dark-tremor-brand",hoverTextColor:t?Fe(t,He.darkText).hoverTextColor:"hover:text-tremor-brand-emphasis dark:hover:text-dark-tremor-brand-emphasis",bgColor:Fe("transparent").bgColor,borderColor:"",hoverBorderColor:""}}},Sh=xt("Button"),M7=({loading:e,iconSize:t,iconPosition:r,Icon:n,needMargin:o,transitionStatus:a})=>{const i=o?r===lu.Left?Z("-ml-1","mr-1.5"):Z("-mr-1","ml-1.5"):"",s=Z("w-0 h-0"),u={default:s,entering:s,entered:t,exiting:t,exited:s};return e?y.createElement(yfe,{className:Z(Sh("icon"),"animate-spin shrink-0",i,u.default,u[a]),style:{transition:"width 150ms"}}):y.createElement(n,{className:Z(Sh("icon"),"shrink-0",t,i)})},du=y.forwardRef((e,t)=>{const{icon:r,iconPosition:n=lu.Left,size:o=Kg.SM,color:a,variant:i="primary",disabled:s,loading:u=!1,loadingText:c,children:d,tooltip:f,className:h}=e,p=Re(e,["icon","iconPosition","size","color","variant","disabled","loading","loadingText","children","tooltip","className"]),g=r,b=u||s,v=g!==void 0||u,x=u&&c,k=!(!d&&!x),E=Z(T7[o].height,T7[o].width),j=i!=="light"?Z("rounded-tremor-default border","shadow-tremor-input","dark:shadow-dark-tremor-input"):"",S=Fm(i,a),C=xfe(i)[o],{tooltipProps:O,getReferenceProps:M}=zo(300),[A,T]=vfe({timeout:50});return m.useEffect(()=>{T(u)},[u]),y.createElement("button",Object.assign({ref:ji([t,O.refs.setReference]),className:Z(Sh("root"),"shrink-0 inline-flex justify-center items-center group font-medium outline-none",j,C.paddingX,C.paddingY,C.fontSize,S.textColor,S.bgColor,S.borderColor,S.hoverBorderColor,b?"opacity-50 cursor-not-allowed":Z(Fm(i,a).hoverTextColor,Fm(i,a).hoverBgColor,Fm(i,a).hoverBorderColor),h),disabled:b},M,p),y.createElement(Po,Object.assign({text:f},O)),v&&n!==lu.Right?y.createElement(M7,{loading:u,iconSize:E,iconPosition:n,Icon:g,transitionStatus:A.status,needMargin:k}):null,x||d?y.createElement("span",{className:Z(Sh("text"),"text-tremor-default whitespace-nowrap")},x?c:d):null,v&&n===lu.Right?y.createElement(M7,{loading:u,iconSize:E,iconPosition:n,Icon:g,transitionStatus:A.status,needMargin:k}):null)});du.displayName="Button";function Qt(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 lo(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Wn(e,t){const r=Qt(e);return isNaN(t)?lo(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Ho(e,t){const r=Qt(e);if(isNaN(t))return lo(e,NaN);if(!t)return r;const n=r.getDate(),o=lo(e,r.getTime());o.setMonth(r.getMonth()+t+1,0);const a=o.getDate();return n>=a?o:(r.setFullYear(o.getFullYear(),o.getMonth(),n),r)}const bN=6048e5,kfe=864e5;let wfe={};function zf(){return wfe}function Aa(e,t){var r,n,o,a;const i=zf(),s=t?.weekStartsOn??((n=(r=t?.locale)==null?void 0:r.options)==null?void 0:n.weekStartsOn)??i.weekStartsOn??((a=(o=i.locale)==null?void 0:o.options)==null?void 0:a.weekStartsOn)??0,u=Qt(e),c=u.getDay(),d=(c<s?7:0)+c-s;return u.setDate(u.getDate()-d),u.setHours(0,0,0,0),u}function hl(e){return Aa(e,{weekStartsOn:1})}function kD(e){const t=Qt(e),r=t.getFullYear(),n=lo(e,0);n.setFullYear(r+1,0,4),n.setHours(0,0,0,0);const o=hl(n),a=lo(e,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const i=hl(a);return t.getTime()>=o.getTime()?r+1:t.getTime()>=i.getTime()?r:r-1}function Ta(e){const t=Qt(e);return t.setHours(0,0,0,0),t}function Oh(e){const t=Qt(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function pa(e,t){const r=Ta(e),n=Ta(t),o=+r-Oh(r),a=+n-Oh(n);return Math.round((o-a)/kfe)}function jfe(e){const t=kD(e),r=lo(e,0);return r.setFullYear(t,0,4),r.setHours(0,0,0,0),hl(r)}function G2(e,t){const r=t*7;return Wn(e,r)}function X2(e,t){return Ho(e,t*12)}function wD(e){let t;return e.forEach(function(r){const n=Qt(r);(t===void 0||t<n||isNaN(Number(n)))&&(t=n)}),t||new Date(NaN)}function jD(e){let t;return e.forEach(r=>{const n=Qt(r);(!t||t>n||isNaN(+n))&&(t=n)}),t||new Date(NaN)}function oo(e,t){const r=Ta(e),n=Ta(t);return+r==+n}function vN(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Efe(e){if(!vN(e)&&typeof e!="number")return!1;const t=Qt(e);return!isNaN(Number(t))}function mf(e,t){const r=Qt(e),n=Qt(t),o=r.getFullYear()-n.getFullYear(),a=r.getMonth()-n.getMonth();return o*12+a}function Nfe(e,t,r){const n=Aa(e,r),o=Aa(t,r),a=+n-Oh(n),i=+o-Oh(o);return Math.round((a-i)/bN)}function yN(e){const t=Qt(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(23,59,59,999),t}function Mn(e){const t=Qt(e);return t.setDate(1),t.setHours(0,0,0,0),t}function xN(e){const t=Qt(e),r=lo(e,0);return r.setFullYear(t.getFullYear(),0,1),r.setHours(0,0,0,0),r}function kN(e,t){var r,n,o,a;const i=zf(),s=t?.weekStartsOn??((n=(r=t?.locale)==null?void 0:r.options)==null?void 0:n.weekStartsOn)??i.weekStartsOn??((a=(o=i.locale)==null?void 0:o.options)==null?void 0:a.weekStartsOn)??0,u=Qt(e),c=u.getDay(),d=(c<s?-7:0)+6-(c-s);return u.setDate(u.getDate()+d),u.setHours(23,59,59,999),u}function ED(e){return kN(e,{weekStartsOn:1})}const Sfe={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"}},Ofe=(e,t,r)=>{let n;const o=Sfe[e];return typeof o=="string"?n=o:t===1?n=o.one:n=o.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function kk(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const Cfe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Pfe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Afe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Tfe={date:kk({formats:Cfe,defaultWidth:"full"}),time:kk({formats:Pfe,defaultWidth:"full"}),dateTime:kk({formats:Afe,defaultWidth:"full"})},Mfe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},_fe=(e,t,r,n)=>Mfe[e];function Vc(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let o;if(n==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,s=r!=null&&r.width?String(r.width):i;o=e.formattingValues[s]||e.formattingValues[i]}else{const i=e.defaultWidth,s=r!=null&&r.width?String(r.width):e.defaultWidth;o=e.values[s]||e.values[i]}const a=e.argumentCallback?e.argumentCallback(t):t;return o[a]}}const Ife={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Dfe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Lfe={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"]},Rfe={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"]},Ffe={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"}},$fe={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"}},Bfe=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},zfe={ordinalNumber:Bfe,era:Vc({values:Ife,defaultWidth:"wide"}),quarter:Vc({values:Dfe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Vc({values:Lfe,defaultWidth:"wide"}),day:Vc({values:Rfe,defaultWidth:"wide"}),dayPeriod:Vc({values:Ffe,defaultWidth:"wide",formattingValues:$fe,defaultFormattingWidth:"wide"})};function Wc(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const i=a[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(s)?qfe(s,f=>f.test(i)):Hfe(s,f=>f.test(i));let c;c=e.valueCallback?e.valueCallback(u):u,c=r.valueCallback?r.valueCallback(c):c;const d=t.slice(i.length);return{value:c,rest:d}}}function Hfe(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function qfe(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function Ufe(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const o=n[0],a=t.match(e.parsePattern);if(!a)return null;let i=e.valueCallback?e.valueCallback(a[0]):a[0];i=r.valueCallback?r.valueCallback(i):i;const s=t.slice(o.length);return{value:i,rest:s}}}const Vfe=/^(\d+)(th|st|nd|rd)?/i,Wfe=/\d+/i,Kfe={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},Yfe={any:[/^b/i,/^(a|c)/i]},Gfe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Xfe={any:[/1/i,/2/i,/3/i,/4/i]},Zfe={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},Jfe={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]},Qfe={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},eme={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]},tme={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},rme={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}},nme={ordinalNumber:Ufe({matchPattern:Vfe,parsePattern:Wfe,valueCallback:e=>parseInt(e,10)}),era:Wc({matchPatterns:Kfe,defaultMatchWidth:"wide",parsePatterns:Yfe,defaultParseWidth:"any"}),quarter:Wc({matchPatterns:Gfe,defaultMatchWidth:"wide",parsePatterns:Xfe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Wc({matchPatterns:Zfe,defaultMatchWidth:"wide",parsePatterns:Jfe,defaultParseWidth:"any"}),day:Wc({matchPatterns:Qfe,defaultMatchWidth:"wide",parsePatterns:eme,defaultParseWidth:"any"}),dayPeriod:Wc({matchPatterns:tme,defaultMatchWidth:"any",parsePatterns:rme,defaultParseWidth:"any"})},Gg={code:"en-US",formatDistance:Ofe,formatLong:Tfe,formatRelative:_fe,localize:zfe,match:nme,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ome(e){const t=Qt(e);return pa(t,xN(t))+1}function ND(e){const t=Qt(e),r=+hl(t)-+jfe(t);return Math.round(r/bN)+1}function SD(e,t){var r,n,o,a;const i=Qt(e),s=i.getFullYear(),u=zf(),c=t?.firstWeekContainsDate??((n=(r=t?.locale)==null?void 0:r.options)==null?void 0:n.firstWeekContainsDate)??u.firstWeekContainsDate??((a=(o=u.locale)==null?void 0:o.options)==null?void 0:a.firstWeekContainsDate)??1,d=lo(e,0);d.setFullYear(s+1,0,c),d.setHours(0,0,0,0);const f=Aa(d,t),h=lo(e,0);h.setFullYear(s,0,c),h.setHours(0,0,0,0);const p=Aa(h,t);return i.getTime()>=f.getTime()?s+1:i.getTime()>=p.getTime()?s:s-1}function ame(e,t){var r,n,o,a;const i=zf(),s=t?.firstWeekContainsDate??((n=(r=t?.locale)==null?void 0:r.options)==null?void 0:n.firstWeekContainsDate)??i.firstWeekContainsDate??((a=(o=i.locale)==null?void 0:o.options)==null?void 0:a.firstWeekContainsDate)??1,u=SD(e,t),c=lo(e,0);return c.setFullYear(u,0,s),c.setHours(0,0,0,0),Aa(c,t)}function OD(e,t){const r=Qt(e),n=+Aa(r,t)-+ame(r,t);return Math.round(n/bN)+1}function vr(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const Ii={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return vr(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):vr(r+1,2)},d(e,t){return vr(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return vr(e.getHours()%12||12,t.length)},H(e,t){return vr(e.getHours(),t.length)},m(e,t){return vr(e.getMinutes(),t.length)},s(e,t){return vr(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),o=Math.trunc(n*Math.pow(10,r-3));return vr(o,t.length)}},Ll={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},_7={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),o=n>0?n:1-n;return r.ordinalNumber(o,{unit:"year"})}return Ii.y(e,t)},Y:function(e,t,r,n){const o=SD(e,n),a=o>0?o:1-o;if(t==="YY"){const i=a%100;return vr(i,2)}return t==="Yo"?r.ordinalNumber(a,{unit:"year"}):vr(a,t.length)},R:function(e,t){const r=kD(e);return vr(r,t.length)},u:function(e,t){const r=e.getFullYear();return vr(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return vr(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return vr(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return Ii.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return vr(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const o=OD(e,n);return t==="wo"?r.ordinalNumber(o,{unit:"week"}):vr(o,t.length)},I:function(e,t,r){const n=ND(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):vr(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):Ii.d(e,t)},D:function(e,t,r){const n=ome(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):vr(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const o=e.getDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return vr(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const o=e.getDay(),a=(o-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return vr(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),o=n===0?7:n;switch(t){case"i":return String(o);case"ii":return vr(o,t.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let o;switch(n===12?o=Ll.noon:n===0?o=Ll.midnight:o=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let o;switch(n>=17?o=Ll.evening:n>=12?o=Ll.afternoon:n>=4?o=Ll.morning:o=Ll.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return Ii.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):Ii.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):vr(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):vr(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):Ii.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):Ii.s(e,t)},S:function(e,t){return Ii.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return D7(n);case"XXXX":case"XX":return Fs(n);case"XXXXX":case"XXX":default:return Fs(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return D7(n);case"xxxx":case"xx":return Fs(n);case"xxxxx":case"xxx":default:return Fs(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+I7(n,":");case"OOOO":default:return"GMT"+Fs(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+I7(n,":");case"zzzz":default:return"GMT"+Fs(n,":")}},t:function(e,t,r){const n=Math.trunc(e.getTime()/1e3);return vr(n,t.length)},T:function(e,t,r){const n=e.getTime();return vr(n,t.length)}};function I7(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=Math.trunc(n/60),a=n%60;return a===0?r+String(o):r+String(o)+t+vr(a,2)}function D7(e,t){return e%60===0?(e>0?"-":"+")+vr(Math.abs(e)/60,2):Fs(e,t)}function Fs(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),o=vr(Math.trunc(n/60),2),a=vr(n%60,2);return r+o+t+a}const L7=(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"})}},CD=(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"})}},ime=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],o=r[2];if(!o)return L7(e,t);let a;switch(n){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}}",L7(n,t)).replace("{{time}}",CD(o,t))},sme={p:CD,P:ime},lme=/^D+$/,ume=/^Y+$/,cme=["D","DD","YY","YYYY"];function dme(e){return lme.test(e)}function fme(e){return ume.test(e)}function mme(e,t,r){const n=pme(e,t,r);if(console.warn(n),cme.includes(e))throw new RangeError(n)}function pme(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const hme=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,gme=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,bme=/^'([^]*?)'?$/,vme=/''/g,yme=/[a-zA-Z]/;function ro(e,t,r){var n,o,a,i,s,u,c,d;const f=zf(),h=r?.locale??f.locale??Gg,p=r?.firstWeekContainsDate??((o=(n=r?.locale)==null?void 0:n.options)==null?void 0:o.firstWeekContainsDate)??f.firstWeekContainsDate??((i=(a=f.locale)==null?void 0:a.options)==null?void 0:i.firstWeekContainsDate)??1,g=r?.weekStartsOn??((u=(s=r?.locale)==null?void 0:s.options)==null?void 0:u.weekStartsOn)??f.weekStartsOn??((d=(c=f.locale)==null?void 0:c.options)==null?void 0:d.weekStartsOn)??0,b=Qt(e);if(!Efe(b))throw new RangeError("Invalid time value");let v=t.match(gme).map(k=>{const E=k[0];if(E==="p"||E==="P"){const j=sme[E];return j(k,h.formatLong)}return k}).join("").match(hme).map(k=>{if(k==="''")return{isToken:!1,value:"'"};const E=k[0];if(E==="'")return{isToken:!1,value:xme(k)};if(_7[E])return{isToken:!0,value:k};if(E.match(yme))throw new RangeError("Format string contains an unescaped latin alphabet character `"+E+"`");return{isToken:!1,value:k}});h.localize.preprocessor&&(v=h.localize.preprocessor(b,v));const x={firstWeekContainsDate:p,weekStartsOn:g,locale:h};return v.map(k=>{if(!k.isToken)return k.value;const E=k.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&fme(E)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&dme(E))&&mme(E,t,String(e));const j=_7[E[0]];return j(b,E,h.localize,x)}).join("")}function xme(e){const t=e.match(bme);return t?t[1].replace(vme,"'"):e}function kme(e){const t=Qt(e),r=t.getFullYear(),n=t.getMonth(),o=lo(e,0);return o.setFullYear(r,n+1,0),o.setHours(0,0,0,0),o.getDate()}function wme(e){return Math.trunc(+Qt(e)/1e3)}function jme(e){const t=Qt(e),r=t.getMonth();return t.setFullYear(t.getFullYear(),r+1,0),t.setHours(0,0,0,0),t}function Eme(e,t){return Nfe(jme(e),Mn(e),t)+1}function Z2(e,t){const r=Qt(e),n=Qt(t);return r.getTime()>n.getTime()}function PD(e,t){const r=Qt(e),n=Qt(t);return+r<+n}function Nme(e,t){const r=Qt(e),n=Qt(t);return+r==+n}function wN(e,t){const r=Qt(e),n=Qt(t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}function Sme(e,t){const r=Qt(e),n=Qt(t);return r.getFullYear()===n.getFullYear()}function np(e,t){return Wn(e,-t)}function wk(e,t){const r=Qt(e),n=r.getFullYear(),o=r.getDate(),a=lo(e,0);a.setFullYear(n,t,15),a.setHours(0,0,0,0);const i=kme(a);return r.setMonth(t,Math.min(o,i)),r}function R7(e,t){const r=Qt(e);return isNaN(+r)?lo(e,NaN):(r.setFullYear(t),r)}function qi(){return Ta(Date.now())}function Ome(e,t){return Ho(e,-t)}function F7(e,t){const{years:r=0,months:n=0,weeks:o=0,days:a=0,hours:i=0,minutes:s=0,seconds:u=0}=t,c=Ome(e,n+r*12),d=np(c,a+o*7),f=s+i*60,h=(u+f*60)*1e3;return lo(e,d.getTime()-h)}var Cme=Object.defineProperty,Pme=(e,t,r)=>t in e?Cme(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jk=(e,t,r)=>(Pme(e,typeof t!="symbol"?t+"":t,r),r);let Ame=class{constructor(){jk(this,"current",this.detect()),jk(this,"handoffState","pending"),jk(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},al=new Ame;function Fa(e){return al.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}function Hf(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function ra(){let e=[],t={addEventListener(r,n,o,a){return r.addEventListener(n,o,a),t.add(()=>r.removeEventListener(n,o,a))},requestAnimationFrame(...r){let n=requestAnimationFrame(...r);return t.add(()=>cancelAnimationFrame(n))},nextFrame(...r){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...r))},setTimeout(...r){let n=setTimeout(...r);return t.add(()=>clearTimeout(n))},microTask(...r){let n={current:!0};return Hf(()=>{n.current&&r[0]()}),t.add(()=>{n.current=!1})},style(r,n,o){let a=r.style.getPropertyValue(n);return Object.assign(r.style,{[n]:o}),this.add(()=>{Object.assign(r.style,{[n]:a})})},group(r){let n=ra();return r(n),this.add(()=>n.dispose())},add(r){return e.includes(r)||e.push(r),()=>{let n=e.indexOf(r);if(n>=0)for(let o of e.splice(n,1))o()}},dispose(){for(let r of e.splice(0))r()}};return t}function $a(){let[e]=m.useState(ra);return m.useEffect(()=>()=>e.dispose(),[e]),e}let Vt=(e,t)=>{al.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function Zn(e){let t=m.useRef(e);return Vt(()=>{t.current=e},[e]),t}let Ae=function(e){let t=Zn(e);return y.useCallback((...r)=>t.current(...r),[t])};function Tme(e){let t=e.width/2,r=e.height/2;return{top:e.clientY-r,right:e.clientX+t,bottom:e.clientY+r,left:e.clientX-t}}function Mme(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function pc({disabled:e=!1}={}){let t=m.useRef(null),[r,n]=m.useState(!1),o=$a(),a=Ae(()=>{t.current=null,n(!1),o.dispose()}),i=Ae(s=>{if(o.dispose(),t.current===null){t.current=s.currentTarget,n(!0);{let u=Fa(s.currentTarget);o.addEventListener(u,"pointerup",a,!1),o.addEventListener(u,"pointermove",c=>{if(t.current){let d=Tme(c);n(Mme(d,t.current.getBoundingClientRect()))}},!1),o.addEventListener(u,"pointercancel",a,!1)}}});return{pressed:r,pressProps:e?{}:{onPointerDown:i,onPointerUp:a,onClick:a}}}let _me=m.createContext(void 0);function qf(){return m.useContext(_me)}function J2(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Jt(e,t,...r){if(e in t){let o=t[e];return typeof o=="function"?o(...r):o}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Jt),n}var qn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(qn||{}),Gi=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Gi||{});function Gt(){let e=Dme();return m.useCallback(t=>Ime({mergeRefs:e,...t}),[e])}function Ime({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:o,visible:a=!0,name:i,mergeRefs:s}){s=s??Lme;let u=AD(t,e);if(a)return $m(u,r,n,i,s);let c=o??0;if(c&2){let{static:d=!1,...f}=u;if(d)return $m(f,r,n,i,s)}if(c&1){let{unmount:d=!0,...f}=u;return Jt(d?0:1,{0(){return null},1(){return $m({...f,hidden:!0,style:{display:"none"}},r,n,i,s)}})}return $m(u,r,n,i,s)}function $m(e,t={},r,n,o){let{as:a=r,children:i,refName:s="ref",...u}=Ek(e,["unmount","static"]),c=e.ref!==void 0?{[s]:e.ref}:{},d=typeof i=="function"?i(t):i;"className"in u&&u.className&&typeof u.className=="function"&&(u.className=u.className(t)),u["aria-labelledby"]&&u["aria-labelledby"]===u.id&&(u["aria-labelledby"]=void 0);let f={};if(t){let h=!1,p=[];for(let[g,b]of Object.entries(t))typeof b=="boolean"&&(h=!0),b===!0&&p.push(g.replace(/([A-Z])/g,v=>`-${v.toLowerCase()}`));if(h){f["data-headlessui-state"]=p.join(" ");for(let g of p)f[`data-${g}`]=""}}if(a===m.Fragment&&(Object.keys(Bi(u)).length>0||Object.keys(Bi(f)).length>0))if(!m.isValidElement(d)||Array.isArray(d)&&d.length>1){if(Object.keys(Bi(u)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Bi(u)).concat(Object.keys(Bi(f))).map(h=>` - ${h}`).join(`
135
+ `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(h=>` - ${h}`).join(`
136
+ `)].join(`
137
+ `))}else{let h=d.props,p=h?.className,g=typeof p=="function"?(...x)=>J2(p(...x),u.className):J2(p,u.className),b=g?{className:g}:{},v=AD(d.props,Bi(Ek(u,["ref"])));for(let x in f)x in v&&delete f[x];return m.cloneElement(d,Object.assign({},v,f,c,{ref:o(Rme(d),c.ref)},b))}return m.createElement(a,Object.assign({},Ek(u,["ref"]),a!==m.Fragment&&c,a!==m.Fragment&&f),d)}function Dme(){let e=m.useRef([]),t=m.useCallback(r=>{for(let n of e.current)n!=null&&(typeof n=="function"?n(r):n.current=r)},[]);return(...r)=>{if(!r.every(n=>n==null))return e.current=r,t}}function Lme(...e){return e.every(t=>t==null)?void 0:t=>{for(let r of e)r!=null&&(typeof r=="function"?r(t):r.current=t)}}function AD(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let o in n)o.startsWith("on")&&typeof n[o]=="function"?(r[o]!=null||(r[o]=[]),r[o].push(n[o])):t[o]=n[o];if(t.disabled||t["aria-disabled"])for(let n in r)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(n)&&(r[n]=[o=>{var a;return(a=o?.preventDefault)==null?void 0:a.call(o)}]);for(let n in r)Object.assign(t,{[n](o,...a){let i=r[n];for(let s of i){if((o instanceof Event||o?.nativeEvent instanceof Event)&&o.defaultPrevented)return;s(o,...a)}}});return t}function ia(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let o in n)o.startsWith("on")&&typeof n[o]=="function"?(r[o]!=null||(r[o]=[]),r[o].push(n[o])):t[o]=n[o];for(let n in r)Object.assign(t,{[n](...o){let a=r[n];for(let i of a)i?.(...o)}});return t}function qt(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Bi(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function Ek(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function Rme(e){return y.version.split(".")[0]>="19"?e.props.ref:e.ref}function jN(e,t,r){let[n,o]=m.useState(r),a=e!==void 0,i=m.useRef(a),s=m.useRef(!1),u=m.useRef(!1);return a&&!i.current&&!s.current?(s.current=!0,i.current=a,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!a&&i.current&&!u.current&&(u.current=!0,i.current=a,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[a?e:n,Ae(c=>(a||o(c),t?.(c)))]}function EN(e){let[t]=m.useState(e);return t}function TD(e={},t=null,r=[]){for(let[n,o]of Object.entries(e))_D(r,MD(t,n),o);return r}function MD(e,t){return e?e+"["+t+"]":t}function _D(e,t,r){if(Array.isArray(r))for(let[n,o]of r.entries())_D(e,MD(t,n.toString()),o);else r instanceof Date?e.push([t,r.toISOString()]):typeof r=="boolean"?e.push([t,r?"1":"0"]):typeof r=="string"?e.push([t,r]):typeof r=="number"?e.push([t,`${r}`]):r==null?e.push([t,""]):TD(r,t,e)}function ID(e){var t,r;let n=(t=e?.form)!=null?t:e.closest("form");if(n){for(let o of n.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(r=n.requestSubmit)==null||r.call(n)}}let Fme="span";var Ma=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Ma||{});function $me(e,t){var r;let{features:n=1,...o}=e,a={ref:t,"aria-hidden":(n&2)===2?!0:(r=o["aria-hidden"])!=null?r:void 0,hidden:(n&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return Gt()({ourProps:a,theirProps:o,slot:{},defaultTag:Fme,name:"Hidden"})}let _a=qt($me),Bme=m.createContext(null);function zme({children:e}){let t=m.useContext(Bme);if(!t)return y.createElement(y.Fragment,null,e);let{target:r}=t;return r?nr.createPortal(y.createElement(y.Fragment,null,e),r):null}function NN({data:e,form:t,disabled:r,onReset:n,overrides:o}){let[a,i]=m.useState(null),s=$a();return m.useEffect(()=>{if(n&&a)return s.addEventListener(a,"reset",n)},[a,t,n]),y.createElement(zme,null,y.createElement(Hme,{setForm:i,formId:t}),TD(e).map(([u,c])=>y.createElement(_a,{features:Ma.Hidden,...Bi({key:u,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:r,name:u,value:c,...o})})))}function Hme({setForm:e,formId:t}){return m.useEffect(()=>{if(t){let r=document.getElementById(t);r&&e(r)}},[e,t]),t?null:y.createElement(_a,{features:Ma.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:r=>{if(!r)return;let n=r.closest("form");n&&e(n)}})}let qme=m.createContext(void 0);function Xg(){return m.useContext(qme)}function hc(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=t?.getAttribute("disabled")==="";return n&&Ume(r)?!1:n}function Ume(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}let DD=Symbol();function SN(e,t=!0){return Object.assign(e,{[DD]:t})}function er(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let r=Ae(n=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(n):o.current=n)});return e.every(n=>n==null||n?.[DD])?void 0:r}let Zg=m.createContext(null);Zg.displayName="DescriptionContext";function LD(){let e=m.useContext(Zg);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,LD),t}return e}function ON(){var e,t;return(t=(e=m.useContext(Zg))==null?void 0:e.value)!=null?t:void 0}function RD(){let[e,t]=m.useState([]);return[e.length>0?e.join(" "):void 0,m.useMemo(()=>function(r){let n=Ae(a=>(t(i=>[...i,a]),()=>t(i=>{let s=i.slice(),u=s.indexOf(a);return u!==-1&&s.splice(u,1),s}))),o=m.useMemo(()=>({register:n,slot:r.slot,name:r.name,props:r.props,value:r.value}),[n,r.slot,r.name,r.props,r.value]);return y.createElement(Zg.Provider,{value:o},r.children)},[t])]}let Vme="p";function Wme(e,t){let r=m.useId(),n=qf(),{id:o=`headlessui-description-${r}`,...a}=e,i=LD(),s=er(t);Vt(()=>i.register(o),[o,i.register]);let u=n||!1,c=m.useMemo(()=>({...i.slot,disabled:u}),[i.slot,u]),d={ref:s,...i.props,id:o};return Gt()({ourProps:d,theirProps:a,slot:c,defaultTag:Vme,name:i.name||"Description"})}let Kme=qt(Wme),FD=Object.assign(Kme,{});var vt=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(vt||{});let Jg=m.createContext(null);Jg.displayName="LabelContext";function $D(){let e=m.useContext(Jg);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,$D),t}return e}function gc(e){var t,r,n;let o=(r=(t=m.useContext(Jg))==null?void 0:t.value)!=null?r:void 0;return((n=e?.length)!=null?n:0)>0?[o,...e].filter(Boolean).join(" "):o}function CN({inherit:e=!1}={}){let t=gc(),[r,n]=m.useState([]),o=e?[t,...r].filter(Boolean):r;return[o.length>0?o.join(" "):void 0,m.useMemo(()=>function(a){let i=Ae(u=>(n(c=>[...c,u]),()=>n(c=>{let d=c.slice(),f=d.indexOf(u);return f!==-1&&d.splice(f,1),d}))),s=m.useMemo(()=>({register:i,slot:a.slot,name:a.name,props:a.props,value:a.value}),[i,a.slot,a.name,a.props,a.value]);return y.createElement(Jg.Provider,{value:s},a.children)},[n])]}let Yme="label";function Gme(e,t){var r;let n=m.useId(),o=$D(),a=Xg(),i=qf(),{id:s=`headlessui-label-${n}`,htmlFor:u=a??((r=o.props)==null?void 0:r.htmlFor),passive:c=!1,...d}=e,f=er(t);Vt(()=>o.register(s),[s,o.register]);let h=Ae(v=>{let x=v.currentTarget;if(x instanceof HTMLLabelElement&&v.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(v),x instanceof HTMLLabelElement){let k=document.getElementById(x.htmlFor);if(k){let E=k.getAttribute("disabled");if(E==="true"||E==="")return;let j=k.getAttribute("aria-disabled");if(j==="true"||j==="")return;(k instanceof HTMLInputElement&&(k.type==="radio"||k.type==="checkbox")||k.role==="radio"||k.role==="checkbox"||k.role==="switch")&&k.click(),k.focus({preventScroll:!0})}}}),p=i||!1,g=m.useMemo(()=>({...o.slot,disabled:p}),[o.slot,p]),b={ref:f,...o.props,id:s,htmlFor:u,onClick:h};return c&&("onClick"in b&&(delete b.htmlFor,delete b.onClick),"onClick"in d&&delete d.onClick),Gt()({ourProps:b,theirProps:d,slot:g,defaultTag:u?Yme:"div",name:o.name||"Label"})}let Xme=qt(Gme),PN=Object.assign(Xme,{}),Zme=m.createContext(()=>{});function AN({value:e,children:t}){return y.createElement(Zme.Provider,{value:e},t)}function Jme(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function BD(e=Jme){return m.useCallback((t,r)=>{if(typeof e=="string"){let n=e;return t?.[n]===r?.[n]}return e(t,r)},[e])}function Qme(e){if(e===null)return{width:0,height:0};let{width:t,height:r}=e.getBoundingClientRect();return{width:t,height:r}}function Ch(e,t=!1){let[r,n]=m.useReducer(()=>({}),{}),o=m.useMemo(()=>Qme(e),[e,r]);return Vt(()=>{if(!e)return;let a=new ResizeObserver(n);return a.observe(e),()=>{a.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let epe=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};function zD(e,t){let r=e(),n=new Set;return{getSnapshot(){return r},subscribe(o){return n.add(o),()=>n.delete(o)},dispatch(o,...a){let i=t[o].call(r,...a);i&&(r=i,n.forEach(s=>s()))}}}function HD(e){return m.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let tpe=new epe(()=>zD(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let r=this.slice();return r.splice(t,1),r}}));function bc(e,t){let r=tpe.get(t),n=m.useId(),o=HD(r);if(Vt(()=>{if(e)return r.dispatch("ADD",n),()=>r.dispatch("REMOVE",n)},[r,e]),!e)return!1;let a=o.indexOf(n),i=o.length;return a===-1&&(a=i,i+=1),a===i-1}let Q2=new Map,kd=new Map;function $7(e){var t;let r=(t=kd.get(e))!=null?t:0;return kd.set(e,r+1),r!==0?()=>B7(e):(Q2.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>B7(e))}function B7(e){var t;let r=(t=kd.get(e))!=null?t:1;if(r===1?kd.delete(e):kd.set(e,r-1),r!==1)return;let n=Q2.get(e);n&&(n["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n["aria-hidden"]),e.inert=n.inert,Q2.delete(e))}function TN(e,{allowed:t,disallowed:r}={}){let n=bc(e,"inert-others");Vt(()=>{var o,a;if(!n)return;let i=ra();for(let u of(o=r?.())!=null?o:[])u&&i.add($7(u));let s=(a=t?.())!=null?a:[];for(let u of s){if(!u)continue;let c=Fa(u);if(!c)continue;let d=u.parentElement;for(;d&&d!==c.body;){for(let f of d.children)s.some(h=>f.contains(h))||i.add($7(f));d=d.parentElement}}return i.dispose},[n,t,r])}function Qg(e,t,r){let n=Zn(o=>{let a=o.getBoundingClientRect();a.x===0&&a.y===0&&a.width===0&&a.height===0&&r()});m.useEffect(()=>{if(!e)return;let o=t===null?null:t instanceof HTMLElement?t:t.current;if(!o)return;let a=ra();if(typeof ResizeObserver<"u"){let i=new ResizeObserver(()=>n.current(o));i.observe(o),a.add(()=>i.disconnect())}if(typeof IntersectionObserver<"u"){let i=new IntersectionObserver(()=>n.current(o));i.observe(o),a.add(()=>i.disconnect())}return()=>a.dispose()},[t,n,e])}let Ph=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),rpe=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var yr=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(yr||{}),ha=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(ha||{}),npe=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(npe||{});function Uf(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ph)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}function ope(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(rpe)).sort((t,r)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(r.tabIndex||Number.MAX_SAFE_INTEGER)))}var eb=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(eb||{});function MN(e,t=0){var r;return e===((r=Fa(e))==null?void 0:r.body)?!1:Jt(t,{0(){return e.matches(Ph)},1(){let n=e;for(;n!==null;){if(n.matches(Ph))return!0;n=n.parentElement}return!1}})}var ape=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(ape||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function ri(e){e?.focus({preventScroll:!0})}let ipe=["textarea","input"].join(",");function spe(e){var t,r;return(r=(t=e?.matches)==null?void 0:t.call(e,ipe))!=null?r:!1}function Xi(e,t=r=>r){return e.slice().sort((r,n)=>{let o=t(r),a=t(n);if(o===null||a===null)return 0;let i=o.compareDocumentPosition(a);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function lpe(e,t){return bn(Uf(),t,{relativeTo:e})}function bn(e,t,{sorted:r=!0,relativeTo:n=null,skipElements:o=[]}={}){let a=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?r?Xi(e):e:t&64?ope(e):Uf(e);o.length>0&&i.length>1&&(i=i.filter(p=>!o.some(g=>g!=null&&"current"in g?g?.current===p:g===p))),n=n??a.activeElement;let s=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(n))-1;if(t&4)return Math.max(0,i.indexOf(n))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},d=0,f=i.length,h;do{if(d>=f||d+f<=0)return 0;let p=u+d;if(t&16)p=(p+f)%f;else{if(p<0)return 3;if(p>=f)return 1}h=i[p],h?.focus(c),d+=s}while(h!==a.activeElement);return t&6&&spe(h)&&h.select(),2}function qD(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function upe(){return/Android/gi.test(window.navigator.userAgent)}function UD(){return qD()||upe()}function Kc(e,t,r,n){let o=Zn(r);m.useEffect(()=>{if(!e)return;function a(i){o.current(i)}return document.addEventListener(t,a,n),()=>document.removeEventListener(t,a,n)},[e,t,n])}function VD(e,t,r,n){let o=Zn(r);m.useEffect(()=>{if(!e)return;function a(i){o.current(i)}return window.addEventListener(t,a,n),()=>window.removeEventListener(t,a,n)},[e,t,n])}const z7=30;function tb(e,t,r){let n=bc(e,"outside-click"),o=Zn(r),a=m.useCallback(function(u,c){if(u.defaultPrevented)return;let d=c(u);if(d===null||!d.getRootNode().contains(d)||!d.isConnected)return;let f=function h(p){return typeof p=="function"?h(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let h of f)if(h!==null&&(h.contains(d)||u.composed&&u.composedPath().includes(h)))return;return!MN(d,eb.Loose)&&d.tabIndex!==-1&&u.preventDefault(),o.current(u,d)},[o,t]),i=m.useRef(null);Kc(n,"pointerdown",u=>{var c,d;i.current=((d=(c=u.composedPath)==null?void 0:c.call(u))==null?void 0:d[0])||u.target},!0),Kc(n,"mousedown",u=>{var c,d;i.current=((d=(c=u.composedPath)==null?void 0:c.call(u))==null?void 0:d[0])||u.target},!0),Kc(n,"click",u=>{UD()||i.current&&(a(u,()=>i.current),i.current=null)},!0);let s=m.useRef({x:0,y:0});Kc(n,"touchstart",u=>{s.current.x=u.touches[0].clientX,s.current.y=u.touches[0].clientY},!0),Kc(n,"touchend",u=>{let c={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(c.x-s.current.x)>=z7||Math.abs(c.y-s.current.y)>=z7))return a(u,()=>u.target instanceof HTMLElement?u.target:null)},!0),VD(n,"blur",u=>a(u,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function sa(...e){return m.useMemo(()=>Fa(...e),[...e])}function rb(e,t,r,n){let o=Zn(r);m.useEffect(()=>{e=e??window;function a(i){o.current(i)}return e.addEventListener(t,a,n),()=>e.removeEventListener(t,a,n)},[e,t,n])}function WD(e){let t=m.useRef({value:"",selectionStart:null,selectionEnd:null});return rb(e,"blur",r=>{let n=r.target;n instanceof HTMLInputElement&&(t.current={value:n.value,selectionStart:n.selectionStart,selectionEnd:n.selectionEnd})}),Ae(()=>{if(document.activeElement!==e&&e instanceof HTMLInputElement&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:r,selectionEnd:n}=t.current;r!==null&&n!==null&&e.setSelectionRange(r,n)}t.current={value:"",selectionStart:null,selectionEnd:null}}})}function vc(e,t){return m.useMemo(()=>{var r;if(e.type)return e.type;let n=(r=e.as)!=null?r:"button";if(typeof n=="string"&&n.toLowerCase()==="button"||t?.tagName==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function cpe(){let e;return{before({doc:t}){var r;let n=t.documentElement,o=(r=t.defaultView)!=null?r:window;e=Math.max(0,o.innerWidth-n.clientWidth)},after({doc:t,d:r}){let n=t.documentElement,o=Math.max(0,n.clientWidth-n.offsetWidth),a=Math.max(0,e-o);r.style(n,"paddingRight",`${a}px`)}}}function dpe(){return qD()?{before({doc:e,d:t,meta:r}){function n(o){return r.containers.flatMap(a=>a()).some(a=>a.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let s=ra();s.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>s.dispose()))}let a=(o=window.scrollY)!=null?o:window.pageYOffset,i=null;t.addEventListener(e,"click",s=>{if(s.target instanceof HTMLElement)try{let u=s.target.closest("a");if(!u)return;let{hash:c}=new URL(u.href),d=e.querySelector(c);d&&!n(d)&&(i=d)}catch{}},!0),t.addEventListener(e,"touchstart",s=>{if(s.target instanceof HTMLElement)if(n(s.target)){let u=s.target;for(;u.parentElement&&n(u.parentElement);)u=u.parentElement;t.style(u,"overscrollBehavior","contain")}else t.style(s.target,"touchAction","none")}),t.addEventListener(e,"touchmove",s=>{if(s.target instanceof HTMLElement){if(s.target.tagName==="INPUT")return;if(n(s.target)){let u=s.target;for(;u.parentElement&&u.dataset.headlessuiPortal!==""&&!(u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth);)u=u.parentElement;u.dataset.headlessuiPortal===""&&s.preventDefault()}else s.preventDefault()}},{passive:!1}),t.add(()=>{var s;let u=(s=window.scrollY)!=null?s:window.pageYOffset;a!==u&&window.scrollTo(0,a),i&&i.isConnected&&(i.scrollIntoView({block:"nearest"}),i=null)})})}}:{}}function fpe(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function mpe(e){let t={};for(let r of e)Object.assign(t,r(t));return t}let rl=zD(()=>new Map,{PUSH(e,t){var r;let n=(r=this.get(e))!=null?r:{doc:e,count:0,d:ra(),meta:new Set};return n.count++,n.meta.add(t),this.set(e,n),this},POP(e,t){let r=this.get(e);return r&&(r.count--,r.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:r}){let n={doc:e,d:t,meta:mpe(r)},o=[dpe(),cpe(),fpe()];o.forEach(({before:a})=>a?.(n)),o.forEach(({after:a})=>a?.(n))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});rl.subscribe(()=>{let e=rl.getSnapshot(),t=new Map;for(let[r]of e)t.set(r,r.documentElement.style.overflow);for(let r of e.values()){let n=t.get(r.doc)==="hidden",o=r.count!==0;(o&&!n||!o&&n)&&rl.dispatch(r.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",r),r.count===0&&rl.dispatch("TEARDOWN",r)}});function ppe(e,t,r=()=>({containers:[]})){let n=HD(rl),o=t?n.get(t):void 0,a=o?o.count>0:!1;return Vt(()=>{if(!(!t||!e))return rl.dispatch("PUSH",t,r),()=>rl.dispatch("POP",t,r)},[e,t]),a}function nb(e,t,r=()=>[document.body]){let n=bc(e,"scroll-lock");ppe(n,t,o=>{var a;return{containers:[...(a=o.containers)!=null?a:[],r]}})}function H7(e){return[e.screenX,e.screenY]}function KD(){let e=m.useRef([-1,-1]);return{wasMoved(t){let r=H7(t);return e.current[0]===r[0]&&e.current[1]===r[1]?!1:(e.current=r,!0)},update(t){e.current=H7(t)}}}function hpe(e=0){let[t,r]=m.useState(e),n=m.useCallback(u=>r(u),[t]),o=m.useCallback(u=>r(c=>c|u),[t]),a=m.useCallback(u=>(t&u)===u,[t]),i=m.useCallback(u=>r(c=>c&~u),[r]),s=m.useCallback(u=>r(c=>c^u),[r]);return{flags:t,setFlag:n,addFlag:o,hasFlag:a,removeFlag:i,toggleFlag:s}}var q7,U7;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((q7=process==null?void 0:u9)==null?void 0:q7.NODE_ENV)==="test"&&typeof((U7=Element?.prototype)==null?void 0:U7.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
138
+ `)),[]});var gpe=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(gpe||{});function yc(e){let t={};for(let r in e)e[r]===!0&&(t[`data-${r}`]="");return t}function xc(e,t,r,n){let[o,a]=m.useState(r),{hasFlag:i,addFlag:s,removeFlag:u}=hpe(e&&o?3:0),c=m.useRef(!1),d=m.useRef(!1),f=$a();return Vt(()=>{var h;if(e){if(r&&a(!0),!t){r&&s(3);return}return(h=n?.start)==null||h.call(n,r),bpe(t,{inFlight:c,prepare(){d.current?d.current=!1:d.current=c.current,c.current=!0,!d.current&&(r?(s(3),u(4)):(s(4),u(2)))},run(){d.current?r?(u(3),s(4)):(u(4),s(3)):r?u(1):s(1)},done(){var p;d.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,u(7),r||a(!1),(p=n?.end)==null||p.call(n,r))}})}},[e,r,t,f]),e?[o,{closed:i(1),enter:i(2),leave:i(4),transition:i(2)||i(4)}]:[r,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function bpe(e,{prepare:t,run:r,done:n,inFlight:o}){let a=ra();return ype(e,{prepare:t,inFlight:o}),a.nextFrame(()=>{r(),a.requestAnimationFrame(()=>{a.add(vpe(e,n))})}),a.dispose}function vpe(e,t){var r,n;let o=ra();if(!e)return o.dispose;let a=!1;o.add(()=>{a=!0});let i=(n=(r=e.getAnimations)==null?void 0:r.call(e).filter(s=>s instanceof CSSTransition))!=null?n:[];return i.length===0?(t(),o.dispose):(Promise.allSettled(i.map(s=>s.finished)).then(()=>{a||t()}),o.dispose)}function ype(e,{inFlight:t,prepare:r}){if(t!=null&&t.current){r();return}let n=e.style.transition;e.style.transition="none",r(),e.offsetHeight,e.style.transition=n}function xpe(e,{container:t,accept:r,walk:n}){let o=m.useRef(r),a=m.useRef(n);m.useEffect(()=>{o.current=r,a.current=n},[r,n]),Vt(()=>{if(!t||!e)return;let i=Fa(t);if(!i)return;let s=o.current,u=a.current,c=Object.assign(f=>s(f),{acceptNode:s}),d=i.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;d.nextNode();)u(d.currentNode)},[t,e,o,a])}function pf(e,t){let r=m.useRef([]),n=Ae(e);m.useEffect(()=>{let o=[...r.current];for(let[a,i]of t.entries())if(r.current[a]!==i){let s=n(t,o);return r.current=t,s}},[n,...t])}function kpe(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:r,version:n}=t;return r+"/"+n}).join(" "):navigator.userAgent}var op=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Ah(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 r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!Ah(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const a=o[n];if(!(a==="_owner"&&e.$$typeof)&&!Ah(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function YD(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function V7(e,t){const r=YD(e);return Math.round(t*r)/r}function Nk(e){const t=m.useRef(e);return op(()=>{t.current=e}),t}function wpe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,elements:{reference:a,floating:i}={},transform:s=!0,whileElementsMounted:u,open:c}=e,[d,f]=m.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=m.useState(n);Ah(h,n)||p(n);const[g,b]=m.useState(null),[v,x]=m.useState(null),k=m.useCallback(L=>{L!==C.current&&(C.current=L,b(L))},[]),E=m.useCallback(L=>{L!==O.current&&(O.current=L,x(L))},[]),j=a||g,S=i||v,C=m.useRef(null),O=m.useRef(null),M=m.useRef(d),A=u!=null,T=Nk(u),_=Nk(o),F=Nk(c),$=m.useCallback(()=>{if(!C.current||!O.current)return;const L={placement:t,strategy:r,middleware:h};_.current&&(L.platform=_.current),Rj(C.current,O.current,L).then(q=>{const U={...q,isPositioned:F.current!==!1};I.current&&!Ah(M.current,U)&&(M.current=U,nr.flushSync(()=>{f(U)}))})},[h,t,r,_,F]);op(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[c]);const I=m.useRef(!1);op(()=>(I.current=!0,()=>{I.current=!1}),[]),op(()=>{if(j&&(C.current=j),S&&(O.current=S),j&&S){if(T.current)return T.current(j,S,$);$()}},[j,S,$,T,A]);const R=m.useMemo(()=>({reference:C,floating:O,setReference:k,setFloating:E}),[k,E]),W=m.useMemo(()=>({reference:j,floating:S}),[j,S]),B=m.useMemo(()=>{const L={position:r,left:0,top:0};if(!W.floating)return L;const q=V7(W.floating,d.x),U=V7(W.floating,d.y);return s?{...L,transform:"translate("+q+"px, "+U+"px)",...YD(W.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:q,top:U}},[r,s,W.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:$,refs:R,elements:W,floatingStyles:B}),[d,$,R,W,B])}const GD=(e,t)=>({...Ij(e),options:[e,t]}),jpe=(e,t)=>({...Dj(e),options:[e,t]}),Epe=(e,t)=>({...Lj(e),options:[e,t]}),Npe=(e,t)=>({...i8(e),options:[e,t]}),XD={...rs},Spe=XD.useInsertionEffect,Ope=Spe||(e=>e());function ZD(e){const t=m.useRef(()=>{});return Ope(()=>{t.current=e}),m.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}var ej=typeof document<"u"?m.useLayoutEffect:m.useEffect;let W7=!1,Cpe=0;const K7=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Cpe++;function Ppe(){const[e,t]=m.useState(()=>W7?K7():void 0);return ej(()=>{e==null&&t(K7())},[]),m.useEffect(()=>{W7=!0},[]),e}const Ape=XD.useId,Tpe=Ape||Ppe;function Mpe(){const e=new Map;return{emit(t,r){var n;(n=e.get(t))==null||n.forEach(o=>o(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){var n;e.set(t,((n=e.get(t))==null?void 0:n.filter(o=>o!==r))||[])}}}const _pe=m.createContext(null),Ipe=m.createContext(null),Dpe=()=>{var e;return((e=m.useContext(_pe))==null?void 0:e.id)||null},Lpe=()=>m.useContext(Ipe),Rpe="data-floating-ui-focusable";function Fpe(e){const{open:t=!1,onOpenChange:r,elements:n}=e,o=Tpe(),a=m.useRef({}),[i]=m.useState(()=>Mpe()),s=Dpe()!=null,[u,c]=m.useState(n.reference),d=ZD((p,g,b)=>{a.current.openEvent=p?g:void 0,i.emit("openchange",{open:p,event:g,reason:b,nested:s}),r?.(p,g,b)}),f=m.useMemo(()=>({setPositionReference:c}),[]),h=m.useMemo(()=>({reference:u||n.reference||null,floating:n.floating||null,domReference:n.reference}),[u,n.reference,n.floating]);return m.useMemo(()=>({dataRef:a,open:t,onOpenChange:d,elements:h,events:i,floatingId:o,refs:f}),[t,d,h,i,o,f])}function $pe(e){e===void 0&&(e={});const{nodeId:t}=e,r=Fpe({...e,elements:{reference:null,floating:null,...e.elements}}),n=e.rootContext||r,o=n.elements,[a,i]=m.useState(null),[s,u]=m.useState(null),c=o?.domReference||a,d=m.useRef(null),f=Lpe();ej(()=>{c&&(d.current=c)},[c]);const h=wpe({...e,elements:{...o,...s&&{reference:s}}}),p=m.useCallback(k=>{const E=yn(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),contextElement:k}:k;u(E),h.refs.setReference(E)},[h.refs]),g=m.useCallback(k=>{(yn(k)||k===null)&&(d.current=k,i(k)),(yn(h.refs.reference.current)||h.refs.reference.current===null||k!==null&&!yn(k))&&h.refs.setReference(k)},[h.refs]),b=m.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d}),[h.refs,g,p]),v=m.useMemo(()=>({...h.elements,domReference:c}),[h.elements,c]),x=m.useMemo(()=>({...h,...n,refs:b,elements:v,nodeId:t}),[h,b,v,t,n]);return ej(()=>{n.dataRef.current.floatingContext=x;const k=f?.nodesRef.current.find(E=>E.id===t);k&&(k.context=x)}),m.useMemo(()=>({...h,context:x,refs:b,elements:v}),[h,b,v,x])}const Y7="active",G7="selected";function Sk(e,t,r){const n=new Map,o=r==="item";let a=e;if(o&&e){const{[Y7]:i,[G7]:s,...u}=e;a=u}return{...r==="floating"&&{tabIndex:-1,[Rpe]:""},...a,...t.map(i=>{const s=i?i[r]:null;return typeof s=="function"?e?s(e):null:s}).concat(e).reduce((i,s)=>(s&&Object.entries(s).forEach(u=>{let[c,d]=u;if(!(o&&[Y7,G7].includes(c)))if(c.indexOf("on")===0){if(n.has(c)||n.set(c,[]),typeof d=="function"){var f;(f=n.get(c))==null||f.push(d),i[c]=function(){for(var h,p=arguments.length,g=new Array(p),b=0;b<p;b++)g[b]=arguments[b];return(h=n.get(c))==null?void 0:h.map(v=>v(...g)).find(v=>v!==void 0)}}}else i[c]=d}),i),{})}}function Bpe(e){e===void 0&&(e=[]);const t=e.map(s=>s?.reference),r=e.map(s=>s?.floating),n=e.map(s=>s?.item),o=m.useCallback(s=>Sk(s,e,"reference"),t),a=m.useCallback(s=>Sk(s,e,"floating"),r),i=m.useCallback(s=>Sk(s,e,"item"),n);return m.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:i}),[o,a,i])}function X7(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const zpe=e=>({name:"inner",options:e,async fn(t){const{listRef:r,overflowRef:n,onFallbackChange:o,offset:a=0,index:i=0,minItemsVisible:s=4,referenceOverflowThreshold:u=0,scrollRef:c,...d}=ta(e,t),{rects:f,elements:{floating:h}}=t,p=r.current[i],g=c?.current||h,b=h.clientTop||g.clientTop,v=h.clientTop!==0,x=g.clientTop!==0,k=h===g;if(!p)return{};const E={...t,...await GD(-p.offsetTop-h.clientTop-f.reference.height/2-p.offsetHeight/2-a).fn(t)},j=await ou(X7(E,g.scrollHeight+b+h.clientTop),d),S=await ou(E,{...d,elementContext:"reference"}),C=gn(0,j.top),O=E.y+C,M=(g.scrollHeight>g.clientHeight?A=>A:bu)(gn(0,g.scrollHeight+(v&&k||x?b*2:0)-C-gn(0,j.bottom)));if(g.style.maxHeight=M+"px",g.scrollTop=C,o){const A=g.offsetHeight<p.offsetHeight*Oa(s,r.current.length)-1||S.top>=-u||S.bottom>=-u;nr.flushSync(()=>o(A))}return n&&(n.current=await ou(X7({...E,y:O},g.offsetHeight+b+h.clientTop),d)),{y:O}}});function Hpe(e,t){const{open:r,elements:n}=e,{enabled:o=!0,overflowRef:a,scrollRef:i,onChange:s}=t,u=ZD(s),c=m.useRef(!1),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(!o)return;function p(b){if(b.ctrlKey||!g||a.current==null)return;const v=b.deltaY,x=a.current.top>=-.5,k=a.current.bottom>=-.5,E=g.scrollHeight-g.clientHeight,j=v<0?-1:1,S=v<0?"max":"min";g.scrollHeight<=g.clientHeight||(!x&&v>0||!k&&v<0?(b.preventDefault(),nr.flushSync(()=>{u(C=>C+Math[S](v,E*j))})):/firefox/i.test(kpe())&&(g.scrollTop+=v))}const g=i?.current||n.floating;if(r&&g)return g.addEventListener("wheel",p),requestAnimationFrame(()=>{d.current=g.scrollTop,a.current!=null&&(f.current={...a.current})}),()=>{d.current=null,f.current=null,g.removeEventListener("wheel",p)}},[o,r,n.floating,a,i,u]);const h=m.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const p=i?.current||n.floating;if(!(!a.current||!p||!c.current)){if(d.current!==null){const g=p.scrollTop-d.current;(a.current.bottom<-.5&&g<-1||a.current.top<-.5&&g>1)&&nr.flushSync(()=>u(b=>b+g))}requestAnimationFrame(()=>{d.current=p.scrollTop})}}}),[n.floating,u,a,i]);return m.useMemo(()=>o?{floating:h}:{},[o,h])}let kc=m.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});kc.displayName="FloatingContext";let _N=m.createContext(null);_N.displayName="PlacementContext";function IN(e){return m.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function DN(){return m.useContext(kc).setReference}function qpe(){return m.useContext(kc).getReferenceProps}function LN(){let{getFloatingProps:e,slot:t}=m.useContext(kc);return m.useCallback((...r)=>Object.assign({},e(...r),{"data-anchor":t.anchor}),[e,t])}function RN(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=m.useContext(_N),r=m.useMemo(()=>e,[JSON.stringify(e,(o,a)=>{var i;return(i=a?.outerHTML)!=null?i:a})]);Vt(()=>{t?.(r??null)},[t,r]);let n=m.useContext(kc);return m.useMemo(()=>[n.setFloating,e?n.styles:{}],[n.setFloating,e,n.styles])}let Z7=4;function FN({children:e,enabled:t=!0}){let[r,n]=m.useState(null),[o,a]=m.useState(0),i=m.useRef(null),[s,u]=m.useState(null);Upe(s);let c=t&&r!==null&&s!==null,{to:d="bottom",gap:f=0,offset:h=0,padding:p=0,inner:g}=Vpe(r,s),[b,v="center"]=d.split(" ");Vt(()=>{c&&a(0)},[c]);let{refs:x,floatingStyles:k,context:E}=$pe({open:c,placement:b==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${b}`:`${b}-${v}`,strategy:"absolute",transform:!1,middleware:[GD({mainAxis:b==="selection"?0:f,crossAxis:h}),jpe({padding:p}),b!=="selection"&&Epe({padding:p}),b==="selection"&&g?zpe({...g,padding:p,overflowRef:i,offset:o,minItemsVisible:Z7,referenceOverflowThreshold:p,onFallbackChange(_){var F,$;if(!_)return;let I=E.elements.floating;if(!I)return;let R=parseFloat(getComputedStyle(I).scrollPaddingBottom)||0,W=Math.min(Z7,I.childElementCount),B=0,L=0;for(let q of($=(F=E.elements.floating)==null?void 0:F.childNodes)!=null?$:[])if(q instanceof HTMLElement){let U=q.offsetTop,H=U+q.clientHeight+R,X=I.scrollTop,Y=X+I.clientHeight;if(U>=X&&H<=Y)W--;else{L=Math.max(0,Math.min(H,Y)-Math.max(U,X)),B=q.clientHeight;break}}W>=1&&a(q=>{let U=B*W-L+R;return q>=U?q:U})}}):null,Npe({padding:p,apply({availableWidth:_,availableHeight:F,elements:$}){Object.assign($.floating.style,{overflow:"auto",maxWidth:`${_}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${F}px)`})}})].filter(Boolean),whileElementsMounted:Kh}),[j=b,S=v]=E.placement.split("-");b==="selection"&&(j="selection");let C=m.useMemo(()=>({anchor:[j,S].filter(Boolean).join(" ")}),[j,S]),O=Hpe(E,{overflowRef:i,onChange:a}),{getReferenceProps:M,getFloatingProps:A}=Bpe([O]),T=Ae(_=>{u(_),x.setFloating(_)});return m.createElement(_N.Provider,{value:n},m.createElement(kc.Provider,{value:{setFloating:T,setReference:x.setReference,styles:k,getReferenceProps:M,getFloatingProps:A,slot:C}},e))}function Upe(e){Vt(()=>{if(!e)return;let t=new MutationObserver(()=>{let r=window.getComputedStyle(e).maxHeight,n=parseFloat(r);if(isNaN(n))return;let o=parseInt(r);isNaN(o)||n!==o&&(e.style.maxHeight=`${Math.ceil(n)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function Vpe(e,t){var r,n,o;let a=Ok((r=e?.gap)!=null?r:"var(--anchor-gap, 0)",t),i=Ok((n=e?.offset)!=null?n:"var(--anchor-offset, 0)",t),s=Ok((o=e?.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:a,offset:i,padding:s}}function Ok(e,t,r=void 0){let n=$a(),o=Ae((u,c)=>{if(u==null)return[r,null];if(typeof u=="number")return[u,null];if(typeof u=="string"){if(!c)return[r,null];let d=J7(u,c);return[d,f=>{let h=JD(u);{let p=h.map(g=>window.getComputedStyle(c).getPropertyValue(g));n.requestAnimationFrame(function g(){n.nextFrame(g);let b=!1;for(let[x,k]of h.entries()){let E=window.getComputedStyle(c).getPropertyValue(k);if(p[x]!==E){p[x]=E,b=!0;break}}if(!b)return;let v=J7(u,c);d!==v&&(f(v),d=v)})}return n.dispose}]}return[r,null]}),a=m.useMemo(()=>o(e,t)[0],[e,t]),[i=a,s]=m.useState();return Vt(()=>{let[u,c]=o(e,t);if(s(u),!!c)return c(s)},[e,t]),i}function JD(e){let t=/var\((.*)\)/.exec(e);if(t){let r=t[1].indexOf(",");if(r===-1)return[t[1]];let n=t[1].slice(0,r).trim(),o=t[1].slice(r+1).trim();return o?[n,...JD(o)]:[n]}return[]}function J7(e,t){let r=document.createElement("div");t.appendChild(r),r.style.setProperty("margin-top","0px","important"),r.style.setProperty("margin-top",e,"important");let n=parseFloat(window.getComputedStyle(r).marginTop)||0;return t.removeChild(r),n}function Wpe({children:e,freeze:t}){let r=Th(t,e);return y.createElement(y.Fragment,null,r)}function Th(e,t){let[r,n]=m.useState(t);return!e&&r!==t&&n(t),e?r:t}let ob=m.createContext(null);ob.displayName="OpenClosedContext";var xr=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(xr||{});function Ni(){return m.useContext(ob)}function Vf({value:e,children:t}){return y.createElement(ob.Provider,{value:e},t)}function $N({children:e}){return y.createElement(ob.Provider,{value:null},e)}function Kpe(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let ca=[];Kpe(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||ca[0]===t.target)return;let r=t.target;r=r.closest(Ph),ca.unshift(r??t.target),ca=ca.filter(n=>n!=null&&n.isConnected),ca.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Ype(e){throw new Error("Unexpected object: "+e)}var Yt=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Yt||{});function wd(e,t){let r=t.resolveItems();if(r.length<=0)return null;let n=t.resolveActiveIndex(),o=n??-1;switch(e.focus){case 0:{for(let a=0;a<r.length;++a)if(!t.resolveDisabled(r[a],a,r))return a;return n}case 1:{o===-1&&(o=r.length);for(let a=o-1;a>=0;--a)if(!t.resolveDisabled(r[a],a,r))return a;return n}case 2:{for(let a=o+1;a<r.length;++a)if(!t.resolveDisabled(r[a],a,r))return a;return n}case 3:{for(let a=r.length-1;a>=0;--a)if(!t.resolveDisabled(r[a],a,r))return a;return n}case 4:{for(let a=0;a<r.length;++a)if(t.resolveId(r[a],a,r)===e.id)return a;return n}case 5:return null;default:Ype(e)}}var BN=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(BN||{});function QD(e){let t=Ae(e),r=m.useRef(!1);m.useEffect(()=>(r.current=!1,()=>{r.current=!0,Hf(()=>{r.current&&t()})}),[t])}function Gpe(){let e=typeof document>"u";return"useSyncExternalStore"in rs?(t=>t.useSyncExternalStore)(rs)(()=>()=>{},()=>!1,()=>!e):!1}function Wf(){let e=Gpe(),[t,r]=m.useState(al.isHandoffComplete);return t&&al.isHandoffComplete===!1&&r(!1),m.useEffect(()=>{t!==!0&&r(!0)},[t]),m.useEffect(()=>al.handoff(),[]),e?!1:t}let eL=m.createContext(!1);function Xpe(){return m.useContext(eL)}function Q7(e){return y.createElement(eL.Provider,{value:e.force},e.children)}function Zpe(e){let t=Xpe(),r=m.useContext(rL),n=sa(e),[o,a]=m.useState(()=>{var i;if(!t&&r!==null)return(i=r.current)!=null?i:null;if(al.isServer)return null;let s=n?.getElementById("headlessui-portal-root");if(s)return s;if(n===null)return null;let u=n.createElement("div");return u.setAttribute("id","headlessui-portal-root"),n.body.appendChild(u)});return m.useEffect(()=>{o!==null&&(n!=null&&n.body.contains(o)||n==null||n.body.appendChild(o))},[o,n]),m.useEffect(()=>{t||r!==null&&a(r.current)},[r,a,t]),o}let tL=m.Fragment,Jpe=qt(function(e,t){let r=e,n=m.useRef(null),o=er(SN(f=>{n.current=f}),t),a=sa(n),i=Zpe(n),[s]=m.useState(()=>{var f;return al.isServer?null:(f=a?.createElement("div"))!=null?f:null}),u=m.useContext(tj),c=Wf();Vt(()=>{!i||!s||i.contains(s)||(s.setAttribute("data-headlessui-portal",""),i.appendChild(s))},[i,s]),Vt(()=>{if(s&&u)return u.register(s)},[u,s]),QD(()=>{var f;!i||!s||(s instanceof Node&&i.contains(s)&&i.removeChild(s),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let d=Gt();return c?!i||!s?null:nr.createPortal(d({ourProps:{ref:o},theirProps:r,slot:{},defaultTag:tL,name:"Portal"}),s):null});function Qpe(e,t){let r=er(t),{enabled:n=!0,...o}=e,a=Gt();return n?y.createElement(Jpe,{...o,ref:r}):a({ourProps:{ref:r},theirProps:o,slot:{},defaultTag:tL,name:"Portal"})}let ehe=m.Fragment,rL=m.createContext(null);function the(e,t){let{target:r,...n}=e,o={ref:er(t)},a=Gt();return y.createElement(rL.Provider,{value:r},a({ourProps:o,theirProps:n,defaultTag:ehe,name:"Popover.Group"}))}let tj=m.createContext(null);function nL(){let e=m.useContext(tj),t=m.useRef([]),r=Ae(a=>(t.current.push(a),e&&e.register(a),()=>n(a))),n=Ae(a=>{let i=t.current.indexOf(a);i!==-1&&t.current.splice(i,1),e&&e.unregister(a)}),o=m.useMemo(()=>({register:r,unregister:n,portals:t}),[r,n,t]);return[t,m.useMemo(()=>function({children:a}){return y.createElement(tj.Provider,{value:o},a)},[o])]}let rhe=qt(Qpe),oL=qt(the),ab=Object.assign(rhe,{Group:oL});var nhe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(nhe||{}),ohe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ohe||{}),ahe=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(ahe||{}),ihe=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",e[e.SetInputElement=8]="SetInputElement",e[e.SetButtonElement=9]="SetButtonElement",e[e.SetOptionsElement=10]="SetOptionsElement",e))(ihe||{});function Ck(e,t=r=>r){let r=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,n=t(e.options.slice()),o=n.length>0&&n[0].dataRef.current.order!==null?n.sort((i,s)=>i.dataRef.current.order-s.dataRef.current.order):Xi(n,i=>i.dataRef.current.domRef.current),a=r?o.indexOf(r):null;return a===-1&&(a=null),{options:o,activeOptionIndex:a}}let she={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var t,r;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((r=e.dataRef.current)!=null&&r.value){let n=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(n!==-1)return{...e,activeOptionIndex:n,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var r,n,o,a;if((r=e.dataRef.current)!=null&&r.disabled||e.optionsElement&&!((n=e.dataRef.current)!=null&&n.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:d}=e.virtual,f=t.focus===Yt.Specific?t.idx:wd(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var p,g;return(g=(p=e.activeOptionIndex)!=null?p:c.findIndex(b=>!d(b)))!=null?g:null},resolveDisabled:d,resolveId(){throw new Error("Function not implemented.")}}),h=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===f&&e.activationTrigger===h?e:{...e,activeOptionIndex:f,activationTrigger:h,isTyping:!1,__demoMode:!1}}let i=Ck(e);if(i.activeOptionIndex===null){let c=i.options.findIndex(d=>!d.dataRef.current.disabled);c!==-1&&(i.activeOptionIndex=c)}let s=t.focus===Yt.Specific?t.idx:wd(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),u=(a=t.trigger)!=null?a:2;return e.activeOptionIndex===s&&e.activationTrigger===u?e:{...e,...i,isTyping:!1,activeOptionIndex:s,activationTrigger:u,__demoMode:!1}},4:(e,t)=>{var r,n,o;if((r=e.dataRef.current)!=null&&r.virtual)return{...e,options:[...e.options,t.payload]};let a=t.payload,i=Ck(e,u=>(u.push(a),u));e.activeOptionIndex===null&&(n=e.dataRef.current)!=null&&n.isSelected(t.payload.dataRef.current.value)&&(i.activeOptionIndex=i.options.indexOf(a));let s={...e,...i,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(s.activeOptionIndex=0),s},5:(e,t)=>{var r;if((r=e.dataRef.current)!=null&&r.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let n=Ck(e,o=>{let a=o.findIndex(i=>i.id===t.id);return a!==-1&&o.splice(a,1),o});return{...e,...n,activationTrigger:2}},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var r,n;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let o=e.activeOptionIndex;if(e.activeOptionIndex!==null){let a=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);a!==-1?o=a:o=null}return{...e,activeOptionIndex:o,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}}},8:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},9:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},10:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},zN=m.createContext(null);zN.displayName="ComboboxActionsContext";function Kf(e){let t=m.useContext(zN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Kf),r}return t}let aL=m.createContext(null);function lhe(e){let t=wc("VirtualProvider"),{options:r}=t.virtual,[n,o]=m.useMemo(()=>{let c=t.optionsElement;if(!c)return[0,0];let d=window.getComputedStyle(c);return[parseFloat(d.paddingBlockStart||d.paddingTop),parseFloat(d.paddingBlockEnd||d.paddingBottom)]},[t.optionsElement]),a=A$({enabled:r.length!==0,scrollPaddingStart:n,scrollPaddingEnd:o,count:r.length,estimateSize(){return 40},getScrollElement(){return t.optionsElement},overscan:12}),[i,s]=m.useState(0);Vt(()=>{s(c=>c+1)},[r]);let u=a.getVirtualItems();return u.length===0?null:y.createElement(aL.Provider,{value:a},y.createElement("div",{style:{position:"relative",width:"100%",height:`${a.getTotalSize()}px`},ref:c=>{c&&t.activationTrigger!==0&&t.activeOptionIndex!==null&&r.length>t.activeOptionIndex&&a.scrollToIndex(t.activeOptionIndex)}},u.map(c=>{var d;return y.createElement(m.Fragment,{key:c.key},y.cloneElement((d=e.children)==null?void 0:d.call(e,{...e.slot,option:r[c.index]}),{key:`${i}-${c.key}`,"data-index":c.index,"aria-setsize":r.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}}))})))}let hf=m.createContext(null);hf.displayName="ComboboxDataContext";function wc(e){let t=m.useContext(hf);if(t===null){let r=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,wc),r}return t}function uhe(e,t){return Jt(t.type,she,e,t)}let che=m.Fragment;function dhe(e,t){var r,n;let o=qf(),{value:a,defaultValue:i,onChange:s,form:u,name:c,by:d,disabled:f=o||!1,onClose:h,__demoMode:p=!1,multiple:g=!1,immediate:b=!1,virtual:v=null,nullable:x,...k}=e,E=EN(i),[j=g?[]:void 0,S]=jN(a,s,E),[C,O]=m.useReducer(uhe,{dataRef:m.createRef(),comboboxState:p?0:1,isTyping:!1,options:[],virtual:v?{options:v.options,disabled:(r=v.disabled)!=null?r:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:p}),M=m.useRef(!1),A=m.useRef({static:!1,hold:!1}),T=BD(d),_=Ae(ne=>v?d===null?v.options.indexOf(ne):v.options.findIndex(ge=>T(ge,ne)):C.options.findIndex(ge=>T(ge.dataRef.current.value,ne))),F=m.useCallback(ne=>Jt(I.mode,{1:()=>j.some(ge=>T(ge,ne)),0:()=>T(j,ne)}),[j]),$=Ae(ne=>C.activeOptionIndex===_(ne)),I=m.useMemo(()=>({...C,immediate:b,optionsPropsRef:A,value:j,defaultValue:E,disabled:f,mode:g?1:0,virtual:v?C.virtual:null,get activeOptionIndex(){if(M.current&&C.activeOptionIndex===null&&(v?v.options.length>0:C.options.length>0)){if(v){let ge=v.options.findIndex(Ee=>{var Pe,Ie;return!((Ie=(Pe=v.disabled)==null?void 0:Pe.call(v,Ee))!=null&&Ie)});if(ge!==-1)return ge}let ne=C.options.findIndex(ge=>!ge.dataRef.current.disabled);if(ne!==-1)return ne}return C.activeOptionIndex},calculateIndex:_,compare:T,isSelected:F,isActive:$}),[j,E,f,g,p,C,v]);Vt(()=>{var ne;v&&O({type:7,options:v.options,disabled:(ne=v.disabled)!=null?ne:null})},[v,v?.options,v?.disabled]),Vt(()=>{C.dataRef.current=I},[I]);let R=I.comboboxState===0;tb(R,[I.buttonElement,I.inputElement,I.optionsElement],()=>ue.closeCombobox());let W=m.useMemo(()=>{var ne,ge,Ee;return{open:I.comboboxState===0,disabled:f,activeIndex:I.activeOptionIndex,activeOption:I.activeOptionIndex===null?null:I.virtual?I.virtual.options[(ne=I.activeOptionIndex)!=null?ne:0]:(Ee=(ge=I.options[I.activeOptionIndex])==null?void 0:ge.dataRef.current.value)!=null?Ee:null,value:j}},[I,f,j]),B=Ae(()=>{if(I.activeOptionIndex!==null){if(ue.setIsTyping(!1),I.virtual)Y(I.virtual.options[I.activeOptionIndex]);else{let{dataRef:ne}=I.options[I.activeOptionIndex];Y(ne.current.value)}ue.goToOption(Yt.Specific,I.activeOptionIndex)}}),L=Ae(()=>{O({type:0}),M.current=!0}),q=Ae(()=>{O({type:1}),M.current=!1,h?.()}),U=Ae(ne=>{O({type:3,isTyping:ne})}),H=Ae((ne,ge,Ee)=>(M.current=!1,ne===Yt.Specific?O({type:2,focus:Yt.Specific,idx:ge,trigger:Ee}):O({type:2,focus:ne,trigger:Ee}))),X=Ae((ne,ge)=>(O({type:4,payload:{id:ne,dataRef:ge}}),()=>{I.isActive(ge.current.value)&&(M.current=!0),O({type:5,id:ne})})),Y=Ae(ne=>Jt(I.mode,{0(){return S?.(ne)},1(){let ge=I.value.slice(),Ee=ge.findIndex(Pe=>T(Pe,ne));return Ee===-1?ge.push(ne):ge.splice(Ee,1),S?.(ge)}})),ae=Ae(ne=>{O({type:6,trigger:ne})}),te=Ae(ne=>{O({type:8,element:ne})}),me=Ae(ne=>{O({type:9,element:ne})}),Q=Ae(ne=>{O({type:10,element:ne})}),ue=m.useMemo(()=>({onChange:Y,registerOption:X,goToOption:H,setIsTyping:U,closeCombobox:q,openCombobox:L,setActivationTrigger:ae,selectActiveOption:B,setInputElement:te,setButtonElement:me,setOptionsElement:Q}),[]),[G,de]=CN(),ie=t===null?{}:{ref:t},V=m.useCallback(()=>{if(E!==void 0)return S?.(E)},[S,E]),ee=Gt();return y.createElement(de,{value:G,props:{htmlFor:(n=I.inputElement)==null?void 0:n.id},slot:{open:I.comboboxState===0,disabled:f}},y.createElement(FN,null,y.createElement(zN.Provider,{value:ue},y.createElement(hf.Provider,{value:I},y.createElement(Vf,{value:Jt(I.comboboxState,{0:xr.Open,1:xr.Closed})},c!=null&&y.createElement(NN,{disabled:f,data:j!=null?{[c]:j}:{},form:u,onReset:V}),ee({ourProps:ie,theirProps:k,slot:W,defaultTag:che,name:"Combobox"}))))))}let fhe="input";function mhe(e,t){var r,n,o,a,i;let s=wc("Combobox.Input"),u=Kf("Combobox.Input"),c=m.useId(),d=Xg(),{id:f=d||`headlessui-combobox-input-${c}`,onChange:h,displayValue:p,disabled:g=s.disabled||!1,autoFocus:b=!1,type:v="text",...x}=e,k=m.useRef(null),E=er(k,t,DN(),u.setInputElement),j=sa(s.inputElement),S=$a(),C=Ae(()=>{u.onChange(null),s.optionsElement&&(s.optionsElement.scrollTop=0),u.goToOption(Yt.Nothing)}),O=m.useMemo(()=>{var Y;return typeof p=="function"&&s.value!==void 0?(Y=p(s.value))!=null?Y:"":typeof s.value=="string"?s.value:""},[s.value,p]);pf(([Y,ae],[te,me])=>{if(s.isTyping)return;let Q=k.current;Q&&((me===0&&ae===1||Y!==te)&&(Q.value=Y),requestAnimationFrame(()=>{if(s.isTyping||!Q||j?.activeElement!==Q)return;let{selectionStart:ue,selectionEnd:G}=Q;Math.abs((G??0)-(ue??0))===0&&ue===0&&Q.setSelectionRange(Q.value.length,Q.value.length)}))},[O,s.comboboxState,j,s.isTyping]),pf(([Y],[ae])=>{if(Y===0&&ae===1){if(s.isTyping)return;let te=k.current;if(!te)return;let me=te.value,{selectionStart:Q,selectionEnd:ue,selectionDirection:G}=te;te.value="",te.value=me,G!==null?te.setSelectionRange(Q,ue,G):te.setSelectionRange(Q,ue)}},[s.comboboxState]);let M=m.useRef(!1),A=Ae(()=>{M.current=!0}),T=Ae(()=>{S.nextFrame(()=>{M.current=!1})}),_=Ae(Y=>{switch(u.setIsTyping(!0),Y.key){case vt.Enter:if(s.comboboxState!==0||M.current)return;if(Y.preventDefault(),Y.stopPropagation(),s.activeOptionIndex===null){u.closeCombobox();return}u.selectActiveOption(),s.mode===0&&u.closeCombobox();break;case vt.ArrowDown:return Y.preventDefault(),Y.stopPropagation(),Jt(s.comboboxState,{0:()=>u.goToOption(Yt.Next),1:()=>u.openCombobox()});case vt.ArrowUp:return Y.preventDefault(),Y.stopPropagation(),Jt(s.comboboxState,{0:()=>u.goToOption(Yt.Previous),1:()=>{nr.flushSync(()=>u.openCombobox()),s.value||u.goToOption(Yt.Last)}});case vt.Home:if(Y.shiftKey)break;return Y.preventDefault(),Y.stopPropagation(),u.goToOption(Yt.First);case vt.PageUp:return Y.preventDefault(),Y.stopPropagation(),u.goToOption(Yt.First);case vt.End:if(Y.shiftKey)break;return Y.preventDefault(),Y.stopPropagation(),u.goToOption(Yt.Last);case vt.PageDown:return Y.preventDefault(),Y.stopPropagation(),u.goToOption(Yt.Last);case vt.Escape:return s.comboboxState!==0?void 0:(Y.preventDefault(),s.optionsElement&&!s.optionsPropsRef.current.static&&Y.stopPropagation(),s.mode===0&&s.value===null&&C(),u.closeCombobox());case vt.Tab:if(s.comboboxState!==0)return;s.mode===0&&s.activationTrigger!==1&&u.selectActiveOption(),u.closeCombobox();break}}),F=Ae(Y=>{h?.(Y),s.mode===0&&Y.target.value===""&&C(),u.openCombobox()}),$=Ae(Y=>{var ae,te,me;let Q=(ae=Y.relatedTarget)!=null?ae:ca.find(ue=>ue!==Y.currentTarget);if(!((te=s.optionsElement)!=null&&te.contains(Q))&&!((me=s.buttonElement)!=null&&me.contains(Q))&&s.comboboxState===0)return Y.preventDefault(),s.mode===0&&s.value===null&&C(),u.closeCombobox()}),I=Ae(Y=>{var ae,te,me;let Q=(ae=Y.relatedTarget)!=null?ae:ca.find(ue=>ue!==Y.currentTarget);(te=s.buttonElement)!=null&&te.contains(Q)||(me=s.optionsElement)!=null&&me.contains(Q)||s.disabled||s.immediate&&s.comboboxState!==0&&S.microTask(()=>{nr.flushSync(()=>u.openCombobox()),u.setActivationTrigger(1)})}),R=gc(),W=ON(),{isFocused:B,focusProps:L}=qo({autoFocus:b}),{isHovered:q,hoverProps:U}=oa({isDisabled:g}),H=m.useMemo(()=>({open:s.comboboxState===0,disabled:g,hover:q,focus:B,autofocus:b}),[s,q,B,b,g]),X=ia({ref:E,id:f,role:"combobox",type:v,"aria-controls":(r=s.optionsElement)==null?void 0:r.id,"aria-expanded":s.comboboxState===0,"aria-activedescendant":s.activeOptionIndex===null?void 0:s.virtual?(n=s.options.find(Y=>!Y.dataRef.current.disabled&&s.compare(Y.dataRef.current.value,s.virtual.options[s.activeOptionIndex])))==null?void 0:n.id:(o=s.options[s.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":R,"aria-describedby":W,"aria-autocomplete":"list",defaultValue:(i=(a=e.defaultValue)!=null?a:s.defaultValue!==void 0?p?.(s.defaultValue):null)!=null?i:s.defaultValue,disabled:g||void 0,autoFocus:b,onCompositionStart:A,onCompositionEnd:T,onKeyDown:_,onChange:F,onFocus:I,onBlur:$},L,U);return Gt()({ourProps:X,theirProps:x,slot:H,defaultTag:fhe,name:"Combobox.Input"})}let phe="button";function hhe(e,t){var r;let n=wc("Combobox.Button"),o=Kf("Combobox.Button"),a=er(t,o.setButtonElement),i=m.useId(),{id:s=`headlessui-combobox-button-${i}`,disabled:u=n.disabled||!1,autoFocus:c=!1,...d}=e,f=WD(n.inputElement),h=Ae(O=>{switch(O.key){case vt.Space:case vt.Enter:O.preventDefault(),O.stopPropagation(),n.comboboxState===1&&nr.flushSync(()=>o.openCombobox()),f();return;case vt.ArrowDown:O.preventDefault(),O.stopPropagation(),n.comboboxState===1&&(nr.flushSync(()=>o.openCombobox()),n.value||o.goToOption(Yt.First)),f();return;case vt.ArrowUp:O.preventDefault(),O.stopPropagation(),n.comboboxState===1&&(nr.flushSync(()=>o.openCombobox()),n.value||o.goToOption(Yt.Last)),f();return;case vt.Escape:if(n.comboboxState!==0)return;O.preventDefault(),n.optionsElement&&!n.optionsPropsRef.current.static&&O.stopPropagation(),nr.flushSync(()=>o.closeCombobox()),f();return;default:return}}),p=Ae(O=>{O.preventDefault(),!hc(O.currentTarget)&&(O.button===BN.Left&&(n.comboboxState===0?o.closeCombobox():o.openCombobox()),f())}),g=gc([s]),{isFocusVisible:b,focusProps:v}=qo({autoFocus:c}),{isHovered:x,hoverProps:k}=oa({isDisabled:u}),{pressed:E,pressProps:j}=pc({disabled:u}),S=m.useMemo(()=>({open:n.comboboxState===0,active:E||n.comboboxState===0,disabled:u,value:n.value,hover:x,focus:b}),[n,x,b,E,u]),C=ia({ref:a,id:s,type:vc(e,n.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(r=n.optionsElement)==null?void 0:r.id,"aria-expanded":n.comboboxState===0,"aria-labelledby":g,disabled:u||void 0,autoFocus:c,onMouseDown:p,onKeyDown:h},v,k,j);return Gt()({ourProps:C,theirProps:d,slot:S,defaultTag:phe,name:"Combobox.Button"})}let ghe="div",bhe=qn.RenderStrategy|qn.Static;function vhe(e,t){var r,n,o;let a=m.useId(),{id:i=`headlessui-combobox-options-${a}`,hold:s=!1,anchor:u,portal:c=!1,modal:d=!0,transition:f=!1,...h}=e,p=wc("Combobox.Options"),g=Kf("Combobox.Options"),b=IN(u);b&&(c=!0);let[v,x]=RN(b),[k,E]=m.useState(null),j=LN(),S=er(t,b?v:null,g.setOptionsElement,E),C=sa(p.optionsElement),O=Ni(),[M,A]=xc(f,k,O!==null?(O&xr.Open)===xr.Open:p.comboboxState===0);Qg(M,p.inputElement,g.closeCombobox);let T=p.__demoMode?!1:d&&p.comboboxState===0;nb(T,C);let _=p.__demoMode?!1:d&&p.comboboxState===0;TN(_,{allowed:m.useCallback(()=>[p.inputElement,p.buttonElement,p.optionsElement],[p.inputElement,p.buttonElement,p.optionsElement])}),Vt(()=>{var X;p.optionsPropsRef.current.static=(X=e.static)!=null?X:!1},[p.optionsPropsRef,e.static]),Vt(()=>{p.optionsPropsRef.current.hold=s},[p.optionsPropsRef,s]),xpe(p.comboboxState===0,{container:p.optionsElement,accept(X){return X.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:X.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(X){X.setAttribute("role","none")}});let F=gc([(r=p.buttonElement)==null?void 0:r.id]),$=m.useMemo(()=>({open:p.comboboxState===0,option:void 0}),[p.comboboxState]),I=Ae(()=>{g.setActivationTrigger(0)}),R=Ae(X=>{X.preventDefault(),g.setActivationTrigger(0)}),W=ia(b?j():{},{"aria-labelledby":F,role:"listbox","aria-multiselectable":p.mode===1?!0:void 0,id:i,ref:S,style:{...h.style,...x,"--input-width":Ch(p.inputElement,!0).width,"--button-width":Ch(p.buttonElement,!0).width},onWheel:p.activationTrigger===0?void 0:I,onMouseDown:R,...yc(A)}),B=M&&p.comboboxState===1,L=Th(B,(n=p.virtual)==null?void 0:n.options),q=Th(B,p.value),U=Ae(X=>p.compare(q,X));if(p.virtual){if(L===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(h,{children:y.createElement(hf.Provider,{value:L!==p.virtual.options?{...p,virtual:{...p.virtual,options:L}}:p},y.createElement(lhe,{slot:$},h.children))})}let H=Gt();return y.createElement(ab,{enabled:c?e.static||M:!1},y.createElement(hf.Provider,{value:p.mode===1?p:{...p,isSelected:U}},H({ourProps:W,theirProps:{...h,children:y.createElement(Wpe,{freeze:B},typeof h.children=="function"?(o=h.children)==null?void 0:o.call(h,$):h.children)},slot:$,defaultTag:ghe,features:bhe,visible:M,name:"Combobox.Options"})))}let yhe="div";function xhe(e,t){var r,n,o,a;let i=wc("Combobox.Option"),s=Kf("Combobox.Option"),u=m.useId(),{id:c=`headlessui-combobox-option-${u}`,value:d,disabled:f=(o=(n=(r=i.virtual)==null?void 0:r.disabled)==null?void 0:n.call(r,d))!=null?o:!1,order:h=null,...p}=e,g=WD(i.inputElement),b=i.virtual?i.activeOptionIndex===i.calculateIndex(d):i.activeOptionIndex===null?!1:((a=i.options[i.activeOptionIndex])==null?void 0:a.id)===c,v=i.isSelected(d),x=m.useRef(null),k=Zn({disabled:f,value:d,domRef:x,order:h}),E=m.useContext(aL),j=er(t,x,E?E.measureElement:null),S=Ae(()=>{s.setIsTyping(!1),s.onChange(d)});Vt(()=>s.registerOption(c,k),[k,c]);let C=m.useRef(!(i.virtual||i.__demoMode));Vt(()=>{if(!i.virtual&&!i.__demoMode)return ra().requestAnimationFrame(()=>{C.current=!0})},[i.virtual,i.__demoMode]),Vt(()=>{if(C.current&&i.comboboxState===0&&b&&i.activationTrigger!==0)return ra().requestAnimationFrame(()=>{var R,W;(W=(R=x.current)==null?void 0:R.scrollIntoView)==null||W.call(R,{block:"nearest"})})},[x,b,i.comboboxState,i.activationTrigger,i.activeOptionIndex]);let O=Ae(R=>{R.preventDefault(),R.button===BN.Left&&(f||(S(),UD()||requestAnimationFrame(()=>g()),i.mode===0&&s.closeCombobox()))}),M=Ae(()=>{if(f)return s.goToOption(Yt.Nothing);let R=i.calculateIndex(d);s.goToOption(Yt.Specific,R)}),A=KD(),T=Ae(R=>A.update(R)),_=Ae(R=>{if(!A.wasMoved(R)||f||b)return;let W=i.calculateIndex(d);s.goToOption(Yt.Specific,W,0)}),F=Ae(R=>{A.wasMoved(R)&&(f||b&&(i.optionsPropsRef.current.hold||s.goToOption(Yt.Nothing)))}),$=m.useMemo(()=>({active:b,focus:b,selected:v,disabled:f}),[b,v,f]),I={id:c,ref:j,role:"option",tabIndex:f===!0?void 0:-1,"aria-disabled":f===!0?!0:void 0,"aria-selected":v,disabled:void 0,onMouseDown:O,onFocus:M,onPointerEnter:T,onMouseEnter:T,onPointerMove:_,onMouseMove:_,onPointerLeave:F,onMouseLeave:F};return Gt()({ourProps:I,theirProps:p,slot:$,defaultTag:yhe,name:"Combobox.Option"})}let khe=qt(dhe),iL=qt(hhe),sL=qt(mhe),whe=PN,lL=qt(vhe),uL=qt(xhe),jhe=Object.assign(khe,{Input:sL,Button:iL,Label:whe,Options:lL,Option:uL});function Ehe(e,t=typeof document<"u"?document.defaultView:null,r){let n=bc(e,"escape");rb(t,"keydown",o=>{n&&(o.defaultPrevented||o.key===vt.Escape&&r(o))})}function Nhe(){var e;let[t]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[r,n]=m.useState((e=t?.matches)!=null?e:!1);return Vt(()=>{if(!t)return;function o(a){n(a.matches)}return t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[t]),r}function cL({defaultContainers:e=[],portals:t,mainTreeNode:r}={}){let n=sa(r),o=Ae(()=>{var a,i;let s=[];for(let u of e)u!==null&&(u instanceof HTMLElement?s.push(u):"current"in u&&u.current instanceof HTMLElement&&s.push(u.current));if(t!=null&&t.current)for(let u of t.current)s.push(u);for(let u of(a=n?.querySelectorAll("html > *, body > *"))!=null?a:[])u!==document.body&&u!==document.head&&u instanceof HTMLElement&&u.id!=="headlessui-portal-root"&&(r&&(u.contains(r)||u.contains((i=r?.getRootNode())==null?void 0:i.host))||s.some(c=>u.contains(c))||s.push(u));return s});return{resolveContainers:o,contains:Ae(a=>o().some(i=>i.contains(a)))}}let dL=m.createContext(null);function Mh({children:e,node:t}){let[r,n]=m.useState(null),o=HN(t??r);return y.createElement(dL.Provider,{value:o},e,o===null&&y.createElement(_a,{features:Ma.Hidden,ref:a=>{var i,s;if(a){for(let u of(s=(i=Fa(a))==null?void 0:i.querySelectorAll("html > *, body > *"))!=null?s:[])if(u!==document.body&&u!==document.head&&u instanceof HTMLElement&&u!=null&&u.contains(a)){n(u);break}}}}))}function HN(e=null){var t;return(t=m.useContext(dL))!=null?t:e}function ib(){let e=m.useRef(!1);return Vt(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var No=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(No||{});function qN(){let e=m.useRef(0);return VD(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function fL(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let r of e.current)r.current instanceof HTMLElement&&t.add(r.current);return t}let She="div";var qs=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(qs||{});function Ohe(e,t){let r=m.useRef(null),n=er(r,t),{initialFocus:o,initialFocusFallback:a,containers:i,features:s=15,...u}=e;Wf()||(s=0);let c=sa(r);The(s,{ownerDocument:c});let d=Mhe(s,{ownerDocument:c,container:r,initialFocus:o,initialFocusFallback:a});_he(s,{ownerDocument:c,container:r,containers:i,previousActiveElement:d});let f=qN(),h=Ae(k=>{let E=r.current;E&&(j=>j())(()=>{Jt(f.current,{[No.Forwards]:()=>{bn(E,yr.First,{skipElements:[k.relatedTarget,a]})},[No.Backwards]:()=>{bn(E,yr.Last,{skipElements:[k.relatedTarget,a]})}})})}),p=bc(!!(s&2),"focus-trap#tab-lock"),g=$a(),b=m.useRef(!1),v={ref:n,onKeyDown(k){k.key=="Tab"&&(b.current=!0,g.requestAnimationFrame(()=>{b.current=!1}))},onBlur(k){if(!(s&4))return;let E=fL(i);r.current instanceof HTMLElement&&E.add(r.current);let j=k.relatedTarget;j instanceof HTMLElement&&j.dataset.headlessuiFocusGuard!=="true"&&(mL(E,j)||(b.current?bn(r.current,Jt(f.current,{[No.Forwards]:()=>yr.Next,[No.Backwards]:()=>yr.Previous})|yr.WrapAround,{relativeTo:k.target}):k.target instanceof HTMLElement&&ri(k.target)))}},x=Gt();return y.createElement(y.Fragment,null,p&&y.createElement(_a,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:h,features:Ma.Focusable}),x({ourProps:v,theirProps:u,defaultTag:She,name:"FocusTrap"}),p&&y.createElement(_a,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:h,features:Ma.Focusable}))}let Che=qt(Ohe),Phe=Object.assign(Che,{features:qs});function Ahe(e=!0){let t=m.useRef(ca.slice());return pf(([r],[n])=>{n===!0&&r===!1&&Hf(()=>{t.current.splice(0)}),n===!1&&r===!0&&(t.current=ca.slice())},[e,ca,t]),Ae(()=>{var r;return(r=t.current.find(n=>n!=null&&n.isConnected))!=null?r:null})}function The(e,{ownerDocument:t}){let r=!!(e&8),n=Ahe(r);pf(()=>{r||t?.activeElement===t?.body&&ri(n())},[r]),QD(()=>{r&&ri(n())})}function Mhe(e,{ownerDocument:t,container:r,initialFocus:n,initialFocusFallback:o}){let a=m.useRef(null),i=bc(!!(e&1),"focus-trap#initial-focus"),s=ib();return pf(()=>{if(e===0)return;if(!i){o!=null&&o.current&&ri(o.current);return}let u=r.current;u&&Hf(()=>{if(!s.current)return;let c=t?.activeElement;if(n!=null&&n.current){if(n?.current===c){a.current=c;return}}else if(u.contains(c)){a.current=c;return}if(n!=null&&n.current)ri(n.current);else{if(e&16){if(bn(u,yr.First|yr.AutoFocus)!==ha.Error)return}else if(bn(u,yr.First)!==ha.Error)return;if(o!=null&&o.current&&(ri(o.current),t?.activeElement===o.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}a.current=t?.activeElement})},[o,i,e]),a}function _he(e,{ownerDocument:t,container:r,containers:n,previousActiveElement:o}){let a=ib(),i=!!(e&4);rb(t?.defaultView,"focus",s=>{if(!i||!a.current)return;let u=fL(n);r.current instanceof HTMLElement&&u.add(r.current);let c=o.current;if(!c)return;let d=s.target;d&&d instanceof HTMLElement?mL(u,d)?(o.current=d,ri(d)):(s.preventDefault(),s.stopPropagation(),ri(c)):ri(o.current)},!0)}function mL(e,t){for(let r of e)if(r.contains(t))return!0;return!1}function pL(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:gL)!==m.Fragment||y.Children.count(e.children)===1}let sb=m.createContext(null);sb.displayName="TransitionContext";var Ihe=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Ihe||{});function Dhe(){let e=m.useContext(sb);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Lhe(){let e=m.useContext(lb);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let lb=m.createContext(null);lb.displayName="NestingContext";function ub(e){return"children"in e?ub(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function hL(e,t){let r=Zn(e),n=m.useRef([]),o=ib(),a=$a(),i=Ae((p,g=Gi.Hidden)=>{let b=n.current.findIndex(({el:v})=>v===p);b!==-1&&(Jt(g,{[Gi.Unmount](){n.current.splice(b,1)},[Gi.Hidden](){n.current[b].state="hidden"}}),a.microTask(()=>{var v;!ub(n)&&o.current&&((v=r.current)==null||v.call(r))}))}),s=Ae(p=>{let g=n.current.find(({el:b})=>b===p);return g?g.state!=="visible"&&(g.state="visible"):n.current.push({el:p,state:"visible"}),()=>i(p,Gi.Unmount)}),u=m.useRef([]),c=m.useRef(Promise.resolve()),d=m.useRef({enter:[],leave:[]}),f=Ae((p,g,b)=>{u.current.splice(0),t&&(t.chains.current[g]=t.chains.current[g].filter(([v])=>v!==p)),t?.chains.current[g].push([p,new Promise(v=>{u.current.push(v)})]),t?.chains.current[g].push([p,new Promise(v=>{Promise.all(d.current[g].map(([x,k])=>k)).then(()=>v())})]),g==="enter"?c.current=c.current.then(()=>t?.wait.current).then(()=>b(g)):b(g)}),h=Ae((p,g,b)=>{Promise.all(d.current[g].splice(0).map(([v,x])=>x)).then(()=>{var v;(v=u.current.shift())==null||v()}).then(()=>b(g))});return m.useMemo(()=>({children:n,register:s,unregister:i,onStart:f,onStop:h,wait:c,chains:d}),[s,i,n,f,h,d,c])}let gL=m.Fragment,bL=qn.RenderStrategy;function Rhe(e,t){var r,n;let{transition:o=!0,beforeEnter:a,afterEnter:i,beforeLeave:s,afterLeave:u,enter:c,enterFrom:d,enterTo:f,entered:h,leave:p,leaveFrom:g,leaveTo:b,...v}=e,[x,k]=m.useState(null),E=m.useRef(null),j=pL(e),S=er(...j?[E,t,k]:t===null?[]:[t]),C=(r=v.unmount)==null||r?Gi.Unmount:Gi.Hidden,{show:O,appear:M,initial:A}=Dhe(),[T,_]=m.useState(O?"visible":"hidden"),F=Lhe(),{register:$,unregister:I}=F;Vt(()=>$(E),[$,E]),Vt(()=>{if(C===Gi.Hidden&&E.current){if(O&&T!=="visible"){_("visible");return}return Jt(T,{hidden:()=>I(E),visible:()=>$(E)})}},[T,E,$,I,O,C]);let R=Wf();Vt(()=>{if(j&&R&&T==="visible"&&E.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[E,T,R,j]);let W=A&&!M,B=M&&O&&A,L=m.useRef(!1),q=hL(()=>{L.current||(_("hidden"),I(E))},F),U=Ae(Q=>{L.current=!0;let ue=Q?"enter":"leave";q.onStart(E,ue,G=>{G==="enter"?a?.():G==="leave"&&s?.()})}),H=Ae(Q=>{let ue=Q?"enter":"leave";L.current=!1,q.onStop(E,ue,G=>{G==="enter"?i?.():G==="leave"&&u?.()}),ue==="leave"&&!ub(q)&&(_("hidden"),I(E))});m.useEffect(()=>{j&&o||(U(O),H(O))},[O,j,o]);let X=!(!o||!j||!R||W),[,Y]=xc(X,x,O,{start:U,end:H}),ae=Bi({ref:S,className:((n=J2(v.className,B&&c,B&&d,Y.enter&&c,Y.enter&&Y.closed&&d,Y.enter&&!Y.closed&&f,Y.leave&&p,Y.leave&&!Y.closed&&g,Y.leave&&Y.closed&&b,!Y.transition&&O&&h))==null?void 0:n.trim())||void 0,...yc(Y)}),te=0;T==="visible"&&(te|=xr.Open),T==="hidden"&&(te|=xr.Closed),Y.enter&&(te|=xr.Opening),Y.leave&&(te|=xr.Closing);let me=Gt();return y.createElement(lb.Provider,{value:q},y.createElement(Vf,{value:te},me({ourProps:ae,theirProps:v,defaultTag:gL,features:bL,visible:T==="visible",name:"Transition.Child"})))}function Fhe(e,t){let{show:r,appear:n=!1,unmount:o=!0,...a}=e,i=m.useRef(null),s=pL(e),u=er(...s?[i,t]:t===null?[]:[t]);Wf();let c=Ni();if(r===void 0&&c!==null&&(r=(c&xr.Open)===xr.Open),r===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[d,f]=m.useState(r?"visible":"hidden"),h=hL(()=>{r||f("hidden")}),[p,g]=m.useState(!0),b=m.useRef([r]);Vt(()=>{p!==!1&&b.current[b.current.length-1]!==r&&(b.current.push(r),g(!1))},[b,r]);let v=m.useMemo(()=>({show:r,appear:n,initial:p}),[r,n,p]);Vt(()=>{r?f("visible"):!ub(h)&&i.current!==null&&f("hidden")},[r,h]);let x={unmount:o},k=Ae(()=>{var S;p&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),E=Ae(()=>{var S;p&&g(!1),(S=e.beforeLeave)==null||S.call(e)}),j=Gt();return y.createElement(lb.Provider,{value:h},y.createElement(sb.Provider,{value:v},j({ourProps:{...x,as:m.Fragment,children:y.createElement(vL,{ref:u,...x,...a,beforeEnter:k,beforeLeave:E})},theirProps:{},defaultTag:m.Fragment,features:bL,visible:d==="visible",name:"Transition"})))}function $he(e,t){let r=m.useContext(sb)!==null,n=Ni()!==null;return y.createElement(y.Fragment,null,!r&&n?y.createElement(rj,{ref:t,...e}):y.createElement(vL,{ref:t,...e}))}let rj=qt(Fhe),vL=qt(Rhe),cb=qt($he),ms=Object.assign(rj,{Child:cb,Root:rj});var Bhe=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Bhe||{}),zhe=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(zhe||{});let Hhe={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},UN=m.createContext(null);UN.displayName="DialogContext";function db(e){let t=m.useContext(UN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,db),r}return t}function qhe(e,t){return Jt(t.type,Hhe,e,t)}let eA=qt(function(e,t){let r=m.useId(),{id:n=`headlessui-dialog-${r}`,open:o,onClose:a,initialFocus:i,role:s="dialog",autoFocus:u=!0,__demoMode:c=!1,unmount:d=!1,...f}=e,h=m.useRef(!1);s=function(){return s==="dialog"||s==="alertdialog"?s:(h.current||(h.current=!0,console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let p=Ni();o===void 0&&p!==null&&(o=(p&xr.Open)===xr.Open);let g=m.useRef(null),b=er(g,t),v=sa(g),x=o?0:1,[k,E]=m.useReducer(qhe,{titleId:null,descriptionId:null,panelRef:m.createRef()}),j=Ae(()=>a(!1)),S=Ae(H=>E({type:0,id:H})),C=Wf()?x===0:!1,[O,M]=nL(),A={get current(){var H;return(H=k.panelRef.current)!=null?H:g.current}},T=HN(),{resolveContainers:_}=cL({mainTreeNode:T,portals:O,defaultContainers:[A]}),F=p!==null?(p&xr.Closing)===xr.Closing:!1;TN(c||F?!1:C,{allowed:Ae(()=>{var H,X;return[(X=(H=g.current)==null?void 0:H.closest("[data-headlessui-portal]"))!=null?X:null]}),disallowed:Ae(()=>{var H;return[(H=T?.closest("body > *:not(#headlessui-portal-root)"))!=null?H:null]})}),tb(C,_,H=>{H.preventDefault(),j()}),Ehe(C,v?.defaultView,H=>{H.preventDefault(),H.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),j()}),nb(c||F?!1:C,v,_),Qg(C,g,j);let[$,I]=RD(),R=m.useMemo(()=>[{dialogState:x,close:j,setTitleId:S,unmount:d},k],[x,k,j,S,d]),W=m.useMemo(()=>({open:x===0}),[x]),B={ref:b,id:n,role:s,tabIndex:-1,"aria-modal":c?void 0:x===0?!0:void 0,"aria-labelledby":k.titleId,"aria-describedby":$,unmount:d},L=!Nhe(),q=qs.None;C&&!c&&(q|=qs.RestoreFocus,q|=qs.TabLock,u&&(q|=qs.AutoFocus),L&&(q|=qs.InitialFocus));let U=Gt();return y.createElement($N,null,y.createElement(Q7,{force:!0},y.createElement(ab,null,y.createElement(UN.Provider,{value:R},y.createElement(oL,{target:g},y.createElement(Q7,{force:!1},y.createElement(I,{slot:W},y.createElement(M,null,y.createElement(Phe,{initialFocus:i,initialFocusFallback:g,containers:_,features:q},y.createElement(AN,{value:j},U({ourProps:B,theirProps:f,slot:W,defaultTag:Uhe,features:Vhe,visible:x===0,name:"Dialog"})))))))))))}),Uhe="div",Vhe=qn.RenderStrategy|qn.Static;function Whe(e,t){let{transition:r=!1,open:n,...o}=e,a=Ni(),i=e.hasOwnProperty("open")||a!==null,s=e.hasOwnProperty("onClose");if(!i&&!s)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!i)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!s)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!a&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(n!==void 0||r)&&!o.static?y.createElement(Mh,null,y.createElement(ms,{show:n,transition:r,unmount:o.unmount},y.createElement(eA,{ref:t,...o}))):y.createElement(Mh,null,y.createElement(eA,{ref:t,open:n,...o}))}let Khe="div";function Yhe(e,t){let r=m.useId(),{id:n=`headlessui-dialog-panel-${r}`,transition:o=!1,...a}=e,[{dialogState:i,unmount:s},u]=db("Dialog.Panel"),c=er(t,u.panelRef),d=m.useMemo(()=>({open:i===0}),[i]),f=Ae(v=>{v.stopPropagation()}),h={ref:c,id:n,onClick:f},p=o?cb:m.Fragment,g=o?{unmount:s}:{},b=Gt();return y.createElement(p,{...g},b({ourProps:h,theirProps:a,slot:d,defaultTag:Khe,name:"Dialog.Panel"}))}let Ghe="div";function Xhe(e,t){let{transition:r=!1,...n}=e,[{dialogState:o,unmount:a}]=db("Dialog.Backdrop"),i=m.useMemo(()=>({open:o===0}),[o]),s={ref:t,"aria-hidden":!0},u=r?cb:m.Fragment,c=r?{unmount:a}:{},d=Gt();return y.createElement(u,{...c},d({ourProps:s,theirProps:n,slot:i,defaultTag:Ghe,name:"Dialog.Backdrop"}))}let Zhe="h2";function Jhe(e,t){let r=m.useId(),{id:n=`headlessui-dialog-title-${r}`,...o}=e,[{dialogState:a,setTitleId:i}]=db("Dialog.Title"),s=er(t);m.useEffect(()=>(i(n),()=>i(null)),[n,i]);let u=m.useMemo(()=>({open:a===0}),[a]),c={ref:s,id:n};return Gt()({ourProps:c,theirProps:o,slot:u,defaultTag:Zhe,name:"Dialog.Title"})}let Qhe=qt(Whe),yL=qt(Yhe),ege=qt(Xhe),tge=qt(Jhe),rge=Object.assign(Qhe,{Panel:yL,Title:tge,Description:FD});var tA;let nge=(tA=y.startTransition)!=null?tA:function(e){e()};var oge=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(oge||{}),age=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.SetButtonElement=4]="SetButtonElement",e[e.SetPanelElement=5]="SetPanelElement",e))(age||{});let ige={0:e=>({...e,disclosureState:Jt(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}},4(e,t){return e.buttonElement===t.element?e:{...e,buttonElement:t.element}},5(e,t){return e.panelElement===t.element?e:{...e,panelElement:t.element}}},VN=m.createContext(null);VN.displayName="DisclosureContext";function WN(e){let t=m.useContext(VN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,WN),r}return t}let KN=m.createContext(null);KN.displayName="DisclosureAPIContext";function xL(e){let t=m.useContext(KN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,xL),r}return t}let YN=m.createContext(null);YN.displayName="DisclosurePanelContext";function sge(){return m.useContext(YN)}function lge(e,t){return Jt(t.type,ige,e,t)}let uge=m.Fragment;function cge(e,t){let{defaultOpen:r=!1,...n}=e,o=m.useRef(null),a=er(t,SN(b=>{o.current=b},e.as===void 0||e.as===m.Fragment)),i=m.useReducer(lge,{disclosureState:r?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:s,buttonId:u},c]=i,d=Ae(b=>{c({type:1});let v=Fa(o);if(!v||!u)return;let x=b?b instanceof HTMLElement?b:b.current instanceof HTMLElement?b.current:v.getElementById(u):v.getElementById(u);x?.focus()}),f=m.useMemo(()=>({close:d}),[d]),h=m.useMemo(()=>({open:s===0,close:d}),[s,d]),p={ref:a},g=Gt();return y.createElement(VN.Provider,{value:i},y.createElement(KN.Provider,{value:f},y.createElement(AN,{value:d},y.createElement(Vf,{value:Jt(s,{0:xr.Open,1:xr.Closed})},g({ourProps:p,theirProps:n,slot:h,defaultTag:uge,name:"Disclosure"})))))}let dge="button";function fge(e,t){let r=m.useId(),{id:n=`headlessui-disclosure-button-${r}`,disabled:o=!1,autoFocus:a=!1,...i}=e,[s,u]=WN("Disclosure.Button"),c=sge(),d=c===null?!1:c===s.panelId,f=m.useRef(null),h=er(f,t,Ae(A=>{if(!d)return u({type:4,element:A})}));m.useEffect(()=>{if(!d)return u({type:2,buttonId:n}),()=>{u({type:2,buttonId:null})}},[n,u,d]);let p=Ae(A=>{var T;if(d){if(s.disclosureState===1)return;switch(A.key){case vt.Space:case vt.Enter:A.preventDefault(),A.stopPropagation(),u({type:0}),(T=s.buttonElement)==null||T.focus();break}}else switch(A.key){case vt.Space:case vt.Enter:A.preventDefault(),A.stopPropagation(),u({type:0});break}}),g=Ae(A=>{switch(A.key){case vt.Space:A.preventDefault();break}}),b=Ae(A=>{var T;hc(A.currentTarget)||o||(d?(u({type:0}),(T=s.buttonElement)==null||T.focus()):u({type:0}))}),{isFocusVisible:v,focusProps:x}=qo({autoFocus:a}),{isHovered:k,hoverProps:E}=oa({isDisabled:o}),{pressed:j,pressProps:S}=pc({disabled:o}),C=m.useMemo(()=>({open:s.disclosureState===0,hover:k,active:j,disabled:o,focus:v,autofocus:a}),[s,k,j,v,o,a]),O=vc(e,s.buttonElement),M=ia(d?{ref:h,type:O,disabled:o||void 0,autoFocus:a,onKeyDown:p,onClick:b}:{ref:h,id:n,type:O,"aria-expanded":s.disclosureState===0,"aria-controls":s.panelElement?s.panelId:void 0,disabled:o||void 0,autoFocus:a,onKeyDown:p,onKeyUp:g,onClick:b},x,E,S);return Gt()({ourProps:M,theirProps:i,slot:C,defaultTag:dge,name:"Disclosure.Button"})}let mge="div",pge=qn.RenderStrategy|qn.Static;function hge(e,t){let r=m.useId(),{id:n=`headlessui-disclosure-panel-${r}`,transition:o=!1,...a}=e,[i,s]=WN("Disclosure.Panel"),{close:u}=xL("Disclosure.Panel"),[c,d]=m.useState(null),f=er(t,Ae(k=>{nge(()=>s({type:5,element:k}))}),d);m.useEffect(()=>(s({type:3,panelId:n}),()=>{s({type:3,panelId:null})}),[n,s]);let h=Ni(),[p,g]=xc(o,c,h!==null?(h&xr.Open)===xr.Open:i.disclosureState===0),b=m.useMemo(()=>({open:i.disclosureState===0,close:u}),[i.disclosureState,u]),v={ref:f,id:n,...yc(g)},x=Gt();return y.createElement($N,null,y.createElement(YN.Provider,{value:i.panelId},x({ourProps:v,theirProps:a,slot:b,defaultTag:mge,features:pge,visible:p,name:"Disclosure.Panel"})))}let gge=qt(cge),bge=qt(fge),vge=qt(hge),GN=Object.assign(gge,{Button:bge,Panel:vge});function yge(e,t){let r=m.useRef({left:0,top:0});if(Vt(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(r.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let n=t.getBoundingClientRect();return n.top!==r.current.top||n.left!==r.current.left}let rA=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function nA(e){var t,r;let n=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!(o instanceof HTMLElement))return n;let a=!1;for(let s of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))s.remove(),a=!0;let i=a?(r=o.innerText)!=null?r:"":n;return rA.test(i)&&(i=i.replace(rA,"")),i}function xge(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let r=e.getAttribute("aria-labelledby");if(r){let n=r.split(" ").map(o=>{let a=document.getElementById(o);if(a){let i=a.getAttribute("aria-label");return typeof i=="string"?i.trim():nA(a).trim()}return null}).filter(Boolean);if(n.length>0)return n.join(", ")}return nA(e).trim()}function kge(e){let t=m.useRef(""),r=m.useRef("");return Ae(()=>{let n=e.current;if(!n)return"";let o=n.innerText;if(t.current===o)return r.current;let a=xge(n).trim().toLowerCase();return t.current=o,r.current=a,a})}var wge=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(wge||{}),jge=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(jge||{}),Ege=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Ege||{}),Nge=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e))(Nge||{});function Pk(e,t=r=>r){let r=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,n=Xi(t(e.options.slice()),a=>a.dataRef.current.domRef.current),o=r?n.indexOf(r):null;return o===-1&&(o=null),{options:n,activeOptionIndex:o}}let Sge={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1,__demoMode:!1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,n=e.options.findIndex(o=>r(o.dataRef.current.value));return n!==-1&&(t=n),{...e,listboxState:0,activeOptionIndex:t,__demoMode:!1}},2(e,t){var r,n,o,a,i;if(e.dataRef.current.disabled||e.listboxState===1)return e;let s={...e,searchQuery:"",activationTrigger:(r=t.trigger)!=null?r:1,__demoMode:!1};if(t.focus===Yt.Nothing)return{...s,activeOptionIndex:null};if(t.focus===Yt.Specific)return{...s,activeOptionIndex:e.options.findIndex(d=>d.id===t.id)};if(t.focus===Yt.Previous){let d=e.activeOptionIndex;if(d!==null){let f=e.options[d].dataRef.current.domRef,h=wd(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(h!==null){let p=e.options[h].dataRef.current.domRef;if(((n=f.current)==null?void 0:n.previousElementSibling)===p.current||((o=p.current)==null?void 0:o.previousElementSibling)===null)return{...s,activeOptionIndex:h}}}}else if(t.focus===Yt.Next){let d=e.activeOptionIndex;if(d!==null){let f=e.options[d].dataRef.current.domRef,h=wd(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(h!==null){let p=e.options[h].dataRef.current.domRef;if(((a=f.current)==null?void 0:a.nextElementSibling)===p.current||((i=p.current)==null?void 0:i.nextElementSibling)===null)return{...s,activeOptionIndex:h}}}}let u=Pk(e),c=wd(t,{resolveItems:()=>u.options,resolveActiveIndex:()=>u.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...s,...u,activeOptionIndex:c}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=e.searchQuery!==""?0:1,n=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+r).concat(e.options.slice(0,e.activeOptionIndex+r)):e.options).find(i=>{var s;return!i.dataRef.current.disabled&&((s=i.dataRef.current.textValue)==null?void 0:s.startsWith(n))}),a=o?e.options.indexOf(o):-1;return a===-1||a===e.activeOptionIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeOptionIndex:a,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let r={id:t.id,dataRef:t.dataRef},n=Pk(e,o=>[...o,r]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(n.activeOptionIndex=n.options.indexOf(r)),{...e,...n}},6:(e,t)=>{let r=Pk(e,n=>{let o=n.findIndex(a=>a.id===t.id);return o!==-1&&n.splice(o,1),n});return{...e,...r,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},XN=m.createContext(null);XN.displayName="ListboxActionsContext";function fb(e){let t=m.useContext(XN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,fb),r}return t}let mb=m.createContext(null);mb.displayName="ListboxDataContext";function Yf(e){let t=m.useContext(mb);if(t===null){let r=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Yf),r}return t}function Oge(e,t){return Jt(t.type,Sge,e,t)}let Cge=m.Fragment;function Pge(e,t){var r;let n=qf(),{value:o,defaultValue:a,form:i,name:s,onChange:u,by:c,invalid:d=!1,disabled:f=n||!1,horizontal:h=!1,multiple:p=!1,__demoMode:g=!1,...b}=e;const v=h?"horizontal":"vertical";let x=er(t),k=EN(a),[E=p?[]:void 0,j]=jN(o,u,k),[S,C]=m.useReducer(Oge,{dataRef:m.createRef(),listboxState:g?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,optionsVisible:!1,buttonElement:null,optionsElement:null,__demoMode:g}),O=m.useRef({static:!1,hold:!1}),M=m.useRef(new Map),A=BD(c),T=m.useCallback(V=>Jt(_.mode,{1:()=>E.some(ee=>A(ee,V)),0:()=>A(E,V)}),[E]),_=m.useMemo(()=>({...S,value:E,disabled:f,invalid:d,mode:p?1:0,orientation:v,compare:A,isSelected:T,optionsPropsRef:O,listRef:M}),[E,f,d,p,S,M]);Vt(()=>{S.dataRef.current=_},[_]);let F=_.listboxState===0;tb(F,[_.buttonElement,_.optionsElement],(V,ee)=>{var ne;C({type:1}),MN(ee,eb.Loose)||(V.preventDefault(),(ne=_.buttonElement)==null||ne.focus())});let $=m.useMemo(()=>({open:_.listboxState===0,disabled:f,invalid:d,value:E}),[_,f,E,d]),I=Ae(V=>{let ee=_.options.find(ne=>ne.id===V);ee&&H(ee.dataRef.current.value)}),R=Ae(()=>{if(_.activeOptionIndex!==null){let{dataRef:V,id:ee}=_.options[_.activeOptionIndex];H(V.current.value),C({type:2,focus:Yt.Specific,id:ee})}}),W=Ae(()=>C({type:0})),B=Ae(()=>C({type:1})),L=$a(),q=Ae((V,ee,ne)=>{L.dispose(),L.microTask(()=>V===Yt.Specific?C({type:2,focus:Yt.Specific,id:ee,trigger:ne}):C({type:2,focus:V,trigger:ne}))}),U=Ae((V,ee)=>(C({type:5,id:V,dataRef:ee}),()=>C({type:6,id:V}))),H=Ae(V=>Jt(_.mode,{0(){return j?.(V)},1(){let ee=_.value.slice(),ne=ee.findIndex(ge=>A(ge,V));return ne===-1?ee.push(V):ee.splice(ne,1),j?.(ee)}})),X=Ae(V=>C({type:3,value:V})),Y=Ae(()=>C({type:4})),ae=Ae(V=>{C({type:7,element:V})}),te=Ae(V=>{C({type:8,element:V})}),me=m.useMemo(()=>({onChange:H,registerOption:U,goToOption:q,closeListbox:B,openListbox:W,selectActiveOption:R,selectOption:I,search:X,clearSearch:Y,setButtonElement:ae,setOptionsElement:te}),[]),[Q,ue]=CN({inherit:!0}),G={ref:x},de=m.useCallback(()=>{if(k!==void 0)return j?.(k)},[j,k]),ie=Gt();return y.createElement(ue,{value:Q,props:{htmlFor:(r=_.buttonElement)==null?void 0:r.id},slot:{open:_.listboxState===0,disabled:f}},y.createElement(FN,null,y.createElement(XN.Provider,{value:me},y.createElement(mb.Provider,{value:_},y.createElement(Vf,{value:Jt(_.listboxState,{0:xr.Open,1:xr.Closed})},s!=null&&E!=null&&y.createElement(NN,{disabled:f,data:{[s]:E},form:i,onReset:de}),ie({ourProps:G,theirProps:b,slot:$,defaultTag:Cge,name:"Listbox"}))))))}let Age="button";function Tge(e,t){var r;let n=Yf("Listbox.Button"),o=fb("Listbox.Button"),a=m.useId(),i=Xg(),{id:s=i||`headlessui-listbox-button-${a}`,disabled:u=n.disabled||!1,autoFocus:c=!1,...d}=e,f=er(t,DN(),o.setButtonElement),h=qpe(),p=Ae(_=>{switch(_.key){case vt.Enter:ID(_.currentTarget);break;case vt.Space:case vt.ArrowDown:_.preventDefault(),nr.flushSync(()=>o.openListbox()),n.value||o.goToOption(Yt.First);break;case vt.ArrowUp:_.preventDefault(),nr.flushSync(()=>o.openListbox()),n.value||o.goToOption(Yt.Last);break}}),g=Ae(_=>{switch(_.key){case vt.Space:_.preventDefault();break}}),b=Ae(_=>{var F;if(hc(_.currentTarget))return _.preventDefault();n.listboxState===0?(nr.flushSync(()=>o.closeListbox()),(F=n.buttonElement)==null||F.focus({preventScroll:!0})):(_.preventDefault(),o.openListbox())}),v=Ae(_=>_.preventDefault()),x=gc([s]),k=ON(),{isFocusVisible:E,focusProps:j}=qo({autoFocus:c}),{isHovered:S,hoverProps:C}=oa({isDisabled:u}),{pressed:O,pressProps:M}=pc({disabled:u}),A=m.useMemo(()=>({open:n.listboxState===0,active:O||n.listboxState===0,disabled:u,invalid:n.invalid,value:n.value,hover:S,focus:E,autofocus:c}),[n.listboxState,n.value,u,S,E,O,n.invalid,c]),T=ia(h(),{ref:f,id:s,type:vc(e,n.buttonElement),"aria-haspopup":"listbox","aria-controls":(r=n.optionsElement)==null?void 0:r.id,"aria-expanded":n.listboxState===0,"aria-labelledby":x,"aria-describedby":k,disabled:u||void 0,autoFocus:c,onKeyDown:p,onKeyUp:g,onKeyPress:v,onClick:b},j,C,M);return Gt()({ourProps:T,theirProps:d,slot:A,defaultTag:Age,name:"Listbox.Button"})}let kL=m.createContext(!1),Mge="div",_ge=qn.RenderStrategy|qn.Static;function Ige(e,t){var r,n;let o=m.useId(),{id:a=`headlessui-listbox-options-${o}`,anchor:i,portal:s=!1,modal:u=!0,transition:c=!1,...d}=e,f=IN(i),[h,p]=m.useState(null);f&&(s=!0);let g=Yf("Listbox.Options"),b=fb("Listbox.Options"),v=sa(g.optionsElement),x=Ni(),[k,E]=xc(c,h,x!==null?(x&xr.Open)===xr.Open:g.listboxState===0);Qg(k,g.buttonElement,b.closeListbox);let j=g.__demoMode?!1:u&&g.listboxState===0;nb(j,v);let S=g.__demoMode?!1:u&&g.listboxState===0;TN(S,{allowed:m.useCallback(()=>[g.buttonElement,g.optionsElement],[g.buttonElement,g.optionsElement])});let C=g.listboxState!==0,O=yge(C,g.buttonElement)?!1:k,M=k&&g.listboxState===1,A=Th(M,g.value),T=Ae(Y=>g.compare(A,Y)),_=m.useMemo(()=>{var Y;if(f==null||!((Y=f?.to)!=null&&Y.includes("selection")))return null;let ae=g.options.findIndex(te=>T(te.dataRef.current.value));return ae===-1&&(ae=0),ae},[f,g.options]),F=(()=>{if(f==null)return;if(_===null)return{...f,inner:void 0};let Y=Array.from(g.listRef.current.values());return{...f,inner:{listRef:{current:Y},index:_}}})(),[$,I]=RN(F),R=LN(),W=er(t,f?$:null,b.setOptionsElement,p),B=$a();m.useEffect(()=>{var Y;let ae=g.optionsElement;ae&&g.listboxState===0&&ae!==((Y=Fa(ae))==null?void 0:Y.activeElement)&&ae?.focus({preventScroll:!0})},[g.listboxState,g.optionsElement]);let L=Ae(Y=>{var ae,te;switch(B.dispose(),Y.key){case vt.Space:if(g.searchQuery!=="")return Y.preventDefault(),Y.stopPropagation(),b.search(Y.key);case vt.Enter:if(Y.preventDefault(),Y.stopPropagation(),g.activeOptionIndex!==null){let{dataRef:me}=g.options[g.activeOptionIndex];b.onChange(me.current.value)}g.mode===0&&(nr.flushSync(()=>b.closeListbox()),(ae=g.buttonElement)==null||ae.focus({preventScroll:!0}));break;case Jt(g.orientation,{vertical:vt.ArrowDown,horizontal:vt.ArrowRight}):return Y.preventDefault(),Y.stopPropagation(),b.goToOption(Yt.Next);case Jt(g.orientation,{vertical:vt.ArrowUp,horizontal:vt.ArrowLeft}):return Y.preventDefault(),Y.stopPropagation(),b.goToOption(Yt.Previous);case vt.Home:case vt.PageUp:return Y.preventDefault(),Y.stopPropagation(),b.goToOption(Yt.First);case vt.End:case vt.PageDown:return Y.preventDefault(),Y.stopPropagation(),b.goToOption(Yt.Last);case vt.Escape:Y.preventDefault(),Y.stopPropagation(),nr.flushSync(()=>b.closeListbox()),(te=g.buttonElement)==null||te.focus({preventScroll:!0});return;case vt.Tab:Y.preventDefault(),Y.stopPropagation(),nr.flushSync(()=>b.closeListbox()),lpe(g.buttonElement,Y.shiftKey?yr.Previous:yr.Next);break;default:Y.key.length===1&&(b.search(Y.key),B.setTimeout(()=>b.clearSearch(),350));break}}),q=(r=g.buttonElement)==null?void 0:r.id,U=m.useMemo(()=>({open:g.listboxState===0}),[g.listboxState]),H=ia(f?R():{},{id:a,ref:W,"aria-activedescendant":g.activeOptionIndex===null||(n=g.options[g.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":g.mode===1?!0:void 0,"aria-labelledby":q,"aria-orientation":g.orientation,onKeyDown:L,role:"listbox",tabIndex:g.listboxState===0?0:void 0,style:{...d.style,...I,"--button-width":Ch(g.buttonElement,!0).width},...yc(E)}),X=Gt();return y.createElement(ab,{enabled:s?e.static||k:!1},y.createElement(mb.Provider,{value:g.mode===1?g:{...g,isSelected:T}},X({ourProps:H,theirProps:d,slot:U,defaultTag:Mge,features:_ge,visible:O,name:"Listbox.Options"})))}let Dge="div";function Lge(e,t){let r=m.useId(),{id:n=`headlessui-listbox-option-${r}`,disabled:o=!1,value:a,...i}=e,s=m.useContext(kL)===!0,u=Yf("Listbox.Option"),c=fb("Listbox.Option"),d=u.activeOptionIndex!==null?u.options[u.activeOptionIndex].id===n:!1,f=u.isSelected(a),h=m.useRef(null),p=kge(h),g=Zn({disabled:o,value:a,domRef:h,get textValue(){return p()}}),b=er(t,h,A=>{A?u.listRef.current.set(n,A):u.listRef.current.delete(n)});Vt(()=>{if(!u.__demoMode&&u.listboxState===0&&d&&u.activationTrigger!==0)return ra().requestAnimationFrame(()=>{var A,T;(T=(A=h.current)==null?void 0:A.scrollIntoView)==null||T.call(A,{block:"nearest"})})},[h,d,u.__demoMode,u.listboxState,u.activationTrigger,u.activeOptionIndex]),Vt(()=>{if(!s)return c.registerOption(n,g)},[g,n,s]);let v=Ae(A=>{var T;if(o)return A.preventDefault();c.onChange(a),u.mode===0&&(nr.flushSync(()=>c.closeListbox()),(T=u.buttonElement)==null||T.focus({preventScroll:!0}))}),x=Ae(()=>{if(o)return c.goToOption(Yt.Nothing);c.goToOption(Yt.Specific,n)}),k=KD(),E=Ae(A=>{k.update(A),!o&&(d||c.goToOption(Yt.Specific,n,0))}),j=Ae(A=>{k.wasMoved(A)&&(o||d||c.goToOption(Yt.Specific,n,0))}),S=Ae(A=>{k.wasMoved(A)&&(o||d&&c.goToOption(Yt.Nothing))}),C=m.useMemo(()=>({active:d,focus:d,selected:f,disabled:o,selectedOption:f&&s}),[d,f,o,s]),O=s?{}:{id:n,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:v,onFocus:x,onPointerEnter:E,onMouseEnter:E,onPointerMove:j,onMouseMove:j,onPointerLeave:S,onMouseLeave:S},M=Gt();return!f&&s?null:M({ourProps:O,theirProps:i,slot:C,defaultTag:Dge,name:"Listbox.Option"})}let Rge=m.Fragment;function Fge(e,t){let{options:r,placeholder:n,...o}=e,a={ref:er(t)},i=Yf("ListboxSelectedOption"),s=m.useMemo(()=>({}),[]),u=i.value===void 0||i.value===null||i.mode===1&&Array.isArray(i.value)&&i.value.length===0,c=Gt();return y.createElement(kL.Provider,{value:!0},c({ourProps:a,theirProps:{...o,children:y.createElement(y.Fragment,null,n&&u?n:r)},slot:s,defaultTag:Rge,name:"ListboxSelectedOption"}))}let $ge=qt(Pge),pb=qt(Tge),Bge=PN,hb=qt(Ige),ZN=qt(Lge),zge=qt(Fge),JN=Object.assign($ge,{Button:pb,Label:Bge,Options:hb,Option:ZN,SelectedOption:zge});var Hge=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Hge||{}),qge=(e=>(e[e.TogglePopover=0]="TogglePopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(qge||{});let Uge={0:e=>({...e,popoverState:Jt(e.popoverState,{0:1,1:0}),__demoMode:!1}),1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},QN=m.createContext(null);QN.displayName="PopoverContext";function gb(e){let t=m.useContext(QN);if(t===null){let r=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,gb),r}return t}let bb=m.createContext(null);bb.displayName="PopoverAPIContext";function e1(e){let t=m.useContext(bb);if(t===null){let r=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,e1),r}return t}let t1=m.createContext(null);t1.displayName="PopoverGroupContext";function wL(){return m.useContext(t1)}let vb=m.createContext(null);vb.displayName="PopoverPanelContext";function Vge(){return m.useContext(vb)}function Wge(e,t){return Jt(t.type,Uge,e,t)}let Kge="div";function Yge(e,t){var r;let{__demoMode:n=!1,...o}=e,a=m.useRef(null),i=er(t,SN(q=>{a.current=q})),s=m.useRef([]),u=m.useReducer(Wge,{__demoMode:n,popoverState:n?0:1,buttons:s,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:m.createRef(),afterPanelSentinel:m.createRef(),afterButtonSentinel:m.createRef()}),[{popoverState:c,button:d,buttonId:f,panel:h,panelId:p,beforePanelSentinel:g,afterPanelSentinel:b,afterButtonSentinel:v},x]=u,k=sa((r=a.current)!=null?r:d),E=m.useMemo(()=>{if(!d||!h)return!1;for(let te of document.querySelectorAll("body > *"))if(Number(te?.contains(d))^Number(te?.contains(h)))return!0;let q=Uf(),U=q.indexOf(d),H=(U+q.length-1)%q.length,X=(U+1)%q.length,Y=q[H],ae=q[X];return!h.contains(Y)&&!h.contains(ae)},[d,h]),j=Zn(f),S=Zn(p),C=m.useMemo(()=>({buttonId:j,panelId:S,close:()=>x({type:1})}),[j,S,x]),O=wL(),M=O?.registerPopover,A=Ae(()=>{var q;return(q=O?.isFocusWithinPopoverGroup())!=null?q:k?.activeElement&&(d?.contains(k.activeElement)||h?.contains(k.activeElement))});m.useEffect(()=>M?.(C),[M,C]);let[T,_]=nL(),F=HN(d),$=cL({mainTreeNode:F,portals:T,defaultContainers:[d,h]});rb(k?.defaultView,"focus",q=>{var U,H,X,Y,ae,te;q.target!==window&&q.target instanceof HTMLElement&&c===0&&(A()||d&&h&&($.contains(q.target)||(H=(U=g.current)==null?void 0:U.contains)!=null&&H.call(U,q.target)||(Y=(X=b.current)==null?void 0:X.contains)!=null&&Y.call(X,q.target)||(te=(ae=v.current)==null?void 0:ae.contains)!=null&&te.call(ae,q.target)||x({type:1})))},!0),tb(c===0,$.resolveContainers,(q,U)=>{x({type:1}),MN(U,eb.Loose)||(q.preventDefault(),d?.focus())});let I=Ae(q=>{x({type:1});let U=q?q instanceof HTMLElement?q:"current"in q&&q.current instanceof HTMLElement?q.current:d:d;U?.focus()}),R=m.useMemo(()=>({close:I,isPortalled:E}),[I,E]),W=m.useMemo(()=>({open:c===0,close:I}),[c,I]),B={ref:i},L=Gt();return y.createElement(Mh,{node:F},y.createElement(FN,null,y.createElement(vb.Provider,{value:null},y.createElement(QN.Provider,{value:u},y.createElement(bb.Provider,{value:R},y.createElement(AN,{value:I},y.createElement(Vf,{value:Jt(c,{0:xr.Open,1:xr.Closed})},y.createElement(_,null,L({ourProps:B,theirProps:o,slot:W,defaultTag:Kge,name:"Popover"})))))))))}let Gge="button";function Xge(e,t){let r=m.useId(),{id:n=`headlessui-popover-button-${r}`,disabled:o=!1,autoFocus:a=!1,...i}=e,[s,u]=gb("Popover.Button"),{isPortalled:c}=e1("Popover.Button"),d=m.useRef(null),f=`headlessui-focus-sentinel-${m.useId()}`,h=wL(),p=h?.closeOthers,g=Vge()!==null;m.useEffect(()=>{if(!g)return u({type:3,buttonId:n}),()=>{u({type:3,buttonId:null})}},[g,n,u]);let[b]=m.useState(()=>Symbol()),v=er(d,t,DN(),Ae(U=>{if(!g){if(U)s.buttons.current.push(b);else{let H=s.buttons.current.indexOf(b);H!==-1&&s.buttons.current.splice(H,1)}s.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),U&&u({type:2,button:U})}})),x=er(d,t),k=sa(d),E=Ae(U=>{var H,X,Y;if(g){if(s.popoverState===1)return;switch(U.key){case vt.Space:case vt.Enter:U.preventDefault(),(X=(H=U.target).click)==null||X.call(H),u({type:1}),(Y=s.button)==null||Y.focus();break}}else switch(U.key){case vt.Space:case vt.Enter:U.preventDefault(),U.stopPropagation(),s.popoverState===1&&p?.(s.buttonId),u({type:0});break;case vt.Escape:if(s.popoverState!==0)return p?.(s.buttonId);if(!d.current||k!=null&&k.activeElement&&!d.current.contains(k.activeElement))return;U.preventDefault(),U.stopPropagation(),u({type:1});break}}),j=Ae(U=>{g||U.key===vt.Space&&U.preventDefault()}),S=Ae(U=>{var H,X;hc(U.currentTarget)||o||(g?(u({type:1}),(H=s.button)==null||H.focus()):(U.preventDefault(),U.stopPropagation(),s.popoverState===1&&p?.(s.buttonId),u({type:0}),(X=s.button)==null||X.focus()))}),C=Ae(U=>{U.preventDefault(),U.stopPropagation()}),{isFocusVisible:O,focusProps:M}=qo({autoFocus:a}),{isHovered:A,hoverProps:T}=oa({isDisabled:o}),{pressed:_,pressProps:F}=pc({disabled:o}),$=s.popoverState===0,I=m.useMemo(()=>({open:$,active:_||$,disabled:o,hover:A,focus:O,autofocus:a}),[$,A,O,_,o,a]),R=vc(e,s.button),W=ia(g?{ref:x,type:R,onKeyDown:E,onClick:S,disabled:o||void 0,autoFocus:a}:{ref:v,id:s.buttonId,type:R,"aria-expanded":s.popoverState===0,"aria-controls":s.panel?s.panelId:void 0,disabled:o||void 0,autoFocus:a,onKeyDown:E,onKeyUp:j,onClick:S,onMouseDown:C},M,T,F),B=qN(),L=Ae(()=>{let U=s.panel;if(!U)return;function H(){Jt(B.current,{[No.Forwards]:()=>bn(U,yr.First),[No.Backwards]:()=>bn(U,yr.Last)})===ha.Error&&bn(Uf().filter(X=>X.dataset.headlessuiFocusGuard!=="true"),Jt(B.current,{[No.Forwards]:yr.Next,[No.Backwards]:yr.Previous}),{relativeTo:s.button})}H()}),q=Gt();return y.createElement(y.Fragment,null,q({ourProps:W,theirProps:i,slot:I,defaultTag:Gge,name:"Popover.Button"}),$&&!g&&c&&y.createElement(_a,{id:f,ref:s.afterButtonSentinel,features:Ma.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:L}))}let Zge="div",Jge=qn.RenderStrategy|qn.Static;function jL(e,t){let r=m.useId(),{id:n=`headlessui-popover-backdrop-${r}`,transition:o=!1,...a}=e,[{popoverState:i},s]=gb("Popover.Backdrop"),[u,c]=m.useState(null),d=er(t,c),f=Ni(),[h,p]=xc(o,u,f!==null?(f&xr.Open)===xr.Open:i===0),g=Ae(x=>{if(hc(x.currentTarget))return x.preventDefault();s({type:1})}),b=m.useMemo(()=>({open:i===0}),[i]),v={ref:d,id:n,"aria-hidden":!0,onClick:g,...yc(p)};return Gt()({ourProps:v,theirProps:a,slot:b,defaultTag:Zge,features:Jge,visible:h,name:"Popover.Backdrop"})}let Qge="div",ebe=qn.RenderStrategy|qn.Static;function tbe(e,t){let r=m.useId(),{id:n=`headlessui-popover-panel-${r}`,focus:o=!1,anchor:a,portal:i=!1,modal:s=!1,transition:u=!1,...c}=e,[d,f]=gb("Popover.Panel"),{close:h,isPortalled:p}=e1("Popover.Panel"),g=`headlessui-focus-sentinel-before-${r}`,b=`headlessui-focus-sentinel-after-${r}`,v=m.useRef(null),x=IN(a),[k,E]=RN(x),j=LN();x&&(i=!0);let[S,C]=m.useState(null),O=er(v,t,x?k:null,Ae(U=>f({type:4,panel:U})),C),M=sa(v);Vt(()=>(f({type:5,panelId:n}),()=>{f({type:5,panelId:null})}),[n,f]);let A=Ni(),[T,_]=xc(u,S,A!==null?(A&xr.Open)===xr.Open:d.popoverState===0);Qg(T,d.button,()=>{f({type:1})});let F=d.__demoMode?!1:s&&T;nb(F,M);let $=Ae(U=>{var H;switch(U.key){case vt.Escape:if(d.popoverState!==0||!v.current||M!=null&&M.activeElement&&!v.current.contains(M.activeElement))return;U.preventDefault(),U.stopPropagation(),f({type:1}),(H=d.button)==null||H.focus();break}});m.useEffect(()=>{var U;e.static||d.popoverState===1&&((U=e.unmount)==null||U)&&f({type:4,panel:null})},[d.popoverState,e.unmount,e.static,f]),m.useEffect(()=>{if(d.__demoMode||!o||d.popoverState!==0||!v.current)return;let U=M?.activeElement;v.current.contains(U)||bn(v.current,yr.First)},[d.__demoMode,o,v.current,d.popoverState]);let I=m.useMemo(()=>({open:d.popoverState===0,close:h}),[d.popoverState,h]),R=ia(x?j():{},{ref:O,id:n,onKeyDown:$,onBlur:o&&d.popoverState===0?U=>{var H,X,Y,ae,te;let me=U.relatedTarget;me&&v.current&&((H=v.current)!=null&&H.contains(me)||(f({type:1}),((Y=(X=d.beforePanelSentinel.current)==null?void 0:X.contains)!=null&&Y.call(X,me)||(te=(ae=d.afterPanelSentinel.current)==null?void 0:ae.contains)!=null&&te.call(ae,me))&&me.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...c.style,...E,"--button-width":Ch(d.button,!0).width},...yc(_)}),W=qN(),B=Ae(()=>{let U=v.current;if(!U)return;function H(){Jt(W.current,{[No.Forwards]:()=>{var X;bn(U,yr.First)===ha.Error&&((X=d.afterPanelSentinel.current)==null||X.focus())},[No.Backwards]:()=>{var X;(X=d.button)==null||X.focus({preventScroll:!0})}})}H()}),L=Ae(()=>{let U=v.current;if(!U)return;function H(){Jt(W.current,{[No.Forwards]:()=>{if(!d.button)return;let X=Uf(),Y=X.indexOf(d.button),ae=X.slice(0,Y+1),te=[...X.slice(Y+1),...ae];for(let me of te.slice())if(me.dataset.headlessuiFocusGuard==="true"||S!=null&&S.contains(me)){let Q=te.indexOf(me);Q!==-1&&te.splice(Q,1)}bn(te,yr.First,{sorted:!1})},[No.Backwards]:()=>{var X;bn(U,yr.Previous)===ha.Error&&((X=d.button)==null||X.focus())}})}H()}),q=Gt();return y.createElement($N,null,y.createElement(vb.Provider,{value:n},y.createElement(bb.Provider,{value:{close:h,isPortalled:p}},y.createElement(ab,{enabled:i?e.static||T:!1},T&&p&&y.createElement(_a,{id:g,ref:d.beforePanelSentinel,features:Ma.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:B}),q({ourProps:R,theirProps:c,slot:I,defaultTag:Qge,features:ebe,visible:T,name:"Popover.Panel"}),T&&p&&y.createElement(_a,{id:b,ref:d.afterPanelSentinel,features:Ma.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:L})))))}let rbe="div";function nbe(e,t){let r=m.useRef(null),n=er(r,t),[o,a]=m.useState([]),i=Ae(b=>{a(v=>{let x=v.indexOf(b);if(x!==-1){let k=v.slice();return k.splice(x,1),k}return v})}),s=Ae(b=>(a(v=>[...v,b]),()=>i(b))),u=Ae(()=>{var b;let v=Fa(r);if(!v)return!1;let x=v.activeElement;return(b=r.current)!=null&&b.contains(x)?!0:o.some(k=>{var E,j;return((E=v.getElementById(k.buttonId.current))==null?void 0:E.contains(x))||((j=v.getElementById(k.panelId.current))==null?void 0:j.contains(x))})}),c=Ae(b=>{for(let v of o)v.buttonId.current!==b&&v.close()}),d=m.useMemo(()=>({registerPopover:s,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:c}),[s,i,u,c]),f=m.useMemo(()=>({}),[]),h=e,p={ref:n},g=Gt();return y.createElement(Mh,null,y.createElement(t1.Provider,{value:d},g({ourProps:p,theirProps:h,slot:f,defaultTag:rbe,name:"Popover.Group"})))}let obe=qt(Yge),r1=qt(Xge),abe=qt(jL),ibe=qt(jL),n1=qt(tbe),sbe=qt(nbe),EL=Object.assign(obe,{Button:r1,Backdrop:ibe,Overlay:abe,Panel:n1,Group:sbe}),o1=m.createContext(null);o1.displayName="GroupContext";let lbe=m.Fragment;function ube(e){var t;let[r,n]=m.useState(null),[o,a]=CN(),[i,s]=RD(),u=m.useMemo(()=>({switch:r,setSwitch:n}),[r,n]),c={},d=e,f=Gt();return y.createElement(s,{name:"Switch.Description",value:i},y.createElement(a,{name:"Switch.Label",value:o,props:{htmlFor:(t=u.switch)==null?void 0:t.id,onClick(h){r&&(h.currentTarget instanceof HTMLLabelElement&&h.preventDefault(),r.click(),r.focus({preventScroll:!0}))}}},y.createElement(o1.Provider,{value:u},f({ourProps:c,theirProps:d,slot:{},defaultTag:lbe,name:"Switch.Group"}))))}let cbe="button";function dbe(e,t){var r;let n=m.useId(),o=Xg(),a=qf(),{id:i=o||`headlessui-switch-${n}`,disabled:s=a||!1,checked:u,defaultChecked:c,onChange:d,name:f,value:h,form:p,autoFocus:g=!1,...b}=e,v=m.useContext(o1),[x,k]=m.useState(null),E=m.useRef(null),j=er(E,t,v===null?null:v.setSwitch,k),S=EN(c),[C,O]=jN(u,d,S??!1),M=$a(),[A,T]=m.useState(!1),_=Ae(()=>{T(!0),O?.(!C),M.nextFrame(()=>{T(!1)})}),F=Ae(Q=>{if(hc(Q.currentTarget))return Q.preventDefault();Q.preventDefault(),_()}),$=Ae(Q=>{Q.key===vt.Space?(Q.preventDefault(),_()):Q.key===vt.Enter&&ID(Q.currentTarget)}),I=Ae(Q=>Q.preventDefault()),R=gc(),W=ON(),{isFocusVisible:B,focusProps:L}=qo({autoFocus:g}),{isHovered:q,hoverProps:U}=oa({isDisabled:s}),{pressed:H,pressProps:X}=pc({disabled:s}),Y=m.useMemo(()=>({checked:C,disabled:s,hover:q,focus:B,active:H,autofocus:g,changing:A}),[C,q,B,H,s,A,g]),ae=ia({id:i,ref:j,role:"switch",type:vc(e,x),tabIndex:e.tabIndex===-1?0:(r=e.tabIndex)!=null?r:0,"aria-checked":C,"aria-labelledby":R,"aria-describedby":W,disabled:s||void 0,autoFocus:g,onClick:F,onKeyUp:$,onKeyPress:I},L,U,X),te=m.useCallback(()=>{if(S!==void 0)return O?.(S)},[O,S]),me=Gt();return y.createElement(y.Fragment,null,f!=null&&y.createElement(NN,{disabled:s,data:{[f]:h||"on"},overrides:{type:"checkbox",checked:C},form:p,onReset:te}),me({ourProps:ae,theirProps:b,slot:Y,defaultTag:cbe,name:"Switch"}))}let fbe=qt(dbe),mbe=ube,pbe=PN,hbe=FD,gbe=Object.assign(fbe,{Group:mbe,Label:pbe,Description:hbe});function bbe({onFocus:e}){let[t,r]=m.useState(!0),n=ib();return t?y.createElement(_a,{as:"button",type:"button",features:Ma.Focusable,onFocus:o=>{o.preventDefault();let a,i=50;function s(){if(i--<=0){a&&cancelAnimationFrame(a);return}if(e()){if(cancelAnimationFrame(a),!n.current)return;r(!1);return}a=requestAnimationFrame(s)}a=requestAnimationFrame(s)}}):null}const NL=m.createContext(null);function vbe(){return{groups:new Map,get(e,t){var r;let n=this.groups.get(e);n||(n=new Map,this.groups.set(e,n));let o=(r=n.get(t))!=null?r:0;n.set(t,o+1);let a=Array.from(n.keys()).indexOf(t);function i(){let s=n.get(t);s>1?n.set(t,s-1):n.delete(t)}return[a,i]}}}function ybe({children:e}){let t=m.useRef(vbe());return m.createElement(NL.Provider,{value:t},e)}function SL(e){let t=m.useContext(NL);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let r=m.useId(),[n,o]=t.current.get(e,r);return m.useEffect(()=>o,[]),n}var xbe=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(xbe||{}),kbe=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(kbe||{}),wbe=(e=>(e[e.SetSelectedIndex=0]="SetSelectedIndex",e[e.RegisterTab=1]="RegisterTab",e[e.UnregisterTab=2]="UnregisterTab",e[e.RegisterPanel=3]="RegisterPanel",e[e.UnregisterPanel=4]="UnregisterPanel",e))(wbe||{});let jbe={0(e,t){var r;let n=Xi(e.tabs,d=>d.current),o=Xi(e.panels,d=>d.current),a=n.filter(d=>{var f;return!((f=d.current)!=null&&f.hasAttribute("disabled"))}),i={...e,tabs:n,panels:o};if(t.index<0||t.index>n.length-1){let d=Jt(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>Jt(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(a.length===0)return i;let f=Jt(d,{0:()=>n.indexOf(a[0]),1:()=>n.indexOf(a[a.length-1])});return{...i,selectedIndex:f===-1?e.selectedIndex:f}}let s=n.slice(0,t.index),u=[...n.slice(t.index),...s].find(d=>a.includes(d));if(!u)return i;let c=(r=n.indexOf(u))!=null?r:e.selectedIndex;return c===-1&&(c=e.selectedIndex),{...i,selectedIndex:c}},1(e,t){if(e.tabs.includes(t.tab))return e;let r=e.tabs[e.selectedIndex],n=Xi([...e.tabs,t.tab],a=>a.current),o=e.selectedIndex;return e.info.current.isControlled||(o=n.indexOf(r),o===-1&&(o=e.selectedIndex)),{...e,tabs:n,selectedIndex:o}},2(e,t){return{...e,tabs:e.tabs.filter(r=>r!==t.tab)}},3(e,t){return e.panels.includes(t.panel)?e:{...e,panels:Xi([...e.panels,t.panel],r=>r.current)}},4(e,t){return{...e,panels:e.panels.filter(r=>r!==t.panel)}}},a1=m.createContext(null);a1.displayName="TabsDataContext";function Xu(e){let t=m.useContext(a1);if(t===null){let r=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Xu),r}return t}let i1=m.createContext(null);i1.displayName="TabsActionsContext";function s1(e){let t=m.useContext(i1);if(t===null){let r=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,s1),r}return t}function Ebe(e,t){return Jt(t.type,jbe,e,t)}let Nbe="div";function Sbe(e,t){let{defaultIndex:r=0,vertical:n=!1,manual:o=!1,onChange:a,selectedIndex:i=null,...s}=e;const u=n?"vertical":"horizontal",c=o?"manual":"auto";let d=i!==null,f=Zn({isControlled:d}),h=er(t),[p,g]=m.useReducer(Ebe,{info:f,selectedIndex:i??r,tabs:[],panels:[]}),b=m.useMemo(()=>({selectedIndex:p.selectedIndex}),[p.selectedIndex]),v=Zn(a||(()=>{})),x=Zn(p.tabs),k=m.useMemo(()=>({orientation:u,activation:c,...p}),[u,c,p]),E=Ae(T=>(g({type:1,tab:T}),()=>g({type:2,tab:T}))),j=Ae(T=>(g({type:3,panel:T}),()=>g({type:4,panel:T}))),S=Ae(T=>{C.current!==T&&v.current(T),d||g({type:0,index:T})}),C=Zn(d?e.selectedIndex:p.selectedIndex),O=m.useMemo(()=>({registerTab:E,registerPanel:j,change:S}),[]);Vt(()=>{g({type:0,index:i??r})},[i]),Vt(()=>{if(C.current===void 0||p.tabs.length<=0)return;let T=Xi(p.tabs,_=>_.current);T.some((_,F)=>p.tabs[F]!==_)&&S(T.indexOf(p.tabs[C.current]))});let M={ref:h},A=Gt();return y.createElement(ybe,null,y.createElement(i1.Provider,{value:O},y.createElement(a1.Provider,{value:k},k.tabs.length<=0&&y.createElement(bbe,{onFocus:()=>{var T,_;for(let F of x.current)if(((T=F.current)==null?void 0:T.tabIndex)===0)return(_=F.current)==null||_.focus(),!0;return!1}}),A({ourProps:M,theirProps:s,slot:b,defaultTag:Nbe,name:"Tabs"}))))}let Obe="div";function Cbe(e,t){let{orientation:r,selectedIndex:n}=Xu("Tab.List"),o=er(t),a=m.useMemo(()=>({selectedIndex:n}),[n]),i=e,s={ref:o,role:"tablist","aria-orientation":r};return Gt()({ourProps:s,theirProps:i,slot:a,defaultTag:Obe,name:"Tabs.List"})}let Pbe="button";function Abe(e,t){var r,n;let o=m.useId(),{id:a=`headlessui-tabs-tab-${o}`,disabled:i=!1,autoFocus:s=!1,...u}=e,{orientation:c,activation:d,selectedIndex:f,tabs:h,panels:p}=Xu("Tab"),g=s1("Tab"),b=Xu("Tab"),[v,x]=m.useState(null),k=m.useRef(null),E=er(k,t,x);Vt(()=>g.registerTab(k),[g,k]);let j=SL("tabs"),S=h.indexOf(k);S===-1&&(S=j);let C=S===f,O=Ae(U=>{var H;let X=U();if(X===ha.Success&&d==="auto"){let Y=(H=Fa(k))==null?void 0:H.activeElement,ae=b.tabs.findIndex(te=>te.current===Y);ae!==-1&&g.change(ae)}return X}),M=Ae(U=>{let H=h.map(X=>X.current).filter(Boolean);if(U.key===vt.Space||U.key===vt.Enter){U.preventDefault(),U.stopPropagation(),g.change(S);return}switch(U.key){case vt.Home:case vt.PageUp:return U.preventDefault(),U.stopPropagation(),O(()=>bn(H,yr.First));case vt.End:case vt.PageDown:return U.preventDefault(),U.stopPropagation(),O(()=>bn(H,yr.Last))}if(O(()=>Jt(c,{vertical(){return U.key===vt.ArrowUp?bn(H,yr.Previous|yr.WrapAround):U.key===vt.ArrowDown?bn(H,yr.Next|yr.WrapAround):ha.Error},horizontal(){return U.key===vt.ArrowLeft?bn(H,yr.Previous|yr.WrapAround):U.key===vt.ArrowRight?bn(H,yr.Next|yr.WrapAround):ha.Error}}))===ha.Success)return U.preventDefault()}),A=m.useRef(!1),T=Ae(()=>{var U;A.current||(A.current=!0,(U=k.current)==null||U.focus({preventScroll:!0}),g.change(S),Hf(()=>{A.current=!1}))}),_=Ae(U=>{U.preventDefault()}),{isFocusVisible:F,focusProps:$}=qo({autoFocus:s}),{isHovered:I,hoverProps:R}=oa({isDisabled:i}),{pressed:W,pressProps:B}=pc({disabled:i}),L=m.useMemo(()=>({selected:C,hover:I,active:W,focus:F,autofocus:s,disabled:i}),[C,I,F,W,s,i]),q=ia({ref:E,onKeyDown:M,onMouseDown:_,onClick:T,id:a,role:"tab",type:vc(e,v),"aria-controls":(n=(r=p[S])==null?void 0:r.current)==null?void 0:n.id,"aria-selected":C,tabIndex:C?0:-1,disabled:i||void 0,autoFocus:s},$,R,B);return Gt()({ourProps:q,theirProps:u,slot:L,defaultTag:Pbe,name:"Tabs.Tab"})}let Tbe="div";function Mbe(e,t){let{selectedIndex:r}=Xu("Tab.Panels"),n=er(t),o=m.useMemo(()=>({selectedIndex:r}),[r]),a=e,i={ref:n};return Gt()({ourProps:i,theirProps:a,slot:o,defaultTag:Tbe,name:"Tabs.Panels"})}let _be="div",Ibe=qn.RenderStrategy|qn.Static;function Dbe(e,t){var r,n,o,a;let i=m.useId(),{id:s=`headlessui-tabs-panel-${i}`,tabIndex:u=0,...c}=e,{selectedIndex:d,tabs:f,panels:h}=Xu("Tab.Panel"),p=s1("Tab.Panel"),g=m.useRef(null),b=er(g,t);Vt(()=>p.registerPanel(g),[p,g]);let v=SL("panels"),x=h.indexOf(g);x===-1&&(x=v);let k=x===d,{isFocusVisible:E,focusProps:j}=qo(),S=m.useMemo(()=>({selected:k,focus:E}),[k,E]),C=ia({ref:b,id:s,role:"tabpanel","aria-labelledby":(n=(r=f[x])==null?void 0:r.current)==null?void 0:n.id,tabIndex:k?u:-1},j),O=Gt();return!k&&((o=c.unmount)==null||o)&&!((a=c.static)!=null&&a)?y.createElement(_a,{"aria-hidden":"true",...C}):O({ourProps:C,theirProps:c,slot:S,defaultTag:_be,features:Ibe,visible:k,name:"Tabs.Panel"})}let Lbe=qt(Abe),Rbe=qt(Sbe),Fbe=qt(Cbe),$be=qt(Mbe),Bbe=qt(Dbe),yb=Object.assign(Lbe,{Group:Rbe,List:Fbe,Panels:$be,Panel:Bbe});const OL=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}),y.createElement("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"}))},Gf=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 10.5858L9.17157 7.75736L7.75736 9.17157L10.5858 12L7.75736 14.8284L9.17157 16.2426L12 13.4142L14.8284 16.2426L16.2426 14.8284L13.4142 12L16.2426 9.17157L14.8284 7.75736L12 10.5858Z"}))};var Ct=function(){return Ct=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Ct.apply(this,arguments)};function zbe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function CL(e,t,r){for(var n=0,o=t.length,a;n<o;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}function Xf(e){return e.mode==="multiple"}function Zf(e){return e.mode==="range"}function xb(e){return e.mode==="single"}var Hbe={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function qbe(e,t){return ro(e,"LLLL y",t)}function Ube(e,t){return ro(e,"d",t)}function Vbe(e,t){return ro(e,"LLLL",t)}function Wbe(e){return"".concat(e)}function Kbe(e,t){return ro(e,"cccccc",t)}function Ybe(e,t){return ro(e,"yyyy",t)}var Gbe=Object.freeze({__proto__:null,formatCaption:qbe,formatDay:Ube,formatMonthCaption:Vbe,formatWeekNumber:Wbe,formatWeekdayName:Kbe,formatYearCaption:Ybe}),Xbe=function(e,t,r){return ro(e,"do MMMM (EEEE)",r)},Zbe=function(){return"Month: "},Jbe=function(){return"Go to next month"},Qbe=function(){return"Go to previous month"},eve=function(e,t){return ro(e,"cccc",t)},tve=function(e){return"Week n. ".concat(e)},rve=function(){return"Year: "},nve=Object.freeze({__proto__:null,labelDay:Xbe,labelMonthDropdown:Zbe,labelNext:Jbe,labelPrevious:Qbe,labelWeekNumber:tve,labelWeekday:eve,labelYearDropdown:rve});function ove(){var e="buttons",t=Hbe,r=Gg,n={},o={},a=1,i={},s=new Date;return{captionLayout:e,classNames:t,formatters:Gbe,labels:nve,locale:r,modifiersClassNames:n,modifiers:o,numberOfMonths:a,styles:i,today:s,mode:"default"}}function ave(e){var t=e.fromYear,r=e.toYear,n=e.fromMonth,o=e.toMonth,a=e.fromDate,i=e.toDate;return n?a=Mn(n):t&&(a=new Date(t,0,1)),o?i=yN(o):r&&(i=new Date(r,11,31)),{fromDate:a?Ta(a):void 0,toDate:i?Ta(i):void 0}}var PL=m.createContext(void 0);function ive(e){var t,r=e.initialProps,n=ove(),o=ave(r),a=o.fromDate,i=o.toDate,s=(t=r.captionLayout)!==null&&t!==void 0?t:n.captionLayout;s!=="buttons"&&(!a||!i)&&(s="buttons");var u;(xb(r)||Xf(r)||Zf(r))&&(u=r.onSelect);var c=Ct(Ct(Ct({},n),r),{captionLayout:s,classNames:Ct(Ct({},n.classNames),r.classNames),components:Ct({},r.components),formatters:Ct(Ct({},n.formatters),r.formatters),fromDate:a,labels:Ct(Ct({},n.labels),r.labels),mode:r.mode||n.mode,modifiers:Ct(Ct({},n.modifiers),r.modifiers),modifiersClassNames:Ct(Ct({},n.modifiersClassNames),r.modifiersClassNames),onSelect:u,styles:Ct(Ct({},n.styles),r.styles),toDate:i});return l.jsx(PL.Provider,{value:c,children:e.children})}function Lr(){var e=m.useContext(PL);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function AL(e){var t=Lr(),r=t.locale,n=t.classNames,o=t.styles,a=t.formatters.formatCaption;return l.jsx("div",{className:n.caption_label,style:o.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:a(e.displayMonth,{locale:r})})}function sve(e){return l.jsx("svg",Ct({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:l.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function TL(e){var t,r,n=e.onChange,o=e.value,a=e.children,i=e.caption,s=e.className,u=e.style,c=Lr(),d=(r=(t=c.components)===null||t===void 0?void 0:t.IconDropdown)!==null&&r!==void 0?r:sve;return l.jsxs("div",{className:s,style:u,children:[l.jsx("span",{className:c.classNames.vhidden,children:e["aria-label"]}),l.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:c.classNames.dropdown,style:c.styles.dropdown,value:o,onChange:n,children:a}),l.jsxs("div",{className:c.classNames.caption_label,style:c.styles.caption_label,"aria-hidden":"true",children:[i,l.jsx(d,{className:c.classNames.dropdown_icon,style:c.styles.dropdown_icon})]})]})}function lve(e){var t,r=Lr(),n=r.fromDate,o=r.toDate,a=r.styles,i=r.locale,s=r.formatters.formatMonthCaption,u=r.classNames,c=r.components,d=r.labels.labelMonthDropdown;if(!n)return l.jsx(l.Fragment,{});if(!o)return l.jsx(l.Fragment,{});var f=[];if(Sme(n,o))for(var h=Mn(n),p=n.getMonth();p<=o.getMonth();p++)f.push(wk(h,p));else for(var h=Mn(new Date),p=0;p<=11;p++)f.push(wk(h,p));var g=function(v){var x=Number(v.target.value),k=wk(Mn(e.displayMonth),x);e.onChange(k)},b=(t=c?.Dropdown)!==null&&t!==void 0?t:TL;return l.jsx(b,{name:"months","aria-label":d(),className:u.dropdown_month,style:a.dropdown_month,onChange:g,value:e.displayMonth.getMonth(),caption:s(e.displayMonth,{locale:i}),children:f.map(function(v){return l.jsx("option",{value:v.getMonth(),children:s(v,{locale:i})},v.getMonth())})})}function uve(e){var t,r=e.displayMonth,n=Lr(),o=n.fromDate,a=n.toDate,i=n.locale,s=n.styles,u=n.classNames,c=n.components,d=n.formatters.formatYearCaption,f=n.labels.labelYearDropdown,h=[];if(!o)return l.jsx(l.Fragment,{});if(!a)return l.jsx(l.Fragment,{});for(var p=o.getFullYear(),g=a.getFullYear(),b=p;b<=g;b++)h.push(R7(xN(new Date),b));var v=function(k){var E=R7(Mn(r),Number(k.target.value));e.onChange(E)},x=(t=c?.Dropdown)!==null&&t!==void 0?t:TL;return l.jsx(x,{name:"years","aria-label":f(),className:u.dropdown_year,style:s.dropdown_year,onChange:v,value:r.getFullYear(),caption:d(r,{locale:i}),children:h.map(function(k){return l.jsx("option",{value:k.getFullYear(),children:d(k,{locale:i})},k.getFullYear())})})}function cve(e,t){var r=m.useState(e),n=r[0],o=r[1],a=t===void 0?n:t;return[a,o]}function dve(e){var t=e.month,r=e.defaultMonth,n=e.today,o=t||r||n||new Date,a=e.toDate,i=e.fromDate,s=e.numberOfMonths,u=s===void 0?1:s;if(a&&mf(a,o)<0){var c=-1*(u-1);o=Ho(a,c)}return i&&mf(o,i)<0&&(o=i),Mn(o)}function fve(){var e=Lr(),t=dve(e),r=cve(t,e.month),n=r[0],o=r[1],a=function(i){var s;if(!e.disableNavigation){var u=Mn(i);o(u),(s=e.onMonthChange)===null||s===void 0||s.call(e,u)}};return[n,a]}function mve(e,t){for(var r=t.reverseMonths,n=t.numberOfMonths,o=Mn(e),a=Mn(Ho(o,n)),i=mf(a,o),s=[],u=0;u<i;u++){var c=Ho(o,u);s.push(c)}return r&&(s=s.reverse()),s}function pve(e,t){if(!t.disableNavigation){var r=t.toDate,n=t.pagedNavigation,o=t.numberOfMonths,a=o===void 0?1:o,i=n?a:1,s=Mn(e);if(!r)return Ho(s,i);var u=mf(r,e);if(!(u<a))return Ho(s,i)}}function hve(e,t){if(!t.disableNavigation){var r=t.fromDate,n=t.pagedNavigation,o=t.numberOfMonths,a=o===void 0?1:o,i=n?a:1,s=Mn(e);if(!r)return Ho(s,-i);var u=mf(s,r);if(!(u<=0))return Ho(s,-i)}}var ML=m.createContext(void 0);function gve(e){var t=Lr(),r=fve(),n=r[0],o=r[1],a=mve(n,t),i=pve(n,t),s=hve(n,t),u=function(f){return a.some(function(h){return wN(f,h)})},c=function(f,h){u(f)||(h&&PD(f,h)?o(Ho(f,1+t.numberOfMonths*-1)):o(f))},d={currentMonth:n,displayMonths:a,goToMonth:o,goToDate:c,previousMonth:s,nextMonth:i,isDateDisplayed:u};return l.jsx(ML.Provider,{value:d,children:e.children})}function jc(){var e=m.useContext(ML);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function oA(e){var t,r=Lr(),n=r.classNames,o=r.styles,a=r.components,i=jc().goToMonth,s=function(d){i(Ho(d,e.displayIndex?-e.displayIndex:0))},u=(t=a?.CaptionLabel)!==null&&t!==void 0?t:AL,c=l.jsx(u,{id:e.id,displayMonth:e.displayMonth});return l.jsxs("div",{className:n.caption_dropdowns,style:o.caption_dropdowns,children:[l.jsx("div",{className:n.vhidden,children:c}),l.jsx(lve,{onChange:s,displayMonth:e.displayMonth}),l.jsx(uve,{onChange:s,displayMonth:e.displayMonth})]})}function bve(e){return l.jsx("svg",Ct({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:l.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function vve(e){return l.jsx("svg",Ct({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:l.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var _h=m.forwardRef(function(e,t){var r=Lr(),n=r.classNames,o=r.styles,a=[n.button_reset,n.button];e.className&&a.push(e.className);var i=a.join(" "),s=Ct(Ct({},o.button_reset),o.button);return e.style&&Object.assign(s,e.style),l.jsx("button",Ct({},e,{ref:t,type:"button",className:i,style:s}))});function yve(e){var t,r,n=Lr(),o=n.dir,a=n.locale,i=n.classNames,s=n.styles,u=n.labels,c=u.labelPrevious,d=u.labelNext,f=n.components;if(!e.nextMonth&&!e.previousMonth)return l.jsx(l.Fragment,{});var h=c(e.previousMonth,{locale:a}),p=[i.nav_button,i.nav_button_previous].join(" "),g=d(e.nextMonth,{locale:a}),b=[i.nav_button,i.nav_button_next].join(" "),v=(t=f?.IconRight)!==null&&t!==void 0?t:vve,x=(r=f?.IconLeft)!==null&&r!==void 0?r:bve;return l.jsxs("div",{className:i.nav,style:s.nav,children:[!e.hidePrevious&&l.jsx(_h,{name:"previous-month","aria-label":h,className:p,style:s.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:o==="rtl"?l.jsx(v,{className:i.nav_icon,style:s.nav_icon}):l.jsx(x,{className:i.nav_icon,style:s.nav_icon})}),!e.hideNext&&l.jsx(_h,{name:"next-month","aria-label":g,className:b,style:s.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:o==="rtl"?l.jsx(x,{className:i.nav_icon,style:s.nav_icon}):l.jsx(v,{className:i.nav_icon,style:s.nav_icon})})]})}function aA(e){var t=Lr().numberOfMonths,r=jc(),n=r.previousMonth,o=r.nextMonth,a=r.goToMonth,i=r.displayMonths,s=i.findIndex(function(g){return wN(e.displayMonth,g)}),u=s===0,c=s===i.length-1,d=t>1&&(u||!c),f=t>1&&(c||!u),h=function(){n&&a(n)},p=function(){o&&a(o)};return l.jsx(yve,{displayMonth:e.displayMonth,hideNext:d,hidePrevious:f,nextMonth:o,previousMonth:n,onPreviousClick:h,onNextClick:p})}function xve(e){var t,r=Lr(),n=r.classNames,o=r.disableNavigation,a=r.styles,i=r.captionLayout,s=r.components,u=(t=s?.CaptionLabel)!==null&&t!==void 0?t:AL,c;return o?c=l.jsx(u,{id:e.id,displayMonth:e.displayMonth}):i==="dropdown"?c=l.jsx(oA,{displayMonth:e.displayMonth,id:e.id}):i==="dropdown-buttons"?c=l.jsxs(l.Fragment,{children:[l.jsx(oA,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),l.jsx(aA,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):c=l.jsxs(l.Fragment,{children:[l.jsx(u,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),l.jsx(aA,{displayMonth:e.displayMonth,id:e.id})]}),l.jsx("div",{className:n.caption,style:a.caption,children:c})}function kve(e){var t=Lr(),r=t.footer,n=t.styles,o=t.classNames.tfoot;return r?l.jsx("tfoot",{className:o,style:n.tfoot,children:l.jsx("tr",{children:l.jsx("td",{colSpan:8,children:r})})}):l.jsx(l.Fragment,{})}function wve(e,t,r){for(var n=r?hl(new Date):Aa(new Date,{locale:e,weekStartsOn:t}),o=[],a=0;a<7;a++){var i=Wn(n,a);o.push(i)}return o}function jve(){var e=Lr(),t=e.classNames,r=e.styles,n=e.showWeekNumber,o=e.locale,a=e.weekStartsOn,i=e.ISOWeek,s=e.formatters.formatWeekdayName,u=e.labels.labelWeekday,c=wve(o,a,i);return l.jsxs("tr",{style:r.head_row,className:t.head_row,children:[n&&l.jsx("td",{style:r.head_cell,className:t.head_cell}),c.map(function(d,f){return l.jsx("th",{scope:"col",className:t.head_cell,style:r.head_cell,"aria-label":u(d,{locale:o}),children:s(d,{locale:o})},f)})]})}function Eve(){var e,t=Lr(),r=t.classNames,n=t.styles,o=t.components,a=(e=o?.HeadRow)!==null&&e!==void 0?e:jve;return l.jsx("thead",{style:n.head,className:r.head,children:l.jsx(a,{})})}function Nve(e){var t=Lr(),r=t.locale,n=t.formatters.formatDay;return l.jsx(l.Fragment,{children:n(e.date,{locale:r})})}var l1=m.createContext(void 0);function Sve(e){if(!Xf(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return l.jsx(l1.Provider,{value:t,children:e.children})}return l.jsx(Ove,{initialProps:e.initialProps,children:e.children})}function Ove(e){var t=e.initialProps,r=e.children,n=t.selected,o=t.min,a=t.max,i=function(c,d,f){var h,p;(h=t.onDayClick)===null||h===void 0||h.call(t,c,d,f);var g=!!(d.selected&&o&&n?.length===o);if(!g){var b=!!(!d.selected&&a&&n?.length===a);if(!b){var v=n?CL([],n):[];if(d.selected){var x=v.findIndex(function(k){return oo(c,k)});v.splice(x,1)}else v.push(c);(p=t.onSelect)===null||p===void 0||p.call(t,v,c,d,f)}}},s={disabled:[]};n&&s.disabled.push(function(c){var d=a&&n.length>a-1,f=n.some(function(h){return oo(h,c)});return!!(d&&!f)});var u={selected:n,onDayClick:i,modifiers:s};return l.jsx(l1.Provider,{value:u,children:r})}function u1(){var e=m.useContext(l1);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function Cve(e,t){var r=t||{},n=r.from,o=r.to;return n&&o?oo(o,e)&&oo(n,e)?void 0:oo(o,e)?{from:o,to:void 0}:oo(n,e)?void 0:Z2(n,e)?{from:e,to:o}:{from:n,to:e}:o?Z2(e,o)?{from:o,to:e}:{from:e,to:o}:n?PD(e,n)?{from:e,to:n}:{from:n,to:e}:{from:e,to:void 0}}var c1=m.createContext(void 0);function Pve(e){if(!Zf(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return l.jsx(c1.Provider,{value:t,children:e.children})}return l.jsx(Ave,{initialProps:e.initialProps,children:e.children})}function Ave(e){var t=e.initialProps,r=e.children,n=t.selected,o=n||{},a=o.from,i=o.to,s=t.min,u=t.max,c=function(p,g,b){var v,x;(v=t.onDayClick)===null||v===void 0||v.call(t,p,g,b);var k=Cve(p,n);(x=t.onSelect)===null||x===void 0||x.call(t,k,p,g,b)},d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(d.range_start=[a],i?(d.range_end=[i],oo(a,i)||(d.range_middle=[{after:a,before:i}])):d.range_end=[a]):i&&(d.range_start=[i],d.range_end=[i]),s&&(a&&!i&&d.disabled.push({after:np(a,s-1),before:Wn(a,s-1)}),a&&i&&d.disabled.push({after:a,before:Wn(a,s-1)}),!a&&i&&d.disabled.push({after:np(i,s-1),before:Wn(i,s-1)})),u){if(a&&!i&&(d.disabled.push({before:Wn(a,-u+1)}),d.disabled.push({after:Wn(a,u-1)})),a&&i){var f=pa(i,a)+1,h=u-f;d.disabled.push({before:np(a,h)}),d.disabled.push({after:Wn(i,h)})}!a&&i&&(d.disabled.push({before:Wn(i,-u+1)}),d.disabled.push({after:Wn(i,u-1)}))}return l.jsx(c1.Provider,{value:{selected:n,onDayClick:c,modifiers:d},children:r})}function d1(){var e=m.useContext(c1);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function ap(e){return Array.isArray(e)?CL([],e):e!==void 0?[e]:[]}function Tve(e){var t={};return Object.entries(e).forEach(function(r){var n=r[0],o=r[1];t[n]=ap(o)}),t}var na;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(na||(na={}));var Mve=na.Selected,Ua=na.Disabled,_ve=na.Hidden,Ive=na.Today,Ak=na.RangeEnd,Tk=na.RangeMiddle,Mk=na.RangeStart,Dve=na.Outside;function Lve(e,t,r){var n,o=(n={},n[Mve]=ap(e.selected),n[Ua]=ap(e.disabled),n[_ve]=ap(e.hidden),n[Ive]=[e.today],n[Ak]=[],n[Tk]=[],n[Mk]=[],n[Dve]=[],n);return e.fromDate&&o[Ua].push({before:e.fromDate}),e.toDate&&o[Ua].push({after:e.toDate}),Xf(e)?o[Ua]=o[Ua].concat(t.modifiers[Ua]):Zf(e)&&(o[Ua]=o[Ua].concat(r.modifiers[Ua]),o[Mk]=r.modifiers[Mk],o[Tk]=r.modifiers[Tk],o[Ak]=r.modifiers[Ak]),o}var _L=m.createContext(void 0);function Rve(e){var t=Lr(),r=u1(),n=d1(),o=Lve(t,r,n),a=Tve(t.modifiers),i=Ct(Ct({},o),a);return l.jsx(_L.Provider,{value:i,children:e.children})}function IL(){var e=m.useContext(_L);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Fve(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function $ve(e){return!!(e&&typeof e=="object"&&"from"in e)}function Bve(e){return!!(e&&typeof e=="object"&&"after"in e)}function zve(e){return!!(e&&typeof e=="object"&&"before"in e)}function Hve(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function qve(e,t){var r,n=t.from,o=t.to;if(n&&o){var a=pa(o,n)<0;a&&(r=[o,n],n=r[0],o=r[1]);var i=pa(e,n)>=0&&pa(o,e)>=0;return i}return o?oo(o,e):n?oo(n,e):!1}function Uve(e){return vN(e)}function Vve(e){return Array.isArray(e)&&e.every(vN)}function Wve(e,t){return t.some(function(r){if(typeof r=="boolean")return r;if(Uve(r))return oo(e,r);if(Vve(r))return r.includes(e);if($ve(r))return qve(e,r);if(Hve(r))return r.dayOfWeek.includes(e.getDay());if(Fve(r)){var n=pa(r.before,e),o=pa(r.after,e),a=n>0,i=o<0,s=Z2(r.before,r.after);return s?i&&a:a||i}return Bve(r)?pa(e,r.after)>0:zve(r)?pa(r.before,e)>0:typeof r=="function"?r(e):!1})}function f1(e,t,r){var n=Object.keys(t).reduce(function(a,i){var s=t[i];return Wve(e,s)&&a.push(i),a},[]),o={};return n.forEach(function(a){return o[a]=!0}),r&&!wN(e,r)&&(o.outside=!0),o}function Kve(e,t){for(var r=Mn(e[0]),n=yN(e[e.length-1]),o,a,i=r;i<=n;){var s=f1(i,t),u=!s.disabled&&!s.hidden;if(!u){i=Wn(i,1);continue}if(s.selected)return i;s.today&&!a&&(a=i),o||(o=i),i=Wn(i,1)}return a||o}var Yve=365;function DL(e,t){var r=t.moveBy,n=t.direction,o=t.context,a=t.modifiers,i=t.retry,s=i===void 0?{count:0,lastFocused:e}:i,u=o.weekStartsOn,c=o.fromDate,d=o.toDate,f=o.locale,h={day:Wn,week:G2,month:Ho,year:X2,startOfWeek:function(v){return o.ISOWeek?hl(v):Aa(v,{locale:f,weekStartsOn:u})},endOfWeek:function(v){return o.ISOWeek?ED(v):kN(v,{locale:f,weekStartsOn:u})}},p=h[r](e,n==="after"?1:-1);n==="before"&&c?p=wD([c,p]):n==="after"&&d&&(p=jD([d,p]));var g=!0;if(a){var b=f1(p,a);g=!b.disabled&&!b.hidden}return g?p:s.count>Yve?s.lastFocused:DL(p,{moveBy:r,direction:n,context:o,modifiers:a,retry:Ct(Ct({},s),{count:s.count+1})})}var LL=m.createContext(void 0);function Gve(e){var t=jc(),r=IL(),n=m.useState(),o=n[0],a=n[1],i=m.useState(),s=i[0],u=i[1],c=Kve(t.displayMonths,r),d=o??(s&&t.isDateDisplayed(s))?s:c,f=function(){u(o),a(void 0)},h=function(v){a(v)},p=Lr(),g=function(v,x){if(o){var k=DL(o,{moveBy:v,direction:x,context:p,modifiers:r});oo(o,k)||(t.goToDate(k,o),h(k))}},b={focusedDay:o,focusTarget:d,blur:f,focus:h,focusDayAfter:function(){return g("day","after")},focusDayBefore:function(){return g("day","before")},focusWeekAfter:function(){return g("week","after")},focusWeekBefore:function(){return g("week","before")},focusMonthBefore:function(){return g("month","before")},focusMonthAfter:function(){return g("month","after")},focusYearBefore:function(){return g("year","before")},focusYearAfter:function(){return g("year","after")},focusStartOfWeek:function(){return g("startOfWeek","before")},focusEndOfWeek:function(){return g("endOfWeek","after")}};return l.jsx(LL.Provider,{value:b,children:e.children})}function m1(){var e=m.useContext(LL);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function Xve(e,t){var r=IL(),n=f1(e,r,t);return n}var p1=m.createContext(void 0);function Zve(e){if(!xb(e.initialProps)){var t={selected:void 0};return l.jsx(p1.Provider,{value:t,children:e.children})}return l.jsx(Jve,{initialProps:e.initialProps,children:e.children})}function Jve(e){var t=e.initialProps,r=e.children,n=function(a,i,s){var u,c,d;if((u=t.onDayClick)===null||u===void 0||u.call(t,a,i,s),i.selected&&!t.required){(c=t.onSelect)===null||c===void 0||c.call(t,void 0,a,i,s);return}(d=t.onSelect)===null||d===void 0||d.call(t,a,a,i,s)},o={selected:t.selected,onDayClick:n};return l.jsx(p1.Provider,{value:o,children:r})}function RL(){var e=m.useContext(p1);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function Qve(e,t){var r=Lr(),n=RL(),o=u1(),a=d1(),i=m1(),s=i.focusDayAfter,u=i.focusDayBefore,c=i.focusWeekAfter,d=i.focusWeekBefore,f=i.blur,h=i.focus,p=i.focusMonthBefore,g=i.focusMonthAfter,b=i.focusYearBefore,v=i.focusYearAfter,x=i.focusStartOfWeek,k=i.focusEndOfWeek,E=function(B){var L,q,U,H;xb(r)?(L=n.onDayClick)===null||L===void 0||L.call(n,e,t,B):Xf(r)?(q=o.onDayClick)===null||q===void 0||q.call(o,e,t,B):Zf(r)?(U=a.onDayClick)===null||U===void 0||U.call(a,e,t,B):(H=r.onDayClick)===null||H===void 0||H.call(r,e,t,B)},j=function(B){var L;h(e),(L=r.onDayFocus)===null||L===void 0||L.call(r,e,t,B)},S=function(B){var L;f(),(L=r.onDayBlur)===null||L===void 0||L.call(r,e,t,B)},C=function(B){var L;(L=r.onDayMouseEnter)===null||L===void 0||L.call(r,e,t,B)},O=function(B){var L;(L=r.onDayMouseLeave)===null||L===void 0||L.call(r,e,t,B)},M=function(B){var L;(L=r.onDayPointerEnter)===null||L===void 0||L.call(r,e,t,B)},A=function(B){var L;(L=r.onDayPointerLeave)===null||L===void 0||L.call(r,e,t,B)},T=function(B){var L;(L=r.onDayTouchCancel)===null||L===void 0||L.call(r,e,t,B)},_=function(B){var L;(L=r.onDayTouchEnd)===null||L===void 0||L.call(r,e,t,B)},F=function(B){var L;(L=r.onDayTouchMove)===null||L===void 0||L.call(r,e,t,B)},$=function(B){var L;(L=r.onDayTouchStart)===null||L===void 0||L.call(r,e,t,B)},I=function(B){var L;(L=r.onDayKeyUp)===null||L===void 0||L.call(r,e,t,B)},R=function(B){var L;switch(B.key){case"ArrowLeft":B.preventDefault(),B.stopPropagation(),r.dir==="rtl"?s():u();break;case"ArrowRight":B.preventDefault(),B.stopPropagation(),r.dir==="rtl"?u():s();break;case"ArrowDown":B.preventDefault(),B.stopPropagation(),c();break;case"ArrowUp":B.preventDefault(),B.stopPropagation(),d();break;case"PageUp":B.preventDefault(),B.stopPropagation(),B.shiftKey?b():p();break;case"PageDown":B.preventDefault(),B.stopPropagation(),B.shiftKey?v():g();break;case"Home":B.preventDefault(),B.stopPropagation(),x();break;case"End":B.preventDefault(),B.stopPropagation(),k();break}(L=r.onDayKeyDown)===null||L===void 0||L.call(r,e,t,B)},W={onClick:E,onFocus:j,onBlur:S,onKeyDown:R,onKeyUp:I,onMouseEnter:C,onMouseLeave:O,onPointerEnter:M,onPointerLeave:A,onTouchCancel:T,onTouchEnd:_,onTouchMove:F,onTouchStart:$};return W}function eye(){var e=Lr(),t=RL(),r=u1(),n=d1(),o=xb(e)?t.selected:Xf(e)?r.selected:Zf(e)?n.selected:void 0;return o}function tye(e){return Object.values(na).includes(e)}function rye(e,t){var r=[e.classNames.day];return Object.keys(t).forEach(function(n){var o=e.modifiersClassNames[n];if(o)r.push(o);else if(tye(n)){var a=e.classNames["day_".concat(n)];a&&r.push(a)}}),r}function nye(e,t){var r=Ct({},e.styles.day);return Object.keys(t).forEach(function(n){var o;r=Ct(Ct({},r),(o=e.modifiersStyles)===null||o===void 0?void 0:o[n])}),r}function oye(e,t,r){var n,o,a,i=Lr(),s=m1(),u=Xve(e,t),c=Qve(e,u),d=eye(),f=!!(i.onDayClick||i.mode!=="default");m.useEffect(function(){var C;u.outside||s.focusedDay&&f&&oo(s.focusedDay,e)&&((C=r.current)===null||C===void 0||C.focus())},[s.focusedDay,e,r,f,u.outside]);var h=rye(i,u).join(" "),p=nye(i,u),g=!!(u.outside&&!i.showOutsideDays||u.hidden),b=(a=(o=i.components)===null||o===void 0?void 0:o.DayContent)!==null&&a!==void 0?a:Nve,v=l.jsx(b,{date:e,displayMonth:t,activeModifiers:u}),x={style:p,className:h,children:v,role:"gridcell"},k=s.focusTarget&&oo(s.focusTarget,e)&&!u.outside,E=s.focusedDay&&oo(s.focusedDay,e),j=Ct(Ct(Ct({},x),(n={disabled:u.disabled,role:"gridcell"},n["aria-selected"]=u.selected,n.tabIndex=E||k?0:-1,n)),c),S={isButton:f,isHidden:g,activeModifiers:u,selectedDays:d,buttonProps:j,divProps:x};return S}function aye(e){var t=m.useRef(null),r=oye(e.date,e.displayMonth,t);return r.isHidden?l.jsx("div",{role:"gridcell"}):r.isButton?l.jsx(_h,Ct({name:"day",ref:t},r.buttonProps)):l.jsx("div",Ct({},r.divProps))}function iye(e){var t=e.number,r=e.dates,n=Lr(),o=n.onWeekNumberClick,a=n.styles,i=n.classNames,s=n.locale,u=n.labels.labelWeekNumber,c=n.formatters.formatWeekNumber,d=c(Number(t),{locale:s});if(!o)return l.jsx("span",{className:i.weeknumber,style:a.weeknumber,children:d});var f=u(Number(t),{locale:s}),h=function(p){o(t,r,p)};return l.jsx(_h,{name:"week-number","aria-label":f,className:i.weeknumber,style:a.weeknumber,onClick:h,children:d})}function sye(e){var t,r,n=Lr(),o=n.styles,a=n.classNames,i=n.showWeekNumber,s=n.components,u=(t=s?.Day)!==null&&t!==void 0?t:aye,c=(r=s?.WeekNumber)!==null&&r!==void 0?r:iye,d;return i&&(d=l.jsx("td",{className:a.cell,style:o.cell,children:l.jsx(c,{number:e.weekNumber,dates:e.dates})})),l.jsxs("tr",{className:a.row,style:o.row,children:[d,e.dates.map(function(f){return l.jsx("td",{className:a.cell,style:o.cell,role:"presentation",children:l.jsx(u,{displayMonth:e.displayMonth,date:f})},wme(f))})]})}function iA(e,t,r){for(var n=r!=null&&r.ISOWeek?ED(t):kN(t,r),o=r!=null&&r.ISOWeek?hl(e):Aa(e,r),a=pa(n,o),i=[],s=0;s<=a;s++)i.push(Wn(o,s));var u=i.reduce(function(c,d){var f=r!=null&&r.ISOWeek?ND(d):OD(d,r),h=c.find(function(p){return p.weekNumber===f});return h?(h.dates.push(d),c):(c.push({weekNumber:f,dates:[d]}),c)},[]);return u}function lye(e,t){var r=iA(Mn(e),yN(e),t);if(t!=null&&t.useFixedWeeks){var n=Eme(e,t);if(n<6){var o=r[r.length-1],a=o.dates[o.dates.length-1],i=G2(a,6-n),s=iA(G2(a,1),i,t);r.push.apply(r,s)}}return r}function uye(e){var t,r,n,o=Lr(),a=o.locale,i=o.classNames,s=o.styles,u=o.hideHead,c=o.fixedWeeks,d=o.components,f=o.weekStartsOn,h=o.firstWeekContainsDate,p=o.ISOWeek,g=lye(e.displayMonth,{useFixedWeeks:!!c,ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:h}),b=(t=d?.Head)!==null&&t!==void 0?t:Eve,v=(r=d?.Row)!==null&&r!==void 0?r:sye,x=(n=d?.Footer)!==null&&n!==void 0?n:kve;return l.jsxs("table",{id:e.id,className:i.table,style:s.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!u&&l.jsx(b,{}),l.jsx("tbody",{className:i.tbody,style:s.tbody,children:g.map(function(k){return l.jsx(v,{displayMonth:e.displayMonth,dates:k.dates,weekNumber:k.weekNumber},k.weekNumber)})}),l.jsx(x,{displayMonth:e.displayMonth})]})}function cye(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var dye=cye()?m.useLayoutEffect:m.useEffect,_k=!1,fye=0;function sA(){return"react-day-picker-".concat(++fye)}function mye(e){var t,r=e??(_k?sA():null),n=m.useState(r),o=n[0],a=n[1];return dye(function(){o===null&&a(sA())},[]),m.useEffect(function(){_k===!1&&(_k=!0)},[]),(t=e??o)!==null&&t!==void 0?t:void 0}function pye(e){var t,r,n=Lr(),o=n.dir,a=n.classNames,i=n.styles,s=n.components,u=jc().displayMonths,c=mye(n.id?"".concat(n.id,"-").concat(e.displayIndex):void 0),d=n.id?"".concat(n.id,"-grid-").concat(e.displayIndex):void 0,f=[a.month],h=i.month,p=e.displayIndex===0,g=e.displayIndex===u.length-1,b=!p&&!g;o==="rtl"&&(t=[p,g],g=t[0],p=t[1]),p&&(f.push(a.caption_start),h=Ct(Ct({},h),i.caption_start)),g&&(f.push(a.caption_end),h=Ct(Ct({},h),i.caption_end)),b&&(f.push(a.caption_between),h=Ct(Ct({},h),i.caption_between));var v=(r=s?.Caption)!==null&&r!==void 0?r:xve;return l.jsxs("div",{className:f.join(" "),style:h,children:[l.jsx(v,{id:c,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),l.jsx(uye,{id:d,"aria-labelledby":c,displayMonth:e.displayMonth})]},e.displayIndex)}function hye(e){var t=Lr(),r=t.classNames,n=t.styles;return l.jsx("div",{className:r.months,style:n.months,children:e.children})}function gye(e){var t,r,n=e.initialProps,o=Lr(),a=m1(),i=jc(),s=m.useState(!1),u=s[0],c=s[1];m.useEffect(function(){o.initialFocus&&a.focusTarget&&(u||(a.focus(a.focusTarget),c(!0)))},[o.initialFocus,u,a.focus,a.focusTarget,a]);var d=[o.classNames.root,o.className];o.numberOfMonths>1&&d.push(o.classNames.multiple_months),o.showWeekNumber&&d.push(o.classNames.with_weeknumber);var f=Ct(Ct({},o.styles.root),o.style),h=Object.keys(n).filter(function(g){return g.startsWith("data-")}).reduce(function(g,b){var v;return Ct(Ct({},g),(v={},v[b]=n[b],v))},{}),p=(r=(t=n.components)===null||t===void 0?void 0:t.Months)!==null&&r!==void 0?r:hye;return l.jsx("div",Ct({className:d.join(" "),style:f,dir:o.dir,id:o.id,nonce:n.nonce,title:n.title,lang:n.lang},h,{children:l.jsx(p,{children:i.displayMonths.map(function(g,b){return l.jsx(pye,{displayIndex:b,displayMonth:g},b)})})}))}function bye(e){var t=e.children,r=zbe(e,["children"]);return l.jsx(ive,{initialProps:r,children:l.jsx(gve,{children:l.jsx(Zve,{initialProps:r,children:l.jsx(Sve,{initialProps:r,children:l.jsx(Pve,{initialProps:r,children:l.jsx(Rve,{children:l.jsx(Gve,{children:t})})})})})})})}function vye(e){return l.jsx(bye,Ct({},e,{children:l.jsx(gye,{initialProps:e})}))}const lA=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M10.8284 12.0007L15.7782 16.9504L14.364 18.3646L8 12.0007L14.364 5.63672L15.7782 7.05093L10.8284 12.0007Z"}))},uA=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z"}))},yye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M4.83582 12L11.0429 18.2071L12.4571 16.7929L7.66424 12L12.4571 7.20712L11.0429 5.79291L4.83582 12ZM10.4857 12L16.6928 18.2071L18.107 16.7929L13.3141 12L18.107 7.20712L16.6928 5.79291L10.4857 12Z"}))},xye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M19.1642 12L12.9571 5.79291L11.5429 7.20712L16.3358 12L11.5429 16.7929L12.9571 18.2071L19.1642 12ZM13.5143 12L7.30722 5.79291L5.89301 7.20712L10.6859 12L5.89301 16.7929L7.30722 18.2071L13.5143 12Z"}))},gt=y.forwardRef((e,t)=>{const{color:r,className:n,children:o}=e;return y.createElement("p",{ref:t,className:Z("text-tremor-default",r?Fe(r,He.text).textColor:Z("text-tremor-content","dark:text-dark-tremor-content"),n)},o)});gt.displayName="Text";const Bm=e=>{var{onClick:t,icon:r}=e,n=Re(e,["onClick","icon"]);const o=r;return y.createElement("button",Object.assign({type:"button",className:Z("flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle select-none dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content")},n),y.createElement(vD,{onClick:t,icon:o,variant:"simple",color:"slate",size:"sm"}))};function h1(e){var{mode:t,defaultMonth:r,selected:n,onSelect:o,locale:a,disabled:i,enableYearNavigation:s,classNames:u,weekStartsOn:c=0}=e,d=Re(e,["mode","defaultMonth","selected","onSelect","locale","disabled","enableYearNavigation","classNames","weekStartsOn"]);return y.createElement(vye,Object.assign({showOutsideDays:!0,mode:t,defaultMonth:r,selected:n,onSelect:o,locale:a,disabled:i,weekStartsOn:c,classNames:Object.assign({months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-2 relative items-center",caption_label:"text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium",nav:"space-x-1 flex items-center",nav_button:"flex items-center justify-center p-1 h-7 w-7 outline-none focus:ring-2 transition duration-100 border border-tremor-border dark:border-dark-tremor-border hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted rounded-tremor-small focus:border-tremor-brand-subtle dark:focus:border-dark-tremor-brand-subtle focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted text-tremor-content-subtle dark:text-dark-tremor-content-subtle hover:text-tremor-content dark:hover:text-dark-tremor-content",nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"w-9 font-normal text-center text-tremor-content-subtle dark:text-dark-tremor-content-subtle",row:"flex w-full mt-0.5",cell:"text-center p-0 relative focus-within:relative text-tremor-default text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",day:"h-9 w-9 p-0 hover:bg-tremor-background-subtle dark:hover:bg-dark-tremor-background-subtle outline-tremor-brand dark:outline-dark-tremor-brand rounded-tremor-default",day_today:"font-bold",day_selected:"aria-selected:bg-tremor-background-emphasis aria-selected:text-tremor-content-inverted dark:aria-selected:bg-dark-tremor-background-emphasis dark:aria-selected:text-dark-tremor-content-inverted ",day_disabled:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle disabled:hover:bg-transparent",day_outside:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle"},u),components:{IconLeft:f=>{var h=Re(f,[]);return y.createElement(lA,Object.assign({className:"h-4 w-4"},h))},IconRight:f=>{var h=Re(f,[]);return y.createElement(uA,Object.assign({className:"h-4 w-4"},h))},Caption:f=>{var h=Re(f,[]);const{goToMonth:p,nextMonth:g,previousMonth:b,currentMonth:v}=jc();return y.createElement("div",{className:"flex justify-between items-center"},y.createElement("div",{className:"flex items-center space-x-1"},s&&y.createElement(Bm,{onClick:()=>v&&p(X2(v,-1)),icon:yye}),y.createElement(Bm,{onClick:()=>b&&p(b),icon:lA})),y.createElement(gt,{className:"text-tremor-default tabular-nums capitalize text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis font-medium"},ro(h.displayMonth,"LLLL yyy",{locale:a})),y.createElement("div",{className:"flex items-center space-x-1"},y.createElement(Bm,{onClick:()=>g&&p(g),icon:uA}),s&&y.createElement(Bm,{onClick:()=>v&&p(X2(v,1)),icon:xye})))}}},d))}h1.displayName="DateRangePicker";const kye=xt("DatePicker"),ps=(e,t)=>{const r=t!==void 0,[n,o]=m.useState(e);return[r?t:n,a=>{r||o(a)}]},cA=xt("DateRangePicker"),wye=(e,t,r,n)=>{var o;if(r&&(e=(o=n.get(r))===null||o===void 0?void 0:o.from),e)return Ta(e&&!t?e:wD([e,t]))},jye=(e,t,r,n)=>{var o,a;if(r&&(e=Ta((a=(o=n.get(r))===null||o===void 0?void 0:o.to)!==null&&a!==void 0?a:qi())),e)return Ta(e&&!t?e:jD([e,t]))},Ik=[{value:"tdy",text:"Today",from:qi()},{value:"w",text:"Last 7 days",from:F7(qi(),{days:7})},{value:"t",text:"Last 30 days",from:F7(qi(),{days:30})},{value:"m",text:"Month to Date",from:Mn(qi())},{value:"y",text:"Year to Date",from:xN(qi())}],FL=(e,t,r,n)=>{const o=r?.code||"en-US";if(!e&&!t)return"";if(e&&!t){if(n)return ro(e,n);const a={year:"numeric",month:"short",day:"numeric"};return e.toLocaleDateString(o,a)}if(e&&t){if(Nme(e,t)){if(n)return ro(e,n);const a={year:"numeric",month:"short",day:"numeric"};return e.toLocaleDateString(o,a)}if(e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()){if(n)return`${ro(e,n)} - ${ro(t,n)}`;const a={month:"short",day:"numeric"};return`${e.toLocaleDateString(o,a)} -
139
+ ${t.getDate()}, ${t.getFullYear()}`}{if(n)return`${ro(e,n)} - ${ro(t,n)}`;const a={year:"numeric",month:"short",day:"numeric"};return`${e.toLocaleDateString(o,a)} -
140
+ ${t.toLocaleDateString(o,a)}`}}return""},gf=e=>["string","number"].includes(typeof e)?e:e instanceof Array?e.map(gf).join(""):typeof e=="object"&&e?gf(e.props.children):void 0;function g1(e){const t=new Map;return y.Children.map(e,r=>{var n;t.set(r.props.value,(n=gf(r))!==null&&n!==void 0?n:r.props.value)}),t}function nj(e,t){return y.Children.map(t,r=>{var n;if(((n=gf(r))!==null&&n!==void 0?n:r.props.value).toLowerCase().includes(e.toLowerCase()))return r})}const hs=(e,t,r=!1)=>Z(t?"bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle":"bg-tremor-background dark:bg-dark-tremor-background",!t&&"hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted",e?"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis":"text-tremor-content dark:text-dark-tremor-content",t&&"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",r&&"text-red-500 placeholder:text-red-500 dark:text-red-500 dark:placeholder:text-red-500",r?"border-red-500 dark:border-red-500":"border-tremor-border dark:border-dark-tremor-border");function gl(e){return e!=null&&e!==""}const Eye=qi(),Nye=y.forwardRef((e,t)=>{var r;const{value:n,defaultValue:o,onValueChange:a,minDate:i,maxDate:s,placeholder:u="Select date",disabled:c=!1,locale:d=Gg,enableClear:f=!0,displayFormat:h,className:p,enableYearNavigation:g=!1,weekStartsOn:b=0,disabledDates:v}=e,x=Re(e,["value","defaultValue","onValueChange","minDate","maxDate","placeholder","disabled","locale","enableClear","displayFormat","className","enableYearNavigation","weekStartsOn","disabledDates"]),[k,E]=ps(o,n),j=m.useMemo(()=>{const M=[];return i&&M.push({before:i}),s&&M.push({after:s}),[...M,...v??[]]},[i,s,v]),S=k?FL(k,void 0,d,h):u,C=Mn((r=k??s)!==null&&r!==void 0?r:Eye),O=f&&!c;return y.createElement(EL,Object.assign({ref:t,as:"div",className:Z("relative w-full min-w-[10rem] text-tremor-default","focus:ring-2 focus:ring-tremor-brand-muted dark:focus:ring-dark-tremor-brand-muted",p)},x),y.createElement(r1,{disabled:c,className:Z("w-full outline-none text-left whitespace-nowrap truncate focus:ring-2 transition duration-100 rounded-tremor-default flex flex-nowrap border pl-3 py-2","border-tremor-border shadow-tremor-input text-tremor-content-emphasis focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",O?"pr-8":"pr-4",hs(gl(k),c))},y.createElement(OL,{className:Z(kye("calendarIcon"),"flex-none shrink-0 h-5 w-5 mr-2 -ml-0.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle"),"aria-hidden":"true"}),y.createElement("p",{className:"truncate"},S)),O&&k?y.createElement("button",{type:"button",className:Z("absolute outline-none inset-y-0 right-0 flex items-center transition duration-100 mr-4"),onClick:M=>{M.preventDefault(),a?.(void 0),E(void 0)}},y.createElement(Gf,{className:Z("flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,y.createElement(ms,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},y.createElement(n1,{anchor:"bottom start",className:Z("z-10 min-w-min divide-y overflow-y-auto outline-none rounded-tremor-default p-3 border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},({close:M})=>y.createElement(h1,{showOutsideDays:!0,mode:"single",defaultMonth:C,selected:k,weekStartsOn:b,onSelect:A=>{a?.(A),E(A),M()},locale:d,disabled:j,enableYearNavigation:g}))))});Nye.displayName="DatePicker";const b1=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M11.9999 13.1714L16.9497 8.22168L18.3639 9.63589L11.9999 15.9999L5.63599 9.63589L7.0502 8.22168L11.9999 13.1714Z"}))},Dk=xt("Select"),v1=y.forwardRef((e,t)=>{const{defaultValue:r="",value:n,onValueChange:o,placeholder:a="Select...",disabled:i=!1,icon:s,enableClear:u=!1,required:c,children:d,name:f,error:h=!1,errorMessage:p,className:g,id:b}=e,v=Re(e,["defaultValue","value","onValueChange","placeholder","disabled","icon","enableClear","required","children","name","error","errorMessage","className","id"]),x=m.useRef(null),k=m.Children.toArray(d),[E,j]=ps(r,n),S=s,C=m.useMemo(()=>{const O=y.Children.toArray(d).filter(m.isValidElement);return g1(O)},[d]);return y.createElement("div",{className:Z("w-full min-w-[10rem] text-tremor-default",g)},y.createElement("div",{className:"relative"},y.createElement("select",{title:"select-hidden",required:c,className:Z("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:E,onChange:O=>{O.preventDefault()},name:f,disabled:i,id:b,onFocus:()=>{const O=x.current;O&&O.focus()}},y.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},a),k.map(O=>{const M=O.props.value,A=O.props.children;return y.createElement("option",{className:"hidden",key:M,value:M},A)})),y.createElement(JN,Object.assign({as:"div",ref:t,defaultValue:E,value:E,onChange:O=>{o?.(O),j(O)},disabled:i,id:b},v),({value:O})=>{var M;return y.createElement(y.Fragment,null,y.createElement(pb,{ref:x,className:Z("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",S?"pl-10":"pl-3",hs(gl(O),i,h))},S&&y.createElement("span",{className:Z("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},y.createElement(S,{className:Z(Dk("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),y.createElement("span",{className:"w-[90%] block truncate"},O&&(M=C.get(O))!==null&&M!==void 0?M:a),y.createElement("span",{className:Z("absolute inset-y-0 right-0 flex items-center mr-3")},y.createElement(b1,{className:Z(Dk("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),u&&E?y.createElement("button",{type:"button",className:Z("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:A=>{A.preventDefault(),j(""),o?.("")}},y.createElement(Gf,{className:Z(Dk("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,y.createElement(ms,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},y.createElement(hb,{anchor:"bottom start",className:Z("z-10 w-[var(--button-width)] divide-y overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},d)))})),h&&p?y.createElement("p",{className:Z("errorMessage","text-sm text-rose-500 mt-1")},p):null)});v1.displayName="Select";const dA=xt("SelectItem"),Zi=y.forwardRef((e,t)=>{const{value:r,icon:n,className:o,children:a}=e,i=Re(e,["value","icon","className","children"]),s=n;return y.createElement(ZN,Object.assign({className:Z(dA("root"),"flex justify-start items-center cursor-default text-tremor-default px-2.5 py-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[selected]:text-tremor-content-strong data-[selected]:bg-tremor-background-muted text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[selected]:text-dark-tremor-content-strong dark:data-[selected]:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",o),ref:t,key:r,value:r},i),s&&y.createElement(s,{className:Z(dA("icon"),"flex-none w-5 h-5 mr-1.5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),y.createElement("span",{className:"whitespace-nowrap truncate"},a??r))});Zi.displayName="SelectItem";const Lk=qi(),Sye=y.forwardRef((e,t)=>{var r,n;const{value:o,defaultValue:a,onValueChange:i,enableSelect:s=!0,minDate:u,maxDate:c,placeholder:d="Select range",selectPlaceholder:f="Select range",disabled:h=!1,locale:p=Gg,enableClear:g=!0,displayFormat:b,children:v,className:x,enableYearNavigation:k=!1,weekStartsOn:E=0,disabledDates:j}=e,S=Re(e,["value","defaultValue","onValueChange","enableSelect","minDate","maxDate","placeholder","selectPlaceholder","disabled","locale","enableClear","displayFormat","children","className","enableYearNavigation","weekStartsOn","disabledDates"]),[C,O]=ps(a,o),[M,A]=m.useState(!1),[T,_]=m.useState(!1),F=m.useMemo(()=>{const H=[];return u&&H.push({before:u}),c&&H.push({after:c}),[...H,...j??[]]},[u,c,j]),$=m.useMemo(()=>{const H=new Map;return v?y.Children.forEach(v,X=>{var Y;H.set(X.props.value,{text:(Y=gf(X))!==null&&Y!==void 0?Y:X.props.value,from:X.props.from,to:X.props.to})}):Ik.forEach(X=>{H.set(X.value,{text:X.text,from:X.from,to:Lk})}),H},[v]),I=m.useMemo(()=>{if(v)return g1(v);const H=new Map;return Ik.forEach(X=>H.set(X.value,X.text)),H},[v]),R=C?.selectValue||"",W=wye(C?.from,u,R,$),B=jye(C?.to,c,R,$),L=W||B?FL(W,B,p,b):d,q=Mn((n=(r=B??W)!==null&&r!==void 0?r:c)!==null&&n!==void 0?n:Lk),U=g&&!h;return y.createElement("div",Object.assign({ref:t,className:Z("w-full min-w-[10rem] relative flex justify-between text-tremor-default max-w-sm shadow-tremor-input dark:shadow-dark-tremor-input rounded-tremor-default",x)},S),y.createElement(EL,{as:"div",className:Z("w-full",s?"rounded-l-tremor-default":"rounded-tremor-default",M&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10")},y.createElement("div",{className:"relative w-full"},y.createElement(r1,{onFocus:()=>A(!0),onBlur:()=>A(!1),disabled:h,className:Z("w-full outline-none text-left whitespace-nowrap truncate focus:ring-2 transition duration-100 rounded-l-tremor-default flex flex-nowrap border pl-3 py-2","rounded-l-tremor-default border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",s?"rounded-l-tremor-default":"rounded-tremor-default",U?"pr-8":"pr-4",hs(gl(W||B),h))},y.createElement(OL,{className:Z(cA("calendarIcon"),"flex-none shrink-0 h-5 w-5 -ml-0.5 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle"),"aria-hidden":"true"}),y.createElement("p",{className:"truncate"},L)),U&&W?y.createElement("button",{type:"button",className:Z("absolute outline-none inset-y-0 right-0 flex items-center transition duration-100 mr-4"),onClick:H=>{H.preventDefault(),i?.({}),O({})}},y.createElement(Gf,{className:Z(cA("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null),y.createElement(ms,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},y.createElement(n1,{anchor:"bottom start",focus:!0,className:Z("min-w-min divide-y overflow-y-auto outline-none rounded-tremor-default p-3 border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},y.createElement(h1,Object.assign({mode:"range",showOutsideDays:!0,defaultMonth:q,selected:{from:W,to:B},onSelect:H=>{i?.({from:H?.from,to:H?.to}),O({from:H?.from,to:H?.to})},locale:p,disabled:F,enableYearNavigation:k,classNames:{day_range_middle:Z("!rounded-none aria-selected:!bg-tremor-background-subtle aria-selected:dark:!bg-dark-tremor-background-subtle aria-selected:!text-tremor-content aria-selected:dark:!bg-dark-tremor-background-subtle"),day_range_start:"rounded-r-none rounded-l-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted",day_range_end:"rounded-l-none rounded-r-tremor-small aria-selected:text-tremor-brand-inverted dark:aria-selected:text-dark-tremor-brand-inverted"},weekStartsOn:E},e))))),s&&y.createElement(JN,{as:"div",className:Z("w-48 -ml-px rounded-r-tremor-default",T&&"ring-2 ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted z-10"),value:R,onChange:H=>{const{from:X,to:Y}=$.get(H),ae=Y??Lk;i?.({from:X,to:ae,selectValue:H}),O({from:X,to:ae,selectValue:H})},disabled:h},({value:H})=>{var X;return y.createElement(y.Fragment,null,y.createElement(pb,{onFocus:()=>_(!0),onBlur:()=>_(!1),className:Z("w-full outline-none text-left whitespace-nowrap truncate rounded-r-tremor-default transition duration-100 border px-4 py-2","border-tremor-border text-tremor-content-emphasis focus:border-tremor-brand-subtle","dark:border-dark-tremor-border dark:text-dark-tremor-content-emphasis dark:focus:border-dark-tremor-brand-subtle",hs(gl(H),h))},H&&(X=I.get(H))!==null&&X!==void 0?X:f),y.createElement(ms,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},y.createElement(hb,{anchor:"bottom end",className:Z("[--anchor-gap:4px] divide-y overflow-y-auto outline-none border min-w-44","shadow-tremor-dropdown bg-tremor-background border-tremor-border divide-tremor-border rounded-tremor-default","dark:shadow-dark-tremor-dropdown dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border")},v??Ik.map(Y=>y.createElement(Zi,{key:Y.value,value:Y.value},Y.text)))))}))});Sye.displayName="DateRangePicker";const Oye=y.forwardRef((e,t)=>{const{value:r,className:n,children:o}=e,a=Re(e,["value","className","children"]);return y.createElement(Zi,Object.assign({ref:t,className:n,value:r},a),o??r)});Oye.displayName="DateRangePickerItem";const $L=m.createContext(et.Blue),BL=m.createContext(0),jd=m.createContext(void 0),kb=m.createContext({selectedValue:void 0,handleValueChange:void 0}),Cye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748Z"}))},Pye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t),y.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))},zm=xt("MultiSelect"),Aye=y.forwardRef((e,t)=>{const{defaultValue:r=[],value:n,onValueChange:o,placeholder:a="Select...",placeholderSearch:i="Search",disabled:s=!1,icon:u,children:c,className:d,required:f,name:h,error:p=!1,errorMessage:g,id:b}=e,v=Re(e,["defaultValue","value","onValueChange","placeholder","placeholderSearch","disabled","icon","children","className","required","name","error","errorMessage","id"]),x=m.useRef(null),k=u,[E,j]=ps(r,n),{reactElementChildren:S,optionsAvailable:C}=m.useMemo(()=>{const F=y.Children.toArray(c).filter(m.isValidElement);return{reactElementChildren:F,optionsAvailable:nj("",F)}},[c]),[O,M]=m.useState(""),A=(E??[]).length>0,T=m.useMemo(()=>O?nj(O,S):C,[O,S,C]),_=()=>{M("")};return y.createElement("div",{className:Z("w-full min-w-[10rem] text-tremor-default",d)},y.createElement("div",{className:"relative"},y.createElement("select",{title:"multi-select-hidden",required:f,className:Z("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:E,onChange:F=>{F.preventDefault()},name:h,disabled:s,multiple:!0,id:b,onFocus:()=>{const F=x.current;F&&F.focus()}},y.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},a),T.map(F=>{const $=F.props.value,I=F.props.children;return y.createElement("option",{className:"hidden",key:$,value:$},I)})),y.createElement(JN,Object.assign({as:"div",ref:t,defaultValue:E,value:E,onChange:F=>{o?.(F),j(F)},disabled:s,id:b,multiple:!0},v),({value:F})=>y.createElement(y.Fragment,null,y.createElement(pb,{className:Z("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 border pr-8 py-1.5","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",k?"pl-11 -ml-0.5":"pl-3",hs(F.length>0,s,p)),ref:x},k&&y.createElement("span",{className:Z("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},y.createElement(k,{className:Z(zm("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),y.createElement("div",{className:"h-6 flex items-center"},F.length>0?y.createElement("div",{className:"flex flex-nowrap overflow-x-scroll [&::-webkit-scrollbar]:hidden [scrollbar-width:none] gap-x-1 mr-5 -ml-1.5 relative"},C.filter($=>F.includes($.props.value)).map(($,I)=>{var R;return y.createElement("div",{key:I,className:Z("max-w-[100px] lg:max-w-[200px] flex justify-center items-center pl-2 pr-1.5 py-1 font-medium","rounded-tremor-small","bg-tremor-background-muted dark:bg-dark-tremor-background-muted","bg-tremor-background-subtle dark:bg-dark-tremor-background-subtle","text-tremor-content-default dark:text-dark-tremor-content-default","text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis")},y.createElement("div",{className:"text-xs truncate "},(R=$.props.children)!==null&&R!==void 0?R:$.props.value),y.createElement("div",{onClick:W=>{W.preventDefault();const B=F.filter(L=>L!==$.props.value);o?.(B),j(B)}},y.createElement(Pye,{className:Z(zm("clearIconItem"),"cursor-pointer rounded-tremor-full w-3.5 h-3.5 ml-2","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle dark:hover:text-tremor-content")})))})):y.createElement("span",null,a)),y.createElement("span",{className:Z("absolute inset-y-0 right-0 flex items-center mr-2.5")},y.createElement(b1,{className:Z(zm("arrowDownIcon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}))),A&&!s?y.createElement("button",{type:"button",className:Z("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:$=>{$.preventDefault(),j([]),o?.([])}},y.createElement(Gf,{className:Z(zm("clearIconAllItems"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,y.createElement(ms,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},y.createElement(hb,{anchor:"bottom start",className:Z("z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},y.createElement("div",{className:Z("flex items-center w-full px-2.5","bg-tremor-background-muted","dark:bg-dark-tremor-background-muted")},y.createElement("span",null,y.createElement(Cye,{className:Z("flex-none w-4 h-4 mr-2","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),y.createElement("input",{name:"search",type:"input",autoComplete:"off",placeholder:i,className:Z("w-full focus:outline-none focus:ring-none bg-transparent text-tremor-default py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-subtle"),onKeyDown:$=>{$.code==="Space"&&$.target.value!==""&&$.stopPropagation()},onChange:$=>M($.target.value),value:O})),y.createElement(kb.Provider,Object.assign({},{onBlur:{handleResetSearch:_}},{value:{selectedValue:F}}),T)))))),p&&g?y.createElement("p",{className:Z("errorMessage","text-sm text-rose-500 mt-1")},g):null)});Aye.displayName="MultiSelect";const fA=xt("MultiSelectItem"),Tye=y.forwardRef((e,t)=>{const{value:r,className:n,children:o}=e,a=Re(e,["value","className","children"]),{selectedValue:i}=m.useContext(kb),s=bde(r,i);return y.createElement(ZN,Object.assign({className:Z(fA("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[select]ed:text-tremor-content-strong text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[select]ed:text-dark-tremor-content-strong dark:data-[select]ed:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",n),ref:t,key:r,value:r},a),y.createElement("input",{type:"checkbox",className:Z(fA("checkbox"),"flex-none focus:ring-none focus:outline-none cursor-pointer mr-2.5","accent-tremor-brand","dark:accent-dark-tremor-brand"),checked:s,readOnly:!0}),y.createElement("span",{className:"whitespace-nowrap truncate"},o??r))});Tye.displayName="MultiSelectItem";const Mye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),y.createElement("path",{d:"M12 4v16m8-8H4"}))},_ye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({},t,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2.5"}),y.createElement("path",{d:"M20 12H4"}))},Iye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM11 15V17H13V15H11ZM11 7V13H13V7H11Z"}))},Dye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M1.18164 12C2.12215 6.87976 6.60812 3 12.0003 3C17.3924 3 21.8784 6.87976 22.8189 12C21.8784 17.1202 17.3924 21 12.0003 21C6.60812 21 2.12215 17.1202 1.18164 12ZM12.0003 17C14.7617 17 17.0003 14.7614 17.0003 12C17.0003 9.23858 14.7617 7 12.0003 7C9.23884 7 7.00026 9.23858 7.00026 12C7.00026 14.7614 9.23884 17 12.0003 17ZM12.0003 15C10.3434 15 9.00026 13.6569 9.00026 12C9.00026 10.3431 10.3434 9 12.0003 9C13.6571 9 15.0003 10.3431 15.0003 12C15.0003 13.6569 13.6571 15 12.0003 15Z"}))},Lye=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M4.52047 5.93457L1.39366 2.80777L2.80788 1.39355L22.6069 21.1925L21.1927 22.6068L17.8827 19.2968C16.1814 20.3755 14.1638 21.0002 12.0003 21.0002C6.60812 21.0002 2.12215 17.1204 1.18164 12.0002C1.61832 9.62282 2.81932 7.5129 4.52047 5.93457ZM14.7577 16.1718L13.2937 14.7078C12.902 14.8952 12.4634 15.0002 12.0003 15.0002C10.3434 15.0002 9.00026 13.657 9.00026 12.0002C9.00026 11.537 9.10522 11.0984 9.29263 10.7067L7.82866 9.24277C7.30514 10.0332 7.00026 10.9811 7.00026 12.0002C7.00026 14.7616 9.23884 17.0002 12.0003 17.0002C13.0193 17.0002 13.9672 16.6953 14.7577 16.1718ZM7.97446 3.76015C9.22127 3.26959 10.5793 3.00016 12.0003 3.00016C17.3924 3.00016 21.8784 6.87992 22.8189 12.0002C22.5067 13.6998 21.8038 15.2628 20.8068 16.5925L16.947 12.7327C16.9821 12.4936 17.0003 12.249 17.0003 12.0002C17.0003 9.23873 14.7617 7.00016 12.0003 7.00016C11.7514 7.00016 11.5068 7.01833 11.2677 7.05343L7.97446 3.76015Z"}))},y1=y.forwardRef((e,t)=>{const{value:r,defaultValue:n,type:o,placeholder:a="Type...",icon:i,error:s=!1,errorMessage:u,disabled:c=!1,stepper:d,makeInputClassName:f,className:h,onChange:p,onValueChange:g,autoFocus:b,pattern:v}=e,x=Re(e,["value","defaultValue","type","placeholder","icon","error","errorMessage","disabled","stepper","makeInputClassName","className","onChange","onValueChange","autoFocus","pattern"]),[k,E]=m.useState(b||!1),[j,S]=m.useState(!1),C=m.useCallback(()=>S(!j),[j,S]),O=i,M=m.useRef(null),A=gl(r||n);return y.useEffect(()=>{const T=()=>E(!0),_=()=>E(!1),F=M.current;return F&&(F.addEventListener("focus",T),F.addEventListener("blur",_),b&&F.focus()),()=>{F&&(F.removeEventListener("focus",T),F.removeEventListener("blur",_))}},[b]),y.createElement(y.Fragment,null,y.createElement("div",{className:Z(f("root"),"relative w-full flex items-center min-w-[10rem] outline-none rounded-tremor-default transition duration-100 border","shadow-tremor-input","dark:shadow-dark-tremor-input",hs(A,c,s),k&&Z("ring-2","border-tremor-brand-subtle ring-tremor-brand-muted","dark:border-dark-tremor-brand-subtle dark:ring-dark-tremor-brand-muted"),h)},O?y.createElement(O,{className:Z(f("icon"),"shrink-0 h-5 w-5 mx-2.5 absolute left-0 flex items-center","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}):null,y.createElement("input",Object.assign({ref:ji([M,t]),defaultValue:n,value:r,type:j?"text":o,className:Z(f("input"),"w-full bg-transparent focus:outline-none focus:ring-0 border-none text-tremor-default rounded-tremor-default transition duration-100 py-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",o==="password"?s?"pr-16":"pr-12":s?"pr-8":"pr-3",O?"pl-10":"pl-3",c?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content"),placeholder:a,disabled:c,"data-testid":"base-input",onChange:T=>{p?.(T),g?.(T.target.value)},pattern:v},x)),o!=="password"||c?null:y.createElement("button",{className:Z(f("toggleButton"),"absolute inset-y-0 right-0 flex items-center px-2.5 rounded-lg"),type:"button",onClick:()=>C(),"aria-label":j?"Hide password":"Show Password"},j?y.createElement(Lye,{className:Z("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0}):y.createElement(Dye,{className:Z("flex-none h-5 w-5 transition","text-tremor-content-subtle hover:text-tremor-content","dark:text-dark-tremor-content-subtle hover:dark:text-dark-tremor-content"),"aria-hidden":!0})),s?y.createElement(Iye,{className:Z(f("errorIcon"),"text-red-500 shrink-0 h-5 w-5 absolute right-0 flex items-center",o==="password"?"mr-10":o==="number"?d?"mr-20":"mr-3":"mx-2.5")}):null,d??null),s&&u?y.createElement("p",{className:Z(f("errorMessage"),"text-sm text-red-500 mt-1")},u):null)});y1.displayName="BaseInput";const mA="flex mx-auto text-tremor-content-subtle dark:text-dark-tremor-content-subtle",pA="cursor-pointer hover:text-tremor-content dark:hover:text-dark-tremor-content",Rye=y.forwardRef((e,t)=>{const{onSubmit:r,enableStepper:n=!0,disabled:o,onValueChange:a,onChange:i}=e,s=Re(e,["onSubmit","enableStepper","disabled","onValueChange","onChange"]),u=m.useRef(null),[c,d]=y.useState(!1),f=y.useCallback(()=>{d(!0)},[]),h=y.useCallback(()=>{d(!1)},[]),[p,g]=y.useState(!1),b=y.useCallback(()=>{g(!0)},[]),v=y.useCallback(()=>{g(!1)},[]);return y.createElement(y1,Object.assign({type:"number",ref:ji([u,t]),disabled:o,makeInputClassName:xt("NumberInput"),onKeyDown:x=>{var k;if(x.key==="Enter"&&!x.ctrlKey&&!x.altKey&&!x.shiftKey){const E=(k=u.current)===null||k===void 0?void 0:k.value;r?.(parseFloat(E??""))}x.key==="ArrowDown"&&f(),x.key==="ArrowUp"&&b()},onKeyUp:x=>{x.key==="ArrowDown"&&h(),x.key==="ArrowUp"&&v()},onChange:x=>{o||(a?.(parseFloat(x.target.value)),i?.(x))},stepper:n?y.createElement("div",{className:Z("flex justify-center align-middle")},y.createElement("div",{tabIndex:-1,onClick:x=>x.preventDefault(),onMouseDown:x=>x.preventDefault(),onTouchStart:x=>{x.cancelable&&x.preventDefault()},onMouseUp:()=>{var x,k;o||((x=u.current)===null||x===void 0||x.stepDown(),(k=u.current)===null||k===void 0||k.dispatchEvent(new Event("input",{bubbles:!0})))},className:Z(!o&&pA,mA,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},y.createElement(_ye,{"data-testid":"step-down",className:(c?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"})),y.createElement("div",{tabIndex:-1,onClick:x=>x.preventDefault(),onMouseDown:x=>x.preventDefault(),onTouchStart:x=>{x.cancelable&&x.preventDefault()},onMouseUp:()=>{var x,k;o||((x=u.current)===null||x===void 0||x.stepUp(),(k=u.current)===null||k===void 0||k.dispatchEvent(new Event("input",{bubbles:!0})))},className:Z(!o&&pA,mA,"group py-[10px] px-2.5 border-l border-tremor-border dark:border-dark-tremor-border")},y.createElement(Mye,{"data-testid":"step-up",className:(p?"scale-95":"")+" h-4 w-4 duration-75 transition group-active:scale-95"}))):null},s))});Rye.displayName="NumberInput";const hA=xt("SearchSelect"),Fye=xt("SearchSelect"),$ye=y.forwardRef((e,t)=>{const{defaultValue:r="",searchValue:n,onSearchValueChange:o,value:a,onValueChange:i,placeholder:s="Select...",disabled:u=!1,icon:c,enableClear:d=!0,name:f,required:h,error:p=!1,errorMessage:g,children:b,className:v,id:x,autoComplete:k="off"}=e,E=Re(e,["defaultValue","searchValue","onSearchValueChange","value","onValueChange","placeholder","disabled","icon","enableClear","name","required","error","errorMessage","children","className","id","autoComplete"]),j=m.useRef(null),[S,C]=ps("",n),[O,M]=ps(r,a),A=c,{reactElementChildren:T,valueToNameMapping:_}=m.useMemo(()=>{const $=y.Children.toArray(b).filter(m.isValidElement);return{reactElementChildren:$,valueToNameMapping:g1($)}},[b]),F=m.useMemo(()=>nj(S??"",T),[S,T]);return y.createElement("div",{className:Z("w-full min-w-[10rem] text-tremor-default",v)},y.createElement("div",{className:"relative"},y.createElement("select",{title:"search-select-hidden",required:h,className:Z("h-full w-full absolute left-0 top-0 -z-10 opacity-0"),value:O,onChange:$=>{$.preventDefault()},name:f,disabled:u,id:x,onFocus:()=>{const $=j.current;$&&$.focus()}},y.createElement("option",{className:"hidden",value:"",disabled:!0,hidden:!0},s),F.map($=>{const I=$.props.value,R=$.props.children;return y.createElement("option",{className:"hidden",key:I,value:I},R)})),y.createElement(jhe,Object.assign({as:"div",ref:t,defaultValue:O,value:O,onChange:$=>{i?.($),M($)},disabled:u,id:x},E),({value:$})=>y.createElement(y.Fragment,null,y.createElement(iL,{className:"w-full"},A&&y.createElement("span",{className:Z("absolute inset-y-0 left-0 flex items-center ml-px pl-2.5")},y.createElement(A,{className:Z(hA("Icon"),"flex-none h-5 w-5","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})),y.createElement(sL,{ref:j,className:Z("w-full outline-none text-left whitespace-nowrap truncate rounded-tremor-default focus:ring-2 transition duration-100 text-tremor-default pr-14 border py-2","border-tremor-border shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:border-dark-tremor-border dark:shadow-dark-tremor-input dark:focus:border-dark-tremor-brand-subtle dark:focus:ring-dark-tremor-brand-muted",A?"pl-10":"pl-3",u?"placeholder:text-tremor-content-subtle dark:placeholder:text-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-tremor-content",hs(gl($),u,p)),placeholder:s,onChange:I=>{o?.(I.target.value),C(I.target.value)},displayValue:I=>{var R;return(R=_.get(I))!==null&&R!==void 0?R:""},autoComplete:k}),y.createElement("div",{className:Z("absolute inset-y-0 right-0 flex items-center pr-2.5")},y.createElement(b1,{className:Z(hA("arrowDownIcon"),"flex-none h-5 w-5","!text-tremor-content-subtle","!dark:text-dark-tremor-content-subtle")}))),d&&O?y.createElement("button",{type:"button",className:Z("absolute inset-y-0 right-0 flex items-center mr-8"),onClick:I=>{I.preventDefault(),M(""),C(""),i?.(""),o?.("")}},y.createElement(Gf,{className:Z(Fye("clearIcon"),"flex-none h-4 w-4","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")})):null,F.length>0&&y.createElement(ms,{enter:"transition ease duration-100 transform",enterFrom:"opacity-0 -translate-y-4",enterTo:"opacity-100 translate-y-0",leave:"transition ease duration-100 transform",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-4"},y.createElement(lL,{anchor:"bottom start",className:Z("z-10 divide-y w-[var(--button-width)] overflow-y-auto outline-none rounded-tremor-default text-tremor-default max-h-[228px] border [--anchor-gap:4px]","bg-tremor-background border-tremor-border divide-tremor-border shadow-tremor-dropdown","dark:bg-dark-tremor-background dark:border-dark-tremor-border dark:divide-dark-tremor-border dark:shadow-dark-tremor-dropdown")},F))))),p&&g?y.createElement("p",{className:Z("errorMessage","text-sm text-rose-500 mt-1")},g):null)});$ye.displayName="SearchSelect";const gA=xt("SearchSelectItem"),Bye=y.forwardRef((e,t)=>{const{value:r,icon:n,className:o,children:a}=e,i=Re(e,["value","icon","className","children"]),s=n;return y.createElement(uL,Object.assign({className:Z(gA("root"),"flex justify-start items-center cursor-default text-tremor-default p-2.5","data-[focus]:bg-tremor-background-muted data-[focus]:text-tremor-content-strong data-[selected]:text-tremor-content-strong data-[selected]:bg-tremor-background-muted text-tremor-content-emphasis","dark:data-[focus]:bg-dark-tremor-background-muted dark:data-[focus]:text-dark-tremor-content-strong dark:data-[selected]:text-dark-tremor-content-strong dark:data-[selected]:bg-dark-tremor-background-muted dark:text-dark-tremor-content-emphasis",o),ref:t,key:r,value:r},i),s&&y.createElement(s,{className:Z(gA("icon"),"flex-none h-5 w-5 mr-3","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle")}),y.createElement("span",{className:"whitespace-nowrap truncate"},a??r))});Bye.displayName="SearchSelectItem";const Ds=xt("Switch"),zye=y.forwardRef((e,t)=>{const{checked:r,defaultChecked:n=!1,onChange:o,color:a,name:i,error:s,errorMessage:u,disabled:c,required:d,tooltip:f,id:h}=e,p=Re(e,["checked","defaultChecked","onChange","color","name","error","errorMessage","disabled","required","tooltip","id"]),g=(S=>({bgColor:S?Fe(S,He.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",ringColor:S?Fe(S,He.ring).ringColor:"ring-tremor-brand-muted dark:ring-dark-tremor-brand-muted"}))(a),[b,v]=ps(n,r),[x,k]=m.useState(!1),{tooltipProps:E,getReferenceProps:j}=zo(300);return y.createElement("div",{className:"flex flex-row items-center justify-start"},y.createElement(Po,Object.assign({text:f},E)),y.createElement("div",Object.assign({ref:ji([t,E.refs.setReference]),className:Z(Ds("root"),"flex flex-row relative h-5")},p,j),y.createElement("input",{type:"checkbox",className:Z(Ds("input"),"absolute w-5 h-5 cursor-pointer left-0 top-0 opacity-0"),name:i,required:d,checked:b,onChange:S=>{S.preventDefault()}}),y.createElement(gbe,{checked:b,onChange:S=>{v(S),o?.(S)},disabled:c,className:Z(Ds("switch"),"w-10 h-5 group relative inline-flex shrink-0 cursor-pointer items-center justify-center rounded-tremor-full","focus:outline-none",c?"cursor-not-allowed":""),onFocus:()=>k(!0),onBlur:()=>k(!1),id:h},y.createElement("span",{className:Z(Ds("sr-only"),"sr-only")},"Switch ",b?"on":"off"),y.createElement("span",{"aria-hidden":"true",className:Z(Ds("background"),b?g.bgColor:"bg-tremor-border dark:bg-dark-tremor-border","pointer-events-none absolute mx-auto h-3 w-9 rounded-tremor-full transition-colors duration-100 ease-in-out")}),y.createElement("span",{"aria-hidden":"true",className:Z(Ds("round"),b?Z(g.bgColor,"translate-x-5 border-tremor-background dark:border-dark-tremor-background"):"translate-x-0 bg-tremor-border dark:bg-dark-tremor-border border-tremor-background dark:border-dark-tremor-background","pointer-events-none absolute left-0 inline-block h-5 w-5 transform rounded-tremor-full border-2 shadow-tremor-input duration-100 ease-in-out transition",x?Z("ring-2",g.ringColor):"")}))),s&&u?y.createElement("p",{className:Z(Ds("errorMessage"),"text-sm text-red-500 mt-1 ")},u):null)});zye.displayName="Switch";const Hye=xt("TabList"),zL=m.createContext("line"),qye={line:Z("flex border-b space-x-4","border-tremor-border","dark:border-dark-tremor-border"),solid:Z("inline-flex p-0.5 rounded-tremor-default space-x-1.5","bg-tremor-background-subtle","dark:bg-dark-tremor-background-subtle")},Zu=y.forwardRef((e,t)=>{const{color:r,variant:n="line",children:o,className:a}=e,i=Re(e,["color","variant","children","className"]);return y.createElement(yb.List,Object.assign({ref:t,className:Z(Hye("root"),"justify-start overflow-x-clip",qye[n],a)},i),y.createElement(zL.Provider,{value:n},y.createElement($L.Provider,{value:r},o)))});Zu.displayName="TabList";const bA=xt("Tab");function Uye(e,t){switch(e){case"line":return Z("data-[selected]:border-b-2 hover:border-b-2 border-transparent transition duration-100 -mb-px px-2 py-2","hover:border-tremor-content hover:text-tremor-content-emphasis text-tremor-content","[&:not([data-selected])]:dark:hover:border-dark-tremor-content-emphasis [&:not([data-selected])]:dark:hover:text-dark-tremor-content-emphasis [&:not([data-selected])]:dark:text-dark-tremor-content",t?Fe(t,He.border).selectBorderColor:["data-[selected]:border-tremor-brand data-[selected]:text-tremor-brand","data-[selected]:dark:border-dark-tremor-brand data-[selected]:dark:text-dark-tremor-brand"]);case"solid":return Z("border-transparent border rounded-tremor-small px-2.5 py-1","data-[selected]:border-tremor-border data-[selected]:bg-tremor-background data-[selected]:shadow-tremor-input [&:not([data-selected])]:hover:text-tremor-content-emphasis data-[selected]:text-tremor-brand [&:not([data-selected])]:text-tremor-content","dark:data-[selected]:border-dark-tremor-border dark:data-[selected]:bg-dark-tremor-background dark:data-[selected]:shadow-dark-tremor-input dark:[&:not([data-selected])]:hover:text-dark-tremor-content-emphasis dark:data-[selected]:text-dark-tremor-brand dark:[&:not([data-selected])]:text-dark-tremor-content",t?Fe(t,He.text).selectTextColor:"text-tremor-content dark:text-dark-tremor-content")}}const vo=y.forwardRef((e,t)=>{const{icon:r,className:n,children:o}=e,a=Re(e,["icon","className","children"]),i=m.useContext(zL),s=m.useContext($L),u=r;return y.createElement(yb,Object.assign({ref:t,className:Z(bA("root"),"flex whitespace-nowrap truncate max-w-xs outline-none data-focus-visible:ring text-tremor-default transition duration-100",Uye(i,s),n,s&&Fe(s,He.text).selectTextColor)},a),u?y.createElement(u,{className:Z(bA("icon"),"flex-none h-5 w-5",o?"mr-2":"")}):null,o?y.createElement("span",null,o):null)});vo.displayName="Tab";const Vye=xt("TabGroup"),Ju=y.forwardRef((e,t)=>{const{defaultIndex:r,index:n,onIndexChange:o,children:a,className:i}=e,s=Re(e,["defaultIndex","index","onIndexChange","children","className"]);return y.createElement(yb.Group,Object.assign({as:"div",ref:t,defaultIndex:r,selectedIndex:n,onChange:o,className:Z(Vye("root"),"w-full",i)},s),a)});Ju.displayName="TabGroup";const Wye=xt("TabPanel"),yo=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]),{selectedValue:a}=m.useContext(kb),i=a===m.useContext(BL);return y.createElement("div",Object.assign({ref:t,className:Z(Wye("root"),"w-full mt-2",i?"":"hidden",n),"aria-selected":i?"true":"false"},o),r)});yo.displayName="TabPanel";const Kye=xt("TabPanels"),Qu=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(yb.Panels,Object.assign({as:"div",ref:t,className:Z(Kye("root"),"w-full",n)},o),({selectedIndex:a})=>y.createElement(kb.Provider,{value:{selectedValue:a}},y.Children.map(r,(i,s)=>y.createElement(BL.Provider,{value:s},i))))});Qu.displayName="TabPanels";const vA=xt("Textarea"),Yye=y.forwardRef((e,t)=>{const{value:r,defaultValue:n="",placeholder:o="Type...",error:a=!1,errorMessage:i,disabled:s=!1,className:u,onChange:c,onValueChange:d,autoHeight:f=!1}=e,h=Re(e,["value","defaultValue","placeholder","error","errorMessage","disabled","className","onChange","onValueChange","autoHeight"]),[p,g]=ps(n,r),b=m.useRef(null),v=gl(p);return m.useEffect(()=>{const x=b.current;if(f&&x){x.style.height="60px";const k=x.scrollHeight;x.style.height=k+"px"}},[f,b,p]),y.createElement(y.Fragment,null,y.createElement("textarea",Object.assign({ref:ji([b,t]),value:p,placeholder:o,disabled:s,className:Z(vA("Textarea"),"w-full flex items-center outline-none rounded-tremor-default px-3 py-2 text-tremor-default focus:ring-2 transition duration-100 border","shadow-tremor-input focus:border-tremor-brand-subtle focus:ring-tremor-brand-muted","dark:shadow-dark-tremor-input focus:dark:border-dark-tremor-brand-subtle focus:dark:ring-dark-tremor-brand-muted",hs(v,s,a),s?"placeholder:text-tremor-content-subtle dark:placeholder:text-dark-tremor-content-subtle":"placeholder:text-tremor-content dark:placeholder:text-dark-tremor-content",u),"data-testid":"text-area",onChange:x=>{c?.(x),g(x.target.value),d?.(x.target.value)}},h)),a&&i?y.createElement("p",{className:Z(vA("errorMessage"),"text-sm text-red-500 mt-1")},i):null)});Yye.displayName="Textarea";const Gye=xt("TextInput"),HL=y.forwardRef((e,t)=>{const{type:r="text"}=e,n=Re(e,["type"]);return y.createElement(y1,Object.assign({ref:t,type:r,makeInputClassName:Gye},n))});HL.displayName="TextInput";const Xye=xt("Accordion"),qL=m.createContext({isOpen:!1}),Zye=y.forwardRef((e,t)=>{var r;const{defaultOpen:n=!1,children:o,className:a}=e,i=Re(e,["defaultOpen","children","className"]),s=(r=m.useContext(jd))!==null&&r!==void 0?r:Z("rounded-tremor-default border");return y.createElement(GN,Object.assign({as:"div",ref:t,className:Z(Xye("root"),"overflow-hidden","bg-tremor-background border-tremor-border","dark:bg-dark-tremor-background dark:border-dark-tremor-border",s,a),defaultOpen:n},i),({open:u})=>y.createElement(qL.Provider,{value:{isOpen:u}},o))});Zye.displayName="Accordion";const Jye=xt("AccordionBody"),Qye=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(GN.Panel,Object.assign({ref:t,className:Z(Jye("root"),"w-full text-tremor-default px-4 pb-3","text-tremor-content","dark:text-dark-tremor-content",n)},o),r)});Qye.displayName="AccordionBody";const exe=e=>{var t=Re(e,[]);return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor"},t),y.createElement("path",{d:"M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z"}))},Rk=xt("AccordionHeader"),txe=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]),{isOpen:a}=m.useContext(qL);return y.createElement(GN.Button,Object.assign({ref:t,className:Z(Rk("root"),"w-full flex items-center justify-between px-4 py-3","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis",n)},o),y.createElement("div",{className:Z(Rk("children"),"flex flex-1 text-inherit mr-4")},r),y.createElement("div",null,y.createElement(exe,{className:Z(Rk("arrowIcon"),"h-5 w-5 -mr-1","text-tremor-content-subtle","dark:text-dark-tremor-content-subtle",a?"transition-all":"transition-all -rotate-180")})))});txe.displayName="AccordionHeader";const rxe=xt("AccordionList"),nxe=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]),a=y.Children.count(r);return y.createElement("div",Object.assign({ref:t,className:Z(rxe("root"),"rounded-tremor-default","shadow-tremor-card","dark:shadow-dark-tremor-card",n)},o),y.Children.map(r,(i,s)=>s===0?y.createElement(jd.Provider,{value:Z("rounded-t-tremor-default border")},y.cloneElement(i)):s===a-1?y.createElement(jd.Provider,{value:Z("rounded-b-tremor-default border-l border-r border-b")},y.cloneElement(i)):y.createElement(jd.Provider,{value:Z("border-l border-r border-b")},y.cloneElement(i))))});nxe.displayName="AccordionList";const oxe=xt("Card"),axe=e=>{if(!e)return"";switch(e){case lu.Left:return"border-l-4";case m7.Top:return"border-t-4";case lu.Right:return"border-r-4";case m7.Bottom:return"border-b-4";default:return""}},At=y.forwardRef((e,t)=>{const{decoration:r="",decorationColor:n,children:o,className:a}=e,i=Re(e,["decoration","decorationColor","children","className"]);return y.createElement("div",Object.assign({ref:t,className:Z(oxe("root"),"relative w-full text-left ring-1 rounded-tremor-default p-6","bg-tremor-background ring-tremor-ring shadow-tremor-card","dark:bg-dark-tremor-background dark:ring-dark-tremor-ring dark:shadow-dark-tremor-card",n?Fe(n,He.border).borderColor:"border-tremor-brand dark:border-dark-tremor-brand",axe(r),a)},i),o)});At.displayName="Card";const ixe=xt("Divider"),Ss=y.forwardRef((e,t)=>{const{className:r,children:n}=e,o=Re(e,["className","children"]);return y.createElement("div",Object.assign({ref:t,className:Z(ixe("root"),"w-full mx-auto my-6 flex justify-between gap-3 items-center text-tremor-default","text-tremor-content","dark:text-dark-tremor-content",r)},o),n?y.createElement(y.Fragment,null,y.createElement("div",{className:Z("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}),y.createElement("div",{className:Z("text-inherit whitespace-nowrap")},n),y.createElement("div",{className:Z("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")})):y.createElement("div",{className:Z("w-full h-[1px] bg-tremor-border dark:bg-dark-tremor-border")}))});Ss.displayName="Divider";const sxe=xt("Flex"),lxe={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between",around:"justify-around",evenly:"justify-evenly"},uxe={start:"items-start",end:"items-end",center:"items-center",baseline:"items-baseline",stretch:"items-stretch"},cxe={row:"flex-row",col:"flex-col","row-reverse":"flex-row-reverse","col-reverse":"flex-col-reverse"},wb=y.forwardRef((e,t)=>{const{flexDirection:r="row",justifyContent:n="between",alignItems:o="center",children:a,className:i}=e,s=Re(e,["flexDirection","justifyContent","alignItems","children","className"]);return y.createElement("div",Object.assign({ref:t,className:Z(sxe("root"),"flex w-full",cxe[r],lxe[n],uxe[o],i)},s),a)});wb.displayName="Flex";const dxe={0:"grid-cols-none",1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",7:"grid-cols-7",8:"grid-cols-8",9:"grid-cols-9",10:"grid-cols-10",11:"grid-cols-11",12:"grid-cols-12"},fxe={0:"sm:grid-cols-none",1:"sm:grid-cols-1",2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6",7:"sm:grid-cols-7",8:"sm:grid-cols-8",9:"sm:grid-cols-9",10:"sm:grid-cols-10",11:"sm:grid-cols-11",12:"sm:grid-cols-12"},mxe={0:"md:grid-cols-none",1:"md:grid-cols-1",2:"md:grid-cols-2",3:"md:grid-cols-3",4:"md:grid-cols-4",5:"md:grid-cols-5",6:"md:grid-cols-6",7:"md:grid-cols-7",8:"md:grid-cols-8",9:"md:grid-cols-9",10:"md:grid-cols-10",11:"md:grid-cols-11",12:"md:grid-cols-12"},pxe={0:"lg:grid-cols-none",1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6",7:"lg:grid-cols-7",8:"lg:grid-cols-8",9:"lg:grid-cols-9",10:"lg:grid-cols-10",11:"lg:grid-cols-11",12:"lg:grid-cols-12"},hxe={1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12",13:"col-span-13"},gxe={1:"sm:col-span-1",2:"sm:col-span-2",3:"sm:col-span-3",4:"sm:col-span-4",5:"sm:col-span-5",6:"sm:col-span-6",7:"sm:col-span-7",8:"sm:col-span-8",9:"sm:col-span-9",10:"sm:col-span-10",11:"sm:col-span-11",12:"sm:col-span-12",13:"sm:col-span-13"},bxe={1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12",13:"md:col-span-13"},vxe={1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12",13:"lg:col-span-13"},yxe=xt("Col"),xxe=y.forwardRef((e,t)=>{const{numColSpan:r=1,numColSpanSm:n,numColSpanMd:o,numColSpanLg:a,children:i,className:s}=e,u=Re(e,["numColSpan","numColSpanSm","numColSpanMd","numColSpanLg","children","className"]),c=(d,f)=>d&&Object.keys(f).includes(String(d))?f[d]:"";return y.createElement("div",Object.assign({ref:t,className:Z(yxe("root"),(()=>{const d=c(r,hxe),f=c(n,gxe),h=c(o,bxe),p=c(a,vxe);return Z(d,f,h,p)})(),s)},u),i)});xxe.displayName="Col";const kxe=xt("Grid"),Hm=(e,t)=>e&&Object.keys(t).includes(String(e))?t[e]:"",jb=y.forwardRef((e,t)=>{const{numItems:r=1,numItemsSm:n,numItemsMd:o,numItemsLg:a,children:i,className:s}=e,u=Re(e,["numItems","numItemsSm","numItemsMd","numItemsLg","children","className"]),c=Hm(r,dxe),d=Hm(n,fxe),f=Hm(o,mxe),h=Hm(a,pxe),p=Z(c,d,f,h);return y.createElement("div",Object.assign({ref:t,className:Z(kxe("root"),"grid",p,s)},u),i)});jb.displayName="Grid";const wxe=xt("dialog"),jxe=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(ms,{appear:!0,show:e.open},y.createElement(rge,Object.assign({ref:t},o,{className:Z(wxe("root"),"relative z-50",n)}),y.createElement(ege,{transition:!0,className:"fixed bg-slate-950/30 dark:bg-slate-950/50 inset-0 transition-opacity data-[closed]:opacity-0 data-[enter]:duration-300 data-[leave]:duration-200 data-[enter]:ease-out data-[leave]:ease-in"}),y.createElement("div",{className:"fixed inset-0 overflow-y-auto w-screen"},y.createElement("div",{className:"flex min-h-full items-center justify-center p-4"},r))))});jxe.displayName="Dialog";const Exe=xt("dialog"),Nxe=y.forwardRef((e,t)=>{var r;const{children:n,className:o}=e,a=Re(e,["children","className"]),i=(r=y.useContext(jd))!==null&&r!==void 0?r:Z("rounded-tremor-default p-6");return y.createElement(cb,{enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95"},y.createElement(yL,Object.assign({ref:t,className:Z(Exe("panel"),"w-full max-w-lg overflow-visible text-left ring-1 shadow-tremor transition-all transform","bg-tremor-background text-tremor-content ring-tremor-ring","dark:bg-dark-tremor-background dark:text-dark-tremor-content dark:ring-dark-tremor-ring",i,o)},a),n))});Nxe.displayName="DialogPanel";const Sxe=xt("List"),Jf=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement("ul",Object.assign({ref:t,className:Z(Sxe("root"),"w-full divide-y","divide-tremor-border text-tremor-content","dark:divide-dark-tremor-border dark:text-dark-tremor-content",n)},o),r)});Jf.displayName="List";const Oxe=xt("ListItem"),Xr=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(y.Fragment,null,y.createElement("li",Object.assign({ref:t,className:Z(Oxe("root"),"w-full flex justify-between items-center text-tremor-default py-2",n)},o),r))});Xr.displayName="ListItem";const yA=xt("Table"),UL=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement("div",{className:Z(yA("root"),"overflow-auto",n)},y.createElement("table",Object.assign({ref:t,className:Z(yA("table"),"w-full text-tremor-default","text-tremor-content","dark:text-dark-tremor-content")},o),r))});UL.displayName="Table";const Cxe=xt("TableBody"),VL=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(y.Fragment,null,y.createElement("tbody",Object.assign({ref:t,className:Z(Cxe("root"),"align-top divide-y","divide-tremor-border","dark:divide-dark-tremor-border",n)},o),r))});VL.displayName="TableBody";const Pxe=xt("TableCell"),Yo=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(y.Fragment,null,y.createElement("td",Object.assign({ref:t,className:Z(Pxe("root"),"align-middle whitespace-nowrap text-left p-4",n)},o),r))});Yo.displayName="TableCell";const Axe=xt("TableFoot"),Txe=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement("tfoot",Object.assign({ref:t,className:Z(Axe("root"),"text-left font-medium border-t-[1px] ","text-tremor-content border-tremor-border","dark:text-dark-tremor-content dark:border-dark-tremor-border",n)},o),r)});Txe.displayName="TableFoot";const Mxe=xt("TableFooterCell"),_xe=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(y.Fragment,null,y.createElement("th",Object.assign({ref:t,className:Z(Mxe("root"),"top-0 px-4 py-3.5","text-tremor-content font-medium","dark:text-dark-tremor-content",n)},o),r))});_xe.displayName="TableFooterCell";const Ixe=xt("TableHead"),WL=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(y.Fragment,null,y.createElement("thead",Object.assign({ref:t,className:Z(Ixe("root"),"text-left","text-tremor-content","dark:text-dark-tremor-content",n)},o),r))});WL.displayName="TableHead";const Dxe=xt("TableHeaderCell"),$s=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(y.Fragment,null,y.createElement("th",Object.assign({ref:t,className:Z(Dxe("root"),"whitespace-nowrap text-left font-semibold top-0 px-4 py-3.5","text-tremor-content-strong","dark:text-dark-tremor-content-strong",n)},o),r))});$s.displayName="TableHeaderCell";const Lxe=xt("TableRow"),Bs=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement(y.Fragment,null,y.createElement("tr",Object.assign({ref:t,className:Z(Lxe("row"),n)},o),r))});Bs.displayName="TableRow";const Rxe=y.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:o,colors:a=Ra,stack:i=!1,relative:s=!1,animationDuration:u=900,showAnimation:c=!1,noDataText:d,autoMinValue:f=!1,minValue:h,maxValue:p,className:g}=e,b=Re(e,["data","categories","index","colors","stack","relative","animationDuration","showAnimation","noDataText","autoMinValue","minValue","maxValue","className"]),v=jl(n,a),x=fs(f,h,p);return y.createElement("div",Object.assign({ref:t,className:Z("w-28 h-12",g)},b),y.createElement(ks,{className:"h-full w-full"},r!=null&&r.length?y.createElement(rD,{data:r,stackOffset:s?"expand":"none",margin:{top:0,left:-1.5,right:-1.5,bottom:0}},y.createElement(so,{hide:!0,domain:x}),y.createElement(io,{hide:!0,dataKey:o}),n.map(k=>{var E;return y.createElement(Ns,{className:Z(Fe((E=v.get(k))!==null&&E!==void 0?E:et.Gray,He.background).fillColor),key:k,name:k,type:"linear",stackId:i||s?"a":void 0,dataKey:k,fill:"",isAnimationActive:c,animationDuration:u})})):y.createElement(Ei,{noDataText:d})))});Rxe.displayName="SparkBarChart";const Fxe=y.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:o,colors:a=Ra,animationDuration:i=900,showAnimation:s=!1,curveType:u="linear",connectNulls:c=!1,noDataText:d,autoMinValue:f=!1,minValue:h,maxValue:p,className:g}=e,b=Re(e,["data","categories","index","colors","animationDuration","showAnimation","curveType","connectNulls","noDataText","autoMinValue","minValue","maxValue","className"]),v=jl(n,a),x=fs(f,h,p);return y.createElement("div",Object.assign({ref:t,className:Z("w-28 h-12",g)},b),y.createElement(ks,{className:"h-full w-full"},r!=null&&r.length?y.createElement(tD,{data:r,margin:{top:1,left:1,right:1,bottom:1}},y.createElement(so,{hide:!0,domain:x}),y.createElement(io,{hide:!0,dataKey:o}),n.map(k=>{var E;return y.createElement(ds,{className:Z(Fe((E=v.get(k))!==null&&E!==void 0?E:et.Gray,He.text).strokeColor),strokeOpacity:1,dot:!1,key:k,name:k,type:u,dataKey:k,stroke:"",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:s,animationDuration:i,connectNulls:c})})):y.createElement(Ei,{noDataText:d})))});Fxe.displayName="SparkLineChart";const $xe=y.forwardRef((e,t)=>{const{data:r=[],categories:n=[],index:o,stack:a=!1,colors:i=Ra,showAnimation:s=!1,animationDuration:u=900,showGradient:c=!0,curveType:d="linear",connectNulls:f=!1,noDataText:h,autoMinValue:p=!1,minValue:g,maxValue:b,className:v}=e,x=Re(e,["data","categories","index","stack","colors","showAnimation","animationDuration","showGradient","curveType","connectNulls","noDataText","autoMinValue","minValue","maxValue","className"]),k=jl(n,i),E=fs(p,g,b);return y.createElement("div",Object.assign({ref:t,className:Z("w-28 h-12",v)},x),y.createElement(ks,{className:"h-full w-full"},r!=null&&r.length?y.createElement(nD,{data:r,margin:{top:1,left:1,right:1,bottom:1}},y.createElement(so,{hide:!0,domain:E}),y.createElement(io,{hide:!0,dataKey:o}),n.map(j=>{var S,C;return y.createElement("defs",{key:j},c?y.createElement("linearGradient",{className:Fe((S=k.get(j))!==null&&S!==void 0?S:et.Gray,He.text).textColor,id:k.get(j),x1:"0",y1:"0",x2:"0",y2:"1"},y.createElement("stop",{offset:"5%",stopColor:"currentColor",stopOpacity:.4}),y.createElement("stop",{offset:"95%",stopColor:"currentColor",stopOpacity:0})):y.createElement("linearGradient",{className:Fe((C=k.get(j))!==null&&C!==void 0?C:et.Gray,He.text).textColor,id:k.get(j),x1:"0",y1:"0",x2:"0",y2:"1"},y.createElement("stop",{stopColor:"currentColor",stopOpacity:.3})))}),n.map(j=>{var S;return y.createElement(wi,{className:Fe((S=k.get(j))!==null&&S!==void 0?S:et.Gray,He.text).strokeColor,strokeOpacity:1,dot:!1,key:j,name:j,type:d,dataKey:j,stroke:"",fill:`url(#${k.get(j)})`,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",isAnimationActive:s,animationDuration:u,stackId:a?"a":void 0,connectNulls:f})})):y.createElement(Ei,{noDataText:h})))});$xe.displayName="AreaChart";const Bxe=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement("b",Object.assign({ref:t,className:Z("text-inherit font-bold",n)},o),r)});Bxe.displayName="Bold";const Yc=xt("Callout"),zxe=y.forwardRef((e,t)=>{const{title:r,icon:n,color:o,className:a,children:i}=e,s=Re(e,["title","icon","color","className","children"]),u=n;return y.createElement("div",Object.assign({ref:t,className:Z(Yc("root"),"flex flex-col overflow-hidden rounded-tremor-default text-tremor-default border-l-4 py-3 pr-3 pl-4",o?Z(Fe(o,He.background).bgColor,Fe(o,He.darkBorder).borderColor,Fe(o,He.darkText).textColor,"dark:bg-opacity-10 bg-opacity-10"):Z("bg-tremor-brand-faint border-tremor-brand-emphasis text-tremor-brand-emphasis","dark:bg-dark-tremor-brand-muted/70 dark:border-dark-tremor-brand-emphasis dark:text-dark-tremor-brand-emphasis"),a)},s),y.createElement("div",{className:Z(Yc("header"),"flex items-start")},u?y.createElement(u,{className:Z(Yc("icon"),"flex-none h-5 w-5 mr-1.5")}):null,y.createElement("h4",{className:Z(Yc("title"),"font-semibold")},r)),y.createElement("p",{className:Z(Yc("body"),"overflow-y-auto",i?"mt-2":"")},i))});zxe.displayName="Callout";const Hxe=y.forwardRef((e,t)=>{const{children:r,className:n}=e,o=Re(e,["children","className"]);return y.createElement("i",Object.assign({ref:t,className:Z("italic text-inherit",n)},o),r)});Hxe.displayName="Italic";const ni=y.forwardRef((e,t)=>{const{color:r,children:n,className:o}=e,a=Re(e,["color","children","className"]);return y.createElement("p",Object.assign({ref:t,className:Z("font-semibold text-tremor-metric",r?Fe(r,He.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",o)},a),n)});ni.displayName="Metric";const qxe=y.forwardRef((e,t)=>{const{color:r,children:n,className:o}=e,a=Re(e,["color","children","className"]);return y.createElement("p",Object.assign({ref:t,className:Z(r?Fe(r,He.lightText).textColor:"text-tremor-content-emphasis dark:text-dark-tremor-content-emphasis",o)},a),n)});qxe.displayName="Subtitle";const Kn=y.forwardRef((e,t)=>{const{color:r,children:n,className:o}=e,a=Re(e,["color","children","className"]);return y.createElement("p",Object.assign({ref:t,className:Z("font-medium text-tremor-title",r?Fe(r,He.darkText).textColor:"text-tremor-content-strong dark:text-dark-tremor-content-strong",o)},a),n)});Kn.displayName="Title";const Va=xt("BarList");function KL(e,t){const{data:r=[],color:n,valueFormatter:o=Ea,showAnimation:a=!1,onValueChange:i,sortOrder:s="descending",className:u}=e,c=Re(e,["data","color","valueFormatter","showAnimation","onValueChange","sortOrder","className"]),d=i?"button":"div",f=y.useMemo(()=>s==="none"?r:[...r].sort((p,g)=>s==="ascending"?p.value-g.value:g.value-p.value),[r,s]),h=y.useMemo(()=>{const p=Math.max(...f.map(g=>g.value),0);return f.map(g=>g.value===0?0:Math.max(g.value/p*100,2))},[f]);return y.createElement("div",Object.assign({ref:t,className:Z(Va("root"),"flex justify-between space-x-6",u),"aria-sort":s},c),y.createElement("div",{className:Z(Va("bars"),"relative w-full space-y-1.5")},f.map((p,g)=>{var b,v,x;const k=p.icon;return y.createElement(d,{key:(b=p.key)!==null&&b!==void 0?b:g,onClick:()=>{i?.(p)},className:Z(Va("bar"),"group w-full flex items-center rounded-tremor-small",i?["cursor-pointer","hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-subtle/40"]:"")},y.createElement("div",{className:Z("flex items-center rounded transition-all bg-opacity-40","h-8",p.color||n?[Fe((v=p.color)!==null&&v!==void 0?v:n,He.background).bgColor,i?"group-hover:bg-opacity-30":""]:"bg-tremor-brand-subtle dark:bg-dark-tremor-brand-subtle/60",!i||p.color||n?"":"group-hover:bg-tremor-brand-subtle/30 group-hover:dark:bg-dark-tremor-brand-subtle/70",g===f.length-1?"mb-0":"",a?"duration-500":""),style:{width:`${h[g]}%`,transition:a?"all 1s":""}},y.createElement("div",{className:Z("absolute left-2 pr-4 flex max-w-full")},k?y.createElement(k,{className:Z(Va("barIcon"),"flex-none h-5 w-5 mr-2","text-tremor-content","dark:text-dark-tremor-content")}):null,p.href?y.createElement("a",{href:p.href,target:(x=p.target)!==null&&x!==void 0?x:"_blank",rel:"noreferrer",className:Z(Va("barLink"),"whitespace-nowrap hover:underline truncate text-tremor-default",i?"cursor-pointer":"","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis"),onClick:E=>E.stopPropagation()},p.name):y.createElement("p",{className:Z(Va("barText"),"whitespace-nowrap truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},p.name))))})),y.createElement("div",{className:Va("labels")},f.map((p,g)=>{var b;return y.createElement("div",{key:(b=p.key)!==null&&b!==void 0?b:g,className:Z(Va("labelWrapper"),"flex justify-end items-center","h-8",g===f.length-1?"mb-0":"mb-1.5")},y.createElement("p",{className:Z(Va("labelText"),"whitespace-nowrap leading-none truncate text-tremor-default","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},o(p.value)))})))}KL.displayName="BarList";const Zl=y.forwardRef(KL),Hl=xt("CategoryBar"),YL=(e,t)=>e?e/t*100:0,Uxe=({values:e})=>{const t=m.useMemo(()=>cN(e),[e]);let r=0,n=0;return y.createElement("div",{className:Z(Hl("labels"),"relative flex w-full text-tremor-default h-5 mb-2","text-tremor-content","dark:text-dark-tremor-content")},e.slice(0,e.length).map((o,a)=>{r+=o;const i=(o>=.1*t||n>=.09*t)&&t-r>=.15*t&&r>=.1*t;n=i?0:n+=o;const s=YL(o,t);return y.createElement("div",{key:`item-${a}`,className:"flex items-center justify-end",style:{width:`${s}%`}},y.createElement("span",{className:Z(i?"block":"hidden","left-1/2 translate-x-1/2")},r))}),y.createElement("div",{className:Z("absolute bottom-0 flex items-center left-0")},"0"),y.createElement("div",{className:Z("absolute bottom-0 flex items-center right-0")},t))},Vxe=y.forwardRef((e,t)=>{const{values:r=[],colors:n=Ra,markerValue:o,showLabels:a=!0,tooltip:i,showAnimation:s=!1,className:u}=e,c=Re(e,["values","colors","markerValue","showLabels","tooltip","showAnimation","className"]),d=m.useMemo(()=>((b,v,x)=>{if(b===void 0)return"";let k=0;for(let E=0;E<v.length;E++){const j=v[E],S=Fe(x[E],He.background).bgColor;if(k+=j,k>=b)return S}return""})(o,r,n),[o,r,n]),{tooltipProps:f,getReferenceProps:h}=zo(),p=m.useMemo(()=>cN(r),[r]),g=m.useMemo(()=>YL(o,p),[o,p]);return y.createElement(y.Fragment,null,y.createElement(Po,Object.assign({text:i},f)),y.createElement("div",Object.assign({ref:t,className:Z(Hl("root"),u)},c),a?y.createElement(Uxe,{values:r}):null,y.createElement("div",{className:Z(Hl("barWrapper"),"relative w-full flex items-center h-2")},y.createElement("div",{className:Z("flex-1 flex items-center h-full overflow-hidden rounded-tremor-full")},r.map((b,v)=>{var x;const k=(x=n[v])!==null&&x!==void 0?x:"gray",E=b/p*100;return y.createElement("div",{key:`item-${v}`,className:Z(Hl("categoryBar"),"h-full",Fe(k,He.background).bgColor),style:{width:`${E}%`}})})),o!==void 0?y.createElement("div",Object.assign({ref:f.refs.setReference,className:Z(Hl("markerWrapper"),"absolute right-1/2 -translate-x-1/2 w-5"),style:{left:`${g}%`,transition:s?"all 1s":""}},h),y.createElement("div",{className:Z(Hl("marker"),"ring-2 mx-auto rounded-tremor-full h-4 w-1","ring-tremor-brand-inverted","dark:ring-dark-tremor-brand-inverted",d)})):null)))});Vxe.displayName="CategoryBar";const xA={[Ar.Increase]:{bgColor:Fe(et.Emerald,He.background).bgColor},[Ar.ModerateIncrease]:{bgColor:Fe(et.Emerald,He.background).bgColor},[Ar.Decrease]:{bgColor:Fe(et.Rose,He.background).bgColor},[Ar.ModerateDecrease]:{bgColor:Fe(et.Rose,He.background).bgColor},[Ar.Unchanged]:{bgColor:Fe(et.Orange,He.background).bgColor}},Gc=xt("DeltaBar"),Wxe=y.forwardRef((e,t)=>{const{value:r,isIncreasePositive:n=!0,showAnimation:o=!1,className:a,tooltip:i}=e,s=Re(e,["value","isIncreasePositive","showAnimation","className","tooltip"]),u=uD((f=>f>=0?Ar.Increase:Ar.Decrease)(r),n),{tooltipProps:c,getReferenceProps:d}=zo();return y.createElement(y.Fragment,null,y.createElement(Po,Object.assign({text:i},c)),y.createElement("div",Object.assign({ref:t,className:Z(Gc("root"),"relative flex items-center w-full rounded-tremor-full h-2","bg-tremor-background-subtle","dark:bg-dark-tremor-background-subtle",a)},s),y.createElement("div",{className:"flex justify-end h-full w-1/2"},r<0?y.createElement("div",Object.assign({ref:c.refs.setReference,className:Z(Gc("negativeDeltaBar"),"rounded-l-tremor-full",xA[u].bgColor),style:{width:`${Math.abs(r)}%`,transition:o?"all duration-300":""}},d)):null),y.createElement("div",{className:Z(Gc("separator"),"ring-2 z-10 rounded-tremor-full h-4 w-1","ring-tremor-brand-inverted bg-tremor-background-emphasis","dark:ring-dark-tremor-brand-inverted dark:bg-dark-tremor-background-emphasis")}),y.createElement("div",{className:Z(Gc("positiveDeltaBarWrapper"),"flex justify-start h-full w-1/2")},r>=0?y.createElement("div",Object.assign({ref:c.refs.setReference,className:Z(Gc("positiveDeltaBar"),"rounded-r-tremor-full",xA[u].bgColor),style:{width:`${Math.abs(r)}%`,transition:o?"all 1s":""}},d)):null)))});Wxe.displayName="DeltaBar";const qm=xt("MarkerBar"),Kxe=y.forwardRef((e,t)=>{const{value:r,minValue:n,maxValue:o,markerTooltip:a,rangeTooltip:i,showAnimation:s=!1,color:u,className:c}=e,d=Re(e,["value","minValue","maxValue","markerTooltip","rangeTooltip","showAnimation","color","className"]),{tooltipProps:f,getReferenceProps:h}=zo(),{tooltipProps:p,getReferenceProps:g}=zo();return y.createElement("div",Object.assign({ref:t,className:Z(qm("root"),"relative flex items-center w-full rounded-tremor-full h-2","bg-tremor-background-subtle","dark:bg-dark-tremor-background-subtle",c)},d),n!==void 0&&o!==void 0?y.createElement(y.Fragment,null,y.createElement(Po,Object.assign({text:i},p)),y.createElement("div",Object.assign({ref:p.refs.setReference,className:Z(qm("rangeBar"),"absolute h-full rounded-tremor-full","bg-tremor-content-subtle","dark:bg-dark-tremor-content-subtle"),style:{left:`${n}%`,width:o-n+"%",transition:s?"all duration-300":""}},g))):null,y.createElement(Po,Object.assign({text:a},f)),y.createElement("div",Object.assign({ref:f.refs.setReference,className:Z(qm("markerWrapper"),"absolute right-1/2 -translate-x-1/2 w-5"),style:{left:`${r}%`,transition:s?"all 1s":""}},h),y.createElement("div",{className:Z(qm("marker"),"ring-2 mx-auto rounded-tremor-full h-4 w-1","ring-tremor-brand-inverted","dark:ring-dark-tremor-brand-inverted",u?Fe(u,He.background).bgColor:"dark:bg-dark-tremor-brand bg-tremor-brand")})))});Kxe.displayName="MarkerBar";const Xc=xt("ProgressBar"),oj=y.forwardRef((e,t)=>{const{value:r,label:n,color:o,tooltip:a,showAnimation:i=!1,className:s}=e,u=Re(e,["value","label","color","tooltip","showAnimation","className"]),{tooltipProps:c,getReferenceProps:d}=zo();return y.createElement(y.Fragment,null,y.createElement(Po,Object.assign({text:a},c)),y.createElement("div",Object.assign({ref:t,className:Z(Xc("root"),"flex items-center w-full",s)},u),y.createElement("div",Object.assign({ref:c.refs.setReference,className:Z(Xc("progressBarWrapper"),"relative flex items-center w-full rounded-tremor-full bg-opacity-20 h-2",o?Fe(o,He.background).bgColor:"bg-tremor-brand-muted/50 dark:bg-dark-tremor-brand-muted")},d),y.createElement("div",{className:Z(Xc("progressBar"),"flex-col h-full rounded-tremor-full",o?Fe(o,He.background).bgColor:"bg-tremor-brand dark:bg-dark-tremor-brand",i?"transition-all duration-300 ease-in-out":""),style:{width:`${r}%`}})),n?y.createElement("div",{className:Z(Xc("labelWrapper"),"w-16 truncate text-right ml-2","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},y.createElement("p",{className:Z(Xc("label"),"shrink-0 whitespace-nowrap truncate text-tremor-default")},n)):null))});oj.displayName="ProgressBar";const Yxe=xt("ProgressBar"),kA={xs:{radius:15,strokeWidth:3},sm:{radius:19,strokeWidth:4},md:{radius:32,strokeWidth:6},lg:{radius:52,strokeWidth:8},xl:{radius:80,strokeWidth:10}},Gxe=y.forwardRef((e,t)=>{const{value:r,size:n="md",className:o,showAnimation:a=!0,color:i,tooltip:s,radius:u,strokeWidth:c,children:d}=e,f=Re(e,["value","size","className","showAnimation","color","tooltip","radius","strokeWidth","children"]),h=(p=r)===void 0?0:p>100?100:p;var p;const g=u??kA[n].radius,b=c??kA[n].strokeWidth,v=g-b/2,x=2*v*Math.PI,k=x-h/100*x,{tooltipProps:E,getReferenceProps:j}=zo();return y.createElement(y.Fragment,null,y.createElement(Po,Object.assign({text:s},E)),y.createElement("div",Object.assign({ref:t,className:Z(Yxe("root"),"flex flex-col items-center justify-center",o)},f),y.createElement("svg",Object.assign({ref:E.refs.setReference,width:2*g,height:2*g,viewBox:`0 0 ${2*g} ${2*g}`,className:"transform -rotate-90"},j),y.createElement("circle",{r:v,cx:g,cy:g,strokeWidth:b,fill:"transparent",stroke:"",strokeLinecap:"round",className:Z("transition-colors ease-linear",i?`${Fe(i,He.background).strokeColor} opacity-20 dark:opacity-25`:"stroke-tremor-brand-muted/50 dark:stroke-dark-tremor-brand-muted")}),h>=0?y.createElement("circle",{r:v,cx:g,cy:g,strokeWidth:b,strokeDasharray:x+" "+x,strokeDashoffset:k,fill:"transparent",stroke:"",strokeLinecap:"round",className:Z("transition-colors ease-linear",i?Fe(i,He.background).strokeColor:"stroke-tremor-brand dark:stroke-dark-tremor-brand",a?"transition-all duration-300 ease-in-out":"")}):null),y.createElement("div",{className:Z("absolute flex")},d)))});Gxe.displayName="ProgressCircle";const GL=xt("Tracker"),XL=y.forwardRef((e,t)=>{const{color:r,tooltip:n}=e,o=Re(e,["color","tooltip"]),{tooltipProps:a,getReferenceProps:i}=zo();return y.createElement("div",Object.assign({ref:ji([t,a.refs.setReference]),className:Z(GL("trackingBlock"),"w-full h-full rounded-[1px] first:rounded-l-[4px] last:rounded-r-[4px]",Fe(r??"gray",He.background).bgColor)},o,i),y.createElement(Po,Object.assign({text:n},a)))});XL.displayName="TrackerBlock";const Xxe=y.forwardRef((e,t)=>{const{data:r=[],className:n}=e,o=Re(e,["data","className"]);return y.createElement("div",Object.assign({ref:t,className:Z(GL("root"),"h-10 flex items-center space-x-0.5",n)},o),r.map((a,i)=>{var s;return y.createElement(XL,{key:(s=a.key)!==null&&s!==void 0?s:i,color:a.color,tooltip:a.tooltip})}))});Xxe.displayName="Tracker";const ZL=({args:e})=>{const t=Object.entries(e||{});return t.length?l.jsx("div",{className:"space-y-1",children:t.map(([r,n])=>l.jsxs("div",{className:"flex items-start gap-2 rounded-tremor-small bg-tremor-background-subtle px-2 py-1 text-xs dark:bg-dark-tremor-background-subtle",children:[l.jsx("span",{className:"font-mono text-tremor-content-strong dark:text-dark-tremor-content-strong",children:r}),l.jsx("span",{className:"flex-1 text-tremor-content dark:text-dark-tremor-content",children:typeof n=="object"?JSON.stringify(n,null,2):String(n)})]},r))}):l.jsx(gt,{className:"text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:"No arguments provided."})},Zxe=({open:e,className:t=""})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-tremor-content transition-transform dark:text-dark-tremor-content ${e?"rotate-180":"rotate-0"} ${t}`,"aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})}),bo=({title:e,children:t,defaultOpen:r=!1,resetKey:n,contentClassName:o="",headerRight:a,className:i="",withBorderTop:s=!0,onToggle:u,copyText:c})=>{const[d,f]=m.useState(r);m.useEffect(()=>{f(r)},[n,r]);const h=()=>{f(p=>{const g=!p;return u?.(g),g})};return l.jsxs("div",{className:`rounded-tremor-small border border-slate-200 dark:border-dark-tremor-border ${i}`,children:[l.jsxs("div",{role:"button",tabIndex:0,onClick:h,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),h())},className:"flex w-full cursor-pointer items-center justify-between px-3 py-2 text-left text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[l.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:e}),l.jsxs("span",{className:"flex items-center gap-2",children:[c?l.jsx(Cn,{textToCopy:c,showLabel:!0}):null,a,l.jsx(Zxe,{open:d})]})]}),d?s?l.jsx("div",{className:`border-t border-tremor-border ${o}`,children:t}):t:null]})},ip=({title:e="Input",validation:t,children:r})=>{var n,o,a,i;const[s,u]=m.useState(!0);return l.jsx(bo,{title:e,defaultOpen:!0,onToggle:u,headerRight:t&&((n=t.missing)!=null&&n.length||(o=t.extra)!=null&&o.length)?l.jsxs("div",{className:"text-[11px] text-amber-700 dark:text-amber-200",children:[(a=t.missing)!=null&&a.length?l.jsxs("span",{className:"mr-2",children:["Missing: ",t.missing.join(", ")]}):null,(i=t.extra)!=null&&i.length?l.jsxs("span",{children:["Extra: ",t.extra.join(", ")]}):null]}):null,className:"rounded-tremor-small border border-tremor-border bg-white shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",withBorderTop:!1,children:s?l.jsx("div",{className:"space-y-2 px-3 pt-0 pb-3",children:r}):null})},sp=({title:e="Output",children:t})=>{const[r,n]=m.useState(!0);return l.jsx(bo,{title:e,defaultOpen:!0,onToggle:n,className:"rounded-tremor-small border border-tremor-border bg-white shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",withBorderTop:!1,children:r?l.jsx("div",{className:"space-y-2 px-3 pt-0 pb-3",children:t}):null})},Za=({data:e,title:t,copyText:r,children:n})=>{const o=r||JSON.stringify(e,null,2);return l.jsxs("div",{className:"rounded-tremor-small border border-slate-200 dark:border-dark-tremor-border",children:[t?l.jsxs("div",{className:"flex items-center justify-between border-b border-tremor-border px-3 py-2",children:[l.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:t}),l.jsx(Cn,{textToCopy:o,showLabel:!0})]}):l.jsx("div",{className:"flex justify-end border-b border-tremor-border px-3 py-2",children:l.jsx(Cn,{textToCopy:o,showLabel:!0})}),n?l.jsx("div",{className:"max-h-100 overflow-auto px-3 py-2",children:n}):l.jsx("pre",{className:"max-h-100 overflow-auto whitespace-pre-wrap px-3 py-2 text-xs text-tremor-content dark:text-dark-tremor-content",children:o})]})},wA=e=>{try{return JSON.parse(e)}catch{return null}},Ih=e=>{if(e==null)return null;if(typeof e=="object")return e;if(typeof e!="string")return null;const t=e.trim();if(!t)return null;const r=wA(t);if(r)return r;const n=t.match(/data:\s*(\{[\s\S]*\})/);if(n&&n[1]){const o=wA(n[1].trim());if(o)return o}return null},Jxe=e=>{if(!e||typeof e!="object")return{total:0,required:0};const t=e.properties||{},r=Array.isArray(e.required)?e.required.length:0;return{total:Object.keys(t).length,required:r}},Qxe=(e="")=>{const t=e.toLowerCase();return t.includes("json")?"json":t.includes("xml")?"xml":t.includes("html")?"html":t.includes("javascript")?"javascript":t.includes("css")?"css":t.includes("yaml")||t.includes("yml")?"yaml":t.includes("sql")?"sql":t.startsWith("text/")?"plaintext":"json"},e0e=(e={},t)=>{if(!t||typeof t!="object")return{missing:[],extra:[]};const r=new Set(t.required||[]),n=new Set(Object.keys(t.properties||{})),o=Object.keys(e),a=Array.from(r).filter(s=>!o.includes(s)),i=o.filter(s=>!n.has(s));return{missing:a,extra:i}},JL=(e="")=>{const t=e.toLowerCase();return t.includes("tool")?"blue":t.includes("prompt")?"indigo":t.includes("resource")?"emerald":t.includes("model")?"amber":"slate"},QL=(e="",t)=>{var r,n,o,a,i,s;if(!t)return{type:"none",raw:null};const u=(e||"").toLowerCase(),c=((r=t?.result)==null?void 0:r.tools)||t?.tools||(Array.isArray((n=t?.result)==null?void 0:n.tools)?t.result.tools:[]),d=(o=t?.result)==null?void 0:o.prompts,f=(a=t?.result)==null?void 0:a.resources,h=(i=t?.result)==null?void 0:i.structuredContent,p=((s=t?.result)==null?void 0:s.content)||t?.content||[],g=t?.result??t;return u==="tools/list"&&Array.isArray(c)?{type:"toolsList",tools:c,raw:g,content:p}:u==="prompts/list"&&Array.isArray(d)?{type:"promptsList",prompts:d,raw:g,content:p}:u==="resources/list"&&Array.isArray(f)?{type:"resourcesList",resources:f,raw:g,content:p}:h?{type:"structured",structuredContent:h,raw:g,content:p}:Array.isArray(p)&&p.length?{type:"content",content:p,raw:g}:{type:"raw",raw:g,content:p}},eR=(e=[])=>{if(!Array.isArray(e)||!e.length)return null;const t=e.filter(r=>r?.data&&r.event&&r.event.toLowerCase()==="message");return t.length?t.map(r=>r.data).join(`
141
+ `):null},t0e=`<svg
142
+ xmlns="http://www.w3.org/2000/svg"
143
+ width="24"
144
+ height="24"
145
+ viewBox="0 0 24 24"
146
+ fill="none"
147
+ stroke="currentColor"
148
+ stroke-width="2"
149
+ stroke-linecap="round"
150
+ stroke-linejoin="round"
151
+ >
152
+ <path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" />
153
+ <path d="M14 2v4a2 2 0 0 0 2 2h4" />
154
+ </svg>
155
+ `,r0e=`<svg
156
+ xmlns="http://www.w3.org/2000/svg"
157
+ width="24"
158
+ height="24"
159
+ viewBox="0 0 24 24"
160
+ fill="none"
161
+ stroke="currentColor"
162
+ stroke-width="2"
163
+ stroke-linecap="round"
164
+ stroke-linejoin="round"
165
+ >
166
+ <path d="m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9" />
167
+ <path d="m18 15 4-4" />
168
+ <path d="m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5" />
169
+ </svg>
170
+ `,n0e=`<svg
171
+ xmlns="http://www.w3.org/2000/svg"
172
+ width="24"
173
+ height="24"
174
+ viewBox="0 0 24 24"
175
+ fill="none"
176
+ stroke="currentColor"
177
+ stroke-width="2"
178
+ stroke-linecap="round"
179
+ stroke-linejoin="round"
180
+ >
181
+ <path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z" />
182
+ </svg>
183
+ `,o0e=`<svg
184
+ xmlns="http://www.w3.org/2000/svg"
185
+ width="24"
186
+ height="24"
187
+ viewBox="0 0 24 24"
188
+ fill="none"
189
+ stroke="currentColor"
190
+ stroke-width="2"
191
+ stroke-linecap="round"
192
+ stroke-linejoin="round"
193
+ >
194
+ <rect width="20" height="8" x="2" y="2" rx="2" ry="2" />
195
+ <rect width="20" height="8" x="2" y="14" rx="2" ry="2" />
196
+ <line x1="6" x2="6.01" y1="6" y2="6" />
197
+ <line x1="6" x2="6.01" y1="18" y2="18" />
198
+ </svg>
199
+ `,a0e={resource:t0e,tool:r0e,prompt:n0e,system:o0e},i0e=(e="")=>{const t=e.toLowerCase();return t.includes("resource")?"resource":t.includes("tool")?"tool":t.includes("prompt")?"prompt":t.includes("system")?"system":null},tR={slate:{root:"bg-slate-500/10 text-slate-700 ring-slate-500/20 dark:bg-slate-500/5 dark:text-slate-200 dark:ring-slate-500/60"},gray:{root:"bg-gray-500/10 text-gray-700 ring-gray-500/20 dark:bg-gray-500/5 dark:text-gray-200 dark:ring-gray-500/60"},zinc:{root:"bg-zinc-500/10 text-zinc-700 ring-zinc-500/20 dark:bg-zinc-500/5 dark:text-zinc-200 dark:ring-zinc-500/60"},neutral:{root:"bg-neutral-500/10 text-neutral-700 ring-neutral-500/20 dark:bg-neutral-500/5 dark:text-neutral-200 dark:ring-neutral-500/60"},stone:{root:"bg-stone-500/10 text-stone-700 ring-stone-500/20 dark:bg-stone-500/5 dark:text-stone-200 dark:ring-stone-500/60"},red:{root:"bg-red-500/10 text-red-700 ring-red-500/20 dark:bg-red-500/5 dark:text-red-200 dark:ring-red-500/60"},orange:{root:"bg-orange-500/10 text-orange-700 ring-orange-500/20 dark:bg-orange-500/5 dark:text-orange-200 dark:ring-orange-500/60"},amber:{root:"bg-amber-500/10 text-amber-700 ring-amber-500/20 dark:bg-amber-500/5 dark:text-amber-200 dark:ring-amber-500/60"},yellow:{root:"bg-yellow-500/10 text-yellow-700 ring-yellow-500/20 dark:bg-yellow-500/5 dark:text-yellow-200 dark:ring-yellow-500/60"},lime:{root:"bg-lime-500/10 text-lime-700 ring-lime-500/20 dark:bg-lime-500/5 dark:text-lime-200 dark:ring-lime-500/60"},green:{root:"bg-green-500/10 text-green-700 ring-green-500/20 dark:bg-green-500/5 dark:text-green-200 dark:ring-green-500/60"},emerald:{root:"bg-emerald-500/10 text-emerald-700 ring-emerald-500/20 dark:bg-emerald-500/5 dark:text-emerald-200 dark:ring-emerald-500/60"},teal:{root:"bg-teal-500/10 text-teal-700 ring-teal-500/20 dark:bg-teal-500/5 dark:text-teal-200 dark:ring-teal-500/60"},cyan:{root:"bg-cyan-500/10 text-cyan-700 ring-cyan-500/20 dark:bg-cyan-500/5 dark:text-cyan-200 dark:ring-cyan-500/60"},sky:{root:"bg-sky-500/10 text-sky-700 ring-sky-500/20 dark:bg-sky-500/5 dark:text-sky-200 dark:ring-sky-500/60"},blue:{root:"bg-blue-500/10 text-blue-700 ring-blue-500/20 dark:bg-blue-500/5 dark:text-blue-200 dark:ring-blue-500/60"},indigo:{root:"bg-indigo-500/10 text-indigo-700 ring-indigo-500/20 dark:bg-indigo-500/5 dark:text-indigo-200 dark:ring-indigo-500/60"},violet:{root:"bg-violet-500/10 text-violet-700 ring-violet-500/20 dark:bg-violet-500/5 dark:text-violet-200 dark:ring-violet-500/60"},purple:{root:"bg-purple-500/10 text-purple-700 ring-purple-500/20 dark:bg-purple-500/5 dark:text-purple-200 dark:ring-purple-500/60"},fuchsia:{root:"bg-fuchsia-500/10 text-fuchsia-700 ring-fuchsia-500/20 dark:bg-fuchsia-500/5 dark:text-fuchsia-200 dark:ring-fuchsia-500/60"},pink:{root:"bg-pink-500/10 text-pink-700 ring-pink-500/20 dark:bg-pink-500/5 dark:text-pink-200 dark:ring-pink-500/60"},rose:{root:"bg-rose-500/10 text-rose-700 ring-rose-500/20 dark:bg-rose-500/5 dark:text-rose-200 dark:ring-rose-500/60"}},jA={xs:"h-[22px] px-2 py-0.5 text-xs",sm:"h-6 px-2.5 py-0.5 text-sm"},s0e=e=>{if(!e)return"blue";const t=String(e).toLowerCase();return tR[t]?t:"blue"},fu=({method:e,children:t,color:r,size:n="xs",showIcon:o=!0,copyText:a})=>{const i=r||JL(e),s=i0e(e),u=o?a0e[s]:null,c=u?u.replace("<svg",'<svg class="h-full w-full block"'):null,d=s0e(i),f=tR[d].root,h=jA[n]||jA.xs,p=a??(typeof t=="string"||typeof t=="number"?String(t):typeof e=="string"?e:""),g=b=>{var v;b.stopPropagation(),p&&(v=navigator?.clipboard)!=null&&v.writeText&&navigator.clipboard.writeText(p).catch(()=>{})};return l.jsx("span",{className:`w-max shrink-0 inline-flex items-center justify-center cursor-pointer rounded-tremor-small ring-1 ring-inset ${h} ${f}`,onClick:g,children:l.jsxs("span",{className:"inline-flex items-center gap-1 leading-none",children:[c?l.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center leading-none","aria-hidden":"true",dangerouslySetInnerHTML:{__html:c}}):null,l.jsx("span",{className:"leading-none",children:t})]})})},Um=(e,t,r="slate")=>e?l.jsx(Ht,{color:r,size:"xs",children:t}):null,rR=({tool:e})=>{var t,r,n,o,a,i,s,u;const{total:c,required:d}=Jxe(e.inputSchema),f=Object.entries(((t=e.inputSchema)==null?void 0:t.properties)||{}),h=new Set(((r=e.inputSchema)==null?void 0:r.required)||[]);return l.jsxs(At,{className:"space-y-2 rounded-tremor-small border border-tremor-border p-3 shadow-sm dark:border-dark-tremor-border",children:[l.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e.title||((n=e.annotations)==null?void 0:n.title)||e.name}),e.description?l.jsx(gt,{className:"mt-0.5 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:e.description}):null]}),l.jsxs("div",{className:"flex flex-wrap gap-1 text-[11px]",children:[Um((o=e.annotations)==null?void 0:o.readOnlyHint,"Read-only","blue"),Um(((a=e.annotations)==null?void 0:a.destructiveHint)&&!((i=e.annotations)!=null&&i.readOnlyHint),"Destructive","rose"),Um((s=e.annotations)==null?void 0:s.idempotentHint,"Idempotent","emerald"),Um((u=e.annotations)==null?void 0:u.openWorldHint,"Open world","amber"),c?l.jsxs(Ht,{color:"slate",size:"xs",children:[c," params",d?` (${d} required)`:""]}):l.jsx(Ht,{color:"slate",size:"xs",children:"No params"})]})]}),f.length?l.jsx("div",{className:"space-y-1",children:f.map(([p,g])=>l.jsxs("div",{className:"flex items-start gap-2 rounded-tremor-small bg-tremor-background-subtle px-2 py-1 dark:bg-dark-tremor-background-subtle",children:[l.jsx("div",{className:"font-mono text-xs text-tremor-content-strong dark:text-dark-tremor-content-strong",children:p}),l.jsxs("div",{className:"flex-1 text-[11px] text-tremor-content dark:text-dark-tremor-content",children:[g!=null&&g.type?`${g.type}`:"any",g!=null&&g.description?` — ${g.description}`:""]}),h.has(p)?l.jsx(Ht,{color:"rose",size:"xs",children:"required"}):null]},p))}):null]})},l0e=e=>{if(!e)return null;const t=e.split(`
200
+ `),r=[];let n=[];const o=()=>{n.length&&(r.push(l.jsx("ul",{className:"list-disc space-y-1 pl-5 text-sm",children:n.map((a,i)=>l.jsx("li",{children:a},i))},`list-${r.length}`)),n=[])};return t.forEach(a=>{var i,s;const u=a.trim();if(!u){o();return}if(u.startsWith("#")){o();const c=Math.min(((s=(i=u.match(/^#+/))==null?void 0:i[0])==null?void 0:s.length)||1,6),d=u.replace(/^#+\s*/,"")||u;r.push(l.jsx("div",{className:`font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong ${c<=2?"text-base":"text-sm"}`,children:d},`h-${r.length}`));return}if(u.startsWith("- ")||u.startsWith("* ")){n.push(u.slice(2));return}o(),r.push(l.jsx("p",{className:"text-sm",children:u},`p-${r.length}`))}),o(),l.jsx("div",{className:"space-y-1 text-tremor-content dark:text-dark-tremor-content",children:r})},u0e=e=>{if(typeof window>"u"||typeof DOMParser>"u")return e||"";try{return new DOMParser().parseFromString(e||"","text/html").body.textContent||e||""}catch{return e||""}},nR=({resource:e,mimeType:t,editorOptions:r})=>typeof e?.text=="string"?l.jsxs(l.Fragment,{children:[(t||"").includes("markdown")?l.jsx("div",{className:"rounded-tremor-small border border-slate-200 bg-tremor-background-subtle p-3 text-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:l0e(e.text)||l.jsx("div",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Unable to render markdown preview."})}):null,(t||"").includes("html")?l.jsxs("div",{className:"rounded-tremor-small border border-slate-200 bg-tremor-background-subtle p-3 text-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"HTML (text-only preview)"}),l.jsx("p",{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:u0e(e.text)})]}):null,l.jsx(si,{value:e.text,language:Qxe(t),theme:ui(),beforeMount:li,options:r,height:"240px"})]}):l.jsx(Za,{data:e}),Zc=({annotations:e})=>{if(!e||typeof e!="object")return null;const{audience:t,priority:r,lastModified:n}=e,o=[];return Array.isArray(t)&&t.length&&o.push(l.jsxs(Ht,{color:"slate",size:"xs",children:["audience: ",t.join(", ")]},"audience")),r!==void 0&&o.push(l.jsxs(Ht,{color:"slate",size:"xs",children:["priority: ",r]},"priority")),n&&o.push(l.jsxs(Ht,{color:"slate",size:"xs",children:["modified: ",n]},"lastModified")),o.length?l.jsx("div",{className:"flex flex-wrap gap-2",children:o}):null},EA=(e,t)=>t?`data:${e||"application/octet-stream"};base64,${t}`:"",c0e=({item:e,index:t})=>{const r=`Item ${t+1}`;switch(e?.type){case"text":return l.jsxs("div",{className:"space-y-1 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Text"]}),l.jsx(Zc,{annotations:e.annotations})]}),l.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs text-slate-700 dark:text-dark-tremor-content",children:e.text||"[empty text]"})]});case"image":return l.jsxs("div",{className:"space-y-2 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Image"]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.mimeType?l.jsx(Ht,{color:"slate",size:"xs",children:e.mimeType}):null,l.jsx(Zc,{annotations:e.annotations})]})]}),e.data?l.jsx("img",{src:EA(e.mimeType,e.data),alt:e.description||"MCP image content",className:"max-h-64 w-auto rounded"}):l.jsx("div",{className:"text-sm text-slate-600 dark:text-dark-tremor-content",children:"No image data provided."})]});case"audio":return l.jsxs("div",{className:"space-y-1 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Audio"]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.mimeType?l.jsx(Ht,{color:"slate",size:"xs",children:e.mimeType}):null,l.jsx(Zc,{annotations:e.annotations})]})]}),e.data?l.jsxs("audio",{controls:!0,className:"w-full",children:[l.jsx("source",{src:EA(e.mimeType,e.data),type:e.mimeType||"audio/wav"}),"Your browser does not support the audio element."]}):l.jsx("div",{className:"text-sm text-slate-600 dark:text-dark-tremor-content",children:"No audio data provided."})]});case"resource_link":return l.jsxs("div",{className:"space-y-1 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Resource link"]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.mimeType?l.jsx(Ht,{color:"slate",size:"xs",children:e.mimeType}):null,l.jsx(Zc,{annotations:e.annotations})]})]}),l.jsxs("div",{className:"space-y-1 text-sm text-slate-800 dark:text-dark-tremor-content",children:[l.jsx("div",{className:"font-semibold",children:e.name||e.title||"Unnamed resource"}),l.jsx("div",{className:"break-all text-xs text-slate-600 dark:text-dark-tremor-content",children:e.uri||"No URI"}),e.description?l.jsx("div",{className:"text-sm text-slate-700 dark:text-dark-tremor-content",children:e.description}):null]})]});case"resource":{const n=e.resource||e;return l.jsxs("div",{className:"space-y-2 rounded-tremor-small border border-slate-200 bg-white p-3 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:[r," · Resource"]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.mimeType?l.jsx(Ht,{color:"slate",size:"xs",children:n.mimeType}):null,l.jsx(Zc,{annotations:n.annotations||e.annotations})]})]}),l.jsx(nR,{resource:n,mimeType:n.mimeType})]})}default:return l.jsx(Za,{data:e,title:`${r} · ${e?.type||"Unknown type"}`,copyText:JSON.stringify(e,null,2)})}},oR=({items:e=[]})=>!Array.isArray(e)||!e.length?l.jsx("div",{className:"text-sm text-slate-500 dark:text-dark-tremor-content",children:"No content items returned."}):l.jsx("div",{className:"space-y-2",children:e.map((t,r)=>l.jsx(c0e,{item:t,index:r},r))}),d0e=({label:e,value:t})=>l.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-medium text-slate-800 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content-strong",children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:e}),l.jsx("span",{className:"font-mono text-sm",children:t??"—"})]}),f0e=({tokens:e,title:t="MCP Tokens",defaultOpen:r=!0})=>{const[n,o]=m.useState(r),a=m.useMemo(()=>[{label:"Request",value:e?.request},{label:"Response",value:e?.response},{label:"Total",value:e?.total}].filter(i=>i.value!==void 0),[e]);return e?l.jsx(bo,{title:t,defaultOpen:r,onToggle:o,className:"rounded-lg border border-slate-200 bg-white shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",withBorderTop:!1,children:n?l.jsx("div",{className:"grid grid-cols-2 gap-3 p-2 sm:grid-cols-3",children:a.length>0?a.map(i=>l.jsx(d0e,{label:i.label,value:i.value},i.label)):l.jsx("div",{className:"text-sm text-slate-500 dark:text-dark-tremor-content",children:"No token counts"})}):null}):null},m0e=({open:e,className:t=""})=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-tremor-content transition-transform dark:text-dark-tremor-content ${e?"rotate-180":"rotate-0"} ${t}`,"aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})}),p0e=({operation:e})=>{var t,r,n,o,a,i,s,u,c,d,f,h,p,g,b;const v=((t=e?.meta)==null?void 0:t.mcp)||((n=(r=e?.raw)==null?void 0:r.meta)==null?void 0:n.mcp)||((a=(o=e?.meta)==null?void 0:o.trace)==null?void 0:a.mcp)||((u=(s=(i=e?.raw)==null?void 0:i.meta)==null?void 0:s.trace)==null?void 0:u.mcp);if(!(v&&typeof v=="object"&&Object.keys(v).filter(U=>v[U]!==void 0).length))return l.jsx("div",{className:"text-sm text-gray-500 dark:text-dark-tremor-content",children:"No MCP metadata"});const x=v.tokens,k=Number(e?.status)>=400;JL(v?.method);const E=typeof((c=e?.request)==null?void 0:c.body)=="string"?e.request.body:(d=e?.request)!=null&&d.body?JSON.stringify(e.request.body):"",j=typeof((f=e?.response)==null?void 0:f.body)=="string"?e.response.body:(h=e?.response)!=null&&h.body?JSON.stringify(e.response.body):"",S=eR((p=e?.response)==null?void 0:p.event_frames),C=j||S||"",O=Ih(E),M=Ih(C),A=!!((g=O?.params)!=null&&g.arguments&&Object.keys(O.params.arguments).length),[T,_]=m.useState("structured"),F=v?.method||O?.method,$=m.useMemo(()=>QL(F,M),[F,M]),I=m.useMemo(()=>!!$.structuredContent,[$.structuredContent]),R=m.useMemo(()=>Array.isArray($.content)&&$.content.length,[$.content]),[W,B]=m.useState({mcp:!0}),L=U=>{B(H=>({...H,[U]:!H[U]}))},q=m.useMemo(()=>{const U=[];return I&&U.push({key:"structured",label:"Structured content"}),R&&U.push({key:"content",label:"Content items"}),U.push({key:"raw",label:"Raw content"}),U},[I,R]);return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-2 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("h3",{className:"text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:"MCP"}),l.jsx(Ht,{color:k?"rose":"emerald",size:"xs",children:k?"Error":"Success"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(vT,{mcp:v}),l.jsx("button",{type:"button",onClick:()=>L("mcp"),"aria-label":W.mcp?"Collapse MCP section":"Expand MCP section",children:l.jsx(m0e,{open:W.mcp})})]})]}),W.mcp?l.jsxs("div",{className:"mt-1 grid grid-cols-1 gap-3 sm:grid-cols-3",children:[l.jsxs("div",{className:"rounded border border-slate-200 bg-white px-3 py-2 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:v.category??"Name"}),l.jsx("div",{className:"mt-1 text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong break-all",children:l.jsx(fu,{method:v.method??"",children:v.name??"—"})})]}),l.jsxs("div",{className:"rounded border border-slate-200 bg-white px-3 py-2 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:"Method"}),l.jsx("div",{className:"mt-1 text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong break-all",children:l.jsx(fu,{method:v.method??"",children:v.method??"—"})})]}),l.jsxs("div",{className:"rounded border border-slate-200 bg-white px-3 py-2 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsx("div",{className:"text-[11px] uppercase tracking-wide text-slate-500 dark:text-dark-tremor-content",children:"Category"}),l.jsx("div",{className:"mt-1 text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong break-all",children:l.jsx(fu,{color:"slate",children:v.category??"—"})})]})]}):null]}),x?l.jsx(f0e,{tokens:x}):null,O||M?l.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[A?l.jsx(ip,{children:l.jsx(ZL,{args:O.params.arguments})}):null,l.jsx(sp,{children:M?$.type==="toolsList"&&(b=$.tools)!=null&&b.length?l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"flex items-center justify-between",children:l.jsxs("h4",{className:"text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:["Tools (",$.tools.length,")"]})}),l.jsx("div",{className:"space-y-2",children:$.tools.map(U=>l.jsx(rR,{tool:U},U.name))})]}):$.type==="promptsList"&&$.prompts?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("h4",{className:"text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:["Prompts (",$.prompts.length,")"]}),l.jsx("div",{className:"space-y-2",children:$.prompts.map(U=>{const H=U.arguments||[],X=H.filter(Y=>Y.required).length;return l.jsxs("div",{className:"space-y-1 rounded border border-slate-200 bg-white p-3 text-sm shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:U.title||U.name}),U.description?l.jsx("div",{className:"text-xs text-slate-600 dark:text-dark-tremor-content",children:U.description}):null]}),l.jsxs(Ht,{color:"slate",size:"xs",children:[H.length," args",X?` (${X} required)`:""]})]}),H.length?l.jsx("div",{className:"space-y-1",children:H.map(Y=>l.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[l.jsx("span",{className:"font-mono text-slate-700 dark:text-dark-tremor-content-strong",children:Y.name}),l.jsx("span",{className:"flex-1 text-slate-700 dark:text-dark-tremor-content",children:Y.description||"No description"}),Y.required?l.jsx(Ht,{color:"rose",size:"xs",children:"required"}):null]},Y.name))}):null]},U.name)})})]}):$.type==="resourcesList"&&$.resources?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("h4",{className:"text-sm font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:["Resources (",$.resources.length,")"]}),l.jsx("div",{className:"divide-y divide-slate-200 text-sm dark:divide-dark-tremor-border",children:$.resources.map(U=>l.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"font-semibold text-slate-800 dark:text-dark-tremor-content-strong",children:U.title||U.name||U.uri}),l.jsx("div",{className:"text-xs text-slate-600 dark:text-dark-tremor-content",children:U.uri}),U.description?l.jsx("div",{className:"text-xs text-slate-700 dark:text-dark-tremor-content",children:U.description}):null]}),U.mimeType?l.jsx(Ht,{color:"slate",size:"xs",children:U.mimeType}):null,U.size?l.jsx(Ht,{color:"slate",size:"xs",children:`${(U.size/1024).toFixed(1)} KB`}):null]},U.uri))})]}):$.type==="structured"||$.type==="content"||R?(()=>{var U;const H=((U=q.find(Y=>Y.key===T))==null?void 0:U.key)||q[0].key,X=q.findIndex(Y=>Y.key===H);return l.jsxs(Ju,{index:X,onIndexChange:Y=>{var ae;return _(((ae=q[Y])==null?void 0:ae.key)||"raw")},children:[l.jsx(Zu,{children:q.map(Y=>l.jsx(vo,{children:Y.label},Y.key))}),l.jsx(Qu,{children:q.map(Y=>l.jsxs(yo,{children:[Y.key==="structured"?l.jsx(Za,{data:$.structuredContent,title:"Structured content"}):null,Y.key==="content"?l.jsx(Za,{data:$.content,title:"Content items",copyText:JSON.stringify($.content,null,2),children:l.jsx(oR,{items:$.content})}):null,Y.key==="raw"?l.jsx(Za,{data:$.raw,title:"Raw Output"}):null]},Y.key))})]})})():l.jsx(Za,{data:$.raw}):l.jsx("div",{className:"text-sm text-slate-500 dark:text-dark-tremor-content",children:"No MCP output"})})]}):null]})},h0e=({endpoint:e,command:t,prompt:r="computer:~$",showCopyButton:n=!1,showCopyLabel:o=!1,copyLabelText:a="Copy",copiedText:i="Copied"})=>{const s=t||`curl -X GET ${e||"http://localhost:8080"}`;return l.jsx("div",{className:"w-full mt-6 max-w-xl mx-auto",children:l.jsxs("div",{className:`coding inverse-toggle px-5 pt-4 shadow-lg text-gray-100 text-sm font-mono subpixel-antialiased
201
+ bg-gray-800 pb-6 pt-4 rounded-lg leading-normal overflow-hidden`,children:[l.jsxs("div",{className:"top mb-2 flex justify-between",children:[l.jsxs("div",{className:"flex",children:[l.jsx("div",{className:"h-3 w-3 bg-red-500 rounded-full"}),l.jsx("div",{className:"ml-2 h-3 w-3 bg-orange-300 rounded-full"}),l.jsx("div",{className:"ml-2 h-3 w-3 bg-green-500 rounded-full"})]}),n&&l.jsx(Cn,{textToCopy:s})]}),l.jsxs("div",{className:"mt-4 flex",children:[l.jsx("span",{className:"text-green-400",children:r}),l.jsxs("p",{className:"flex-1 typing items-start pl-2",children:[s,l.jsx("br",{})]})]})]})})},g0e=25;function b0e(e){const{client:t,setToast:r}=Er(),[n,o]=m.useState(null),[a,i]=m.useState(!1),s=m.useRef(0),u=m.useRef(new Map),c=m.useRef([]),d=p=>{if(!p)return null;const g=u.current;if(!g.has(p))return null;const b=c.current,v=b.indexOf(p);return v>=0&&b.splice(v,1),b.unshift(p),g.get(p)},f=(p,g)=>{if(!p)return;const b=u.current,v=c.current,x=b.has(p);if(b.set(p,g),x){const k=v.indexOf(p);k>=0&&v.splice(k,1)}for(v.unshift(p);v.length>g0e;){const k=v.pop();b.delete(k)}},h=m.useCallback(async(p,{force:g}={})=>{var b;if(!p||!((b=t?.operations)!=null&&b.getOperation)){o(null);return}const v=g?null:d(p);if(v){o(v),i(!1);return}const x=++s.current;i(!0);try{const k=await t.operations.getOperation(p);if(s.current!==x)return;o(k),f(p,k),i(!1)}catch(k){if(s.current!==x)return;i(!1),r({message:"Failed to load request",subMessage:k?.message||"Unable to fetch the operation details.",type:"error"})}},[t,r]);return m.useEffect(()=>{if(!e){o(null);return}h(e)},[e,h]),{detailOperation:n,fetchDetail:h,isFetching:a}}const Fk={opacity:1,visibility:"visible",transition:"opacity 0.3s ease-in-out, visibility 0.3s ease-in-out"},$k={opacity:0,visibility:"hidden",transition:"opacity 0.3s ease-in-out, visibility 0.3s ease-in-out"},v0e=({operation:e,currentTab:t,setCurrentTab:r})=>{var n,o,a,i,s,u;const[c,d]=Ur("ingressEndpoint",""),[f,h]=Ur("proxyEndpoint",""),[p]=Ur("expose","false"),g=p==="true",[b,v]=m.useState(!1),{detailOperation:x,fetchDetail:k,isFetching:E}=b0e(e?.id),[j,S]=m.useState(!1),C=$=>$?Array.isArray($)?$:Object.entries($).map(([I,R])=>({name:I,value:R})):[],O=C((o=(n=x?.meta)==null?void 0:n.inspectr)==null?void 0:o.guard),M=C((i=(a=x?.meta)==null?void 0:a.inspectr)==null?void 0:i.directives),A=O.length>0||M.length>0,T=((s=x?.meta)==null?void 0:s.mcp)||null,_=!!(T&&typeof T=="object"&&Object.keys(T).some($=>T[$]!==void 0)),F=Array.isArray((u=x?.meta)==null?void 0:u.tags)&&x.meta.tags.length>0?"calc(100vh - 270px - 64px - 48px)":"calc(100vh - 270px - 64px)";return m.useEffect(()=>{x&&!A&&t==="meta"&&r("request")},[A,t,r]),m.useEffect(()=>{x&&!_&&t==="mcp"&&r("request")},[_,t,r]),m.useEffect(()=>{const $=setTimeout(()=>{v(!0)},100);return()=>clearTimeout($)},[]),m.useEffect(()=>{E||S(!1)},[E]),m.useEffect(()=>{S(!1)},[e?.id]),e?x?l.jsxs("div",{className:"relative flex flex-col h-full min-h-0",style:b?Fk:$k,children:[l.jsx(cV,{operation:x,setCurrentTab:r,onRefresh:()=>{e!=null&&e.id&&(S(!0),k(e.id,{force:!0}))},isRefreshing:E&&j}),l.jsxs("div",{className:"flex space-x-2",children:[l.jsx("button",{className:`px-4 py-1 text-base rounded-t ${t==="request"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-200 dark:bg-dark-tremor-background-subtle text-gray-700 dark:text-dark-tremor-content"}`,onClick:()=>r("request"),children:"Request"}),l.jsx("button",{className:`px-4 py-1 text-base rounded-t ${t==="response"?"bg-blue-600 dark:bg-blue-700 text-white":"bg-gray-200 dark:bg-dark-tremor-background-subtle text-gray-700 dark:text-dark-tremor-content"}`,onClick:()=>r("response"),children:"Response"}),A&&l.jsx("button",{className:`px-4 py-1 text-base rounded-t ${t==="meta"?"bg-teal-600 dark:bg-teal-700 text-white":"bg-gray-200 dark:bg-dark-tremor-background-subtle text-gray-700 dark:text-dark-tremor-content"}`,onClick:()=>r("meta"),children:"Info"}),_&&l.jsx("button",{className:`px-4 py-1 text-base rounded-t ${t==="mcp"?"bg-sky-500 dark:bg-sky-800 text-white":"bg-gray-200 dark:bg-dark-tremor-background-subtle text-gray-700 dark:text-dark-tremor-content"}`,onClick:()=>r("mcp"),children:"MCP"})]}),l.jsx("div",{className:"p-4 bg-white dark:bg-dark-tremor-background border border-gray-300 dark:border-dark-tremor-border rounded-b shadow dark:shadow-dark-tremor-shadow flex-1 min-h-0 overflow-y-auto",style:{...b?Fk:$k,maxHeight:F},children:t==="request"?l.jsx(yW,{operation:x}):t==="response"?l.jsx(SW,{operation:x}):t==="meta"&&A?l.jsx(OW,{operation:x}):t==="mcp"?l.jsx(p0e,{operation:x}):null})]}):null:l.jsx("div",{className:"h-96 min-h-full mb-20 flex flex-1 flex-col justify-center rounded-tremor-default border border-tremor-border bg-tremor-background-muted px-6 py-10 dark:border-dark-tremor-border dark:bg-dark-tremor-background-muted",style:b?Fk:$k,children:l.jsxs("div",{className:"mx-auto text-center",children:[l.jsx("h4",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong font-[Inter] font-sans",children:"Request Inspectr"}),l.jsx("p",{className:"mt-3 max-w-xl text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content sm:text-base",children:"Select a request from the list to view its details"}),l.jsxs("p",{className:"max-w-xl text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content sm:text-base",children:["or get started by making a request to"," ",g?c?`"${c}"`:"the ingress endpoint":f?`"${f}"`:"the proxy endpoint","."]}),l.jsx(h0e,{endpoint:g?c:f,showCopyButton:!0}),l.jsxs("div",{className:"mt-8 sm:flex sm:items-center sm:justify-center sm:gap-x-3",children:[l.jsx("a",{href:"https://inspectr.dev/docs",target:"_blank",className:"w-full whitespace-nowrap rounded-tremor-small bg-tremor-brand px-4 py-2 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis sm:w-fit",children:"View Documentation"}),l.jsxs("a",{href:"https://inspectr.dev",target:"_blank",className:"mt-2 inline-flex w-full items-center justify-center gap-1.5 whitespace-nowrap rounded-tremor-small border border-tremor-border bg-tremor-background px-3 py-2 text-tremor-default font-medium text-tremor-brand shadow-tremor-input hover:text-tremor-brand-emphasis dark:border-dark-tremor-border dark:bg-dark-tremor-background dark:text-dark-tremor-brand dark:shadow-dark-tremor-input hover:dark:text-dark-tremor-brand-emphasis sm:mt-0 sm:w-fit",children:["Visit Website",l.jsx(fF,{className:"size-5 shrink-0","aria-hidden":!0})]})]})]})})},y0e="data:image/svg+xml,%3csvg%20class='inline-block'%20width='24'%20height='24'%20viewBox='0%200%201648%201648'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='grad-r4R0»'%20x1='0%25'%20y1='0%25'%20x2='100%25'%20y2='0%25'%3e%3cstop%20offset='0%25'%20style='stop-color:%23ff8c00'%3e%3c/stop%3e%3cstop%20offset='100%25'%20style='stop-color:%23ffd700'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20d='m610%20216.654c-66.158%204.092-126.119%2035.849-164.917%2087.346-8.408%2011.16-13.344%2019.191-19.983%2032.513-12.431%2024.946-19.521%2050.434-22.11%2079.487-1.665%2018.687-.854%20826.238.841%20837.939%207.867%2054.284%2032.465%20101.134%2070.706%20134.667%2016.297%2014.291%2032.283%2024.657%2053.963%2034.991%2016.889%208.05%2034.568%2013.468%2060.5%2018.541%209.019%201.764%2052.201%201.795%2061.5.044%2026.487-4.989%2043.97-10.341%2061-18.675%2015.131-7.406%2021.53-11.135%2060.5-35.267%2020.813-12.887%2023.095-14.298%2029.5-18.24l13-8%2013-8c6.901-4.247%2012.593-7.767%2029.54-18.271%205.796-3.593%2012.771-7.863%2015.5-9.49%202.728-1.626%208.56-5.19%2012.96-7.921%204.4-2.73%2072.575-44.711%20151.5-93.29s150.925-92.918%20160-98.531c9.075-5.612%2024.15-14.936%2033.5-20.719s23.075-14.234%2030.5-18.78c85.169-52.142%20120.029-73.942%20130.014-81.304%2040.974-30.211%2068.344-69.764%2081.788-118.194%2013.864-49.94%208.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5%2077.269c-39.541%206.402-76.013%2029.73-97.661%2062.467-13.001%2019.66-19.718%2038.39-22.802%2063.584-1.472%2012.028-1.434%20802.191.04%20818.026%201.861%2019.998%206.142%2035.48%2014.415%2052.133%2017.942%2036.114%2053.025%2064.18%2091.508%2073.203%203.575.839%208.975%202.118%2012%202.844%208.221%201.973%2040.343%201.613%2049.971-.56%2032.301-7.289%2065.233-26.686%2094.817-55.849%2015.26-15.042%2022.884-24.803%2033.571-42.979%2013.939-23.706%2020.949-43.36%2027.745-77.792%201.004-5.086%201.428-50%201.949-206.5.465-139.686%201.001-201.809%201.777-206%20.611-3.3%201.608-9.15%202.217-13%201.672-10.583%204.039-21.117%207.191-32%208.179-28.247%2020.714-55.13%2037.188-79.751%2024.262-36.262%2053.189-63.572%2093.074-87.872%204.95-3.016%2012.825-7.435%2017.5-9.82s8.95-4.668%209.5-5.074c3.565-2.63%2034.688-13.266%2052.465-17.93%206.2-1.627%2011.49-3.174%2011.754-3.439%201.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5%20305.564c-5.775.685-11.625%201.491-13%201.792-1.375.3-5.2%201.088-8.5%201.749-7.914%201.587-27.103%207.461-36.5%2011.174-38.797%2015.33-75.171%2044.925-98.829%2080.41-11.24%2016.86-21.329%2038.407-26.167%2055.888-2.443%208.825-3.85%2014.608-4.866%2020-.621%203.3-1.653%208.475-2.292%2011.5-.846%204.008-1.345%2059.624-1.837%20205-.618%20182.331-.824%20200.361-2.399%20209.5-1.629%209.459-4.196%2022.506-6.744%2034.279-.628%202.903-.881%205.54-.561%205.859.596.596%20455.986-279.084%20472.195-290.001%2017.547-11.819%2036.335-33.412%2046.291-53.203%203.956-7.863%209.527-23.924%2011.597-33.434%204.848-22.272%203.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25%201048.256c3.988.189%2010.513.189%2014.5%200%203.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346'%20fill='url(%23grad-r4R0»)'%20fill-rule='evenodd'%3e%3c/path%3e%3c/svg%3e";function x0e({status:e,onReconnect:t}){const r={connected:"bg-green-500 text-white",reconnecting:"bg-yellow-500 text-black",disconnected:"bg-red-500 text-white"}[e],n={connected:"bg-green-800 animate-pulse",reconnecting:"bg-yellow-800 animate-pulse",disconnected:"bg-red-800"}[e],o=e.charAt(0).toUpperCase()+e.slice(1);return l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{className:`px-2 py-1 rounded-full text-xs font-semibold flex items-center ${r}`,children:[l.jsx("span",{className:`w-2 h-2 rounded-full mr-1 ${n}`}),o]}),e==="disconnected"&&l.jsx("button",{onClick:t,className:"ml-2 text-sm font-medium text-blue-600 hover:underline",children:"Reconnect"})]})}const k0e=()=>{const{apiEndpoint:e,setApiEndpoint:t,connectionStatus:r,channelCode:n,setChannelCode:o,channel:a,setChannel:i,client:s,userInitiatedRegistrationRef:u,handleRegister:c,attemptReRegistration:d,resetReRegistration:f}=Er(),[h,p]=m.useState(!1),[g,b]=m.useState(e),[v,x]=m.useState(n),[k,E]=m.useState(a);m.useEffect(()=>{h||(b(e),x(n),E(a))},[e,n,a,h]);const j=()=>{const C=g.replace(/\/+$/,"");t(C),s.configure({apiEndpoint:C}),u.current=!1,c(n,a,"",!0)},S=()=>{u.current=!0,o(v),i(k),c(v,k,"",!0)};return l.jsxs("div",{className:"fixed bottom-0 left-0 w-full",children:[l.jsxs("div",{className:"flex items-center justify-between bg-gray-200 dark:bg-dark-tremor-background-subtle px-4 py-2 w-full cursor-pointer select-none",onClick:()=>p(C=>!C),children:[l.jsx(x0e,{status:r,onReconnect:C=>{C.stopPropagation(),f(),d()}}),l.jsxs("a",{href:"https://github.com/inspectr-hq/inspectr",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2",onClick:C=>C.stopPropagation(),children:[l.jsx("img",{src:y0e,alt:"Inspectr Logo",className:"h-6"}),l.jsx("span",{className:"text-gray-700 dark:text-dark-tremor-content font-semibold text-sm",children:"Inspectr"})]})]}),l.jsx("div",{className:`bg-gray-100 dark:bg-dark-tremor-background border-t border-gray-300 dark:border-dark-tremor-border transition-all duration-300 overflow-hidden ${h?"max-h-96 opacity-100 py-4":"max-h-0 opacity-0 py-0"}`,children:l.jsxs("div",{className:"px-6",children:[l.jsx("h2",{className:"text-lg font-semibold text-gray-800 dark:text-dark-tremor-content-strong mb-4",children:"Configuration"}),l.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Inspectr API Endpoint"}),l.jsx("input",{type:"text",placeholder:"Enter API Endpoint...",value:g,onChange:C=>b(C.target.value),className:"w-full border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),l.jsx("button",{onClick:j,className:"mt-2 bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800 text-white px-3 py-1.5 rounded-md text-sm",children:"Save"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Channel"}),l.jsx("input",{type:"text",placeholder:"Enter Channel...",value:k,onChange:C=>E(C.target.value),className:"w-full bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content border border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"}),l.jsx("button",{onClick:S,className:"mt-2 bg-green-600 hover:bg-green-700 dark:bg-green-700 dark:hover:bg-green-800 text-white px-3 py-1.5 rounded-md text-sm",children:"Register"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-dark-tremor-content mb-1",children:"Access Code"}),l.jsx("input",{type:"text",placeholder:"Enter Access Code...",value:v,onChange:C=>x(C.target.value),className:"w-full border bg-white dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content border-gray-300 dark:border-dark-tremor-border rounded-md shadow-sm py-2 px-3 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]})]})]})})]})};function mi(){const e=window.location.hash.slice(1),[t,r]=e.split("?"),[n,o,a]=t.split("/"),i=Object.fromEntries(new URLSearchParams(r||""));return{slug:n,operationId:o,subTab:a,params:i}}function w0e(e,t=e[0].slug){const r=()=>{const{slug:s,operationId:u,subTab:c,params:d}=mi();return e.some(f=>f.slug===s)?{slug:s,operationId:u,subTab:c,params:d}:{slug:t,operationId:null,subTab:null,params:{}}},[n,o]=m.useState(()=>typeof window>"u"?{slug:t,operationId:null,subTab:null,params:{}}:r());m.useEffect(()=>{const s=()=>o(r());return window.addEventListener("hashchange",s),()=>window.removeEventListener("hashchange",s)},[]);const a=s=>{window.history.pushState(null,"",`#${s.slug}`),o({slug:s.slug,operationId:null,subTab:null,params:{}})},i=e.find(s=>s.slug===n.slug)||e[0];return{route:n,currentNav:i,handleTabClick:a}}function j0e(e,t="request"){const[r,n]=m.useState(null),[o,a]=m.useState(t);return m.useEffect(()=>{const i=()=>{const{slug:s,operationId:u,subTab:c}=mi();if(s==="inspectr"){if(u&&e.length){const d=e.find(f=>String(f.id)===u);d&&n(d)}c&&a(c)}};return i(),window.addEventListener("hashchange",i),()=>window.removeEventListener("hashchange",i)},[e]),{selectedOperation:r,currentTab:o,handleSelect:i=>{n(i),window.history.pushState(null,"",`#inspectr/${i.id}/${o}`)},handleTabChange:i=>{a(i);const s=r?`#inspectr/${r.id}`:"#inspectr";window.history.replaceState(null,"",`${s}/${i}`)},clearSelection:()=>{n(null),window.history.pushState(null,"","#inspectr")}}}function NA(e,t){if(e===null)return t;try{return JSON.parse(e)}catch{return e}}function SA(e){if(e==null)return null;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function E0e(e,t,r={}){const{resetOnReload:n=!1}=r,o=m.useRef(),a=()=>{if(typeof window>"u")return t;const u=sessionStorage.getItem(e);return NA(u,t)},[i,s]=m.useState(a);return m.useEffect(()=>{o.current=i},[i]),m.useEffect(()=>{if(!n||typeof window>"u")return;const u=()=>{sessionStorage.removeItem(e)};return window.addEventListener("beforeunload",u),()=>window.removeEventListener("beforeunload",u)},[e,n]),m.useEffect(()=>{if(typeof window>"u")return;const u=c=>{if(c.key&&c.key!==e)return;const d=sessionStorage.getItem(e),f=NA(d,t),h=SA(o.current);d!==h&&s(f)};return window.addEventListener("storage",u),window.addEventListener("session-storage",u),()=>{window.removeEventListener("storage",u),window.removeEventListener("session-storage",u)}},[e,t]),m.useEffect(()=>{if(typeof window>"u")return;const u=SA(i),c=sessionStorage.getItem(e);if(u===null){if(c===null)return;sessionStorage.removeItem(e)}else{if(c===u)return;sessionStorage.setItem(e,u)}window.dispatchEvent(new CustomEvent("session-storage",{detail:{key:e,value:i}}))},[e,i]),[i,s]}const N0e=e=>{if(e==null)return null;if(typeof e=="string")return e;if(e instanceof Date)return e.toISOString();if(typeof e=="number"){const r=new Date(e);if(!Number.isNaN(r.valueOf()))return r.toISOString()}const t=new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toISOString()},Us=e=>N0e(e),aj=(e,t)=>{if(!e)return!1;if(!t)return!0;const r=Date.parse(e),n=Date.parse(t);return!Number.isNaN(r)&&!Number.isNaN(n)?r>n:e>t},S0e="requestFilters",OA=Object.freeze({}),O0e=Object.freeze({resetOnReload:!0}),aR=({route:e={slug:"inspectr"}})=>{const{toast:t,setToast:r,client:n}=Er(),{syncOperations:o,setLastEventId:a}=Er(),i=100,s=33,[u,c]=m.useState(1),[d,f]=m.useState(!1),[h,p]=Ur("leftPanelWidth",s),[,g]=Ur("inspectrLastSeenAt",null),b=parseFloat(h||s),v=m.useRef(!1),[x,k]=m.useState("time"),[E,j]=m.useState("desc"),[S,C]=E0e(S0e,OA,O0e),O=m.useRef(!1),M=Q=>String(Q).split(",").map(ue=>ue.trim()).filter(Boolean);m.useEffect(()=>{const Q=e?.params||{},{status:ue,method:G,path:de,host:ie,tags:V,tag:ee,durationMin:ne,durationMax:ge,from:Ee,to:Pe,start:Ie,end:nt,range:Me,timestampRange:ot,sortField:Ge,sortDirection:at,page:mt}=Q;if(ue!==void 0||G!==void 0||de!==void 0||ie!==void 0||V!==void 0||ee!==void 0||ne!==void 0||ge!==void 0||Ee!==void 0||Pe!==void 0||Ie!==void 0||nt!==void 0||Me!==void 0||ot!==void 0){const Ke={};ue!==void 0&&(Ke.status=M(ue)),G!==void 0&&(Ke.method=M(G)),de&&(Ke.path=de),ie&&(Ke.host=ie),ne!==void 0&&(Ke.durationMin=ne),ge!==void 0&&(Ke.durationMax=ge);const pt=Me||ot;pt?Ke.timestampRange=pt:(Ee||Pe||Ie||nt)&&(Ke.timestampRange={start:Ee||Ie,end:Pe||nt});const jt=V??ee;jt!==void 0&&(Ke.tags=M(jt)),C(Ke),O.current=!0}else O.current&&(C(OA),O.current=!1);if(Ge&&k(Ge),(at==="asc"||at==="desc")&&j(at),mt){const Ke=Number.parseInt(mt,10);Number.isFinite(Ke)&&Ke>0&&c(Ke)}},[e?.params,C]);const{results:A=[],totalCount:T=0}=ba(()=>Nn.queryEvents({filters:S,sort:{field:x,order:E},page:u,pageSize:i}),[S,x,E,u],{results:[],totalCount:0})||{},_=ba(()=>Nn.getAllTagOptions(),[],[])||[],F=ba(async()=>{try{const Q=await Nn.db.events.orderBy("time").last();return Q?.time||null}catch{return null}},[])||null,$=(e?.slug||null)==="inspectr";m.useEffect(()=>{if(!$)return;const Q=Us(F);Q&&g(ue=>{const G=Us(ue);return!G||aj(Q,G)?Q:G})},[$,F,g]);const I=T?Math.ceil(T/i):1,{selectedOperation:R,currentTab:W,handleSelect:B,handleTabChange:L,clearSelection:q}=j0e(A),U=()=>{f(!0),o(),setTimeout(()=>f(!1),2500)};m.useEffect(()=>{if(!A||R&&A.some(G=>G.id===R.id))return;const{slug:Q,operationId:ue}=mi();if(Q==="inspectr"&&ue){const G=A.find(de=>String(de.id)===ue);G&&B(G);return}A.length>0?B(A[0]):q()},[A,R]);const H=async()=>{q();try{await Nn.clearEvents(),await ae(),a("")}catch(Q){console.error("Error clearing all operations:",Q)}},X=async()=>{try{const Q=await Nn.queryEvents({filters:S,sort:{field:"time",order:"desc"},page:1,pageSize:Number.MAX_SAFE_INTEGER});await Promise.all(Q.map(async ue=>{await Nn.deleteEvent(ue.id),await te(ue.operation_id)})),R&&Q.some(ue=>ue.id===R.id)&&q()}catch(Q){console.error("Error clearing filtered operations:",Q)}},Y=async Q=>{const ue=R&&(R.id||"")===Q,G=await Nn.getEvent(Q);try{if(await Nn.deleteEvent(Q),await te(G.operation_id),ue){q();const de=await Nn.queryEvents({sort:{field:x,order:E},filters:S,page:u,pageSize:i});de&&de.length>0&&B(de[0])}}catch(de){console.error("Error during operation removal:",de)}},ae=async()=>{try{await n.operations.deleteAll()}catch(Q){console.error("Error deleting all operations:",Q),r({message:"Error deleting all operations",subMessage:Q.message,type:"error"})}},te=async Q=>{try{await n.operations.delete(Q)}catch(ue){console.error(`Error deleting operation ${Q}:`,ue),r({message:"Error deleting operation",subMessage:ue.message,type:"error"})}};m.useEffect(()=>{const Q=G=>{if(!v.current)return;const de=G.clientX/window.innerWidth*100;de>10&&de<90&&p(String(de))},ue=()=>{v.current=!1};return window.addEventListener("mousemove",Q),window.addEventListener("mouseup",ue),()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",ue)}},[p]);const me=()=>{v.current=!0};return l.jsxs("div",{className:"flex flex-col h-screen bg-white dark:bg-dark-tremor-background",style:{maxHeight:"calc(100vh - 64px)"},children:[l.jsxs("div",{className:"flex flex-grow",children:[l.jsx("div",{className:"overflow-y-auto",style:{width:`${b}%`},children:l.jsx(bF,{operations:A||[],onSelect:B,onRemove:Y,clearOperations:H,clearFilteredOperations:X,selectedOperation:R,currentPage:u,totalPages:I,totalCount:T||0,onPageChange:c,sortField:x,sortDirection:E,filters:S,setSortField:k,setSortDirection:j,setFilters:C,syncOperations:U,isSyncing:d,tagOptions:_})}),l.jsx("div",{className:"relative w-px bg-gray-300 dark:bg-dark-tremor-border cursor-col-resize",onMouseDown:me,children:l.jsx("button",{type:"button",className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-10 flex items-center justify-center px-0 py-2 rounded-md border border-gray-300 bg-white/80 backdrop-blur-sm shadow-sm cursor-col-resize dark:border-dark-tremor-border dark:bg-dark-tremor-background/80",title:"Drag to resize. Double-click to reset.","aria-label":"Resize panels",onMouseDown:Q=>{Q.preventDefault(),me()},onDoubleClick:Q=>{Q.preventDefault(),p(s)},children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4 text-gray-600 dark:text-gray-400","aria-hidden":!0,children:l.jsx("path",{d:"M8.5 7C9.32843 7 10 6.32843 10 5.5C10 4.67157 9.32843 4 8.5 4C7.67157 4 7 4.67157 7 5.5C7 6.32843 7.67157 7 8.5 7ZM8.5 13.5C9.32843 13.5 10 12.8284 10 12C10 11.1716 9.32843 10.5 8.5 10.5C7.67157 10.5 7 11.1716 7 12C7 12.8284 7.67157 13.5 8.5 13.5ZM10 18.5C10 19.3284 9.32843 20 8.5 20C7.67157 20 7 19.3284 7 18.5C7 17.6716 7.67157 17 8.5 17C9.32843 17 10 17.6716 10 18.5ZM15.5 7C16.3284 7 17 6.32843 17 5.5C17 4.67157 16.3284 4 15.5 4C14.6716 4 14 4.67157 14 5.5C14 6.32843 14.6716 7 15.5 7ZM17 12C17 12.8284 16.3284 13.5 15.5 13.5C14.6716 13.5 14 12.8284 14 12C14 11.1716 14.6716 10.5 15.5 10.5C16.3284 10.5 17 11.1716 17 12ZM15.5 20C16.3284 20 17 19.3284 17 18.5C17 17.6716 16.3284 17 15.5 17C14.6716 17 14 17.6716 14 18.5C14 19.3284 14.6716 20 15.5 20Z"})})})}),l.jsx("div",{className:"p-4 h-full overflow-y-auto bg-white dark:bg-dark-tremor-background text-tremor-content-strong dark:text-dark-tremor-content-strong",style:{width:`${100-b}%`},children:l.jsx("div",{className:"flex flex-col h-full",children:l.jsx(v0e,{operation:R,currentTab:W,setCurrentTab:L})})})]}),l.jsx(k0e,{})]})},CA="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%201648%201648'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='grad-ops'%20x1='0%25'%20y1='0%25'%20x2='100%25'%20y2='0%25'%3e%3cstop%20offset='0%25'%20stop-color='%2353afba'%3e%3c/stop%3e%3cstop%20offset='100%25'%20stop-color='%2376fffb'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20d='m610%20216.654c-66.158%204.092-126.119%2035.849-164.917%2087.346-8.408%2011.16-13.344%2019.191-19.983%2032.513-12.431%2024.946-19.521%2050.434-22.11%2079.487-1.665%2018.687-.854%20826.238.841%20837.939%207.867%2054.284%2032.465%20101.134%2070.706%20134.667%2016.297%2014.291%2032.283%2024.657%2053.963%2034.991%2016.889%208.05%2034.568%2013.468%2060.5%2018.541%209.019%201.764%2052.201%201.795%2061.5.044%2026.487-4.989%2043.97-10.341%2061-18.675%2015.131-7.406%2021.53-11.135%2060.5-35.267%2020.813-12.887%2023.095-14.298%2029.5-18.24l13-8%2013-8c6.901-4.247%2012.593-7.767%2029.54-18.271%205.796-3.593%2012.771-7.863%2015.5-9.49%202.728-1.626%208.56-5.19%2012.96-7.921%204.4-2.73%2072.575-44.711%20151.5-93.29s150.925-92.918%20160-98.531c9.075-5.612%2024.15-14.936%2033.5-20.719s23.075-14.234%2030.5-18.78c85.169-52.142%20120.029-73.942%20130.014-81.304%2040.974-30.211%2068.344-69.764%2081.788-118.194%2013.864-49.94%208.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5%2077.269c-39.541%206.402-76.013%2029.73-97.661%2062.467-13.001%2019.66-19.718%2038.39-22.802%2063.584-1.472%2012.028-1.434%20802.191.04%20818.026%201.861%2019.998%206.142%2035.48%2014.415%2052.133%2017.942%2036.114%2053.025%2064.18%2091.508%2073.203%203.575.839%208.975%202.118%2012%202.844%208.221%201.973%2040.343%201.613%2049.971-.56%2032.301-7.289%2065.233-26.686%2094.817-55.849%2015.26-15.042%2022.884-24.803%2033.571-42.979%2013.939-23.706%2020.949-43.36%2027.745-77.792%201.004-5.086%201.428-50%201.949-206.5.465-139.686%201.001-201.809%201.777-206%20.611-3.3%201.608-9.15%202.217-13%201.672-10.583%204.039-21.117%207.191-32%208.179-28.247%2020.714-55.13%2037.188-79.751%2024.262-36.262%2053.189-63.572%2093.074-87.872%204.95-3.016%2012.825-7.435%2017.5-9.82s8.95-4.668%209.5-5.074c3.565-2.63%2034.688-13.266%2052.465-17.93%206.2-1.627%2011.49-3.174%2011.754-3.439%201.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5%20305.564c-5.775.685-11.625%201.491-13%201.792-1.375.3-5.2%201.088-8.5%201.749-7.914%201.587-27.103%207.461-36.5%2011.174-38.797%2015.33-75.171%2044.925-98.829%2080.41-11.24%2016.86-21.329%2038.407-26.167%2055.888-2.443%208.825-3.85%2014.608-4.866%2020-.621%203.3-1.653%208.475-2.292%2011.5-.846%204.008-1.345%2059.624-1.837%20205-.618%20182.331-.824%20200.361-2.399%20209.5-1.629%209.459-4.196%2022.506-6.744%2034.279-.628%202.903-.881%205.54-.561%205.859.596.596%20455.986-279.084%20472.195-290.001%2017.547-11.819%2036.335-33.412%2046.291-53.203%203.956-7.863%209.527-23.924%2011.597-33.434%204.848-22.272%203.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25%201048.256c3.988.189%2010.513.189%2014.5%200%203.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346'%20fill='url(%23grad-ops)'%20fill-rule='evenodd'%3e%3c/path%3e%3c/svg%3e",C0e="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%201648%201648'%20xmlns='http://www.w3.org/2000/svg'%3e%3cdefs%3e%3clinearGradient%20id='grad-connections'%20x1='0%25'%20y1='0%25'%20x2='100%25'%20y2='0%25'%3e%3cstop%20offset='0%25'%20stop-color='%23ff8c00'%3e%3c/stop%3e%3cstop%20offset='100%25'%20stop-color='%23ffd700'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cpath%20d='m610%20216.654c-66.158%204.092-126.119%2035.849-164.917%2087.346-8.408%2011.16-13.344%2019.191-19.983%2032.513-12.431%2024.946-19.521%2050.434-22.11%2079.487-1.665%2018.687-.854%20826.238.841%20837.939%207.867%2054.284%2032.465%20101.134%2070.706%20134.667%2016.297%2014.291%2032.283%2024.657%2053.963%2034.991%2016.889%208.05%2034.568%2013.468%2060.5%2018.541%209.019%201.764%2052.201%201.795%2061.5.044%2026.487-4.989%2043.97-10.341%2061-18.675%2015.131-7.406%2021.53-11.135%2060.5-35.267%2020.813-12.887%2023.095-14.298%2029.5-18.24l13-8%2013-8c6.901-4.247%2012.593-7.767%2029.54-18.271%205.796-3.593%2012.771-7.863%2015.5-9.49%202.728-1.626%208.56-5.19%2012.96-7.921%204.4-2.73%2072.575-44.711%20151.5-93.29s150.925-92.918%20160-98.531c9.075-5.612%2024.15-14.936%2033.5-20.719s23.075-14.234%2030.5-18.78c85.169-52.142%20120.029-73.942%20130.014-81.304%2040.974-30.211%2068.344-69.764%2081.788-118.194%2013.864-49.94%208.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5%2077.269c-39.541%206.402-76.013%2029.73-97.661%2062.467-13.001%2019.66-19.718%2038.39-22.802%2063.584-1.472%2012.028-1.434%20802.191.04%20818.026%201.861%2019.998%206.142%2035.48%2014.415%2052.133%2017.942%2036.114%2053.025%2064.18%2091.508%2073.203%203.575.839%208.975%202.118%2012%202.844%208.221%201.973%2040.343%201.613%2049.971-.56%2032.301-7.289%2065.233-26.686%2094.817-55.849%2015.26-15.042%2022.884-24.803%2033.571-42.979%2013.939-23.706%2020.949-43.36%2027.745-77.792%201.004-5.086%201.428-50%201.949-206.5.465-139.686%201.001-201.809%201.777-206%20.611-3.3%201.608-9.15%202.217-13%201.672-10.583%204.039-21.117%207.191-32%208.179-28.247%2020.714-55.13%2037.188-79.751%2024.262-36.262%2053.189-63.572%2093.074-87.872%204.95-3.016%2012.825-7.435%2017.5-9.82s8.95-4.668%209.5-5.074c3.565-2.63%2034.688-13.266%2052.465-17.93%206.2-1.627%2011.49-3.174%2011.754-3.439%201.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5%20305.564c-5.775.685-11.625%201.491-13%201.792-1.375.3-5.2%201.088-8.5%201.749-7.914%201.587-27.103%207.461-36.5%2011.174-38.797%2015.33-75.171%2044.925-98.829%2080.41-11.24%2016.86-21.329%2038.407-26.167%2055.888-2.443%208.825-3.85%2014.608-4.866%2020-.621%203.3-1.653%208.475-2.292%2011.5-.846%204.008-1.345%2059.624-1.837%20205-.618%20182.331-.824%20200.361-2.399%20209.5-1.629%209.459-4.196%2022.506-6.744%2034.279-.628%202.903-.881%205.54-.561%205.859.596.596%20455.986-279.084%20472.195-290.001%2017.547-11.819%2036.335-33.412%2046.291-53.203%203.956-7.863%209.527-23.924%2011.597-33.434%204.848-22.272%203.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25%201048.256c3.988.189%2010.513.189%2014.5%200%203.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346'%20fill='url(%23grad-connections)'%20fill-rule='evenodd'%3e%3c/path%3e%3c/svg%3e",iR="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='currentColor'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='m3.75%2013.5%2010.5-11.25L12%2010.5h8.25L9.75%2021.75%2012%2013.5H3.75Z'%20/%3e%3c/svg%3e",P0e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20d='M3.49994%2011.7501L11.6717%203.57855C12.7762%202.47398%2014.5672%202.47398%2015.6717%203.57855C16.7762%204.68312%2016.7762%206.47398%2015.6717%207.57855M15.6717%207.57855L9.49994%2013.7501M15.6717%207.57855C16.7762%206.47398%2018.5672%206.47398%2019.6717%207.57855C20.7762%208.68312%2020.7762%2010.474%2019.6717%2011.5785L12.7072%2018.543C12.3167%2018.9335%2012.3167%2019.5667%2012.7072%2019.9572L13.9999%2021.2499'%20stroke='%236b7280'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/path%3e%3cpath%20d='M17.4999%209.74921L11.3282%2015.921C10.2237%2017.0255%208.43272%2017.0255%207.32823%2015.921C6.22373%2014.8164%206.22373%2013.0255%207.32823%2011.921L13.4999%205.74939'%20stroke='%236b7280'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/path%3e%3c/svg%3e",A0e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%236b7280'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%3e%3cpath%20d='m15%2012-8.373%208.373a1%201%200%201%201-3-3L12%209'%3e%3c/path%3e%3cpath%20d='m18%2015%204-4'%3e%3c/path%3e%3cpath%20d='m21.5%2011.5-1.914-1.914A2%202%200%200%201%2019%208.172V7l-2.26-2.26a6%206%200%200%200-4.202-1.756L9%202.96l.92.82A6.18%206.18%200%200%201%2012%208.4V10l2%202h1.172a2%202%200%200%201%201.414.586L18.5%2014.5'%3e%3c/path%3e%3c/svg%3e",T0e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%236b7280'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%3e%3cpath%20d='M20%207h-3a2%202%200%200%201-2-2V2'%3e%3c/path%3e%3cpath%20d='M9%2018a2%202%200%200%201-2-2V4a2%202%200%200%201%202-2h7l4%204v10a2%202%200%200%201-2%202Z'%3e%3c/path%3e%3cpath%20d='M3%207.6v12.8A1.6%201.6%200%200%200%204.6%2022h9.8'%3e%3c/path%3e%3c/svg%3e",M0e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%236b7280'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%3e%3cpath%20d='M21%2015a2%202%200%200%201-2%202H7l-4%204V5a2%202%200%200%201%202-2h14a2%202%200%200%201%202%202z'%3e%3c/path%3e%3c/svg%3e";function Na(e,t=!1,r=!0){const[n,o]=Ur(`feature_preview_${e}`,t?"true":void 0);return m.useEffect(()=>{r&&n==="false"&&o(void 0)},[r,n,o]),[n==="true",a=>{o(a?"true":r?void 0:"false")}]}function sR(e){const t=e&&e.reason||"",r=e&&e.status;switch(t){case"invalid_request":return'Invalid request. Submit as {"license_key": "..."}.';case"invalid_format":return"Invalid format. Did you paste JSON or a file? Paste only the license key string.";case"ingress_unreachable":return"Activation service unreachable. Check network/ingress connectivity and try again.";case"activation_error":return`Activation failed. ${e?.details||"Please try again or contact support."}`;case"invalid_key":return"Invalid license key. Is this the exact key? Check for typos or request a new key.";case"revoked":return"License revoked. Contact support to resolve or obtain a new license.";case"expired":return"License expired. Renew your license or enter a valid key.";case"storage_error":return"Failed to store the license locally. Ensure write permissions and retry.";case"internal_error":return"Server error during activation. Please try again shortly.";default:return r===401?"Unauthorized: Invalid license key.":r===403?"Forbidden: License revoked.":r===410?"Expired license. Please renew or use a new key.":e?.message||"Failed to update license"}}function _0e({open:e,onClose:t,onSubmit:r}){const[n,o]=m.useState(""),[a,i]=m.useState(""),[s,u]=m.useState(!1),c="license-file-input";if(m.useEffect(()=>{e&&(o(""),i(""),u(!1))},[e]),!e)return null;const d=async()=>{i("");const h=(n||"").trim();if(!h){i("Please paste a license key.");return}try{u(!0),await r(h),t()}catch(p){const g=sR(p);i(g),u(!1)}},f=async h=>{const p=h.target.files&&h.target.files[0];if(p)try{const g=await p.text();o(g.trim()),i("")}catch{i("Failed to read license file.")}finally{h.target.value=""}};return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white dark:bg-gray-950 rounded-lg shadow-xl max-w-2xl w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-50",children:"Update License"}),l.jsx("button",{onClick:t,className:"text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-gray-100","aria-label":"Close",disabled:s,children:"×"})]}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"Paste your license key below or upload a key file."}),l.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[l.jsx("input",{id:c,type:"file",accept:".txt,.key,.license,application/octet-stream,text/plain,application/json",onChange:f,className:"hidden",disabled:s}),l.jsx("button",{type:"button",onClick:()=>{var h;return(h=document.getElementById(c))==null?void 0:h.click()},className:"px-3 py-1.5 text-sm rounded bg-gray-200 dark:bg-gray-800 text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-gray-700",disabled:s,children:"Upload Key File"}),l.jsx("span",{className:"text-xs text-gray-500",children:"Accepted: .txt, .key, .license"})]}),l.jsx("textarea",{className:`w-full h-48 p-3 rounded border text-sm font-mono ${a?"border-red-500 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-800 focus:border-blue-500 focus:ring-blue-500"}`,placeholder:"Paste your license key here",value:n,onChange:h=>{o(h.target.value),a&&i("")},disabled:s}),a&&l.jsx("p",{className:"mt-2 text-sm text-red-600",children:a}),l.jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded hover:bg-gray-300 dark:hover:bg-gray-700",disabled:s,children:"Cancel"}),l.jsx("button",{onClick:d,className:`px-4 py-2 text-white rounded ${s?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,disabled:s,children:s?"Updating…":"Update License"})]})]})]})}function I0e({open:e,onClose:t,license:r,onRefresh:n}){var o,a;const[i,s]=m.useState(""),[u,c]=m.useState(!1),[d,f]=m.useState("");if(m.useEffect(()=>{e&&(s(""),c(!1),f(""))},[e]),!e)return null;const h=((o=r?.license)==null?void 0:o.plan)||"unknown",p=r?.license||{},g=r?.features||{},b=((a=r?.usage)==null?void 0:a.features)||{},v=p?.expires_at||null,x=p?.starts_at||null,k=p?.updated_at||null,E=p?.grace_until||null,j=p?.in_grace===!0,S=p?.issuer||null,C=p?.subject||null,O=Object.entries(g||{}),M=U=>{if(!U)return null;const H=new Date(U);return isNaN(H)?U:H.toISOString().slice(0,19).replace("T"," ")},A=async()=>{f("");const U=(i||"").trim();if(!U){f("Please enter a license key.");return}try{c(!0),await n(U),s("")}catch(H){f(sR(H))}finally{c(!1)}},T=new Date,_=v?new Date(v):null,F=E?new Date(E):null,$=_?T>_:!1,I=$&&F?T>F:!1,R=j||$&&F&&T<=F,W=_?T<=_:!1;let B="Unknown",L="",q="bg-gray-400";return I?(B="Expired",L=F?`(grace ended ${M(E)})`:"(grace ended)",q="bg-red-600"):R?(B="In Grace",L=F?`(until ${M(E)})`:"",q="bg-yellow-500"):W&&(B="Active",L=_?`(until ${M(v)})`:"",q="bg-green-600"),l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white dark:bg-gray-950 rounded-lg shadow-xl max-w-3xl w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-gray-50",children:"License Overview"}),l.jsx("button",{onClick:t,className:"text-gray-600 dark:text-gray-300 hover:text-gray-800 dark:hover:text-gray-100","aria-label":"Close",disabled:u,children:"×"})]}),l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4",children:[l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Status"}),l.jsxs("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50 flex items-center",children:[l.jsx("span",{className:`inline-block w-2 h-2 rounded-full mr-2 ${q}`}),B,L&&l.jsx("span",{className:"ml-2 text-xs font-normal text-gray-500",children:L})]})]}),l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Plan"}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:h})]}),l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Issued By"}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:S||"—"})]}),l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500",children:"License Key"}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:C||"—"})]}),l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Last Updated"}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:M(k)||"—"})]}),l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Starts"}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:M(x)||"—"})]}),l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Expires"}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:M(v)||"—"})]}),E&&l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500",children:"Grace Until"}),l.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:M(E)})]})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50 mb-2",children:"Features"}),O.length===0&&l.jsx("p",{className:"text-sm text-gray-500",children:"No features available."}),l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:O.map(([U,H])=>{const X=U.toUpperCase(),Y=b?.[U]||{};return l.jsxs("div",{className:"rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-xs uppercase text-gray-500 mb-1",children:X}),l.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300 space-y-1",children:["effective_enabled"in H&&l.jsxs("p",{children:["Effective enabled: ",String(H.effective_enabled)]}),"effective_limit"in H&&l.jsxs("p",{children:["Effective limit: ",H.effective_limit??"—"]}),"licensed_enabled"in H&&l.jsxs("p",{children:["Licensed enabled: ",String(H.licensed_enabled)]}),"licensed_limit"in H&&l.jsxs("p",{children:["Licensed limit: ",H.licensed_limit??"—"]}),"default_limit"in H&&l.jsxs("p",{children:["Default limit: ",H.default_limit??"—"]}),"unlimited"in H&&l.jsxs("p",{children:["Unlimited: ",String(H.unlimited)]}),("used"in Y||"used"in H)&&l.jsxs("p",{children:["Used: ",Y.used??H.used??0]}),("remaining"in Y||"remaining"in H)&&l.jsxs("p",{children:["Remaining: ",Y.remaining??H.remaining??0]}),("window"in Y||"window"in H)&&l.jsxs("p",{children:["Window: ",Y.window??H.window??"—"]}),("period_start"in Y||"period_start"in H)&&l.jsxs("p",{children:["Period start: ",M(Y.period_start??H.period_start)]})]})]},U)})})]}),l.jsxs("div",{className:"mt-2 rounded border border-gray-200 dark:border-gray-800 p-3",children:[l.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Refresh License"}),l.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Enter a license key to update the license details."}),l.jsxs("div",{className:"mt-2 flex gap-2",children:[l.jsx("input",{type:"text",value:i,onChange:U=>s(U.target.value),placeholder:"INSPECTR-...",className:"flex-1 rounded border border-gray-300 dark:border-gray-800 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:u}),l.jsx("button",{type:"button",onClick:A,className:`px-4 py-2 text-white rounded ${u?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,disabled:u,children:u?"Refreshing…":"Refresh License"})]}),d&&l.jsx("p",{className:"mt-2 text-sm text-red-600",children:d})]})]})]})}const D0e=()=>{var e,t,r,n,o,a,i,s,u,c,d,f,h,p;const{client:g,setToast:b}=Er(),[v,x]=m.useState(null),[k,E]=m.useState(null),[j,S]=m.useState(!0),[C,O]=m.useState(!1),[M,A]=m.useState(""),[T,_]=m.useState(!1),[F,$]=m.useState(!1),[I,R]=m.useState(!1),[W,B]=m.useState(!1),L=y.useCallback(async($e=!1)=>{var ut;try{$e?S(!0):O(!0);let $t=null,St=null;(ut=g?.service)!=null&&ut.getLicense?[$t,St]=await Promise.all([g.service.getMetrics(),g.service.getLicense().catch(()=>null)]):$t=await g.service.getMetrics(),x($t),St&&E(St),A("")}catch($t){console.error("Error fetching metrics:",$t),A($t.message||"Failed to load metrics")}finally{$e?S(!1):O(!1)}},[g]);m.useEffect(()=>{L(!0)},[L]);const q=async $e=>{await g.service.putLicense($e),b?.({message:"License updated",subMessage:"License applied successfully."}),await L(!1)},U=async $e=>{await g.service.putLicense($e),b?.({message:"License refreshed",subMessage:"License updated successfully."}),await L(!1)},H=v?.operations||{},X=((t=(e=v?.generic)==null?void 0:e.totals)==null?void 0:t.sse)||{},Y=((n=(r=v?.generic)==null?void 0:r.totals)==null?void 0:n.mcp)||{},ae=((a=(o=v?.generic)==null?void 0:o.totals)==null?void 0:a.features)||{},te=v?.features||{},me=v?.mcp||{},Q=(()=>{var $e;const ut=($e=k?.features)==null?void 0:$e.mcp;if(ut)return ut.unlimited===!0?!0:typeof ut.effective_limit=="number"?!1:ut.effective_enabled===!0&&typeof ut.default_limit!="number"})(),ue=(()=>{var $e;const ut=($e=k?.features)==null?void 0:$e.mcp;return!ut||ut.unlimited===!0?null:typeof ut.effective_limit=="number"?ut.effective_limit:typeof ut.default_limit=="number"?ut.default_limit:null})(),G=(i=k?.features)==null?void 0:i.mcp,de=(u=(s=k?.usage)==null?void 0:s.features)==null?void 0:u.mcp,ie=(()=>{const $e=de?.window||G?.window;return $e?$e.charAt(0).toUpperCase()+$e.slice(1):null})(),V=(()=>{const $e=de?.period_start||G?.period_start;if(!$e)return null;const ut=new Date($e);return isNaN(ut)?null:ut.toISOString().slice(0,10)})(),ee=(()=>{const $e=de?.period_end||G?.period_end;if(!$e)return null;const ut=new Date($e);return isNaN(ut)?null:ut.toISOString().slice(0,10)})(),ne=typeof de?.used=="number"?de.used:typeof Y.requests=="number"?Y.requests:0,ge=ue?Math.min(100,ne/ue*100):0,Ee=(c=k?.features)==null?void 0:c.rules,Pe=(f=(d=k?.usage)==null?void 0:d.features)==null?void 0:f.rules,Ie=(()=>{const $e=Ee;return!$e||$e.unlimited===!0?null:typeof $e.effective_limit=="number"?$e.effective_limit:typeof $e.default_limit=="number"?$e.default_limit:null})();(()=>{const $e=Pe?.window||Ee?.window;return $e?$e.charAt(0).toUpperCase()+$e.slice(1):null})(),(()=>{const $e=Pe?.period_start||Ee?.period_start;if(!$e)return null;const ut=new Date($e);return isNaN(ut)?null:ut.toISOString().slice(0,10)})(),(()=>{const $e=Pe?.period_end||Ee?.period_end;if(!$e)return null;const ut=new Date($e);return isNaN(ut)?null:ut.toISOString().slice(0,10)})();const nt=((p=(h=v?.generic)==null?void 0:h.totals)==null?void 0:p.rules)||{},Me=v?.rules||{},ot=typeof nt.definitions=="number"?nt.definitions:typeof Me.definitions_total=="number"?Me.definitions_total:0,Ge=Ie?Math.min(100,ot/Ie*100):0,at=(()=>{var $e;const ut=((($e=k?.license)==null?void 0:$e.plan)||"").toString().toLowerCase(),$t=(me?.plan||"").toString().toLowerCase(),St=ut||$t;return St==="pro"||St==="professional"||St==="paid"?"pro":["open_source","open-source","opensource","oss","open source"].includes(St)?"open_source":Q?"pro":"open_source"})(),mt=at==="pro"?"Pro":"Open Source",Ke=at==="pro"?"bg-brand-primary text-gray-900 ":"bg-white dark:bg-gray-800/10 border border-brand-primary text-brand-primary",pt=(()=>{var $e;const ut=($e=v?.meta)==null?void 0:$e.installed_at;if(!ut)return null;const $t=new Date(ut);return isNaN($t)?null:$t.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})})(),jt=at==="open_source"&&ne>0||typeof ue=="number"&&ge>=90,Ze=at==="open_source"&&ot>0||typeof Ie=="number"&&Ge>=90;return m.useEffect(()=>{v&&_(jt)},[jt,v]),m.useEffect(()=>{v&&$(Ze)},[Ze,v]),j?l.jsxs(At,{className:"p-6",children:[l.jsx(Kn,{children:"Usage Overview"}),l.jsx(gt,{className:"mt-2",children:"Loading usage…"})]}):M?l.jsxs(At,{className:"p-6",children:[l.jsx(Kn,{children:"Usage Overview"}),l.jsxs(gt,{className:"mt-2 text-red-600 dark:text-red-400",children:["Error loading metrics: ",M]})]}):l.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[l.jsx("header",{children:l.jsxs("div",{className:"sm:flex sm:items-center sm:justify-between",children:[l.jsx("h3",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Usage Overview"}),l.jsx("div",{className:"mt-2 sm:mt-0",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(du,{onClick:()=>B(!0),children:"License Details"}),l.jsx(du,{onClick:()=>R(!0),children:"Update License"}),l.jsx(du,{onClick:()=>L(!1),children:C?"Loading":"Refresh"})]})})]})}),l.jsxs("div",{className:"rounded-lg bg-gray-200 p-6 ring-1 ring-inset ring-gray-200 dark:bg-gray-400/10 dark:ring-gray-800",children:[l.jsxs("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:["This workspace is currently on"," ",l.jsx("span",{className:`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium ${Ke}`,children:mt})]}),l.jsxs("p",{className:"mt-1 max-w-2xl text-sm leading-6 text-gray-500",children:[at==="pro"?"You're on Pro — enjoy premium features and priority support.":"Boost your analytics and unlock advanced features with our premium plans.",l.jsxs("a",{href:"https://inspectr.dev/pricing",target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-center gap-1 text-indigo-600 dark:text-indigo-500",children:[at==="pro"?"Explore features":"Compare plans",l.jsx("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor","aria-hidden":"true",className:"remixicon size-4 shrink-0",children:l.jsx("path",{d:"M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z"})})]})]})]}),pt&&l.jsxs(gt,{className:"-mt-2 text-sm text-gray-500",children:["Usage metrics since ",pt]}),l.jsx(_0e,{open:I,onClose:()=>R(!1),onSubmit:q}),l.jsx(I0e,{open:W,onClose:()=>B(!1),license:k,onRefresh:U}),l.jsxs(At,{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("img",{src:CA,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),l.jsx(Kn,{className:"!mb-0",children:"Operations"})]}),l.jsx(gt,{className:"mt-1 text-gray-500",children:"Metrics on requests, responses, and events handled by Inspectr."}),l.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-4",children:[l.jsxs("div",{children:[l.jsx(gt,{children:"Total requests"}),l.jsx(ni,{children:H.total_requests??(H.requests_local??0)+(H.requests_ingress??0)}),l.jsx("div",{className:"mt-3",children:l.jsx(Zl,{data:[{name:"proxy",value:H.requests_local??0,color:"cyan"},{name:"ingress",value:H.requests_ingress??0,color:"yellow"}]})})]}),l.jsxs("div",{children:[l.jsx(gt,{children:"Total responses"}),l.jsx(ni,{children:H.total_responses??(H.responses_local??0)+(H.responses_ingress??0)}),l.jsx("div",{className:"mt-3",children:l.jsx(Zl,{data:[{name:"proxy",value:H.responses_local??0,color:"cyan"},{name:"ingress",value:H.responses_ingress??0,color:"yellow"}]})})]}),l.jsxs("div",{children:[l.jsx(gt,{children:"Event frames"}),l.jsx(ni,{children:H.total_event_frames??(H.event_frames_local??0)+(H.event_frames_ingress??0)}),l.jsx("div",{className:"mt-3",children:l.jsx(Zl,{data:[{name:"proxy",value:H.event_frames_local??0,color:"cyan"},{name:"ingress",value:H.event_frames_ingress??0,color:"yellow"}]})})]})]})]}),l.jsxs(At,{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("img",{src:CA,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),l.jsx(Kn,{className:"!mb-0",children:"Features"})]}),l.jsx(gt,{className:"mt-1 text-gray-500",children:"Usage metrics for core Inspectr features."}),l.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Registrations"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:ae.registrations??te.registration_requests??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Token refresh"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:ae.token_refresh??te.token_refresh_requests??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Launches"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:ae.launches??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Ingress registrations"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:ae.ingress_registrations??0})]})]})]}),l.jsxs(At,{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("img",{src:C0e,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),l.jsx(Kn,{className:"!mb-0",children:"Inspectr Connections"})]}),l.jsx(gt,{className:"mt-1 text-gray-500",children:"Overview of metrics related to the Inspectr App SSE connections to Inspectr."}),l.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Active connections"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:X.active??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Reconnect attempts"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:X.reconnect_attempts??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total connections"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:X.total_connections??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total disconnections"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:X.total_disconnections??0})]})]})]}),l.jsxs(At,{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("img",{src:iR,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),l.jsx(Kn,{className:"!mb-0",children:"Rules"})]}),l.jsx(gt,{className:"mt-1 text-gray-500",children:"Overview of Rules definitions and actions usage."}),F&&Ze&&l.jsxs("div",{className:"mt-4 rounded-md bg-gray-50 p-6 ring-1 ring-inset ring-gray-200 dark:bg-gray-900 dark:ring-gray-800",children:[l.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Want more rules?"}),l.jsx("p",{className:"mt-2 text-sm/6 text-gray-500 dark:text-gray-500",children:"Elevate your workspace and boost productivity with premium features. See our pro plans and upgrade today."}),l.jsxs("div",{className:"mt-6 flex items-center space-x-2",children:[l.jsx("a",{href:"https://inspectr.dev/pricing",target:"_blank",rel:"noreferrer noopener",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-yellow-500 dark:outline-blue-500 border-transparent text-white dark:text-white bg-yellow-500 dark:bg-yellow-500 hover:bg-yellow-600 dark:hover:bg-yellow-600 disabled:bg-blue-300 disabled:text-white disabled:dark:bg-blue-800 disabled:dark:text-blue-400",children:"Discover Plans"}),l.jsx("button",{type:"button",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 disabled:dark:text-gray-600",onClick:()=>$(!1),children:"Dismiss"})]})]}),Ie!==null&&l.jsxs("div",{className:"mt-6",children:[l.jsx(gt,{className:"mb-2",children:"Definitions usage"}),l.jsx(oj,{value:Ge,color:"indigo"}),l.jsxs(gt,{className:"mt-2",children:[ot," of ",Ie," rules defined"]})]}),l.jsxs("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Rules executed"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:nt.actions_executed??Me.actions_executed??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Actions triggered"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:nt.actions_triggered??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Historically operations processed"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:nt.apply_processed??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Historically operations updated"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:nt.apply_updated??0})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong mb-2",children:"Actions by type"}),l.jsx(Zl,{data:Object.entries(Me.actions_by_type||{}).map(([$e,ut])=>({name:$e,value:ut}))})]})]})]}),l.jsxs(At,{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("img",{src:P0e,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),l.jsx(Kn,{className:"!mb-0",children:"Inspectr MCP Server"})]}),l.jsx(gt,{className:"mt-1 text-gray-500",children:"Overview of Model Context Protocol (MCP) activity on the Inspectr MCP server, including usage across tools, resources, and prompts."}),T&&jt&&l.jsxs("div",{className:"mt-4 rounded-md bg-gray-50 p-6 ring-1 ring-inset ring-gray-200 dark:bg-gray-900 dark:ring-gray-800",children:[l.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Want to upgrade?"}),l.jsx("p",{className:"mt-2 text-sm/6 text-gray-500 dark:text-gray-500",children:"Elevate your workspace and boost productivity with premium features. See our pro plans and upgrade today."}),l.jsxs("div",{className:"mt-6 flex items-center space-x-2",children:[l.jsx("a",{href:"https://inspectr.dev/pricing",target:"_blank",rel:"noreferrer noopener",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-yellow-500 dark:outline-yellow-500 border-transparent text-white dark:text-white bg-yellow-500 dark:bg-yellow-500 hover:bg-yellow-600 dark:hover:bg-yellow-600 disabled:bg-blue-300 disabled:text-white disabled:dark:bg-blue-800 disabled:dark:text-blue-400",children:"Explore Plans"}),l.jsx("button",{type:"button",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-gray-300 dark:border-gray-800 text-gray-900 dark:text-gray-50 bg-white dark:bg-gray-950 hover:bg-gray-50 dark:hover:bg-gray-900/60 disabled:text-gray-400 disabled:dark:text-gray-600",onClick:()=>_(!1),children:"Dismiss"})]})]}),ue&&l.jsxs("div",{className:"mt-6",children:[l.jsx(gt,{className:"mb-2",children:"Remaining usage"}),l.jsx(oj,{value:ge,color:"blue"}),l.jsxs(gt,{className:"mt-2",children:[ne," of ",ue," uses"]}),(ie||V||ee)&&l.jsxs(gt,{className:"mt-1 text-gray-500",children:[ie?`${ie} window`:"Usage window",V?` since ${V}`:"",ee?` — resets on ${ee}`:""]})]}),l.jsxs("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-2 gap-6",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[l.jsx("h4",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Usage"}),l.jsxs("div",{children:[l.jsxs("p",{className:"flex items-center text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:[l.jsx("img",{src:A0e,width:16,height:16,alt:"","aria-hidden":"true",className:"w-4 h-4 mr-2"}),"Total tools"]}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Y.tools??0})]}),l.jsxs("div",{children:[l.jsxs("p",{className:"flex items-center text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:[l.jsx("img",{src:T0e,width:16,height:16,alt:"","aria-hidden":"true",className:"w-4 h-4 mr-2"}),"Total resources"]}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Y.resources??0})]}),l.jsxs("div",{children:[l.jsxs("p",{className:"flex items-center text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:[l.jsx("img",{src:M0e,width:16,height:16,alt:"","aria-hidden":"true",className:"w-4 h-4 mr-2"}),"Total prompts"]}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Y.prompts??0})]})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[l.jsx("h4",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Traffic"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total requests"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Y.requests??0})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:"Total responses"}),l.jsx("p",{className:"font-semibold text-tremor-metric text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Y.responses??0})]})]})]})]})]})};function L0e(...e){return e.filter(Boolean).join(" ")}function R0e({overall:e}){if(!e)return l.jsx("div",{children:"Loading KPI..."});const t=[{name:"Total Requests",stat:e.total_requests,change:"",changeType:"neutral"},{name:"Average Response Time",stat:`${e.average_response_time} ms`,change:"",changeType:"neutral"},{name:"Success Rate",stat:`${(e.success_rate*100).toFixed(1)}%`,change:"",changeType:"neutral"},{name:"Error Rate",stat:`${(e.error_rate*100).toFixed(1)}%`,change:"",changeType:"neutral"}],r=t.length;return l.jsx("dl",{className:`grid grid-cols-1 gap-${r} sm:grid-cols-2 lg:grid-cols-${r}`,children:t.map(n=>l.jsxs(At,{children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("dt",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:n.name}),n.change&&l.jsx("span",{className:L0e(n.changeType==="positive"?"bg-emerald-100 text-emerald-800 ring-emerald-600/10 dark:bg-emerald-400/10 dark:text-emerald-500 dark:ring-emerald-400/20":"bg-red-100 text-red-800 ring-red-600/10 dark:bg-red-400/10 dark:text-red-500 dark:ring-red-400/20","inline-flex items-center rounded-tremor-small px-2 py-1 text-tremor-label font-medium ring-1 ring-inset"),children:n.change})]}),l.jsx("dd",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:n.stat})]},n.name))})}function F0e(...e){return e.filter(Boolean).join(" ")}function $0e({title:e="Traffic Volume",data:t,valueFormatter:r}){const n=Array.isArray(t)?t:[],o=n.reduce((s,u)=>(s["2xx"]+=u["2xx"]||0,s["3xx"]+=u["3xx"]||0,s["4xx"]+=u["4xx"]||0,s["5xx"]+=u["5xx"]||0,s),{"2xx":0,"3xx":0,"4xx":0,"5xx":0}),a=r||(s=>Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(s)),i=[{name:"2xx",value:o["2xx"],color:"bg-blue-500"},{name:"3xx",value:o["3xx"],color:"bg-orange-500"},{name:"4xx",value:o["4xx"],color:"bg-cyan-500"},{name:"5xx",value:o["5xx"],color:"bg-red-500"}];return l.jsxs(At,{className:"mt-4 h-120 rounded-tremor-small p-2",children:[l.jsx("h3",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),l.jsx("ul",{role:"list",className:"mt-6 grid gap-3 sm:grid-cols-4 md:grid-cols-4",children:i.map(s=>l.jsxs("li",{className:"rounded-tremor-small border border-tremor-border px-3 py-2 text-left dark:border-dark-tremor-border",children:[l.jsxs("div",{className:"flex items-center space-x-1.5",children:[l.jsx("span",{className:F0e(s.color,"size-2.5 rounded-sm"),"aria-hidden":"true"}),l.jsx("p",{className:"text-tremor-label text-tremor-content dark:text-dark-tremor-content",children:s.name})]}),l.jsx("p",{className:"mt-0.5 font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:a(s.value)})]},s.name))}),l.jsx(kh,{data:n,index:"date",categories:["2xx","3xx","4xx","5xx"],colors:["blue","orange","cyan","red"],showLegend:!1,valueFormatter:a,yAxisWidth:50,stack:!0,className:"mt-6 hidden h-80 w-full sm:block"}),l.jsx(kh,{data:n,index:"date",categories:["2xx","3xx","4xx","5xx"],colors:["blue","orange","cyan","red"],showLegend:!1,valueFormatter:a,showYAxis:!1,stack:!0,className:"mt-6 h-48 w-full sm:hidden"})]})}function B0e(e,t){return t==="ms"?`${Math.round(e)}`:new Intl.NumberFormat("en-US",{maximumFractionDigits:0,notation:"compact",compactDisplay:"short"}).format(e)}function lp({title:e="Response Times",data:t,metricKey:r=[],metricUnit:n="",highlightValue:o="",highlightLabel:a=""}){const i=Array.isArray(r)?r:[r],s=u=>B0e(u,n);return l.jsxs(At,{className:"mt-4 h-120 rounded-tremor-small p-2",children:[l.jsx("h3",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),l.jsxs("div",{className:"p-6",children:[l.jsx("p",{className:"text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:a}),l.jsxs("p",{className:"text-2xl font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[o,n?` ${n}`:""]}),l.jsx(df,{data:t,index:"date",categories:i,showGradient:!1,valueFormatter:s,className:"mt-8 hidden h-80 w-full sm:block"}),l.jsx(df,{data:t,index:"date",categories:i,showGradient:!1,valueFormatter:s,className:"mt-8 h-48 w-full sm:hidden"})]})]})}function z0e(...e){return e.filter(Boolean).join(" ")}function Eb({className:e=""}){return l.jsx("div",{className:z0e("flex items-center justify-center w-full h-full border border-dashed rounded-tremor-default border-tremor-border dark:border-dark-tremor-border",e),children:l.jsx("p",{className:"text-tremor-content text-tremor-default dark:text-dark-tremor-content",children:"No data"})})}const H0e=e=>`${Intl.NumberFormat("us").format(e).toString()}`;function Di({title:e,data:t,toggleable:r=!0}){const[n,o]=m.useState(!0),a=r?n:!0,i=t?t.map(u=>({name:u.p95_response_time!=null?`${u.path} (P95: ${u.p95_response_time} ms)`:u.path,value:u.count})):[],s=i.length>0;return l.jsxs(At,{className:"mt-4 rounded-tremor-small p-2",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-tremor-border p-3 dark:border-dark-tremor-border",children:[l.jsx("p",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),l.jsx("p",{className:"text-tremor-label font-medium uppercase text-tremor-content dark:text-dark-tremor-content",children:"Totals"})]}),l.jsx("div",{className:`overflow-hidden p-6 ${a?"":"max-h-[260px]"}`,children:s?l.jsx(Zl,{data:i,valueFormatter:H0e}):l.jsx(Eb,{className:"min-h-[150px]"})}),r&&s&&l.jsx("div",{className:`flex justify-center ${n?"px-6 pb-6":"absolute inset-x-0 bottom-0 rounded-b-tremor-default bg-gradient-to-t from-tremor-background to-transparent py-7 dark:from-dark-tremor-background"}`,children:l.jsx("button",{className:"flex items-center justify-center rounded-tremor-small border border-tremor-border bg-tremor-background px-2.5 py-2 text-tremor-default font-medium text-tremor-content-strong shadow-tremor-input hover:bg-tremor-background-muted dark:border-dark-tremor-border dark:bg-dark-tremor-background dark:text-dark-tremor-content-strong dark:shadow-dark-tremor-input hover:dark:bg-dark-tremor-background-muted",onClick:()=>o(!n),children:n?"Show less":"Show more"})})]})}function q0e(...e){return e.filter(Boolean).join(" ")}function Rl({title:e="Donut Chart",description:t="",data:r,valueFormatter:n,colors:o}){const a=["bg-blue-500","bg-violet-500","bg-fuchsia-500","bg-emerald-500","bg-sky-500"],i=o||["blue","violet","fuchsia","emerald","sky"],s=n||(c=>`${c}`);let u=[];if(Array.isArray(r))u=r;else if(r&&typeof r=="object"){const c=Object.entries(r),d=c.reduce((f,[,h])=>f+h,0);u=c.map(([f,h],p)=>({name:f,amount:h,share:d>0?`${(h/d*100).toFixed(1)}%`:"0%",borderColor:a[p%a.length]}))}return l.jsxs(At,{className:"mt-4 h-120 rounded-tremor-small p-2",children:[l.jsx("h3",{className:"text-tremor-default font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),t&&l.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:t}),l.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-0 sm:grid-cols-2 sm:gap-8",children:[l.jsx(dD,{data:u,category:"amount",index:"name",valueFormatter:s,showTooltip:!0,className:"h-40 w-full",colors:i}),l.jsx("div",{className:"mt-6 flex items-center sm:mt-0",children:l.jsx("ul",{role:"list",className:"space-y-3",children:u.map(c=>l.jsxs("li",{className:"flex space-x-3",children:[l.jsx("span",{className:q0e(c.borderColor,"w-1 shrink-0 rounded")}),l.jsxs("div",{children:[l.jsxs("p",{className:"text-tremor-default font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[s(c.amount)," ",l.jsxs("span",{className:"font-normal",children:["(",c.share,")"]})]}),l.jsx("p",{className:"mt-0.5 whitespace-nowrap text-tremor-default text-tremor-content dark:text-dark-tremor-content",children:c.name})]})]},c.name))})})]})]})}const U0e=({open:e,onClose:t,onConfirm:r,title:n="Clear All",message:o="Are you sure you want to clear all? This action cannot be undone.",confirmButtonText:a="Clear All"})=>e?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsx("div",{className:"flex-shrink-0 bg-red-100 rounded-full p-2",children:l.jsx("svg",{className:"size-6 text-red-600",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})})}),l.jsxs("div",{className:"ml-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:n}),l.jsx("p",{className:"mt-2 text-sm text-gray-500",children:o})]})]}),l.jsxs("div",{className:"mt-6 flex justify-end space-x-3",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 rounded hover:bg-gray-300 text-sm",children:"Cancel"}),l.jsx("button",{onClick:()=>{r(),t()},className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 text-sm",children:a})]})]})]}):null;function PA(e){return e==null||Number.isNaN(e)?"":`${Math.round(e)}`}function V0e({active:e,label:t,onClick:r}){return l.jsx("button",{type:"button",onClick:r,className:["px-2 py-1 text-xs rounded border",e?"bg-tremor-brand text-tremor-brand-inverted dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted border-transparent":"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-200 border-gray-300 dark:border-gray-600 hover:bg-gray-200 dark:hover:bg-gray-600"].join(" "),children:t})}function W0e({title:e="HTTP Request duration: p50, p90, p95, p99",data:t=[]}){const r=["p50","p90","p95","p99"],n=m.useMemo(()=>{if(!Array.isArray(t))return[];const f=new Set;for(const h of t)for(const p of r)h&&typeof h[p]=="number"&&f.add(p);return r.filter(h=>f.has(h))},[t]),[o,a]=m.useState(new Set(r));m.useEffect(()=>{a(f=>{const h=new Set([...f].filter(p=>n.includes(p)));return h.size===0?new Set(n):(n.forEach(p=>h.add(p)),h)})},[n]);const i=f=>{a(h=>{const p=new Set(h);return p.has(f)?p.delete(f):p.add(f),p})},s={p50:"blue",p90:"violet",p95:"cyan",p99:"rose"},u=m.useMemo(()=>n.filter(f=>o.has(f)),[n,o]),c=m.useMemo(()=>u.map(f=>s[f]),[u]),d=Array.isArray(t)&&t.length>0&&n.length>0;return l.jsxs(At,{className:"mt-4 rounded-tremor-small p-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h3",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),l.jsx("div",{className:"flex gap-2",children:r.map(f=>l.jsx(V0e,{label:f.toUpperCase(),active:o.has(f),onClick:()=>i(f)},f))})]}),l.jsxs("div",{className:"p-6",children:[d?u.length===0?l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"No percentile selected. Toggle one or more options above."}):l.jsxs(l.Fragment,{children:[l.jsx(df,{data:t,index:"date",categories:u,colors:c,showGradient:!1,valueFormatter:PA,className:"mt-4 hidden h-80 w-full sm:block"}),l.jsx(df,{data:t,index:"date",categories:u,colors:c,showGradient:!1,valueFormatter:PA,className:"mt-4 h-48 w-full sm:hidden"})]}):l.jsx(Eb,{className:"h-40"}),d?l.jsx("p",{className:"mt-3 text-xs text-gray-500 dark:text-gray-400",children:"Values in milliseconds"}):null]})]})}function Jc(...e){return e.filter(Boolean).join(" ")}function up({tags:e=[],selectedTag:t,onSelect:r,disabled:n=!1,loading:o=!1,error:a,fullWidth:i=!1}){const[s,u]=m.useState(!1),c=m.useRef(null),d=m.useRef(null),f=!!t;m.useEffect(()=>{if(!s)return;const v=k=>{!d.current||!c.current||d.current.contains(k.target)||c.current.contains(k.target)||u(!1)},x=k=>{var E;k.key==="Escape"&&(u(!1),(E=c.current)==null||E.focus())};return document.addEventListener("mousedown",v),document.addEventListener("touchstart",v),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("touchstart",v),document.removeEventListener("keydown",x)}},[s]);const h=()=>{n||u(v=>!v)},p=()=>u(!1),g=v=>{n||(r?.(v),p())},b="tag-filter-dropdown-label";return l.jsxs("div",{className:Jc("relative inline-block text-left",i?"w-full":""),children:[l.jsxs("button",{type:"button",ref:c,onClick:h,onKeyDown:v=>{v.key==="ArrowDown"&&!s&&(v.preventDefault(),u(!0))},disabled:n,"aria-haspopup":"menu","aria-expanded":s,"aria-labelledby":b,className:Jc("inline-flex items-center gap-2 rounded-tremor-small border border-tremor-border bg-tremor-background px-3 py-2 text-sm font-medium text-tremor-content-strong shadow-tremor-input transition focus:z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand/60 min-h-[42px]",i?"w-full justify-start":"","hover:bg-tremor-background-subtle disabled:cursor-not-allowed disabled:opacity-70","dark:border-dark-tremor-border dark:bg-gray-950 dark:text-dark-tremor-content-strong dark:shadow-dark-tremor-input dark:hover:bg-gray-950/60"),children:[l.jsx("span",{id:b,className:"sr-only",children:"Filter statistics by tag"}),l.jsx(mF,{className:"h-4 w-4","aria-hidden":!0}),f?l.jsx(cl,{tag:t}):l.jsx("span",{className:"text-xs uppercase tracking-wide",children:"All tags"})]}),s?l.jsxs("div",{ref:d,role:"menu","aria-orientation":"vertical","aria-labelledby":b,className:Jc("absolute z-50 mt-2 w-64 rounded-md border border-tremor-border bg-tremor-background p-2 shadow-xl shadow-black/[2.5%] focus:outline-none dark:border-dark-tremor-border dark:bg-gray-950",i?"left-0 right-auto origin-top-left":"right-0 origin-top-right"),children:[l.jsx("div",{className:"px-2 pb-2 text-xs font-semibold uppercase tracking-wide text-tremor-content dark:text-dark-tremor-content",children:"Select a tag"}),l.jsxs("div",{className:"max-h-60 overflow-y-auto",children:[l.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":!f,onClick:()=>g(null),className:Jc("flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition","text-gray-500 hover:bg-tremor-background-subtle focus:outline-none focus-visible:bg-tremor-background-subtle dark:text-gray-400 dark:hover:bg-dark-tremor-background dark:focus-visible:bg-dark-tremor-background",f?"":"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong"),children:[l.jsx("span",{className:"text-xs font-medium uppercase tracking-wide",children:"All tags"}),f?null:l.jsx(W1,{className:"ml-auto h-4 w-4 text-tremor-brand dark:text-dark-tremor-brand","aria-hidden":!0})]}),l.jsx("div",{className:"my-2 h-px bg-tremor-border dark:bg-dark-tremor-border"}),o?l.jsx("div",{className:"px-2 py-4 text-center text-xs text-gray-500 dark:text-gray-400",children:"Loading tags…"}):e.length===0?l.jsx("div",{className:"px-2 py-4 text-center text-xs text-gray-500 dark:text-gray-400",children:a||"No tags available"}):e.map(v=>{const x=t===v;return l.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":x,onClick:()=>g(v),className:Jc("flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm transition","text-tremor-content-strong hover:bg-tremor-background-subtle focus:outline-none focus-visible:bg-tremor-background-subtle dark:text-dark-tremor-content-strong dark:hover:bg-dark-tremor-background dark:focus-visible:bg-dark-tremor-background",x?"font-semibold":""),children:[l.jsx(cl,{tag:v}),x?l.jsx(W1,{className:"ml-auto h-4 w-4 text-tremor-brand dark:text-dark-tremor-brand","aria-hidden":!0}):null]},v)})]})]}):null]})}const lR=(e,t=0,r=0,n=0,o=0)=>new Date(e.getFullYear(),e.getMonth(),e.getDate(),t,r,n,o),Nb=e=>!(e instanceof Date)||Number.isNaN(e.getTime())?new Date(0).toISOString():lR(e).toISOString(),Sb=e=>!(e instanceof Date)||Number.isNaN(e.getTime())?new Date(0).toISOString():lR(e,23,59,59,999).toISOString(),Qc=(e,t,r)=>{const n=Nb(t),o=Sb(r);return{label:e,start:n,end:o,tooltip:`${n} – ${o}`}},uR=(e=new Date)=>{const t=e instanceof Date?new Date(e):new Date,r=t;return new Date(r.getTime()-60*60*1e3),[Qc("Today",t,t),Qc("7D",new Date(t.getTime()-7*24*60*60*1e3),t),Qc("30D",new Date(t.getTime()-30*24*60*60*1e3),t),Qc("3M",new Date(t.getUTCFullYear(),t.getUTCMonth()-3,t.getUTCDate()),t),Qc("6M",new Date(t.getUTCFullYear(),t.getUTCMonth()-6,t.getUTCDate()),t)]},x1=(e,t=new Date)=>e&&uR(t).find(r=>r.label===e)||null,AA=(...e)=>e.filter(Boolean).join(" ");function k1({selectedRange:e,onSelect:t,onCustomClick:r,referenceDate:n}){const o=m.useMemo(()=>uR(n),[n]);return l.jsxs("div",{className:"inline-flex items-center rounded shadow",children:[o.map((a,i)=>l.jsx("button",{onClick:()=>t?.(a),title:a.tooltip,type:"button",className:AA(i===0?"rounded-l":i===o.length-1?"-ml-px rounded-r":"-ml-px","border px-3 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand/60",e===a.label?"bg-tremor-brand text-tremor-brand-inverted dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted":"bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"),children:a.label},a.label)),l.jsx("button",{onClick:r,title:"Set custom date range",type:"button",className:AA("-ml-px rounded-r","border px-3 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand/60",e==="Custom"?"bg-tremor-brand text-tremor-brand-inverted dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted":"bg-gray-100 text-gray-600 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"),children:"Custom"})]})}const Vm=e=>{const t=Number(e);return Number.isNaN(t)?"0":Intl.NumberFormat("us").format(t)};function K0e({total:e}){const t=[{name:"Total MCP Requests",stat:Vm(e?.count)},{name:"Request Tokens",stat:Vm(e?.request_tokens)},{name:"Response Tokens",stat:Vm(e?.response_tokens)},{name:"Total Tokens",stat:Vm(e?.total_tokens)}];return l.jsx("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:t.map(r=>l.jsxs(At,{children:[l.jsx("div",{className:"flex items-center justify-between",children:l.jsx("dt",{className:"text-tremor-default font-medium text-tremor-content dark:text-dark-tremor-content",children:r.name})}),l.jsx("dd",{className:"text-tremor-metric font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:r.stat})]},r.name))})}const cR=e=>{const t=Number(e);return Number.isNaN(t)?"0":Intl.NumberFormat("us").format(t)},Y0e=e=>`${cR(e)}`;function Fl({title:e,items:t}){const r=Array.isArray(t)?t.map(o=>{const a=o.totalTokens!=null?` (${cR(o.totalTokens)} tokens)`:"";return{name:`${o.name}${a}`,value:o.count??0}}):[],n=r.length>0;return l.jsxs(At,{className:"mt-4 rounded-tremor-small p-2",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-tremor-border p-3 dark:border-dark-tremor-border",children:[l.jsx("p",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),l.jsx("p",{className:"text-tremor-label font-medium uppercase text-tremor-content dark:text-dark-tremor-content",children:"Count"})]}),l.jsx("div",{className:"overflow-hidden p-6",children:n?l.jsx(Zl,{data:r,valueFormatter:Y0e}):l.jsx(Eb,{className:"min-h-[150px]"})})]})}function TA(e){return new Date(e).toLocaleString("en-GB",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function w1(e){return new Date(e).toLocaleString("en-GB",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function Bk(e){return Array.isArray(e)?e.map(t=>{const r={...t,date:w1(t.date)};return t.median_response_time!=null&&(r.p50=t.median_response_time),t.p90_response_time!=null&&(r.p90=t.p90_response_time),t.p95_response_time!=null&&(r.p95=t.p95_response_time),t.p99_response_time!=null&&(r.p99=t.p99_response_time),r}):[]}function G0e(e){const t={};return Array.isArray(e)&&e.forEach(r=>{const n=r?.series;!n||typeof n!="object"||Object.entries(n).forEach(([o,a])=>{const i=typeof a=="number"?a:a?.count;if(i==null)return;const s=Number(i);Number.isNaN(s)||(t[o]=(t[o]??0)+s)})}),t}const dR=e=>{const t=Number(e);return Number.isNaN(t)?"0":Intl.NumberFormat("us").format(t)};function X0e({tag:e}){return e?l.jsx(cl,{tag:e}):l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:"All operations"})}function fR(e,t,{includeTopMargin:r=!0,layout:n="overview"}={}){var o,a,i,s,u,c,d,f,h,p,g,b,v,x,k,E,j;const S=n==="compare",C="mt-6 grid grid-cols-1 gap-4";return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:r?"mt-6":"",children:l.jsx(R0e,{overall:e?.overall})}),l.jsxs("div",{className:S?C:"mt-6 grid grid-cols-2 gap-4 md:grid-cols-2 lg:grid-cols-2",children:[l.jsx($0e,{title:"Traffic Volume",data:t}),l.jsx(lp,{title:"Average Response Times",data:t,metricKey:["min_response_time","average_response_time","max_response_time"],metricUnit:"ms",highlightValue:(o=e?.overall)==null?void 0:o.average_response_time,highlightLabel:"Average Response Time"})]}),l.jsx("div",{className:"mt-6 grid grid-cols-1",children:l.jsx(W0e,{title:"HTTP Request duration: p50, p90, p95, p99",data:t})}),S?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:C,children:[l.jsx(lp,{title:"Success / Error Rate",data:t,metricKey:["success","errors"],metricUnit:"",highlightValue:(a=e?.overall)==null?void 0:a.average_errors,highlightLabel:"Average Errors"}),l.jsx(Di,{title:"Top Endpoints",data:(i=e?.top_endpoints)==null?void 0:i.all,toggleable:!1})]}),l.jsxs("div",{className:C,children:[l.jsx(Rl,{title:"Method Ratio",description:"Distribution of HTTP methods",data:(s=e?.totals)==null?void 0:s.method}),l.jsx(Rl,{title:"Protocol Ratio",description:"Distribution of protocols",data:(u=e?.totals)==null?void 0:u.protocol}),l.jsx(Rl,{title:"Status Ratio",description:"Distribution of HTTP status codes",data:(c=e?.totals)==null?void 0:c.status}),l.jsx(Di,{title:"Top Failed Endpoints",data:(d=e?.top_endpoints)==null?void 0:d.error,toggleable:!1})]}),l.jsxs("div",{className:C,children:[l.jsx(Di,{title:"Top Fastest Endpoints (P95)",data:(f=e?.top_endpoints)==null?void 0:f.fastest,toggleable:!1}),l.jsx(Di,{title:"Top Slowest Endpoints (P95)",data:(h=e?.top_endpoints)==null?void 0:h.slowest,toggleable:!1})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mt-6 grid grid-cols-3 gap-4 items-stretch",children:[l.jsx("div",{className:"col-span-2",children:l.jsx(lp,{title:"Success / Error Rate",data:t,metricKey:["success","errors"],metricUnit:"",highlightValue:(p=e?.overall)==null?void 0:p.average_errors,highlightLabel:"Average Errors"})}),l.jsx("div",{className:"col-span-1",children:l.jsx(Di,{title:"Top Endpoints",data:(g=e?.top_endpoints)==null?void 0:g.all,toggleable:!1})})]}),l.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-4 lg:grid-cols-4",children:[l.jsx(Rl,{title:"Method Ratio",description:"Distribution of HTTP methods",data:(b=e?.totals)==null?void 0:b.method}),l.jsx(Rl,{title:"Protocol Ratio",description:"Distribution of protocols",data:(v=e?.totals)==null?void 0:v.protocol}),l.jsx(Rl,{title:"Status Ratio",description:"Distribution of HTTP status codes",data:(x=e?.totals)==null?void 0:x.status}),l.jsx(Di,{title:"Top Failed Endpoints",data:(k=e?.top_endpoints)==null?void 0:k.error,toggleable:!1})]}),l.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-4 md:grid-cols-2 lg:grid-cols-2",children:[l.jsx(Di,{title:"Top Fastest Endpoints (P95)",data:(E=e?.top_endpoints)==null?void 0:E.fastest,toggleable:!1}),l.jsx(Di,{title:"Top Slowest Endpoints (P95)",data:(j=e?.top_endpoints)==null?void 0:j.slowest,toggleable:!1})]})]})]})}function $l(e,t=10){return!e||typeof e!="object"?[]:Object.entries(e).map(([r,n])=>{const o=Number(n?.count??0),a=Number(n?.request_tokens??0),i=Number(n?.response_tokens??0),s=n?.total_tokens!=null?Number(n.total_tokens):a+i;return{name:r,count:o,totalTokens:s}}).sort((r,n)=>n.count-r.count).slice(0,t)}function zk(e,t=5){const r=Array.isArray(e)?e:[];if(!r.length)return{data:[],keys:[],topLabel:""};const n=new Map;r.forEach(u=>{const c=u?.series;!c||typeof c!="object"||Object.entries(c).forEach(([d,f])=>{const h=Number(f?.count??0);n.set(d,(n.get(d)??0)+h)})});const o=[...n.entries()].sort((u,c)=>c[1]-u[1]).slice(0,t),a=o.map(([u])=>u),i=o[0],s=i?`${i[0]} (${dR(i[1])})`:"";return{data:r.map(u=>{const c={date:w1(u.timestamp)};return a.forEach(d=>{var f,h;c[d]=Number(((h=(f=u?.series)==null?void 0:f[d])==null?void 0:h.count)??0)}),c}),keys:a,topLabel:s}}function Wm({title:e,data:t,keys:r,highlightLabel:n,highlightValue:o}){return!Array.isArray(t)||t.length===0||!Array.isArray(r)||r.length===0?l.jsxs(At,{className:"mt-4 rounded-tremor-small p-2",children:[l.jsx("h3",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),l.jsx("div",{className:"p-6",children:l.jsx(Eb,{className:"min-h-[180px]"})})]}):l.jsx(lp,{title:e,data:t,metricKey:r,metricUnit:"",highlightLabel:n,highlightValue:o})}function MA({label:e,tag:t,stats:r,intervalData:n,loading:o}){const a=!!r;return l.jsxs("div",{className:"rounded-tremor-small border border-tremor-border bg-tremor-background p-4 shadow-sm dark:border-dark-tremor-border dark:bg-gray-950",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e}),l.jsx("div",{className:"mt-1",children:l.jsx(X0e,{tag:t})})]}),o?l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Loading…"}):null]}),a?l.jsx("div",{className:"mt-4",children:fR(r,n,{includeTopMargin:!1,layout:"compare"})}):l.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-400",children:o?"Loading statistics…":"No data available for this selection."})]})}function Z0e({route:e}){var t;const{client:r}=Er();Na("feat_statistics_compare",!1,!0);const[n,o]=m.useState(null),[a,i]=m.useState(!1),[s,u]=m.useState(null),[c,d]=m.useState("hour"),[f,h]=m.useState([]),[p,g]=m.useState(!1),[b,v]=m.useState(""),[x,k]=m.useState(null),[E,j]=m.useState("overview"),[S,C]=m.useState(null),[O,M]=m.useState(void 0),[A,T]=m.useState(null),[_,F]=m.useState(null),[$,I]=m.useState(!1),[R,W]=m.useState(null),[B,L]=m.useState(null),[q,U]=m.useState(null),[H,X]=m.useState({tool:null,prompt:null,resource:null}),[Y,ae]=m.useState(!1),[te,me]=m.useState(null),Q=new Date,ue=Nb(Q),G=Sb(Q),[de,ie]=m.useState("Today"),[V,ee]=m.useState(ue),[ne,ge]=m.useState(G),[Ee,Pe]=m.useState(!1),[Ie,nt]=m.useState(new Date(Q.getTime()-7*24*60*60*1e3).toISOString().split("T")[0]),[Me,ot]=m.useState("00:00"),[Ge,at]=m.useState(Q.toISOString().split("T")[0]),[mt,Ke]=m.useState("23:59"),[pt,jt]=m.useState(!1);m.useEffect(()=>{const Je=e?.params||{},or=Je.interval||Je.group||"",Et={hourly:"hour",daily:"day",weekly:"week",monthly:"month"}[String(or).toLowerCase()]||or;["hour","day","week","month"].includes(Et)&&d(Et);const Lt=Je.from||Je.start,en=Je.to||Je.end;if(Lt&&en){const ke=new Date(Lt),_e=new Date(en);if(!Number.isNaN(ke.getTime())&&!Number.isNaN(_e.getTime())){ee(ke.toISOString()),ge(_e.toISOString()),ie("Custom"),nt(ke.toISOString().split("T")[0]),at(_e.toISOString().split("T")[0]),ot(ke.toISOString().slice(11,16)),Ke(_e.toISOString().slice(11,16)),Pe(!1);return}}const Yr=Je.range||Je.preset,hr=x1(Yr);hr&&(ie(hr.label),ee(hr.start),ge(hr.end),Pe(!1))},[e?.params]);const Ze=async Je=>{var or,Et,Lt,en,Yr,hr;const ke={from:V,to:ne,interval:c,tag:Je||void 0},[_e,bt,Ot,st,lt,tn,gr,cr,Nr]=await Promise.all([r.stats.getOverview(ke),r.stats.getBuckets(ke),r.stats.aggregateBy("method",{...ke,order:"-count",metrics:["count"]}),r.stats.aggregateBy("status",{...ke,order:"-count",metrics:["count"]}),r.stats.getBucketsGroup("protocol",{...ke}),r.stats.aggregateBy("path",{...ke,order:"-count",metrics:["count"],limit:10}),r.stats.aggregateBy("path",{...ke,statusClass:["4xx","5xx"],order:"-count",metrics:["count"],limit:10}),r.stats.aggregateBy("path",{...ke,order:"+p95_ms",metrics:["count","p95_ms"],limit:10}),r.stats.aggregateBy("path",{...ke,order:"-p95_ms",metrics:["count","p95_ms"],limit:10})]),In=_e?.data??_e?.overall??_e??null,eo=(bt?.data??[]).map(Kt=>{const En=Kt?.series??{},Vo=Number(En["2xx"]??0),Si=Number(En["3xx"]??0),Ba=Number(En["4xx"]??0),fo=Number(En["5xx"]??0),Nl=(typeof Kt.requests=="number"?Kt.requests:Kt.total_requests)??Vo+Si+Ba+fo,Oi=(typeof Kt.success=="number"?Kt.success:void 0)??Vo+Si,Sl=(typeof Kt.errors=="number"?Kt.errors:void 0)??Ba+fo;return{date:Kt.timestamp||Kt.date,total_requests:Nl,success:Oi,errors:Sl,"2xx":Vo,"4xx":Ba,"5xx":fo,average_response_time:Kt.avg_ms??Kt.average_response_time,min_response_time:Kt.min_ms??Kt.min_response_time,max_response_time:Kt.max_ms??Kt.max_response_time,median_response_time:Kt.p50_ms??Kt.median_response_time,p90_response_time:Kt.p90_ms??Kt.p90_response_time,p95_response_time:Kt.p95_ms??Kt.p95_response_time,p99_response_time:Kt.p99_ms??Kt.p99_response_time}}),Wt={method:Object.fromEntries((((or=Ot?.data)==null?void 0:or.rows)??[]).map(Kt=>[Kt.method,Kt.count])),status:Object.fromEntries((((Et=st?.data)==null?void 0:Et.rows)??[]).map(Kt=>[String(Kt.status),Kt.count])),protocol:G0e(lt?.data??lt?.buckets??[])},un=Kt=>(Kt??[]).map(En=>({path:En.path,count:En.count,p95_response_time:En.p95_ms??En.p95_response_time})),rn={all:un((Lt=tn?.data)==null?void 0:Lt.rows),error:un((en=gr?.data)==null?void 0:en.rows),fastest:un((Yr=cr?.data)==null?void 0:Yr.rows),slowest:un((hr=Nr?.data)==null?void 0:hr.rows)};return{overall:In,by_interval:eo,totals:Wt,top_endpoints:rn}},$e=async()=>{var Je,or,Et;if(!((Je=r?.stats)!=null&&Je.getOverview))return;const Lt=!!((or=r?.stats)!=null&&or.getMcpOperations),en=!!((Et=r?.stats)!=null&&Et.getMcpBuckets),Yr=Lt||en;i(!0),u(null),Yr&&(ae(!0),me(null),L(null),U(null),X({tool:null,prompt:null,resource:null}));try{const hr=Ze(x);if(Yr){const _e=[];Lt&&_e.push({key:"ops",promise:r.stats.getMcpOperations({from:V,to:ne})}),en&&(_e.push({key:"buckets",promise:r.stats.getMcpBuckets({from:V,to:ne,interval:c})}),_e.push({key:"tool",promise:r.stats.getMcpBuckets({from:V,to:ne,interval:c,group:"tool"})}),_e.push({key:"prompt",promise:r.stats.getMcpBuckets({from:V,to:ne,interval:c,group:"prompt"})}),_e.push({key:"resource",promise:r.stats.getMcpBuckets({from:V,to:ne,interval:c,group:"resource"})})),(async()=>{const bt=await Promise.allSettled(_e.map(lt=>lt.promise)),Ot={tool:null,prompt:null,resource:null};let st=!1;bt.forEach((lt,tn)=>{var gr;const cr=(gr=_e[tn])==null?void 0:gr.key;lt.status==="fulfilled"?(cr==="ops"&&L(lt.value),cr==="buckets"&&U(lt.value),cr==="tool"&&(Ot.tool=lt.value,st=!0),cr==="prompt"&&(Ot.prompt=lt.value,st=!0),cr==="resource"&&(Ot.resource=lt.value,st=!0)):lt.reason&&(console.error(lt.reason),me(Nr=>{var In;return Nr||((In=lt.reason)==null?void 0:In.message)||"Failed to load MCP statistics"}))}),st&&X(Ot),ae(!1)})()}const ke=await hr;o(ke)}catch(hr){console.error(hr),u(hr?.message||"Failed to load statistics")}finally{i(!1)}},ut=async()=>{var Je;if((Je=r?.stats)!=null&&Je.getOverview&&O!==void 0){I(!0),W(null);try{const or=Ze(S).then(hr=>(T(hr),hr)),Et=Ze(O).then(hr=>(F(hr),hr)),[Lt,en]=await Promise.allSettled([or,Et]),Yr=Lt.status==="rejected"?Lt.reason:en.status==="rejected"?en.reason:null;Yr&&(console.error(Yr),W(Yr?.message||"Failed to load comparison data"))}finally{I(!1)}}},$t=()=>E==="compare"?ut():$e(),St=async()=>{try{await r.stats.deleteOperations(),await $e(),E==="compare"&&await ut()}catch(Je){console.error("Error clearing all operation stats:",Je)}};m.useEffect(()=>{$e()},[r,c,V,ne,x]),m.useEffect(()=>{E==="compare"&&ut()},[r,E,c,V,ne,S,O]),m.useEffect(()=>{var Je;if(!((Je=r?.operations)!=null&&Je.listTags))return;let or=!1;return(async()=>{try{g(!0),v("");const Et=await r.operations.listTags();if(or)return;const Lt=Array.isArray(Et?.tags)?[...Et.tags]:[];Lt.sort((en,Yr)=>en.localeCompare(Yr)),h(Lt)}catch(Et){if(or)return;console.error("Failed to load tags",Et),h([]),v(Et?.message||"Failed to load tags")}finally{or||g(!1)}})(),()=>{or=!0}},[r]),m.useEffect(()=>{x&&(f.includes(x)||k(null))},[f,x]),m.useEffect(()=>{S&&(f.includes(S)||C(null))},[f,S]),m.useEffect(()=>{if(O!=null&&!f.includes(O)){const Je=f.find(or=>or!==S)??null;M(Je)}},[f,S,O]),m.useEffect(()=>{if(O!==void 0)return;if(f.length===0){M(null);return}const Je=f.find(or=>or!==S)??f[0];M(Je??null)},[f,S,O]);const An=m.useMemo(()=>Bk(n?.by_interval),[n?.by_interval]),Zt=B?.data??null,Jr=m.useMemo(()=>(Array.isArray(q?.data)?q.data:[]).map(Je=>({date:w1(Je.timestamp),mcp_count:Je.count??0,mcp_request_tokens:Je.request_tokens??0,mcp_response_tokens:Je.response_tokens??0,mcp_total_tokens:Je.total_tokens!=null?Je.total_tokens:(Je.request_tokens??0)+(Je.response_tokens??0)})),[q]),Ye=m.useMemo(()=>{var Je;return zk((Je=H.tool)==null?void 0:Je.data)},[H.tool]),jn=m.useMemo(()=>{var Je;return zk((Je=H.prompt)==null?void 0:Je.data)},[H.prompt]),Wr=m.useMemo(()=>{var Je;return zk((Je=H.resource)==null?void 0:Je.data)},[H.resource]),Qn=m.useMemo(()=>{var Je;const or=Number(((Je=Zt?.total)==null?void 0:Je.count)??0),Et=Ye.keys.length||jn.keys.length||Wr.keys.length,Lt=Jr.length>0;return or>0||Et||Lt},[Zt,Ye,jn,Wr,Jr]),Be=m.useMemo(()=>({byTool:$l(Zt?.by_tool),byResource:$l(Zt?.by_resource),byPrompt:$l(Zt?.by_prompt),byMethod:$l(Zt?.by_method),byCategory:$l(Zt?.by_category),bySession:$l(Zt?.by_session)}),[Zt]),Kr=m.useMemo(()=>Bk(A?.by_interval),[A?.by_interval]),ur=m.useMemo(()=>Bk(_?.by_interval),[_?.by_interval]),Xe=E==="compare"?1:0,Bt=E==="compare"?$:a,Tt=O===void 0?null:O,Qr=Je=>{j(Je===1?"compare":"overview")},Mr=Je=>{ie(Je.label),ee(Je.start),ge(Je.end),Pe(!1)},tr=()=>{Pe(!Ee),Ee||ie("Custom")},_n=()=>{const Je=new Date(`${Ie}T${Me}:00`),or=new Date(`${Ge}T${mt}:00`);ee(Je.toISOString()),ge(or.toISOString()),ie("Custom"),Pe(!1)};return l.jsxs(l.Fragment,{children:[l.jsx("header",{children:l.jsxs("div",{className:"sm:flex sm:items-center sm:justify-between",children:[l.jsx("h3",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Inspectr Statistics"}),l.jsxs("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400 sm:mt-0",children:[l.jsx("span",{className:"font-medium",children:"Range:"})," ",TA(V)," -"," ",TA(ne)]})]})}),l.jsxs(Ju,{index:Xe,onIndexChange:Qr,children:[l.jsxs("div",{className:"relative mt-4",children:[l.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs(Zu,{className:"w-auto",children:[l.jsx(vo,{children:"Overview"}),l.jsx(vo,{children:"Compare"})]}),E==="overview"?l.jsx(up,{tags:f,selectedTag:x,onSelect:k,disabled:Bt,loading:p,error:b}):l.jsx("div",{className:"flex flex-wrap items-end gap-3",children:l.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[l.jsx(up,{tags:f,selectedTag:S,onSelect:C,disabled:Bt,loading:p,error:b}),l.jsx(up,{tags:f,selectedTag:Tt,onSelect:M,disabled:Bt,loading:p,error:b})]})})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[l.jsx(k1,{selectedRange:de,onSelect:Mr,onCustomClick:tr}),l.jsxs(v1,{className:"w-full sm:w-fit [&>button]:rounded-tremor-small",enableClear:!1,value:c,onValueChange:Je=>d(Je),children:[l.jsx(Zi,{value:"hour",children:"Hourly"}),l.jsx(Zi,{value:"day",children:"Daily"}),l.jsx(Zi,{value:"week",children:"Weekly"}),l.jsx(Zi,{value:"month",children:"Monthly"})]}),l.jsx(du,{onClick:$t,disabled:Bt,children:Bt?"Loading":"Refresh"}),l.jsxs("button",{type:"button",className:"rounded bg-red-500 px-2 py-2 text-xs text-white",onClick:()=>jt(!0),children:[l.jsx("span",{className:"sr-only",children:"Clear all operation stats"}),l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",className:"h-4 w-4","aria-hidden":!0,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"})})]})]})]}),b&&!p?l.jsxs("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:["Tag filter unavailable: ",b]}):null,Ee&&l.jsxs("div",{className:"absolute top-full right-0 z-10 mt-2 flex flex-wrap items-center gap-2 rounded bg-gray-50 p-3 shadow dark:bg-gray-800",children:[l.jsxs("div",{className:"flex flex-col",children:[l.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Start Date"}),l.jsx("input",{type:"date",value:Ie,onChange:Je=>nt(Je.target.value),className:"rounded border px-2 py-1 focus:outline-none focus:ring-2 focus:ring-tremor-brand dark:border-gray-600 dark:bg-gray-700"})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Start Time"}),l.jsx("input",{type:"time",value:Me,onChange:Je=>ot(Je.target.value),className:"rounded border px-2 py-1 focus:outline-none focus:ring-2 focus:ring-tremor-brand dark:border-gray-600 dark:bg-gray-700"})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"End Date"}),l.jsx("input",{type:"date",value:Ge,onChange:Je=>at(Je.target.value),className:"rounded border px-2 py-1 focus:outline-none focus:ring-2 focus:ring-tremor-brand dark:border-gray-600 dark:bg-gray-700"})]}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("label",{className:"text-xs text-gray-500 dark:text-gray-400",children:"End Time"}),l.jsx("input",{type:"time",value:mt,onChange:Je=>Ke(Je.target.value),className:"rounded border px-2 py-1 focus:outline-none focus:ring-2 focus:ring-tremor-brand dark:border-gray-600 dark:bg-gray-700"})]}),l.jsx("div",{className:"flex items-end",children:l.jsx(du,{onClick:_n,className:"ml-2",children:"Apply"})})]})]}),l.jsxs(Qu,{children:[l.jsxs(yo,{children:[s?l.jsxs("p",{className:"mt-4 text-red-600 dark:text-red-400",children:["Error: ",s]}):null,l.jsx("main",{className:"mt-6",children:fR(n,An)}),Y||te||Qn?l.jsxs("section",{className:"mt-10",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsx("h4",{className:"text-tremor-title font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"MCP Usage"}),Y?l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Loading MCP stats…"}):null]}),te?l.jsxs("p",{className:"mt-2 text-sm text-red-600 dark:text-red-400",children:["MCP stats error: ",te]}):null,!Y&&!te&&Qn?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mt-4",children:l.jsx(K0e,{total:Zt.total})}),l.jsx("div",{className:"mt-6",children:l.jsx(Wm,{title:"MCP Usage Trend",data:Jr,keys:["mcp_count","mcp_total_tokens"],highlightValue:dR((t=Zt?.total)==null?void 0:t.count),highlightLabel:"Total MCP Requests"})}),l.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 xl:grid-cols-3",children:[l.jsx(Wm,{title:"Tools Usage Over Time",data:Ye.data,keys:Ye.keys,highlightLabel:"Top Tool",highlightValue:Ye.topLabel}),l.jsx(Wm,{title:"Prompts Usage Over Time",data:jn.data,keys:jn.keys,highlightLabel:"Top Prompt",highlightValue:jn.topLabel}),l.jsx(Wm,{title:"Resources Usage Over Time",data:Wr.data,keys:Wr.keys,highlightLabel:"Top Resource",highlightValue:Wr.topLabel})]}),l.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-4 xl:grid-cols-2",children:[l.jsx(Fl,{title:"By Tool",items:Be.byTool}),l.jsx(Fl,{title:"By Resource",items:Be.byResource}),l.jsx(Fl,{title:"By Prompt",items:Be.byPrompt}),l.jsx(Fl,{title:"By Method",items:Be.byMethod}),l.jsx(Fl,{title:"By Category",items:Be.byCategory}),l.jsx(Fl,{title:"By Session",items:Be.bySession})]})]}):null]}):null]}),l.jsxs(yo,{children:[R?l.jsxs("p",{className:"mt-4 text-red-600 dark:text-red-400",children:["Comparison error: ",R]}):null,l.jsx("main",{className:"mt-6",children:l.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-2",children:[l.jsx(MA,{label:"Input A",tag:S,stats:A,intervalData:Kr,loading:$}),l.jsx(MA,{label:"Input B",tag:Tt,stats:_,intervalData:ur,loading:$})]})})]})]})]}),l.jsx(U0e,{open:pt,onClose:()=>jt(!1),title:"Clear All Operation Stats?",message:"Are you sure you want to clear all operation stats? This action cannot be undone.",onConfirm:St})]})}const J0e=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"boolean",label:"Boolean"}],Q0e=e=>{if(!Array.isArray(e)||e.length===0)return[];const t=new Set;return e.map(r=>{if(!r||typeof r!="object")return null;const n=r.operator||r.value||r.op;if(!n||typeof n!="string")return null;const o=n.trim();if(!o||t.has(o))return null;t.add(o);const a=Array.isArray(r.aliases)?r.aliases.filter(i=>typeof i=="string"&&i.trim()):[];return{operator:o,label:r.label||r.name||o,description:r.description||"",aliases:a,valueRequired:!!(r.value_required??r.valueRequired??r.requiresValue),multiValue:!!(r.multi_value??r.multiValue)}}).filter(Boolean)},eke=(e=[])=>e.map(t=>({value:t.operator,label:t.label||t.operator,description:t.description||"",valueRequired:t.valueRequired!==!1,multiValue:t.multiValue===!0})),tke=(e=[])=>e.reduce((t,r)=>{const n=r.label||r.operator;return t[r.operator]=n,(r.aliases||[]).forEach(o=>{t[o]=n}),t},{}),rke=(e=[])=>e.reduce((t,r)=>(t[r.operator]=r,(r.aliases||[]).forEach(n=>{t[n]=r}),t),{}),mR=(e=[])=>{var t;return((t=e[0])==null?void 0:t.operator)||""},nke=[{value:"and",label:"All conditions match"},{value:"or",label:"Any condition matches"}],oke={and:"All conditions must match before actions run.",or:"Any condition may match before actions run."},_A={tag:"Apply static tags",tag_dynamic:"Apply dynamic tags"},ij=e=>typeof e=="boolean"?e:typeof e=="string"?e==="true"||e==="1":!!e,sj=e=>{if(e?.input==="single_select"&&Array.isArray(e?.choices)&&e.choices.length){if(e.default!=null)return e.default;const t=e.choices[0];return t?.value??""}return typeof e?.type=="string"&&e.type.startsWith("array")?"":e?.type==="object"?{}:e?.type==="boolean"?ij(e.default??!0):e?.default!=null?e.default:""},cp=()=>Math.random().toString(36).slice(2,10),lj=(e=mR())=>({path:"",operator:e,value:"",valueType:"string"}),ld=e=>({id:cp(),type:e?.type||"",params:(e?.params||[]).reduce((t,r)=>(t[r.name]=sj(r),t),{})}),ud=e=>Array.isArray(e)?e:typeof e=="string"?e.split(",").map(t=>t.trim()).filter(Boolean):[],Dh=e=>e?Array.isArray(e)?e.flatMap(Dh):e.left&&e.op?[e]:e.args?e.args.flatMap(Dh):[]:[],ake=e=>typeof e=="number"?"number":typeof e=="boolean"?"boolean":"string",ike=e=>e==null||e===""?"empty":Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):typeof e=="string"?`"${e}"`:typeof e=="boolean"?e?"true":"false":String(e),ske=e=>_A[e]?_A[e]:e.toString().replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase()),lke=(e={})=>{const t=Object.entries(e);return t.length===0?"No parameters configured":t.map(([r,n])=>Array.isArray(n)?`${r}: ${n.join(", ")}`:typeof n=="object"&&n!==null?`${r}: ${JSON.stringify(n)}`:typeof n=="boolean"?`${r}: ${n?"true":"false"}`:`${r}: ${n}`).join(" · ")},uke=e=>{if(!e)return null;const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const r=Date.now()-t.getTime();if(r<0)return t.toLocaleString();const n=Math.round(r/6e4);if(n<1)return"Just now";if(n<60)return`${n}m ago`;const o=Math.round(n/60);if(o<24)return`${o}h ago`;const a=Math.round(o/24);return a<30?`${a}d ago`:t.toLocaleDateString()},IA=(e,t,r)=>{if(!Array.isArray(e))return e;const n=e.length;if(n===0)return e;const o=(t%n+n)%n,a=(r%n+n)%n;if(o===a)return e;const i=[...e],[s]=i.splice(o,1);return i.splice(a,0,s),i},cke=({variant:e})=>e==="event"?l.jsx("span",{className:"relative flex aspect-square h-9 items-center justify-center rounded-lg bg-orange-600 dark:bg-orange-500","aria-hidden":"true",children:l.jsxs("svg",{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",className:"size-5 shrink-0 text-white","aria-hidden":"true",children:[l.jsx("path",{d:"M12 2v14"}),l.jsx("path",{d:"m19 9-7 7-7-7"}),l.jsx("circle",{cx:"12",cy:"21",r:"1"})]})}):e==="condition"?l.jsx("span",{className:"relative flex aspect-square h-9 items-center justify-center rounded-lg bg-sky-500 dark:bg-sky-500","aria-hidden":"true",children:l.jsxs("svg",{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",className:"size-5 shrink-0 text-white","aria-hidden":"true",children:[l.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),l.jsx("path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3"}),l.jsx("path",{d:"M9 11.2h5.7"})]})}):l.jsx("span",{className:"relative flex aspect-square h-9 items-center justify-center rounded-lg bg-emerald-500 dark:bg-emerald-500","aria-hidden":"true",children:l.jsxs("svg",{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",className:"size-5 shrink-0 text-white","aria-hidden":"true",children:[l.jsx("path",{d:"M22 12A10 10 0 1 1 12 2"}),l.jsx("path",{d:"M22 2 12 12"}),l.jsx("path",{d:"M16 2h6v6"})]})}),dke=(e,t,r)=>{var n;const o=String(((n=e.expression)==null?void 0:n.op)||"and").toLowerCase(),a=oke[o],i=t[e.event]||{},s=i.name||e.event,u=[e.description,i.description,a].filter(Boolean),c=[{variant:"event",title:s,description:u.join(" · ")}];return Dh(e.expression).forEach((d,f)=>{var h,p;const g=r?.[d.op]||d.op,b=ike(d.right),v=[];(h=d.left)!=null&&h.path&&v.push(d.left.path),(p=d.right)!=null&&p.path&&v.push(`Compare to ${d.right.path}`),c.push({variant:"condition",title:`Condition ${f+1}: ${g} ${b}`,description:v.join(" · ")})}),(e.actions||[]).forEach((d,f)=>{c.push({variant:"action",title:`Action ${f+1}: ${ske(d.type)}`,description:lke(d.params)})}),c},fke=e=>{if(!e||typeof e!="object")return null;const{id:t,updated_at:r,created_at:n,...o}=e,a=`Copy of ${e.name||"Untitled rule"}`;return{...o,name:a,active:!1}},mke=({rules:e,events:t,loading:r,error:n,isRefreshing:o,openRuleId:a,onToggleRule:i,onRefresh:s,onEditRule:u,onDeleteRule:c,onCreateRule:d,onStartFromTemplate:f,onApplyHistory:h,actionsDisabled:p=!1,onDuplicateRule:g,onPauseRule:b,onExportRule:v,onImportRule:x,meta:k,licenseUsage:E=null,onPageChange:j,paginationAlwaysShow:S=!1,operatorLabelMap:C={}})=>{const O=m.useMemo(()=>t.reduce((I,R)=>(I[R.type]=R,I),{}),[t]),M=typeof k?.total=="number"?k.total:e.length,A=typeof E?.limit=="number"&&!Number.isNaN(E.limit)?E.limit:null,T=typeof E?.used=="number"&&!Number.isNaN(E.used)?E.used:null,_=Number.isFinite(T)?T:M,F=A!==null?`${_}/${A}`:`${_}`,$=A!==null&&Number.isFinite(_)&&_>=A;return l.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("img",{src:iR,width:24,height:24,alt:"","aria-hidden":"true",className:"inline-block"}),l.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-50",children:"Rules"}),l.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-xs font-semibold text-gray-700 dark:bg-gray-800 dark:text-gray-200",children:F})]}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Overview of automation rules currently available on your workspace."})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("button",{type:"button",onClick:x,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:"Import rule"}),l.jsx("button",{type:"button",onClick:f,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:"Start from template"}),l.jsx("button",{type:"button",onClick:d,className:"inline-flex items-center rounded-md border border-transparent bg-blue-500 px-3 py-1.5 text-sm font-medium text-white shadow-sm transition hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-600 dark:hover:bg-blue-500",children:"Add rule"}),l.jsx("button",{type:"button",onClick:()=>s&&s(),title:"Refresh rules",disabled:o||r,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:o?"Refreshing…":"Refresh"})]})]}),l.jsxs("div",{className:"px-4 py-4",children:[$?l.jsxs("div",{className:"my-2 flex items-center justify-between gap-3 rounded-md bg-gray-50 px-3 py-2 text-sm text-gray-700 ring-1 ring-inset ring-gray-200 dark:bg-gray-900 dark:text-gray-300 dark:ring-gray-800",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-400 dark:bg-gray-400",children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"white",className:"size-6",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})})}),l.jsxs("div",{className:"flex flex-col",children:[l.jsx("p",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Rules limit reached"}),l.jsx("p",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400",children:"You have used all available rules within your plan. View available plans to unlock more capacity."})]})]}),l.jsx("a",{href:"https://inspectr.dev/pricing",target:"_blank",rel:"noreferrer noopener",className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border px-3 py-2 text-center text-sm font-medium shadow-sm transition-all duration-100 ease-in-out disabled:pointer-events-none disabled:shadow-none outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500 dark:outline-blue-500 border-transparent text-white dark:text-white bg-yellow-500 dark:bg-yellow-500 hover:bg-yellow-600 dark:hover:bg-blue-600 disabled:bg-blue-300 disabled:text-white disabled:dark:bg-blue-800 disabled:dark:text-blue-400",children:"Discover Plans"})]}):null,r?l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Loading rules…"}):n?l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:n}):e.length===0?l.jsxs("div",{className:"mt-8 flex h-96 min-h-full flex-1 flex-col justify-center rounded-lg border border-gray-200 bg-gray-50 px-6 py-10 text-center dark:border-gray-700 dark:bg-gray-800",children:[l.jsx("h2",{className:"text-2xl font-semibold text-gray-900 dark:text-gray-50",children:"Get started with rules"}),l.jsx("p",{className:"mt-3 mx-auto max-w-xl text-sm text-gray-500 dark:text-gray-400 sm:text-base",children:"Automate how Inspectr responds to captured operations. Add your first rule or choose a template to jump-start your automation flow."}),l.jsxs("div",{className:"mt-8 flex flex-col items-center justify-center gap-3 sm:flex-row",children:[l.jsx("button",{type:"button",onClick:d,disabled:p||r,className:"inline-flex w-full items-center justify-center rounded-md border border-transparent bg-blue-500 px-3 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-600 dark:hover:bg-blue-500 sm:w-auto",children:"Add rule"}),l.jsx("button",{type:"button",onClick:f,disabled:p||r,className:"inline-flex w-full items-center justify-center gap-1 rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/60 sm:w-auto",children:"Start from template"})]})]}):l.jsx("div",{className:"space-y-3",children:e.map(I=>{const R=a===I.id,W=dke(I,O,C),B=uke(I.updated_at||I.created_at);return l.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[l.jsx("button",{type:"button",onClick:()=>i(R?null:I.id),className:"flex w-full items-center justify-between gap-4 px-4 py-3 text-left text-sm font-medium text-gray-900 transition hover:bg-gray-50 dark:text-gray-100 dark:hover:bg-gray-900/40",children:l.jsxs("div",{className:"flex w-full items-center justify-between gap-4",children:[l.jsxs("div",{className:"truncate",children:[l.jsx("p",{className:"truncate text-sm font-medium text-gray-900 dark:text-gray-50",children:I.name}),l.jsx("p",{className:"mt-0.5 truncate text-xs text-gray-500 dark:text-gray-400",children:I.description||"No description provided"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium ${I.active?"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400"}`,children:[l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-3.5","aria-hidden":"true",children:I.active?l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"m9 11 3 3L22 4"}),l.jsx("path",{d:"M21.801 10A10 10 0 1 1 17 3.335"})]}):l.jsx("circle",{cx:"12",cy:"12",r:"10"})}),I.active?"Live":"Inactive"]}),l.jsx("svg",{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",className:`size-5 shrink-0 transition-transform duration-150 text-gray-400 dark:text-gray-600 ${R?"rotate-180":""}`,"aria-hidden":"true",children:l.jsx("path",{d:"m6 9 6 6 6-6"})})]})]})}),R&&l.jsx("div",{className:"border-t border-gray-200 bg-gray-50 px-4 py-5 text-sm dark:border-gray-800 dark:bg-gray-900/40",children:l.jsxs("div",{className:"overflow-hidden pb-4 text-sm text-gray-700 dark:text-gray-200",children:[l.jsx("div",{className:"mx-auto flex w-full items-center justify-between gap-3 text-sm text-gray-500 dark:text-gray-500",children:l.jsx("div",{className:"h-[1px] w-full bg-gray-200 dark:bg-gray-800"})}),l.jsx("ul",{role:"list",className:"mt-6 space-y-6","aria-label":"Rule steps",children:W.map((L,q)=>{const U=q===W.length-1;return l.jsxs("li",{className:"relative flex gap-x-4",children:[!U&&l.jsx("div",{className:"-bottom-6 absolute left-0 top-0 flex w-9 justify-center",children:l.jsx("div",{className:"w-px bg-gray-200 dark:bg-gray-800"})}),l.jsx(cke,{variant:L.variant}),l.jsxs("div",{children:[l.jsxs("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:[q+1,". ",L.title]}),L.description&&l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:L.description})]})]},`${I.id}-step-${q}`)})}),l.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-between gap-3",children:[l.jsx("time",{className:"flex-none text-xs leading-5 text-gray-500 dark:text-gray-500",children:B?`Updated ${B}`:"Updated recently"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{type:"button",onClick:()=>h&&h(I),className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-blue-500 px-3 py-1.5 text-sm font-medium text-blue-600 shadow-sm transition hover:bg-blue-50 dark:border-blue-400 dark:text-blue-400 dark:hover:bg-blue-900/20",children:[l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4 -ml-0.5 mr-1.5","aria-hidden":"true",children:l.jsx("path",{d:"M19.3788 15.1057C20.9258 11.4421 19.5373 7.11431 16.0042 5.0745C13.4511 3.60046 10.4232 3.69365 8.03452 5.0556L7.04216 3.31879C10.028 1.61639 13.8128 1.4999 17.0042 3.34245C21.4949 5.93513 23.2139 11.4848 21.1217 16.112L22.4635 16.8867L18.2984 19.1008L18.1334 14.3867L19.3788 15.1057ZM4.62961 8.89968C3.08263 12.5633 4.47116 16.8911 8.00421 18.9309C10.5573 20.4049 13.5851 20.3118 15.9737 18.9499L16.9661 20.6867C13.9803 22.389 10.1956 22.5055 7.00421 20.663C2.51357 18.0703 0.794565 12.5206 2.88672 7.89342L1.54492 7.11873L5.70999 4.90463L5.87505 9.61873L4.62961 8.89968ZM13.4184 14.8311L10.59 12.0027L7.76157 14.8311L6.34736 13.4169L10.59 9.17428L13.4184 12.0027L16.2469 9.17428L17.6611 10.5885L13.4184 14.8311Z"})}),"Apply to history"]}),l.jsxs("button",{type:"button",onClick:()=>u(I),className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/30",children:[l.jsxs("svg",{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",className:"lucide lucide-settings -ml-0.5 mr-1.5 size-4 shrink-0","aria-hidden":"true",children:[l.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),"Edit"]}),l.jsxs("button",{type:"button",onClick:()=>{const L=fke(I);L&&(g?g(L):d&&d(L))},className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/30",title:"Duplicate rule","aria-label":"Duplicate rule",children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4 -ml-0.5 mr-1.5",children:[l.jsx("path",{d:"M9 7a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V7z"}),l.jsx("path",{d:"M5 9a2 2 0 0 1 2-2h1v7a4 4 0 0 0 4 4h7v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V9z"})]}),"Duplicate"]}),l.jsxs("button",{type:"button",onClick:()=>v&&v(I),className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/30",title:"Export rule","aria-label":"Export rule",children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"-ml-0.5 mr-1.5 size-4",children:[l.jsx("path",{d:"M5 7v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7"}),l.jsx("path",{d:"M12 3v12"}),l.jsx("path",{d:"m8 11 4 4 4-4"})]}),"Export"]}),l.jsxs("button",{type:"button",onClick:()=>c(I),className:"inline-flex items-center gap-1 rounded-md border border-grey-300 px-2.5 py-1.5 text-xs font-medium text-red-700 transition hover:bg-red-50 dark:border-red-900/40 dark:text-red-300 dark:hover:bg-red-950",children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"-ms-0.5",children:[l.jsx("path",{d:"M3 6h18"}),l.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),l.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),l.jsx("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),l.jsx("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]}),"Delete"]}),l.jsxs("button",{type:"button",onClick:()=>b&&b(I),disabled:p||r,className:"relative inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-900 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-50 dark:hover:bg-gray-800/30",title:I.active?"Pause rule":"Activate rule",children:[I.active?l.jsxs("svg",{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",className:"lucide lucide-circle-pause -ml-0.5 mr-1.5 size-4 shrink-0","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("line",{x1:"10",x2:"10",y1:"15",y2:"9"}),l.jsx("line",{x1:"14",x2:"14",y1:"15",y2:"9"})]}):l.jsxs("svg",{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",className:"lucide lucide-circle-play -ml-0.5 mr-1.5 size-4 shrink-0","aria-hidden":"true",children:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("polygon",{points:"10 8 16 12 10 16"})]}),I.active?"Pause":"Play"]})]})]})]})})]},I.id||I.name)})}),k&&l.jsx(pj,{meta:k,onPageChange:j,alwaysShow:S})]})]})};function pke({id:e,descriptor:t,value:r,onChange:n,readOnly:o}){if(!t||t.hidden)return null;const a=t.label||t.name,i=o??!!t.readonly,s=t.help||(t.description?"":t.description);return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[a,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("input",{id:e,type:"checkbox",disabled:i,checked:!!r,onChange:u=>n(u.target.checked),className:"size-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900"}),t.description&&l.jsx("span",{className:"text-xs text-gray-600 dark:text-gray-400",children:t.description})]}),s&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:s})]})}function hke({id:e,descriptor:t,value:r,onChange:n,provider:o,readOnly:a}){if(!t||t.hidden)return null;const i=t.label||t.name,s=a??!!t.readonly,u=t.help||t.description,c="block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",d=(t.choices||[]).filter(f=>!f.group||!o||f.group===o);return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[i,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsx("select",{id:e,disabled:s,value:typeof r=="string"?r:r??"",onChange:f=>n(f.target.value),className:c,children:d.map(f=>l.jsx("option",{value:f.value,title:f.description||"",children:f.label||f.value},f.value))}),u&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u})]})}function gke({id:e,descriptor:t,value:r,onChange:n,provider:o,readOnly:a}){if(!t||t.hidden)return null;const i=t.label||t.name,s=a??!!t.readonly,u=t.help||t.description,c="block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",d=r&&typeof r=="object"&&r!==null?r:{},f=(g,b)=>{const v={...d};b?g in v||(v[g]=""):delete v[g],n(v)},h=(g,b)=>{const v={...d};v[g]=b,n(v)},p=(t.choices||[]).filter(g=>!g.group||!o||g.group===o);return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[i,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:p.map(g=>{var b,v;const x=((b=g.meta)==null?void 0:b.key)||g.value,k=Object.prototype.hasOwnProperty.call(d,x),E=((v=g.meta)==null?void 0:v.type)||"string",j=(()=>{const S=d[x];if(E==="object"&&typeof S=="object"&&S!==null)try{return JSON.stringify(S)}catch{return String(S)}return S??""})();return l.jsxs("div",{className:"rounded-md border border-gray-200 p-2 dark:border-gray-800",children:[l.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[l.jsx("input",{type:"checkbox",disabled:s,checked:k,onChange:S=>f(x,S.target.checked),className:"mt-1 size-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900"}),l.jsxs("span",{className:"flex-1",children:[l.jsx("span",{className:"font-medium text-gray-800 dark:text-gray-200",children:g.label||g.value}),g.description&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:g.description})]})]}),k&&l.jsx("div",{className:"mt-2",children:E==="object"?l.jsx("textarea",{rows:3,disabled:s,value:j,onChange:S=>h(x,S.target.value),placeholder:g.label,className:c}):l.jsx("input",{type:E==="integer"||E==="number"?"number":"text",disabled:s,value:j,onChange:S=>h(x,S.target.value),placeholder:g.label,className:c})})]},g.value)})}),u&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u})]})}function bke({id:e,descriptor:t,value:r,onChange:n,readOnly:o}){if(!t||t.hidden)return null;const a=t.label||t.name,i=o??!!t.readonly,s=t.placeholder||"",u=t.help||t.description;return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[a,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsx("input",{id:e,type:"number",step:t.type==="integer"?1:"any",disabled:i,value:r??"",onChange:c=>n(c.target.value),placeholder:s,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),u&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u})]})}function vke({id:e,descriptor:t,value:r,onChange:n,readOnly:o}){if(!t||t.hidden)return null;const a=t.label||t.name,i=o??!!t.readonly,s=t.placeholder||"",u=t.help||t.description;return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[a,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsx("input",{id:e,type:"text",disabled:i,value:Array.isArray(r)?r.join(", "):r??"",onChange:c=>n(c.target.value),placeholder:s,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),u&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u})]})}function yke({id:e,descriptor:t,value:r,onChange:n,readOnly:o}){if(!t||t.hidden)return null;const a=t.label||t.name,i=o??!!t.readonly,s=t.placeholder||"",u=t.help||t.description,c="block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",d=typeof r=="string"?r:r?JSON.stringify(r,null,2):"";return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[a,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsx("textarea",{id:e,rows:4,disabled:i,value:d,onChange:f=>n(f.target.value),placeholder:s,className:c}),u&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u})]})}function xke({id:e,descriptor:t,value:r,onChange:n,readOnly:o}){if(!t||t.hidden)return null;const a=t.label||t.name,i=o??!!t.readonly,s=t.placeholder||"",u=t.help||t.description;return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[a,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsx("input",{id:e,type:"text",disabled:i,value:typeof r=="string"?r:r??"",onChange:c=>n(c.target.value),placeholder:s,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),u&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u})]})}function kke({id:e,descriptor:t,value:r,onChange:n,readOnly:o}){if(!t||t.hidden)return null;const a=t.label||t.name,i=o??!!t.readonly,s=t.placeholder||"",u=t.help||t.description;return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[a,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsx("input",{id:e,type:"password",disabled:i,value:typeof r=="string"?r:r??"",onChange:c=>n(c.target.value),placeholder:s,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),u&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u})]})}class wke{add(t,r,n){if(typeof arguments[0]!="string")for(let o in arguments[0])this.add(o,arguments[0][o],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(o){this[o]=this[o]||[],r&&this[o][n?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(n){n.call(r&&r.context?r.context:r,r)})}}class jke{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(o=>{if(typeof o!="object"||!o.name||!o.init)throw new Error("Invalid JSEP plugin format");this.registered[o.name]||(o.init(this.jsep),this.registered[o.name]=o)})}}class Ne{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+Ne.version}static addUnaryOp(t){return Ne.max_unop_len=Math.max(t.length,Ne.max_unop_len),Ne.unary_ops[t]=1,Ne}static addBinaryOp(t,r,n){return Ne.max_binop_len=Math.max(t.length,Ne.max_binop_len),Ne.binary_ops[t]=r,n?Ne.right_associative.add(t):Ne.right_associative.delete(t),Ne}static addIdentifierChar(t){return Ne.additional_identifier_chars.add(t),Ne}static addLiteral(t,r){return Ne.literals[t]=r,Ne}static removeUnaryOp(t){return delete Ne.unary_ops[t],t.length===Ne.max_unop_len&&(Ne.max_unop_len=Ne.getMaxKeyLen(Ne.unary_ops)),Ne}static removeAllUnaryOps(){return Ne.unary_ops={},Ne.max_unop_len=0,Ne}static removeIdentifierChar(t){return Ne.additional_identifier_chars.delete(t),Ne}static removeBinaryOp(t){return delete Ne.binary_ops[t],t.length===Ne.max_binop_len&&(Ne.max_binop_len=Ne.getMaxKeyLen(Ne.binary_ops)),Ne.right_associative.delete(t),Ne}static removeAllBinaryOps(){return Ne.binary_ops={},Ne.max_binop_len=0,Ne}static removeLiteral(t){return delete Ne.literals[t],Ne}static removeAllLiterals(){return Ne.literals={},Ne}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new Ne(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(r=>r.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return Ne.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!Ne.binary_ops[String.fromCharCode(t)]||Ne.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return Ne.isIdentifierStart(t)||Ne.isDecimalDigit(t)}throwError(t){const r=new Error(t+" at character "+this.index);throw r.index=this.index,r.description=t,r}runHook(t,r){if(Ne.hooks[t]){const n={context:this,node:r};return Ne.hooks.run(t,n),n.node}return r}searchHook(t){if(Ne.hooks[t]){const r={context:this};return Ne.hooks[t].find(function(n){return n.call(r.context,r),r.node}),r.node}}gobbleSpaces(){let t=this.code;for(;t===Ne.SPACE_CODE||t===Ne.TAB_CODE||t===Ne.LF_CODE||t===Ne.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),r=t.length===1?t[0]:{type:Ne.COMPOUND,body:t};return this.runHook("after-all",r)}gobbleExpressions(t){let r=[],n,o;for(;this.index<this.expr.length;)if(n=this.code,n===Ne.SEMCOL_CODE||n===Ne.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())r.push(o);else if(this.index<this.expr.length){if(n===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,Ne.max_binop_len),r=t.length;for(;r>0;){if(Ne.binary_ops.hasOwnProperty(t)&&(!Ne.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!Ne.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=r,t;t=t.substr(0,--r)}return!1}gobbleBinaryExpression(){let t,r,n,o,a,i,s,u,c;if(i=this.gobbleToken(),!i||(r=this.gobbleBinaryOp(),!r))return i;for(a={value:r,prec:Ne.binaryPrecedence(r),right_a:Ne.right_associative.has(r)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+r),o=[i,a,s];r=this.gobbleBinaryOp();){if(n=Ne.binaryPrecedence(r),n===0){this.index-=r.length;break}a={value:r,prec:n,right_a:Ne.right_associative.has(r)},c=r;const d=f=>a.right_a&&f.right_a?n>f.prec:n<=f.prec;for(;o.length>2&&d(o[o.length-2]);)s=o.pop(),r=o.pop().value,i=o.pop(),t={type:Ne.BINARY_EXP,operator:r,left:i,right:s},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+c),o.push(a,t)}for(u=o.length-1,t=o[u];u>1;)t={type:Ne.BINARY_EXP,operator:o[u-1].value,left:o[u-2],right:t},u-=2;return t}gobbleToken(){let t,r,n,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,Ne.isDecimalDigit(t)||t===Ne.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===Ne.SQUOTE_CODE||t===Ne.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===Ne.OBRACK_CODE)o=this.gobbleArray();else{for(r=this.expr.substr(this.index,Ne.max_unop_len),n=r.length;n>0;){if(Ne.unary_ops.hasOwnProperty(r)&&(!Ne.isIdentifierStart(this.code)||this.index+r.length<this.expr.length&&!Ne.isIdentifierPart(this.expr.charCodeAt(this.index+r.length)))){this.index+=n;const a=this.gobbleToken();return a||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:Ne.UNARY_EXP,operator:r,argument:a,prefix:!0})}r=r.substr(0,--n)}Ne.isIdentifierStart(t)?(o=this.gobbleIdentifier(),Ne.literals.hasOwnProperty(o.name)?o={type:Ne.LITERAL,value:Ne.literals[o.name],raw:o.name}:o.name===Ne.this_str&&(o={type:Ne.THIS_EXP})):t===Ne.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let r=this.code;for(;r===Ne.PERIOD_CODE||r===Ne.OBRACK_CODE||r===Ne.OPAREN_CODE||r===Ne.QUMARK_CODE;){let n;if(r===Ne.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==Ne.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),r=this.code}this.index++,r===Ne.OBRACK_CODE?(t={type:Ne.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),r=this.code,r!==Ne.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):r===Ne.OPAREN_CODE?t={type:Ne.CALL_EXP,arguments:this.gobbleArguments(Ne.CPAREN_CODE),callee:t}:(r===Ne.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),t={type:Ne.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),n&&(t.optional=!0),this.gobbleSpaces(),r=this.code}return t}gobbleNumericLiteral(){let t="",r,n;for(;Ne.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===Ne.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);Ne.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(r=this.char,r==="e"||r==="E"){for(t+=this.expr.charAt(this.index++),r=this.char,(r==="+"||r==="-")&&(t+=this.expr.charAt(this.index++));Ne.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);Ne.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return n=this.code,Ne.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(n===Ne.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===Ne.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:Ne.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const r=this.index,n=this.expr.charAt(this.index++);let o=!1;for(;this.index<this.expr.length;){let a=this.expr.charAt(this.index++);if(a===n){o=!0;break}else if(a==="\\")switch(a=this.expr.charAt(this.index++),a){case"n":t+=`
202
+ `;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=a}else t+=a}return o||this.throwError('Unclosed quote after "'+t+'"'),{type:Ne.LITERAL,value:t,raw:this.expr.substring(r,this.index)}}gobbleIdentifier(){let t=this.code,r=this.index;for(Ne.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,Ne.isIdentifierPart(t));)this.index++;return{type:Ne.IDENTIFIER,name:this.expr.slice(r,this.index)}}gobbleArguments(t){const r=[];let n=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===t){n=!0,this.index++,t===Ne.CPAREN_CODE&&o&&o>=r.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(a===Ne.COMMA_CODE){if(this.index++,o++,o!==r.length){if(t===Ne.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===Ne.CBRACK_CODE)for(let i=r.length;i<o;i++)r.push(null)}}else if(r.length!==o&&o!==0)this.throwError("Expected comma");else{const i=this.gobbleExpression();(!i||i.type===Ne.COMPOUND)&&this.throwError("Expected comma"),r.push(i)}}return n||this.throwError("Expected "+String.fromCharCode(t)),r}gobbleGroup(){this.index++;let t=this.gobbleExpressions(Ne.CPAREN_CODE);if(this.code===Ne.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:Ne.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:Ne.ARRAY_EXP,elements:this.gobbleArguments(Ne.CBRACK_CODE)}}}const Eke=new wke;Object.assign(Ne,{hooks:Eke,plugins:new jke(Ne),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});Ne.max_unop_len=Ne.getMaxKeyLen(Ne.unary_ops);Ne.max_binop_len=Ne.getMaxKeyLen(Ne.binary_ops);const pi=e=>new Ne(e).parse(),Nke=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(Ne).filter(e=>!Nke.includes(e)&&pi[e]===void 0).forEach(e=>{pi[e]=Ne[e]});pi.Jsep=Ne;const Ske="ConditionalExpression";var Oke={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const o=this.gobbleExpression();if(o||this.throwError("Expected expression"),t.node={type:Ske,test:r,consequent:n,alternate:o},r.operator&&e.binary_ops[r.operator]<=.9){let a=r;for(;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=r}}else this.throwError("Expected :")}})}};pi.plugins.register(Oke);const DA=47,Cke=92;var Pke={name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(this.code===DA){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(this.code===DA&&!n){const o=this.expr.slice(r,this.index);let a="";for(;++this.index<this.expr.length;){const s=this.code;if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57)a+=this.char;else break}let i;try{i=new RegExp(o,a)}catch(s){this.throwError(s.message)}return t.node={type:e.LITERAL,value:i,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=this.code===Cke?2:1}this.throwError("Unclosed Regex")}})}};const Hk=43,Ake=45,ql={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[Hk,Ake],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];ql.assignmentOperators.forEach(n=>e.addBinaryOp(n,ql.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(n){const o=this.code;ql.updateOperators.some(a=>a===o&&a===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:o===Hk?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!n.node.argument||!t.includes(n.node.argument.type))&&this.throwError(`Unexpected ${n.node.operator}`))}),e.hooks.add("after-token",function(n){if(n.node){const o=this.code;ql.updateOperators.some(a=>a===o&&a===this.expr.charCodeAt(this.index+1))&&(t.includes(n.node.type)||this.throwError(`Unexpected ${n.node.operator}`),this.index+=2,n.node={type:"UpdateExpression",operator:o===Hk?"++":"--",argument:n.node,prefix:!1})}}),e.hooks.add("after-expression",function(n){n.node&&r(n.node)});function r(n){ql.assignmentOperators.has(n.operator)?(n.type="AssignmentExpression",r(n.left),r(n.right)):n.operator||Object.values(n).forEach(o=>{o&&typeof o=="object"&&r(o)})}}};pi.plugins.register(Pke,ql);pi.addUnaryOp("typeof");pi.addLiteral("null",null);pi.addLiteral("undefined",void 0);const Tke=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),kr={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return kr.evalBinaryExpression(e,t);case"Compound":return kr.evalCompound(e,t);case"ConditionalExpression":return kr.evalConditionalExpression(e,t);case"Identifier":return kr.evalIdentifier(e,t);case"Literal":return kr.evalLiteral(e,t);case"MemberExpression":return kr.evalMemberExpression(e,t);case"UnaryExpression":return kr.evalUnaryExpression(e,t);case"ArrayExpression":return kr.evalArrayExpression(e,t);case"CallExpression":return kr.evalCallExpression(e,t);case"AssignmentExpression":return kr.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(r,n)=>r||n(),"&&":(r,n)=>r&&n(),"|":(r,n)=>r|n(),"^":(r,n)=>r^n(),"&":(r,n)=>r&n(),"==":(r,n)=>r==n(),"!=":(r,n)=>r!=n(),"===":(r,n)=>r===n(),"!==":(r,n)=>r!==n(),"<":(r,n)=>r<n(),">":(r,n)=>r>n(),"<=":(r,n)=>r<=n(),">=":(r,n)=>r>=n(),"<<":(r,n)=>r<<n(),">>":(r,n)=>r>>n(),">>>":(r,n)=>r>>>n(),"+":(r,n)=>r+n(),"-":(r,n)=>r-n(),"*":(r,n)=>r*n(),"/":(r,n)=>r/n(),"%":(r,n)=>r%n()}[e.operator](kr.evalAst(e.left,t),()=>kr.evalAst(e.right,t))},evalCompound(e,t){let r;for(let n=0;n<e.body.length;n++){e.body[n].type==="Identifier"&&["var","let","const"].includes(e.body[n].name)&&e.body[n+1]&&e.body[n+1].type==="AssignmentExpression"&&(n+=1);const o=e.body[n];r=kr.evalAst(o,t)}return r},evalConditionalExpression(e,t){return kr.evalAst(e.test,t)?kr.evalAst(e.consequent,t):kr.evalAst(e.alternate,t)},evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral(e){return e.value},evalMemberExpression(e,t){const r=String(e.computed?kr.evalAst(e.property):e.property.name),n=kr.evalAst(e.object,t);if(n==null)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&Tke.has(r))throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);const o=n[r];return typeof o=="function"?o.bind(n):o},evalUnaryExpression(e,t){return{"-":r=>-kr.evalAst(r,t),"!":r=>!kr.evalAst(r,t),"~":r=>~kr.evalAst(r,t),"+":r=>+kr.evalAst(r,t),typeof:r=>typeof kr.evalAst(r,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(r=>kr.evalAst(r,t))},evalCallExpression(e,t){const r=e.arguments.map(n=>kr.evalAst(n,t));return kr.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const r=e.left.name,n=kr.evalAst(e.right,t);return t[r]=n,t[r]}};class Mke{constructor(t){this.code=t,this.ast=pi(this.code)}runInNewContext(t){const r=Object.assign(Object.create(null),t);return kr.evalAst(this.ast,r)}}function Li(e,t){return e=e.slice(),e.push(t),e}function uj(e,t){return t=t.slice(),t.unshift(e),t}class _ke extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}}function ir(e,t,r,n,o){if(!(this instanceof ir))try{return new ir(e,t,r,n,o)}catch(i){if(!i.avoidNew)throw i;return i.value}typeof e=="string"&&(o=n,n=r,r=t,t=e,e=null);const a=e&&typeof e=="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors>"u"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){const i={path:a?e.path:t};a?"json"in e&&(i.json=e.json):i.json=r;const s=this.evaluate(i);if(!s||typeof s!="object")throw new _ke(s);return s}}ir.prototype.evaluate=function(e,t,r,n){let o=this.parent,a=this.parentProperty,{flatten:i,wrap:s}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),i=Object.hasOwn(e,"flatten")?e.flatten:i,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,s=Object.hasOwn(e,"wrap")?e.wrap:s,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=Object.hasOwn(e,"parent")?e.parent:o,a=Object.hasOwn(e,"parentProperty")?e.parentProperty:a,e=e.path}if(o=o||null,a=a||null,Array.isArray(e)&&(e=ir.toPathString(e)),!e&&e!==""||!t)return;const u=ir.toPathArray(e);u[0]==="$"&&u.length>1&&u.shift(),this._hasParentSelector=null;const c=this._trace(u,t,["$"],o,a,r).filter(function(d){return d&&!d.isParentSelector});return c.length?!s&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce((d,f)=>{const h=this._getPreferredOutput(f);return i&&Array.isArray(h)?d=d.concat(h):d.push(h),d},[]):s?[]:void 0};ir.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const r=Array.isArray(e.path)?e.path:ir.toPathArray(e.path);return e.pointer=ir.toPointer(r),e.path=typeof e.path=="string"?e.path:ir.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return ir.toPathString(e[t]);case"pointer":return ir.toPointer(e.path);default:throw new TypeError("Unknown result type")}};ir.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:ir.toPathString(e.path),t(n,r,e)}};ir.prototype._trace=function(e,t,r,n,o,a,i,s){let u;if(!e.length)return u={path:r,value:t,parent:n,parentProperty:o,hasArrExpr:i},this._handleCallback(u,a,"value"),u;const c=e[0],d=e.slice(1),f=[];function h(p){Array.isArray(p)?p.forEach(g=>{f.push(g)}):f.push(p)}if((typeof c!="string"||s)&&t&&Object.hasOwn(t,c))h(this._trace(d,t[c],Li(r,c),t,c,a,i));else if(c==="*")this._walk(t,p=>{h(this._trace(d,t[p],Li(r,p),t,p,a,!0,!0))});else if(c==="..")h(this._trace(d,t,r,n,o,a,i)),this._walk(t,p=>{typeof t[p]=="object"&&h(this._trace(e.slice(),t[p],Li(r,p),t,p,a,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(c==="~")return u={path:Li(r,c),value:o,parent:n,parentProperty:null},this._handleCallback(u,a,"property"),u;if(c==="$")h(this._trace(d,t,r,null,null,a,i));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c))h(this._slice(c,d,t,r,n,o,a));else if(c.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const p=c.replace(/^\?\((.*?)\)$/u,"$1"),g=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(p);g?this._walk(t,b=>{const v=[g[2]],x=g[1]?t[b][g[1]]:t[b];this._trace(v,x,r,n,o,a,!0).length>0&&h(this._trace(d,t[b],Li(r,b),t,b,a,!0))}):this._walk(t,b=>{this._eval(p,t[b],b,r,n,o)&&h(this._trace(d,t[b],Li(r,b),t,b,a,!0))})}else if(c[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(uj(this._eval(c,t,r.at(-1),r.slice(0,-1),n,o),d),t,r,n,o,a,i))}else if(c[0]==="@"){let p=!1;const g=c.slice(1,-2);switch(g){case"scalar":(!t||!["object","function"].includes(typeof t))&&(p=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===g&&(p=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(p=!0);break;case"number":Number.isFinite(t)&&(p=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(p=!0);break;case"object":t&&typeof t===g&&(p=!0);break;case"array":Array.isArray(t)&&(p=!0);break;case"other":p=this.currOtherTypeCallback(t,r,n,o);break;case"null":t===null&&(p=!0);break;default:throw new TypeError("Unknown value type "+g)}if(p)return u={path:r,value:t,parent:n,parentProperty:o},this._handleCallback(u,a,"value"),u}else if(c[0]==="`"&&t&&Object.hasOwn(t,c.slice(1))){const p=c.slice(1);h(this._trace(d,t[p],Li(r,p),t,p,a,i,!0))}else if(c.includes(",")){const p=c.split(",");for(const g of p)h(this._trace(uj(g,d),t,r,n,o,a,!0))}else!s&&t&&Object.hasOwn(t,c)&&h(this._trace(d,t[c],Li(r,c),t,c,a,i,!0))}if(this._hasParentSelector)for(let p=0;p<f.length;p++){const g=f[p];if(g&&g.isParentSelector){const b=this._trace(g.expr,t,g.path,n,o,a,i);if(Array.isArray(b)){f[p]=b[0];const v=b.length;for(let x=1;x<v;x++)p++,f.splice(p,0,b[x])}else f[p]=b}}return f};ir.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let n=0;n<r;n++)t(n)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})};ir.prototype._slice=function(e,t,r,n,o,a,i){if(!Array.isArray(r))return;const s=r.length,u=e.split(":"),c=u[2]&&Number.parseInt(u[2])||1;let d=u[0]&&Number.parseInt(u[0])||0,f=u[1]&&Number.parseInt(u[1])||s;d=d<0?Math.max(0,d+s):Math.min(s,d),f=f<0?Math.max(0,f+s):Math.min(s,f);const h=[];for(let p=d;p<f;p+=c)this._trace(uj(p,t),r,n,o,a,i,!0).forEach(g=>{h.push(g)});return h};ir.prototype._eval=function(e,t,r,n,o,a){this.currSandbox._$_parentProperty=a,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const i=e.includes("@path");i&&(this.currSandbox._$_path=ir.toPathString(n.concat([r])));const s=this.currEval+"Script:"+e;if(!ir.cache[s]){let u=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(i&&(u=u.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)ir.cache[s]=new this.safeVm.Script(u);else if(this.currEval==="native")ir.cache[s]=new this.vm.Script(u);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const c=this.currEval;ir.cache[s]=new c(u)}else if(typeof this.currEval=="function")ir.cache[s]={runInNewContext:c=>this.currEval(u,c)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return ir.cache[s].runInNewContext(this.currSandbox)}catch(u){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+u.message+": "+e)}};ir.cache={};ir.toPathString=function(e){const t=e,r=t.length;let n="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(n+=/^[0-9*]+$/u.test(t[o])?"["+t[o]+"]":"['"+t[o]+"']");return n};ir.toPointer=function(e){const t=e,r=t.length;let n="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(n+="/"+t[o].toString().replaceAll("~","~0").replaceAll("/","~1"));return n};ir.toPathArray=function(e){const{cache:t}=ir;if(t[e])return t[e].concat();const r=[],n=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(o,a){return"[#"+(r.push(a)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(o,a){return"['"+a.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(o,a){return";"+a.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(o){const a=o.match(/#(\d+)/u);return!a||!a[1]?o:r[a[1]]});return t[e]=n,t[e].concat()};ir.prototype.safeVm={Script:Mke};const Ike=function(e,t,r){const n=e.length;for(let o=0;o<n;o++){const a=e[o];r(a)&&t.push(e.splice(o--,1)[0])}};class Dke{constructor(t){this.code=t}runInNewContext(t){let r=this.code;const n=Object.keys(t),o=[];Ike(n,o,u=>typeof t[u]=="function");const a=n.map(u=>t[u]);r=o.reduce((u,c)=>{let d=t[c].toString();return/function/u.test(d)||(d="function "+d),"var "+c+"="+d+";"+u},"")+r,!/(['"])use strict\1/u.test(r)&&!n.includes("arguments")&&(r="var arguments = undefined;"+r),r=r.replace(/;\s*$/u,"");const i=r.lastIndexOf(";"),s=i!==-1?r.slice(0,i+1)+" return "+r.slice(i+1):" return "+r;return new Function(...n,s)(...a)}}ir.prototype.vm={Script:Dke};const LA={label:"Inspectr Operation",value:"$",description:"Root object containing the captured request, response, and metadata.",children:[{label:"Version",value:"$.version",description:"Inspectr payload version string."},{label:"Operation ID",value:"$.operation_id",description:"Unique identifier assigned to the captured operation."},{label:"Correlation ID",value:"$.correlation_id",description:"Correlation identifier propagated between services."},{label:"Request",value:"$.request",description:"Incoming HTTP request information.",children:[{label:"Method",value:"$.request.method"},{label:"URL",value:"$.request.url"},{label:"Path",value:"$.request.path"},{label:"Server",value:"$.request.server"},{label:"Client IP",value:"$.request.client_ip"},{label:"HTTP Version",value:"$.request.http_version"},{label:"Headers Size",value:"$.request.headers_size"},{label:"Headers",value:"$.request.headers",description:"Array of request headers as name/value pairs.",children:[{label:"Header Name",value:"$.request.headers[*].name"},{label:"Header Value",value:"$.request.headers[*].value"}]},{label:"Query Parameters",value:"$.request.query_params",description:"Array of query parameters as name/value pairs.",children:[{label:"Query Param Name",value:"$.request.query_params[*].name"},{label:"Query Param Value",value:"$.request.query_params[*].value"}]},{label:"Cookies",value:"$.request.cookies",description:"Array of request cookies.",children:[{label:"Cookie Name",value:"$.request.cookies[*].name"},{label:"Cookie Value",value:"$.request.cookies[*].value"}]},{label:"Body",value:"$.request.body"},{label:"Body Size",value:"$.request.body_size"},{label:"Timestamp",value:"$.request.timestamp"}]},{label:"Response",value:"$.response",description:"Outgoing HTTP response information.",children:[{label:"Status Code",value:"$.response.status"},{label:"Status Text",value:"$.response.status_text"},{label:"HTTP Version",value:"$.response.http_version"},{label:"Headers Size",value:"$.response.headers_size"},{label:"Headers",value:"$.response.headers",description:"Array of response headers as name/value pairs.",children:[{label:"Header Name",value:"$.response.headers[*].name"},{label:"Header Value",value:"$.response.headers[*].value"}]},{label:"Cookies",value:"$.response.cookies",description:"Array of response cookies.",children:[{label:"Cookie Name",value:"$.response.cookies[*].name"},{label:"Cookie Value",value:"$.response.cookies[*].value"}]},{label:"Body",value:"$.response.body"},{label:"Body Size",value:"$.response.body_size"},{label:"Timestamp",value:"$.response.timestamp"},{label:"Event Frames",value:"$.response.event_frames",description:"Server-sent events captured during the operation.",children:[{label:"Frame ID",value:"$.response.event_frames[*].id"},{label:"Frame Event",value:"$.response.event_frames[*].event"},{label:"Frame Data",value:"$.response.event_frames[*].data"},{label:"Frame Timestamp",value:"$.response.event_frames[*].timestamp"}]}]},{label:"Timing",value:"$.timing",description:"Timing metrics for the operation lifecycle.",children:[{label:"Request Timestamp",value:"$.timing.request"},{label:"Response Timestamp",value:"$.timing.response"},{label:"Duration (ms)",value:"$.timing.duration"}]},{label:"Meta",value:"$.meta",description:"Additional metadata captured alongside the operation.",children:[{label:"Proxy",value:"$.meta.proxy",children:[{label:"Instance",value:"$.meta.proxy.instance"},{label:"URL",value:"$.meta.proxy.url"}]},{label:"Ingress",value:"$.meta.ingress",children:[{label:"Headers",value:"$.meta.ingress.headers",description:"Map of ingress headers preserved by Inspectr.",children:[{label:"Header Value by Name",value:'$.meta.ingress.headers["Header-Name"]',description:"Replace Header-Name with the ingress header key."}]}]},{label:"Inspectr",value:"$.meta.inspectr",children:[{label:"Directives",value:"$.meta.inspectr.directives",description:"Map of Inspectr directive headers.",children:[{label:"Directive by Name",value:'$.meta.inspectr.directives["directive-name"]',description:"Replace directive-name with the directive key."}]},{label:"Guard",value:"$.meta.inspectr.guard",description:"Map of Inspectr Guard headers.",children:[{label:"Guard Header by Name",value:'$.meta.inspectr.guard["guard-name"]',description:"Replace guard-name with the guard header key."}]}]},{label:"Tags",value:"$.meta.tags",description:"Array of user-defined tags applied to the operation.",children:[{label:"Tag Value",value:"$.meta.tags[*]"}]}]}]};function Lke(e){const t=[],r=n=>{n&&(n.value&&t.push({value:n.value,label:n.label,description:n.description||""}),n.children&&n.children.length>0&&n.children.forEach(o=>r(o)))};return r(e),t}const RA=Object.freeze({results:[],totalCount:0});function Rke(e=10){const t=typeof e=="number"&&e>0?e:10,r=ba(()=>Nn.queryEvents({sort:{field:"time",order:"desc"},page:1,pageSize:t}),[t],RA)||RA,n=Array.isArray(r.results)?r.results:[],o=typeof r.totalCount=="number"?r.totalCount:0;return{results:n,totalCount:o}}const FA=e=>{if(typeof e!="string")return e;const t=e.trim();if(t===""||!(t.startsWith("{")||t.startsWith("[")))return e;try{return JSON.parse(t)}catch{return e}},Fke=e=>{if(!e||typeof e!="object")return e;const t={...e};if(e.request&&typeof e.request=="object"&&(t.request={...e.request},"body"in e.request)){const r=FA(e.request.body);r!==e.request.body&&(t.request.body=r,t.request.__rawBody=e.request.body)}if(e.response&&typeof e.response=="object"&&(t.response={...e.response},"body"in e.response)){const r=FA(e.response.body);r!==e.response.body&&(t.response.body=r,t.response.__rawBody=e.response.body)}return t};function pR(e,t,r=0){return e?e.map(n=>{const o=`${n.value||n.label}-${r}`,a=n.children&&n.children.length>0,i=`${r*12}px`;return l.jsxs("div",{className:"space-y-1",style:{paddingLeft:i},children:[l.jsxs("button",{type:"button",onClick:()=>n.value&&t(n.value),className:`flex w-full flex-col items-start rounded-md px-2 py-1 text-left text-sm transition hover:bg-blue-50 hover:text-blue-600 focus:bg-blue-100 focus:text-blue-700 focus:outline-none dark:hover:bg-blue-500/10 dark:hover:text-blue-300 dark:focus:bg-blue-500/20 dark:focus:text-blue-200 ${n.value?"":"cursor-default text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400"}`,disabled:!n.value,children:[l.jsx("span",{children:n.label}),n.description&&n.value&&l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:n.description})]}),a&&pR(n.children,t,r+1)]},o)}):null}function hR({id:e,value:t,onChange:r,placeholder:n="$.request.path",inputClassName:o="",browseButtonLabel:a="Browse paths",className:i="",disabled:s=!1,enablePreview:u=!1}){const c=m.useId(),d=e||`json-path-input-${c}`,f=`${d}-options`,[h,p]=m.useState(!1),[g,b]=m.useState(""),[v,x]=m.useState(!1),[k,E]=m.useState(""),[j,S]=m.useState(null),[C,O]=m.useState(0),[M,A]=m.useState(""),[T,_]=m.useState(!1),F=typeof t=="string"?t.trim():"",{results:$}=Rke(8),I=m.useMemo(()=>Lke(LA),[]),R=m.useMemo(()=>{const q=g.trim().toLowerCase();return q?I.filter(U=>U.value.toLowerCase().includes(q)||U.label&&U.label.toLowerCase().includes(q)||U.description&&U.description.toLowerCase().includes(q)):I},[I,g]),W=q=>{q&&(r&&r(q),p(!1))};m.useEffect(()=>{var q;if(!u||!v||!$.length)return;const U=(q=$[0])==null?void 0:q.id;U&&E(H=>H||U)},[u,v,$]),m.useEffect(()=>{if(!u||!v)return;if(!F){S(null),O(0),A(""),_(!1);return}if(!k){S(null),O(0),A("Select an operation to preview"),_(!1);return}const q=$.find(U=>U.id===k);if(!q){S(null),O(0),A("Selected operation is no longer available"),_(!1);return}_(!0);try{const U=Fke(q),H=ir({path:F,json:U}),X=Array.isArray(H)?H:[H],Y=X.length;O(Y),S(Y===0?null:Y===1?X[0]:X),A("")}catch(U){S(null),O(0),A(U?.message||"Failed to evaluate JSON path")}finally{_(!1)}},[u,v,F,k,$]),m.useEffect(()=>{u||x(!1)},[u]);const B=()=>{if(!F)return l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Enter a JSON path to preview the matching values."});if(!$.length)return l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No recent operations available. Capture traffic to preview JSON path results."});if(M)return l.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-600 dark:border-red-900 dark:bg-red-950/40 dark:text-red-300",children:M});if(T)return l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Evaluating JSON path…"});if(C===0||j===null||typeof j>"u")return l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"No results found for this JSON path in the selected operation."});const q=(()=>{if(typeof j=="string")return j;if(typeof j=="number"||typeof j=="boolean")return String(j);try{return JSON.stringify(j,null,2)}catch{return String(j)}})();return l.jsxs("div",{className:"space-y-2",children:[C>1&&l.jsxs("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:["Found ",C," matches."]}),l.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-gray-200 bg-gray-50 p-3 text-xs text-gray-800 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100",children:q})]})},L=$.map(q=>{var U,H,X,Y,ae;const te=((U=q?.request)==null?void 0:U.method)||"GET",me=((H=q?.request)==null?void 0:H.path)||((X=q?.request)==null?void 0:X.url)||"Unknown path",Q=(Y=q?.response)==null?void 0:Y.status,ue=(ae=q?.request)!=null&&ae.timestamp?new Date(q.request.timestamp).toLocaleString():"Unknown time",G=Q?`${Q}`:"N/A";return{id:q.id,label:`${te} ${me} • ${G} • ${ue}`}});return l.jsxs("div",{className:`space-y-2 ${i}`,children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("input",{id:d,list:f,value:t,onChange:q=>r&&r(q.target.value),placeholder:n,className:`block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30 ${o}`,onFocus:()=>!s&&b(""),autoComplete:"off",disabled:s}),l.jsx("datalist",{id:f,children:I.map(q=>l.jsx("option",{value:q.value,children:q.label},q.value))})]}),u&&l.jsx("button",{type:"button",onClick:()=>{s||x(q=>!q)},className:"inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800 dark:focus:border-blue-700 dark:focus:ring-blue-700/30 disabled:cursor-not-allowed disabled:opacity-60",disabled:s,children:v?"Hide preview":"Preview"}),l.jsx("button",{type:"button",onClick:()=>{s||(p(q=>!q),b(""))},className:"inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800 dark:focus:border-blue-700 dark:focus:ring-blue-700/30 disabled:cursor-not-allowed disabled:opacity-60",disabled:s,children:a})]}),h&&!s&&l.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white p-3 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:[l.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[l.jsx("input",{type:"text",value:g,onChange:q=>b(q.target.value),placeholder:"Search JSON paths...",className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),l.jsx("button",{type:"button",onClick:()=>p(!1),className:"inline-flex items-center justify-center whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-sm font-medium text-gray-600 transition hover:bg-gray-100 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:"Close"})]}),l.jsx("div",{className:"max-h-64 space-y-1 overflow-y-auto pr-1 text-gray-800 dark:text-gray-100",children:g.trim()?R.length>0?R.map(q=>l.jsxs("button",{type:"button",onClick:()=>W(q.value),className:"flex w-full flex-col items-start rounded-md px-2 py-1 text-left text-sm transition hover:bg-blue-50 hover:text-blue-600 focus:bg-blue-100 focus:text-blue-700 focus:outline-none dark:hover:bg-blue-500/10 dark:hover:text-blue-300 dark:focus:bg-blue-500/20 dark:focus:text-blue-200",children:[l.jsx("span",{children:q.value}),q.label&&l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:q.label}),q.description&&l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-500",children:q.description})]},q.value)):l.jsx("p",{className:"px-2 py-4 text-sm text-gray-500 dark:text-gray-400",children:"No matches found."}):pR([LA],W)})]}),u&&v&&!s&&l.jsxs("div",{className:"space-y-3 rounded-lg border border-gray-200 bg-white p-3 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{htmlFor:`${d}-preview-operation`,className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Preview with operation"}),l.jsxs("select",{id:`${d}-preview-operation`,value:k,onChange:q=>E(q.target.value),className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:[l.jsx("option",{value:"",children:"Select an operation…"}),L.map(q=>l.jsx("option",{value:q.id,children:q.label},q.id))]})]}),l.jsx("div",{children:B()})]})]})}function $ke({id:e,descriptor:t,value:r,onChange:n,readOnly:o}){var a,i;if(!t||t.hidden)return null;const s=t.label||t.name,u=t.help||t.description,c=t.placeholder||"$.request.path",d=((a=t.meta)==null?void 0:a.browseLabel)||((i=t.meta)==null?void 0:i.browse_label)||"Browse paths",f=o??!!t.readonly,h=typeof r=="string"?r:r??"";return l.jsxs("div",{className:"space-y-1",children:[l.jsxs("label",{htmlFor:e,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[s,t.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]}),l.jsx(hR,{id:e,value:h,onChange:n,placeholder:c,browseButtonLabel:d,disabled:f,enablePreview:!0}),u&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:u})]})}function qk({id:e,descriptor:t,value:r,onChange:n,provider:o,className:a="",readOnly:i}){if(!t||t.hidden)return null;const s=t.type==="boolean"||t.input==="boolean",u=typeof t.type=="string"&&t.type.startsWith("array"),c=t.input==="single_select"&&Array.isArray(t.choices),d=t.input==="multi_select"&&Array.isArray(t.choices),f=t.type==="integer"||t.type==="number"||t.input==="number",h=t.type==="object"||t.input==="object",p=t.input==="password",g=t.input==="json_path";let b=xke;return s?b=pke:c?b=hke:d?b=gke:f?b=bke:u?b=vke:h?b=yke:p?b=kke:g&&(b=$ke),l.jsx("div",{className:a,children:l.jsx(b,{id:e,descriptor:t,value:r,onChange:n,provider:o,readOnly:i})})}function Bke({value:e,options:t=[],onChange:r,disabled:n=!1,className:o=""}){const a=Array.isArray(t)?t:[],i=a.length>0,s=e??"",u=c=>{r?.(c.target.value)};return l.jsx("select",{value:i?s:"",onChange:u,disabled:n||!i,className:o||"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:i?a.map(c=>l.jsx("option",{value:c.value,children:c.label},c.value)):l.jsx("option",{value:"",disabled:!0,children:"No operators available"})})}const $A="block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",zke="rounded-md border border-dashed border-gray-300 px-3 py-2 text-sm text-gray-500 dark:border-gray-700 dark:text-gray-400",Hke=e=>e===!0?"true":e===!1?"false":e===""||e===null||e===void 0?"true":String(e),qke=(e,t)=>e?t==="number"?"e.g. 100, 200":"Enter comma-separated values":t==="number"?"e.g. 200":"e.g. /api/payments";function Uke({value:e,valueType:t="string",valueRequired:r=!0,multiValue:n=!1,onChange:o,className:a,hintClassName:i}){return r?t==="boolean"?l.jsxs("select",{value:Hke(e),onChange:s=>o?.(s.target.value),className:a||$A,children:[l.jsx("option",{value:"true",children:"true"}),l.jsx("option",{value:"false",children:"false"})]}):l.jsx("input",{type:"text",value:e??"",onChange:s=>o?.(s.target.value),placeholder:qke(n,t),className:a||$A}):l.jsx("div",{className:i||zke,children:"This operator does not require a comparison value."})}const BA=({onMoveUp:e,onMoveDown:t,disableUp:r,disableDown:n})=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("button",{type:"button",onClick:e,disabled:r,"aria-label":"Move up",className:"inline-flex items-center justify-center rounded-md border border-gray-200 p-1 text-gray-500 transition hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:l.jsx("path",{d:"m18 15-6-6-6 6"})})}),l.jsx("button",{type:"button",onClick:t,disabled:n,"aria-label":"Move down",className:"inline-flex items-center justify-center rounded-md border border-gray-200 p-1 text-gray-500 transition hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:l.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),Vke=({form:e,events:t,selectedEventDescription:r,actionsCatalog:n,isEditing:o,saving:a,formErrors:i,onSubmit:s,onReset:u,onFieldChange:c,onConditionChange:d,onAddCondition:f,onRemoveCondition:h,onMoveCondition:p,onActionTypeChange:g,onActionParamChange:b,onAddAction:v,onRemoveAction:x,onMoveAction:k,operatorOptions:E,formId:j,hideFooter:S=!1})=>{const C=e.conditions.length>1,O=e.actions.length>1,M=Array.isArray(E)?E:[];return l.jsxs("form",{id:j,className:"space-y-6 rounded-lg border border-gray-200 bg-gray-50 p-4 shadow-sm dark:border-gray-800 dark:bg-[#090E1A]/60 sm:p-6",onSubmit:s,children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"rule-name",className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:o?"Edit Rule":"Rule Name"}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:o?"Update the selected rule and save your changes.":"Define a descriptive name for your rule."})]}),o&&l.jsx("span",{className:"inline-flex items-center rounded-full bg-blue-500/10 px-3 py-1 text-xs font-medium text-blue-600 dark:text-blue-400",children:"Editing"})]}),l.jsx("input",{id:"rule-name",type:"text",value:e.name,onChange:A=>c("name",A.target.value),placeholder:"E.g. Min. Transaction Amount USD",className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"rule-description",className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Description"}),l.jsx("textarea",{id:"rule-description",rows:3,value:e.description,onChange:A=>c("description",A.target.value),placeholder:"Optional summary for this automation rule",className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)_minmax(0,1fr)]",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"rule-event",className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Event Trigger"}),l.jsxs("select",{id:"rule-event",value:e.event,onChange:A=>c("event",A.target.value),className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:[t.length===0&&l.jsx("option",{value:"",children:"No events available"}),t.map(A=>l.jsx("option",{value:A.type,children:A.label||A.name||A.type},A.type))]}),t.length>0&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:r||"Select the event to monitor."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"rule-priority",className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Priority"}),l.jsx("input",{id:"rule-priority",type:"number",value:e.priority,onChange:A=>c("priority",A.target.value),className:"block w-full max-w-[7rem] rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30"})]}),l.jsxs("div",{className:"space-y-2 sm:justify-self-end",children:[l.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-50",children:"Activation"}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("input",{id:"rule-active",type:"checkbox",checked:e.active,onChange:A=>c("active",A.target.checked),className:"size-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900"}),l.jsx("label",{htmlFor:"rule-active",className:"text-sm text-gray-700 dark:text-gray-200",children:"Rule is active"})]})]})]}),l.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-[#090E1A]",children:[l.jsxs("div",{className:"border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[l.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Rule Flow"}),l.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:"Configure the event, matching conditions, and resulting actions."})]}),l.jsxs("div",{className:"space-y-6 px-4 py-5",children:[l.jsxs("div",{className:"rounded-lg border-l-4 border-orange-600 bg-orange-50/60 p-4 dark:border-orange-500 dark:bg-orange-500/10",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("span",{className:"flex aspect-square h-10 items-center justify-center rounded-lg bg-orange-600 dark:bg-orange-500","aria-hidden":"true",children:l.jsxs("svg",{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",className:"size-6 text-white",children:[l.jsx("path",{d:"M12 2v14"}),l.jsx("path",{d:"m19 9-7 7-7-7"}),l.jsx("circle",{cx:"12",cy:"21",r:"1"})]})}),l.jsxs("div",{className:"truncate",children:[l.jsx("h5",{className:"text-sm font-medium capitalize text-gray-900 dark:text-gray-50",children:"Event"}),l.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:"Select the operation event you want to monitor."})]})]}),l.jsxs("div",{className:"mt-4",children:[l.jsx("label",{className:"text-xs font-medium text-gray-900 dark:text-gray-200",htmlFor:"builder-event",children:"Event"}),l.jsx("select",{id:"builder-event",value:e.event,onChange:A=>c("event",A.target.value),className:"mt-2 block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#090E1A] dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:t.map(A=>l.jsx("option",{value:A.type,children:A.name||A.type},A.type))})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsx("h5",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Conditions"}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",htmlFor:"expression-type",children:"Condition Logic"}),l.jsx("select",{id:"expression-type",value:e.expressionType,onChange:A=>c("expressionType",A.target.value),className:"rounded-md border border-gray-300 bg-white px-3 py-2 text-xs text-gray-700 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:nke.map(A=>l.jsx("option",{value:A.value,children:A.label},A.value))})]})]}),e.conditions.map((A,T)=>{const _=M.find(I=>I.value===A.operator)||M[0],F=_?.valueRequired!==!1,$=_?.multiValue===!0;return l.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900",children:l.jsxs("div",{className:"flex items-start gap-4 px-4 py-4",children:[l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx("span",{className:"flex aspect-square h-10 items-center justify-center rounded-lg bg-sky-500","aria-hidden":"true",children:l.jsxs("svg",{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",className:"size-6 text-white",children:[l.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}),l.jsx("path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3"}),l.jsx("path",{d:"M9 11.2h5.7"})]})}),l.jsx(BA,{onMoveUp:()=>p(T,T-1),onMoveDown:()=>p(T,T+1),disableUp:!C||T===0,disableDown:!C||T===e.conditions.length-1})]}),l.jsxs("div",{className:"flex-1 space-y-3",children:[l.jsxs("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"JSON path"}),l.jsx(hR,{value:A.path,onChange:I=>d(T,"path",I),placeholder:"$.request.path",className:"!space-y-1",browseButtonLabel:"Browse",enablePreview:!0})]}),l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Operator"}),l.jsx(Bke,{value:A.operator,options:M,onChange:I=>d(T,"operator",I),disabled:a||M.length===0})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Value Type"}),l.jsx("select",{value:A.valueType,onChange:I=>d(T,"valueType",I.target.value),disabled:!F,className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:J0e.map(I=>l.jsx("option",{value:I.value,children:I.label},I.value))})]})]})]}),l.jsxs("div",{className:"grid gap-3 sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Compare value"}),l.jsx(Uke,{value:A.value,valueType:A.valueType,valueRequired:F,multiValue:$,onChange:I=>d(T,"value",I)})]}),l.jsx("div",{className:"flex flex-wrap items-end justify-end gap-2",children:l.jsx("button",{type:"button",onClick:()=>h(T),className:"inline-flex items-center gap-2 rounded-md border border-transparent px-3 py-2 text-xs font-medium text-red-600 transition hover:border-red-200 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60 dark:text-red-400 dark:hover:border-red-800 dark:hover:bg-red-900/30",disabled:e.conditions.length===1,children:"Remove"})})]})]})]})},T)}),l.jsxs("button",{type:"button",onClick:f,className:"inline-flex items-center gap-2 rounded-md border border-dashed border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:border-gray-400 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:border-gray-500 dark:hover:bg-gray-900",children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4","aria-hidden":"true",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add Condition"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("h5",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:"Actions"}),l.jsxs("button",{type:"button",onClick:v,className:"inline-flex items-center gap-2 rounded-md border border-transparent bg-blue-500 px-3 py-2 text-xs font-medium text-white transition hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-500",children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4","aria-hidden":"true",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add Action"]})]}),e.actions.map((A,T)=>{const _=n.find(R=>R.type===A.type),F=_||{params:[]},$=!_&&!!A.type,I=["overflow-hidden rounded-lg border bg-white shadow-sm dark:bg-gray-900",$?"border-amber-300 dark:border-amber-500/40":"border-gray-200 dark:border-gray-800"].join(" ");return l.jsx("div",{className:I,children:l.jsxs("div",{className:"flex items-start gap-4 px-4 py-4",children:[l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx("span",{className:"flex aspect-square h-10 items-center justify-center rounded-lg bg-emerald-500","aria-hidden":"true",children:l.jsxs("svg",{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",className:"size-6 text-white",children:[l.jsx("path",{d:"M22 12A10 10 0 1 1 12 2"}),l.jsx("path",{d:"M22 2 12 12"}),l.jsx("path",{d:"M16 2h6v6"})]})}),l.jsx(BA,{onMoveUp:()=>k(A.id,T-1),onMoveDown:()=>k(A.id,T+1),disableUp:!O||T===0,disableDown:!O||T===e.actions.length-1})]}),l.jsxs("div",{className:"flex-1 space-y-3",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[l.jsxs("div",{className:"flex-1 min-w-[180px] space-y-1",children:[l.jsx("label",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Action Type"}),l.jsxs("select",{value:A.type,onChange:R=>g(A.id,R.target.value),className:"block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm transition focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-50 dark:focus:border-blue-700 dark:focus:ring-blue-700/30",children:[n.length===0&&l.jsx("option",{value:"",children:"No actions available"}),$&&A.type&&l.jsx("option",{value:A.type,children:A.type}),n.map(R=>{const W=R.label||R.name,B=W&&W!==R.type?`${W} (${R.type})`:R.type;return l.jsx("option",{value:R.type,children:B},R.type)})]})]}),$&&l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"inline-flex items-center rounded-full bg-amber-100 px-2.5 py-1 text-xs font-medium text-amber-800 dark:bg-amber-500/10 dark:text-amber-200",children:"Connector disabled"})}),l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("button",{type:"button",onClick:()=>x(A.id),className:"inline-flex items-center gap-2 rounded-md border border-transparent px-3 py-2 text-xs font-medium text-red-600 transition hover:border-red-200 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-60 dark:text-red-400 dark:hover:border-red-800 dark:hover:bg-red-900/30",disabled:e.actions.length===1,children:"Remove"})})]}),F?.description&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:F.description}),$&&l.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:border-amber-500/30 dark:bg-amber-950/40 dark:text-amber-100",children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mt-0.5 size-4 flex-shrink-0","aria-hidden":"true",children:[l.jsx("path",{d:"M10.29 3.86 1.82 18a1 1 0 0 0 .86 1.5h18.64a1 1 0 0 0 .86-1.5L13.71 3.86a1 1 0 0 0-1.72 0Z"}),l.jsx("path",{d:"M12 9v4"}),l.jsx("path",{d:"M12 17h.01"})]}),l.jsxs("div",{children:[l.jsx("p",{className:"font-semibold",children:"Action unavailable"}),l.jsx("p",{className:"mt-1 text-amber-700 dark:text-amber-200/80",children:"This action is unavailable because its connector is disabled. The existing configuration is kept when you save, but the action will be skipped until the connector is enabled again."})]})]}),l.jsx("div",{className:"space-y-4",children:(F.params||[]).map(R=>{var W,B,L,q;if(R.hidden)return null;const U=`${A.id}-${R.name}`,H=(W=A.params)==null?void 0:W[R.name];R.type==="boolean"||R.input,typeof R.type=="string"&&R.type.startsWith("array"),R.input==="single_select"&&Array.isArray(R.choices),R.input==="multi_select"&&Array.isArray(R.choices),R.type==="integer"||R.type==="number"||R.input;const X=R.type==="object"||R.input==="object";R.input,R.readonly;const Y=l.jsxs("label",{htmlFor:U,className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:[R.label||R.name,R.required&&l.jsx("span",{className:"ml-1 text-red-500",children:"*"})]});if(X&&Array.isArray(R.variants)&&R.variants.length){const ae=(B=A.params)==null?void 0:B.provider,te=R.variants.find(Q=>Q.value===ae),me=H&&typeof H=="object"?H:{};return l.jsxs("div",{className:"space-y-2",children:[Y,ae?te?l.jsxs("div",{className:"space-y-3 rounded-md border border-gray-200 p-3 dark:border-gray-800",children:[te.description&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:te.description}),(te.params||[]).map(Q=>{var ue;if(Q.hidden)return null;const G=`${U}-${Q.name}`;Q.type==="boolean"||Q.input,Q.type==="integer"||Q.type==="number"||Q.input,typeof Q.type=="string"&&Q.type.startsWith("array"),Q.type==="object"||Q.input,Q.input==="single_select"&&Array.isArray(Q.choices),Q.input,Q.readonly;const de=me?.[Q.name],ie=V=>{b(A.id,R.name,{...me,[Q.name]:V})};return l.jsx(qk,{id:G,descriptor:Q,provider:(ue=A.params)==null?void 0:ue.provider,value:de,onChange:V=>ie(V)},Q.name)})]}):l.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:['No options available for provider "',ae,'".']}):l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:"Select a provider to configure options."}),(R.description||R.help)&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:R.description||R.help})]},R.name)}return X?l.jsx(qk,{id:U,descriptor:R,provider:(L=A.params)==null?void 0:L.provider,value:H,onChange:ae=>b(A.id,R.name,ae)},R.name):l.jsx(qk,{id:U,descriptor:R,provider:(q=A.params)==null?void 0:q.provider,value:H,onChange:ae=>b(A.id,R.name,ae)},R.name)})})]})]})},A.id)}),l.jsxs("button",{type:"button",onClick:v,className:"inline-flex items-center gap-2 rounded-md border border-dashed border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:border-gray-400 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:border-gray-500 dark:hover:bg-gray-900",children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4","aria-hidden":"true",children:[l.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),l.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add Action"]})]})]})]}),i.length>0&&l.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/30 dark:text-red-300",children:l.jsx("ul",{className:"list-disc space-y-1 pl-4",children:i.map((A,T)=>l.jsx("li",{children:A},T))})}),!S&&l.jsxs("div",{className:"sticky bottom-0 z-10 -mx-4 -mb-4 flex items-center justify-end gap-3 border-t border-gray-200 bg-gray-50/95 px-4 py-3 backdrop-blur supports-[backdrop-filter]:backdrop-blur dark:border-gray-800 dark:bg-[#090E1A]/95 sm:-mx-6 sm:px-6",children:[l.jsx("button",{type:"button",onClick:u,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:o?"Cancel edit":"Reset"}),l.jsx("button",{type:"submit",disabled:a,className:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-300 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-500 dark:hover:bg-blue-400",children:a?"Saving…":o?"Update Rule":"Save Rule"})]})]})};function Wke({open:e,title:t,description:r,onClose:n,children:o,footer:a=null,showFooter:i=!0,onReset:s,onSave:u,saving:c=!1,isEditing:d=!1,formId:f}){return e?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:l.jsxs("div",{className:"flex max-h-[94vh] w-full max-w-[70%] flex-col overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:t}),r&&l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:r})]}),l.jsx("button",{type:"button",onClick:n,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close builder dialog",children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[l.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),l.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),l.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-4 sm:px-6",children:o}),(a||i)&&l.jsx("div",{className:"border-t border-gray-200 bg-gray-50 px-4 py-3 dark:border-gray-800 dark:bg-gray-900 sm:px-6",children:a||l.jsxs("div",{className:"flex items-center justify-end gap-3",children:[s?l.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:d?"Cancel edit":"Reset"}):null,l.jsx("button",{type:f?"submit":"button",form:f,onClick:f?void 0:u,disabled:c,className:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-300 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-500 dark:hover:bg-blue-400",children:c?"Saving…":d?"Update Rule":"Save Rule"})]})})]})}):null}function Kke({open:e,groupedTemplates:t,loading:r,error:n,onClose:o,onRetry:a,onSelect:i}){const[s,u]=y.useState(null),[c,d]=y.useState("");y.useEffect(()=>{var p;if(!e){u(null),d("");return}if(t.length===0){u(null);return}t.some(g=>g.id===s)||u(((p=t[0])==null?void 0:p.id)??null)},[e,t,s]);const f=y.useMemo(()=>t.find(p=>p.id===s)??null,[t,s]),h=y.useMemo(()=>{if(!f)return[];if(!c.trim())return f.items;const p=c.toLowerCase();return f.items.filter(g=>{var b,v;const x=((b=g.name)==null?void 0:b.toLowerCase())??"",k=((v=g.description)==null?void 0:v.toLowerCase())??"";return x.includes(p)||k.includes(p)})},[f,c]);return e?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:l.jsxs("div",{className:"w-full max-w-5xl overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Start from a template"}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Choose a starter rule and customise it to fit your automation workflow."})]}),l.jsx("button",{type:"button",onClick:o,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close template dialog",children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[l.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),l.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),l.jsx("div",{className:"max-h-[80vh] overflow-y-auto px-4 py-6 sm:px-6",children:r?l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Loading templates…"}):n?l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:n}),l.jsx("button",{type:"button",onClick:a,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",children:"Try again"})]}):t.length===0?l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"No templates available right now."}):l.jsxs("div",{className:"grid gap-6 lg:grid-cols-[260px,1fr]",children:[l.jsxs("aside",{className:"space-y-4",children:[l.jsx("h4",{className:"text-sm font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:"Template groups"}),l.jsx("div",{className:"space-y-2",children:t.map(p=>{const g=p.id===s;return l.jsx("button",{type:"button",onClick:()=>{u(p.id),d("")},className:`w-full rounded-md border px-4 py-3 text-left transition ${g?"border-blue-500 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-900/30 dark:text-blue-100":"border-gray-200 bg-white text-gray-900 hover:border-blue-300 hover:bg-blue-50/60 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-100 dark:hover:border-blue-500/70 dark:hover:bg-blue-900/20"}`,children:l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-semibold",children:p.label}),p.description&&l.jsx("p",{className:"mt-1 text-xs text-gray-600 dark:text-gray-400",children:p.description})]}),l.jsx("span",{className:"rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-600 dark:bg-gray-800 dark:text-gray-300",children:p.items.length})]})},p.id)})})]}),l.jsxs("section",{className:"space-y-4",children:[l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold text-gray-900 dark:text-gray-50",children:f?.label??"Select a group"}),f?.description&&l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:f.description})]}),f&&l.jsxs("div",{className:"relative w-full sm:w-64",children:[l.jsx("label",{htmlFor:"template-search",className:"sr-only",children:"Search templates"}),l.jsx("input",{id:"template-search",type:"search",value:c,onChange:p=>d(p.target.value),placeholder:"Search templates",className:"w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm outline-none transition focus:border-blue-500 focus:ring-2 focus:ring-blue-500/40 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100"}),l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"pointer-events-none absolute right-3 top-1/2 size-4 -translate-y-1/2 text-gray-400 dark:text-gray-500","aria-hidden":"true",children:[l.jsx("circle",{cx:"11",cy:"11",r:"8"}),l.jsx("path",{d:"m21 21-3.6-3.6"})]})]})]}),f?h.length===0?l.jsx("div",{className:"rounded-md border border-dashed border-gray-300 p-6 text-center text-sm text-gray-600 dark:border-gray-700 dark:text-gray-400",children:"No templates match your search in this group."}):l.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:h.map(p=>{var g;return l.jsxs("div",{className:"flex h-full flex-col justify-between rounded-lg border border-gray-200 bg-white p-4 shadow-sm transition hover:border-blue-400 hover:shadow-md dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h5",{className:"text-base font-semibold text-gray-900 dark:text-gray-50",children:p.name}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:p.description}),l.jsxs("div",{className:"mt-3 space-y-1 text-xs text-gray-500 dark:text-gray-500",children:[l.jsxs("p",{children:[l.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:"Event:"})," ",p.event]}),l.jsxs("p",{children:[l.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:"Actions:"})," ",((g=p.actions)==null?void 0:g.length)||0]})]})]}),l.jsx("button",{type:"button",onClick:()=>i(p),className:"mt-4 inline-flex items-center justify-center rounded-md border border-transparent bg-blue-500 px-3 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-blue-600 dark:bg-blue-600 dark:hover:bg-blue-500",children:"Use template"})]},p.id)})}):l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Select a group to view its templates."})]})]})})]})}):null}function Yke({open:e,rule:t,onClose:r,onPreview:n,onApply:o,loading:a,applying:i,error:s,preview:u,previewType:c="preview",tagOptions:d=[]}){const f=()=>({since:"",until:"",methods:[],path:"",host:"",tagsAll:[],tagsAny:[],statuses:[]}),[h,p]=m.useState(f),[g,b]=m.useState(!1),v=m.useMemo(()=>{if(!Array.isArray(d))return[];const B=Array.from(new Set(d.filter(L=>typeof L=="string")));return B.sort((L,q)=>L.localeCompare(q)),B},[d]);m.useEffect(()=>{e&&(p(f()),b(!1))},[e,t?.id]);const x=B=>Array.isArray(B)?B.map(L=>L.trim()).filter(Boolean):[],k=B=>{const{name:L,value:q}=B.target;p(U=>({...U,[L]:q}))},E=B=>{const L=x(B).slice(0,1);p(q=>({...q,methods:L}))},j=B=>{p(L=>({...L,statuses:x(B)}))},S=B=>{p(L=>({...L,tagsAll:x(B)}))},C=B=>{p(L=>({...L,tagsAny:x(B)}))},O=()=>{p(f()),b(!1)},M=m.useMemo(()=>{var B,L,q,U,H,X;const Y=[];return h.since&&Y.push("Since"),h.until&&Y.push("Until"),(B=h.methods)!=null&&B.length&&Y.push("Method"),(L=h.statuses)!=null&&L.length&&Y.push("Status codes"),(q=h.path)!=null&&q.trim()&&Y.push("Path"),(U=h.host)!=null&&U.trim()&&Y.push("Host"),(H=h.tagsAll)!=null&&H.length&&Y.push("Tags (all)"),(X=h.tagsAny)!=null&&X.length&&Y.push("Tags (any)"),Y},[h]);m.useEffect(()=>{M.length>0&&b(!0)},[M.length]);const A=()=>{var B,L;const q=te=>{if(!te)return;const me=new Date(te);return Number.isNaN(me.getTime())?void 0:me},U=(Array.isArray(h.statuses)?h.statuses:[]).map(te=>Number(te)).filter(te=>Number.isFinite(te)),H=x(h.methods).map(te=>te.toUpperCase()),X=x(h.tagsAll),Y=x(h.tagsAny),ae=H[0];return{since:q(h.since),until:q(h.until),method:ae,path:((B=h.path)==null?void 0:B.trim())||void 0,host:((L=h.host)==null?void 0:L.trim())||void 0,tagsAll:X.length?X:void 0,tagsAny:Y.length?Y:void 0,statuses:U.length?U:void 0}},T=m.useMemo(()=>{if(!u)return[];const B=u.matches||u.operations||u.items||u.sample||u.sampled||u.preview||[];return Array.isArray(B)?B:[]},[u]),_=m.useMemo(()=>!u||typeof u!="object"?[]:[{key:"processed",label:"Processed",value:u.processed},{key:"matched",label:"Matched",value:u.matched},{key:"updated",label:"Updated",value:u.updated},{key:"duration_ms",label:"Duration (ms)",value:u.duration_ms}].filter(B=>B.value!==void 0&&B.value!==null),[u]),F=c==="apply",$=m.useMemo(()=>u?typeof u?.matched=="number"?u.matched>0:T.length>0:!1,[u,T]),I=F?"Apply results":"Preview summary",R=F?"Affected operations":"Preview matches",W=(B,L)=>{const q=B.method||B.req_method||B.http_method,U=B.path||B.req_path||B.url||B.request_path,H=B.status||B.res_status||B.http_status,X=B.time||B.ts||B.timestamp||B.at;return l.jsxs("li",{className:"rounded border border-gray-200 bg-white p-3 text-xs dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[q&&l.jsx("span",{className:"inline-flex items-center rounded bg-gray-100 px-2 py-0.5 font-medium text-gray-700 dark:bg-gray-800 dark:text-gray-300",children:q}),U&&l.jsx("span",{className:"truncate text-gray-800 dark:text-gray-200",children:U}),H!=null&&l.jsx("span",{className:"ml-auto inline-flex items-center rounded bg-gray-100 px-2 py-0.5 font-medium text-gray-700 dark:bg-gray-800 dark:text-gray-300",children:String(H)})]}),X&&l.jsx("div",{className:"mt-1 text-gray-500 dark:text-gray-400",children:String(X)}),!q&&!U&&!H&&l.jsx("pre",{className:"mt-2 overflow-auto text-[10px] leading-tight text-gray-600 dark:text-gray-400",children:JSON.stringify(B,null,2)})]},L)};return e?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:l.jsxs("div",{className:"w-full max-w-3xl overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:["Apply “",t?.name,"” to history"]}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Optionally set filters, review the results, then apply."})]}),l.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close",children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[l.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),l.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),l.jsxs("div",{className:"max-h-[80vh] overflow-auto p-4 sm:p-6",children:[l.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Filters (optional)"}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:M.length===0?"No filters applied. Inspectr will search across all stored operations.":`Active filters: ${M.join(", ")}`})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[M.length>0&&l.jsx("button",{type:"button",onClick:O,className:"rounded border border-gray-300 px-2 py-1 text-xs font-medium text-gray-600 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:"Clear filters"}),l.jsx("button",{type:"button",onClick:()=>b(B=>!B),className:"rounded border border-transparent bg-gray-100 px-2 py-1 text-xs font-medium text-gray-700 transition hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",children:g?"Hide filters":"Show filters"})]})]}),g&&l.jsxs("div",{className:"mt-4 grid grid-cols-1 gap-3 sm:grid-cols-2",children:[l.jsxs("label",{className:"text-xs text-gray-700 dark:text-gray-300",children:["Since",l.jsx("input",{type:"datetime-local",name:"since",value:h.since,onChange:k,className:"mt-1 w-full rounded border border-gray-300 bg-white p-2 text-sm dark:border-gray-700 dark:bg-gray-900"})]}),l.jsxs("label",{className:"text-xs text-gray-700 dark:text-gray-300",children:["Until",l.jsx("input",{type:"datetime-local",name:"until",value:h.until,onChange:k,className:"mt-1 w-full rounded border border-gray-300 bg-white p-2 text-sm dark:border-gray-700 dark:bg-gray-900"})]}),l.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300",children:[l.jsx("span",{children:"Method"}),l.jsx("div",{className:"mt-1",children:l.jsx(Ys,{options:c9,selected:h.methods,onChange:E,placeholder:"Select method",colorFn:mj})})]}),l.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300",children:[l.jsx("span",{children:"Status codes"}),l.jsx("div",{className:"mt-1",children:l.jsx(Ys,{options:d9,selected:h.statuses,onChange:j,placeholder:"Add status code...",colorFn:bf})})]}),l.jsxs("label",{className:"text-xs text-gray-700 dark:text-gray-300",children:["Path contains",l.jsx("input",{type:"text",name:"path",placeholder:"/api/users",value:h.path,onChange:k,className:"mt-1 w-full rounded border border-gray-300 bg-white p-2 text-sm dark:border-gray-700 dark:bg-gray-900"})]}),l.jsxs("label",{className:"text-xs text-gray-700 dark:text-gray-300",children:["Host",l.jsx("input",{type:"text",name:"host",placeholder:"api.example.com",value:h.host,onChange:k,className:"mt-1 w-full rounded border border-gray-300 bg-white p-2 text-sm dark:border-gray-700 dark:bg-gray-900"})]}),l.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300",children:[l.jsx("span",{children:"Tags (all)"}),l.jsx("div",{className:"mt-1",children:l.jsx(Ys,{options:v,selected:h.tagsAll,onChange:S,placeholder:"Add tag..."})})]}),l.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300",children:[l.jsx("span",{children:"Tags (any)"}),l.jsx("div",{className:"mt-1",children:l.jsx(Ys,{options:v,selected:h.tagsAny,onChange:C,placeholder:"Add tag..."})})]})]})]}),F&&!i&&!s&&l.jsx("div",{className:"mt-3 rounded border border-green-200 bg-green-50 px-3 py-2 text-xs text-green-700 dark:border-green-900 dark:bg-green-950/40 dark:text-green-300",children:"Rule applied to historical operations. Review the results below."}),s&&l.jsx("p",{className:"mt-3 text-sm text-red-600 dark:text-red-400",children:s}),l.jsxs("div",{className:"mt-4 flex w-full items-center justify-end gap-3",children:[l.jsx("button",{type:"button",onClick:()=>n(A()),disabled:a,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-900 transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-50 dark:hover:bg-gray-800",children:a?"Previewing…":"Preview matches"}),l.jsx("button",{type:"button",onClick:()=>o(A()),disabled:i,className:"inline-flex items-center rounded-md border border-transparent bg-blue-500 px-3 py-2 text-sm font-medium text-white shadow-sm transition hover:bg-blue-600 disabled:cursor-not-allowed disabled:opacity-70 dark:bg-blue-600 dark:hover:bg-blue-500",children:i?"Applying…":"Apply now"}),l.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",children:"Cancel"})]}),_.length>0&&l.jsxs("div",{className:"mt-6 space-y-2",children:[l.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:I}),l.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:_.map(B=>l.jsxs("div",{className:"flex items-center justify-between rounded border border-gray-200 bg-gray-50 px-4 py-3 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-400",children:B.label}),l.jsx("span",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:B.value})]},B.key))})]}),T.length>0&&l.jsxs("div",{className:"mt-6",children:[l.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-gray-50",children:R}),l.jsx("ul",{className:"mt-2 space-y-2",children:T.map(W)})]}),!a&&u&&!$&&l.jsx("p",{className:"mt-4 text-sm text-gray-500 dark:text-gray-400",children:"No matching operations found for the selected filters."})]})]})}):null}function Gke({onTagsUpdate:e}){const{client:t,setToast:r}=Er(),[n,o]=m.useState([]),[a,i]=m.useState(!0),[s,u]=m.useState(""),[c,d]=m.useState(!1),[f,h]=m.useState(null),[p,g]=m.useState(!1),[b,v]=m.useState(""),x=!!(t!=null&&t.operations),k=O=>{o(O),e?.(O)},E=async()=>{if(x)try{d(!0),u("");const O=await t.operations.listTags(),M=Array.isArray(O?.tags)?O.tags:[];M.sort((A,T)=>A.localeCompare(T)),k(M)}catch(O){console.error("Failed to refresh tags",O),u(O?.message||"Failed to refresh tags")}finally{d(!1)}};m.useEffect(()=>{if(!x)return;let O=!1;return(async()=>{try{i(!0);const M=await t.operations.listTags();if(O)return;const A=Array.isArray(M?.tags)?M.tags:[];A.sort((T,_)=>T.localeCompare(_)),k(A)}catch(M){if(O)return;console.error("Failed to load tags",M),u(M?.message||"Failed to load tags")}finally{O||i(!1)}})(),()=>{O=!0}},[x,t]);const j=O=>{h(O),v("")},S=()=>{h(null),v("")},C=async()=>{if(!(!f||!(t!=null&&t.operations)))try{g(!0),v("");const O=await t.operations.bulkDeleteTag({tag:f,dryRun:!1});r?.({type:"success",message:`Tag "${f}" removed from matching operations`}),h(null),E()}catch(O){console.error("Bulk delete tag failed",O),v(O?.message||"Failed to delete tag"),r?.({type:"error",message:O?.message||"Failed to delete tag"})}finally{g(!1)}};return l.jsxs("section",{className:"rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-base font-semibold text-gray-900 dark:text-gray-50",children:"Operation Tags"}),l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:"View and remove tags across operations."})]}),l.jsx("div",{className:"flex items-center gap-3",children:l.jsx("button",{type:"button",onClick:E,title:"Refresh tags",disabled:c||a,className:"inline-flex items-center rounded-md border border-gray-300 px-3 py-1.5 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-900",children:c?"Refreshing…":"Refresh"})})]}),l.jsxs("div",{className:"px-4 pt-2 pb-4",children:[s&&l.jsx("div",{className:"mb-3 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900/50 dark:bg-red-950 dark:text-red-300",children:s}),a?l.jsx("div",{className:"py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Loading tags…"}):n.length===0?l.jsx("div",{className:"py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"No tags found."}):l.jsx("ul",{className:"divide-y divide-gray-200 dark:divide-gray-800",children:n.map(O=>l.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[l.jsx("div",{className:"inline-flex items-center gap-2",children:l.jsx(cl,{tag:O})}),l.jsxs("button",{type:"button",onClick:()=>j(O),className:"inline-flex items-center gap-1 rounded-md border border-red-200 px-2.5 py-1.5 text-xs font-medium text-red-700 transition hover:bg-red-50 dark:border-red-900/40 dark:text-red-300 dark:hover:bg-red-950",title:`Remove tag "${O}" from operations`,children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"-ms-0.5",children:[l.jsx("path",{d:"M3 6h18"}),l.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),l.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),l.jsx("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),l.jsx("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]}),"Remove"]})]},O))})]}),l.jsx(lg,{open:!!f,isDeleting:p,error:b,onCancel:S,onConfirm:C,title:"Remove tag from operations?",description:f?l.jsxs(l.Fragment,{children:["This will remove the tag ",l.jsx("span",{className:"font-semibold",children:f})," from all matching operations. This action cannot be undone."]}):"",confirmLabel:"Delete Tag"})]})}function Xke({open:e,rule:t,onClose:r}){const{client:n,setToast:o}=Er(),[a,i]=m.useState(!1),[s,u]=m.useState(""),c=m.useMemo(()=>t?.name||"All rules",[t]);if(!e)return null;const d=async()=>{var f;if((f=n?.rules)!=null&&f.export){i(!0),u("");try{const{blob:h,filename:p}=await n.rules.export({id:t?.id}),g=URL.createObjectURL(h),b=document.createElement("a");b.href=g,b.download=p||"rules.yaml",document.body.appendChild(b),b.click(),b.remove(),URL.revokeObjectURL(g),o?.({type:"success",message:`Downloaded ${p||"rules.yaml"}`}),r?.()}catch(h){console.error("Export download failed",h),u(h?.message||"Failed to export rules")}finally{i(!1)}}};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:l.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Export rules"}),l.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Download YAML export",t!=null&&t.name?` for "${c}"`:"","."]}),t?.name&&l.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:["Rule: ",c]})]}),l.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close export dialog",children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[l.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),l.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),l.jsxs("div",{className:"space-y-4 px-4 py-4 sm:px-6",children:[s&&l.jsx("div",{className:"rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300",children:s}),l.jsx("div",{className:"flex items-center justify-end",children:l.jsx("button",{type:"button",onClick:d,disabled:a,className:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:opacity-60 focus:outline-none focus:ring-2 focus:ring-blue-300 dark:bg-blue-500 dark:hover:bg-blue-400",children:a?"Preparing…":"Download rules.yaml"})})]})]})})}function Zke({open:e,onCancel:t,onImport:r,onImported:n}){const{client:o,setToast:a}=Er(),[i,s]=m.useState(""),[u,c]=m.useState(null),[d,f]=m.useState(""),[h,p]=m.useState(!1),[g,b]=m.useState(!1);if(m.useEffect(()=>{e||(s(""),c(null),f(""),p(!1),b(!1))},[e]),!e)return null;const v=k=>{var E;const j=((E=k.target.files)==null?void 0:E[0])||null;c(j),f("")},x=async()=>{var k;if((k=o?.rules)!=null&&k.import){if(!u&&!i.trim()){f("Select a YAML file or paste YAML content.");return}p(!0),f("");try{let E=i;if(u)try{E=await new Response(u).text()}catch(C){console.error("Failed to read file",C),f("Could not read the selected file. Please reselect it or paste the YAML."),p(!1);return}const j=await o.rules.import(E,{overwrite:g}),S=j?.rule||(Array.isArray(j?.rules)?j.rules[0]:null);if(a?.({type:"success",message:"Import completed"}),n)try{await n()}catch{}S&&r&&r(S),t?.()}catch(E){console.error("Import failed",E),f(E?.message||"Failed to import rules")}finally{p(!1)}}};return l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 !mt-0",children:l.jsxs("div",{className:"w-full max-w-xl overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-gray-200 px-4 py-4 dark:border-gray-800 sm:px-6",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"Import rules"}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Upload a .yaml export or paste YAML content."})]}),l.jsx("button",{type:"button",onClick:t,className:"inline-flex items-center rounded-md border border-gray-300 p-2 text-gray-500 transition hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800","aria-label":"Close import dialog",children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:[l.jsx("line",{x1:"18",x2:"6",y1:"6",y2:"18"}),l.jsx("line",{x1:"6",x2:"18",y1:"6",y2:"18"})]})})]}),l.jsxs("div",{className:"space-y-4 px-4 py-4 sm:px-6",children:[d&&l.jsx("div",{className:"rounded-md border border-red-300 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300",children:d}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("label",{htmlFor:"rule-import-file",className:"shrink-0 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:"YAML file"}),l.jsx("input",{id:"rule-import-file",type:"file",accept:".yaml,.yml,text/yaml,application/x-yaml,application/yaml",onChange:v,onClick:k=>{k.currentTarget.value=null},className:"block w-full text-sm text-gray-700 file:mr-3 file:rounded-md file:border file:border-gray-300 file:bg-white file:px-3 file:py-2 file:text-sm file:font-medium file:text-gray-700 hover:file:bg-gray-50 dark:text-gray-200 dark:file:border-gray-700 dark:file:bg-gray-900"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"rule-import-yaml",className:"text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:"Or paste YAML"}),l.jsx("textarea",{id:"rule-import-yaml",value:i,onChange:k=>s(k.target.value),rows:12,placeholder:`# name: Example rule
203
+ # event: ...
204
+ # expression:
205
+ # op: and
206
+ # args: ...`,className:"mt-2 block w-full rounded-md border border-gray-300 bg-white px-3 py-2 font-mono text-xs text-gray-800 shadow-inner focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-gray-800 dark:bg-[#0B101F] dark:text-gray-100 dark:focus:border-blue-700 dark:focus:ring-blue-800/50"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[l.jsx("input",{type:"checkbox",checked:g,onChange:k=>b(k.target.checked),className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-700 dark:bg-gray-900"}),"Overwrite existing rules"]}),l.jsxs("div",{className:"flex justify-end gap-3",children:[l.jsx("button",{type:"button",onClick:t,disabled:h,className:"inline-flex items-center rounded-md border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100 disabled:opacity-60 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800",children:"Cancel"}),l.jsx("button",{type:"button",onClick:x,disabled:h,className:"inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-blue-700 disabled:opacity-60 focus:outline-none focus:ring-2 focus:ring-blue-300 dark:bg-blue-500 dark:hover:bg-blue-400",children:h?"Importing…":"Import"})]})]})]})]})})}const Uk=(e,t,r)=>{var n;return{name:"",description:"",event:((n=e?.[0])==null?void 0:n.type)||"",priority:10,active:!0,expressionType:"and",conditions:[lj(r)],actions:t!=null&&t.length?[ld(t[0])]:[]}},Jke=(e,t,r=!1)=>{const n=o=>{if(t==="number"){const a=Number(o);return Number.isNaN(a)?o:a}return t==="boolean"?typeof o=="boolean"?o:typeof o=="string"?o==="true":!!o:o};return r?(Array.isArray(e)?e:ud(e)).map(o=>n(o)):n(e)};function Qke({route:e}){var t;const{client:r,setToast:n}=Er(),[o,a]=m.useState([]),[i,s]=m.useState(null),[u,c]=m.useState([]),[d,f]=m.useState([]),[h,p]=m.useState(!0),[g,b]=m.useState(!1),[v,x]=m.useState(""),[k,E]=m.useState(null),[j,S]=m.useState(!1),[C,O]=m.useState(null),M=m.useRef(!1),[A,T]=m.useState(!1),[_,F]=m.useState(null),[$,I]=m.useState(""),[R,W]=m.useState(!1),[B,L]=m.useState(!1),[q,U]=m.useState([]),[H,X]=m.useState([]),[Y,ae]=m.useState(!1),[te,me]=m.useState(""),[Q,ue]=m.useState(!1),[G,de]=m.useState(null),[ie,V]=m.useState(!1),[ee,ne]=m.useState(!1),[ge,Ee]=m.useState(""),[Pe,Ie]=m.useState(null),[nt,Me]=m.useState(null),[ot,Ge]=m.useState(!1),[at,mt]=m.useState(null),[Ke,pt]=m.useState(!1),[jt,Ze]=m.useState([]),[$e,ut]=m.useState(null),$t=m.useRef(null),St=m.useRef(null),An=(xe,we=1)=>{const De=Array.isArray(xe?.rules)?xe.rules:[];a(De);const Te=xe?.meta;if(Te&&typeof Te=="object"){const ct={...Te},ht=Number(ct.page??we);ct.page=Number.isFinite(ht)&&ht>0?ht:1,s(ct)}else s(null)},Zt=m.useRef(!0);m.useEffect(()=>()=>{Zt.current=!1},[]);const Jr=async(xe=1)=>{if(!(r!=null&&r.rules))return null;const we=Number(xe),De=Number.isFinite(we)&&we>0?we:1;try{return await r.rules.list({page:De})}catch(Te){if(De===1)return await r.rules.list();throw Te}},[Ye,jn]=m.useState([]),Wr=m.useMemo(()=>eke(Ye),[Ye]),Qn=m.useMemo(()=>tke(Ye),[Ye]),Be=m.useMemo(()=>rke(Ye),[Ye]),Kr=m.useMemo(()=>mR(Ye),[Ye]),[ur,Xe]=m.useState(()=>Uk([],[],Kr)),[Bt,Tt]=m.useState([]),Qr=m.useCallback(async()=>{var xe,we,De,Te;if(!((xe=r?.service)!=null&&xe.getLicense))return Zt.current&&ut(null),null;try{const ct=await r.service.getLicense();if(!Zt.current)return ct;const ht=(we=ct?.features)==null?void 0:we.rules,Ve=(Te=(De=ct?.usage)==null?void 0:De.features)==null?void 0:Te.rules,Mt=typeof ht?.effective_limit=="number"?ht.effective_limit:null,Or=typeof Ve?.used=="number"?Ve.used:null;return ut({limit:Mt,used:Or}),ct}catch(ct){return console.error("Failed to load license info",ct),Zt.current&&ut(null),null}},[r]);m.useEffect(()=>{Qr()},[Qr]),m.useEffect(()=>{if(!(r!=null&&r.rules))return;let xe=!1;return(async()=>{var we;try{p(!0);const[De,Te,ct,ht]=await Promise.all([Jr(1),r.rules.getEvents(),r.rules.getActions(),r.rules.getOperators()]);if(xe)return;An(De,((we=De?.meta)==null?void 0:we.page)??1),c(Te.events||[]),f(ct.actions||[]);const Ve=Array.isArray(ht)?ht:Array.isArray(ht?.operators)?ht.operators:[];jn(Q0e(Ve)),x("")}catch(De){if(xe)return;console.error("Failed to load rules",De),x(De?.message||"Failed to load rules")}finally{xe||p(!1)}})(),()=>{xe=!0}},[r]),m.useEffect(()=>{h||M.current||(Xe(Uk(u,d,Kr)),M.current=!0)},[h,u,d,Kr]),m.useEffect(()=>{if(!Array.isArray(Wr)||Wr.length===0)return;const xe=new Set(Wr.map(we=>we.value));Xe(we=>{var De;if(!((De=we?.conditions)!=null&&De.length))return we;let Te=!1;const ct=we.conditions.map(ht=>xe.has(ht.operator)?ht:(Te=!0,{...ht,operator:Kr}));return Te?{...we,conditions:ct}:we})},[Wr,Kr]),m.useEffect(()=>{const xe=typeof window<"u"?mi():{},we=e?.operationId||xe.operationId,De=e?.subTab||xe.subTab;if(!we||De!=="edit"){St.current=null;return}if(h)return;const Te=`${we}:edit`;if(St.current===Te&&!A||$t.current===Te&&A)return;let ct=!1;return(async()=>{var ht;let Ve=o.find(Mt=>String(Mt.id)===String(we));if(!Ve&&(ht=r?.rules)!=null&&ht.get)try{Ve=await r.rules.get(we)}catch(Mt){console.error("Failed to load rule for edit route",Mt)}ct||!Ve||(Xe(Nr(Ve)),O(Ve.id||we),Tt([]),T(!0),E(Ve.id||we),$t.current=Te)})(),()=>{ct=!0}},[e?.operationId,e?.subTab,h,o,r,A]);const Mr=m.useMemo(()=>u.reduce((xe,we)=>(xe[we.type]=we,xe),{}),[u]),tr=async(xe=i?.page||1)=>{if(!(r!=null&&r.rules))return null;const we=Number(xe),De=Number.isFinite(we)&&we>0?we:1;let Te=null;try{b(!0),Te=await Jr(De),An(Te,De),x("")}catch(ct){console.error("Failed to refresh rules",ct),x(ct?.message||"Failed to refresh rules")}finally{b(!1)}return Te},_n=async(xe=i?.page||1)=>{await Promise.all([tr(xe),Qr()])},Je=async xe=>{const we=Number(xe)||1;we!==(i?.page||1)&&await tr(we)},or=async xe=>{if(!(r!=null&&r.rules)||!(xe!=null&&xe.id))return;const we=!xe.active;try{await r.rules.update(xe.id,{...xe,active:we}),n?.({type:"success",message:`Rule "${xe.name||"Untitled"}" ${we?"activated":"paused"}`}),await tr()}catch(De){console.error("Toggle rule active failed",De),n?.({type:"error",message:De?.message||"Failed to update rule status"})}},Et=async()=>{var xe;try{ae(!0),me("");const[we,De]=await Promise.all([fetch("https://templates.inspectr.dev/api/rules/templates"),fetch("https://templates.inspectr.dev/api/rules/templates/group-types")]);if(!we.ok)throw new Error(`Template fetch failed (${we.status})`);if(!De.ok)throw new Error(`Group types fetch failed (${De.status})`);const Te=await we.json(),ct=await De.json();U(Array.isArray(Te)?Te:[]),X(Array.isArray(ct)?ct:[])}catch(we){console.error("Failed to load templates",we),we?.name==="TypeError"||(xe=we?.message)!=null&&xe.includes("Failed to fetch")?(me(""),L(!1),Lt(),O(null),Tt([]),T(!0),U([]),X([])):me(we?.message||"Failed to load templates")}finally{ae(!1)}},Lt=()=>{Xe(Uk(u,d,Kr)),Tt([]),O(null)},en=()=>{const xe=typeof window<"u"?mi():{},we=e?.operationId||xe.operationId,De=e?.subTab||xe.subTab;we&&De==="edit"&&(St.current=`${we}:edit`),T(!1),Lt()},Yr=(xe,we)=>{Xe(De=>({...De,[xe]:we}))},hr=(xe,we,De)=>{Xe(Te=>{const ct=Te.conditions.map((ht,Ve)=>{if(Ve!==xe)return ht;if(we==="valueType"){if(De==="boolean"){const Mt=ht.value==="false"?"false":"true";return{...ht,valueType:De,value:Mt}}if(ht.valueType==="boolean")return{...ht,valueType:De,value:""}}if(we==="operator"){const Mt=(Be[De]||{}).valueRequired!==!1,Or=Mt?ht.valueType:"string";let Rr=ht.value;return Mt?Or==="boolean"&&Rr===""&&(Rr="true"):Rr="",{...ht,operator:De,valueType:Or,value:Rr}}return{...ht,[we]:De}});return{...Te,conditions:ct}})},ke=(xe,we)=>{Xe(De=>({...De,conditions:IA(De.conditions,xe,we)}))},_e=()=>{Xe(xe=>({...xe,conditions:[...xe.conditions,lj(Kr)]}))},bt=xe=>{Xe(we=>{if(we.conditions.length===1)return we;const De=we.conditions.filter((Te,ct)=>ct!==xe);return{...we,conditions:De}})},Ot=xe=>d.find(we=>we.type===xe),st=()=>{Xe(xe=>{const we=d[0],De=we?ld(we):{id:cp(),type:"",params:{}};return{...xe,actions:[...xe.actions,De]}})},lt=xe=>{Xe(we=>we.actions.length===1?we:{...we,actions:we.actions.filter(De=>De.id!==xe)})},tn=(xe,we)=>{Xe(De=>({...De,actions:De.actions.map(Te=>{var ct;if(Te.id!==xe)return Te;const ht=Ot(we);if(!ht)return{...Te,type:we,definitionMissing:!!we,originalParams:Te.originalParams??Te.params??{}};const Ve=ld(ht);try{const Mt=(ht.params||[]).find(yt=>yt.name==="provider"),Or=(ht.params||[]).find(yt=>yt.name==="provider_options"),Rr=(ct=Ve.params)==null?void 0:ct.provider;if(Mt&&Or&&Array.isArray(Or.variants)){const yt=Or.variants.find(_t=>_t.value===Rr);if(yt){const _t=(yt.params||[]).reduce((Ut,br)=>(Ut[br.name]=sj(br),Ut),{});Ve.params.provider_options=_t}}}catch{}return{...Ve,id:xe,type:we}})}))},gr=(xe,we,De)=>{Xe(Te=>({...Te,actions:Te.actions.map(ct=>{var ht;if(ct.id!==xe)return ct;const Ve={...ct.params,[we]:De};if(we==="provider"){const Mt=Ot(ct.type),Or=(ht=Mt?.params)==null?void 0:ht.find(Rr=>Rr.name==="provider_options");if(Or&&Array.isArray(Or.variants)){const Rr=Or.variants.find(yt=>yt.value===De);Rr?Ve.provider_options=(Rr.params||[]).reduce((yt,_t)=>(yt[_t.name]=sj(_t),yt),{}):Ve.provider_options={}}else Ve.provider_options={}}return{...ct,params:Ve}})}))},cr=(xe,we)=>{Xe(De=>{const Te=De.actions.findIndex(ct=>ct.id===xe);return Te===-1?De:{...De,actions:IA(De.actions,Te,we)}})},Nr=xe=>{var we,De;const Te=String(((we=xe?.expression)==null?void 0:we.op)||"and").toLowerCase(),ct=Dh(xe?.expression),ht=ct.length?ct.map(yt=>{var _t;const Ut=yt.right;let br;Array.isArray(Ut)?Ut.every(Cr=>typeof Cr=="number")?br="number":Ut.every(Cr=>typeof Cr=="boolean")?br="boolean":br="string":br=ake(Ut);let Gr;return Array.isArray(Ut)?Gr=Ut.join(", "):br==="boolean"?Gr=Ut?"true":"false":Ut==null?Gr="":Gr=String(Ut),{path:((_t=yt.left)==null?void 0:_t.path)||"",operator:yt.op||"==",valueType:br,value:Gr}}):[lj(Kr)],Ve=(()=>{var yt;return(yt=xe?.actions)!=null&&yt.length?xe.actions.map(_t=>{const Ut=Ot(_t.type);if(!Ut){let Cr={};if(_t!=null&&_t.params&&typeof _t.params=="object")try{Cr=JSON.parse(JSON.stringify(_t.params))}catch{Cr={..._t.params}}return{id:cp(),type:_t.type||"",params:Cr,definitionMissing:!!_t.type,originalParams:Cr}}const br=ld(Ut),Gr={...br.params};return(Ut.params||[]).forEach(Cr=>{var an;const sn=(an=_t.params)==null?void 0:an[Cr.name];Cr.type==="boolean"?Gr[Cr.name]=sn===void 0?Gr[Cr.name]:ij(sn):typeof Cr.type=="string"&&Cr.type.startsWith("array")?Array.isArray(sn)?Gr[Cr.name]=sn.join(", "):Gr[Cr.name]=sn||"":Cr.type==="object"?sn&&typeof sn=="object"?Gr[Cr.name]=sn:Gr[Cr.name]={}:Gr[Cr.name]=sn==null?"":String(sn)}),{...br,id:cp(),type:_t.type||"",params:Gr}}):d.length?[ld(d[0])]:[]})(),Mt=xe?.event,Or=((De=u[0])==null?void 0:De.type)||"",Rr=u.some(yt=>yt.type===Mt)?Mt:Or;return{name:xe?.name||"",description:xe?.description||"",event:Rr,priority:xe?.priority??10,active:xe?.active!==!1,expressionType:Te,conditions:ht,actions:Ve}},In=()=>{const xe=[];return ur.name.trim()||xe.push("Rule name is required."),ur.event||xe.push("Select an event for the rule."),ur.conditions.forEach((we,De)=>{we.path.trim()||xe.push(`Condition ${De+1} is missing a data path.`);const Te=Be[we.operator]||{};Te.valueRequired!==!1&&(Te.multiValue?(Array.isArray(we.value)?we.value:ud(we.value)).length||xe.push(`Condition ${De+1} is missing a value.`):`${we.value}`.trim()===""&&xe.push(`Condition ${De+1} is missing a value.`))}),ur.conditions.length||xe.push("Add at least one condition."),ur.actions.length||xe.push("Add at least one action."),ur.actions.forEach(we=>{const De=Ot(we.type);if(!De){we.type||xe.push("Every action must have a type.");return}(De.params||[]).forEach(Te=>{var ct;const ht=(ct=we.params)==null?void 0:ct[Te.name];if(typeof Te.type=="string"&&Te.type.startsWith("array")){const Ve=ud(ht);!Te.readonly&&Te.required&&Ve.length===0&&xe.push(`${Te.name} is required for the ${we.type} action.`)}else if(Te.type==="string")!Te.readonly&&Te.required&&!`${ht??""}`.trim()&&xe.push(`${Te.name} is required for the ${we.type} action.`);else if(Te.type==="boolean")!Te.readonly&&Te.required&&typeof ht!="boolean"&&xe.push(`${Te.name} must be toggled for the ${we.type} action.`);else if(Te.type==="integer"||Te.type==="number"){const Ve=Number(ht);!Te.readonly&&Te.required&&!Number.isFinite(Ve)&&xe.push(`${Te.name} must be a valid ${Te.type} for the ${we.type} action.`)}else if(Te.type==="object"&&Te.required&&!Te.readonly){if(ht==null||typeof ht=="object"&&Object.keys(ht).length===0)xe.push(`${Te.name} is required for the ${we.type} action.`);else if(typeof ht=="string")try{const Ve=JSON.parse(ht);(!Ve||typeof Ve!="object")&&xe.push(`${Te.name} must be a valid JSON object for the ${we.type} action.`)}catch{xe.push(`${Te.name} must be valid JSON for the ${we.type} action.`)}}})}),xe},eo=()=>({name:ur.name.trim(),description:ur.description.trim()||void 0,event:ur.event,priority:Number(ur.priority)||0,active:!!ur.active,expression:{op:ur.expressionType,args:ur.conditions.map(xe=>{const we=Be[xe.operator]||{},De=we.valueRequired!==!1,Te={op:xe.operator,left:{path:xe.path.trim()}};if(De){const ct=Jke(xe.value,xe.valueType,we.multiValue===!0);Te.right=ct}return Te})},actions:ur.actions.map(xe=>{const we=Ot(xe.type);if(!we){const Te=xe.originalParams&&Object.keys(xe.originalParams).length?xe.originalParams:xe.params||{};return{type:xe.type,params:Te}}const De={};return(we.params||[]).forEach(Te=>{var ct,ht;const Ve=(ct=xe.params)==null?void 0:ct[Te.name];if(typeof Te.type=="string"&&Te.type.startsWith("array")){const Mt=ud(Ve);(Te.required||Mt.length)&&(De[Te.name]=Mt)}else if(Te.type==="boolean")Ve!==void 0&&(De[Te.name]=ij(Ve));else if(Te.type==="integer"||Te.type==="number"){if(Ve!==void 0&&Ve!==""){const Mt=Number(Ve);Number.isFinite(Mt)&&(De[Te.name]=Mt)}}else if(Te.type==="object"){if(Ve){if(typeof Ve=="object"){let Mt=Ve;if(Te.input==="multi_select"&&Array.isArray(Te.choices)){const Or={};Object.entries(Ve).forEach(([Rr,yt])=>{var _t;const Ut=Te.choices.find(Gr=>{var Cr;return(((Cr=Gr.meta)==null?void 0:Cr.key)||Gr.value)===Rr}),br=(_t=Ut?.meta)==null?void 0:_t.type;if(br==="integer"||br==="number"){const Gr=Number(yt);Or[Rr]=Number.isFinite(Gr)?Gr:yt}else if(br==="boolean")Or[Rr]=yt===!0||yt==="true"||yt==="1";else if(br==="object")try{Or[Rr]=typeof yt=="string"?JSON.parse(yt):yt}catch{Or[Rr]=yt}else Or[Rr]=yt}),Mt=Or}else if(Array.isArray(Te.variants)&&Te.name==="provider_options"){const Or=(ht=xe.params)==null?void 0:ht.provider,Rr=Te.variants.find(yt=>yt.value===Or);if(Rr){const yt={};(Rr.params||[]).forEach(_t=>{const Ut=Ve[_t.name];if(Ut!==void 0)if(_t.type==="integer"||_t.type==="number"){const br=Number(Ut);yt[_t.name]=Number.isFinite(br)?br:Ut}else if(_t.type==="boolean")yt[_t.name]=Ut===!0||Ut==="true"||Ut==="1";else if(typeof _t.type=="string"&&_t.type.startsWith("array"))yt[_t.name]=Array.isArray(Ut)?Ut:ud(Ut);else if(_t.type==="object")try{yt[_t.name]=typeof Ut=="string"?JSON.parse(Ut):Ut}catch{yt[_t.name]=Ut}else yt[_t.name]=Ut}),Mt=yt}}(Te.required||Object.keys(Mt).length)&&(De[Te.name]=Mt)}else if(typeof Ve=="string")try{const Mt=JSON.parse(Ve);Mt&&typeof Mt=="object"&&(Te.required||Object.keys(Mt).length)&&(De[Te.name]=Mt)}catch{}}}else{const Mt=typeof Ve=="string"?Ve.trim():Ve;(Te.required||Mt!=null&&Mt!=="")&&(De[Te.name]=Mt)}}),{type:xe.type,params:De}})}),Wt=async xe=>{if(xe.preventDefault(),!(r!=null&&r.rules))return;const we=In();if(we.length){Tt(we);return}Tt([]),S(!0);const De=eo(),Te=!!C;try{const ct=Te?await r.rules.replace(C,De):await r.rules.create(De);n?.({message:Te?"Rule updated":"Rule saved",subMessage:`${De.name} applied successfully.`}),ct!=null&&ct.id&&a(ht=>{const Ve=ht.findIndex(Or=>Or.id===ct.id);if(Ve===-1)return[ct,...ht];const Mt=[...ht];return Mt[Ve]=ct,Mt}),await tr(),en()}catch(ct){console.error("Failed to save rule",ct),Tt([ct?.message||"Failed to save rule"])}finally{S(!1)}},un=xe=>{d.length&&(Xe(Nr(xe)),O(xe.id||null),Tt([]),T(!0),E(xe.id||null))},rn=xe=>{F(xe),I("")},Kt=async()=>{if(!(!(r!=null&&r.rules)||!_)){W(!0),I("");try{await r.rules.delete(_.id),a(xe=>xe.filter(we=>we.id!==_.id)),C&&_.id===C&&en(),k===_.id&&E(null),n?.({message:"Rule deleted",subMessage:`${_.name||"Rule"} removed successfully.`}),await tr(),F(null)}catch(xe){console.error("Failed to delete rule",xe),I(xe?.message||"Failed to delete rule")}finally{W(!1)}}},En=()=>{R||(F(null),I(""))},Vo=()=>{C?en():Lt()},Si=()=>{Lt(),T(!0)},Ba=()=>{L(!0),!Y&&q.length===0&&Et()},fo=xe=>{d.length&&(Xe(Nr(xe)),O(null),Tt([]),L(!1),T(!0))},Nl=xe=>{const we=Nr(xe);Xe(we),O(null),Tt([]),T(!0)},Oi=xe=>{xe&&(mt(xe),Ge(!0))},Sl=()=>{Ge(!1),mt(null)},Xt=()=>{pt(!0)},Qf=()=>{pt(!1)},em=xe=>{xe&&(Xe(Nr(xe)),O(null),Tt([]),pt(!1),T(!0),E(null))},Ol=(t=Mr[ur.event])==null?void 0:t.description,tm=C?"Edit rule":"Create rule",Sr=C?"Update the event, conditions, and actions for this automation rule.":"Define the event trigger, matching conditions, and resulting actions for your new rule.",Ci=m.useMemo(()=>H.reduce((xe,we)=>(xe[we.id]=we,xe),{}),[H]),Os=m.useMemo(()=>{if(!q.length)return[];const xe=[];H.forEach(De=>{const Te=q.filter(ct=>ct.group_type===De.id);Te.length&&xe.push({id:De.id,label:De.label,description:De.description,items:Te})});const we=q.filter(De=>!De.group_type||!Ci[De.group_type]);return we.length&&xe.push({id:"uncategorized",label:"Other Templates",description:"General-purpose rules without a defined category.",items:we}),xe},[q,H,Ci]),Pi=xe=>{de(xe),ue(!0),Ee(""),Ie(null),Me(null)},Nc=()=>{ue(!1),de(null),Ee(""),Ie(null),V(!1),ne(!1),Me(null)},Sc=async xe=>{if(!(!(r!=null&&r.rules)||!(G!=null&&G.id)))try{V(!0),Ee("");const we=await r.rules.applyToHistory(G.id,{...xe,dryRun:!0});Ie(we||{}),Me("preview")}catch(we){console.error("Preview apply failed",we),Ee(we?.message||"Failed to preview")}finally{V(!1)}},Cl=async xe=>{if(!(!(r!=null&&r.rules)||!(G!=null&&G.id)))try{ne(!0),Ee("");const we=await r.rules.applyToHistory(G.id,{...xe,dryRun:!1});Ie(we||{}),Me("apply"),n?.({type:"success",message:"Rule applied to matching historical operations"})}catch(we){console.error("Apply to history failed",we),Ee(we?.message||"Failed to apply"),n?.({type:"error",message:we?.message||"Failed to apply rule"})}finally{ne(!1)}};return l.jsxs("div",{className:"min-h-screen flex flex-col space-y-6",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3 flex-1 min-h-0",children:[l.jsx("div",{className:"lg:col-span-2 min-h-0 flex flex-col",children:l.jsx(mke,{rules:o,events:u,loading:h,error:v,isRefreshing:g,openRuleId:k,onToggleRule:E,onRefresh:_n,onEditRule:un,onDeleteRule:rn,onCreateRule:Si,onStartFromTemplate:Ba,onApplyHistory:Pi,onDuplicateRule:Nl,onPauseRule:or,onExportRule:Oi,onImportRule:Xt,meta:i,licenseUsage:$e,onPageChange:Je,paginationAlwaysShow:!1,operatorLabelMap:Qn})}),l.jsx("div",{className:"lg:col-span-1",children:l.jsx(Gke,{onTagsUpdate:Ze})})]}),l.jsx(lg,{open:!!_,rule:_,isDeleting:R,error:$,onCancel:En,onConfirm:Kt}),l.jsx(Wke,{open:A,title:tm,description:Sr,onClose:en,showFooter:!0,onReset:Vo,formId:"rules-builder-form",saving:j,isEditing:!!C,children:l.jsx(Vke,{form:ur,events:u,selectedEventDescription:Ol,actionsCatalog:d,isEditing:!!C,saving:j,formErrors:Bt,onSubmit:Wt,onReset:Vo,formId:"rules-builder-form",hideFooter:!0,onFieldChange:Yr,onConditionChange:hr,onAddCondition:_e,onRemoveCondition:bt,onMoveCondition:ke,onActionTypeChange:tn,onActionParamChange:gr,onAddAction:st,onRemoveAction:lt,onMoveAction:cr,operatorOptions:Wr})}),l.jsx(Kke,{open:B,groupedTemplates:Os,loading:Y,error:te,onClose:()=>L(!1),onRetry:Et,onSelect:fo}),l.jsx(Yke,{open:Q,rule:G,onClose:Nc,onPreview:Sc,onApply:Cl,loading:ie,applying:ee,error:ge,preview:Pe,previewType:nt,tagOptions:jt}),l.jsx(Xke,{open:ot,rule:at,onClose:Sl}),l.jsx(Zke,{open:Ke,onCancel:Qf,onImport:em,onImported:tr})]})}function gR({count:e,color:t="red",className:r=""}){if(!e||e<=0)return null;const n=t==="green"?"bg-green-600":t==="orange"?"bg-orange-500":"bg-red-600";return l.jsx("span",{className:`inline-flex items-center justify-center px-1.5 py-0.5 text-xs font-semibold leading-none text-white ${n} rounded-full ${r}`,children:e})}function ga({variant:e="auto",filled:t=!1,backgroundClass:r="",children:n}){const o="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",a={success:"border-green-500 text-green-500",error:"border-red-500 text-red-500",neutral:"border-gray-300 text-gray-800 dark:border-gray-600 dark:text-gray-200"},i={success:"bg-green-500 text-white border-green-500",error:"bg-red-500 text-white border-red-500",neutral:"bg-gray-300 text-gray-800 border-gray-300 dark:bg-gray-600 dark:text-gray-200"},s=["ok","active","running","on","yes"],u=["nok","inactive","stopped","off","no"],c=String(n).trim().toLowerCase();let d;e==="auto"?s.includes(c.toLowerCase())?d="success":u.includes(c.toLowerCase())?d="error":d="neutral":d=e;const f=t?i[d]:a[d];return l.jsx("span",{className:`${o} ${f} ${r}`,children:n})}function ewe(){const{apiEndpoint:e,setApiEndpoint:t,client:r}=Er(),[n,o]=m.useState(e),[a,i]=m.useState(null),s=async u=>{u.preventDefault();const c=n.replace(/\/+$/,"");t(c),r.configure({apiEndpoint:c});try{i(null),await r.service.getHealth()}catch(d){i(d.message)}};return l.jsxs(l.Fragment,{children:[l.jsxs("form",{className:"grid grid-cols-1 gap-10 md:grid-cols-3 items-end",onSubmit:s,children:[l.jsxs("div",{className:"self-start",children:[l.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"API Endpoint"}),l.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Set the base URL for the Inspectr API."})]}),l.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[l.jsx(HL,{id:"api-endpoint",name:"api-endpoint",placeholder:"https://localhost:4004/api",value:n,onValueChange:u=>o(u),className:`mt-2 focus:ring-2 focus:ring-offset-0 ${a?"border-red-500 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":""}`}),a&&l.jsxs("p",{className:"mt-2 text-sm text-red-600",children:["Cannot connect to ",n]}),l.jsx("div",{className:"flex items-center justify-end space-x-4 pt-4",children:l.jsx("button",{type:"submit",className:"whitespace-nowrap rounded-tremor-default bg-tremor-brand px-4 py-2.5 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis",children:"Save API Endpoint"})})]})]}),l.jsx(Ss,{className:"my-10"})]})}function Vk({component:e}){const{client:t}=Er(),[r,n]=m.useState("loading"),[o,a]=m.useState(null),i=m.useRef(()=>{}),s=500;m.useEffect(()=>{let d=!1;async function f(){d||(n("loading"),a(null));const h=Date.now();try{const p=await t.service.ping(e),g=Date.now()-h,b=()=>{d||(n(p.status),a(p.error||null))};g<s?setTimeout(b,s-g):b()}catch(p){const g=Date.now()-h,b=()=>{d||(n("down"),a(p.message))};g<s?setTimeout(b,s-g):b()}}return i.current=f,f(),()=>{d=!0}},[t.service,e]);const u=r==="up"?"fill-green-500":r==="down"?"fill-red-500":"fill-gray-400 animate-pulse",c=o?`${o}`:`${e}: ${r}`;return l.jsx(Cf,{content:c,sideOffset:4,side:"left",onClick:()=>i.current(),children:l.jsx("svg",{viewBox:"0 0 6 6","aria-hidden":"true",className:Oo("w-3 h-3 cursor-pointer",u),children:l.jsx("circle",{r:"3",cx:"3",cy:"3"})})})}function twe(){const{apiEndpoint:e,proxyEndpoint:t,ingressEndpoint:r,client:n}=Er(),[o,a]=m.useState(null),[i,s]=m.useState(null),u=async()=>{try{s(null),a(null);const c=await n.service.getHealth();a(c)}catch(c){console.error("Health error",c),s(c.message)}};return m.useEffect(()=>{u()},[e]),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Inspectr"}),l.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Information about the connected Inspectr service itself."})]}),l.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[!o&&!i&&l.jsx("p",{className:"mt-2 text-tremor-default",children:"Loading…"}),l.jsxs(Jf,{className:"mt-4 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),l.jsx(ga,{filled:"true",children:o?.message??"NOK"})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Version"}),l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content",children:o?.version??"-"})]}),o&&l.jsxs(l.Fragment,{children:[l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Running since"}),l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content",children:new Date(o.start_time).toLocaleString()})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Mode"}),l.jsx(ga,{variant:"neutral",children:o.mode})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Proxy URL"}),t?l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:t}),l.jsx(Cn,{textToCopy:t,showLabel:!1})]}):l.jsx("span",{className:"text-tremor-default dark:text-dark-tremor-content",children:"Not set"})]}),o?.backend&&l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Backend URL"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Vk,{component:"backend"}),l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:o.backend}),l.jsx(Cn,{textToCopy:o.backend,showLabel:!1})]})]}),o?.mode==="mock"&&l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Mock URL"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Vk,{component:"mock"}),l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:t}),l.jsx(Cn,{textToCopy:t,showLabel:!1})]})]}),o?.mode==="catch"&&l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Catch URL"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(Vk,{component:"catch"}),l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:t}),l.jsx(Cn,{textToCopy:t,showLabel:!1})]})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Expose"}),l.jsx(ga,{children:o!=null&&o.expose?"Yes":"No"})]}),o.expose&&r&&l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Expose URL"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:r}),l.jsx(Cn,{textToCopy:r,showLabel:!1})]})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"App"}),l.jsx(ga,{children:o!=null&&o.app?"Yes":"No"})]})]})]})]})]}),l.jsx(Ss,{className:"my-10"})]})}function rwe({open:e,onClose:t,initialUrl:r="",onSubmit:n}){const[o,a]=m.useState(r),[i,s]=m.useState(null),[u,c]=m.useState(!1);if(m.useEffect(()=>{e&&(a(r),s(null),+c(!1))},[e,r]),!e)return null;const d=async()=>{c(!0),s(null);try{await n(o),t()}catch(f){console.error("Mock launch error",f),s(f.message||"Failed to launch mock"),c(!1)}};return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Set OpenAPI URL"}),l.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",disabled:u,children:"×"})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"openapi-url",className:"block text-sm font-medium text-gray-700",children:"OpenAPI Spec URL"}),l.jsx("input",{id:"openapi-url",type:"url",value:o,onChange:f=>{a(f.target.value),i&&s(null)},placeholder:"https://example.com/openapi.yaml",disabled:u,className:"mt-1 block w-full rounded-md shadow-sm sm:text-sm "+(i?"border-red-500 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-blue-500 focus:border-blue-500")}),i&&l.jsx("p",{className:"mt-2 text-sm text-red-600",children:i})]}),l.jsxs("div",{className:"flex justify-end space-x-3",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",disabled:u,children:"Cancel"}),l.jsx("button",{onClick:d,className:`px-4 py-2 text-white rounded ${u?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,disabled:u,children:u?"Loading…":"Launch Mock"})]})]})]})}function nwe(){const{client:e}=Er(),[t,r]=m.useState(null),[n,o]=m.useState(!1),a=async()=>{try{const s=await e.mock.getConfig();r(s)}catch(s){console.error("Mock info error",s),r(null)}},i=async s=>{try{await e.mock.launch(s),a()}catch(u){throw console.error("Mock launch error",u),u}};return m.useEffect(()=>{a()},[]),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Mock Details"}),l.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Information about your mock configuration."}),l.jsx("div",{className:"mt-4",children:l.jsx("button",{onClick:()=>o(!0),className:"whitespace-nowrap rounded-tremor-default bg-tremor-brand px-4 py-2.5 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis",children:"Set OpenAPI"})})]}),l.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[!t&&l.jsx("p",{className:"mt-2 text-tremor-default",children:"Loading mock info…"}),t&&l.jsxs(Jf,{className:"mt-4 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),l.jsx(ga,{filled:"true",children:t!=null&&t.status?"Active":"Inactive"})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"OpenAPI Spec"}),l.jsx("a",{href:t.openapi,target:"_blank",rel:"noopener noreferrer",className:"underline text-tremor-content dark:text-dark-tremor-content",children:t.openapi})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Examples"}),l.jsx(ga,{variant:"neutral",children:t?.examples})]})]})]})]}),l.jsx(rwe,{open:n,onClose:()=>o(!1),initialUrl:t?.openapi,onSubmit:i}),l.jsx(Ss,{className:"my-10"})]})}function owe({open:e,onClose:t,initialSecret:r="",initialTtl:n="",onSubmit:o}){const[a,i]=m.useState(r),[s,u]=m.useState(n),[c,d]=m.useState(null),[f,h]=m.useState(!1);if(m.useEffect(()=>{e&&(i(r),u(n),d(null),h(!1))},[e,r,n]),!e)return null;const p=async()=>{h(!0),d(null);try{await o(a,s),t()}catch(g){console.error("Authentication save error",g),d(g.message||"Failed to save"),h(!1)}};return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Authentication Guard Settings"}),l.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",disabled:f,children:"×"})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"auth-secret",className:"block text-sm font-medium text-gray-700",children:"Secret"}),l.jsx("input",{id:"auth-secret",type:"text",value:a,onChange:g=>{i(g.target.value),c&&d(null)},disabled:f,className:"mt-1 block w-full rounded-md shadow-sm border-gray-300 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"auth-ttl",className:"block text-sm font-medium text-gray-700",children:"TTL (hours, optional)"}),l.jsx("input",{id:"auth-ttl",type:"number",value:s,onChange:g=>{u(g.target.value),c&&d(null)},placeholder:"24",disabled:f,className:"mt-1 block w-full rounded-md shadow-sm border-gray-300 focus:ring-blue-500 focus:border-blue-500 sm:text-sm"})]}),c&&l.jsx("p",{className:"mt-2 text-sm text-red-600",children:c}),l.jsxs("div",{className:"flex justify-end space-x-3",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",disabled:f,children:"Cancel"}),l.jsx("button",{onClick:p,className:`px-4 py-2 text-white rounded ${f?"bg-gray-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,disabled:f,children:f?"Saving…":"Save"})]})]})]})}const awe=()=>l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-4 w-4","aria-hidden":"true",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})}),dp=({label:e,tooltip:t})=>{if(!t)return null;const r=`${e} details`;return l.jsx(Cf,{content:t,sideOffset:6,side:"top",children:l.jsx("button",{type:"button","aria-label":r,className:"rounded-full p-1 text-gray-400 transition hover:text-gray-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-tremor-brand dark:text-gray-500 dark:hover:text-gray-300",children:l.jsx(awe,{})})})};function iwe(){const{apiEndpoint:e,client:t}=Er(),[r,n]=m.useState(null),[o,a]=m.useState(""),[i,s]=m.useState(""),[u,c]=m.useState(!1),[d,f]=m.useState(null),[h,p]=m.useState(!1),[g,b]=m.useState(!1),v=r===null&&!d,x=async()=>{try{f(null);const j=await t.auth.getAuthenticationSettings();n(j),a(j.secret||""),s(String(j.token_ttl||"")),c(!!j.enabled)}catch(j){console.error("Authentication info error",j),f(j.message)}},k=async(j=o,S=i,C=u)=>{try{b(!0);const O={enabled:C,secret:j,token_ttl:S?parseInt(S,10):void 0},M=await t.auth.updateAuthenticationSettings(O);n(M),a(M.secret||""),s(String(M.token_ttl||"")),c(!!M.enabled),f(null)}catch(O){console.error("Security save error",O),f(O.message)}finally{b(!1)}},E=async()=>{await k(o,i,u)};return m.useEffect(()=>{x()},[e]),l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3 items-start",children:[l.jsxs("div",{className:"self-start",children:[l.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Backend Authentication Guard"}),l.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Use one of the following API Keys to authenticate requests to your backend."}),l.jsx("div",{className:"mt-4",children:l.jsx("button",{type:"button",onClick:()=>p(!0),className:"whitespace-nowrap rounded-tremor-default bg-tremor-brand px-4 py-2.5 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis",children:"Configure Authentication"})})]}),l.jsxs("div",{className:"sm:max-w-3xl md:col-span-2 space-y-4",children:[r&&l.jsxs(Jf,{className:"mt-4 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[l.jsxs(Xr,{className:"py-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Guard Protection"}),l.jsx(dp,{label:"Authentication Guard",tooltip:"Enable API key authentication on all requests."})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(og,{checked:u,onChange:async j=>{c(j),await k(o,i,j)},disabled:g||v,className:Oo("relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand focus-visible:ring-offset-2",u?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700",g||v?"opacity-60 cursor-not-allowed":""),children:[l.jsx("span",{className:"sr-only",children:"Toggle Authentication Guard"}),l.jsx("span",{"aria-hidden":"true",className:Oo("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",u?"translate-x-4":"translate-x-0")})]}),l.jsx("span",{className:"text-sm font-medium text-tremor-content dark:text-dark-tremor-content",children:u?"Enabled":"Disabled"}),g&&l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Saving…"})]})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong min-w-10",children:"inspectr-auth-key"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:r.auth_key||"-"}),l.jsx(Cn,{textToCopy:r.auth_key||"",showLabel:!1})]})]}),l.jsxs(Xr,{className:"py-3 flex justify-between items-start",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong w-40 flex-shrink-0",children:"inspectr-auth-token"}),l.jsxs("div",{className:"flex flex-col items-end space-y-1",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content break-all",children:r.auth_token||"-"}),l.jsx(Cn,{textToCopy:r.auth_token||"",showLabel:!1})]}),l.jsx("div",{className:"flex items-center space-x-2",children:l.jsx("button",{type:"button",onClick:E,className:"px-2 py-0.5 rounded bg-tremor-brand text-white hover:bg-tremor-brand-emphasis text-xs",children:"Renew"})})]})]}),l.jsxs(Xr,{className:"py-3 flex justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"inspectr-auth-token Expiration"}),l.jsx("span",{className:"text-tremor-content dark:text-dark-tremor-content",children:r.auth_token_expiration?new Date(r.auth_token_expiration).toLocaleString():"-"})]})]}),d&&l.jsx("p",{className:"text-sm text-red-600",children:d})]})]}),l.jsx(owe,{open:h,onClose:()=>p(!1),initialSecret:o,initialTtl:i,onSubmit:async(j,S)=>{a(j),s(S),await k(j,S,u)}}),l.jsx(Ss,{className:"my-10"})]})}const zA=[{slug:"feat_export_openapi",title:"Export as OpenAPI Document",description:"Export your API operations as an OpenAPI document. This document can be used as a starting point for building a custom OpenAPI document.",image:"https://inspectr.dev/preview/export-openapi.png"},{slug:"feat_export_postman",title:"Export as Postman Collection",description:"Export your API operations as a Postman collection. The Postman collection contains all requests based on the Inspectr Operations history.",image:"https://inspectr.dev/preview/export-postman.png"}],swe=[{slug:"feat_connectors",title:"Inspectr Connectors",description:"Forward Inspectr events to other services by configuring outbound connectors.",image:void 0,defaultEnabled:!1,removeWhenFalse:!0},{slug:"feat_insights_display",title:"Insights Display",description:"Show the insights explorer navigation with Endpoint, List, Table, and Timeline modes.",image:void 0,defaultEnabled:!1,removeWhenFalse:!0}];function lwe(){const[e]=Ur("future","false"),t=e==="true",r=y.useMemo(()=>t?[...zA,...swe]:zA,[t]).map(n=>{const[o,a]=Na(n.slug,n.defaultEnabled,n.removeWhenFalse);return{...n,enabled:o,setEnabled:a}});return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3 items-start",children:[l.jsxs("div",{className:"self-start",children:[l.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Feature Previews"}),l.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Enable or disable experimental features."})]}),l.jsx("div",{className:"sm:max-w-3xl md:col-span-2 space-y-6",children:r.map(n=>l.jsxs("div",{className:"flex items-start space-x-4",children:[l.jsxs("div",{className:"flex-1",children:[l.jsx("h3",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:n.title}),l.jsx("p",{className:"mt-1 text-tremor-content dark:text-dark-tremor-content",children:n.description})]}),n.image&&l.jsx("img",{src:n.image,alt:n.slug,className:"w-32 border border-tremor-border dark:border-dark-tremor-border rounded"}),l.jsxs("div",{className:"flex items-center pt-1 space-x-3",children:[l.jsxs(og,{checked:!!n.enabled,onChange:()=>n.setEnabled(!n.enabled),className:Oo("relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60",n.enabled?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700"),children:[l.jsx("span",{className:"sr-only",children:n.enabled?"Disable feature preview":"Enable feature preview"}),l.jsx("span",{"aria-hidden":"true",className:Oo("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",n.enabled?"translate-x-4":"translate-x-0")})]}),l.jsx("span",{className:"text-sm font-medium text-tremor-content dark:text-dark-tremor-content",children:n.enabled?"Enabled":"Disabled"})]})]},n.slug))})]}),l.jsx(Ss,{className:"my-10"})]})}function uwe(){const{client:e}=Er(),[t,r]=m.useState(null),[n,o]=m.useState(!0),[a,i]=m.useState(!1),[s,u]=m.useState(""),[c,d]=m.useState(!1),f=m.useCallback(async()=>{var S;if(!((S=e?.mcp)!=null&&S.getMCPServerSettings)){r(null),o(!1);return}try{u(""),o(!0);const C=await e.mcp.getMCPServerSettings();r(C),d(!!(C!=null&&C.public))}catch(C){console.error("Failed to load MCP server settings",C),r(null),u(C.message||"Failed to load MCP server info")}finally{o(!1)}},[e]);m.useEffect(()=>{f()},[f]);const h=async S=>{var C;if(!((C=e?.mcp)!=null&&C.updateMCPServerSettings))return;const O=c;d(S),i(!0),u("");try{const M=await e.mcp.updateMCPServerSettings({public:S});r(M),d(!!(M!=null&&M.public))}catch(M){console.error("Failed to update MCP public exposure",M),d(O),u(M.message||"Failed to update MCP server visibility")}finally{i(!1)}},p=t||{},g=p?.local_url||p?.url||"",b=p?.public_url||"",v=p?.enabled??!!g,x=v?"Active":"Inactive",k=b||(c?"Activating public MCP access…":"-"),E="text-tremor-content dark:text-dark-tremor-content break-all text-sm",j=!!b;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"MCP Server (Preview)"}),l.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Connection details for the built-in MCP server for Inspectr."})]}),l.jsxs("div",{className:"sm:max-w-3xl md:col-span-2",children:[n&&l.jsx("p",{className:"mt-2 text-tremor-default",children:"Loading MCP server info…"}),s&&l.jsx("p",{className:"mt-2 text-tremor-default text-red-600 dark:text-red-400",children:s}),t?l.jsxs(Jf,{className:"mt-4 divide-y divide-tremor-border dark:divide-dark-tremor-border",children:[l.jsxs(Xr,{className:"py-3 flex items-center justify-between",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),l.jsx(ga,{filled:!0,variant:v?"success":"neutral",children:x})]}),l.jsxs(Xr,{className:"py-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Public access"}),l.jsx(dp,{label:"Public access",tooltip:"Allow external agents to connect through the public Inspectr MCP endpoint."})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs(og,{checked:c,onChange:h,disabled:a||n,className:Oo("relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand focus-visible:ring-offset-2",c?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700",a||n?"opacity-60 cursor-not-allowed":""),children:[l.jsx("span",{className:"sr-only",children:"Toggle public MCP access"}),l.jsx("span",{"aria-hidden":"true",className:Oo("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",c?"translate-x-4":"translate-x-0")})]}),l.jsx("span",{className:"text-sm font-medium text-tremor-content dark:text-dark-tremor-content",children:c?"Enabled":"Local only"}),a&&l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Saving…"})]})]}),l.jsxs(Xr,{className:"py-3 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Local URL"}),l.jsx(dp,{label:"Local URL",tooltip:"Use this endpoint when connecting from the same network as your Inspectr instance."})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:E,children:g||"-"}),g&&l.jsx(Cn,{textToCopy:g,showLabel:!1})]})]}),l.jsxs(Xr,{className:"py-3 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Public URL"}),l.jsx(dp,{label:"Public URL",tooltip:"Share this endpoint with external MCP clients after enabling public access."})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:Oo(E,j?"":"text-gray-500 dark:text-gray-400"),children:k}),j&&l.jsx(Cn,{textToCopy:b,showLabel:!1})]})]})]}):!n&&!s&&l.jsx("p",{className:"mt-4 text-sm text-gray-600 dark:text-gray-400",children:"MCP server settings are unavailable."})]})]}),l.jsx(Ss,{className:"my-10"})]})}const cwe={name:"",server_url:"",description:"",enabled:!0,headers:{}},HA=(e={})=>{if(!e||typeof e!="object")return[{key:"",value:""}];const t=Object.entries(e);return t.length===0?[{key:"",value:""}]:t.map(([r,n])=>({key:r,value:String(n??"")}))},dwe=e=>e.reduce((t,{key:r,value:n})=>{const o=r.trim();return o&&(t[o]=n??""),t},{}),fwe=(e={})=>{const t=Object.entries(e||{});if(t.length===0)return{authName:"Authorization",authToken:"",restHeaders:{}};const r=t.map(([u,c])=>[u,c,u.toLowerCase()]);let n=r.find(([,,u])=>u==="authorization");if(n||(n=r.find(([,u])=>typeof u=="string"&&/^\s*Bearer\s+/i.test(u))),!n)return{authName:"Authorization",authToken:"",restHeaders:e};const[o,a]=n,i=typeof a=="string"?a.replace(/^\s*Bearer\s+/i,""):String(a??""),s=t.filter(([u])=>u!==o).reduce((u,[c,d])=>(u[c]=d,u),{});return{authName:o,authToken:i,restHeaders:s}};function mwe({open:e,mode:t="create",initialData:r=cwe,onClose:n,onSubmit:o}){const[a,i]=m.useState(r.name||""),[s,u]=m.useState(r.server_url||""),[c,d]=m.useState(r.description||""),[f,h]=m.useState(typeof r.enabled=="boolean"?r.enabled:!0),[p,g]=m.useState(HA(r.headers)),[b,v]=m.useState("Authorization"),[x,k]=m.useState(""),[E,j]=m.useState(!1),[S,C]=m.useState(null),[O,M]=m.useState(!1);m.useEffect(()=>{if(e){i(r.name||""),u(r.server_url||""),d(r.description||""),h(typeof r.enabled=="boolean"?r.enabled:!0);const{authName:R,authToken:W,restHeaders:B}=fwe(r.headers);v(R||"Authorization"),k(W||""),g(HA(B));const L=Object.keys(B||{}).length>0;j(!!W||L),C(null),M(!1)}},[e,r]);const A=m.useMemo(()=>O||!a.trim()||!s.trim(),[O,a,s]);if(!e)return null;const T=(R,W,B)=>{g(L=>{const q=[...L];return q[R]={...q[R],[W]:B},q})},_=()=>{g(R=>[...R,{key:"",value:""}])},F=R=>{g(W=>W.length===1?[{key:"",value:""}]:W.filter((B,L)=>L!==R))},$=async()=>{if(!A){M(!0),C(null);try{const R={name:a.trim(),server_url:s.trim(),description:c.trim(),enabled:!!f},W=dwe(p),B=b.trim(),L=x.trim();B&&L&&(W[B]=/^Bearer\s+/i.test(L)?L:`Bearer ${L}`),R.headers=W,await o(R),n()}catch(R){console.error("Connector save error",R),C(R?.message||"Failed to save connector"),M(!1)}}},I=()=>j(R=>!R);return l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-40",onClick:()=>O?null:n()}),l.jsxs("div",{className:"relative z-10 w-full max-w-2xl mx-4 rounded-lg bg-white p-6 shadow-xl",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:t==="edit"?"Edit Connector":"Create Connector"}),l.jsx("button",{type:"button",onClick:n,className:"text-gray-500 hover:text-gray-700","aria-label":"Close",disabled:O,children:"×"})]}),l.jsxs("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto pr-1",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"connector-name",className:"block text-sm font-medium text-gray-700",children:"Name"}),l.jsx("input",{id:"connector-name",type:"text",value:a,onChange:R=>i(R.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"Custom Connector"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"connector-server-url",className:"block text-sm font-medium text-gray-700",children:"Server URL"}),l.jsx("input",{id:"connector-server-url",type:"url",value:s,onChange:R=>u(R.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"http://localhost:3100"})]}),l.jsxs("div",{children:[l.jsxs("label",{htmlFor:"connector-description",className:"block text-sm font-medium text-gray-700",children:["Description ",l.jsx("span",{className:"text-xs text-gray-300",children:"(optional)"})]}),l.jsx("input",{id:"connector-description",value:c,onChange:R=>d(R.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"A custom connector for integrating with Inspectr Rules."})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx("input",{id:"connector-enabled",type:"checkbox",checked:!!f,onChange:R=>h(R.target.checked),disabled:O,className:"h-5 w-5 rounded border-gray-300 text-tremor-brand focus:ring-tremor-brand"}),l.jsx("label",{htmlFor:"connector-enabled",className:"text-sm font-medium text-gray-700",children:"Enabled"})]}),l.jsxs("div",{children:[l.jsx("button",{type:"button",onClick:I,className:"text-sm font-medium text-tremor-brand hover:text-tremor-brand-emphasis",disabled:O,children:"Configure authentication & headers"}),E&&l.jsxs("div",{className:"mt-3 space-y-4 rounded-lg border border-tremor-border bg-tremor-background-muted p-4 dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"API Token Authentication"}),l.jsxs("div",{className:"mt-3 grid gap-3 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"connector-auth-header",className:"block text-sm font-medium text-gray-700",children:"Header Name"}),l.jsx("input",{id:"connector-auth-header",type:"text",value:b,onChange:R=>v(R.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"Authorization"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"connector-auth-token",className:"block text-sm font-medium text-gray-700",children:"Bearer Token"}),l.jsx("input",{id:"connector-auth-token",type:"text",value:x,onChange:R=>k(R.target.value),disabled:O,className:"mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand",placeholder:"Bearer Token"})]})]})]}),l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"block text-sm font-medium text-gray-700",children:"Additional Headers"}),l.jsx("button",{type:"button",onClick:_,disabled:O,className:"text-sm font-medium text-tremor-brand hover:text-tremor-brand-emphasis",children:"Add header"})]}),l.jsx("div",{className:"mt-2 space-y-2",children:p.map((R,W)=>l.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_1fr_auto]",children:[l.jsx("input",{type:"text",value:R.key,onChange:B=>T(W,"key",B.target.value),placeholder:"Header name",disabled:O,className:"rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand"}),l.jsx("input",{type:"text",value:R.value,onChange:B=>T(W,"value",B.target.value),placeholder:"Header value",disabled:O,className:"rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm focus:border-tremor-brand focus:outline-none focus:ring-1 focus:ring-tremor-brand"}),l.jsx("button",{type:"button",onClick:()=>F(W),disabled:O,className:"text-sm text-red-600 hover:text-red-700",children:"Remove"})]},W))})]})]})]}),S&&l.jsx("p",{className:"text-sm text-red-600",children:S})]}),l.jsxs("div",{className:"mt-6 flex justify-end space-x-3",children:[l.jsx("button",{type:"button",onClick:n,disabled:O,className:"rounded-md bg-gray-200 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-300",children:"Cancel"}),l.jsx("button",{type:"button",onClick:$,disabled:A,className:`rounded-md px-4 py-2 text-sm font-medium text-white ${A?"bg-gray-400 cursor-not-allowed":"bg-tremor-brand hover:bg-tremor-brand-emphasis"}`,children:O?"Saving…":t==="edit"?"Save changes":"Create connector"})]})]})]})}const qA={pending:{label:"Pending",description:"Inspectr is still discovering the connector metadata.",dotClass:"fill-amber-500 dark:fill-amber-400 animate-pulse",badgeProps:{variant:"neutral",filled:!0,backgroundClass:"border-amber-300 bg-amber-100 text-amber-700 dark:border-amber-500 dark:bg-amber-900/40 dark:text-amber-200"}},ready:{label:"Ready",description:"The connector is healthy and routable.",dotClass:"fill-emerald-500 dark:fill-emerald-400",badgeProps:{variant:"success",filled:!0}},disabled:{label:"Disabled",description:"The connector is disabled and will never receive traffic.",dotClass:"fill-gray-300 dark:fill-gray-500",badgeProps:{variant:"neutral",filled:!0,backgroundClass:"border-gray-300 bg-gray-200 text-gray-600 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300"}},disconnected:{label:"Disconnected",description:"The connector is temporarily unreachable and will be retried with backoff.",dotClass:"fill-rose-500 dark:fill-rose-400",badgeProps:{variant:"error",filled:!0}},unknown:{label:"Unknown",description:"The connector status is unknown.",dotClass:"fill-gray-300 dark:fill-gray-600 animate-pulse",badgeProps:{variant:"neutral",filled:!0,backgroundClass:"border-gray-300 bg-gray-200 text-gray-600 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-300"}}},bR=e=>{var t,r;const n=e?.status||((t=e?.record)==null?void 0:t.status);return n?String(n).toLowerCase():((r=e?.record)==null?void 0:r.enabled)===!1?"disabled":e?.ready===!0?"ready":e?.ready===!1?"disconnected":"pending"},j1=e=>qA[e]||qA.unknown,pwe=e=>e?Array.isArray(e)?e:Array.isArray(e.connectors)?e.connectors:[]:[],Ed=e=>{if(!e)return"-";try{return new Date(e).toLocaleString()}catch{return e}},hwe=({headers:e})=>{const t=m.useMemo(()=>!e||typeof e!="object"?[]:Object.entries(e),[e]);return t.length===0?l.jsx("p",{className:"text-sm text-tremor-content",children:"No headers configured."}):l.jsx("dl",{className:"mt-1 space-y-1",children:t.map(([r,n])=>l.jsxs("div",{className:"grid grid-cols-[120px_1fr] gap-2 text-sm",children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:r}),l.jsx("dd",{className:"break-all text-tremor-content dark:text-dark-tremor-content",children:String(n??"")})]},r))})},gwe=({actions:e})=>!Array.isArray(e)||e.length===0?l.jsx("p",{className:"text-sm text-tremor-content",children:"No actions exposed."}):l.jsx("div",{className:"space-y-2",children:e.map(t=>l.jsxs("div",{className:"rounded border border-tremor-border p-3",children:[l.jsx("p",{className:"text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:t?.label||t?.type||"Action"}),l.jsx("p",{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:t?.description||"No description provided."}),Array.isArray(t?.params)&&t.params.length>0&&l.jsxs("div",{className:"mt-2 text-xs text-tremor-content dark:text-dark-tremor-content",children:[l.jsx("p",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Parameters"}),l.jsx("ul",{className:"mt-1 space-y-1 list-disc pl-5",children:t.params.map(r=>l.jsxs("li",{children:[l.jsx("span",{className:"font-medium",children:r?.name}),r!=null&&r.required?" (required)":""," - ",r?.description||r?.type]},r?.name||r?.type))})]})]},t?.type||t?.label))}),vR=({status:e,lastSync:t,error:r})=>{const n=e?String(e).toLowerCase():"unknown",o=j1(n),a=[o.description];t&&a.push(`Last sync: ${Ed(t)}`),r&&a.push(`Last error: ${r}`);const i=l.jsx("span",{className:"block whitespace-pre-line",children:a.filter(Boolean).join(`
207
+ `)});return l.jsx(Cf,{content:i,sideOffset:4,side:"left",children:l.jsx("svg",{viewBox:"0 0 6 6","aria-hidden":"true",className:Oo("h-3 w-3",o.dotClass),children:l.jsx("circle",{r:"3",cx:"3",cy:"3"})})})},bwe=({open:e})=>l.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",className:Oo("h-4 w-4 text-tremor-content-subtle transition-transform duration-200 dark:text-dark-tremor-content-subtle",e?"-rotate-180":"rotate-0"),children:l.jsx("path",{fill:"currentColor",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 10.94l3.71-3.71a.75.75 0 0 1 1.06 1.06l-4.24 4.25a.75.75 0 0 1-1.06 0L5.21 8.29a.75.75 0 0 1 .02-1.08Z"})}),Wk=({title:e,defaultOpen:t=!1,children:r})=>l.jsx(iv,{defaultOpen:t,children:({open:n})=>l.jsxs("div",{className:"rounded-lg border border-tremor-border bg-white dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:[l.jsxs(iv.Button,{className:"flex w-full items-center justify-between gap-3 px-4 py-3 text-sm font-semibold bg-gray-100 text-tremor-content-strong transition hover:bg-gray-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:text-dark-tremor-content-strong dark:hover:bg-dark-tremor-background-muted",children:[l.jsx("span",{children:e}),l.jsx(bwe,{open:n})]}),l.jsx(iv.Panel,{className:"mt-4 px-4 pb-4 text-sm text-tremor-content dark:text-dark-tremor-content",children:r})]})}),vwe=({connector:e})=>{const t=e?.record||{},r=e?.info||{},n=e?.actions,o=bR(e),a=j1(o);return l.jsxs("div",{className:"mt-4 space-y-3",children:[l.jsxs(Wk,{title:"Connector Details",defaultOpen:!0,children:[l.jsxs("dl",{className:"grid gap-y-2 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Status"}),l.jsxs("dd",{className:"space-y-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(vR,{status:o,lastSync:e?.last_sync,error:e?.last_error}),l.jsx(ga,{...a.badgeProps||{},children:a.label})]}),l.jsx("p",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:a.description})]})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Source"}),l.jsx("dd",{children:t.source||"-"})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Created"}),l.jsx("dd",{children:Ed(t.created_at)})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Updated"}),l.jsx("dd",{children:Ed(t.updated_at)})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Last sync"}),l.jsx("dd",{children:Ed(e?.last_sync)})]}),e?.last_error&&l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong text-red-600 dark:text-red-400",children:"Last error"}),l.jsx("dd",{className:"text-red-600 dark:text-red-400",children:e.last_error})]})]}),l.jsxs("div",{className:"mt-4",children:[l.jsx("p",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Headers"}),l.jsx(hwe,{headers:t.headers})]})]}),l.jsx(Wk,{title:"Service Info",children:r&&Object.keys(r).length>0?l.jsxs("dl",{className:"space-y-2",children:[l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Name"}),l.jsx("dd",{children:r.name||"-"})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Version"}),l.jsx("dd",{children:r.version||"-"})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Protocol version"}),l.jsx("dd",{children:r.protocol_version??"-"})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Maintainer"}),l.jsx("dd",{children:r.maintainer||"-"})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Description"}),l.jsx("dd",{children:r.description||"-"})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Supported events"}),l.jsx("dd",{children:Array.isArray(r.supported_events)&&r.supported_events.length>0?r.supported_events.join(", "):"—"})]}),l.jsxs("div",{children:[l.jsx("dt",{className:"font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Supported models"}),l.jsx("dd",{children:Array.isArray(r.supported_models)&&r.supported_models.length>0?r.supported_models.map(i=>`${i?.kind||"-"} ${i!=null&&i.version?`(${i.version})`:""}`).join(", "):"—"})]})]}):l.jsx("p",{children:"No metadata available."})}),l.jsx(Wk,{title:"Actions",children:l.jsx(gwe,{actions:n})})]})};function ywe(){const{client:e,setToast:t}=Er(),[r,n]=m.useState([]),[o,a]=m.useState(!0),[i,s]=m.useState(null),[u,c]=m.useState(null),[d,f]=m.useState(!1),[h,p]=m.useState("create"),[g,b]=m.useState(null),[v,x]=m.useState(null),[k,E]=m.useState(null),[j,S]=m.useState(!1),[C,O]=m.useState(""),M=m.useCallback(async()=>{try{a(!0),s(null);const B=await e.connectors.list(),L=pwe(B);n(L),c(q=>q&&(L.some(U=>{var H;return((H=U?.record)==null?void 0:H.id)===q})?q:null))}catch(B){console.error("Connectors load error",B),s(B?.message||"Failed to load connectors"),n([])}finally{a(!1)}},[e]);m.useEffect(()=>{M()},[M]);const A=()=>{p("create"),b(null),f(!0)},T=B=>{p("edit"),b(B?.record||null),f(!0)},_=B=>{const L=B?.record;L!=null&&L.id&&(E(L),O(""))},F=async()=>{if(k!=null&&k.id){S(!0),O(""),x(k.id);try{await e.connectors.delete(k.id),t?.({message:"Connector deleted",type:"success"}),u===k.id&&c(null),E(null),M()}catch(B){console.error("Connector delete error",B),t?.({type:"error",message:B?.message||"Failed to delete connector"}),O(B?.message||"Failed to delete connector")}finally{S(!1),x(null)}}},$=()=>{j||(E(null),O(""))},I=async B=>{if(h==="edit"&&g!=null&&g.id){const q=await e.connectors.update(g.id,B);return t?.({message:"Connector updated",type:"success"}),M(),q}const L=await e.connectors.create(B);return t?.({message:"Connector created",type:"success"}),M(),L},R=async B=>{const L=B?.record;if(L!=null&&L.id){x(L.id);try{const q={name:L.name,server_url:L.server_url,description:L.description,enabled:!L.enabled,headers:L.headers||{}};await e.connectors.update(L.id,q),t?.({message:`Connector ${L.enabled?"disabled":"enabled"}`,type:"success"}),M()}catch(q){console.error("Connector toggle error",q),t?.({type:"error",message:q?.message||"Failed to update connector status"})}finally{x(null)}}},W=r.length>0;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 gap-10 md:grid-cols-3 items-start",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Connectors (Preview)"}),l.jsx("p",{className:"mt-1 text-tremor-default leading-6 text-tremor-content dark:text-dark-tremor-content",children:"Manage outbound connectors to forward Inspectr events to other services."}),l.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[l.jsx("button",{type:"button",onClick:A,className:"rounded-tremor-default bg-tremor-brand px-4 py-2.5 text-tremor-default font-medium text-tremor-brand-inverted shadow-tremor-input hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:shadow-dark-tremor-input dark:hover:bg-dark-tremor-brand-emphasis",children:"Create connector"}),l.jsx("button",{type:"button",onClick:M,className:"rounded-tremor-default border border-tremor-border px-4 py-2.5 text-tremor-default font-medium text-tremor-content hover:bg-tremor-background-muted dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted",children:"Refresh"})]})]}),l.jsxs("div",{className:"sm:max-w-4xl md:col-span-2",children:[o&&l.jsx("p",{className:"text-tremor-default",children:"Loading connectors…"}),!o&&i&&l.jsx("p",{className:"text-sm text-red-600",children:i}),!o&&!i&&!W&&l.jsx("div",{className:"rounded-lg border border-dashed border-tremor-border p-6 text-center text-sm text-tremor-content dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"No connectors yet. Create one to start forwarding events."}),!o&&!i&&W&&l.jsx("div",{className:"space-y-4",children:r.map((B,L)=>{const q=B?.record||{},U=q.id||q.name||`connector-${L}`,H=v===q.id,X=bR(B),Y=j1(X);return l.jsxs("div",{className:"rounded-lg border border-tremor-border bg-white p-4 shadow-sm dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:[l.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("p",{className:"text-base font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:q.name||"Unnamed connector"}),l.jsx("p",{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:q.description||"No description provided."})]}),l.jsxs("div",{className:"flex gap-2 sm:justify-end self-start",children:[l.jsx("button",{type:"button",onClick:()=>c(ae=>ae===q.id?null:q.id),className:"rounded-md border border-tremor-border px-3 py-2 text-sm font-medium text-tremor-content hover:bg-tremor-background-muted dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted disabled:cursor-not-allowed disabled:opacity-70",disabled:H,children:(q.id,"Details")}),l.jsx("button",{type:"button",onClick:()=>T(B),className:"rounded-md border border-tremor-border px-3 py-2 text-sm font-medium text-tremor-content hover:bg-tremor-background-muted dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted disabled:cursor-not-allowed disabled:opacity-70",disabled:H,children:"Edit"}),l.jsx("button",{type:"button",onClick:()=>_(B),className:"rounded-md border border-red-200 px-3 py-2 text-sm font-medium text-red-600 hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-70",disabled:H,children:"Delete"})]}),l.jsx("div",{className:"sm:col-span-2",children:l.jsxs("div",{className:"flex items-center justify-between text-xs",children:[l.jsx("p",{className:"uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:q.server_url||"—"}),B?.last_sync&&l.jsxs("p",{className:"text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:["Last sync: ",Ed(B.last_sync)]})]})}),X!=="ready"&&B?.last_error&&l.jsx("div",{className:"sm:col-span-2",children:l.jsxs("div",{className:"rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-800 dark:border-amber-600 dark:bg-amber-950/40 dark:text-amber-200",children:[l.jsx("span",{className:"font-medium",children:"Connection warning:"})," ",B.last_error]})}),l.jsx("div",{className:"sm:col-span-2",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-xs text-tremor-content dark:text-dark-tremor-content",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{children:"Connection"}),l.jsx(vR,{status:X,lastSync:B?.last_sync,error:B?.last_error}),l.jsx(ga,{...Y.badgeProps||{},children:Y.label})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{children:"Status"}),l.jsx(ga,{variant:q.enabled?"success":"neutral",filled:!0,children:q.enabled?"Enabled":"Disabled"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(og,{checked:!!q.enabled,onChange:()=>R(B),disabled:H,className:Oo("relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60",q.enabled?"bg-tremor-brand dark:bg-dark-tremor-brand":"bg-gray-200 dark:bg-gray-700"),children:[l.jsx("span",{className:"sr-only",children:q.enabled?"Disable connector":"Enable connector"}),l.jsx("span",{"aria-hidden":"true",className:Oo("pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out",q.enabled?"translate-x-4":"translate-x-0")})]}),l.jsx("span",{className:"font-medium",children:q.enabled?"Disable":"Enable"})]})]})})]}),u===q.id&&l.jsx(vwe,{connector:B})]},U)})})]})]}),l.jsx(lg,{open:!!k,rule:k,title:"Delete connector?",description:l.jsxs(l.Fragment,{children:["This will permanently remove"," ",l.jsx("span",{className:"font-medium",children:k?.name||k?.id||"this connector"})," ","and its configuration."]}),confirmLabel:"Delete Connector",isDeleting:j,error:C,onCancel:$,onConfirm:F}),l.jsx(mwe,{open:d,mode:h,initialData:g||void 0,onClose:()=>f(!1),onSubmit:I}),l.jsx(Ss,{className:"my-10"})]})}const UA=[{slug:"general",label:"General"},{slug:"mock",label:"Mock"},{slug:"guard",label:"Authentication Guard"},{slug:"connectors",label:"Connectors"},{slug:"mcp-server",label:"MCP Server"},{slug:"previews",label:"Feature Previews"}],VA=()=>{const{slug:e,operationId:t}=mi();return e==="settings"&&t?t:"general"};function xwe(){const[e,t]=m.useState(VA),[r]=Na("feat_connectors");m.useEffect(()=>{const a=()=>t(VA());return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]),m.useEffect(()=>{e==="connectors"&&!r&&(window.history.replaceState(null,"","#settings/general"),t("general"))},[r,e]);const n=a=>{window.history.pushState(null,"",`#settings/${a}`),t(a)},o=r?UA:UA.filter(a=>a.slug!=="connectors");return l.jsxs("div",{className:"flex flex-col md:flex-row min-h-[calc(100vh-100px)] bg-white dark:bg-gray-950",children:[l.jsx("aside",{className:"md:w-56 border-b md:border-b-0 md:border-r border-tremor-border dark:border-dark-tremor-border md:min-h-full",children:l.jsx("nav",{className:"flex md:flex-col",children:o.map(a=>l.jsx("button",{onClick:()=>n(a.slug),className:`px-4 py-2 text-left text-tremor-default border-b md:border-b-0 md:border-l-4 md:py-3 ${e===a.slug?"md:border-tremor-brand md:text-tremor-brand text-tremor-brand font-medium bg-tremor-brand/5 dark:bg-dark-tremor-brand/10":"border-transparent text-tremor-content hover:bg-tremor-background-muted dark:hover:bg-dark-tremor-background-muted"}`,children:a.label},a.slug))})}),l.jsxs("div",{className:"flex-1 h-full overflow-y-auto p-4 sm:px-6 sm:pb-10 sm:pt-10 lg:px-10 lg:pt-7 max-w-5xl mx-auto",children:[e==="general"&&l.jsxs(l.Fragment,{children:[l.jsx(ewe,{}),l.jsx(twe,{})]}),e==="connectors"&&r&&l.jsx(ywe,{}),e==="mock"&&l.jsx(nwe,{}),e==="guard"&&l.jsx(iwe,{}),e==="mcp-server"&&l.jsx(uwe,{}),e==="previews"&&l.jsx(lwe,{})]})]})}function bl({message:e="No operations captured yet."}){return l.jsx("div",{className:"flex items-center justify-center rounded-tremor-small border border-dashed border-tremor-border py-16 text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:e})}function Ec({method:e}){return l.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold ${mj(e)}`,children:e||"N/A"})}function El({status:e}){const t=typeof e=="number"?e:Number(e);return l.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold ${bf(t)}`,children:e??"—"})}const kwe=e=>{const t=Number(e)||0;return t>=95?{label:"Healthy",color:"bg-emerald-500"}:t>=80?{label:"Warning",color:"bg-amber-500"}:{label:"Critical",color:"bg-rose-500"}};function wwe({endpoint:e}){const{method:t,path:r,host:n,count:o,successRate:a,averageDuration:i,p95Duration:s,chartData:u,latestStatus:c,seriesLoading:d,seriesError:f}=e,h=m.useMemo(()=>new Intl.NumberFormat,[]),p=kwe(a),g=d&&!u.length,b=f&&!u.length;return l.jsx(At,{className:"h-full rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ec,{method:t}),l.jsx(Kn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:r})]}),n?l.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:n}):null]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(Ht,{color:"slate",children:["Requests ",h.format(o)]}),l.jsx(El,{status:c})]})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[l.jsx("div",{className:"lg:col-span-3",children:g?l.jsx("div",{className:"flex h-36 items-center justify-center rounded-md border border-dashed border-tremor-border text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Loading series…"}):b?l.jsx("div",{className:"flex h-36 items-center justify-center rounded-md border border-rose-200 bg-rose-50 px-3 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:"Failed to load series"}):u.length?l.jsx(fD,{data:u,index:"time",categories:["duration","baseline"],colors:["cyan","gray"],showYAxis:!1,showLegend:!1,className:"h-36"}):l.jsx("div",{className:"flex h-36 items-center justify-center rounded-md border border-dashed border-tremor-border text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"No recent series data"})}),l.jsxs("div",{className:"flex flex-col justify-between gap-4 rounded-tremor-small bg-gray-50 p-4 dark:bg-dark-tremor-background",children:[l.jsxs("div",{children:[l.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Success rate"}),l.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[l.jsxs(ni,{className:"!text-xl",children:[a,"%"]}),l.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium text-white ${p.color}`,children:p.label})]})]}),l.jsxs("div",{children:[l.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Avg duration"}),l.jsx(ni,{className:"!text-xl",children:i?`${i}ms`:"N/A"}),l.jsxs(gt,{className:"mt-1 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:["p95 ",s?`${s}ms`:"N/A"]})]})]})]})]})})}function jwe({endpoints:e,loading:t,error:r}){return t?l.jsx(At,{className:"rounded-tremor-small border border-dashed border-tremor-border py-12 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Loading endpoint summary…"}):r?l.jsxs(At,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-6 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load endpoint summary: ",r.message||"Unexpected error"]}):e.length?l.jsx(jb,{numItemsSm:1,numItemsMd:1,numItemsLg:1,className:"gap-4",children:e.map(n=>l.jsx(wwe,{endpoint:n},n.key))}):l.jsx(bl,{message:"No endpoint activity to display yet."})}function Ewe({operation:e}){return l.jsx(At,{className:"h-full rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ec,{method:e.method}),l.jsx(gt,{className:`text-xs font-semibold ${vf(e.method)}`,children:e.method})]}),l.jsx(Kn,{className:"text-base text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e.path}),l.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:zn(e.timestamp)}),e.host?l.jsxs(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:["Host ",e.host]}):null]}),l.jsxs("div",{className:"flex flex-col items-end gap-2",children:[l.jsx(El,{status:e.status}),l.jsx(Ht,{color:"blue",children:ao(e.duration)})]})]}),e.tags.length>0?l.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.tags.slice(0,6).map(t=>l.jsx(cl,{tag:t},t.token)),e.tags.length>6?l.jsxs("span",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:["+",e.tags.length-6," more"]}):null]}):null]})})}const Nwe=100,Swe=40;function Owe({operations:e}){return e.length?l.jsx(jb,{numItemsSm:1,numItemsLg:2,className:"gap-4",children:e.slice(0,Nwe).map(t=>l.jsx(Ewe,{operation:t},t.id))}):l.jsx(bl,{message:"Operations will appear here once traffic flows."})}const WA=["emerald","blue","violet","amber","rose","cyan","slate","stone"],cj=24*60*60*1e3,KA=480,Kk=50,Cwe=e=>e||e===0?String(e):"Unknown",Pwe=e=>e?e.toUpperCase():"UNKNOWN",Awe=e=>e&&e.trim()?e:"Unknown",Twe=e=>e&&e.trim()?e:"Unknown",Mwe=e=>{if(Number.isFinite(e?.timestampMs))return e.timestampMs;const t=Date.parse(e?.timestamp);return Number.isNaN(t)?null:t},yR=16,xR=18,_we=50,Yk=[{key:"status",dimension:"status",limit:_we},{key:"method",dimension:"method",limit:12},{key:"host",dimension:"host",limit:12},{key:"path",dimension:"path",limit:xR},{key:"tags",dimension:"tag",limit:yR}],kR=e=>[...e].sort((t,r)=>r.count!==t.count?r.count-t.count:t.label.localeCompare(r.label)),ed=(e,t,r)=>{if(!t.length)return e;const n=new Map(e.map(o=>[o.value,o]));return t.forEach(o=>{n.has(o)||n.set(o,r(o))}),kR(Array.from(n.values()))},Iwe={hour:60*60*1e3,day:cj,week:7*cj},Dwe=(e,t="day")=>{if(!e)return{label:"Unknown",sortValue:Number.POSITIVE_INFINITY,startMs:null,endMs:null};const r=new Date(e);if(Number.isNaN(r.getTime()))return{label:"Unknown",sortValue:Number.POSITIVE_INFINITY,startMs:null,endMs:null};const n=Iwe[t]??cj,o=r.getTime(),a=o+n-1;let i;return t==="hour"?i=r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):t==="week"?i=r.toLocaleDateString([],{month:"short",day:"numeric"}):i=r.toLocaleDateString([],{month:"short",day:"numeric"}),{label:i,sortValue:o,startMs:o,endMs:a}},wR=e=>Number(e?.requests??e?.total_requests??e?.count??0),Lwe={status:e=>e?.status??e?.key??e?.value,method:e=>e?.method??e?.key??e?.value,host:e=>e?.host??e?.key??e?.value,path:e=>e?.path??e?.key??e?.value,tags:e=>e?.tag??e?.key??e?.value},jR={status:Cwe,method:Pwe,host:Awe,path:Twe,tags:e=>e&&typeof e=="string"?e:"Unknown"},Rwe=(e,t)=>{const r=Lwe[t],n=jR[t]||(a=>a??"Unknown");if(!r)return[];const o=e.map(a=>{const i=r(a),s=n(i);if(!s)return null;const u=Number(a?.count??a?.total??0);return{value:s,label:s,count:Number.isFinite(u)?u:0}}).filter(Boolean);return kR(o)},td=(e,t)=>{const r=(jR[e]||(n=>n??"Unknown"))(t);return{value:r,label:r,count:0}},Fwe=(e,t,r,n)=>{if(!Array.isArray(e)||e.length===0)return[];const o=t.filter(i=>i!=="Other"),a=t.includes("Other");return e.map(i=>{const s=i?.timestamp??i?.date??i?.bucket??null,{label:u,sortValue:c,startMs:d,endMs:f}=Dwe(s,n),h={day:u,dayKey:s||c,startMs:d,endMs:f,sortValue:c,...r};let p=0;if(o.forEach(g=>{var b;const v=Number(((b=i?.series)==null?void 0:b[g])??i?.[g]??0);Number.isFinite(v)&&(h[g]=v,p+=v)}),a){const g=wR(i),b=Number.isFinite(g)?Math.max(0,g-p):0;h.Other=b}return h}).sort((i,s)=>i.sortValue-s.sortValue).map(({sortValue:i,...s})=>s)},E1=[{key:"lt-10",label:"< 10 ms",min:0,max:10},{key:"10-20",label:"10 - 20 ms",min:10,max:20},{key:"20-50",label:"20 - 50 ms",min:20,max:50},{key:"50-100",label:"50 - 100 ms",min:50,max:100},{key:"100-250",label:"100 – 250 ms",min:100,max:250},{key:"250-500",label:"250 – 500 ms",min:250,max:500},{key:"500-1000",label:"0.5 – 1 s",min:500,max:1e3},{key:"1000-3000",label:"1 – 3 s",min:1e3,max:3e3},{key:"gte-3000",label:"> 3 s",min:3e3,max:null}],Ja={key:"unknown",label:"Unknown duration"},$we=e=>{const t=Number(e);if(!Number.isFinite(t)||t<0)return Ja.key;const r=E1.find(n=>{const o=n.min==null||t>=n.min,a=n.max==null||t<n.max;return o&&a});return r?r.key:Ja.key},Bwe=e=>{const t=new Map;return[...E1,Ja].forEach(r=>{t.set(r.key,{value:r.key,label:r.label,count:0})}),e.forEach(r=>{const n=$we(r.duration),o=t.get(n);o&&(o.count+=1)}),Array.from(t.values()).filter(r=>r.count>0).sort((r,n)=>{if(r.value===Ja.key)return 1;if(n.value===Ja.key)return-1;const o=["lt-100","100-250","250-500","500-1000","1000-3000","gte-3000"];return o.indexOf(r.value)-o.indexOf(n.value)})};function zwe({operations:e}){if(!e.length)return l.jsx(bl,{message:"No operations available for tabular view."});const{client:t}=Er(),[r,n]=m.useState(1),[o,a]=m.useState([]),[i,s]=m.useState(null),[u,c]=m.useState(!1),[d,f]=m.useState(null),[h,p]=m.useState({data:[],interval:"day",loading:!1,error:null,total:0}),[g,b]=m.useState(()=>({status:{items:[],total:0,loading:!1,error:null},method:{items:[],total:0,loading:!1,error:null},host:{items:[],total:0,loading:!1,error:null},path:{items:[],total:0,loading:!1,error:null},tags:{items:[],total:0,loading:!1,error:null}})),v=m.useMemo(()=>new Date,[]),x=m.useMemo(()=>x1("30D",v),[v]),k=x?.start??Nb(v),E=x?.end??Sb(v),[j,S]=m.useState(x?.label??"Custom"),[C,O]=m.useState(k),[M,A]=m.useState(E),[T,_]=m.useState(!1),[F,$]=m.useState(new Date(v.getTime()-30*24*60*60*1e3).toISOString().split("T")[0]),[I,R]=m.useState("00:00"),[W,B]=m.useState(v.toISOString().split("T")[0]),[L,q]=m.useState("23:59"),[U,H]=m.useState(""),[X,Y]=m.useState(()=>({status:new Set,method:new Set,host:new Set,tags:new Set,path:new Set,duration:new Set})),ae=m.useMemo(()=>Array.from(X.status),[X.status]),te=m.useMemo(()=>Array.from(X.method),[X.method]),me=m.useMemo(()=>Array.from(X.host),[X.host]),Q=m.useMemo(()=>Array.from(X.tags),[X.tags]),ue=m.useMemo(()=>Array.from(X.path),[X.path]),G=m.useMemo(()=>Array.from(X.duration),[X.duration]),de=m.useMemo(()=>G.map(ke=>ke===Ja.key?Ja:E1.find(_e=>_e.key===ke)).filter(Boolean),[G]),ie=m.useMemo(()=>JSON.stringify({status:[...ae].sort(),method:[...te].sort(),host:[...me].sort(),tags:[...Q].sort(),path:[...ue].sort(),duration:[...G].sort()}),[ae,te,me,Q,ue,G]),V=m.useMemo(()=>({get(ke){const _e={},bt=(Ot,st)=>{st.length&&(_e[Ot]=st.length===1?st[0]:st)};return ke!=="status"&&bt("status",ae),ke!=="method"&&bt("method",te),ke!=="host"&&bt("host",me),ke!=="path"&&bt("path",ue),ke!=="tags"&&bt("tag",Q),_e}}),[me,te,ue,ae,Q]),ee=m.useRef(null),[ne,ge]=m.useState(null);m.useLayoutEffect(()=>{const ke=ee.current;if(!ke)return;const _e=()=>{ge(ke.offsetHeight||null)};if(_e(),typeof ResizeObserver<"u"){const bt=new ResizeObserver(()=>_e());return bt.observe(ke),()=>bt.disconnect()}return window.addEventListener("resize",_e),()=>window.removeEventListener("resize",_e)},[]),m.useEffect(()=>{n(1)},[ie,C,M]),m.useEffect(()=>{var ke,_e;if(!T)return;const bt=new Date(C),Ot=new Date(M);Number.isNaN(bt.getTime())||($(bt.toISOString().split("T")[0]),R(((ke=bt.toISOString().split("T")[1])==null?void 0:ke.slice(0,5))||"00:00")),Number.isNaN(Ot.getTime())||(B(Ot.toISOString().split("T")[0]),q(((_e=Ot.toISOString().split("T")[1])==null?void 0:_e.slice(0,5))||"23:59"))},[T,C,M]);const Ee=m.useMemo(()=>Date.parse(C),[C]),Pe=m.useMemo(()=>Date.parse(M),[M]),Ie=Number.isFinite(Ee)&&Number.isFinite(Pe)&&Pe>=Ee,nt=m.useMemo(()=>Ie?e.filter(ke=>{const _e=Mwe(ke);return Number.isFinite(_e)?_e>=Ee&&_e<=Pe:!1}):[],[e,Ie,Ee,Pe]),Me=m.useMemo(()=>o.map(ke=>{let _e=ke.path||"";if(!_e&&ke.url)try{const bt=new URL(ke.url);_e=bt.pathname||bt.href}catch{_e=ke.url}return{id:ke.operation_id||ke.id||ke.uuid||(ke.timestamp?`ts-${ke.timestamp}`:null)||(ke.url?`url-${ke.url}`:null)||(_e?`path-${_e}`:null)||void 0,status:ke.status??ke.status_code??null,method:(ke.method||ke.http_method||"unknown").toUpperCase(),path:_e||"/",duration:ke.duration??null,timestamp:ke.timestamp??null,host:ke.server||ke.host||""}}),[o]),ot=i?.page??r,Ge=Number.isFinite(Number(ot))?Number(ot):r,at=Ge>=1?Ge:1,mt=i?.limit??i?.per_page??Kk,Ke=Number.isFinite(Number(mt))?Number(mt):Kk,pt=i?.total??i?.total_count??null,jt=pt==null?null:Number.isFinite(Number(pt))?Number(pt):null,Ze=i?.total_pages??(jt!==null&&Ke?Math.max(1,Math.ceil(jt/Ke)):Math.max(1,at)),$e=Number.isFinite(Number(Ze))?Number(Ze):Math.max(1,at),ut=at>1,$t=at<$e;m.useEffect(()=>{var ke;if(!Ie){a([]),s(null),f(null),c(!1);return}if(!((ke=t?.operations)!=null&&ke.listCompact))return;let _e=!1;return(async()=>{var bt,Ot;c(!0),f(null);try{const st={page:r,limit:Kk,since:C,until:M,sortField:"timestamp",sortDirection:"desc"},lt=V.get(void 0);lt.status&&(Array.isArray(lt.status)?lt.status.length===1?st.status=lt.status[0]:st.statuses=lt.status:st.status=lt.status),lt.method&&(Array.isArray(lt.method)?lt.method.length===1?st.method=lt.method[0]:st.methods=lt.method:st.method=lt.method),lt.host&&(Array.isArray(lt.host)?lt.host.length===1?st.host=lt.host[0]:st.hosts=lt.host:st.host=lt.host),lt.path&&(Array.isArray(lt.path)?lt.path.length===1?st.path=lt.path[0]:st.paths=lt.path:st.path=lt.path),lt.tag&&(Array.isArray(lt.tag)?lt.tag.length===1?st.tag=lt.tag[0]:st.tagsAny=lt.tag:st.tag=lt.tag);const tn=de.some(Wt=>Wt.key===Ja.key),gr=de.filter(Wt=>Wt.key!==Ja.key);if(!tn&&gr.length>0){let Wt=null,un=null;gr.forEach(rn=>{rn.min!==void 0&&rn.min!==null&&(Wt=Wt===null?rn.min:Math.min(Wt,rn.min)),rn.max!==void 0&&rn.max!==null&&(un=un===null?rn.max:Math.max(un,rn.max))}),Wt!==null&&(st.minDuration=Wt),un!==null&&(st.maxDuration=un)}const cr=await t.operations.listCompact(st);if(_e)return;const Nr=Array.isArray(cr?.operations)?cr.operations:[];a(Nr),s(cr?.meta||null);const In=Number((bt=cr?.meta)==null?void 0:bt.page),eo=Number((Ot=cr?.meta)==null?void 0:Ot.total_pages);Number.isFinite(In)&&In>=1&&In!==r?n(In):Number.isFinite(eo)&&eo>=1&&r>eo&&n(eo)}catch(st){if(_e)return;f(st instanceof Error?st.message:"Failed to load operations"),a([]),s(null)}finally{_e||c(!1)}})(),()=>{_e=!0}},[t,r,C,M,Ie,ie,ae,te,me,Q,ue,de]),m.useEffect(()=>{var ke;if(!Ie){p({data:[],interval:"day",loading:!1,error:null,total:0});return}if(!((ke=t?.stats)!=null&&ke.getBuckets))return;let _e=!1;return p(bt=>({...bt,loading:!0,error:null})),(async()=>{var bt;const Ot=V.get(void 0);try{const st=await t.stats.getBuckets({from:C,to:M,interval:"day",group:"status",...Ot});if(_e)return;const lt=Array.isArray(st?.data)?st.data:[],tn=((bt=st?.meta)==null?void 0:bt.interval)||"day",gr=lt.reduce((cr,Nr)=>cr+wR(Nr),0);p({data:lt,interval:tn,loading:!1,error:null,total:gr})}catch(st){if(_e)return;const lt=st instanceof Error?st.message:"Failed to load chart data";p({data:[],interval:"day",loading:!1,error:lt,total:0})}})(),()=>{_e=!0}},[V,t,M,Ie,C]),m.useEffect(()=>{var ke;if(!Ie){b(bt=>{const Ot={...bt};return Yk.forEach(({key:st})=>{Ot[st]={items:[],total:0,loading:!1,error:null}}),Ot});return}if(!((ke=t?.stats)!=null&&ke.aggregateBy))return;let _e=!1;return b(bt=>{const Ot={...bt};return Yk.forEach(({key:st})=>{Ot[st]={...bt[st],loading:!0,error:null}}),Ot}),(async()=>{const bt={from:C,to:M,metrics:["count"],order:"-count"},Ot=await Promise.all(Yk.map(async st=>{var lt;const tn=V.get(st.key);try{const gr=await t.stats.aggregateBy(st.dimension,{...bt,...tn,limit:st.limit}),cr=((lt=gr?.data)==null?void 0:lt.rows)??[],Nr=Rwe(cr,st.key),In=Nr.reduce((eo,Wt)=>eo+(Number.isFinite(Wt.count)?Wt.count:0),0);return{key:st.key,items:Nr,total:In,error:null}}catch(gr){const cr=gr instanceof Error?gr.message:"Failed to load facet data";return{key:st.key,items:[],total:0,error:cr}}}));_e||b(st=>{const lt={...st};return Ot.forEach(({key:tn,items:gr,total:cr,error:Nr})=>{lt[tn]={items:gr,total:cr,error:Nr,loading:!1}}),lt})})(),()=>{_e=!0}},[V,t,M,Ie,C]);const St=m.useMemo(()=>{const ke=g.status.items;return ed(ke,ae,_e=>td("status",_e))},[g.status.items,ae]),An=m.useMemo(()=>{const ke=g.method.items;return ed(ke,te,_e=>td("method",_e))},[g.method.items,te]),Zt=m.useMemo(()=>{const ke=g.host.items;return ed(ke,me,_e=>td("host",_e)).slice(0,12)},[g.host.items,me]),Jr=m.useMemo(()=>{const ke=g.tags.items;return ed(ke,Q,_e=>td("tags",_e)).slice(0,yR)},[g.tags.items,Q]),Ye=m.useMemo(()=>{const ke=g.path.items;return ed(ke,ue,_e=>td("path",_e)).slice(0,xR)},[g.path.items,ue]),jn=m.useMemo(()=>Bwe(nt),[nt]),Wr=m.useMemo(()=>[{key:"status",label:"Status code",items:St},{key:"method",label:"Method",items:An},{key:"path",label:"Path",items:Ye},{key:"duration",label:"Duration",items:jn},{key:"tags",label:"Tags",items:Jr},{key:"host",label:"Host",items:Zt}],[jn,Zt,An,Ye,St,Jr]),Qn=m.useMemo(()=>St.slice(0,5).map(ke=>ke.value),[St]),Be=m.useMemo(()=>{const ke=[...Qn];return ae.forEach(_e=>{ke.includes(_e)||ke.push(_e)}),ke},[ae,Qn]),Kr=m.useMemo(()=>{const ke=new Set(Be);return St.map(_e=>_e.value).filter(_e=>!ke.has(_e))},[Be,St]),ur=m.useMemo(()=>{const ke=[...Be];return Kr.length>0&&ke.push("Other"),ke},[Be,Kr]),Xe=m.useMemo(()=>ur.map((ke,_e)=>WA[_e%WA.length]),[ur]),Bt=m.useMemo(()=>{const ke={};return ur.forEach(_e=>{ke[_e]=0}),ke},[ur]),Tt=(ke,_e)=>{Y(bt=>{const Ot=new Set(bt[ke]);return Ot.has(_e)?Ot.delete(_e):Ot.add(_e),{...bt,[ke]:Ot}})},Qr=()=>{Y({status:new Set,method:new Set,host:new Set,tags:new Set,path:new Set,duration:new Set})},Mr=m.useMemo(()=>Ie?h.data.length?Fwe(h.data,ur,Bt,h.interval):[]:[],[ur,h.data,h.interval,Bt,Ie]),tr=m.useMemo(()=>Ie&&Number.isFinite(h.total)?h.total:0,[h.total,Ie]),_n=m.useMemo(()=>Ie?h.data.length>0?h.total:ae.length>0?St.reduce((ke,_e)=>{if(ae.includes(_e.value)){const bt=Number(_e.count)||0;return ke+bt}return ke},0):tr:0,[h.data,h.total,Ie,tr,ae,St]),Je=X.status.size+X.method.size+X.host.size+X.tags.size+X.path.size+X.duration.size,or=Ie?`${zn(C)} – ${zn(M)}`:"Invalid range selected",Et=ke=>{S(ke.label),O(ke.start),A(ke.end),_(!1),H("")},Lt=()=>{_(ke=>!ke),T||(S("Custom"),H(""))},en=()=>{if(!F||!W){H("Select both start and end dates.");return}const ke=new Date(`${F}T${I||"00:00"}:00`),_e=new Date(`${W}T${L||"00:00"}:00`);if(Number.isNaN(ke.getTime())||Number.isNaN(_e.getTime())){H("Unable to parse custom range.");return}if(ke>_e){H("Start must be before end.");return}O(ke.toISOString()),A(_e.toISOString()),S("Custom"),_(!1),H("")},Yr=ke=>{if(!ke||ke.eventType!=="bar"&&ke.eventType!=="category")return;const{startMs:_e,endMs:bt,categoryClicked:Ot}=ke;ke.eventType==="bar"&&Number.isFinite(_e)&&Number.isFinite(bt)&&bt>=_e&&(O(new Date(_e).toISOString()),A(new Date(bt).toISOString()),S("Custom")),Ot&&(Ot==="Other"?Kr.length>0&&Y(st=>{const lt=new Set(st.status);return Kr.every(tn=>lt.has(tn))?Kr.forEach(tn=>lt.delete(tn)):Kr.forEach(tn=>lt.add(tn)),{...st,status:lt}}):Tt("status",Ot)),_(!1),H("")},hr=ne??KA;return l.jsxs("div",{className:"space-y-6",children:[l.jsxs(At,{className:"rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:[l.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h3",{className:"text-base font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Requests by status code"}),l.jsx("p",{className:"mt-1 text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"Daily request volume stacked per HTTP response code."}),l.jsxs("p",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:["Range: ",or]})]}),l.jsxs("div",{className:"flex flex-col items-start gap-3 lg:items-end",children:[l.jsxs("div",{className:"relative",children:[l.jsx(k1,{selectedRange:j,onSelect:Et,onCustomClick:Lt}),T?l.jsx("div",{className:"absolute right-0 top-full z-20 mt-2 w-72 rounded-md border border-tremor-border bg-tremor-background p-3 shadow-xl dark:border-dark-tremor-border dark:bg-gray-950",children:l.jsxs("div",{className:"flex flex-col gap-3 text-xs text-tremor-content dark:text-dark-tremor-content",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:"Start"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"date",value:F,onChange:ke=>{$(ke.target.value),H("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"}),l.jsx("input",{type:"time",value:I,onChange:ke=>{R(ke.target.value),H("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"})]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:"End"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"date",value:W,onChange:ke=>{B(ke.target.value),H("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"}),l.jsx("input",{type:"time",value:L,onChange:ke=>{q(ke.target.value),H("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"})]})]}),U&&l.jsx("p",{className:"text-[11px] text-rose-600 dark:text-rose-500",children:U}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:()=>{_(!1),H("")},className:"rounded border border-tremor-border px-2 py-1 text-xs text-tremor-content hover:bg-gray-100 dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted",children:"Cancel"}),l.jsx("button",{type:"button",onClick:en,className:"rounded bg-tremor-brand px-3 py-1 text-xs font-semibold text-tremor-brand-inverted hover:bg-tremor-brand-emphasis dark:bg-dark-tremor-brand dark:text-dark-tremor-brand-inverted dark:hover:bg-dark-tremor-brand-emphasis",children:"Apply"})]})]})}):null]}),l.jsxs("div",{className:"text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:[_n.toLocaleString()," of ",tr.toLocaleString()," requests in range visible"]}),nt.length!==e.length?l.jsxs("div",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:[e.length.toLocaleString()," total requests loaded"]}):null]})]}),Ie?h.loading?l.jsx("div",{className:"mt-8 rounded border border-dashed border-tremor-border bg-white py-12 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:"Loading chart data…"}):h.error?l.jsx("div",{className:"mt-8 rounded border border-dashed border-rose-500/60 bg-rose-50 py-12 text-center text-sm text-rose-700 dark:border-rose-500/70 dark:bg-rose-900/20 dark:text-rose-200",children:h.error}):Mr.length>0?l.jsx(kh,{className:"mt-6",data:Mr,index:"day",categories:ur,colors:Xe,stack:!0,onValueChange:Yr,valueFormatter:ke=>ke.toLocaleString()}):l.jsx("div",{className:"mt-8 rounded border border-dashed border-tremor-border bg-white py-12 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:bg-dark-tremor-background",children:"No data to visualize for the selected filters."}):l.jsx("div",{className:"mt-6 rounded border border-dashed border-rose-500/60 bg-rose-50 py-6 text-center text-sm text-rose-700 dark:border-rose-500/70 dark:bg-rose-900/20 dark:text-rose-200",children:"Adjust the date range to view request trends."})]}),l.jsxs("div",{className:"grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)] lg:items-start",children:[l.jsxs(At,{ref:ee,className:"flex h-full flex-col rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",style:{minHeight:KA},children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Filters"}),Je>0&&l.jsxs("button",{type:"button",onClick:Qr,className:"text-xs font-medium text-emerald-600 hover:underline dark:text-emerald-400",children:["Clear all (",Je,")"]})]}),l.jsx("div",{className:"mt-4 space-y-6",children:Wr.map(ke=>l.jsxs("div",{children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:ke.label}),l.jsxs("div",{className:"mt-2 space-y-1",children:[ke.items.map(_e=>{const bt=X[ke.key].has(_e.value);return l.jsxs("button",{type:"button",onClick:()=>Tt(ke.key,_e.value),className:`flex w-full items-center justify-between rounded px-2 py-1.5 text-sm transition ${bt?"bg-emerald-100 text-emerald-900 dark:bg-emerald-900/30 dark:text-emerald-100":"text-tremor-content hover:bg-gray-100 dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted"}`,title:_e.label,children:[l.jsx("span",{className:"truncate",children:_e.label}),l.jsx("span",{className:"ml-3 text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:_e.count.toLocaleString()})]},_e.value)}),ke.items.length===0&&l.jsx("div",{className:"px-2 py-2 text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"No data available"})]})]},ke.key))})]}),l.jsxs(At,{className:"flex h-full flex-col rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",style:{minHeight:hr,maxHeight:hr},children:[l.jsxs("div",{className:"flex flex-col gap-2 border-b border-tremor-border px-4 py-3 dark:border-dark-tremor-border lg:flex-row lg:items-center lg:justify-between",children:[l.jsx("p",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Request details"}),l.jsxs("p",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:[u?"Loading…":`${Me.length.toLocaleString()} results${jt!==null?` • ${jt.toLocaleString()} total`:""}`,Je>0&&l.jsx("span",{children:" • Filters active"}),d&&!u&&l.jsx("span",{className:"ml-2 text-rose-500 dark:text-rose-400",children:d})]})]}),l.jsx("div",{className:"flex-1 overflow-hidden",children:l.jsx("div",{className:"h-full min-h-0 overflow-x-auto",children:l.jsx("div",{className:"h-full min-h-0 overflow-y-auto",children:l.jsxs(UL,{className:"min-w-full",children:[l.jsx(WL,{className:"sticky top-0 z-10 bg-white shadow-sm dark:bg-dark-tremor-background",children:l.jsxs(Bs,{children:[l.jsx($s,{children:"Timestamp"}),l.jsx($s,{children:"Status"}),l.jsx($s,{children:"Method"}),l.jsx($s,{children:"Path"}),l.jsx($s,{children:"Duration"}),l.jsx($s,{children:"Host"})]})}),l.jsx(VL,{children:Ie?u?l.jsx(Bs,{children:l.jsx(Yo,{colSpan:6,className:"py-10 text-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"Loading operations…"})}):d?l.jsx(Bs,{children:l.jsx(Yo,{colSpan:6,className:"py-10 text-center text-sm text-rose-500 dark:text-rose-400",children:d})}):Me.length===0?l.jsx(Bs,{children:l.jsx(Yo,{colSpan:6,className:"py-10 text-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"No operations match the selected filters."})}):Me.map((ke,_e)=>l.jsxs(Bs,{children:[l.jsx(Yo,{className:"min-w-[160px]",children:zn(ke.timestamp)}),l.jsx(Yo,{children:l.jsx(El,{status:ke.status})}),l.jsx(Yo,{children:l.jsx("span",{className:`font-semibold ${vf(ke.method)}`,children:ke.method})}),l.jsx(Yo,{className:"max-w-md truncate",children:ke.path}),l.jsx(Yo,{children:ao(ke.duration)}),l.jsx(Yo,{children:ke.host||"—"})]},ke.id??_e)):l.jsx(Bs,{children:l.jsx(Yo,{colSpan:6,className:"py-10 text-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content-subtle",children:"Select a valid date range to view operations."})})})]})})})}),l.jsx("div",{className:"border-t border-tremor-border px-4 py-3 text-xs text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content-subtle",children:l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("span",{children:["Page ",at.toLocaleString()," of ",$e.toLocaleString(),jt!==null?l.jsxs("span",{children:[" • ",jt.toLocaleString()," records"]}):null]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("button",{type:"button",onClick:()=>n(ke=>Math.max(1,ke-1)),disabled:!ut||u,className:"rounded border border-tremor-border px-3 py-1 text-xs font-medium text-tremor-content hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted",children:"Previous"}),l.jsx("button",{type:"button",onClick:()=>n(ke=>$t?ke+1:ke),disabled:!$t||u,className:"rounded border border-tremor-border px-3 py-1 text-xs font-medium text-tremor-content hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-muted",children:"Next"})]})]})})]})]})]})}const Jl=e=>{if(!Number.isFinite(e))return"—";const t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})},Hwe=e=>e>=500?"bg-rose-500/80":e>=400&&e<500?"bg-amber-500/80":e>=300&&e<400?"bg-blue-500/70":e>=200&&e<300?"bg-emerald-500/80":"bg-slate-400/70",Ql=e=>Math.min(Math.max(e,0),100),qwe=1e3,eu=60*qwe,Vs=60*eu,Do=24*Vs,Uwe=7,Gk=[1e3,2e3,5e3,15e3,3e4,eu,5*eu,15*eu,30*eu,Vs,2*Vs,3*Vs,6*Vs,12*Vs,Do,2*Do,7*Do,14*Do,30*Do,90*Do],YA=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",hour12:!1}),Vwe=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),ER=new Intl.DateTimeFormat([],{month:"short",day:"numeric"}),Wwe=new Intl.DateTimeFormat([],{weekday:"short",month:"short",day:"numeric"}),NR=new Intl.DateTimeFormat([],{month:"short",day:"numeric",year:"numeric"}),GA=new Intl.DateTimeFormat([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}),Kwe=(e,t,r)=>{const n=new Date(e);return t>=Do?r>180*Do?NR.format(n):ER.format(n):t>=Vs?r>2*Do?GA.format(n):YA.format(n):t>=eu?r>Do?GA.format(n):YA.format(n):Vwe.format(n)},Ywe=(e,t)=>{const r=new Date(e);return t>180*Do?NR.format(r):t>14*Do?ER.format(r):Wwe.format(r)},Gwe=(e,t)=>{const r=t-e;if(!Number.isFinite(r)||r<=0)return{interval:null,ticks:[],daySegments:[],startLabel:Jl(e),endLabel:Jl(t)};const n=Gk.find(c=>r/c<=Uwe)??Gk[Gk.length-1],o=[],a=Math.ceil(e/n)*n;for(let c=a;c<t;c+=n){if(c<=e||c>=t)continue;const d=Ql((c-e)/r*100);o.push({key:`tick-${c}`,value:c,percent:d,label:Kwe(c,n,r)})}const i=[];let s=e,u=0;for(;s<t&&u<730;){const c=new Date(s);c.setHours(24,0,0,0);const d=c.getTime(),f=Math.min(t,d),h=Ql((s-e)/r*100),p=(f-s)/r*100,g=Math.min(Math.max(p,0),100-h),b=p>0&&g<.3?Math.min(.3,100-h):g;if(i.push({key:`segment-${s}`,start:s,end:f,leftPercent:h,widthPercent:b,label:Ywe(s,r)}),f===s)break;s=f,u+=1}return{interval:n,ticks:o,daySegments:i,startLabel:Jl(e),endLabel:Jl(t)}};function Xwe({operations:e}){const t=m.useMemo(()=>new Date,[]),r=m.useMemo(()=>x1("Today",t),[t]),n=r?.start??Nb(t),o=r?.end??Sb(t),[a,i]=m.useState(r?.label??"Custom"),[s,u]=m.useState(n),[c,d]=m.useState(o),[f,h]=m.useState(!1),[p,g]=m.useState(new Date(t.getTime()-7*24*60*60*1e3).toISOString().split("T")[0]),[b,v]=m.useState("00:00"),[x,k]=m.useState(t.toISOString().split("T")[0]),[E,j]=m.useState("23:59"),[S,C]=m.useState(null),[O,M]=m.useState(!1),[A,T]=m.useState(""),_=m.useMemo(()=>{const ue=new Map;return e.forEach(G=>{G.tags.forEach(de=>{ue.has(de.raw)||ue.set(de.raw,de)})}),Array.from(ue.keys()).sort((G,de)=>G.localeCompare(de))},[e]);m.useEffect(()=>{S&&(_.includes(S)||C(null))},[_,S]),m.useEffect(()=>{_.length||O&&M(!1)},[_,O]),m.useEffect(()=>{var ue,G;if(!f)return;const de=new Date(s),ie=new Date(c);Number.isNaN(de.getTime())||(g(de.toISOString().split("T")[0]),v(((ue=de.toISOString().split("T")[1])==null?void 0:ue.slice(0,5))||"00:00")),Number.isNaN(ie.getTime())||(k(ie.toISOString().split("T")[0]),j(((G=ie.toISOString().split("T")[1])==null?void 0:G.slice(0,5))||"00:00"))},[f,s,c]);const F=m.useMemo(()=>{var ue;return S&&((ue=yu(S))==null?void 0:ue.token)||null},[S]),$=m.useMemo(()=>Date.parse(s),[s]),I=m.useMemo(()=>Date.parse(c),[c]),R=Number.isFinite($)&&Number.isFinite(I)&&I>$,W=R?I-$:1,B=m.useMemo(()=>R?e.filter(ue=>!ue.timestampMs||ue.timestampMs<$||ue.timestampMs>I?!1:F?ue.tags.some(G=>G.token===F):!0).sort((ue,G)=>(ue.timestampMs||0)-(G.timestampMs||0)):[],[e,R,$,I,F]),L=m.useMemo(()=>{if(!B.length)return[];if(!O)return[{key:"all",label:null,operations:B.map(G=>({operation:G}))}];const ue=new Map;return B.forEach(G=>{if(!G.tags.length){const de=ue.get("__untagged__")||{key:"__untagged__",label:null,operations:[]};de.operations.push({operation:G}),ue.set("__untagged__",de);return}G.tags.forEach(de=>{const ie=de.token;ue.has(ie)||ue.set(ie,{key:ie,label:de,operations:[]}),ue.get(ie).operations.push({operation:G,tag:de})})}),Array.from(ue.values()).sort((G,de)=>{var ie,V;const ee=((ie=G.label)==null?void 0:ie.display)||"Untagged",ne=((V=de.label)==null?void 0:V.display)||"Untagged";return ee.localeCompare(ne)})},[B,O]),{ticks:q,daySegments:U,startLabel:H,endLabel:X}=m.useMemo(()=>R?Gwe($,I):{ticks:[],daySegments:[],startLabel:"",endLabel:""},[R,$,I]),Y=ue=>{i(ue.label),u(ue.start),d(ue.end),h(!1),T("")},ae=()=>{h(ue=>!ue),f||i("Custom")},te=()=>{if(!p||!x){T("Select start and end dates.");return}const ue=new Date(`${p}T${b||"00:00"}:00`),G=new Date(`${x}T${E||"00:00"}:00`);if(Number.isNaN(ue.getTime())||Number.isNaN(G.getTime())){T("Unable to parse custom range.");return}if(ue>G){T("Start must be before end.");return}u(ue.toISOString()),d(G.toISOString()),i("Custom"),h(!1),T("")},me=`${zn(s)} – ${zn(c)}`,Q=_.length>0;return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[l.jsxs("div",{className:"relative flex flex-wrap items-center gap-3",children:[l.jsx(k1,{selectedRange:a,onSelect:Y,onCustomClick:ae}),f?l.jsx("div",{className:"absolute left-0 top-full z-20 mt-2 w-72 rounded-md border border-tremor-border bg-tremor-background p-3 shadow-xl dark:border-dark-tremor-border dark:bg-gray-950",children:l.jsxs("div",{className:"flex flex-col gap-3 text-xs text-tremor-content dark:text-dark-tremor-content",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:"Start"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"date",value:p,onChange:ue=>{g(ue.target.value),T("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"}),l.jsx("input",{type:"time",value:b,onChange:ue=>{v(ue.target.value),T("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"})]})]}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide",children:"End"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{type:"date",value:x,onChange:ue=>{k(ue.target.value),T("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"}),l.jsx("input",{type:"time",value:E,onChange:ue=>{j(ue.target.value),T("")},className:"w-full rounded border border-tremor-border px-2 py-1 text-sm focus:outline-none focus-visible:ring-2 focus-visible:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900"})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",className:"rounded border border-tremor-border px-2 py-1 text-xs font-medium text-tremor-content hover:bg-tremor-background-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content dark:hover:bg-dark-tremor-background-subtle",onClick:()=>h(!1),children:"Cancel"}),l.jsx("button",{type:"button",className:"rounded bg-tremor-brand px-3 py-1 text-xs font-medium text-white hover:bg-tremor-brand-emphasis",onClick:te,children:"Apply range"})]}),A?l.jsx("p",{className:"text-[11px] text-rose-600 dark:text-rose-400",children:A}):null]})}):null,l.jsx(up,{options:_,selected:S,onSelect:C,placeholder:"Filter by tag"})]}),l.jsx("div",{className:"flex items-center gap-3",children:l.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-tremor-content dark:text-dark-tremor-content",children:[l.jsx("input",{type:"checkbox",className:"size-4 rounded border-tremor-border text-tremor-brand focus:ring-tremor-brand dark:border-dark-tremor-border dark:bg-gray-900",checked:O,disabled:!Q,onChange:ue=>M(ue.target.checked)}),"Group by tags"]})})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[l.jsx("span",{children:me}),l.jsxs("span",{children:[B.length," operations"]})]}),A?l.jsx("p",{className:"text-xs text-rose-600 dark:text-rose-400",children:A}):null,l.jsx(At,{className:"rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:R?L.length===0?l.jsx(bl,{message:"No operations captured in the selected range."}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:gap-4",children:[l.jsx("div",{className:"hidden md:block md:w-1/3 lg:w-1/5"}),l.jsx("div",{className:"w-full md:w-2/3 lg:w-4/5",children:l.jsxs("div",{className:"relative h-20",children:[l.jsx("div",{className:"absolute inset-x-0 top-0 h-7",children:l.jsx("div",{className:"relative h-full overflow-hidden rounded-tremor-small border border-tremor-border bg-tremor-background-subtle dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:U.map((ue,G)=>{const de=Ql(ue.leftPercent),ie=Math.min(Math.max(ue.widthPercent,0),100-de),V=ue.widthPercent>0&&ie<.3?Math.min(.3,100-de):ie;return l.jsx("div",{className:`absolute flex h-full items-center justify-center px-2 text-[10px] font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content-subtle ${G>0?"border-l border-tremor-border dark:border-dark-tremor-border":""}`,style:{left:`${de}%`,width:`${V}%`},children:l.jsx("span",{className:"pointer-events-none truncate",children:ue.label})},ue.key)})})}),l.jsx("div",{className:"absolute inset-x-0 bottom-6",children:l.jsxs("div",{className:"relative h-8",children:[l.jsx("div",{className:"absolute inset-x-0 bottom-0 border-t border-dashed border-tremor-border dark:border-dark-tremor-border"}),q.map(ue=>l.jsxs("div",{className:"absolute bottom-0 flex -translate-x-1/2 flex-col items-center text-[11px] font-medium text-tremor-content-subtle dark:text-dark-tremor-content",style:{left:`${Ql(ue.percent)}%`},children:[l.jsx("span",{className:"mb-1 whitespace-nowrap",children:ue.label}),l.jsx("span",{className:"block h-2 border-l border-tremor-border dark:border-dark-tremor-border"})]},ue.key))]})}),l.jsxs("div",{className:"absolute inset-x-0 bottom-0 flex justify-between text-[10px] text-tremor-content-subtle dark:text-dark-tremor-content",children:[l.jsx("span",{children:H||Jl($)}),l.jsx("span",{children:X||Jl(I)})]})]})})]}),l.jsx("div",{className:"space-y-4",children:L.map(ue=>l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[l.jsx("div",{className:"flex items-center gap-2",children:O?ue.label?l.jsx(cl,{tag:ue.label}):l.jsx("span",{className:"rounded-full bg-slate-100 px-3 py-1 text-[11px] font-medium text-slate-600 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:"Untagged"}):l.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"All operations"})}),l.jsxs("span",{className:"text-[11px] text-tremor-content-subtle dark:text-dark-tremor-content",children:[ue.operations.length," ops"]})]}),l.jsx("div",{className:"space-y-3",children:ue.operations.map(({operation:G,tag:de},ie)=>{const V=G.timestampMs??0,ee=Number.isFinite(G.duration)?G.duration:0,ne=ee>0?V+ee:V,ge=Math.max(V,$),Ee=Math.max(ge,Math.min(ne,I)),Pe=(ge-$)/W*100,Ie=(Ee-ge)/W*100,nt=Ql(Pe),Me=Ie>0?`${Math.max(Ie,.8)}%`:"6px",ot=Ie>0?void 0:"translateX(-50%)",Ge=`${G.method} ${G.path}
208
+ ${zn(G.timestamp)}
209
+ Duration ${ao(G.duration)}`,at=Hwe(G.status),mt=`${G.id||G.operationId||G.timestampMs||"op"}-${de?.token||"all"}-${ie}`;return l.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-stretch md:gap-4",children:[l.jsxs("div",{className:"w-full min-w-0 md:w-1/3 lg:w-1/5",children:[l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.jsx("span",{className:`font-semibold uppercase ${vf(G.method)}`,children:G.method}),l.jsx("span",{className:"max-w-md truncate text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:G.path||"/"}),l.jsxs("span",{className:"max-w-md truncate text-[11px] text-tremor-content-subtle dark:text-dark-tremor-content",children:["(",ao(G.duration),")"]})]}),l.jsx("div",{className:"text-[11px] text-tremor-content-subtle dark:text-dark-tremor-content",children:zn(G.timestamp)})]}),l.jsx("div",{className:"w-full md:w-2/3 lg:w-4/5",children:l.jsxs("div",{className:"relative h-10 overflow-hidden rounded-tremor-small border border-dashed border-tremor-border bg-tremor-background-subtle dark:border-dark-tremor-border dark:bg-dark-tremor-background-subtle",children:[l.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[U.slice(1).map(Ke=>l.jsx("div",{className:"absolute top-0 bottom-0 border-l border-tremor-border dark:border-dark-tremor-border",style:{left:`${Ke.leftPercent}%`}},`day-boundary-${Ke.key}`)),q.filter(Ke=>Ke.percent>0&&Ke.percent<100).map(Ke=>l.jsx("div",{className:"absolute top-1 bottom-1 border-l border-tremor-border opacity-40 dark:border-dark-tremor-border dark:opacity-50",style:{left:`${Ql(Ke.percent)}%`}},`grid-${Ke.key}`))]}),l.jsxs("div",{className:`absolute inset-y-1 z-10 flex items-center overflow-hidden rounded ${at} text-[10px] font-semibold uppercase tracking-wide text-white shadow-sm`,style:{left:`${nt}%`,width:Me,transform:ot},title:Ge,children:[l.jsx("span",{className:"px-2 truncate",children:G.method}),l.jsxs("span",{className:"px-2 truncate",children:["Duration ",ao(G.duration)]})]})]})})]},mt)})})]},ue.key))})]}):l.jsx(bl,{message:"Select a valid time range to view the timeline."})})]})}const ko=(...e)=>e.filter(Boolean).join(" "),Zwe=e=>{if(!e)return null;try{return new URL(e)}catch{return null}},Jwe=(e,t)=>{if(!e)return t??null;const r=Date.parse(e);return Number.isFinite(r)?r:t??null},SR=e=>{if(e==null)return"N/A";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},dj=e=>e?e.trace_id||e.traceId||"Trace":"Unknown trace",Qwe=(e,t=0)=>{if(!e)return null;const r=e.request||{},n=e.response||{},o=e.timing||{},a=e.meta||{},i=r.url||"",s=Zwe(i),u=r.timestamp||n.timestamp||a.timestamp||e.timestamp||null,c=Jwe(u,t),d=Number.isFinite(Number(o.duration))?Number(o.duration):Number.isFinite(Number(e.duration))?Number(e.duration):null,f=Array.isArray(a.tags)?a.tags:Array.isArray(e.tags)?e.tags:[];return{id:e.operation_id||e.operationId||`operation-${t}`,method:(r.method||e.method||"GET").toUpperCase(),status:n.status??e.status??null,duration:d,timestamp:u,timestampMs:c,path:r.path||s?.pathname||i||"/",host:r.server||s?.host||"",url:i,request:r,response:n,timing:o,tags:Sf(f),correlationId:e.correlation_id||null,traceInfo:a.trace||null,raw:e}},e2e=(e,t)=>{if(e!=null&&e.first_seen&&e!=null&&e.last_seen){const o=Date.parse(e.first_seen),a=Date.parse(e.last_seen);if(Number.isFinite(o)&&Number.isFinite(a)&&a>=o)return a-o}if(!(t!=null&&t.length))return null;let r=null,n=null;return t.forEach((o,a)=>{const{start:i,end:s}=Ob(o,a);r=r===null?i:Math.min(r,i),n=n===null?s:Math.max(n,s)}),r===null||n===null||n<r?null:n-r},Ob=(e,t=0)=>{const r=Number.isFinite(e.timestampMs)?e.timestampMs:t,n=Number.isFinite(e.duration)?e.duration:0,o=r+n;return{start:r,duration:n,end:o}},t2e=e=>{if(!(e!=null&&e.length))return{start:0,end:1,duration:1};let t=null,r=null;if(e.forEach((o,a)=>{const{start:i,end:s}=Ob(o,a);t=t===null?i:Math.min(t,i),r=r===null?s:Math.max(r,s)}),t===null||r===null)return{start:0,end:1,duration:1};const n=Math.max(r-t,1);return{start:t,end:r,duration:n}},OR=e=>e>=500?"bg-rose-500/80":e>=400?"bg-amber-500/80":e>=300?"bg-blue-500/70":e>=200?"bg-emerald-500/80":"bg-slate-400/70",CR=e=>e>=500?"bg-rose-500":e>=400?"bg-amber-500":e>=300?"bg-blue-500":e>=200?"bg-emerald-500":"bg-slate-400",r2e=e=>{var t;return(t=e?.raw)!=null&&t.meta?Object.entries(e.raw.meta).filter(([r])=>r!=="tags"&&r!=="trace").map(([r,n])=>({key:r,value:SR(n)})):[]},n2e=e=>{var t;const r=(t=e?.traceInfo)==null?void 0:t.generic;return!r||typeof r!="object"?[]:Object.entries(r).map(([n,o])=>({key:n,value:SR(o)}))},o2e=e=>{var t;if(!((t=e?.tags)!=null&&t.length))return null;const r=e.tags.find(n=>n.keyToken==="agent")||e.tags.find(n=>n.key==="agent");return r&&(r.value||r.display)||null},PR=({operation:e,mcpMeta:t})=>{var r,n;return l.jsxs("dl",{className:"divide-y divide-tremor-border text-sm dark:divide-dark-tremor-border",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[l.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Request time"}),l.jsx("dd",{className:"text-right text-tremor-content dark:text-dark-tremor-content",children:zn(e.timestamp)})]}),l.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[l.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Operation ID"}),l.jsx("dd",{className:"text-right text-sm font-mono text-tremor-content dark:text-dark-tremor-content",children:e.id})]}),l.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[l.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Correlation ID"}),l.jsx("dd",{className:"text-right text-sm font-mono text-tremor-content dark:text-dark-tremor-content",children:e.correlationId||"—"})]}),l.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[l.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace ID"}),l.jsx("dd",{className:"text-right text-sm font-mono text-tremor-content dark:text-dark-tremor-content",children:((r=e.traceInfo)==null?void 0:r.trace_id)||"—"})]}),l.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[l.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace source"}),l.jsx("dd",{className:"text-right text-tremor-content dark:text-dark-tremor-content",children:((n=e.traceInfo)==null?void 0:n.source)||"—"})]}),t!=null&&t.tokens?l.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[l.jsx("dt",{className:"text-tremor-content-subtle dark:text-dark-tremor-content",children:"Tokens"}),l.jsxs("dd",{className:"flex items-center gap-2 text-right text-tremor-content dark:text-dark-tremor-content",children:[l.jsxs(Ht,{color:"indigo",size:"xs",children:["Request ",t.tokens.request??"—"]}),l.jsxs(Ht,{color:"indigo",size:"xs",children:["Response ",t.tokens.response??"—"]}),l.jsxs(Ht,{color:"indigo",size:"xs",children:["Total ",t.tokens.total??"—"]})]})]}):null]})},XA=({headers:e=[]})=>e.length?l.jsx("div",{className:"max-h-60 overflow-auto",children:l.jsx("dl",{className:"divide-y divide-tremor-border dark:divide-dark-tremor-border",children:e.map((t,r)=>l.jsxs("div",{className:"flex items-start gap-3 px-3 py-1",children:[l.jsx("dt",{className:"w-40 shrink-0 text-[10px] font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:t.name}),l.jsx("dd",{className:"flex-1 text-[10px] text-tremor-content dark:text-dark-tremor-content",children:t.value||"—"})]},`${t.name}-${r}`))})}):l.jsx(gt,{className:"px-3 py-2 text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:"No headers"}),fj=e=>e?Array.isArray(e)?e.map(t=>({name:t.name??t.key??"",value:t.value})):typeof e=="object"?"name"in e&&"value"in e?[{name:e.name,value:e.value}]:Object.entries(e).map(([t,r])=>({name:t,value:r})):[]:[],ZA=e=>{var t;const r=(t=fj(e).find(n=>{var o;return((o=n.name)==null?void 0:o.toLowerCase())==="content-type"}))==null?void 0:t.value;return!r||typeof r!="string"?null:r.split(";")[0].trim().toLowerCase()},JA=e=>!e||e.includes("json")?"json":e.includes("html")?"html":e.includes("xml")?"xml":e.includes("javascript")?"javascript":e.includes("css")?"css":e.includes("yaml")||e.includes("yml")?"yaml":e.includes("sql")?"sql":(e.startsWith("text/"),"plaintext"),QA=(e,t)=>{if(e==null)return"";if(typeof e=="string"){if(t!=null&&t.includes("json"))try{const r=JSON.parse(e);return JSON.stringify(r,null,2)}catch{return e}if(t!=null&&t.includes("xml"))try{return OT(e)}catch{return e}return e}if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)};function AR({operation:e,isLoading:t}){var r,n,o,a,i,s,u,c,d,f,h,p,g,b,v,x;typeof window<"u"&&localStorage.getItem("debug")==="true"&&console.log("OP",e);const k=r2e(e),E=m.useMemo(()=>new Set(["proxy","ingress","inspectr"]),[]),j=k.filter(L=>!E.has(L.key)),S=k.filter(L=>E.has(L.key)),C=n2e(e),O=Array.isArray(e?.tags)?e.tags:[],M=fj((r=e?.request)==null?void 0:r.headers),A=fj((n=e?.response)==null?void 0:n.headers),T=((o=e?.meta)==null?void 0:o.mcp)||((i=(a=e?.raw)==null?void 0:a.meta)==null?void 0:i.mcp)||((u=(s=e?.meta)==null?void 0:s.trace)==null?void 0:u.mcp)||((f=(d=(c=e?.raw)==null?void 0:c.meta)==null?void 0:d.trace)==null?void 0:f.mcp)||{},_=ZA((h=e?.request)==null?void 0:h.headers),F=ZA((p=e?.response)==null?void 0:p.headers),$=QA((g=e?.request)==null?void 0:g.body,_),I=QA((b=e?.response)==null?void 0:b.body,F),R=JA(_),W=JA(F),B=m.useMemo(()=>({readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",fontSize:12,lineNumbers:"off",folding:!1}),[]);return e?l.jsxs("div",{className:"flex h-full flex-col",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ec,{method:e.method}),l.jsx(Kn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:`${e.path||e.url||"Operation"}`})]}),l.jsx(gt,{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:e.host||((v=e.request)==null?void 0:v.server)||"Unspecified host"})]}),l.jsxs("div",{className:"flex flex-col items-end gap-2",children:[l.jsx(El,{status:e.status}),l.jsx(Ht,{color:"blue",children:ao(e.duration)})]})]}),l.jsxs("div",{className:"mt-6 space-y-5",children:[l.jsx(bo,{title:"Properties",resetKey:e?.id,defaultOpen:!0,children:l.jsx(PR,{operation:e,mcpMeta:T})}),l.jsx(bo,{title:`Request headers (${M.length})`,resetKey:e?.id,defaultOpen:!1,children:l.jsx(XA,{headers:M})}),l.jsx(bo,{title:"Request body",resetKey:e?.id,defaultOpen:!1,copyText:$,children:l.jsx("div",{className:"h-60 overflow-hidden",children:l.jsx(si,{value:$||"No request body",language:R,theme:ui(),beforeMount:li,options:B,height:"100%"})})}),l.jsx(bo,{title:"Response body",resetKey:e?.id,defaultOpen:!1,copyText:I,children:l.jsx("div",{className:"h-[320px] overflow-hidden",children:l.jsx(si,{value:I||"No response body",language:W,theme:ui(),beforeMount:li,options:B,height:"100%"})})}),l.jsx(bo,{title:`Response headers (${A.length})`,resetKey:e?.id,defaultOpen:!1,children:l.jsx(XA,{headers:A})}),O.length?l.jsxs("div",{children:[l.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"Tags"}),l.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:O.map(L=>l.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-100 px-2.5 py-1 text-xs font-medium text-gray-700 dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content",children:L.display},L.token))})]}):null,j.length?l.jsx(bo,{title:"Metadata",resetKey:e?.id,defaultOpen:!1,children:l.jsx("div",{className:"px-3 py-2",children:l.jsx("div",{className:"mt-2 space-y-3",children:j.map(L=>l.jsxs("div",{children:[l.jsx(gt,{className:"text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:L.key}),l.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-tremor-small bg-gray-900 px-3 py-2 text-xs text-gray-100 dark:bg-gray-800 dark:text-gray-100",children:L.value})]},L.key))})})}):null,S.length||C.length?l.jsx(bo,{title:"Advanced metadata",resetKey:e?.id,defaultOpen:!1,children:l.jsxs("div",{className:"divide-y divide-tremor-border text-sm dark:divide-dark-tremor-border",children:[(x=e.traceInfo)!=null&&x.generic&&C.length?l.jsxs("div",{className:"px-3 py-2",children:[l.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace metadata"}),l.jsx("div",{className:"mt-2 space-y-3",children:C.map(L=>l.jsxs("div",{children:[l.jsx(gt,{className:"text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:L.key}),l.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-tremor-small bg-gray-900 px-3 py-2 text-xs text-gray-100 dark:bg-gray-800 dark:text-gray-100",children:L.value})]},L.key))})]}):null,S.map(L=>l.jsxs("div",{className:"px-3 py-2",children:[l.jsx(gt,{className:"text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:L.key}),l.jsx("pre",{className:"mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-tremor-small bg-gray-900 px-3 py-2 text-xs text-gray-100 dark:bg-gray-800 dark:text-gray-100",children:L.value})]},L.key))]})}):null]})]}):l.jsx("div",{className:"flex h-full items-center justify-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:t?"Loading trace details…":"Select a span to inspect its details."})}const e9=200,TR=({initialTraceId:e=null,initialOperationId:t=null,onTraceChange:r,onOperationChange:n,isActive:o=!0,listLimit:a=e9,detailLimit:i=e9}={})=>{var s,u;const{client:c}=Er(),d=!!((s=c?.traces)!=null&&s.list&&(u=c?.traces)!=null&&u.get),[f,h]=m.useState([]),[p,g]=m.useState(null),[b,v]=m.useState(!1),[x,k]=m.useState(null),[E,j]=m.useState(e??null),[S,C]=m.useState(null),[O,M]=m.useState(null),[A,T]=m.useState([]),[_,F]=m.useState(!1),[$,I]=m.useState(null),[R,W]=m.useState(0),[B,L]=m.useState(1),[q,U]=m.useState(0),[H,X]=m.useState(t??null),Y=m.useRef(r),ae=m.useRef(n),te=m.useRef(void 0),me=m.useRef(void 0);m.useEffect(()=>{Y.current=r},[r]),m.useEffect(()=>{ae.current=n},[n]),m.useEffect(()=>{e&&e!==E&&j(e)},[e]),m.useEffect(()=>{t&&t!==H&&X(t)},[t]),m.useEffect(()=>{if(!d||!o)return;let ee=!0;return v(!0),k(null),c.traces.list({limit:a}).then(ne=>{ee&&(h(Array.isArray(ne?.traces)?ne.traces:[]),g(ne?.meta||null))}).catch(ne=>{ee&&(k(ne),h([]),g(null))}).finally(()=>{ee&&v(!1)}),()=>{ee=!1}},[d,c,a,o,q]),m.useEffect(()=>{var ee;if(!f.length||E)return;const ne=e&&f.some(ge=>ge.trace_id===e)?e:((ee=f[0])==null?void 0:ee.trace_id)??null;ne&&ne!==E&&j(ne)},[f,E,e]),m.useEffect(()=>{L(1)},[E]),m.useEffect(()=>{if(!d||!o||!E){C(null),M(null),T([]),I(null);return}let ee=!0;return F(!0),I(null),c.traces.get(E,{page:B,limit:i}).then(ne=>{ee&&(C(ne?.trace||null),M(ne?.meta||null),T(Array.isArray(ne?.operations)?ne.operations:[]))}).catch(ne=>{ee&&(I(ne),C(null),M(null),T([]))}).finally(()=>{ee&&F(!1)}),()=>{ee=!1}},[d,c,E,i,o,R,B]);const Q=m.useMemo(()=>Array.isArray(A)?A.map((ee,ne)=>Qwe(ee,ne)).filter(Boolean).sort((ee,ne)=>{const ge=Number.isFinite(ee.timestampMs)?ee.timestampMs:0,Ee=Number.isFinite(ne.timestampMs)?ne.timestampMs:0;return ge-Ee}):[],[A]);m.useEffect(()=>{if(!Q.length){H!==null&&X(null);return}if(H&&Q.some(ne=>ne.id===H))return;const ee=t&&Q.some(ne=>ne.id===t)?t:Q[0].id;ee!==H&&X(ee)},[Q,H,t]);const ue=m.useMemo(()=>H&&Q.find(ee=>ee.id===H)||null,[Q,H]),G=m.useMemo(()=>S||f.find(ee=>ee.trace_id===E)||null,[S,f,E]),de=G?.sources||S?.sources||[],ie=m.useMemo(()=>e2e(G,Q),[G,Q]),V=m.useMemo(()=>t2e(Q),[Q]);return m.useEffect(()=>{!o||typeof Y.current!="function"||te.current!==E&&(te.current=E,Y.current(E||null))},[E,o]),m.useEffect(()=>{!o||typeof ae.current!="function"||me.current!==H&&(me.current=H,ae.current(H||null))},[H,o]),m.useEffect(()=>{o||(v(!1),F(!1))},[o]),{supportsTraces:d,traceList:f,traceListMeta:p,isTraceListLoading:b,traceListError:x,traceDetail:S,traceDetailMeta:O,traceDetailError:$,isTraceDetailLoading:_,selectedTraceId:E,setSelectedTraceId:ee=>{if(!ee){j(null),X(null);return}ee!==E&&X(null),j(ee)},traceSummary:G,traceSources:de,traceDurationMs:ie,normalizedOperations:Q,timeline:V,selectedOperationId:H,setSelectedOperationId:ee=>{X(ee)},selectedOperation:ue,refreshTraceList:()=>U(ee=>ee+1),refreshTraceDetail:()=>W(ee=>ee+1),traceDetailPage:B,setTraceDetailPage:L}},t9=2;function a2e({operations:e=[],initialTraceId:t=null,initialOperationId:r=null,onTraceChange:n,onOperationChange:o,isActive:a=!0}){const{supportsTraces:i,traceList:s,traceListMeta:u,isTraceListLoading:c,traceListError:d,traceDetailError:f,traceDetailMeta:h,isTraceDetailLoading:p,selectedTraceId:g,setSelectedTraceId:b,traceSummary:v,traceSources:x,traceDurationMs:k,normalizedOperations:E,timeline:j,selectedOperationId:S,setSelectedOperationId:C,selectedOperation:O}=TR({initialTraceId:t,initialOperationId:r,onTraceChange:n,onOperationChange:o,isActive:a}),M=j.start,A=j.duration;if(!i)return l.jsx(At,{className:"rounded-tremor-small border border-dashed border-tremor-border p-6 text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Trace exploration requires an Inspectr API version that exposes the /api/traces endpoints."});if(c&&!s.length)return l.jsx(At,{className:"rounded-tremor-small border border-tremor-border p-6 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Loading traces…"});if(d&&!s.length)return l.jsxs(At,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-6 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load traces: ",d.message||"Unexpected error"]});if(!s.length)return l.jsx(bl,{message:"No traces recorded yet. Start sending traffic to populate this view."});const T=v?.operation_count||E.length,_=F=>{var $;const I=Number.isFinite(F.timestampMs)?F.timestampMs:M,R=Number.isFinite(F.duration)?F.duration:0,W=(I-M)/A*100,B=Math.min(Math.max(W,0),100),L=R/A*100,q=Math.min(Math.max(Number.isFinite(L)?L:t9,t9),100-B),U=S===F.id,H=`${F.method} ${F.path}`;return l.jsxs("button",{type:"button",onClick:()=>C(F.id),className:ko("w-full rounded-tremor-small border px-3 py-3 text-left transition focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:border-dark-tremor-border",U?"border-tremor-brand bg-tremor-brand-faint ring-0 dark:border-tremor-brand":"border-transparent hover:border-slate-200 hover:bg-slate-50 dark:hover:border-slate-600 dark:hover:bg-dark-tremor-background-subtle"),children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:ko("h-2.5 w-2.5 rounded-full",CR(F.status??null))}),l.jsx("span",{className:"truncate text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:H})]}),l.jsxs("div",{className:"flex flex-col items-end gap-1 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[l.jsx("span",{children:ao(F.duration)}),l.jsx("span",{children:zn(F.timestamp)})]})]}),l.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[l.jsx(Ec,{method:F.method}),l.jsx(El,{status:F.status}),($=F.traceInfo)!=null&&$.source?l.jsx(Ht,{color:"blue",children:F.traceInfo.source}):null,F.host?l.jsx("span",{className:"truncate",children:F.host}):null]}),l.jsx("div",{className:"relative mt-3 h-2 rounded-full bg-slate-100 dark:bg-dark-tremor-background-subtle",children:l.jsx("span",{className:ko("absolute top-0 h-2 rounded-full transition-all",OR(F.status??null)),style:{left:`${B}%`,width:`${q}%`}})})]},F.id)};return l.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)]",children:[l.jsxs(At,{className:"rounded-tremor-small border border-tremor-border p-6 dark:border-dark-tremor-border",children:[l.jsxs(wb,{justifyContent:"between",alignItems:"start",children:[l.jsxs("div",{children:[l.jsx(Kn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Trace explorer"}),l.jsx(gt,{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:"Inspect spans collected for a trace and explore downstream requests."})]}),l.jsx(Ht,{color:f?"rose":"slate",children:`${T} ${T===1?"step":"steps"}`})]}),l.jsxs("div",{className:"mt-6 flex flex-col gap-4",children:[l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{children:[l.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace"}),l.jsx(gt,{className:"text-sm text-tremor-content-strong dark:text-dark-tremor-content-strong",children:dj(v)})]}),x!=null&&x.length?l.jsx("div",{className:"flex flex-wrap gap-2",children:x.map(F=>l.jsx(Ht,{color:"blue",children:F},F))}):null,l.jsxs("div",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[v!=null&&v.first_seen?l.jsxs("div",{children:["First seen: ",zn(v.first_seen)]}):null,v!=null&&v.last_seen?l.jsxs("div",{children:["Last seen: ",zn(v.last_seen)]}):null,k!=null?l.jsxs("div",{children:["Observed duration: ",ao(k)]}):null]})]}),l.jsx(v1,{className:"w-full sm:w-72 [&>button]:rounded-tremor-small",enableClear:!1,value:g??v?.trace_id??"",onValueChange:b,children:s.map(F=>l.jsx(Zi,{value:F.trace_id,children:dj(F)},F.trace_id))})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[l.jsxs("span",{children:["Page ",h?.page||u?.page||1," of"," ",u?.total_pages||h?.total_pages||1]}),l.jsx("span",{children:p?"Refreshing trace…":`Total operations: ${T}`})]}),f?l.jsxs(At,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load trace details: ",f.message||"Unexpected error"]}):null,l.jsx("div",{className:"space-y-4",children:E.length?E.map(F=>_(F)):l.jsx(At,{className:"rounded-tremor-small border border-dashed border-tremor-border p-6 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"No operations recorded for this trace."})})]})]}),l.jsx(At,{className:"rounded-tremor-small border border-tremor-border p-6 dark:border-dark-tremor-border",children:l.jsx(AR,{operation:O,isLoading:p})})]})}const r9=({items:e=[]})=>e.length?l.jsx("div",{className:"space-y-1 text-xs text-tremor-content dark:text-dark-tremor-content",children:e.map((t,r)=>{if(!t)return null;const{label:n,value:o}=t;return o==null||o===""?null:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("span",{className:"font-mono text-tremor-content-strong dark:text-dark-tremor-content-strong",children:n}),l.jsx("span",{className:"flex-1 break-words",children:typeof o=="string"?o:JSON.stringify(o)})]},`${n}-${r}`)})}):null;function i2e({operation:e,isLoading:t}){var r,n,o,a,i,s,u,c,d,f,h,p,g,b,v,x,k,E,j,S,C,O,M,A,T,_,F,$,I;typeof window<"u"&&localStorage.getItem("debug")==="true"&&console.log("OP",e);const[R,W]=m.useState(!1),[B,L]=m.useState("structured"),q=m.useRef([]),U=((r=e?.meta)==null?void 0:r.mcp)||((o=(n=e?.raw)==null?void 0:n.meta)==null?void 0:o.mcp)||((i=(a=e?.meta)==null?void 0:a.trace)==null?void 0:i.mcp)||((c=(u=(s=e?.raw)==null?void 0:s.meta)==null?void 0:u.trace)==null?void 0:c.mcp)||{},H=typeof((d=e?.request)==null?void 0:d.body)=="string"?e.request.body:(f=e?.request)!=null&&f.body?JSON.stringify(e.request.body):"",X=typeof((h=e?.response)==null?void 0:h.body)=="string"?e.response.body:(p=e?.response)!=null&&p.body?JSON.stringify(e.response.body):"",Y=eR((g=e?.response)==null?void 0:g.event_frames),ae=X||Y||"",te=Ih(H),me=Ih(ae),Q=U.method||te?.method||"",ue=U.category||"";(b=me?.result)!=null&&b.tools||me?.tools;const G=Array.isArray((v=e?.meta)==null?void 0:v.tags)&&e.meta.tags.some(Ze=>typeof Ze=="string"&&Ze.startsWith("mcp.tool.")),de=m.useMemo(()=>QL(Q,me),[Q,me]),ie=de.type==="toolsList"&&Array.isArray(de.tools),V=Q==="tools/call"||Q==="tool/call"||G,ee=de.type==="promptsList",ne=Q==="prompts/get",ge=de.type==="resourcesList",Ee=Q==="resources/read",Pe=m.useMemo(()=>Array.isArray(de.content)&&de.content.length,[de.content]),Ie=m.useMemo(()=>{const Ze=[];return de.structuredContent&&Ze.push({key:"structured",label:"Structured content"}),Pe&&Ze.push({key:"content",label:"Content items"}),Ze.push({key:"raw",label:"Raw content"}),Ze},[de.structuredContent,Pe]);m.useEffect(()=>{W(!1),de.structuredContent?L("structured"):L(Pe?"content":"raw")},[e?.id]),ie&&de.tools.length&&(q.current=de.tools);const nt=(q.current||[]).find(Ze=>{var $e;return Ze.name===(($e=te?.params)==null?void 0:$e.name)}),Me=((k=(x=me?.result)==null?void 0:x.tool)==null?void 0:k.inputSchema)||nt?.inputSchema||Array.isArray(de.tools)&&((E=de.tools.find(Ze=>{var $e;return Ze.name===(($e=te?.params)==null?void 0:$e.name)}))==null?void 0:E.inputSchema)||null,ot=V?e0e(((j=te?.params)==null?void 0:j.arguments)||{},Me):{missing:[],extra:[]},Ge=me?.result,at=Ge?.mimeType||((S=Ge?.resource)==null?void 0:S.mimeType)||"",mt=te?JSON.stringify(te,null,2):H||"No request body",Ke=me?JSON.stringify(me,null,2):X||"No response body",pt=m.useMemo(()=>({readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",fontSize:12,lineNumbers:"off",folding:!1}),[]),jt=()=>V?"Tool call":ie?"Tools list":ee?"Prompts list":ne?"Prompt":ge?"Resources list":Ee?"Resource":"Typed view";return e?l.jsxs("div",{className:"flex h-full flex-col",children:[l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ec,{method:e.method}),l.jsx(Kn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:`${e.path||e.url||"Operation"}`})]}),l.jsx(gt,{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:e.host||((C=e.request)==null?void 0:C.server)||"Unspecified host"})]}),l.jsxs("div",{className:"flex flex-col items-end gap-2",children:[l.jsx(El,{status:e.status}),l.jsx(Ht,{color:"blue",children:ao(e.duration)})]})]}),l.jsxs("div",{className:"mt-6 flex-1 space-y-5 pr-1",children:[l.jsx(bo,{title:"Properties",resetKey:e?.id,defaultOpen:!0,children:l.jsx(PR,{operation:e,mcpMeta:U})}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(gt,{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"MCP"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fu,{method:Q||"",children:Q||"Unknown method"}),ue?l.jsx(Ht,{color:"slate",size:"xs",children:ue}):null]})]}),l.jsxs(Ju,{index:R?1:0,onIndexChange:Ze=>W(Ze===1),children:[l.jsxs(Zu,{children:[l.jsx(vo,{children:jt()}),l.jsx(vo,{children:"Raw"})]}),l.jsxs(Qu,{children:[l.jsx(yo,{children:l.jsxs("div",{className:"space-y-3",children:[ie&&(O=de.tools)!=null&&O.length?l.jsxs("div",{className:"space-y-2",children:[l.jsx("div",{className:"flex items-center justify-between",children:l.jsxs(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:["Tools (",de.tools.length,")"]})}),l.jsx("div",{className:"space-y-2",children:de.tools.map(Ze=>l.jsx(rR,{tool:Ze},Ze.name))})]}):null,V?l.jsx("div",{className:"space-y-2",children:l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("span",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:"Tool:"}),l.jsx(fu,{method:Q||"",children:((M=te?.params)==null?void 0:M.name)||"-"}),l.jsx("span",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:"Result:"}),me!=null&&me.error?l.jsx(Ht,{color:"rose",size:"xs",children:"Error"}):l.jsx(Ht,{color:"emerald",size:"xs",children:"Success"})]}),l.jsxs("div",{className:"grid gap-3 md:grid-cols-1",children:[l.jsx(ip,{validation:Me?ot:void 0,children:l.jsx(ZL,{args:(A=te?.params)==null?void 0:A.arguments})}),l.jsx(sp,{children:me?(()=>{var Ze;const $e=((Ze=Ie.find(St=>St.key===B))==null?void 0:Ze.key)||Ie[0].key,ut=Ie.findIndex(St=>St.key===$e),$t=me?.result??me??{};return l.jsxs(Ju,{index:ut,onIndexChange:St=>{var An;return L(((An=Ie[St])==null?void 0:An.key)||Ie[0].key)},children:[l.jsx(Zu,{children:Ie.map(St=>l.jsx(vo,{children:St.label},St.key))}),l.jsx(Qu,{children:Ie.map(St=>l.jsxs(yo,{children:[St.key==="structured"?l.jsx(Za,{data:de.structuredContent,title:"Structured content",copyText:JSON.stringify(de.structuredContent,null,2)}):null,St.key==="content"?l.jsx(Za,{data:de.content,title:"Content items",copyText:JSON.stringify(de.content,null,2),children:l.jsx(oR,{items:de.content})}):null,St.key==="raw"?l.jsx(Za,{data:$t,title:"Raw Output",copyText:JSON.stringify($t,null,2)}):null]},St.key))})]})})():l.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:"No result returned."})})]})]})}):null,ee&&Array.isArray(de.prompts)?l.jsxs("div",{className:"space-y-2",children:[l.jsxs(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:["Prompts (",de.prompts.length,")"]}),l.jsx("div",{className:"space-y-2",children:de.prompts.map(Ze=>{const $e=Ze.arguments||[],ut=$e.filter($t=>$t.required).length;return l.jsxs(At,{className:"space-y-1 rounded-tremor-small border border-tremor-border p-3 shadow-sm dark:border-dark-tremor-border",children:[l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Ze.title||Ze.name}),Ze.description?l.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:Ze.description}):null]}),l.jsxs(Ht,{color:"slate",size:"xs",children:[$e.length," args",ut?` (${ut} required)`:""]})]}),$e.length?l.jsx("div",{className:"space-y-1",children:$e.map($t=>l.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[l.jsx("span",{className:"font-mono text-tremor-content-strong dark:text-dark-tremor-content-strong",children:$t.name}),l.jsx("span",{className:"flex-1 text-tremor-content dark:text-dark-tremor-content",children:$t.description||"No description"}),$t.required?l.jsx(Ht,{color:"rose",size:"xs",children:"required"}):null]},$t.name))}):null]},Ze.name)})})]}):null,ne&&Array.isArray((T=me?.result)==null?void 0:T.messages)?l.jsx("div",{className:"space-y-2",children:l.jsxs("div",{className:"grid gap-3",children:[l.jsx(ip,{children:l.jsx(r9,{items:[{label:"name",value:((_=te?.params)==null?void 0:_.name)||((F=me?.result)==null?void 0:F.name)||"—"},...Array.isArray(($=te?.params)==null?void 0:$.arguments)?te.params.arguments.map((Ze,$e)=>({label:`arg ${$e+1}`,value:Ze})):[]]})}),l.jsx(sp,{children:l.jsx("div",{className:"space-y-2",children:me.result.messages.map((Ze,$e)=>{var ut;return l.jsx("div",{className:`flex ${Ze.role==="assistant"?"justify-end":"justify-start"}`,children:l.jsx("div",{className:`max-w-xl rounded-tremor-small px-3 py-2 text-sm ${Ze.role==="assistant"?"bg-tremor-brand-faint text-tremor-content-strong":"bg-tremor-background-subtle text-tremor-content dark:bg-dark-tremor-background-subtle dark:text-dark-tremor-content"}`,children:Array.isArray(Ze.content)?Ze.content.map(($t,St)=>l.jsx("div",{children:$t.text||"[content]"},St)):((ut=Ze.content)==null?void 0:ut.text)||"[content]"})},$e)})})})]})}):null,ge&&Array.isArray(de.resources)?l.jsxs("div",{className:"space-y-2",children:[l.jsxs(gt,{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:["Resources (",de.resources.length,")"]}),l.jsx("div",{className:"divide-y divide-tremor-border text-sm dark:divide-dark-tremor-border",children:de.resources.map(Ze=>l.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"text-sm font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:Ze.title||Ze.name||Ze.uri}),l.jsx("div",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:Ze.uri}),Ze.description?l.jsx("div",{className:"text-xs text-tremor-content dark:text-dark-tremor-content",children:Ze.description}):null]}),Ze.mimeType?l.jsx(Ht,{color:"slate",size:"xs",children:Ze.mimeType}):null,Ze.size?l.jsx(Ht,{color:"slate",size:"xs",children:`${(Ze.size/1024).toFixed(1)} KB`}):null]},Ze.uri))})]}):null,Ee&&me!=null&&me.result?l.jsx("div",{className:"space-y-2",children:l.jsxs("div",{className:"grid gap-3",children:[l.jsx(ip,{children:l.jsx(r9,{items:[{label:"uri",value:((I=te?.params)==null?void 0:I.uri)||Ge?.uri},at?{label:"mime",value:at}:null]})}),l.jsx(sp,{children:l.jsx(nR,{resource:Ge,mimeType:at,editorOptions:pt})})]})}):null,!ie&&!V&&!ee&&!ne&&!ge&&!Ee?l.jsx(gt,{className:"text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:"No typed MCP view available for this method. Switch to Raw JSON to inspect."}):null]})}),l.jsx(yo,{children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(bo,{title:"HTTP Request",resetKey:e?.id,defaultOpen:!1,copyText:mt,children:l.jsx("div",{className:"h-60 overflow-hidden",children:l.jsx(si,{value:mt||"No request body",language:"json",theme:ui(),beforeMount:li,options:pt,height:"100%"})})}),l.jsx(bo,{title:"HTTP Response",resetKey:e?.id,defaultOpen:!1,copyText:Ke,children:l.jsx("div",{className:"h-[320px] overflow-hidden",children:l.jsx(si,{value:Ke||"No response body",language:"json",theme:ui(),beforeMount:li,options:pt,height:"100%"})})})]})})]})]})]})]})]}):l.jsx("div",{className:"flex h-full items-center justify-center text-sm text-tremor-content-subtle dark:text-dark-tremor-content",children:t?"Loading trace details…":"Select a span to inspect its details."})}const Bl=3;function MR({start:e,duration:t,status:r,total:n,baseStart:o,baseDuration:a,variant:i="status"}){if(!Number.isFinite(n)||n<=0)return l.jsx("div",{className:"h-2 w-full rounded-full bg-slate-200 dark:bg-dark-tremor-background-subtle"});const s=Number.isFinite(n)&&n>0?n:a,u=(e-o)/s*100,c=t/s*100,d=(p,g=0,b=100)=>Math.min(Math.max(p,g),b);let f=d(u),h=d(f+c)-f;return!Number.isFinite(h)||h<=0?(h=Bl,f>=100&&(f=100-h)):h<Bl&&(h=Math.min(100,f+Bl)-f,h<Bl&&(f=Math.max(0,100-Bl),h=Bl)),l.jsx("div",{className:"relative h-2 min-w-0 flex-1 overflow-hidden rounded-full bg-slate-200 dark:bg-dark-tremor-background-subtle",children:l.jsx("span",{className:ko("absolute top-0 h-2 rounded-full transition-all",i==="brand"?"bg-tremor-brand/80 dark:bg-tremor-brand/60":OR(r??null)),style:{left:`${f}%`,width:`${h}%`}})})}function s2e({operation:e,index:t,isSelected:r,onSelect:n,timelineWidth:o,baseStart:a,baseDuration:i,selectedOperationRef:s}){var u,c,d,f,h,p,g,b;const{start:v,duration:x}=Ob(e,t),k=((u=e?.meta)==null?void 0:u.mcp)||((d=(c=e?.raw)==null?void 0:c.meta)==null?void 0:d.mcp)||((h=(f=e?.meta)==null?void 0:f.trace)==null?void 0:h.mcp)||((b=(g=(p=e?.raw)==null?void 0:p.meta)==null?void 0:g.trace)==null?void 0:b.mcp),E=k?.name||k?.method||null;return l.jsx("button",{ref:r?s:null,type:"button",onClick:n,className:ko("flex w-full items-center gap-3 rounded-tremor-small px-0 py-1.5 text-left transition focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",r?"bg-tremor-brand-faint text-tremor-content-strong ring-0 dark:bg-tremor-brand-faint/40":"hover:bg-slate-100 dark:hover:bg-dark-tremor-background-subtle"),children:l.jsxs("div",{className:ko("grid w-full items-center gap-2 pl-0",o<45?"sm:grid-cols-[1.5rem_minmax(0,1fr)]":"sm:grid-cols-[1.5rem_minmax(0,1fr)_65%]"),children:[l.jsx("div",{className:"flex justify-center",children:l.jsx("span",{className:ko("h-2 w-2 rounded-full",CR(e.status??null))})}),l.jsxs("div",{className:"min-w-0 flex flex-col",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[l.jsx(Ec,{method:e.method}),l.jsx("span",{className:"truncate",children:e.path}),E?l.jsx(fu,{method:k?.method||"",children:E}):null]}),l.jsx(gt,{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:zn(e.timestamp,{includeMilliseconds:!0})})]}),l.jsxs("div",{className:ko("min-w-0 items-center gap-3",o<45?"hidden":"flex"),children:[l.jsx(gt,{className:"w-20 shrink-0 text-right text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:ao(e.duration)}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(MR,{start:v,duration:x,status:e.status,total:i,baseStart:a,baseDuration:i})}),l.jsx("div",{className:"w-10 shrink-0 flex justify-center",children:l.jsx(El,{status:e.status})})]})]})},e.id)}function l2e({group:e,isExpanded:t,onToggle:r,selectedOperationId:n,onOperationSelect:o,timelineWidth:a,baseStart:i,baseDuration:s,selectedOperationRef:u}){const c=e.operations.some(h=>h.id===n),{startMs:d,durationMs:f}=e;return l.jsxs("div",{className:ko("rounded-tremor-small border border-transparent bg-white/60 shadow-sm transition dark:bg-dark-tremor-background",c?"border-tremor-brand shadow-tremor-card dark:border-tremor-brand":"hover:border-slate-200 hover:shadow-tremor-card dark:hover:border-slate-700"),children:[l.jsx("button",{type:"button",onClick:()=>r(e.id),className:"flex w-full items-center gap-3 px-3 py-2 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",children:l.jsxs("div",{className:ko("grid w-full items-center gap-2 pl-0",a<45?"sm:grid-cols-[1.5rem_minmax(0,1fr)]":"sm:grid-cols-[1.5rem_minmax(0,1fr)_65%]"),children:[l.jsx("div",{className:"flex justify-center",children:l.jsx("span",{className:ko("flex h-6 w-6 shrink-0 items-center justify-center rounded-full border",t?"border-tremor-brand text-tremor-brand":"border-slate-300 text-slate-500 dark:border-slate-600 dark:text-slate-400"),"aria-hidden":!0,children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:ko("h-3.5 w-3.5 transition-transform",t?"rotate-180":"rotate-0"),children:l.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.084l3.71-3.854a.75.75 0 0 1 1.08 1.04l-4.25 4.417a.75.75 0 0 1-1.08 0L5.21 8.27a.75.75 0 0 1 .02-1.06z",clipRule:"evenodd"})})})}),l.jsxs("div",{className:"min-w-0 flex flex-col",children:[l.jsx("div",{className:"flex items-center gap-2 truncate",children:l.jsx(gt,{className:"truncate text-sm font-medium text-tremor-content-strong dark:text-dark-tremor-content-strong",children:e.label})}),e.subtitle?l.jsx(gt,{className:"truncate text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:e.subtitle}):null]}),l.jsxs("div",{className:ko("min-w-0 items-center gap-3",a<45?"hidden":"flex"),children:[l.jsx(gt,{className:"w-20 shrink-0 text-right text-xs font-semibold text-tremor-content-strong dark:text-dark-tremor-content-strong",children:ao(f)}),l.jsx("div",{className:"flex-1 min-w-0",children:l.jsx(MR,{start:d??i,duration:f,total:s,baseStart:i,baseDuration:s,variant:"brand"})}),l.jsx("div",{className:"w-10 shrink-0 flex justify-center",children:l.jsx(Ht,{color:"slate",children:e.operations.length})})]})]})}),t?l.jsx("div",{className:"border-t border-tremor-border px-3 py-2 dark:border-dark-tremor-border",children:l.jsx("div",{className:"space-y-1",children:e.operations.map((h,p)=>l.jsx(s2e,{operation:h,index:p,isSelected:n===h.id,onSelect:()=>o(h.id),timelineWidth:a,baseStart:i,baseDuration:s,selectedOperationRef:u},h.id))})}):null]},e.id)}function u2e({onMouseDown:e,onDoubleClick:t}){return l.jsx("div",{className:"relative w-px cursor-col-resize bg-gray-300 dark:bg-dark-tremor-border",onMouseDown:e,children:l.jsx("button",{type:"button",className:"absolute left-1/2 top-1/2 z-10 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center rounded-md border border-gray-300 bg-white/80 px-0 py-2 text-gray-600 shadow-sm backdrop-blur-sm transition hover:bg-white dark:border-dark-tremor-border dark:bg-dark-tremor-background/80 dark:text-dark-tremor-content",title:"Drag to resize. Double-click to reset.","aria-label":"Resize panels",onMouseDown:r=>{r.preventDefault(),e?.(r)},onDoubleClick:r=>{r.preventDefault(),t?.(r)},children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-4 w-4","aria-hidden":!0,children:l.jsx("path",{d:"M8.5 7C9.32843 7 10 6.32843 10 5.5C10 4.67157 9.32843 4 8.5 4C7.67157 4 7 4.67157 7 5.5C7 6.32843 7.67157 7 8.5 7ZM8.5 13.5C9.32843 13.5 10 12.8284 10 12C10 11.1716 9.32843 10.5 8.5 10.5C7.67157 10.5 7 11.1716 7 12C7 12.8284 7.67157 13.5 8.5 13.5ZM10 18.5C10 19.3284 9.32843 20 8.5 20C7.67157 20 7 19.3284 7 18.5C7 17.6716 7.67157 17 8.5 17C9.32843 17 10 17.6716 10 18.5ZM15.5 7C16.3284 7 17 6.32843 17 5.5C17 4.67157 16.3284 4 15.5 4C14.6716 4 14 4.67157 14 5.5C14 6.32843 14.6716 7 15.5 7ZM17 12C17 12.8284 16.3284 13.5 15.5 13.5C14.6716 13.5 14 12.8284 14 12C14 11.1716 14.6716 10.5 15.5 10.5C16.3284 10.5 17 11.1716 17 12ZM15.5 20C16.3284 20 17 19.3284 17 18.5C17 17.6716 16.3284 17 15.5 17C14.6716 17 14 17.6716 14 18.5C14 19.3284 14.6716 20 15.5 20Z"})})})})}const c2e=({className:e="",...t})=>l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:`lucide lucide-chart-gantt-icon lucide-chart-gantt ${e}`,"aria-hidden":"true",...t,children:[l.jsx("path",{d:"M10 6h8"}),l.jsx("path",{d:"M12 16h6"}),l.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),l.jsx("path",{d:"M8 11h7"})]});function d2e({operationCount:e,onRefresh:t,isRefreshing:r,hasError:n,traceSources:o}){return l.jsxs(wb,{justifyContent:"between",alignItems:"start",children:[l.jsx("div",{children:l.jsxs(Kn,{className:"flex items-center gap-2 text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:[l.jsx(c2e,{className:"h-4 w-4"}),l.jsx("span",{children:"Trace timeline"})]})}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:t,disabled:r,title:"Refresh trace",className:"inline-flex items-center gap-1 rounded-tremor-small border border-tremor-border px-3 py-1.5 text-sm font-medium text-tremor-content-strong shadow-sm transition hover:bg-slate-50 disabled:cursor-not-allowed disabled:opacity-70 dark:border-dark-tremor-border dark:text-dark-tremor-content-strong dark:hover:bg-dark-tremor-background-subtle",children:r?"Refreshing…":"Refresh"}),o!=null&&o.length?l.jsx("div",{className:"flex flex-wrap gap-2",children:o.map(a=>l.jsx(Ht,{color:"blue",children:a},a))}):null,l.jsx(Ht,{color:n?"rose":"slate",children:`${e} ${e===1?"step":"steps"}`})]})]})}function f2e({traceSummary:e,traceDurationMs:t,traceDetailMeta:r,traceListMeta:n,isTraceDetailLoading:o,operationCount:a,tokenTotals:i}){const s=u=>u==null?"—":u.toLocaleString();return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[l.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-tremor-content-subtle dark:text-dark-tremor-content",children:"Trace"}),l.jsx("span",{className:"text-sm text-tremor-content-strong dark:text-dark-tremor-content-strong",children:dj(e)})]}),i?l.jsxs("div",{className:"w-full flex flex-wrap items-center justify-between gap-4 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[l.jsxs("div",{className:"text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:["Estimated total tokens for ",a," operations:"]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-right text-tremor-content dark:text-dark-tremor-content",children:[l.jsxs(Ht,{color:"indigo",size:"xs",children:["Request ",s(i.request)]}),l.jsxs(Ht,{color:"indigo",size:"xs",children:["Response ",s(i.response)]}),l.jsxs(Ht,{color:"indigo",size:"xs",children:["Total ",s(i.total)]})]})]}):null,l.jsxs("div",{className:"w-full flex flex-wrap items-center justify-between gap-4 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[e!=null&&e.first_seen?l.jsxs("div",{children:["First step: ",zn(e.first_seen)]}):null,e!=null&&e.last_seen?l.jsxs("div",{children:["Last step: ",zn(e.last_seen)]}):null,t!=null?l.jsxs("div",{children:["Observed duration: ",ao(t)]}):null]})]}),l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-tremor-content-subtle dark:text-dark-tremor-content",children:[l.jsxs("span",{children:["Page ",r?.page||n?.page||1," of"," ",n?.total_pages||r?.total_pages||1]}),l.jsx("span",{children:o?"Refreshing trace…":`Total operations: ${a}`})]})]})}function m2e({supportsTraces:e,isTraceListLoading:t,traceList:r,traceListError:n}){return e?t&&!r.length?l.jsx(At,{className:"rounded-tremor-small border border-tremor-border p-6 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Loading traces…"}):n&&!r.length?l.jsxs(At,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-6 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load traces: ",n.message||"Unexpected error"]}):r.length?null:l.jsx(bl,{message:"No traces recorded yet. Start sending traffic to populate this view."}):l.jsx(At,{className:"rounded-tremor-small border border-dashed border-tremor-border p-6 text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"Trace exploration requires an Inspectr API version that exposes the /api/traces endpoints."})}const Xk=56,n9=30,o9=75,p2e="traceTimelineWidth",Zk="calc(100vh - 64px)",h2e=e=>{var t;if(!e.length)return"Trace group";const r=e[0];return o2e(r)||((t=r.traceInfo)==null?void 0:t.source)||(r.correlationId?`Correlation ${r.correlationId}`:null)||`${r.method} ${r.path}`},g2e=e=>{if(!e.length)return"";const t=e[0];return t.path||t.url||""},b2e=e=>e.length?e.reduce((t,r)=>Math.max(t,r.status??0),0):null,Jk=e=>{const t=Number(e);return Number.isFinite(t)?t:null};function _R({operations:e=[],initialTraceId:t=null,initialOperationId:r=null,onTraceChange:n,onOperationChange:o,isActive:a=!0}){const{supportsTraces:i,traceList:s,traceListMeta:u,isTraceListLoading:c,traceListError:d,traceDetailError:f,traceDetailMeta:h,isTraceDetailLoading:p,selectedTraceId:g,traceSummary:b,traceSources:v,traceDurationMs:x,normalizedOperations:k,timeline:E,selectedOperationId:j,setSelectedOperationId:S,selectedOperation:C,refreshTraceList:O,refreshTraceDetail:M,traceDetailPage:A,setTraceDetailPage:T}=TR({initialTraceId:t,initialOperationId:r,onTraceChange:n,onOperationChange:o,isActive:a}),[_,F]=m.useState(()=>new Set),[$,I]=Ur(p2e,String(Xk)),R=m.useMemo(()=>{const ie=Number($);return Number.isFinite(ie)&&ie>=n9&&ie<=o9?ie:Xk},[$]),W=m.useRef(!1),B=m.useRef(null),L=m.useRef(null),q=m.useRef(null),U=E.start,H=E.duration,X=m.useMemo(()=>{if(!k.length)return[];const ie=new Map;return k.forEach((V,ee)=>{const ne=V.correlationId||`__group-${ee}`;ie.has(ne)||ie.set(ne,{id:ne,operations:[],startMs:null,endMs:null,order:ee});const ge=ie.get(ne);ge.operations.push(V);const{start:Ee,end:Pe}=Ob(V,ee);ge.startMs=ge.startMs===null?Ee:Math.min(ge.startMs,Ee),ge.endMs=ge.endMs===null?Pe:Math.max(ge.endMs,Pe)}),Array.from(ie.values()).map(V=>({...V,label:h2e(V.operations),subtitle:g2e(V.operations),durationMs:V.startMs!=null&&V.endMs!=null?Math.max(V.endMs-V.startMs,0):0,maxStatus:b2e(V.operations)})).sort((V,ee)=>(V.startMs??0)-(ee.startMs??0))},[k]),Y=p||c,ae=()=>{O(),M()};m.useEffect(()=>{if(!X.length){F(new Set);return}F(new Set(X.map(ie=>ie.id)))},[g,X]),m.useEffect(()=>{if(!j||!X.length)return;const ie=X.find(V=>V.operations.some(ee=>ee.id===j));ie&&!_.has(ie.id)&&F(V=>{const ee=new Set(V);return ee.add(ie.id),ee})},[j,X,_]),m.useEffect(()=>{if(!j)return;const ie=setTimeout(()=>{L.current&&q.current!==j&&(L.current.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),q.current=j)},150);return()=>clearTimeout(ie)},[j,_]);const te=m.useCallback(()=>{W.current=!1},[]),me=m.useCallback(ie=>{if(!W.current||!B.current)return;const V=B.current.getBoundingClientRect();if(!V.width)return;const ee=(ie.clientX-V.left)/V.width*100,ne=Math.min(Math.max(ee,n9),o9);I(String(ne))},[I]);m.useEffect(()=>(window.addEventListener("mousemove",me),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",te)}),[me,te]);const Q=m.useMemo(()=>{let ie=0,V=0,ee=0,ne=!1,ge=!1,Ee=!1;return k.forEach(Pe=>{var Ie,nt,Me,ot,Ge,at,mt,Ke;if(!Pe)return;const pt=((Ie=Pe?.meta)==null?void 0:Ie.mcp)||((Me=(nt=Pe?.raw)==null?void 0:nt.meta)==null?void 0:Me.mcp)||((Ge=(ot=Pe?.meta)==null?void 0:ot.trace)==null?void 0:Ge.mcp)||((Ke=(mt=(at=Pe?.raw)==null?void 0:at.meta)==null?void 0:mt.trace)==null?void 0:Ke.mcp),jt=pt?.tokens;if(!jt)return;const Ze=Jk(jt.request),$e=Jk(jt.response),ut=Jk(jt.total);Ze!==null&&(ne=!0,ie+=Ze),$e!==null&&(ge=!0,V+=$e),ut!==null?(Ee=!0,ee+=ut):(Ze!==null||$e!==null)&&(Ee=!0,ee+=(Ze??0)+($e??0))}),ne||ge||Ee?{request:ne?ie:null,response:ge?V:null,total:Ee?ee:null}:null},[k]);if(!i||c&&!s.length||d&&!s.length||!s.length)return l.jsx(m2e,{supportsTraces:i,isTraceListLoading:c,traceList:s,traceListError:d});const ue=b?.operation_count||k.length,G=ie=>{F(V=>{const ee=new Set(V);return ee.has(ie)?ee.delete(ie):ee.add(ie),ee})},de=ie=>{var V;if(!ie)return!1;const ee=ie.meta||{},ne=((V=ie.raw)==null?void 0:V.meta)||{},ge=ee.trace||ne.trace||{},Ee=ee.mcp||ne.mcp||ge.mcp,Pe=ee.protocol==="mcp"||ne.protocol==="mcp";return!!(Ee&&Object.keys(Ee).length||Pe)};return l.jsxs("div",{ref:B,className:"flex flex-col gap-4 lg:flex-row",style:{maxHeight:Zk},children:[l.jsxs(At,{id:"trace-timeline",className:"w-full overflow-y-auto rounded-tremor-small border border-tremor-border p-6 dark:border-dark-tremor-border",style:{width:`${R}%`,maxHeight:Zk},children:[l.jsx(d2e,{operationCount:ue,onRefresh:ae,isRefreshing:Y,hasError:!!f,traceSources:v}),l.jsxs("div",{className:"mt-6 flex flex-col gap-4 min-w-0",children:[l.jsx(f2e,{traceSummary:b,traceDurationMs:x,traceDetailMeta:h,traceListMeta:u,isTraceDetailLoading:p,operationCount:ue,tokenTotals:Q}),f?l.jsxs(At,{className:"rounded-tremor-small border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700 dark:border-rose-900 dark:bg-rose-900/20 dark:text-rose-300",children:["Failed to load trace details: ",f.message||"Unexpected error"]}):null,l.jsx("div",{className:"space-y-3",children:X.length?X.map(ie=>l.jsx(l2e,{group:ie,isExpanded:_.has(ie.id),onToggle:G,selectedOperationId:j,onOperationSelect:S,timelineWidth:R,baseStart:U,baseDuration:H,selectedOperationRef:L},ie.id)):l.jsx(At,{className:"rounded-tremor-small border border-dashed border-tremor-border p-6 text-center text-sm text-tremor-content-subtle dark:border-dark-tremor-border dark:text-dark-tremor-content",children:"No operations recorded for this trace."})})]}),l.jsx(pj,{meta:h,currentPage:A,onPageChange:T,alwaysShow:!1})]}),l.jsx(u2e,{onMouseDown:()=>{W.current=!0},onDoubleClick:()=>{I(String(Xk))}}),l.jsx(At,{id:"trace-details",className:"w-full overflow-y-auto rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",style:{width:`${100-R}%`,maxHeight:Zk},children:de(C)?l.jsx(i2e,{operation:C,isLoading:p}):l.jsx(AR,{operation:C,isLoading:p})})]})}const v2e=e=>{if(!e)return null;try{return new URL(e)}catch{return null}},y2e=e=>{var t,r;if(!e)return null;const n=((t=e.raw)==null?void 0:t.data)||{},o=n.request||{},a=n.response||{},i=n.timing||{},s=(e.method||o.method||"GET").toUpperCase(),u=e.status_code??a.status??null,c=e.duration??i.duration,d=Number.isFinite(Number(c))?Number(c):null,f=e.time||o.timestamp||null,h=v2e(o.url||e.url||""),p=o.path||e.path||h?.pathname||o.url||e.url||"/",g=o.server||h?.host||"",b=Array.isArray((r=n.meta)==null?void 0:r.tags)?n.meta.tags:Array.isArray(e.tags)?e.tags:[],v=Sf(b);return{id:e.id,operationId:e.operation_id,method:s,status:u,duration:d,timestamp:f,timestampMs:f?Date.parse(f):null,path:p,host:g,url:o.url||e.url||"",request:o,response:a,timing:i,tags:v,raw:n}},x2e=e=>{if(!e)return"Unknown";const t=new Date(e);return Number.isNaN(t.getTime())?"Unknown":t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})},a9=(e,t)=>`${e} ${t}`,Nd="trace",Ws="trace-timeline",il=["endpoint","list","table","timeline",Nd,Ws],k2e=il.indexOf(Nd),Ks=il.indexOf(Ws),IR=(e,t)=>e&&il.includes(e)?il.indexOf(e):t&&Ks>=0?Ks:0,w2e=()=>{if(typeof window>"u")return{tabIndex:0,traceId:null,traceOperationId:null};const{slug:e,params:t}=mi();if(e!=="insights")return{tabIndex:0,traceId:null,traceOperationId:null};const r=t.trace||null,n=t.traceOp||t.operation||null,o=t.view;return{tabIndex:IR(o,r),traceId:r,traceOperationId:n}};function j2e(){var e,t,r,n;const{client:o}=Er(),a=m.useMemo(()=>w2e(),[]),[i,s]=m.useState(null),[u,c]=m.useState(null),[d,f]=m.useState(!1),[h,p]=m.useState({}),[g,b]=m.useState(a.tabIndex),[v,x]=m.useState({traceId:a.traceId,operationId:a.traceOperationId}),k=ba(()=>Nn.db.events.orderBy("time").last(),[],null)||null,E=ba(()=>Nn.db.events.orderBy("time").reverse().toArray(),[],[])||[],j=m.useMemo(()=>E.map(I=>y2e(I)).filter(Boolean).sort((I,R)=>(R.timestampMs||0)-(I.timestampMs||0)),[E]);m.useEffect(()=>{if(typeof window>"u")return;const I=()=>{const{slug:R,params:W}=mi();if(R!=="insights")return;const B=W.trace||null,L=W.traceOp||W.operation||null,q=W.view,U=IR(q,B);b(U),x(H=>H.traceId===B&&H.operationId===L?H:{traceId:B,operationId:L})};return I(),window.addEventListener("hashchange",I),()=>window.removeEventListener("hashchange",I)},[]);const S=(I={})=>{if(typeof window>"u")return;const{slug:R,params:W}=mi(),B=R==="insights"?{...W}:{};Object.entries(I).forEach(([H,X])=>{X==null||X===""?delete B[H]:B[H]=String(X)});const L=new URLSearchParams;Object.entries(B).forEach(([H,X])=>{X!=null&&L.set(H,X)});const q=L.toString(),U=`#insights${q?`?${q}`:""}`;typeof window<"u"&&window.location.hash!==U&&window.history.replaceState(null,"",U)},C=I=>{b(I);const R=il[I]||"endpoint",W=R===Nd||R===Ws;S({view:R,trace:W?v.traceId??null:null,traceOp:W?v.operationId??null:null})},O=I=>{const R=v.traceId===I,W={traceId:I||null,operationId:R?v.operationId:null};if(v.traceId===W.traceId&&v.operationId===W.operationId)return;x(W);const B=il[g],L=B===Nd||B===Ws;S({view:L?B:Ws,trace:W.traceId??null,traceOp:W.operationId??null}),!L&&Ks>=0&&b(Ks)},M=I=>{const R={traceId:v.traceId,operationId:I||null};if(v.traceId===R.traceId&&v.operationId===R.operationId)return;x(R);const W=il[g],B=W===Nd||W===Ws;S({view:B?W:Ws,trace:R.traceId??null,traceOp:R.operationId??null}),!B&&Ks>=0&&b(Ks)};m.useEffect(()=>{var I;if(!((I=o?.operations)!=null&&I.summarize))return;let R=!0;return(async()=>{f(!0),c(null);try{const W=await o.operations.summarize();R&&(s(W),p({}))}catch(W){R&&c(W)}finally{R&&f(!1)}})(),()=>{R=!1}},[o,k?.id]),m.useEffect(()=>{var I,R;if(!((I=o?.operations)!=null&&I.getSeries)||!((R=i?.summaries)!=null&&R.length))return;let W=!0;return(async()=>{const B=i.summaries;await Promise.all(B.map(async L=>{const q=a9(L.method,L.path);p(U=>({...U,[q]:{...U[q]||{},loading:!0,error:null}}));try{const U=await o.operations.getSeries({method:L.method,path:L.path,seriesLimit:Swe});if(!W)return;p(H=>({...H,[q]:{...H[q]||{},loading:!1,data:U,error:null}}))}catch(U){if(!W)return;p(H=>({...H,[q]:{...H[q]||{},loading:!1,error:U}}))}}))})(),()=>{W=!1}},[o,i?.summaries]);const A=m.useMemo(()=>{var I;return(I=i?.summaries)!=null&&I.length?i.summaries.map(R=>{var W;const B=a9(R.method,R.path),L=h[B]||{},q=(((W=L.data)==null?void 0:W.series)||[]).slice(-40).map(U=>({time:x2e(U.ts),duration:U.duration??0,baseline:U.baseline??R.averageDuration??0}));return{...R,key:B,chartData:q,seriesLoading:L.loading??!1,seriesError:L.error||null}}):[]},[i,h]),T=((e=i?.totals)==null?void 0:e.totalOperations)??j.length,_=(t=i?.totals)==null?void 0:t.totalEndpoints,F=(r=i?.totals)==null?void 0:r.errorCount,$=(n=i?.totals)==null?void 0:n.averageDuration;return l.jsxs("div",{className:"space-y-6",children:[l.jsxs(At,{className:"rounded-tremor-small border border-tremor-border dark:border-dark-tremor-border",children:[l.jsxs(wb,{justifyContent:"between",alignItems:"start",children:[l.jsxs("div",{children:[l.jsx(Kn,{className:"text-lg text-tremor-content-strong dark:text-dark-tremor-content-strong",children:"Insights Explorer"}),l.jsx(gt,{className:"mt-1 text-sm text-tremor-content dark:text-dark-tremor-content",children:"Get more insights into the operations by grouping them by endpoint, as time line view, as rich cards, or in a compact table"})]}),l.jsx(Ht,{color:u?"rose":"slate",children:d?"Loading…":`Total ${T}`})]}),l.jsxs(jb,{numItemsSm:1,numItemsLg:3,className:"mt-6 gap-4",children:[l.jsxs(At,{className:"bg-gray-50 shadow-none dark:bg-dark-tremor-background",children:[l.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Unique endpoints"}),l.jsx(ni,{className:"mt-2",children:_})]}),l.jsxs(At,{className:"bg-gray-50 shadow-none dark:bg-dark-tremor-background",children:[l.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Errors"}),l.jsxs(ni,{className:"mt-2",children:[F," ",l.jsxs("span",{className:"text-base font-normal text-tremor-content-subtle dark:text-dark-tremor-content",children:["(",T?Math.round(F/T*100):0,"%)"]})]})]}),l.jsxs(At,{className:"bg-gray-50 shadow-none dark:bg-dark-tremor-background",children:[l.jsx(gt,{className:"text-sm text-tremor-content dark:text-dark-tremor-content",children:"Avg duration"}),l.jsx(ni,{className:"mt-2",children:$?`${$}ms`:"N/A"})]})]})]}),l.jsxs(Ju,{index:g,onIndexChange:C,children:[l.jsxs(Zu,{children:[l.jsx(vo,{children:"Endpoint mode"}),l.jsx(vo,{children:"List mode"}),l.jsx(vo,{children:"Table mode"}),l.jsx(vo,{children:"Timeline mode"}),l.jsx(vo,{children:"Trace explorer"}),l.jsx(vo,{children:"Trace timeline"})]}),l.jsxs(Qu,{className:"mt-6 space-y-6",children:[l.jsx(yo,{children:l.jsx(jwe,{endpoints:A,loading:d,error:u})}),l.jsx(yo,{children:l.jsx(Owe,{operations:j})}),l.jsx(yo,{children:l.jsx(zwe,{operations:j})}),l.jsx(yo,{children:l.jsx(Xwe,{operations:j})}),l.jsx(yo,{children:l.jsx(a2e,{operations:j,initialTraceId:v.traceId,initialOperationId:v.operationId,onTraceChange:O,onOperationChange:M,isActive:g===k2e})}),l.jsx(yo,{children:l.jsx(_R,{operations:j,initialTraceId:v.traceId,initialOperationId:v.operationId,onTraceChange:O,onOperationChange:M,isActive:g===Ks})})]})]})]})}const i9=(e,t)=>{let r="#traces";return e&&(r+=`/${e}`,t&&(r+=`/${t}`)),r},s9=e=>{e&&(window.location.hash===e?window.dispatchEvent(new HashChangeEvent("hashchange")):window.location.hash=e)};function E2e({route:e}){var t,r;const n=e?.operationId||((t=e?.params)==null?void 0:t.trace)||null,o=e?.subTab||((r=e?.params)==null?void 0:r.operation)||null,[a,i]=m.useState(n),[s,u]=m.useState(o),[c,d]=m.useState(o||null),f=m.useRef(a),h=m.useRef(s),p=m.useRef(c),g=m.useRef({traceId:n,operationId:o});m.useEffect(()=>{f.current=a},[a]),m.useEffect(()=>{h.current=s},[s]),m.useEffect(()=>{p.current=c},[c]),m.useEffect(()=>{const j=g.current;if(n!==j.traceId||o!==j.operationId){g.current={traceId:n,operationId:o},i(n||null),u(o||null),d(o||null);return}n!==a&&i(n||null),o!==s&&u(o||null),!p.current&&o&&d(o)},[n,o,a,s]);const b=m.useCallback(j=>{if(!j)return;i(j),j!==f.current&&(d(null),u(null),h.current=null);const S=i9(j,j===f.current?h.current:null);s9(S)},[]),v=m.useCallback(j=>{if(!j)return;u(j);const S=f.current;if(!S)return;p.current||d(j);const C=i9(S,j);s9(C)},[]),x=m.useMemo(()=>a||"—",[a]),k=p.current||o||h.current||"",E=k?`#inspectr/${k}/request`:"#inspectr";return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsxs("a",{href:E,className:"inline-flex items-center gap-2 rounded-md border border-slate-300 px-3 py-1.5 text-sm font-medium text-slate-700 transition hover:border-slate-400 hover:bg-slate-100 dark:border-slate-700 dark:text-slate-200 dark:hover:border-slate-600 dark:hover:bg-dark-tremor-background-subtle",children:[l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-4 w-4","aria-hidden":!0,children:l.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06l4-4a.75.75 0 0 1 1.06 1.06L4.56 9H16a.75.75 0 0 1 0 1.5H4.56l2.65 2.65a.75.75 0 0 1 0 1.06Z",clipRule:"evenodd"})}),"Back to request"]}),l.jsxs("div",{className:"text-xs font-medium uppercase tracking-wide text-slate-600 dark:text-slate-300",children:["Trace ",x]})]}),l.jsx(_R,{initialTraceId:n,initialOperationId:o,onTraceChange:b,onOperationChange:v,isActive:!0})]})}function N2e(){const{client:e,setToast:t}=Er(),[r,n]=m.useState(!1),[o,a]=m.useState(""),[i,s]=m.useState(null),[u,c]=m.useState(!1),[d,f]=m.useState(null);m.useEffect(()=>{const b=new URLSearchParams(window.location.search).get("openapi");b&&(a(b),n(!0),h())},[]);const h=async()=>{try{const b=await e.service.getHealth();f(b.mode)}catch{}},p=()=>{u||n(!1)},g=async()=>{c(!0),s(null);try{await e.mock.launch(o),t({message:"Mock launched",subMessage:"Serving mock from OpenAPI spec",type:"success"}),n(!1)}catch(b){console.error("Mock launch error",b),s(b.message||"Failed to launch mock"),c(!1)}};return r?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:p}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-3xl w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Configure Inspectr Mock"}),l.jsx("button",{onClick:p,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",disabled:u,children:"×"})]}),d==="proxy"?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"mb-2 text-sm text-gray-700",children:"Inspectr lets you serve a mock API based on an OpenAPI spec."}),l.jsxs("div",{className:"mb-6 p-4 bg-yellow-50 border border-yellow-200 rounded",children:[l.jsxs("p",{className:"text-sm font-medium text-yellow-800",children:["Inspectr is currently running in ",l.jsx("strong",{children:"proxy"})," mode."]}),l.jsx("p",{className:"mt-2 text-sm text-yellow-800",children:"To switch to mock mode, restart Inspectr with:"}),l.jsxs("pre",{className:"mt-2 p-2 bg-gray-100 text-xs rounded overflow-auto",children:['npx @inspectr/inspectr --mock-backend="',o,'"']}),l.jsx(Cn,{textToCopy:`npx @inspectr/inspectr --mock-backend=${o}`})]}),l.jsx("p",{className:"mb-4 text-sm text-gray-700",children:"Follow the instructions above to start Inspectr as Mock server from the OpenAPI spec."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("button",{onClick:p,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"})})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"mb-2 text-sm text-gray-700",children:"Inspectr lets you serve a mock API based on an OpenAPI spec."}),l.jsxs("p",{className:"mb-4 text-sm text-gray-700",children:["You’re about to use ",l.jsx("b",{children:o})," for mock responses. This will replace any existing mock configuration or catch-mode settings."]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"openapi-url",className:"block text-sm font-medium text-gray-700",children:"OpenAPI Spec URL"}),l.jsx("input",{id:"openapi-url",type:"url",value:o,onChange:b=>{a(b.target.value),s(null)},placeholder:"https://example.com/openapi.yaml",disabled:u,className:"mt-1 block w-full rounded-md shadow-sm sm:text-sm "+(i?"border-red-500 text-red-900 placeholder-red-300 focus:ring-red-500 focus:border-red-500":"border-gray-300 focus:ring-blue-500 focus:border-blue-500")}),i&&l.jsx("p",{className:"mt-2 text-sm text-red-600",children:i})]}),l.jsxs("div",{className:"flex justify-end space-x-3",children:[l.jsx("button",{onClick:p,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",disabled:u,children:"Cancel"}),l.jsx("button",{onClick:g,className:`px-4 py-2 text-white rounded ${u?"bg-gray-400 cursor-not-allowed":"bg-red-600 hover:bg-red-700"}`,disabled:u,children:u?"Loading…":"Confirm"})]})]})]})]}):null}function S2e({open:e,onClose:t}){const{client:r,setToast:n}=Er(),[o,a]=m.useState("json"),[i,s]=m.useState(!1),[u,c]=m.useState("preset"),[d,f]=m.useState(""),[h,p]=m.useState(""),[g,b]=m.useState(""),[v]=Na("feat_export_openapi"),[x]=Na("feat_export_postman"),[k,E]=m.useState("");m.useEffect(()=>{e||E("")},[e]);const j=async()=>{s(!0),E("");try{const S={format:o};u==="preset"?d&&(S.preset=d):(h&&(S.since=new Date(h).toISOString()),g&&(S.until=new Date(g).toISOString()));const C=await r.operations.export(S),O=new Date,M=I=>I.toString().padStart(2,"0"),A=`${O.getFullYear()}-${M(O.getMonth()+1)}-${M(O.getDate())}-${M(O.getHours())}${M(O.getMinutes())}`,T=URL.createObjectURL(C),_=document.createElement("a");_.href=T;const F=o==="phar"?"phar":"json",$=o==="json"?"":`_${o}`;_.download=`inspectr_operations_${A}${$}.${F}`,_.click(),URL.revokeObjectURL(T),t&&t()}catch(S){console.error("Export failed",S);const C=S?.message||"Export failed";E(C),n({message:"Export failed",subMessage:C,type:"error"})}finally{s(!1)}};return e?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Export Operations"}),l.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",children:"×"})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Time Range"}),l.jsxs("div",{className:"mt-1 flex items-center space-x-4",children:[l.jsxs("label",{className:"inline-flex items-center",children:[l.jsx("input",{type:"radio",name:"timeOption",value:"preset",checked:u==="preset",onChange:()=>c("preset"),className:"form-radio"}),l.jsx("span",{className:"ml-2",children:"Preset"})]}),l.jsxs("label",{className:"inline-flex items-center",children:[l.jsx("input",{type:"radio",name:"timeOption",value:"custom",checked:u==="custom",onChange:()=>c("custom"),className:"form-radio"}),l.jsx("span",{className:"ml-2",children:"Custom"})]})]}),u==="preset"&&l.jsxs("select",{value:d,onChange:S=>f(S.target.value),className:"mt-2 block w-full rounded-md border-gray-300 shadow-sm sm:text-sm",children:[l.jsx("option",{value:"",children:"-- Select preset --"}),l.jsx("option",{value:"1h",children:"Last hour"}),l.jsx("option",{value:"24h",children:"Last 24 hours"}),l.jsx("option",{value:"7d",children:"Last 7 days"}),l.jsx("option",{value:"30d",children:"Last 30 days"}),l.jsx("option",{value:"start",children:"Since start Inspectr"}),l.jsx("option",{value:"first",children:"Since first operation"})]}),u==="custom"&&l.jsxs("div",{className:"mt-2 space-y-2",children:[l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm",children:"Since"}),l.jsx("input",{type:"datetime-local",value:h,onChange:S=>p(S.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm sm:text-sm"})]}),l.jsxs("div",{children:[l.jsx("label",{className:"block text-sm",children:"Until (optional)"}),l.jsx("input",{type:"datetime-local",value:g,onChange:S=>b(S.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm sm:text-sm"})]})]})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Format"}),l.jsxs("select",{value:o,onChange:S=>a(S.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm",children:[l.jsx("option",{value:"json",children:"JSON"}),v&&l.jsx("option",{value:"openapi",children:"OpenAPI (preview)"}),x&&l.jsx("option",{value:"postman",children:"Postman (preview)"})]})]}),k&&l.jsx("p",{className:"mb-4 text-sm text-red-600",role:"alert",children:k}),l.jsxs("div",{className:"flex justify-end space-x-3",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"}),l.jsx("button",{onClick:j,disabled:i,className:`px-4 py-2 text-white rounded ${i?"bg-gray-400":"bg-blue-600 hover:bg-blue-700"}`,children:i?"Exporting…":"Export"})]})]})]}):null}function O2e({open:e,onClose:t,onContinue:r,onCancelRecording:n,startTime:o}){const{client:a,setToast:i}=Er(),[s,u]=m.useState("json"),[c,d]=m.useState(!1),[f]=Na("feat_export_openapi"),[h]=Na("feat_export_postman"),[p,g]=m.useState(""),b=ba(async()=>o?await Nn.db.events.where("time").above(o).count():0,[o]);m.useEffect(()=>{e||g("")},[e]);const v=async()=>{d(!0),g("");try{const x=await a.operations.export({since:o,format:s}),k=new Date,E=A=>A.toString().padStart(2,"0"),j=`${k.getFullYear()}-${E(k.getMonth()+1)}-${E(k.getDate())}-${E(k.getHours())}${E(k.getMinutes())}`,S=URL.createObjectURL(x),C=document.createElement("a");C.href=S;const O=s==="phar"?"phar":"json",M=s==="json"?"":`_${s}`;C.download=`inspectr_operations_${j}${M}.${O}`,C.click(),URL.revokeObjectURL(S),t&&t()}catch(x){console.error("Export failed",x);const k=x?.message||"Export failed";g(k),i({message:"Export failed",subMessage:k,type:"error"})}finally{d(!1)}};return e?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-lg w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Export Recording"}),l.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",children:"×"})]}),l.jsxs("p",{className:"text-sm mb-4",children:[b," operations recorded since ",new Date(o).toLocaleString()]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Format"}),l.jsxs("select",{value:s,onChange:x=>u(x.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm",children:[l.jsx("option",{value:"json",children:"JSON"}),f&&l.jsx("option",{value:"openapi",children:"OpenAPI (preview)"}),h&&l.jsx("option",{value:"postman",children:"Postman (preview)"})]})]}),p&&l.jsx("p",{className:"-mt-2 mb-4 text-sm text-red-600",role:"alert",children:p}),l.jsxs("div",{className:"flex justify-end space-x-3",children:[l.jsx("button",{onClick:r,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Continue Recording"}),l.jsx("button",{onClick:n,className:"px-4 py-2 bg-orange-200 text-gray-700 rounded hover:bg-orange-300",children:"Cancel Recording"}),l.jsx("button",{onClick:v,disabled:c,className:`px-4 py-2 text-white rounded ${c?"bg-gray-400":"bg-blue-600 hover:bg-blue-700"}`,children:c?"Exporting…":"Export"})]})]})]}):null}function C2e({open:e,onClose:t}){const{client:r,setToast:n}=Er(),[o,a]=m.useState(null),[i,s]=m.useState(!1),u=async()=>{if(o){s(!0);try{await r.operations.import(o),n({message:"Import completed",type:"success"}),t&&t()}catch(c){console.error("Import failed",c),n({message:"Import failed",subMessage:c.message,type:"error"})}finally{s(!1)}}};return e?l.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[l.jsx("div",{className:"absolute inset-0 bg-black opacity-50",onClick:t}),l.jsxs("div",{className:"relative bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6 z-10",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Import Operations"}),l.jsx("button",{onClick:t,className:"text-gray-600 hover:text-gray-800","aria-label":"Close",children:"×"})]}),l.jsx("div",{className:"mb-4",children:l.jsx("input",{type:"file",accept:".json",onChange:c=>a(c.target.files[0]),className:"mt-1 block w-full text-sm"})}),l.jsxs("div",{className:"flex justify-end space-x-3",children:[l.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded hover:bg-gray-300",children:"Cancel"}),l.jsx("button",{onClick:u,disabled:!o||i,className:`px-4 py-2 text-white rounded ${!o||i?"bg-gray-400":"bg-blue-600 hover:bg-blue-700"}`,children:i?"Importing…":"Import"})]})]})]}):null}const P2e="inspectrVersionMuteUntil",l9=3*24*60*60*1e3;function A2e(){const{client:e}=Er(),[t,r]=Ur(P2e,""),[n,o]=m.useState(!1),[a,i]=m.useState(!1),[s,u]=m.useState(null);m.useEffect(()=>{var g;if(!((g=e?.service)!=null&&g.getVersion))return;const b=t?Date.parse(t):0;if(b&&b>Date.now()){i(!1),o(!1);return}let v=!1;return e.service.getVersion().then(x=>{if(!v)if(u(x),x!=null&&x.update_available)i(!0);else{i(!1),o(!1);const k=new Date(Date.now()+l9).toISOString();r(k)}}).catch(x=>{console.error("Version check failed",x)}),()=>{v=!0}},[e,t]);const c=()=>{o(!1)},d=()=>{const g=new Date(Date.now()+l9).toISOString();r(g),i(!1),c()},f=()=>{d()},h=()=>{window.open("https://inspectr.dev/docs/getting-started/upgrade","_blank","noopener,noreferrer")},p=()=>{s!=null&&s.update_available&&o(!0)};return a?l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:p,className:"inline-flex items-center gap-2 rounded-md border border-amber-400 bg-amber-500 px-1 py-1 text-xs font-semibold text-white shadow-sm transition hover:bg-amber-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-amber-500 focus-visible:ring-offset-2",children:[l.jsx("span",{className:"h-2 w-2 rounded-full bg-white/90 shadow-sm"}),l.jsx("span",{className:"uppercase tracking-wide",children:"Update available"})]}),l.jsx(hw,{show:n,as:m.Fragment,children:l.jsx(ym,{as:"div",className:"pointer-events-none fixed inset-x-0 top-6 z-40 flex justify-center px-4 sm:top-8",onClose:c,children:l.jsx(hw.Child,{as:m.Fragment,enter:"ease-out duration-200",enterFrom:"opacity-0 -translate-y-2",enterTo:"opacity-100 translate-y-0",leave:"ease-in duration-150",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-2",children:l.jsx(ym.Panel,{className:"pointer-events-auto relative w-full max-w-4xl overflow-hidden rounded-2xl border border-gray-200 bg-white p-6 shadow-xl dark:border-gray-800 dark:bg-gray-900",children:l.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:gap-6",children:[l.jsxs("div",{className:"flex items-start gap-3 sm:min-w-[220px]",children:[l.jsx("span",{className:"mt-1 flex h-12 w-12 items-center justify-center rounded-full bg-emerald-100 text-emerald-700 shadow-sm dark:bg-emerald-900/30 dark:text-emerald-200",children:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:l.jsx("path",{d:"M19.4668 8.69379L19.7134 8.12811C20.1529 7.11947 20.9445 6.31641 21.9323 5.87708L22.6919 5.53922C23.1027 5.35653 23.1027 4.75881 22.6919 4.57612L21.9748 4.25714C20.9616 3.80651 20.1558 2.97373 19.7238 1.93083L19.4706 1.31953C19.2942 0.893489 18.7058 0.893489 18.5293 1.31953L18.2761 1.93083C17.8442 2.97373 17.0384 3.80651 16.0252 4.25714L15.3081 4.57612C14.8973 4.75881 14.8973 5.35653 15.3081 5.53922L16.0677 5.87708C17.0555 6.31641 17.8471 7.11947 18.2866 8.12811L18.5331 8.69379C18.7136 9.10792 19.2864 9.10792 19.4668 8.69379ZM5 6C4.68525 6 4.38886 6.14819 4.2 6.4L1.2 10.4C0.913337 10.7822 0.937093 11.3138 1.25671 11.669L10.2567 21.669C10.4464 21.8797 10.7165 22 11 22C11.2835 22 11.5537 21.8797 11.7433 21.669L20.7433 11.669L19.2567 10.331L11 19.5052L3.29335 10.9422L5.5 8H14V6H5Z"})})}),l.jsxs("div",{className:"space-y-1",children:[l.jsx(ym.Title,{className:"text-lg font-semibold text-gray-900 dark:text-gray-50",children:"New Inspectr version available"}),l.jsx(ym.Description,{className:"text-sm text-gray-700 dark:text-gray-200",children:s!=null&&s.latest_version?`Update to ${s.latest_version} to get the latest improvements.`:"A new build is ready for you. Grab the latest to get new features."}),l.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:["Current: ",s?.current_version||"Unknown"," • Latest:"," ",s?.latest_version||"—"]})]})]}),l.jsxs("div",{className:"flex flex-1 flex-wrap items-center justify-end gap-3",children:[l.jsx("button",{type:"button",onClick:f,className:"inline-flex items-center justify-center rounded-full px-4 py-2 text-sm font-semibold text-gray-700 transition hover:bg-gray-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:text-gray-200 dark:hover:bg-gray-800",children:"Skip"}),l.jsx("button",{type:"button",onClick:h,className:"inline-flex items-center justify-center rounded-full bg-emerald-600 px-4 py-2 text-sm font-semibold text-white shadow-sm transition hover:bg-emerald-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:bg-emerald-500 dark:hover:bg-emerald-400",children:"Update"})]})]})})})})})]}):null}function DR(...e){return e.filter(Boolean).join(" ")}const T2e=[{name:"Request History",slug:"inspectr",component:aR},{name:"Trace Explorer",slug:"traces",component:E2e,hidden:!0},{name:"Insights",slug:"insights",component:j2e},{name:"Statistics",slug:"statistics",component:Z0e},{name:"Usage",slug:"usage",component:D0e},{name:"Rules",slug:"rules",component:Qke},{name:"Settings",slug:"settings",component:xwe}],M2e=e=>l.jsx("svg",{fill:"currentColor",height:"24",width:"24",viewBox:"0 0 1648 1648",xmlns:"http://www.w3.org/2000/svg",...e,children:l.jsx("path",{d:"m610 216.654c-66.158 4.092-126.119 35.849-164.917 87.346-8.408 11.16-13.344 19.191-19.983 32.513-12.431 24.946-19.521 50.434-22.11 79.487-1.665 18.687-.854 826.238.841 837.939 7.867 54.284 32.465 101.134 70.706 134.667 16.297 14.291 32.283 24.657 53.963 34.991 16.889 8.05 34.568 13.468 60.5 18.541 9.019 1.764 52.201 1.795 61.5.044 26.487-4.989 43.97-10.341 61-18.675 15.131-7.406 21.53-11.135 60.5-35.267 20.813-12.887 23.095-14.298 29.5-18.24l13-8 13-8c6.901-4.247 12.593-7.767 29.54-18.271 5.796-3.593 12.771-7.863 15.5-9.49 2.728-1.626 8.56-5.19 12.96-7.921 4.4-2.73 72.575-44.711 151.5-93.29s150.925-92.918 160-98.531c9.075-5.612 24.15-14.936 33.5-20.719s23.075-14.234 30.5-18.78c85.169-52.142 120.029-73.942 130.014-81.304 40.974-30.211 68.344-69.764 81.788-118.194 13.864-49.94 8.549-104.847-14.809-153-16.836-34.708-41.252-62.432-74.993-85.154-4.125-2.778-17.625-11.26-30-18.849s-27-16.594-32.5-20.009c-5.5-3.416-109.45-67.427-231-142.246-306.386-188.593-335.221-206.352-350-215.553-30.562-19.028-59.301-29.911-90-34.083-11.697-1.59-30.408-2.514-39.5-1.952m-10.5 77.269c-39.541 6.402-76.013 29.73-97.661 62.467-13.001 19.66-19.718 38.39-22.802 63.584-1.472 12.028-1.434 802.191.04 818.026 1.861 19.998 6.142 35.48 14.415 52.133 17.942 36.114 53.025 64.18 91.508 73.203 3.575.839 8.975 2.118 12 2.844 8.221 1.973 40.343 1.613 49.971-.56 32.301-7.289 65.233-26.686 94.817-55.849 15.26-15.042 22.884-24.803 33.571-42.979 13.939-23.706 20.949-43.36 27.745-77.792 1.004-5.086 1.428-50 1.949-206.5.465-139.686 1.001-201.809 1.777-206 .611-3.3 1.608-9.15 2.217-13 1.672-10.583 4.039-21.117 7.191-32 8.179-28.247 20.714-55.13 37.188-79.751 24.262-36.262 53.189-63.572 93.074-87.872 4.95-3.016 12.825-7.435 17.5-9.82s8.95-4.668 9.5-5.074c3.565-2.63 34.688-13.266 52.465-17.93 6.2-1.627 11.49-3.174 11.754-3.439 1.003-1.002-1.016-2.602-10.967-8.689-5.639-3.449-16.552-10.172-24.252-14.94-13.435-8.319-31.76-19.604-58.5-36.029-6.875-4.222-16.1-9.911-20.5-12.641-7.667-4.758-73.088-45.103-122.5-75.546-75.227-46.348-108.509-66.591-116.5-70.86-9.422-5.033-25.23-10.76-37.043-13.419-7.967-1.794-40.076-2.843-47.957-1.567m473.5 305.564c-5.775.685-11.625 1.491-13 1.792-1.375.3-5.2 1.088-8.5 1.749-7.914 1.587-27.103 7.461-36.5 11.174-38.797 15.33-75.171 44.925-98.829 80.41-11.24 16.86-21.329 38.407-26.167 55.888-2.443 8.825-3.85 14.608-4.866 20-.621 3.3-1.653 8.475-2.292 11.5-.846 4.008-1.345 59.624-1.837 205-.618 182.331-.824 200.361-2.399 209.5-1.629 9.459-4.196 22.506-6.744 34.279-.628 2.903-.881 5.54-.561 5.859.596.596 455.986-279.084 472.195-290.001 17.547-11.819 36.335-33.412 46.291-53.203 3.956-7.863 9.527-23.924 11.597-33.434 4.848-22.272 3.572-48.26-3.506-71.387-6.907-22.572-18.055-40.93-35.316-58.158-12.705-12.681-16.829-15.485-79.066-53.756-7.15-4.397-15.7-9.654-19-11.684-3.3-2.029-8.925-5.504-12.5-7.722-53.826-33.397-67.199-40.611-88.616-47.8-29.343-9.85-61.599-13.421-90.384-10.006m-1066.25 1048.256c3.988.189 10.513.189 14.5 0 3.988-.19.725-.346-7.25-.346s-11.238.156-7.25.346",fillRule:"evenodd"})});function Y2e(){const[e]=Na("feat_insights_display",!1,!0);Na("feat_export_mcp_server",!1,!0),Na("feat_rules_ui",!1,!0);const t=m.useMemo(()=>{let j=T2e;return e!==!0&&(j=j.filter(S=>S.slug!=="insights")),j},[e]),[r,n]=m.useState(()=>t[0]),{route:o,currentNav:a,handleTabClick:i}=w0e(t),s=m.useMemo(()=>t.filter(j=>!j.hidden),[t]),u=a.component,[c,d]=m.useState(!1),[f,h]=m.useState(!1),[p,g]=Ur("recordStart",null),[b,v]=m.useState(()=>!!p);m.useEffect(()=>{v(!!p)},[p]),m.useEffect(()=>{a&&n(a)},[a]);const[x,k]=m.useState(!1),E=ba(async()=>!b||!p?0:await Nn.db.events.where("time").above(p).count(),[b,p]);return l.jsxs(Vq,{children:[l.jsx(N2e,{}),l.jsxs("div",{className:"flex flex-col min-h-screen",children:[l.jsx("div",{className:"border-b border-tremor-border dark:border-dark-tremor-border relative h-full overflow-hidden bg-gray-50 dark:bg-dark-tremor-background-subtle",children:l.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:l.jsxs("div",{className:"overflow flex h-16 sm:space-x-7 items-center",children:[l.jsx("div",{className:"hidden shrink-0 sm:flex sm:items-center",children:l.jsx("a",{href:"/",className:"p-1.5",children:l.jsx(M2e,{className:"size-4 shrink-0 w-8 h-8 text-tremor-content-strong dark:text-dark-tremor-content-strong","aria-hidden":!0})})}),l.jsx("nav",{className:"flex-1 -mb-px flex space-x-6","aria-label":"Tabs",children:s.map(j=>j.slug==="inspectr"?l.jsx(I2e,{navItem:j,isActive:j.slug===a.slug,onClick:()=>i(j),isCurrent:j.name===r.name},j.slug):l.jsx("button",{onClick:()=>i(j),className:DR(j.slug===a.slug?"dark:text-tremor-dark-brand border-tremor-brand text-tremor-brand":"border-transparent text-tremor-content-emphasis hover:border-tremor-content-subtle hover:text-tremor-content-strong dark:text-dark-tremor-content-emphasis hover:dark:border-dark-tremor-content-subtle hover:dark:text-dark-tremor-content-strong","inline-flex items-center whitespace-nowrap border-b-2 px-2 py-2 text-tremor-default font-medium"),"aria-current":j.name===r.name?"page":void 0,children:j.name},j.slug))}),l.jsxs("div",{className:"ml-auto flex items-center space-x-2",children:[l.jsx(A2e,{}),l.jsx("button",{className:"px-2 py-1 text-cyan-500 hover:text-white border border-cyan-500 hover:bg-cyan-500 rounded text-xs",onClick:()=>d(!0),children:"Export"}),l.jsx("button",{className:"px-2 py-1 text-cyan-500 hover:text-white border border-cyan-500 hover:bg-cyan-500 rounded text-xs",onClick:()=>h(!0),children:"Import"}),l.jsxs("div",{className:"relative",children:[l.jsxs("button",{disabled:x,className:`px-2 py-1 rounded text-xs flex items-center border border-green-500 ${b?"text-white bg-green-500":"text-green-500 hover:text-white hover:bg-green-500"} `,onClick:()=>{b?E>0?k(!0):(v(!1),g(null)):(g(new Date().toISOString()),v(!0))},children:[l.jsx("span",{className:`mr-1 block w-2 h-2 ${b?"bg-red-600 animate-pulse":"bg-red-600 rounded-full"}`}),b?"Stop Recording":"Start Recording"]}),b&&E>0&&l.jsx("span",{className:"absolute -top-3 -right-2",children:l.jsx(gR,{count:E})})]})]})]})})}),l.jsx("div",{className:"flex-grow overflow-auto",children:["insights","statistics","settings","usage","rules","traces"].includes(a.slug)?l.jsx("div",{className:"p-4 bg-gray-50 dark:bg-gray-950",children:l.jsx(u,{route:o},a.slug)}):l.jsx(aR,{route:o},"inspectr")}),l.jsx(_2e,{}),l.jsx(S2e,{open:c,onClose:()=>d(!1)}),l.jsx(C2e,{open:f,onClose:()=>h(!1)}),l.jsx(O2e,{open:x,onContinue:()=>{k(!1)},onCancelRecording:()=>{k(!1),v(!1),g(null)},onClose:()=>k(!1),startTime:p})]})]})}const _2e=()=>{const{toast:e,setToast:t}=Er();return e?l.jsx(Km,{message:e.message,subMessage:e.subMessage,type:e.type,onClose:()=>t(null)}):null},I2e=({navItem:e,isActive:t,onClick:r,isCurrent:n})=>{const{connectionStatus:o}=Er(),[a,i]=Ur("inspectrLastSeenAt",null),[s,u]=m.useState(()=>Us(a)),c=ba(async()=>{try{const p=await Nn.db.events.orderBy("time").last();return p?.time||null}catch{return null}},[]),d=ba(async()=>{if(!s)return 0;try{return await Nn.db.events.where("time").above(s).count()}catch{return 0}},[s]);m.useEffect(()=>{const p=Us(a);u(g=>{const b=Us(g);return p?t||!b?p:aj(p,b)?b:p:b?g:null})},[a,t]);const f=o==="connected"?"green":o==="disconnected"?"red":"orange",h=()=>{const p=Us(c)||new Date().toISOString();i(g=>{const b=Us(g);return!b||aj(p,b)?p:b}),u(p),r&&r()};return l.jsxs("button",{onClick:h,className:DR(t?"dark:text-tremor-dark-brand border-tremor-brand text-tremor-brand":"border-transparent text-tremor-content-emphasis hover:border-tremor-content-subtle hover:text-tremor-content-strong dark:text-dark-tremor-content-emphasis hover:dark:border-dark-tremor-content-subtle hover:dark:text-dark-tremor-content-strong","inline-flex items-center whitespace-nowrap border-b-2 px-2 py-2 text-tremor-default font-medium relative"),"aria-current":n?"page":void 0,children:[e.name,!t&&d>0&&l.jsx("span",{className:"absolute -top-3 -right-2",children:l.jsx(gR,{count:d,color:f})})]},e.slug)};export{Y2e as Workspace};