const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dd3aEmC1.js","assets/duckdb-DfDkxxLj.js"])))=>i.map(i=>d[i]);
var Oj=Object.freeze,Mj=Object.defineProperty,Qte=Object.defineProperties;var Jte=Object.getOwnPropertyDescriptors;var sT=Object.getOwnPropertySymbols;var Dj=Object.prototype.hasOwnProperty,Pj=Object.prototype.propertyIsEnumerable;var Lj=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e);var cm=Math.pow,wv=(e,t,n)=>t in e?Mj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q=(e,t)=>{for(var n in t||(t={}))Dj.call(t,n)&&wv(e,n,t[n]);if(sT)for(var n of sT(t))Pj.call(t,n)&&wv(e,n,t[n]);return e},he=(e,t)=>Qte(e,Jte(t));var Tn=(e,t)=>{var n={};for(var r in e)Dj.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sT)for(var r of sT(e))t.indexOf(r)<0&&Pj.call(e,r)&&(n[r]=e[r]);return n};var Kt=(e,t,n)=>wv(e,typeof t!="symbol"?t+"":t,n);var wn=(e,t)=>Oj(Mj(e,"raw",{value:Oj(t||e.slice())})),H=(e,t,n)=>new Promise((r,a)=>{var s=c=>{try{l(n.next(c))}catch(u){a(u)}},i=c=>{try{l(n.throw(c))}catch(u){a(u)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(s,i);l((n=n.apply(e,t)).next())});var iT=(e,t,n)=>(t=e[Lj("asyncIterator")])?t.call(e):(e=e[Lj("iterator")](),t={},n=(r,a)=>(a=e[r])&&(t[r]=s=>new Promise((i,l,c)=>(s=a.call(e,s),c=s.done,Promise.resolve(s.value).then(u=>i({value:u,done:c}),l)))),n("next"),n("return"),t);import{Q as Zte,A as ene,L as tne,F as wi}from"./duckdb-DfDkxxLj.js";function nne(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const s=Object.getOwnPropertyDescriptor(r,a);s&&Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();var oT=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ir(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cv={exports:{}},um={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var kj;function rne(){if(kj)return um;kj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var l in a)l!=="key"&&(s[l]=a[l])}else s=a;return a=s.ref,{$$typeof:e,type:r,key:i,ref:a!==void 0?a:null,props:s}}return um.Fragment=t,um.jsx=n,um.jsxs=n,um}var jj;function ane(){return jj||(jj=1,Cv.exports=rne()),Cv.exports}var o=ane(),Iv={exports:{}},Jt={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Uj;function sne(){if(Uj)return Jt;Uj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),i=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.iterator;function p($){return $===null||typeof $!="object"?null:($=m&&$[m]||$["@@iterator"],typeof $=="function"?$:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,y={};function b($,X,Z){this.props=$,this.context=X,this.refs=y,this.updater=Z||g}b.prototype.isReactComponent={},b.prototype.setState=function($,X){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,X,"setState")},b.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function x(){}x.prototype=b.prototype;function R($,X,Z){this.props=$,this.context=X,this.refs=y,this.updater=Z||g}var A=R.prototype=new x;A.constructor=R,T(A,b.prototype),A.isPureReactComponent=!0;var w=Array.isArray,_={H:null,A:null,T:null,S:null,V:null},N=Object.prototype.hasOwnProperty;function I($,X,Z,V,te,ae){return Z=ae.ref,{$$typeof:e,type:$,key:X,ref:Z!==void 0?Z:null,props:ae}}function D($,X){return I($.type,X,void 0,void 0,void 0,$.props)}function M($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function O($){var X={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(Z){return X[Z]})}var L=/\/+/g;function k($,X){return typeof $=="object"&&$!==null&&$.key!=null?O(""+$.key):X.toString(36)}function F(){}function U($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(F,F):($.status="pending",$.then(function(X){$.status==="pending"&&($.status="fulfilled",$.value=X)},function(X){$.status==="pending"&&($.status="rejected",$.reason=X)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function B($,X,Z,V,te){var ae=typeof $;(ae==="undefined"||ae==="boolean")&&($=null);var ne=!1;if($===null)ne=!0;else switch(ae){case"bigint":case"string":case"number":ne=!0;break;case"object":switch($.$$typeof){case e:case t:ne=!0;break;case h:return ne=$._init,B(ne($._payload),X,Z,V,te)}}if(ne)return te=te($),ne=V===""?"."+k($,0):V,w(te)?(Z="",ne!=null&&(Z=ne.replace(L,"$&/")+"/"),B(te,X,Z,"",function(W){return W})):te!=null&&(M(te)&&(te=D(te,Z+(te.key==null||$&&$.key===te.key?"":(""+te.key).replace(L,"$&/")+"/")+ne)),X.push(te)),1;ne=0;var ce=V===""?".":V+":";if(w($))for(var ie=0;ie<$.length;ie++)V=$[ie],ae=ce+k(V,ie),ne+=B(V,X,Z,ae,te);else if(ie=p($),typeof ie=="function")for($=ie.call($),ie=0;!(V=$.next()).done;)V=V.value,ae=ce+k(V,ie++),ne+=B(V,X,Z,ae,te);else if(ae==="object"){if(typeof $.then=="function")return B(U($),X,Z,V,te);throw X=String($),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ne}function j($,X,Z){if($==null)return $;var V=[],te=0;return B($,V,"","",function(ae){return X.call(Z,ae,te++)}),V}function G($){if($._status===-1){var X=$._result;X=X(),X.then(function(Z){($._status===0||$._status===-1)&&($._status=1,$._result=Z)},function(Z){($._status===0||$._status===-1)&&($._status=2,$._result=Z)}),$._status===-1&&($._status=0,$._result=X)}if($._status===1)return $._result.default;throw $._result}var K=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}};function J(){}return Jt.Children={map:j,forEach:function($,X,Z){j($,function(){X.apply(this,arguments)},Z)},count:function($){var X=0;return j($,function(){X++}),X},toArray:function($){return j($,function(X){return X})||[]},only:function($){if(!M($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Jt.Component=b,Jt.Fragment=n,Jt.Profiler=a,Jt.PureComponent=R,Jt.StrictMode=r,Jt.Suspense=c,Jt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_,Jt.__COMPILER_RUNTIME={__proto__:null,c:function($){return _.H.useMemoCache($)}},Jt.cache=function($){return function(){return $.apply(null,arguments)}},Jt.cloneElement=function($,X,Z){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var V=T({},$.props),te=$.key,ae=void 0;if(X!=null)for(ne in X.ref!==void 0&&(ae=void 0),X.key!==void 0&&(te=""+X.key),X)!N.call(X,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&X.ref===void 0||(V[ne]=X[ne]);var ne=arguments.length-2;if(ne===1)V.children=Z;else if(1<ne){for(var ce=Array(ne),ie=0;ie<ne;ie++)ce[ie]=arguments[ie+2];V.children=ce}return I($.type,te,void 0,void 0,ae,V)},Jt.createContext=function($){return $={$$typeof:i,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:s,_context:$},$},Jt.createElement=function($,X,Z){var V,te={},ae=null;if(X!=null)for(V in X.key!==void 0&&(ae=""+X.key),X)N.call(X,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(te[V]=X[V]);var ne=arguments.length-2;if(ne===1)te.children=Z;else if(1<ne){for(var ce=Array(ne),ie=0;ie<ne;ie++)ce[ie]=arguments[ie+2];te.children=ce}if($&&$.defaultProps)for(V in ne=$.defaultProps,ne)te[V]===void 0&&(te[V]=ne[V]);return I($,ae,void 0,void 0,null,te)},Jt.createRef=function(){return{current:null}},Jt.forwardRef=function($){return{$$typeof:l,render:$}},Jt.isValidElement=M,Jt.lazy=function($){return{$$typeof:h,_payload:{_status:-1,_result:$},_init:G}},Jt.memo=function($,X){return{$$typeof:u,type:$,compare:X===void 0?null:X}},Jt.startTransition=function($){var X=_.T,Z={};_.T=Z;try{var V=$(),te=_.S;te!==null&&te(Z,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(J,K)}catch(ae){K(ae)}finally{_.T=X}},Jt.unstable_useCacheRefresh=function(){return _.H.useCacheRefresh()},Jt.use=function($){return _.H.use($)},Jt.useActionState=function($,X,Z){return _.H.useActionState($,X,Z)},Jt.useCallback=function($,X){return _.H.useCallback($,X)},Jt.useContext=function($){return _.H.useContext($)},Jt.useDebugValue=function(){},Jt.useDeferredValue=function($,X){return _.H.useDeferredValue($,X)},Jt.useEffect=function($,X,Z){var V=_.H;if(typeof Z=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return V.useEffect($,X)},Jt.useId=function(){return _.H.useId()},Jt.useImperativeHandle=function($,X,Z){return _.H.useImperativeHandle($,X,Z)},Jt.useInsertionEffect=function($,X){return _.H.useInsertionEffect($,X)},Jt.useLayoutEffect=function($,X){return _.H.useLayoutEffect($,X)},Jt.useMemo=function($,X){return _.H.useMemo($,X)},Jt.useOptimistic=function($,X){return _.H.useOptimistic($,X)},Jt.useReducer=function($,X,Z){return _.H.useReducer($,X,Z)},Jt.useRef=function($){return _.H.useRef($)},Jt.useState=function($){return _.H.useState($)},Jt.useSyncExternalStore=function($,X,Z){return _.H.useSyncExternalStore($,X,Z)},Jt.useTransition=function(){return _.H.useTransition()},Jt.version="19.1.0",Jt}var Fj;function b1(){return Fj||(Fj=1,Iv.exports=sne()),Iv.exports}var v=b1();const Ht=ir(v),ine=nne({__proto__:null,default:Ht},[v]);var Ov={exports:{}},dm={},Lv={exports:{}},Mv={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var $j;function one(){return $j||($j=1,function(e){function t(j,G){var K=j.length;j.push(G);e:for(;0<K;){var J=K-1>>>1,$=j[J];if(0<a($,G))j[J]=G,j[K]=$,K=J;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var G=j[0],K=j.pop();if(K!==G){j[0]=K;e:for(var J=0,$=j.length,X=$>>>1;J<X;){var Z=2*(J+1)-1,V=j[Z],te=Z+1,ae=j[te];if(0>a(V,K))te<$&&0>a(ae,V)?(j[J]=ae,j[te]=K,J=te):(j[J]=V,j[Z]=K,J=Z);else if(te<$&&0>a(ae,K))j[J]=ae,j[te]=K,J=te;else break e}}return G}function a(j,G){var K=j.sortIndex-G.sortIndex;return K!==0?K:j.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],h=1,m=null,p=3,g=!1,T=!1,y=!1,b=!1,x=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate!="undefined"?setImmediate:null;function w(j){for(var G=n(u);G!==null;){if(G.callback===null)r(u);else if(G.startTime<=j)r(u),G.sortIndex=G.expirationTime,t(c,G);else break;G=n(u)}}function _(j){if(y=!1,w(j),!T)if(n(c)!==null)T=!0,N||(N=!0,k());else{var G=n(u);G!==null&&B(_,G.startTime-j)}}var N=!1,I=-1,D=5,M=-1;function O(){return b?!0:!(e.unstable_now()-M<D)}function L(){if(b=!1,N){var j=e.unstable_now();M=j;var G=!0;try{e:{T=!1,y&&(y=!1,R(I),I=-1),g=!0;var K=p;try{t:{for(w(j),m=n(c);m!==null&&!(m.expirationTime>j&&O());){var J=m.callback;if(typeof J=="function"){m.callback=null,p=m.priorityLevel;var $=J(m.expirationTime<=j);if(j=e.unstable_now(),typeof $=="function"){m.callback=$,w(j),G=!0;break t}m===n(c)&&r(c),w(j)}else r(c);m=n(c)}if(m!==null)G=!0;else{var X=n(u);X!==null&&B(_,X.startTime-j),G=!1}}break e}finally{m=null,p=K,g=!1}G=void 0}}finally{G?k():N=!1}}}var k;if(typeof A=="function")k=function(){A(L)};else if(typeof MessageChannel!="undefined"){var F=new MessageChannel,U=F.port2;F.port1.onmessage=L,k=function(){U.postMessage(null)}}else k=function(){x(L,0)};function B(j,G){I=x(function(){j(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125<j||(D=0<j?Math.floor(1e3/j):5)},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_next=function(j){switch(p){case 1:case 2:case 3:var G=3;break;default:G=p}var K=p;p=G;try{return j()}finally{p=K}},e.unstable_requestPaint=function(){b=!0},e.unstable_runWithPriority=function(j,G){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var K=p;p=j;try{return G()}finally{p=K}},e.unstable_scheduleCallback=function(j,G,K){var J=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?J+K:J):K=J,j){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=K+$,j={id:h++,callback:G,priorityLevel:j,startTime:K,expirationTime:$,sortIndex:-1},K>J?(j.sortIndex=K,t(u,j),n(c)===null&&j===n(u)&&(y?(R(I),I=-1):y=!0,B(_,K-J))):(j.sortIndex=$,t(c,j),T||g||(T=!0,N||(N=!0,k()))),j},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(j){var G=p;return function(){var K=p;p=G;try{return j.apply(this,arguments)}finally{p=K}}}}(Mv)),Mv}var Bj;function lne(){return Bj||(Bj=1,Lv.exports=one()),Lv.exports}var Dv={exports:{}},ya={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Hj;function cne(){if(Hj)return ya;Hj=1;var e=b1();function t(c){var u="https://react.dev/errors/"+c;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)u+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+c+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function s(c,u,h){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:m==null?null:""+m,children:c,containerInfo:u,implementation:h}}var i=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,u){if(c==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return ya.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ya.createPortal=function(c,u){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return s(c,u,null,h)},ya.flushSync=function(c){var u=i.T,h=r.p;try{if(i.T=null,r.p=2,c)return c()}finally{i.T=u,r.p=h,r.d.f()}},ya.preconnect=function(c,u){typeof c=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(c,u))},ya.prefetchDNS=function(c){typeof c=="string"&&r.d.D(c)},ya.preinit=function(c,u){if(typeof c=="string"&&u&&typeof u.as=="string"){var h=u.as,m=l(h,u.crossOrigin),p=typeof u.integrity=="string"?u.integrity:void 0,g=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;h==="style"?r.d.S(c,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:m,integrity:p,fetchPriority:g}):h==="script"&&r.d.X(c,{crossOrigin:m,integrity:p,fetchPriority:g,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},ya.preinitModule=function(c,u){if(typeof c=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var h=l(u.as,u.crossOrigin);r.d.M(c,{crossOrigin:h,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(c)},ya.preload=function(c,u){if(typeof c=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var h=u.as,m=l(h,u.crossOrigin);r.d.L(c,h,{crossOrigin:m,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},ya.preloadModule=function(c,u){if(typeof c=="string")if(u){var h=l(u.as,u.crossOrigin);r.d.m(c,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:h,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(c)},ya.requestFormReset=function(c){r.d.r(c)},ya.unstable_batchedUpdates=function(c,u){return c(u)},ya.useFormState=function(c,u,h){return i.H.useFormState(c,u,h)},ya.useFormStatus=function(){return i.H.useHostTransitionStatus()},ya.version="19.1.0",ya}var Vj;function x8(){if(Vj)return Dv.exports;Vj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){}}return e(),Dv.exports=cne(),Dv.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Gj;function une(){if(Gj)return dm;Gj=1;var e=lne(),t=b1(),n=x8();function r(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var E=2;E<arguments.length;E++)f+="&args[]="+encodeURIComponent(arguments[E])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(d){return!(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)}function s(d){var f=d,E=d;if(d.alternate)for(;f.return;)f=f.return;else{d=f;do f=d,(f.flags&4098)!==0&&(E=f.return),d=f.return;while(d)}return f.tag===3?E:null}function i(d){if(d.tag===13){var f=d.memoizedState;if(f===null&&(d=d.alternate,d!==null&&(f=d.memoizedState)),f!==null)return f.dehydrated}return null}function l(d){if(s(d)!==d)throw Error(r(188))}function c(d){var f=d.alternate;if(!f){if(f=s(d),f===null)throw Error(r(188));return f!==d?null:d}for(var E=d,S=f;;){var C=E.return;if(C===null)break;var P=C.alternate;if(P===null){if(S=C.return,S!==null){E=S;continue}break}if(C.child===P.child){for(P=C.child;P;){if(P===E)return l(C),d;if(P===S)return l(C),f;P=P.sibling}throw Error(r(188))}if(E.return!==S.return)E=C,S=P;else{for(var Y=!1,ee=C.child;ee;){if(ee===E){Y=!0,E=C,S=P;break}if(ee===S){Y=!0,S=C,E=P;break}ee=ee.sibling}if(!Y){for(ee=P.child;ee;){if(ee===E){Y=!0,E=P,S=C;break}if(ee===S){Y=!0,S=P,E=C;break}ee=ee.sibling}if(!Y)throw Error(r(189))}}if(E.alternate!==S)throw Error(r(190))}if(E.tag!==3)throw Error(r(188));return E.stateNode.current===E?d:f}function u(d){var f=d.tag;if(f===5||f===26||f===27||f===6)return d;for(d=d.child;d!==null;){if(f=u(d),f!==null)return f;d=d.sibling}return null}var h=Object.assign,m=Symbol.for("react.element"),p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),R=Symbol.for("react.consumer"),A=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function k(d){return d===null||typeof d!="object"?null:(d=L&&d[L]||d["@@iterator"],typeof d=="function"?d:null)}var F=Symbol.for("react.client.reference");function U(d){if(d==null)return null;if(typeof d=="function")return d.$$typeof===F?null:d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case T:return"Fragment";case b:return"Profiler";case y:return"StrictMode";case _:return"Suspense";case N:return"SuspenseList";case M:return"Activity"}if(typeof d=="object")switch(d.$$typeof){case g:return"Portal";case A:return(d.displayName||"Context")+".Provider";case R:return(d._context.displayName||"Context")+".Consumer";case w:var f=d.render;return d=d.displayName,d||(d=f.displayName||f.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case I:return f=d.displayName||null,f!==null?f:U(d.type)||"Memo";case D:f=d._payload,d=d._init;try{return U(d(f))}catch(E){}}return null}var B=Array.isArray,j=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},J=[],$=-1;function X(d){return{current:d}}function Z(d){0>$||(d.current=J[$],J[$]=null,$--)}function V(d,f){$++,J[$]=d.current,d.current=f}var te=X(null),ae=X(null),ne=X(null),ce=X(null);function ie(d,f){switch(V(ne,f),V(ae,d),V(te,null),f.nodeType){case 9:case 11:d=(d=f.documentElement)&&(d=d.namespaceURI)?sj(d):0;break;default:if(d=f.tagName,f=f.namespaceURI)f=sj(f),d=ij(f,d);else switch(d){case"svg":d=1;break;case"math":d=2;break;default:d=0}}Z(te),V(te,d)}function W(){Z(te),Z(ae),Z(ne)}function Q(d){d.memoizedState!==null&&V(ce,d);var f=te.current,E=ij(f,d.type);f!==E&&(V(ae,d),V(te,E))}function se(d){ae.current===d&&(Z(te),Z(ae)),ce.current===d&&(Z(ce),am._currentValue=K)}var z=Object.prototype.hasOwnProperty,xe=e.unstable_scheduleCallback,le=e.unstable_cancelCallback,pe=e.unstable_shouldYield,_e=e.unstable_requestPaint,re=e.unstable_now,Se=e.unstable_getCurrentPriorityLevel,$e=e.unstable_ImmediatePriority,qe=e.unstable_UserBlockingPriority,Je=e.unstable_NormalPriority,lt=e.unstable_LowPriority,at=e.unstable_IdlePriority,ot=e.log,st=e.unstable_setDisableYieldValue,oe=null,ue=null;function Ee(d){if(typeof ot=="function"&&st(d),ue&&typeof ue.setStrictMode=="function")try{ue.setStrictMode(oe,d)}catch(f){}}var Le=Math.clz32?Math.clz32:tt,ke=Math.log,Ge=Math.LN2;function tt(d){return d>>>=0,d===0?32:31-(ke(d)/Ge|0)|0}var ct=256,Te=4194304;function Oe(d){var f=d&42;if(f!==0)return f;switch(d&-d){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return d&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return d}}function de(d,f,E){var S=d.pendingLanes;if(S===0)return 0;var C=0,P=d.suspendedLanes,Y=d.pingedLanes;d=d.warmLanes;var ee=S&134217727;return ee!==0?(S=ee&~P,S!==0?C=Oe(S):(Y&=ee,Y!==0?C=Oe(Y):E||(E=ee&~d,E!==0&&(C=Oe(E))))):(ee=S&~P,ee!==0?C=Oe(ee):Y!==0?C=Oe(Y):E||(E=S&~d,E!==0&&(C=Oe(E)))),C===0?0:f!==0&&f!==C&&(f&P)===0&&(P=C&-C,E=f&-f,P>=E||P===32&&(E&4194048)!==0)?f:C}function Ae(d,f){return(d.pendingLanes&~(d.suspendedLanes&~d.pingedLanes)&f)===0}function we(d,f){switch(d){case 1:case 2:case 4:case 8:case 64:return f+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return f+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ie(){var d=ct;return ct<<=1,(ct&4194048)===0&&(ct=256),d}function Ke(){var d=Te;return Te<<=1,(Te&62914560)===0&&(Te=4194304),d}function it(d){for(var f=[],E=0;31>E;E++)f.push(d);return f}function De(d,f){d.pendingLanes|=f,f!==268435456&&(d.suspendedLanes=0,d.pingedLanes=0,d.warmLanes=0)}function nt(d,f,E,S,C,P){var Y=d.pendingLanes;d.pendingLanes=E,d.suspendedLanes=0,d.pingedLanes=0,d.warmLanes=0,d.expiredLanes&=E,d.entangledLanes&=E,d.errorRecoveryDisabledLanes&=E,d.shellSuspendCounter=0;var ee=d.entanglements,fe=d.expirationTimes,ve=d.hiddenUpdates;for(E=Y&~E;0<E;){var Pe=31-Le(E),He=1<<Pe;ee[Pe]=0,fe[Pe]=-1;var Re=ve[Pe];if(Re!==null)for(ve[Pe]=null,Pe=0;Pe<Re.length;Pe++){var Ne=Re[Pe];Ne!==null&&(Ne.lane&=-536870913)}E&=~He}S!==0&&Pt(d,S,0),P!==0&&C===0&&d.tag!==0&&(d.suspendedLanes|=P&~(Y&~f))}function Pt(d,f,E){d.pendingLanes|=f,d.suspendedLanes&=~f;var S=31-Le(f);d.entangledLanes|=f,d.entanglements[S]=d.entanglements[S]|1073741824|E&4194090}function pt(d,f){var E=d.entangledLanes|=f;for(d=d.entanglements;E;){var S=31-Le(E),C=1<<S;C&f|d[S]&f&&(d[S]|=f),E&=~C}}function Bt(d){switch(d){case 2:d=1;break;case 8:d=4;break;case 32:d=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:d=128;break;case 268435456:d=134217728;break;default:d=0}return d}function un(d){return d&=-d,2<d?8<d?(d&134217727)!==0?32:268435456:8:2}function _t(){var d=G.p;return d!==0?d:(d=window.event,d===void 0?32:Rj(d.type))}function et(d,f){var E=G.p;try{return G.p=d,f()}finally{G.p=E}}var We=Math.random().toString(36).slice(2),yt="__reactFiber$"+We,Yt="__reactProps$"+We,tn="__reactContainer$"+We,In="__reactEvents$"+We,ga="__reactListeners$"+We,Ur="__reactHandles$"+We,Pn="__reactResources$"+We,dr="__reactMarker$"+We;function kn(d){delete d[yt],delete d[Yt],delete d[In],delete d[ga],delete d[Ur]}function dt(d){var f=d[yt];if(f)return f;for(var E=d.parentNode;E;){if(f=E[tn]||E[yt]){if(E=f.alternate,f.child!==null||E!==null&&E.child!==null)for(d=uj(d);d!==null;){if(E=d[yt])return E;d=uj(d)}return f}d=E,E=d.parentNode}return null}function kt(d){if(d=d[yt]||d[tn]){var f=d.tag;if(f===5||f===6||f===13||f===26||f===27||f===3)return d}return null}function jn(d){var f=d.tag;if(f===5||f===26||f===27||f===6)return d.stateNode;throw Error(r(33))}function Gn(d){var f=d[Pn];return f||(f=d[Pn]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function Wt(d){d[dr]=!0}var wt=new Set,Ct={};function Vt(d,f){On(d,f),On(d+"Capture",f)}function On(d,f){for(Ct[d]=f,d=0;d<f.length;d++)wt.add(f[d])}var gn=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),zt={},pn={};function ei(d){return z.call(pn,d)?!0:z.call(zt,d)?!1:gn.test(d)?pn[d]=!0:(zt[d]=!0,!1)}function or(d,f,E){if(ei(f))if(E===null)d.removeAttribute(f);else{switch(typeof E){case"undefined":case"function":case"symbol":d.removeAttribute(f);return;case"boolean":var S=f.toLowerCase().slice(0,5);if(S!=="data-"&&S!=="aria-"){d.removeAttribute(f);return}}d.setAttribute(f,""+E)}}function Ar(d,f,E){if(E===null)d.removeAttribute(f);else{switch(typeof E){case"undefined":case"function":case"symbol":case"boolean":d.removeAttribute(f);return}d.setAttribute(f,""+E)}}function hr(d,f,E,S){if(S===null)d.removeAttribute(E);else{switch(typeof S){case"undefined":case"function":case"symbol":case"boolean":d.removeAttribute(E);return}d.setAttributeNS(f,E,""+S)}}var ro,zn;function As(d){if(ro===void 0)try{throw Error()}catch(E){var f=E.stack.trim().match(/\n( *(at )?)/);ro=f&&f[1]||"",zn=-1<E.stack.indexOf("\n    at")?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+ro+d+zn}var Tt=!1;function Rs(d,f){if(!d||Tt)return"";Tt=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var S={DetermineComponentFrameRoot:function(){try{if(f){var He=function(){throw Error()};if(Object.defineProperty(He.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(He,[])}catch(Ne){var Re=Ne}Reflect.construct(d,[],He)}else{try{He.call()}catch(Ne){Re=Ne}d.call(He.prototype)}}else{try{throw Error()}catch(Ne){Re=Ne}(He=d())&&typeof He.catch=="function"&&He.catch(function(){})}}catch(Ne){if(Ne&&Re&&typeof Ne.stack=="string")return[Ne.stack,Re.stack]}return[null,null]}};S.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var C=Object.getOwnPropertyDescriptor(S.DetermineComponentFrameRoot,"name");C&&C.configurable&&Object.defineProperty(S.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var P=S.DetermineComponentFrameRoot(),Y=P[0],ee=P[1];if(Y&&ee){var fe=Y.split("\n"),ve=ee.split("\n");for(C=S=0;S<fe.length&&!fe[S].includes("DetermineComponentFrameRoot");)S++;for(;C<ve.length&&!ve[C].includes("DetermineComponentFrameRoot");)C++;if(S===fe.length||C===ve.length)for(S=fe.length-1,C=ve.length-1;1<=S&&0<=C&&fe[S]!==ve[C];)C--;for(;1<=S&&0<=C;S--,C--)if(fe[S]!==ve[C]){if(S!==1||C!==1)do if(S--,C--,0>C||fe[S]!==ve[C]){var Pe="\n"+fe[S].replace(" at new "," at ");return d.displayName&&Pe.includes("<anonymous>")&&(Pe=Pe.replace("<anonymous>",d.displayName)),Pe}while(1<=S&&0<=C);break}}}finally{Tt=!1,Error.prepareStackTrace=E}return(E=d?d.displayName||d.name:"")?As(E):""}function sc(d){switch(d.tag){case 26:case 27:case 5:return As(d.type);case 16:return As("Lazy");case 13:return As("Suspense");case 19:return As("SuspenseList");case 0:case 15:return Rs(d.type,!1);case 11:return Rs(d.type.render,!1);case 1:return Rs(d.type,!0);case 31:return As("Activity");default:return""}}function ic(d){try{var f="";do f+=sc(d),d=d.return;while(d);return f}catch(E){return"\nError generating stack: "+E.message+"\n"+E.stack}}function sa(d){switch(typeof d){case"bigint":case"boolean":case"number":case"string":case"undefined":return d;case"object":return d;default:return""}}function oc(d){var f=d.type;return(d=d.nodeName)&&d.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function Qg(d){var f=oc(d)?"checked":"value",E=Object.getOwnPropertyDescriptor(d.constructor.prototype,f),S=""+d[f];if(!d.hasOwnProperty(f)&&typeof E!="undefined"&&typeof E.get=="function"&&typeof E.set=="function"){var C=E.get,P=E.set;return Object.defineProperty(d,f,{configurable:!0,get:function(){return C.call(this)},set:function(Y){S=""+Y,P.call(this,Y)}}),Object.defineProperty(d,f,{enumerable:E.enumerable}),{getValue:function(){return S},setValue:function(Y){S=""+Y},stopTracking:function(){d._valueTracker=null,delete d[f]}}}}function Wo(d){d._valueTracker||(d._valueTracker=Qg(d))}function mf(d){if(!d)return!1;var f=d._valueTracker;if(!f)return!0;var E=f.getValue(),S="";return d&&(S=oc(d)?d.checked?"true":"false":d.value),d=S,d!==E?(f.setValue(d),!0):!1}function ao(d){if(d=d||(typeof document!="undefined"?document:void 0),typeof d=="undefined")return null;try{return d.activeElement||d.body}catch(f){return d.body}}var pf=/[\n"\\]/g;function Ua(d){return d.replace(pf,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function so(d,f,E,S,C,P,Y,ee){d.name="",Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?d.type=Y:d.removeAttribute("type"),f!=null?Y==="number"?(f===0&&d.value===""||d.value!=f)&&(d.value=""+sa(f)):d.value!==""+sa(f)&&(d.value=""+sa(f)):Y!=="submit"&&Y!=="reset"||d.removeAttribute("value"),f!=null?Ea(d,Y,sa(f)):E!=null?Ea(d,Y,sa(E)):S!=null&&d.removeAttribute("value"),C==null&&P!=null&&(d.defaultChecked=!!P),C!=null&&(d.checked=C&&typeof C!="function"&&typeof C!="symbol"),ee!=null&&typeof ee!="function"&&typeof ee!="symbol"&&typeof ee!="boolean"?d.name=""+sa(ee):d.removeAttribute("name")}function gf(d,f,E,S,C,P,Y,ee){if(P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(d.type=P),f!=null||E!=null){if(!(P!=="submit"&&P!=="reset"||f!=null))return;E=E!=null?""+sa(E):"",f=f!=null?""+sa(f):E,ee||f===d.value||(d.value=f),d.defaultValue=f}S=S!=null?S:C,S=typeof S!="function"&&typeof S!="symbol"&&!!S,d.checked=ee?d.checked:!!S,d.defaultChecked=!!S,Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"&&(d.name=Y)}function Ea(d,f,E){f==="number"&&ao(d.ownerDocument)===d||d.defaultValue===""+E||(d.defaultValue=""+E)}function Xo(d,f,E,S){if(d=d.options,f){f={};for(var C=0;C<E.length;C++)f["$"+E[C]]=!0;for(E=0;E<d.length;E++)C=f.hasOwnProperty("$"+d[E].value),d[E].selected!==C&&(d[E].selected=C),C&&S&&(d[E].defaultSelected=!0)}else{for(E=""+sa(E),f=null,C=0;C<d.length;C++){if(d[C].value===E){d[C].selected=!0,S&&(d[C].defaultSelected=!0);return}f!==null||d[C].disabled||(f=d[C])}f!==null&&(f.selected=!0)}}function Jg(d,f,E){if(f!=null&&(f=""+sa(f),f!==d.value&&(d.value=f),E==null)){d.defaultValue!==f&&(d.defaultValue=f);return}d.defaultValue=E!=null?""+sa(E):""}function Si(d,f,E,S){if(f==null){if(S!=null){if(E!=null)throw Error(r(92));if(B(S)){if(1<S.length)throw Error(r(93));S=S[0]}E=S}E==null&&(E=""),f=E}E=sa(f),d.defaultValue=E,S=d.textContent,S===E&&S!==""&&S!==null&&(d.value=S)}function bi(d,f){if(f){var E=d.firstChild;if(E&&E===d.lastChild&&E.nodeType===3){E.nodeValue=f;return}}d.textContent=f}var WZ=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function sP(d,f,E){var S=f.indexOf("--")===0;E==null||typeof E=="boolean"||E===""?S?d.setProperty(f,""):f==="float"?d.cssFloat="":d[f]="":S?d.setProperty(f,E):typeof E!="number"||E===0||WZ.has(f)?f==="float"?d.cssFloat=E:d[f]=(""+E).trim():d[f]=E+"px"}function iP(d,f,E){if(f!=null&&typeof f!="object")throw Error(r(62));if(d=d.style,E!=null){for(var S in E)!E.hasOwnProperty(S)||f!=null&&f.hasOwnProperty(S)||(S.indexOf("--")===0?d.setProperty(S,""):S==="float"?d.cssFloat="":d[S]="");for(var C in f)S=f[C],f.hasOwnProperty(C)&&E[C]!==S&&sP(d,C,S)}else for(var P in f)f.hasOwnProperty(P)&&sP(d,P,f[P])}function _S(d){if(d.indexOf("-")===-1)return!1;switch(d){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var XZ=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),KZ=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Zg(d){return KZ.test(""+d)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":d}var wS=null;function CS(d){return d=d.target||d.srcElement||window,d.correspondingUseElement&&(d=d.correspondingUseElement),d.nodeType===3?d.parentNode:d}var Gu=null,zu=null;function oP(d){var f=kt(d);if(f&&(d=f.stateNode)){var E=d[Yt]||null;e:switch(d=f.stateNode,f.type){case"input":if(so(d,E.value,E.defaultValue,E.defaultValue,E.checked,E.defaultChecked,E.type,E.name),f=E.name,E.type==="radio"&&f!=null){for(E=d;E.parentNode;)E=E.parentNode;for(E=E.querySelectorAll('input[name="'+Ua(""+f)+'"][type="radio"]'),f=0;f<E.length;f++){var S=E[f];if(S!==d&&S.form===d.form){var C=S[Yt]||null;if(!C)throw Error(r(90));so(S,C.value,C.defaultValue,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name)}}for(f=0;f<E.length;f++)S=E[f],S.form===d.form&&mf(S)}break e;case"textarea":Jg(d,E.value,E.defaultValue);break e;case"select":f=E.value,f!=null&&Xo(d,!!E.multiple,f,!1)}}}var IS=!1;function lP(d,f,E){if(IS)return d(f,E);IS=!0;try{var S=d(f);return S}finally{if(IS=!1,(Gu!==null||zu!==null)&&(UE(),Gu&&(f=Gu,d=zu,zu=Gu=null,oP(f),d)))for(f=0;f<d.length;f++)oP(d[f])}}function Ef(d,f){var E=d.stateNode;if(E===null)return null;var S=E[Yt]||null;if(S===null)return null;E=S[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(S=!S.disabled)||(d=d.type,S=!(d==="button"||d==="input"||d==="select"||d==="textarea")),d=!S;break e;default:d=!1}if(d)return null;if(E&&typeof E!="function")throw Error(r(231,f,typeof E));return E}var io=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),OS=!1;if(io)try{var Tf={};Object.defineProperty(Tf,"passive",{get:function(){OS=!0}}),window.addEventListener("test",Tf,Tf),window.removeEventListener("test",Tf,Tf)}catch(d){OS=!1}var Ko=null,LS=null,eE=null;function cP(){if(eE)return eE;var d,f=LS,E=f.length,S,C="value"in Ko?Ko.value:Ko.textContent,P=C.length;for(d=0;d<E&&f[d]===C[d];d++);var Y=E-d;for(S=1;S<=Y&&f[E-S]===C[P-S];S++);return eE=C.slice(d,1<S?1-S:void 0)}function tE(d){var f=d.keyCode;return"charCode"in d?(d=d.charCode,d===0&&f===13&&(d=13)):d=f,d===10&&(d=13),32<=d||d===13?d:0}function nE(){return!0}function uP(){return!1}function qa(d){function f(E,S,C,P,Y){this._reactName=E,this._targetInst=C,this.type=S,this.nativeEvent=P,this.target=Y,this.currentTarget=null;for(var ee in d)d.hasOwnProperty(ee)&&(E=d[ee],this[ee]=E?E(P):P[ee]);return this.isDefaultPrevented=(P.defaultPrevented!=null?P.defaultPrevented:P.returnValue===!1)?nE:uP,this.isPropagationStopped=uP,this}return h(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var E=this.nativeEvent;E&&(E.preventDefault?E.preventDefault():typeof E.returnValue!="unknown"&&(E.returnValue=!1),this.isDefaultPrevented=nE)},stopPropagation:function(){var E=this.nativeEvent;E&&(E.stopPropagation?E.stopPropagation():typeof E.cancelBubble!="unknown"&&(E.cancelBubble=!0),this.isPropagationStopped=nE)},persist:function(){},isPersistent:nE}),f}var lc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(d){return d.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rE=qa(lc),yf=h({},lc,{view:0,detail:0}),QZ=qa(yf),MS,DS,xf,aE=h({},yf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kS,button:0,buttons:0,relatedTarget:function(d){return d.relatedTarget===void 0?d.fromElement===d.srcElement?d.toElement:d.fromElement:d.relatedTarget},movementX:function(d){return"movementX"in d?d.movementX:(d!==xf&&(xf&&d.type==="mousemove"?(MS=d.screenX-xf.screenX,DS=d.screenY-xf.screenY):DS=MS=0,xf=d),MS)},movementY:function(d){return"movementY"in d?d.movementY:DS}}),dP=qa(aE),JZ=h({},aE,{dataTransfer:0}),ZZ=qa(JZ),eee=h({},yf,{relatedTarget:0}),PS=qa(eee),tee=h({},lc,{animationName:0,elapsedTime:0,pseudoElement:0}),nee=qa(tee),ree=h({},lc,{clipboardData:function(d){return"clipboardData"in d?d.clipboardData:window.clipboardData}}),aee=qa(ree),see=h({},lc,{data:0}),hP=qa(see),iee={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oee={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},lee={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cee(d){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(d):(d=lee[d])?!!f[d]:!1}function kS(){return cee}var uee=h({},yf,{key:function(d){if(d.key){var f=iee[d.key]||d.key;if(f!=="Unidentified")return f}return d.type==="keypress"?(d=tE(d),d===13?"Enter":String.fromCharCode(d)):d.type==="keydown"||d.type==="keyup"?oee[d.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kS,charCode:function(d){return d.type==="keypress"?tE(d):0},keyCode:function(d){return d.type==="keydown"||d.type==="keyup"?d.keyCode:0},which:function(d){return d.type==="keypress"?tE(d):d.type==="keydown"||d.type==="keyup"?d.keyCode:0}}),dee=qa(uee),hee=h({},aE,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),fP=qa(hee),fee=h({},yf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kS}),mee=qa(fee),pee=h({},lc,{propertyName:0,elapsedTime:0,pseudoElement:0}),gee=qa(pee),Eee=h({},aE,{deltaX:function(d){return"deltaX"in d?d.deltaX:"wheelDeltaX"in d?-d.wheelDeltaX:0},deltaY:function(d){return"deltaY"in d?d.deltaY:"wheelDeltaY"in d?-d.wheelDeltaY:"wheelDelta"in d?-d.wheelDelta:0},deltaZ:0,deltaMode:0}),Tee=qa(Eee),yee=h({},lc,{newState:0,oldState:0}),xee=qa(yee),See=[9,13,27,32],jS=io&&"CompositionEvent"in window,Sf=null;io&&"documentMode"in document&&(Sf=document.documentMode);var bee=io&&"TextEvent"in window&&!Sf,mP=io&&(!jS||Sf&&8<Sf&&11>=Sf),pP=" ",gP=!1;function EP(d,f){switch(d){case"keyup":return See.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function TP(d){return d=d.detail,typeof d=="object"&&"data"in d?d.data:null}var qu=!1;function vee(d,f){switch(d){case"compositionend":return TP(f);case"keypress":return f.which!==32?null:(gP=!0,pP);case"textInput":return d=f.data,d===pP&&gP?null:d;default:return null}}function Aee(d,f){if(qu)return d==="compositionend"||!jS&&EP(d,f)?(d=cP(),eE=LS=Ko=null,qu=!1,d):null;switch(d){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return mP&&f.locale!=="ko"?null:f.data;default:return null}}var Ree={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function yP(d){var f=d&&d.nodeName&&d.nodeName.toLowerCase();return f==="input"?!!Ree[d.type]:f==="textarea"}function xP(d,f,E,S){Gu?zu?zu.push(S):zu=[S]:Gu=S,f=GE(f,"onChange"),0<f.length&&(E=new rE("onChange","change",null,E,S),d.push({event:E,listeners:f}))}var bf=null,vf=null;function Nee(d){ej(d,0)}function sE(d){var f=jn(d);if(mf(f))return d}function SP(d,f){if(d==="change")return f}var bP=!1;if(io){var US;if(io){var FS="oninput"in document;if(!FS){var vP=document.createElement("div");vP.setAttribute("oninput","return;"),FS=typeof vP.oninput=="function"}US=FS}else US=!1;bP=US&&(!document.documentMode||9<document.documentMode)}function AP(){bf&&(bf.detachEvent("onpropertychange",RP),vf=bf=null)}function RP(d){if(d.propertyName==="value"&&sE(vf)){var f=[];xP(f,vf,d,CS(d)),lP(Nee,f)}}function _ee(d,f,E){d==="focusin"?(AP(),bf=f,vf=E,bf.attachEvent("onpropertychange",RP)):d==="focusout"&&AP()}function wee(d){if(d==="selectionchange"||d==="keyup"||d==="keydown")return sE(vf)}function Cee(d,f){if(d==="click")return sE(f)}function Iee(d,f){if(d==="input"||d==="change")return sE(f)}function Oee(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var os=typeof Object.is=="function"?Object.is:Oee;function Af(d,f){if(os(d,f))return!0;if(typeof d!="object"||d===null||typeof f!="object"||f===null)return!1;var E=Object.keys(d),S=Object.keys(f);if(E.length!==S.length)return!1;for(S=0;S<E.length;S++){var C=E[S];if(!z.call(f,C)||!os(d[C],f[C]))return!1}return!0}function NP(d){for(;d&&d.firstChild;)d=d.firstChild;return d}function _P(d,f){var E=NP(d);d=0;for(var S;E;){if(E.nodeType===3){if(S=d+E.textContent.length,d<=f&&S>=f)return{node:E,offset:f-d};d=S}e:{for(;E;){if(E.nextSibling){E=E.nextSibling;break e}E=E.parentNode}E=void 0}E=NP(E)}}function wP(d,f){return d&&f?d===f?!0:d&&d.nodeType===3?!1:f&&f.nodeType===3?wP(d,f.parentNode):"contains"in d?d.contains(f):d.compareDocumentPosition?!!(d.compareDocumentPosition(f)&16):!1:!1}function CP(d){d=d!=null&&d.ownerDocument!=null&&d.ownerDocument.defaultView!=null?d.ownerDocument.defaultView:window;for(var f=ao(d.document);f instanceof d.HTMLIFrameElement;){try{var E=typeof f.contentWindow.location.href=="string"}catch(S){E=!1}if(E)d=f.contentWindow;else break;f=ao(d.document)}return f}function $S(d){var f=d&&d.nodeName&&d.nodeName.toLowerCase();return f&&(f==="input"&&(d.type==="text"||d.type==="search"||d.type==="tel"||d.type==="url"||d.type==="password")||f==="textarea"||d.contentEditable==="true")}var Lee=io&&"documentMode"in document&&11>=document.documentMode,Yu=null,BS=null,Rf=null,HS=!1;function IP(d,f,E){var S=E.window===E?E.document:E.nodeType===9?E:E.ownerDocument;HS||Yu==null||Yu!==ao(S)||(S=Yu,"selectionStart"in S&&$S(S)?S={start:S.selectionStart,end:S.selectionEnd}:(S=(S.ownerDocument&&S.ownerDocument.defaultView||window).getSelection(),S={anchorNode:S.anchorNode,anchorOffset:S.anchorOffset,focusNode:S.focusNode,focusOffset:S.focusOffset}),Rf&&Af(Rf,S)||(Rf=S,S=GE(BS,"onSelect"),0<S.length&&(f=new rE("onSelect","select",null,f,E),d.push({event:f,listeners:S}),f.target=Yu)))}function cc(d,f){var E={};return E[d.toLowerCase()]=f.toLowerCase(),E["Webkit"+d]="webkit"+f,E["Moz"+d]="moz"+f,E}var Wu={animationend:cc("Animation","AnimationEnd"),animationiteration:cc("Animation","AnimationIteration"),animationstart:cc("Animation","AnimationStart"),transitionrun:cc("Transition","TransitionRun"),transitionstart:cc("Transition","TransitionStart"),transitioncancel:cc("Transition","TransitionCancel"),transitionend:cc("Transition","TransitionEnd")},VS={},OP={};io&&(OP=document.createElement("div").style,"AnimationEvent"in window||(delete Wu.animationend.animation,delete Wu.animationiteration.animation,delete Wu.animationstart.animation),"TransitionEvent"in window||delete Wu.transitionend.transition);function uc(d){if(VS[d])return VS[d];if(!Wu[d])return d;var f=Wu[d],E;for(E in f)if(f.hasOwnProperty(E)&&E in OP)return VS[d]=f[E];return d}var LP=uc("animationend"),MP=uc("animationiteration"),DP=uc("animationstart"),Mee=uc("transitionrun"),Dee=uc("transitionstart"),Pee=uc("transitioncancel"),PP=uc("transitionend"),kP=new Map,GS="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");GS.push("scrollEnd");function ti(d,f){kP.set(d,f),Vt(f,[d])}var jP=new WeakMap;function Ns(d,f){if(typeof d=="object"&&d!==null){var E=jP.get(d);return E!==void 0?E:(f={value:d,source:f,stack:ic(f)},jP.set(d,f),f)}return{value:d,source:f,stack:ic(f)}}var _s=[],Xu=0,zS=0;function iE(){for(var d=Xu,f=zS=Xu=0;f<d;){var E=_s[f];_s[f++]=null;var S=_s[f];_s[f++]=null;var C=_s[f];_s[f++]=null;var P=_s[f];if(_s[f++]=null,S!==null&&C!==null){var Y=S.pending;Y===null?C.next=C:(C.next=Y.next,Y.next=C),S.pending=C}P!==0&&UP(E,C,P)}}function oE(d,f,E,S){_s[Xu++]=d,_s[Xu++]=f,_s[Xu++]=E,_s[Xu++]=S,zS|=S,d.lanes|=S,d=d.alternate,d!==null&&(d.lanes|=S)}function qS(d,f,E,S){return oE(d,f,E,S),lE(d)}function Ku(d,f){return oE(d,null,null,f),lE(d)}function UP(d,f,E){d.lanes|=E;var S=d.alternate;S!==null&&(S.lanes|=E);for(var C=!1,P=d.return;P!==null;)P.childLanes|=E,S=P.alternate,S!==null&&(S.childLanes|=E),P.tag===22&&(d=P.stateNode,d===null||d._visibility&1||(C=!0)),d=P,P=P.return;return d.tag===3?(P=d.stateNode,C&&f!==null&&(C=31-Le(E),d=P.hiddenUpdates,S=d[C],S===null?d[C]=[f]:S.push(f),f.lane=E|536870912),P):null}function lE(d){if(50<Kf)throw Kf=0,Jb=null,Error(r(185));for(var f=d.return;f!==null;)d=f,f=d.return;return d.tag===3?d.stateNode:null}var Qu={};function kee(d,f,E,S){this.tag=d,this.key=E,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ls(d,f,E,S){return new kee(d,f,E,S)}function YS(d){return d=d.prototype,!(!d||!d.isReactComponent)}function oo(d,f){var E=d.alternate;return E===null?(E=ls(d.tag,f,d.key,d.mode),E.elementType=d.elementType,E.type=d.type,E.stateNode=d.stateNode,E.alternate=d,d.alternate=E):(E.pendingProps=f,E.type=d.type,E.flags=0,E.subtreeFlags=0,E.deletions=null),E.flags=d.flags&65011712,E.childLanes=d.childLanes,E.lanes=d.lanes,E.child=d.child,E.memoizedProps=d.memoizedProps,E.memoizedState=d.memoizedState,E.updateQueue=d.updateQueue,f=d.dependencies,E.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},E.sibling=d.sibling,E.index=d.index,E.ref=d.ref,E.refCleanup=d.refCleanup,E}function FP(d,f){d.flags&=65011714;var E=d.alternate;return E===null?(d.childLanes=0,d.lanes=f,d.child=null,d.subtreeFlags=0,d.memoizedProps=null,d.memoizedState=null,d.updateQueue=null,d.dependencies=null,d.stateNode=null):(d.childLanes=E.childLanes,d.lanes=E.lanes,d.child=E.child,d.subtreeFlags=0,d.deletions=null,d.memoizedProps=E.memoizedProps,d.memoizedState=E.memoizedState,d.updateQueue=E.updateQueue,d.type=E.type,f=E.dependencies,d.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),d}function cE(d,f,E,S,C,P){var Y=0;if(S=d,typeof d=="function")YS(d)&&(Y=1);else if(typeof d=="string")Y=Ute(d,E,te.current)?26:d==="html"||d==="head"||d==="body"?27:5;else e:switch(d){case M:return d=ls(31,E,f,C),d.elementType=M,d.lanes=P,d;case T:return dc(E.children,C,P,f);case y:Y=8,C|=24;break;case b:return d=ls(12,E,f,C|2),d.elementType=b,d.lanes=P,d;case _:return d=ls(13,E,f,C),d.elementType=_,d.lanes=P,d;case N:return d=ls(19,E,f,C),d.elementType=N,d.lanes=P,d;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case x:case A:Y=10;break e;case R:Y=9;break e;case w:Y=11;break e;case I:Y=14;break e;case D:Y=16,S=null;break e}Y=29,E=Error(r(130,d===null?"null":typeof d,"")),S=null}return f=ls(Y,E,f,C),f.elementType=d,f.type=S,f.lanes=P,f}function dc(d,f,E,S){return d=ls(7,d,S,f),d.lanes=E,d}function WS(d,f,E){return d=ls(6,d,null,f),d.lanes=E,d}function XS(d,f,E){return f=ls(4,d.children!==null?d.children:[],d.key,f),f.lanes=E,f.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},f}var Ju=[],Zu=0,uE=null,dE=0,ws=[],Cs=0,hc=null,lo=1,co="";function fc(d,f){Ju[Zu++]=dE,Ju[Zu++]=uE,uE=d,dE=f}function $P(d,f,E){ws[Cs++]=lo,ws[Cs++]=co,ws[Cs++]=hc,hc=d;var S=lo;d=co;var C=32-Le(S)-1;S&=~(1<<C),E+=1;var P=32-Le(f)+C;if(30<P){var Y=C-C%5;P=(S&(1<<Y)-1).toString(32),S>>=Y,C-=Y,lo=1<<32-Le(f)+C|E<<C|S,co=P+d}else lo=1<<P|E<<C|S,co=d}function KS(d){d.return!==null&&(fc(d,1),$P(d,1,0))}function QS(d){for(;d===uE;)uE=Ju[--Zu],Ju[Zu]=null,dE=Ju[--Zu],Ju[Zu]=null;for(;d===hc;)hc=ws[--Cs],ws[Cs]=null,co=ws[--Cs],ws[Cs]=null,lo=ws[--Cs],ws[Cs]=null}var Fa=null,Tr=null,An=!1,mc=null,vi=!1,JS=Error(r(519));function pc(d){var f=Error(r(418,""));throw wf(Ns(f,d)),JS}function BP(d){var f=d.stateNode,E=d.type,S=d.memoizedProps;switch(f[yt]=d,f[Yt]=S,E){case"dialog":on("cancel",f),on("close",f);break;case"iframe":case"object":case"embed":on("load",f);break;case"video":case"audio":for(E=0;E<Jf.length;E++)on(Jf[E],f);break;case"source":on("error",f);break;case"img":case"image":case"link":on("error",f),on("load",f);break;case"details":on("toggle",f);break;case"input":on("invalid",f),gf(f,S.value,S.defaultValue,S.checked,S.defaultChecked,S.type,S.name,!0),Wo(f);break;case"select":on("invalid",f);break;case"textarea":on("invalid",f),Si(f,S.value,S.defaultValue,S.children),Wo(f)}E=S.children,typeof E!="string"&&typeof E!="number"&&typeof E!="bigint"||f.textContent===""+E||S.suppressHydrationWarning===!0||aj(f.textContent,E)?(S.popover!=null&&(on("beforetoggle",f),on("toggle",f)),S.onScroll!=null&&on("scroll",f),S.onScrollEnd!=null&&on("scrollend",f),S.onClick!=null&&(f.onclick=zE),f=!0):f=!1,f||pc(d)}function HP(d){for(Fa=d.return;Fa;)switch(Fa.tag){case 5:case 13:vi=!1;return;case 27:case 3:vi=!0;return;default:Fa=Fa.return}}function Nf(d){if(d!==Fa)return!1;if(!An)return HP(d),An=!0,!1;var f=d.tag,E;if((E=f!==3&&f!==27)&&((E=f===5)&&(E=d.type,E=!(E!=="form"&&E!=="button")||mv(d.type,d.memoizedProps)),E=!E),E&&Tr&&pc(d),HP(d),f===13){if(d=d.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));e:{for(d=d.nextSibling,f=0;d;){if(d.nodeType===8)if(E=d.data,E==="/$"){if(f===0){Tr=ri(d.nextSibling);break e}f--}else E!=="$"&&E!=="$!"&&E!=="$?"||f++;d=d.nextSibling}Tr=null}}else f===27?(f=Tr,hl(d.type)?(d=Tv,Tv=null,Tr=d):Tr=f):Tr=Fa?ri(d.stateNode.nextSibling):null;return!0}function _f(){Tr=Fa=null,An=!1}function VP(){var d=mc;return d!==null&&(Xa===null?Xa=d:Xa.push.apply(Xa,d),mc=null),d}function wf(d){mc===null?mc=[d]:mc.push(d)}var ZS=X(null),gc=null,uo=null;function Qo(d,f,E){V(ZS,f._currentValue),f._currentValue=E}function ho(d){d._currentValue=ZS.current,Z(ZS)}function eb(d,f,E){for(;d!==null;){var S=d.alternate;if((d.childLanes&f)!==f?(d.childLanes|=f,S!==null&&(S.childLanes|=f)):S!==null&&(S.childLanes&f)!==f&&(S.childLanes|=f),d===E)break;d=d.return}}function tb(d,f,E,S){var C=d.child;for(C!==null&&(C.return=d);C!==null;){var P=C.dependencies;if(P!==null){var Y=C.child;P=P.firstContext;e:for(;P!==null;){var ee=P;P=C;for(var fe=0;fe<f.length;fe++)if(ee.context===f[fe]){P.lanes|=E,ee=P.alternate,ee!==null&&(ee.lanes|=E),eb(P.return,E,d),S||(Y=null);break e}P=ee.next}}else if(C.tag===18){if(Y=C.return,Y===null)throw Error(r(341));Y.lanes|=E,P=Y.alternate,P!==null&&(P.lanes|=E),eb(Y,E,d),Y=null}else Y=C.child;if(Y!==null)Y.return=C;else for(Y=C;Y!==null;){if(Y===d){Y=null;break}if(C=Y.sibling,C!==null){C.return=Y.return,Y=C;break}Y=Y.return}C=Y}}function Cf(d,f,E,S){d=null;for(var C=f,P=!1;C!==null;){if(!P){if((C.flags&524288)!==0)P=!0;else if((C.flags&262144)!==0)break}if(C.tag===10){var Y=C.alternate;if(Y===null)throw Error(r(387));if(Y=Y.memoizedProps,Y!==null){var ee=C.type;os(C.pendingProps.value,Y.value)||(d!==null?d.push(ee):d=[ee])}}else if(C===ce.current){if(Y=C.alternate,Y===null)throw Error(r(387));Y.memoizedState.memoizedState!==C.memoizedState.memoizedState&&(d!==null?d.push(am):d=[am])}C=C.return}d!==null&&tb(f,d,E,S),f.flags|=262144}function hE(d){for(d=d.firstContext;d!==null;){if(!os(d.context._currentValue,d.memoizedValue))return!0;d=d.next}return!1}function Ec(d){gc=d,uo=null,d=d.dependencies,d!==null&&(d.firstContext=null)}function Ta(d){return GP(gc,d)}function fE(d,f){return gc===null&&Ec(d),GP(d,f)}function GP(d,f){var E=f._currentValue;if(f={context:f,memoizedValue:E,next:null},uo===null){if(d===null)throw Error(r(308));uo=f,d.dependencies={lanes:0,firstContext:f},d.flags|=524288}else uo=uo.next=f;return E}var jee=typeof AbortController!="undefined"?AbortController:function(){var d=[],f=this.signal={aborted:!1,addEventListener:function(E,S){d.push(S)}};this.abort=function(){f.aborted=!0,d.forEach(function(E){return E()})}},Uee=e.unstable_scheduleCallback,Fee=e.unstable_NormalPriority,Fr={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nb(){return{controller:new jee,data:new Map,refCount:0}}function If(d){d.refCount--,d.refCount===0&&Uee(Fee,function(){d.controller.abort()})}var Of=null,rb=0,ed=0,td=null;function $ee(d,f){if(Of===null){var E=Of=[];rb=0,ed=sv(),td={status:"pending",value:void 0,then:function(S){E.push(S)}}}return rb++,f.then(zP,zP),f}function zP(){if(--rb===0&&Of!==null){td!==null&&(td.status="fulfilled");var d=Of;Of=null,ed=0,td=null;for(var f=0;f<d.length;f++)(0,d[f])()}}function Bee(d,f){var E=[],S={status:"pending",value:null,reason:null,then:function(C){E.push(C)}};return d.then(function(){S.status="fulfilled",S.value=f;for(var C=0;C<E.length;C++)(0,E[C])(f)},function(C){for(S.status="rejected",S.reason=C,C=0;C<E.length;C++)(0,E[C])(void 0)}),S}var qP=j.S;j.S=function(d,f){typeof f=="object"&&f!==null&&typeof f.then=="function"&&$ee(d,f),qP!==null&&qP(d,f)};var Tc=X(null);function ab(){var d=Tc.current;return d!==null?d:Jn.pooledCache}function mE(d,f){f===null?V(Tc,Tc.current):V(Tc,f.pool)}function YP(){var d=ab();return d===null?null:{parent:Fr._currentValue,pool:d}}var Lf=Error(r(460)),WP=Error(r(474)),pE=Error(r(542)),sb={then:function(){}};function XP(d){return d=d.status,d==="fulfilled"||d==="rejected"}function gE(){}function KP(d,f,E){switch(E=d[E],E===void 0?d.push(f):E!==f&&(f.then(gE,gE),f=E),f.status){case"fulfilled":return f.value;case"rejected":throw d=f.reason,JP(d),d;default:if(typeof f.status=="string")f.then(gE,gE);else{if(d=Jn,d!==null&&100<d.shellSuspendCounter)throw Error(r(482));d=f,d.status="pending",d.then(function(S){if(f.status==="pending"){var C=f;C.status="fulfilled",C.value=S}},function(S){if(f.status==="pending"){var C=f;C.status="rejected",C.reason=S}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw d=f.reason,JP(d),d}throw Mf=f,Lf}}var Mf=null;function QP(){if(Mf===null)throw Error(r(459));var d=Mf;return Mf=null,d}function JP(d){if(d===Lf||d===pE)throw Error(r(483))}var Jo=!1;function ib(d){d.updateQueue={baseState:d.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ob(d,f){d=d.updateQueue,f.updateQueue===d&&(f.updateQueue={baseState:d.baseState,firstBaseUpdate:d.firstBaseUpdate,lastBaseUpdate:d.lastBaseUpdate,shared:d.shared,callbacks:null})}function Zo(d){return{lane:d,tag:0,payload:null,callback:null,next:null}}function el(d,f,E){var S=d.updateQueue;if(S===null)return null;if(S=S.shared,(Ln&2)!==0){var C=S.pending;return C===null?f.next=f:(f.next=C.next,C.next=f),S.pending=f,f=lE(d),UP(d,null,E),f}return oE(d,S,f,E),lE(d)}function Df(d,f,E){if(f=f.updateQueue,f!==null&&(f=f.shared,(E&4194048)!==0)){var S=f.lanes;S&=d.pendingLanes,E|=S,f.lanes=E,pt(d,E)}}function lb(d,f){var E=d.updateQueue,S=d.alternate;if(S!==null&&(S=S.updateQueue,E===S)){var C=null,P=null;if(E=E.firstBaseUpdate,E!==null){do{var Y={lane:E.lane,tag:E.tag,payload:E.payload,callback:null,next:null};P===null?C=P=Y:P=P.next=Y,E=E.next}while(E!==null);P===null?C=P=f:P=P.next=f}else C=P=f;E={baseState:S.baseState,firstBaseUpdate:C,lastBaseUpdate:P,shared:S.shared,callbacks:S.callbacks},d.updateQueue=E;return}d=E.lastBaseUpdate,d===null?E.firstBaseUpdate=f:d.next=f,E.lastBaseUpdate=f}var cb=!1;function Pf(){if(cb){var d=td;if(d!==null)throw d}}function kf(d,f,E,S){cb=!1;var C=d.updateQueue;Jo=!1;var P=C.firstBaseUpdate,Y=C.lastBaseUpdate,ee=C.shared.pending;if(ee!==null){C.shared.pending=null;var fe=ee,ve=fe.next;fe.next=null,Y===null?P=ve:Y.next=ve,Y=fe;var Pe=d.alternate;Pe!==null&&(Pe=Pe.updateQueue,ee=Pe.lastBaseUpdate,ee!==Y&&(ee===null?Pe.firstBaseUpdate=ve:ee.next=ve,Pe.lastBaseUpdate=fe))}if(P!==null){var He=C.baseState;Y=0,Pe=ve=fe=null,ee=P;do{var Re=ee.lane&-536870913,Ne=Re!==ee.lane;if(Ne?(hn&Re)===Re:(S&Re)===Re){Re!==0&&Re===ed&&(cb=!0),Pe!==null&&(Pe=Pe.next={lane:0,tag:ee.tag,payload:ee.payload,callback:null,next:null});e:{var Ft=d,Lt=ee;Re=f;var $n=E;switch(Lt.tag){case 1:if(Ft=Lt.payload,typeof Ft=="function"){He=Ft.call($n,He,Re);break e}He=Ft;break e;case 3:Ft.flags=Ft.flags&-65537|128;case 0:if(Ft=Lt.payload,Re=typeof Ft=="function"?Ft.call($n,He,Re):Ft,Re==null)break e;He=h({},He,Re);break e;case 2:Jo=!0}}Re=ee.callback,Re!==null&&(d.flags|=64,Ne&&(d.flags|=8192),Ne=C.callbacks,Ne===null?C.callbacks=[Re]:Ne.push(Re))}else Ne={lane:Re,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},Pe===null?(ve=Pe=Ne,fe=He):Pe=Pe.next=Ne,Y|=Re;if(ee=ee.next,ee===null){if(ee=C.shared.pending,ee===null)break;Ne=ee,ee=Ne.next,Ne.next=null,C.lastBaseUpdate=Ne,C.shared.pending=null}}while(!0);Pe===null&&(fe=He),C.baseState=fe,C.firstBaseUpdate=ve,C.lastBaseUpdate=Pe,P===null&&(C.shared.lanes=0),ll|=Y,d.lanes=Y,d.memoizedState=He}}function ZP(d,f){if(typeof d!="function")throw Error(r(191,d));d.call(f)}function e2(d,f){var E=d.callbacks;if(E!==null)for(d.callbacks=null,d=0;d<E.length;d++)ZP(E[d],f)}var nd=X(null),EE=X(0);function t2(d,f){d=yo,V(EE,d),V(nd,f),yo=d|f.baseLanes}function ub(){V(EE,yo),V(nd,nd.current)}function db(){yo=EE.current,Z(nd),Z(EE)}var tl=0,nn=null,Un=null,Cr=null,TE=!1,rd=!1,yc=!1,yE=0,jf=0,ad=null,Hee=0;function Rr(){throw Error(r(321))}function hb(d,f){if(f===null)return!1;for(var E=0;E<f.length&&E<d.length;E++)if(!os(d[E],f[E]))return!1;return!0}function fb(d,f,E,S,C,P){return tl=P,nn=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,j.H=d===null||d.memoizedState===null?U2:F2,yc=!1,P=E(S,C),yc=!1,rd&&(P=r2(f,E,S,C)),n2(d),P}function n2(d){j.H=RE;var f=Un!==null&&Un.next!==null;if(tl=0,Cr=Un=nn=null,TE=!1,jf=0,ad=null,f)throw Error(r(300));d===null||zr||(d=d.dependencies,d!==null&&hE(d)&&(zr=!0))}function r2(d,f,E,S){nn=d;var C=0;do{if(rd&&(ad=null),jf=0,rd=!1,25<=C)throw Error(r(301));if(C+=1,Cr=Un=null,d.updateQueue!=null){var P=d.updateQueue;P.lastEffect=null,P.events=null,P.stores=null,P.memoCache!=null&&(P.memoCache.index=0)}j.H=Xee,P=f(E,S)}while(rd);return P}function Vee(){var d=j.H,f=d.useState()[0];return f=typeof f.then=="function"?Uf(f):f,d=d.useState()[0],(Un!==null?Un.memoizedState:null)!==d&&(nn.flags|=1024),f}function mb(){var d=yE!==0;return yE=0,d}function pb(d,f,E){f.updateQueue=d.updateQueue,f.flags&=-2053,d.lanes&=~E}function gb(d){if(TE){for(d=d.memoizedState;d!==null;){var f=d.queue;f!==null&&(f.pending=null),d=d.next}TE=!1}tl=0,Cr=Un=nn=null,rd=!1,jf=yE=0,ad=null}function Ya(){var d={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Cr===null?nn.memoizedState=Cr=d:Cr=Cr.next=d,Cr}function Ir(){if(Un===null){var d=nn.alternate;d=d!==null?d.memoizedState:null}else d=Un.next;var f=Cr===null?nn.memoizedState:Cr.next;if(f!==null)Cr=f,Un=d;else{if(d===null)throw nn.alternate===null?Error(r(467)):Error(r(310));Un=d,d={memoizedState:Un.memoizedState,baseState:Un.baseState,baseQueue:Un.baseQueue,queue:Un.queue,next:null},Cr===null?nn.memoizedState=Cr=d:Cr=Cr.next=d}return Cr}function Eb(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Uf(d){var f=jf;return jf+=1,ad===null&&(ad=[]),d=KP(ad,d,f),f=nn,(Cr===null?f.memoizedState:Cr.next)===null&&(f=f.alternate,j.H=f===null||f.memoizedState===null?U2:F2),d}function xE(d){if(d!==null&&typeof d=="object"){if(typeof d.then=="function")return Uf(d);if(d.$$typeof===A)return Ta(d)}throw Error(r(438,String(d)))}function Tb(d){var f=null,E=nn.updateQueue;if(E!==null&&(f=E.memoCache),f==null){var S=nn.alternate;S!==null&&(S=S.updateQueue,S!==null&&(S=S.memoCache,S!=null&&(f={data:S.data.map(function(C){return C.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),E===null&&(E=Eb(),nn.updateQueue=E),E.memoCache=f,E=f.data[f.index],E===void 0)for(E=f.data[f.index]=Array(d),S=0;S<d;S++)E[S]=O;return f.index++,E}function fo(d,f){return typeof f=="function"?f(d):f}function SE(d){var f=Ir();return yb(f,Un,d)}function yb(d,f,E){var S=d.queue;if(S===null)throw Error(r(311));S.lastRenderedReducer=E;var C=d.baseQueue,P=S.pending;if(P!==null){if(C!==null){var Y=C.next;C.next=P.next,P.next=Y}f.baseQueue=C=P,S.pending=null}if(P=d.baseState,C===null)d.memoizedState=P;else{f=C.next;var ee=Y=null,fe=null,ve=f,Pe=!1;do{var He=ve.lane&-536870913;if(He!==ve.lane?(hn&He)===He:(tl&He)===He){var Re=ve.revertLane;if(Re===0)fe!==null&&(fe=fe.next={lane:0,revertLane:0,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null}),He===ed&&(Pe=!0);else if((tl&Re)===Re){ve=ve.next,Re===ed&&(Pe=!0);continue}else He={lane:0,revertLane:ve.revertLane,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null},fe===null?(ee=fe=He,Y=P):fe=fe.next=He,nn.lanes|=Re,ll|=Re;He=ve.action,yc&&E(P,He),P=ve.hasEagerState?ve.eagerState:E(P,He)}else Re={lane:He,revertLane:ve.revertLane,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null},fe===null?(ee=fe=Re,Y=P):fe=fe.next=Re,nn.lanes|=He,ll|=He;ve=ve.next}while(ve!==null&&ve!==f);if(fe===null?Y=P:fe.next=ee,!os(P,d.memoizedState)&&(zr=!0,Pe&&(E=td,E!==null)))throw E;d.memoizedState=P,d.baseState=Y,d.baseQueue=fe,S.lastRenderedState=P}return C===null&&(S.lanes=0),[d.memoizedState,S.dispatch]}function xb(d){var f=Ir(),E=f.queue;if(E===null)throw Error(r(311));E.lastRenderedReducer=d;var S=E.dispatch,C=E.pending,P=f.memoizedState;if(C!==null){E.pending=null;var Y=C=C.next;do P=d(P,Y.action),Y=Y.next;while(Y!==C);os(P,f.memoizedState)||(zr=!0),f.memoizedState=P,f.baseQueue===null&&(f.baseState=P),E.lastRenderedState=P}return[P,S]}function a2(d,f,E){var S=nn,C=Ir(),P=An;if(P){if(E===void 0)throw Error(r(407));E=E()}else E=f();var Y=!os((Un||C).memoizedState,E);Y&&(C.memoizedState=E,zr=!0),C=C.queue;var ee=o2.bind(null,S,C,d);if(Ff(2048,8,ee,[d]),C.getSnapshot!==f||Y||Cr!==null&&Cr.memoizedState.tag&1){if(S.flags|=2048,sd(9,bE(),i2.bind(null,S,C,E,f),null),Jn===null)throw Error(r(349));P||(tl&124)!==0||s2(S,f,E)}return E}function s2(d,f,E){d.flags|=16384,d={getSnapshot:f,value:E},f=nn.updateQueue,f===null?(f=Eb(),nn.updateQueue=f,f.stores=[d]):(E=f.stores,E===null?f.stores=[d]:E.push(d))}function i2(d,f,E,S){f.value=E,f.getSnapshot=S,l2(f)&&c2(d)}function o2(d,f,E){return E(function(){l2(f)&&c2(d)})}function l2(d){var f=d.getSnapshot;d=d.value;try{var E=f();return!os(d,E)}catch(S){return!0}}function c2(d){var f=Ku(d,2);f!==null&&fs(f,d,2)}function Sb(d){var f=Ya();if(typeof d=="function"){var E=d;if(d=E(),yc){Ee(!0);try{E()}finally{Ee(!1)}}}return f.memoizedState=f.baseState=d,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:d},f}function u2(d,f,E,S){return d.baseState=E,yb(d,Un,typeof S=="function"?S:fo)}function Gee(d,f,E,S,C){if(AE(d))throw Error(r(485));if(d=f.action,d!==null){var P={payload:C,action:d,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Y){P.listeners.push(Y)}};j.T!==null?E(!0):P.isTransition=!1,S(P),E=f.pending,E===null?(P.next=f.pending=P,d2(f,P)):(P.next=E.next,f.pending=E.next=P)}}function d2(d,f){var E=f.action,S=f.payload,C=d.state;if(f.isTransition){var P=j.T,Y={};j.T=Y;try{var ee=E(C,S),fe=j.S;fe!==null&&fe(Y,ee),h2(d,f,ee)}catch(ve){bb(d,f,ve)}finally{j.T=P}}else try{P=E(C,S),h2(d,f,P)}catch(ve){bb(d,f,ve)}}function h2(d,f,E){E!==null&&typeof E=="object"&&typeof E.then=="function"?E.then(function(S){f2(d,f,S)},function(S){return bb(d,f,S)}):f2(d,f,E)}function f2(d,f,E){f.status="fulfilled",f.value=E,m2(f),d.state=E,f=d.pending,f!==null&&(E=f.next,E===f?d.pending=null:(E=E.next,f.next=E,d2(d,E)))}function bb(d,f,E){var S=d.pending;if(d.pending=null,S!==null){S=S.next;do f.status="rejected",f.reason=E,m2(f),f=f.next;while(f!==S)}d.action=null}function m2(d){d=d.listeners;for(var f=0;f<d.length;f++)(0,d[f])()}function p2(d,f){return f}function g2(d,f){if(An){var E=Jn.formState;if(E!==null){e:{var S=nn;if(An){if(Tr){t:{for(var C=Tr,P=vi;C.nodeType!==8;){if(!P){C=null;break t}if(C=ri(C.nextSibling),C===null){C=null;break t}}P=C.data,C=P==="F!"||P==="F"?C:null}if(C){Tr=ri(C.nextSibling),S=C.data==="F!";break e}}pc(S)}S=!1}S&&(f=E[0])}}return E=Ya(),E.memoizedState=E.baseState=f,S={pending:null,lanes:0,dispatch:null,lastRenderedReducer:p2,lastRenderedState:f},E.queue=S,E=P2.bind(null,nn,S),S.dispatch=E,S=Sb(!1),P=_b.bind(null,nn,!1,S.queue),S=Ya(),C={state:f,dispatch:null,action:d,pending:null},S.queue=C,E=Gee.bind(null,nn,C,P,E),C.dispatch=E,S.memoizedState=d,[f,E,!1]}function E2(d){var f=Ir();return T2(f,Un,d)}function T2(d,f,E){if(f=yb(d,f,p2)[0],d=SE(fo)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var S=Uf(f)}catch(Y){throw Y===Lf?pE:Y}else S=f;f=Ir();var C=f.queue,P=C.dispatch;return E!==f.memoizedState&&(nn.flags|=2048,sd(9,bE(),zee.bind(null,C,E),null)),[S,P,d]}function zee(d,f){d.action=f}function y2(d){var f=Ir(),E=Un;if(E!==null)return T2(f,E,d);Ir(),f=f.memoizedState,E=Ir();var S=E.queue.dispatch;return E.memoizedState=d,[f,S,!1]}function sd(d,f,E,S){return d={tag:d,create:E,deps:S,inst:f,next:null},f=nn.updateQueue,f===null&&(f=Eb(),nn.updateQueue=f),E=f.lastEffect,E===null?f.lastEffect=d.next=d:(S=E.next,E.next=d,d.next=S,f.lastEffect=d),d}function bE(){return{destroy:void 0,resource:void 0}}function x2(){return Ir().memoizedState}function vE(d,f,E,S){var C=Ya();S=S===void 0?null:S,nn.flags|=d,C.memoizedState=sd(1|f,bE(),E,S)}function Ff(d,f,E,S){var C=Ir();S=S===void 0?null:S;var P=C.memoizedState.inst;Un!==null&&S!==null&&hb(S,Un.memoizedState.deps)?C.memoizedState=sd(f,P,E,S):(nn.flags|=d,C.memoizedState=sd(1|f,P,E,S))}function S2(d,f){vE(8390656,8,d,f)}function b2(d,f){Ff(2048,8,d,f)}function v2(d,f){return Ff(4,2,d,f)}function A2(d,f){return Ff(4,4,d,f)}function R2(d,f){if(typeof f=="function"){d=d();var E=f(d);return function(){typeof E=="function"?E():f(null)}}if(f!=null)return d=d(),f.current=d,function(){f.current=null}}function N2(d,f,E){E=E!=null?E.concat([d]):null,Ff(4,4,R2.bind(null,f,d),E)}function vb(){}function _2(d,f){var E=Ir();f=f===void 0?null:f;var S=E.memoizedState;return f!==null&&hb(f,S[1])?S[0]:(E.memoizedState=[d,f],d)}function w2(d,f){var E=Ir();f=f===void 0?null:f;var S=E.memoizedState;if(f!==null&&hb(f,S[1]))return S[0];if(S=d(),yc){Ee(!0);try{d()}finally{Ee(!1)}}return E.memoizedState=[S,f],S}function Ab(d,f,E){return E===void 0||(tl&1073741824)!==0?d.memoizedState=f:(d.memoizedState=E,d=Ok(),nn.lanes|=d,ll|=d,E)}function C2(d,f,E,S){return os(E,f)?E:nd.current!==null?(d=Ab(d,E,S),os(d,f)||(zr=!0),d):(tl&42)===0?(zr=!0,d.memoizedState=E):(d=Ok(),nn.lanes|=d,ll|=d,f)}function I2(d,f,E,S,C){var P=G.p;G.p=P!==0&&8>P?P:8;var Y=j.T,ee={};j.T=ee,_b(d,!1,f,E);try{var fe=C(),ve=j.S;if(ve!==null&&ve(ee,fe),fe!==null&&typeof fe=="object"&&typeof fe.then=="function"){var Pe=Bee(fe,S);$f(d,f,Pe,hs(d))}else $f(d,f,S,hs(d))}catch(He){$f(d,f,{then:function(){},status:"rejected",reason:He},hs())}finally{G.p=P,j.T=Y}}function qee(){}function Rb(d,f,E,S){if(d.tag!==5)throw Error(r(476));var C=O2(d).queue;I2(d,C,f,K,E===null?qee:function(){return L2(d),E(S)})}function O2(d){var f=d.memoizedState;if(f!==null)return f;f={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:K},next:null};var E={};return f.next={memoizedState:E,baseState:E,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fo,lastRenderedState:E},next:null},d.memoizedState=f,d=d.alternate,d!==null&&(d.memoizedState=f),f}function L2(d){var f=O2(d).next.queue;$f(d,f,{},hs())}function Nb(){return Ta(am)}function M2(){return Ir().memoizedState}function D2(){return Ir().memoizedState}function Yee(d){for(var f=d.return;f!==null;){switch(f.tag){case 24:case 3:var E=hs();d=Zo(E);var S=el(f,d,E);S!==null&&(fs(S,f,E),Df(S,f,E)),f={cache:nb()},d.payload=f;return}f=f.return}}function Wee(d,f,E){var S=hs();E={lane:S,revertLane:0,action:E,hasEagerState:!1,eagerState:null,next:null},AE(d)?k2(f,E):(E=qS(d,f,E,S),E!==null&&(fs(E,d,S),j2(E,f,S)))}function P2(d,f,E){var S=hs();$f(d,f,E,S)}function $f(d,f,E,S){var C={lane:S,revertLane:0,action:E,hasEagerState:!1,eagerState:null,next:null};if(AE(d))k2(f,C);else{var P=d.alternate;if(d.lanes===0&&(P===null||P.lanes===0)&&(P=f.lastRenderedReducer,P!==null))try{var Y=f.lastRenderedState,ee=P(Y,E);if(C.hasEagerState=!0,C.eagerState=ee,os(ee,Y))return oE(d,f,C,0),Jn===null&&iE(),!1}catch(fe){}finally{}if(E=qS(d,f,C,S),E!==null)return fs(E,d,S),j2(E,f,S),!0}return!1}function _b(d,f,E,S){if(S={lane:2,revertLane:sv(),action:S,hasEagerState:!1,eagerState:null,next:null},AE(d)){if(f)throw Error(r(479))}else f=qS(d,E,S,2),f!==null&&fs(f,d,2)}function AE(d){var f=d.alternate;return d===nn||f!==null&&f===nn}function k2(d,f){rd=TE=!0;var E=d.pending;E===null?f.next=f:(f.next=E.next,E.next=f),d.pending=f}function j2(d,f,E){if((E&4194048)!==0){var S=f.lanes;S&=d.pendingLanes,E|=S,f.lanes=E,pt(d,E)}}var RE={readContext:Ta,use:xE,useCallback:Rr,useContext:Rr,useEffect:Rr,useImperativeHandle:Rr,useLayoutEffect:Rr,useInsertionEffect:Rr,useMemo:Rr,useReducer:Rr,useRef:Rr,useState:Rr,useDebugValue:Rr,useDeferredValue:Rr,useTransition:Rr,useSyncExternalStore:Rr,useId:Rr,useHostTransitionStatus:Rr,useFormState:Rr,useActionState:Rr,useOptimistic:Rr,useMemoCache:Rr,useCacheRefresh:Rr},U2={readContext:Ta,use:xE,useCallback:function(d,f){return Ya().memoizedState=[d,f===void 0?null:f],d},useContext:Ta,useEffect:S2,useImperativeHandle:function(d,f,E){E=E!=null?E.concat([d]):null,vE(4194308,4,R2.bind(null,f,d),E)},useLayoutEffect:function(d,f){return vE(4194308,4,d,f)},useInsertionEffect:function(d,f){vE(4,2,d,f)},useMemo:function(d,f){var E=Ya();f=f===void 0?null:f;var S=d();if(yc){Ee(!0);try{d()}finally{Ee(!1)}}return E.memoizedState=[S,f],S},useReducer:function(d,f,E){var S=Ya();if(E!==void 0){var C=E(f);if(yc){Ee(!0);try{E(f)}finally{Ee(!1)}}}else C=f;return S.memoizedState=S.baseState=C,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:C},S.queue=d,d=d.dispatch=Wee.bind(null,nn,d),[S.memoizedState,d]},useRef:function(d){var f=Ya();return d={current:d},f.memoizedState=d},useState:function(d){d=Sb(d);var f=d.queue,E=P2.bind(null,nn,f);return f.dispatch=E,[d.memoizedState,E]},useDebugValue:vb,useDeferredValue:function(d,f){var E=Ya();return Ab(E,d,f)},useTransition:function(){var d=Sb(!1);return d=I2.bind(null,nn,d.queue,!0,!1),Ya().memoizedState=d,[!1,d]},useSyncExternalStore:function(d,f,E){var S=nn,C=Ya();if(An){if(E===void 0)throw Error(r(407));E=E()}else{if(E=f(),Jn===null)throw Error(r(349));(hn&124)!==0||s2(S,f,E)}C.memoizedState=E;var P={value:E,getSnapshot:f};return C.queue=P,S2(o2.bind(null,S,P,d),[d]),S.flags|=2048,sd(9,bE(),i2.bind(null,S,P,E,f),null),E},useId:function(){var d=Ya(),f=Jn.identifierPrefix;if(An){var E=co,S=lo;E=(S&~(1<<32-Le(S)-1)).toString(32)+E,f="«"+f+"R"+E,E=yE++,0<E&&(f+="H"+E.toString(32)),f+="»"}else E=Hee++,f="«"+f+"r"+E.toString(32)+"»";return d.memoizedState=f},useHostTransitionStatus:Nb,useFormState:g2,useActionState:g2,useOptimistic:function(d){var f=Ya();f.memoizedState=f.baseState=d;var E={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=E,f=_b.bind(null,nn,!0,E),E.dispatch=f,[d,f]},useMemoCache:Tb,useCacheRefresh:function(){return Ya().memoizedState=Yee.bind(null,nn)}},F2={readContext:Ta,use:xE,useCallback:_2,useContext:Ta,useEffect:b2,useImperativeHandle:N2,useInsertionEffect:v2,useLayoutEffect:A2,useMemo:w2,useReducer:SE,useRef:x2,useState:function(){return SE(fo)},useDebugValue:vb,useDeferredValue:function(d,f){var E=Ir();return C2(E,Un.memoizedState,d,f)},useTransition:function(){var d=SE(fo)[0],f=Ir().memoizedState;return[typeof d=="boolean"?d:Uf(d),f]},useSyncExternalStore:a2,useId:M2,useHostTransitionStatus:Nb,useFormState:E2,useActionState:E2,useOptimistic:function(d,f){var E=Ir();return u2(E,Un,d,f)},useMemoCache:Tb,useCacheRefresh:D2},Xee={readContext:Ta,use:xE,useCallback:_2,useContext:Ta,useEffect:b2,useImperativeHandle:N2,useInsertionEffect:v2,useLayoutEffect:A2,useMemo:w2,useReducer:xb,useRef:x2,useState:function(){return xb(fo)},useDebugValue:vb,useDeferredValue:function(d,f){var E=Ir();return Un===null?Ab(E,d,f):C2(E,Un.memoizedState,d,f)},useTransition:function(){var d=xb(fo)[0],f=Ir().memoizedState;return[typeof d=="boolean"?d:Uf(d),f]},useSyncExternalStore:a2,useId:M2,useHostTransitionStatus:Nb,useFormState:y2,useActionState:y2,useOptimistic:function(d,f){var E=Ir();return Un!==null?u2(E,Un,d,f):(E.baseState=d,[d,E.queue.dispatch])},useMemoCache:Tb,useCacheRefresh:D2},id=null,Bf=0;function NE(d){var f=Bf;return Bf+=1,id===null&&(id=[]),KP(id,d,f)}function Hf(d,f){f=f.props.ref,d.ref=f!==void 0?f:null}function _E(d,f){throw f.$$typeof===m?Error(r(525)):(d=Object.prototype.toString.call(f),Error(r(31,d==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":d)))}function $2(d){var f=d._init;return f(d._payload)}function B2(d){function f(ye,ge){if(d){var be=ye.deletions;be===null?(ye.deletions=[ge],ye.flags|=16):be.push(ge)}}function E(ye,ge){if(!d)return null;for(;ge!==null;)f(ye,ge),ge=ge.sibling;return null}function S(ye){for(var ge=new Map;ye!==null;)ye.key!==null?ge.set(ye.key,ye):ge.set(ye.index,ye),ye=ye.sibling;return ge}function C(ye,ge){return ye=oo(ye,ge),ye.index=0,ye.sibling=null,ye}function P(ye,ge,be){return ye.index=be,d?(be=ye.alternate,be!==null?(be=be.index,be<ge?(ye.flags|=67108866,ge):be):(ye.flags|=67108866,ge)):(ye.flags|=1048576,ge)}function Y(ye){return d&&ye.alternate===null&&(ye.flags|=67108866),ye}function ee(ye,ge,be,Be){return ge===null||ge.tag!==6?(ge=WS(be,ye.mode,Be),ge.return=ye,ge):(ge=C(ge,be),ge.return=ye,ge)}function fe(ye,ge,be,Be){var gt=be.type;return gt===T?Pe(ye,ge,be.props.children,Be,be.key):ge!==null&&(ge.elementType===gt||typeof gt=="object"&&gt!==null&&gt.$$typeof===D&&$2(gt)===ge.type)?(ge=C(ge,be.props),Hf(ge,be),ge.return=ye,ge):(ge=cE(be.type,be.key,be.props,null,ye.mode,Be),Hf(ge,be),ge.return=ye,ge)}function ve(ye,ge,be,Be){return ge===null||ge.tag!==4||ge.stateNode.containerInfo!==be.containerInfo||ge.stateNode.implementation!==be.implementation?(ge=XS(be,ye.mode,Be),ge.return=ye,ge):(ge=C(ge,be.children||[]),ge.return=ye,ge)}function Pe(ye,ge,be,Be,gt){return ge===null||ge.tag!==7?(ge=dc(be,ye.mode,Be,gt),ge.return=ye,ge):(ge=C(ge,be),ge.return=ye,ge)}function He(ye,ge,be){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return ge=WS(""+ge,ye.mode,be),ge.return=ye,ge;if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case p:return be=cE(ge.type,ge.key,ge.props,null,ye.mode,be),Hf(be,ge),be.return=ye,be;case g:return ge=XS(ge,ye.mode,be),ge.return=ye,ge;case D:var Be=ge._init;return ge=Be(ge._payload),He(ye,ge,be)}if(B(ge)||k(ge))return ge=dc(ge,ye.mode,be,null),ge.return=ye,ge;if(typeof ge.then=="function")return He(ye,NE(ge),be);if(ge.$$typeof===A)return He(ye,fE(ye,ge),be);_E(ye,ge)}return null}function Re(ye,ge,be,Be){var gt=ge!==null?ge.key:null;if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return gt!==null?null:ee(ye,ge,""+be,Be);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case p:return be.key===gt?fe(ye,ge,be,Be):null;case g:return be.key===gt?ve(ye,ge,be,Be):null;case D:return gt=be._init,be=gt(be._payload),Re(ye,ge,be,Be)}if(B(be)||k(be))return gt!==null?null:Pe(ye,ge,be,Be,null);if(typeof be.then=="function")return Re(ye,ge,NE(be),Be);if(be.$$typeof===A)return Re(ye,ge,fE(ye,be),Be);_E(ye,be)}return null}function Ne(ye,ge,be,Be,gt){if(typeof Be=="string"&&Be!==""||typeof Be=="number"||typeof Be=="bigint")return ye=ye.get(be)||null,ee(ge,ye,""+Be,gt);if(typeof Be=="object"&&Be!==null){switch(Be.$$typeof){case p:return ye=ye.get(Be.key===null?be:Be.key)||null,fe(ge,ye,Be,gt);case g:return ye=ye.get(Be.key===null?be:Be.key)||null,ve(ge,ye,Be,gt);case D:var rn=Be._init;return Be=rn(Be._payload),Ne(ye,ge,be,Be,gt)}if(B(Be)||k(Be))return ye=ye.get(be)||null,Pe(ge,ye,Be,gt,null);if(typeof Be.then=="function")return Ne(ye,ge,be,NE(Be),gt);if(Be.$$typeof===A)return Ne(ye,ge,be,fE(ge,Be),gt);_E(ge,Be)}return null}function Ft(ye,ge,be,Be){for(var gt=null,rn=null,St=ge,Mt=ge=0,Yr=null;St!==null&&Mt<be.length;Mt++){St.index>Mt?(Yr=St,St=null):Yr=St.sibling;var En=Re(ye,St,be[Mt],Be);if(En===null){St===null&&(St=Yr);break}d&&St&&En.alternate===null&&f(ye,St),ge=P(En,ge,Mt),rn===null?gt=En:rn.sibling=En,rn=En,St=Yr}if(Mt===be.length)return E(ye,St),An&&fc(ye,Mt),gt;if(St===null){for(;Mt<be.length;Mt++)St=He(ye,be[Mt],Be),St!==null&&(ge=P(St,ge,Mt),rn===null?gt=St:rn.sibling=St,rn=St);return An&&fc(ye,Mt),gt}for(St=S(St);Mt<be.length;Mt++)Yr=Ne(St,ye,Mt,be[Mt],Be),Yr!==null&&(d&&Yr.alternate!==null&&St.delete(Yr.key===null?Mt:Yr.key),ge=P(Yr,ge,Mt),rn===null?gt=Yr:rn.sibling=Yr,rn=Yr);return d&&St.forEach(function(El){return f(ye,El)}),An&&fc(ye,Mt),gt}function Lt(ye,ge,be,Be){if(be==null)throw Error(r(151));for(var gt=null,rn=null,St=ge,Mt=ge=0,Yr=null,En=be.next();St!==null&&!En.done;Mt++,En=be.next()){St.index>Mt?(Yr=St,St=null):Yr=St.sibling;var El=Re(ye,St,En.value,Be);if(El===null){St===null&&(St=Yr);break}d&&St&&El.alternate===null&&f(ye,St),ge=P(El,ge,Mt),rn===null?gt=El:rn.sibling=El,rn=El,St=Yr}if(En.done)return E(ye,St),An&&fc(ye,Mt),gt;if(St===null){for(;!En.done;Mt++,En=be.next())En=He(ye,En.value,Be),En!==null&&(ge=P(En,ge,Mt),rn===null?gt=En:rn.sibling=En,rn=En);return An&&fc(ye,Mt),gt}for(St=S(St);!En.done;Mt++,En=be.next())En=Ne(St,ye,Mt,En.value,Be),En!==null&&(d&&En.alternate!==null&&St.delete(En.key===null?Mt:En.key),ge=P(En,ge,Mt),rn===null?gt=En:rn.sibling=En,rn=En);return d&&St.forEach(function(Kte){return f(ye,Kte)}),An&&fc(ye,Mt),gt}function $n(ye,ge,be,Be){if(typeof be=="object"&&be!==null&&be.type===T&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case p:e:{for(var gt=be.key;ge!==null;){if(ge.key===gt){if(gt=be.type,gt===T){if(ge.tag===7){E(ye,ge.sibling),Be=C(ge,be.props.children),Be.return=ye,ye=Be;break e}}else if(ge.elementType===gt||typeof gt=="object"&&gt!==null&&gt.$$typeof===D&&$2(gt)===ge.type){E(ye,ge.sibling),Be=C(ge,be.props),Hf(Be,be),Be.return=ye,ye=Be;break e}E(ye,ge);break}else f(ye,ge);ge=ge.sibling}be.type===T?(Be=dc(be.props.children,ye.mode,Be,be.key),Be.return=ye,ye=Be):(Be=cE(be.type,be.key,be.props,null,ye.mode,Be),Hf(Be,be),Be.return=ye,ye=Be)}return Y(ye);case g:e:{for(gt=be.key;ge!==null;){if(ge.key===gt)if(ge.tag===4&&ge.stateNode.containerInfo===be.containerInfo&&ge.stateNode.implementation===be.implementation){E(ye,ge.sibling),Be=C(ge,be.children||[]),Be.return=ye,ye=Be;break e}else{E(ye,ge);break}else f(ye,ge);ge=ge.sibling}Be=XS(be,ye.mode,Be),Be.return=ye,ye=Be}return Y(ye);case D:return gt=be._init,be=gt(be._payload),$n(ye,ge,be,Be)}if(B(be))return Ft(ye,ge,be,Be);if(k(be)){if(gt=k(be),typeof gt!="function")throw Error(r(150));return be=gt.call(be),Lt(ye,ge,be,Be)}if(typeof be.then=="function")return $n(ye,ge,NE(be),Be);if(be.$$typeof===A)return $n(ye,ge,fE(ye,be),Be);_E(ye,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,ge!==null&&ge.tag===6?(E(ye,ge.sibling),Be=C(ge,be),Be.return=ye,ye=Be):(E(ye,ge),Be=WS(be,ye.mode,Be),Be.return=ye,ye=Be),Y(ye)):E(ye,ge)}return function(ye,ge,be,Be){try{Bf=0;var gt=$n(ye,ge,be,Be);return id=null,gt}catch(St){if(St===Lf||St===pE)throw St;var rn=ls(29,St,null,ye.mode);return rn.lanes=Be,rn.return=ye,rn}finally{}}}var od=B2(!0),H2=B2(!1),Is=X(null),Ai=null;function nl(d){var f=d.alternate;V($r,$r.current&1),V(Is,d),Ai===null&&(f===null||nd.current!==null||f.memoizedState!==null)&&(Ai=d)}function V2(d){if(d.tag===22){if(V($r,$r.current),V(Is,d),Ai===null){var f=d.alternate;f!==null&&f.memoizedState!==null&&(Ai=d)}}else rl()}function rl(){V($r,$r.current),V(Is,Is.current)}function mo(d){Z(Is),Ai===d&&(Ai=null),Z($r)}var $r=X(0);function wE(d){for(var f=d;f!==null;){if(f.tag===13){var E=f.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||E.data==="$?"||Ev(E)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break;for(;f.sibling===null;){if(f.return===null||f.return===d)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}function wb(d,f,E,S){f=d.memoizedState,E=E(S,f),E=E==null?f:h({},f,E),d.memoizedState=E,d.lanes===0&&(d.updateQueue.baseState=E)}var Cb={enqueueSetState:function(d,f,E){d=d._reactInternals;var S=hs(),C=Zo(S);C.payload=f,E!=null&&(C.callback=E),f=el(d,C,S),f!==null&&(fs(f,d,S),Df(f,d,S))},enqueueReplaceState:function(d,f,E){d=d._reactInternals;var S=hs(),C=Zo(S);C.tag=1,C.payload=f,E!=null&&(C.callback=E),f=el(d,C,S),f!==null&&(fs(f,d,S),Df(f,d,S))},enqueueForceUpdate:function(d,f){d=d._reactInternals;var E=hs(),S=Zo(E);S.tag=2,f!=null&&(S.callback=f),f=el(d,S,E),f!==null&&(fs(f,d,E),Df(f,d,E))}};function G2(d,f,E,S,C,P,Y){return d=d.stateNode,typeof d.shouldComponentUpdate=="function"?d.shouldComponentUpdate(S,P,Y):f.prototype&&f.prototype.isPureReactComponent?!Af(E,S)||!Af(C,P):!0}function z2(d,f,E,S){d=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(E,S),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(E,S),f.state!==d&&Cb.enqueueReplaceState(f,f.state,null)}function xc(d,f){var E=f;if("ref"in f){E={};for(var S in f)S!=="ref"&&(E[S]=f[S])}if(d=d.defaultProps){E===f&&(E=h({},E));for(var C in d)E[C]===void 0&&(E[C]=d[C])}return E}var CE=typeof reportError=="function"?reportError:function(d){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof d=="object"&&d!==null&&typeof d.message=="string"?String(d.message):String(d),error:d});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",d);return}};function q2(d){CE(d)}function Y2(d){}function W2(d){CE(d)}function IE(d,f){try{var E=d.onUncaughtError;E(f.value,{componentStack:f.stack})}catch(S){setTimeout(function(){throw S})}}function X2(d,f,E){try{var S=d.onCaughtError;S(E.value,{componentStack:E.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(C){setTimeout(function(){throw C})}}function Ib(d,f,E){return E=Zo(E),E.tag=3,E.payload={element:null},E.callback=function(){IE(d,f)},E}function K2(d){return d=Zo(d),d.tag=3,d}function Q2(d,f,E,S){var C=E.type.getDerivedStateFromError;if(typeof C=="function"){var P=S.value;d.payload=function(){return C(P)},d.callback=function(){X2(f,E,S)}}var Y=E.stateNode;Y!==null&&typeof Y.componentDidCatch=="function"&&(d.callback=function(){X2(f,E,S),typeof C!="function"&&(cl===null?cl=new Set([this]):cl.add(this));var ee=S.stack;this.componentDidCatch(S.value,{componentStack:ee!==null?ee:""})})}function Kee(d,f,E,S,C){if(E.flags|=32768,S!==null&&typeof S=="object"&&typeof S.then=="function"){if(f=E.alternate,f!==null&&Cf(f,E,C,!0),E=Is.current,E!==null){switch(E.tag){case 13:return Ai===null?ev():E.alternate===null&&yr===0&&(yr=3),E.flags&=-257,E.flags|=65536,E.lanes=C,S===sb?E.flags|=16384:(f=E.updateQueue,f===null?E.updateQueue=new Set([S]):f.add(S),nv(d,S,C)),!1;case 22:return E.flags|=65536,S===sb?E.flags|=16384:(f=E.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([S])},E.updateQueue=f):(E=f.retryQueue,E===null?f.retryQueue=new Set([S]):E.add(S)),nv(d,S,C)),!1}throw Error(r(435,E.tag))}return nv(d,S,C),ev(),!1}if(An)return f=Is.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=C,S!==JS&&(d=Error(r(422),{cause:S}),wf(Ns(d,E)))):(S!==JS&&(f=Error(r(423),{cause:S}),wf(Ns(f,E))),d=d.current.alternate,d.flags|=65536,C&=-C,d.lanes|=C,S=Ns(S,E),C=Ib(d.stateNode,S,C),lb(d,C),yr!==4&&(yr=2)),!1;var P=Error(r(520),{cause:S});if(P=Ns(P,E),Xf===null?Xf=[P]:Xf.push(P),yr!==4&&(yr=2),f===null)return!0;S=Ns(S,E),E=f;do{switch(E.tag){case 3:return E.flags|=65536,d=C&-C,E.lanes|=d,d=Ib(E.stateNode,S,d),lb(E,d),!1;case 1:if(f=E.type,P=E.stateNode,(E.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||P!==null&&typeof P.componentDidCatch=="function"&&(cl===null||!cl.has(P))))return E.flags|=65536,C&=-C,E.lanes|=C,C=K2(C),Q2(C,d,E,S),lb(E,C),!1}E=E.return}while(E!==null);return!1}var J2=Error(r(461)),zr=!1;function ia(d,f,E,S){f.child=d===null?H2(f,null,E,S):od(f,d.child,E,S)}function Z2(d,f,E,S,C){E=E.render;var P=f.ref;if("ref"in S){var Y={};for(var ee in S)ee!=="ref"&&(Y[ee]=S[ee])}else Y=S;return Ec(f),S=fb(d,f,E,Y,P,C),ee=mb(),d!==null&&!zr?(pb(d,f,C),po(d,f,C)):(An&&ee&&KS(f),f.flags|=1,ia(d,f,S,C),f.child)}function ek(d,f,E,S,C){if(d===null){var P=E.type;return typeof P=="function"&&!YS(P)&&P.defaultProps===void 0&&E.compare===null?(f.tag=15,f.type=P,tk(d,f,P,S,C)):(d=cE(E.type,null,S,f,f.mode,C),d.ref=f.ref,d.return=f,f.child=d)}if(P=d.child,!Ub(d,C)){var Y=P.memoizedProps;if(E=E.compare,E=E!==null?E:Af,E(Y,S)&&d.ref===f.ref)return po(d,f,C)}return f.flags|=1,d=oo(P,S),d.ref=f.ref,d.return=f,f.child=d}function tk(d,f,E,S,C){if(d!==null){var P=d.memoizedProps;if(Af(P,S)&&d.ref===f.ref)if(zr=!1,f.pendingProps=S=P,Ub(d,C))(d.flags&131072)!==0&&(zr=!0);else return f.lanes=d.lanes,po(d,f,C)}return Ob(d,f,E,S,C)}function nk(d,f,E){var S=f.pendingProps,C=S.children,P=d!==null?d.memoizedState:null;if(S.mode==="hidden"){if((f.flags&128)!==0){if(S=P!==null?P.baseLanes|E:E,d!==null){for(C=f.child=d.child,P=0;C!==null;)P=P|C.lanes|C.childLanes,C=C.sibling;f.childLanes=P&~S}else f.childLanes=0,f.child=null;return rk(d,f,S,E)}if((E&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},d!==null&&mE(f,P!==null?P.cachePool:null),P!==null?t2(f,P):ub(),V2(f);else return f.lanes=f.childLanes=536870912,rk(d,f,P!==null?P.baseLanes|E:E,E)}else P!==null?(mE(f,P.cachePool),t2(f,P),rl(),f.memoizedState=null):(d!==null&&mE(f,null),ub(),rl());return ia(d,f,C,E),f.child}function rk(d,f,E,S){var C=ab();return C=C===null?null:{parent:Fr._currentValue,pool:C},f.memoizedState={baseLanes:E,cachePool:C},d!==null&&mE(f,null),ub(),V2(f),d!==null&&Cf(d,f,S,!0),null}function OE(d,f){var E=f.ref;if(E===null)d!==null&&d.ref!==null&&(f.flags|=4194816);else{if(typeof E!="function"&&typeof E!="object")throw Error(r(284));(d===null||d.ref!==E)&&(f.flags|=4194816)}}function Ob(d,f,E,S,C){return Ec(f),E=fb(d,f,E,S,void 0,C),S=mb(),d!==null&&!zr?(pb(d,f,C),po(d,f,C)):(An&&S&&KS(f),f.flags|=1,ia(d,f,E,C),f.child)}function ak(d,f,E,S,C,P){return Ec(f),f.updateQueue=null,E=r2(f,S,E,C),n2(d),S=mb(),d!==null&&!zr?(pb(d,f,P),po(d,f,P)):(An&&S&&KS(f),f.flags|=1,ia(d,f,E,P),f.child)}function sk(d,f,E,S,C){if(Ec(f),f.stateNode===null){var P=Qu,Y=E.contextType;typeof Y=="object"&&Y!==null&&(P=Ta(Y)),P=new E(S,P),f.memoizedState=P.state!==null&&P.state!==void 0?P.state:null,P.updater=Cb,f.stateNode=P,P._reactInternals=f,P=f.stateNode,P.props=S,P.state=f.memoizedState,P.refs={},ib(f),Y=E.contextType,P.context=typeof Y=="object"&&Y!==null?Ta(Y):Qu,P.state=f.memoizedState,Y=E.getDerivedStateFromProps,typeof Y=="function"&&(wb(f,E,Y,S),P.state=f.memoizedState),typeof E.getDerivedStateFromProps=="function"||typeof P.getSnapshotBeforeUpdate=="function"||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(Y=P.state,typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount(),Y!==P.state&&Cb.enqueueReplaceState(P,P.state,null),kf(f,S,P,C),Pf(),P.state=f.memoizedState),typeof P.componentDidMount=="function"&&(f.flags|=4194308),S=!0}else if(d===null){P=f.stateNode;var ee=f.memoizedProps,fe=xc(E,ee);P.props=fe;var ve=P.context,Pe=E.contextType;Y=Qu,typeof Pe=="object"&&Pe!==null&&(Y=Ta(Pe));var He=E.getDerivedStateFromProps;Pe=typeof He=="function"||typeof P.getSnapshotBeforeUpdate=="function",ee=f.pendingProps!==ee,Pe||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(ee||ve!==Y)&&z2(f,P,S,Y),Jo=!1;var Re=f.memoizedState;P.state=Re,kf(f,S,P,C),Pf(),ve=f.memoizedState,ee||Re!==ve||Jo?(typeof He=="function"&&(wb(f,E,He,S),ve=f.memoizedState),(fe=Jo||G2(f,E,fe,S,Re,ve,Y))?(Pe||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount()),typeof P.componentDidMount=="function"&&(f.flags|=4194308)):(typeof P.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=S,f.memoizedState=ve),P.props=S,P.state=ve,P.context=Y,S=fe):(typeof P.componentDidMount=="function"&&(f.flags|=4194308),S=!1)}else{P=f.stateNode,ob(d,f),Y=f.memoizedProps,Pe=xc(E,Y),P.props=Pe,He=f.pendingProps,Re=P.context,ve=E.contextType,fe=Qu,typeof ve=="object"&&ve!==null&&(fe=Ta(ve)),ee=E.getDerivedStateFromProps,(ve=typeof ee=="function"||typeof P.getSnapshotBeforeUpdate=="function")||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(Y!==He||Re!==fe)&&z2(f,P,S,fe),Jo=!1,Re=f.memoizedState,P.state=Re,kf(f,S,P,C),Pf();var Ne=f.memoizedState;Y!==He||Re!==Ne||Jo||d!==null&&d.dependencies!==null&&hE(d.dependencies)?(typeof ee=="function"&&(wb(f,E,ee,S),Ne=f.memoizedState),(Pe=Jo||G2(f,E,Pe,S,Re,Ne,fe)||d!==null&&d.dependencies!==null&&hE(d.dependencies))?(ve||typeof P.UNSAFE_componentWillUpdate!="function"&&typeof P.componentWillUpdate!="function"||(typeof P.componentWillUpdate=="function"&&P.componentWillUpdate(S,Ne,fe),typeof P.UNSAFE_componentWillUpdate=="function"&&P.UNSAFE_componentWillUpdate(S,Ne,fe)),typeof P.componentDidUpdate=="function"&&(f.flags|=4),typeof P.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof P.componentDidUpdate!="function"||Y===d.memoizedProps&&Re===d.memoizedState||(f.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||Y===d.memoizedProps&&Re===d.memoizedState||(f.flags|=1024),f.memoizedProps=S,f.memoizedState=Ne),P.props=S,P.state=Ne,P.context=fe,S=Pe):(typeof P.componentDidUpdate!="function"||Y===d.memoizedProps&&Re===d.memoizedState||(f.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||Y===d.memoizedProps&&Re===d.memoizedState||(f.flags|=1024),S=!1)}return P=S,OE(d,f),S=(f.flags&128)!==0,P||S?(P=f.stateNode,E=S&&typeof E.getDerivedStateFromError!="function"?null:P.render(),f.flags|=1,d!==null&&S?(f.child=od(f,d.child,null,C),f.child=od(f,null,E,C)):ia(d,f,E,C),f.memoizedState=P.state,d=f.child):d=po(d,f,C),d}function ik(d,f,E,S){return _f(),f.flags|=256,ia(d,f,E,S),f.child}var Lb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mb(d){return{baseLanes:d,cachePool:YP()}}function Db(d,f,E){return d=d!==null?d.childLanes&~E:0,f&&(d|=Os),d}function ok(d,f,E){var S=f.pendingProps,C=!1,P=(f.flags&128)!==0,Y;if((Y=P)||(Y=d!==null&&d.memoizedState===null?!1:($r.current&2)!==0),Y&&(C=!0,f.flags&=-129),Y=(f.flags&32)!==0,f.flags&=-33,d===null){if(An){if(C?nl(f):rl(),An){var ee=Tr,fe;if(fe=ee){e:{for(fe=ee,ee=vi;fe.nodeType!==8;){if(!ee){ee=null;break e}if(fe=ri(fe.nextSibling),fe===null){ee=null;break e}}ee=fe}ee!==null?(f.memoizedState={dehydrated:ee,treeContext:hc!==null?{id:lo,overflow:co}:null,retryLane:536870912,hydrationErrors:null},fe=ls(18,null,null,0),fe.stateNode=ee,fe.return=f,f.child=fe,Fa=f,Tr=null,fe=!0):fe=!1}fe||pc(f)}if(ee=f.memoizedState,ee!==null&&(ee=ee.dehydrated,ee!==null))return Ev(ee)?f.lanes=32:f.lanes=536870912,null;mo(f)}return ee=S.children,S=S.fallback,C?(rl(),C=f.mode,ee=LE({mode:"hidden",children:ee},C),S=dc(S,C,E,null),ee.return=f,S.return=f,ee.sibling=S,f.child=ee,C=f.child,C.memoizedState=Mb(E),C.childLanes=Db(d,Y,E),f.memoizedState=Lb,S):(nl(f),Pb(f,ee))}if(fe=d.memoizedState,fe!==null&&(ee=fe.dehydrated,ee!==null)){if(P)f.flags&256?(nl(f),f.flags&=-257,f=kb(d,f,E)):f.memoizedState!==null?(rl(),f.child=d.child,f.flags|=128,f=null):(rl(),C=S.fallback,ee=f.mode,S=LE({mode:"visible",children:S.children},ee),C=dc(C,ee,E,null),C.flags|=2,S.return=f,C.return=f,S.sibling=C,f.child=S,od(f,d.child,null,E),S=f.child,S.memoizedState=Mb(E),S.childLanes=Db(d,Y,E),f.memoizedState=Lb,f=C);else if(nl(f),Ev(ee)){if(Y=ee.nextSibling&&ee.nextSibling.dataset,Y)var ve=Y.dgst;Y=ve,S=Error(r(419)),S.stack="",S.digest=Y,wf({value:S,source:null,stack:null}),f=kb(d,f,E)}else if(zr||Cf(d,f,E,!1),Y=(E&d.childLanes)!==0,zr||Y){if(Y=Jn,Y!==null&&(S=E&-E,S=(S&42)!==0?1:Bt(S),S=(S&(Y.suspendedLanes|E))!==0?0:S,S!==0&&S!==fe.retryLane))throw fe.retryLane=S,Ku(d,S),fs(Y,d,S),J2;ee.data==="$?"||ev(),f=kb(d,f,E)}else ee.data==="$?"?(f.flags|=192,f.child=d.child,f=null):(d=fe.treeContext,Tr=ri(ee.nextSibling),Fa=f,An=!0,mc=null,vi=!1,d!==null&&(ws[Cs++]=lo,ws[Cs++]=co,ws[Cs++]=hc,lo=d.id,co=d.overflow,hc=f),f=Pb(f,S.children),f.flags|=4096);return f}return C?(rl(),C=S.fallback,ee=f.mode,fe=d.child,ve=fe.sibling,S=oo(fe,{mode:"hidden",children:S.children}),S.subtreeFlags=fe.subtreeFlags&65011712,ve!==null?C=oo(ve,C):(C=dc(C,ee,E,null),C.flags|=2),C.return=f,S.return=f,S.sibling=C,f.child=S,S=C,C=f.child,ee=d.child.memoizedState,ee===null?ee=Mb(E):(fe=ee.cachePool,fe!==null?(ve=Fr._currentValue,fe=fe.parent!==ve?{parent:ve,pool:ve}:fe):fe=YP(),ee={baseLanes:ee.baseLanes|E,cachePool:fe}),C.memoizedState=ee,C.childLanes=Db(d,Y,E),f.memoizedState=Lb,S):(nl(f),E=d.child,d=E.sibling,E=oo(E,{mode:"visible",children:S.children}),E.return=f,E.sibling=null,d!==null&&(Y=f.deletions,Y===null?(f.deletions=[d],f.flags|=16):Y.push(d)),f.child=E,f.memoizedState=null,E)}function Pb(d,f){return f=LE({mode:"visible",children:f},d.mode),f.return=d,d.child=f}function LE(d,f){return d=ls(22,d,null,f),d.lanes=0,d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},d}function kb(d,f,E){return od(f,d.child,null,E),d=Pb(f,f.pendingProps.children),d.flags|=2,f.memoizedState=null,d}function lk(d,f,E){d.lanes|=f;var S=d.alternate;S!==null&&(S.lanes|=f),eb(d.return,f,E)}function jb(d,f,E,S,C){var P=d.memoizedState;P===null?d.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:S,tail:E,tailMode:C}:(P.isBackwards=f,P.rendering=null,P.renderingStartTime=0,P.last=S,P.tail=E,P.tailMode=C)}function ck(d,f,E){var S=f.pendingProps,C=S.revealOrder,P=S.tail;if(ia(d,f,S.children,E),S=$r.current,(S&2)!==0)S=S&1|2,f.flags|=128;else{if(d!==null&&(d.flags&128)!==0)e:for(d=f.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&lk(d,E,f);else if(d.tag===19)lk(d,E,f);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break e;for(;d.sibling===null;){if(d.return===null||d.return===f)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}S&=1}switch(V($r,S),C){case"forwards":for(E=f.child,C=null;E!==null;)d=E.alternate,d!==null&&wE(d)===null&&(C=E),E=E.sibling;E=C,E===null?(C=f.child,f.child=null):(C=E.sibling,E.sibling=null),jb(f,!1,C,E,P);break;case"backwards":for(E=null,C=f.child,f.child=null;C!==null;){if(d=C.alternate,d!==null&&wE(d)===null){f.child=C;break}d=C.sibling,C.sibling=E,E=C,C=d}jb(f,!0,E,null,P);break;case"together":jb(f,!1,null,null,void 0);break;default:f.memoizedState=null}return f.child}function po(d,f,E){if(d!==null&&(f.dependencies=d.dependencies),ll|=f.lanes,(E&f.childLanes)===0)if(d!==null){if(Cf(d,f,E,!1),(E&f.childLanes)===0)return null}else return null;if(d!==null&&f.child!==d.child)throw Error(r(153));if(f.child!==null){for(d=f.child,E=oo(d,d.pendingProps),f.child=E,E.return=f;d.sibling!==null;)d=d.sibling,E=E.sibling=oo(d,d.pendingProps),E.return=f;E.sibling=null}return f.child}function Ub(d,f){return(d.lanes&f)!==0?!0:(d=d.dependencies,!!(d!==null&&hE(d)))}function Qee(d,f,E){switch(f.tag){case 3:ie(f,f.stateNode.containerInfo),Qo(f,Fr,d.memoizedState.cache),_f();break;case 27:case 5:Q(f);break;case 4:ie(f,f.stateNode.containerInfo);break;case 10:Qo(f,f.type,f.memoizedProps.value);break;case 13:var S=f.memoizedState;if(S!==null)return S.dehydrated!==null?(nl(f),f.flags|=128,null):(E&f.child.childLanes)!==0?ok(d,f,E):(nl(f),d=po(d,f,E),d!==null?d.sibling:null);nl(f);break;case 19:var C=(d.flags&128)!==0;if(S=(E&f.childLanes)!==0,S||(Cf(d,f,E,!1),S=(E&f.childLanes)!==0),C){if(S)return ck(d,f,E);f.flags|=128}if(C=f.memoizedState,C!==null&&(C.rendering=null,C.tail=null,C.lastEffect=null),V($r,$r.current),S)break;return null;case 22:case 23:return f.lanes=0,nk(d,f,E);case 24:Qo(f,Fr,d.memoizedState.cache)}return po(d,f,E)}function uk(d,f,E){if(d!==null)if(d.memoizedProps!==f.pendingProps)zr=!0;else{if(!Ub(d,E)&&(f.flags&128)===0)return zr=!1,Qee(d,f,E);zr=(d.flags&131072)!==0}else zr=!1,An&&(f.flags&1048576)!==0&&$P(f,dE,f.index);switch(f.lanes=0,f.tag){case 16:e:{d=f.pendingProps;var S=f.elementType,C=S._init;if(S=C(S._payload),f.type=S,typeof S=="function")YS(S)?(d=xc(S,d),f.tag=1,f=sk(null,f,S,d,E)):(f.tag=0,f=Ob(null,f,S,d,E));else{if(S!=null){if(C=S.$$typeof,C===w){f.tag=11,f=Z2(null,f,S,d,E);break e}else if(C===I){f.tag=14,f=ek(null,f,S,d,E);break e}}throw f=U(S)||S,Error(r(306,f,""))}}return f;case 0:return Ob(d,f,f.type,f.pendingProps,E);case 1:return S=f.type,C=xc(S,f.pendingProps),sk(d,f,S,C,E);case 3:e:{if(ie(f,f.stateNode.containerInfo),d===null)throw Error(r(387));S=f.pendingProps;var P=f.memoizedState;C=P.element,ob(d,f),kf(f,S,null,E);var Y=f.memoizedState;if(S=Y.cache,Qo(f,Fr,S),S!==P.cache&&tb(f,[Fr],E,!0),Pf(),S=Y.element,P.isDehydrated)if(P={element:S,isDehydrated:!1,cache:Y.cache},f.updateQueue.baseState=P,f.memoizedState=P,f.flags&256){f=ik(d,f,S,E);break e}else if(S!==C){C=Ns(Error(r(424)),f),wf(C),f=ik(d,f,S,E);break e}else{switch(d=f.stateNode.containerInfo,d.nodeType){case 9:d=d.body;break;default:d=d.nodeName==="HTML"?d.ownerDocument.body:d}for(Tr=ri(d.firstChild),Fa=f,An=!0,mc=null,vi=!0,E=H2(f,null,S,E),f.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling}else{if(_f(),S===C){f=po(d,f,E);break e}ia(d,f,S,E)}f=f.child}return f;case 26:return OE(d,f),d===null?(E=mj(f.type,null,f.pendingProps,null))?f.memoizedState=E:An||(E=f.type,d=f.pendingProps,S=qE(ne.current).createElement(E),S[yt]=f,S[Yt]=d,la(S,E,d),Wt(S),f.stateNode=S):f.memoizedState=mj(f.type,d.memoizedProps,f.pendingProps,d.memoizedState),null;case 27:return Q(f),d===null&&An&&(S=f.stateNode=dj(f.type,f.pendingProps,ne.current),Fa=f,vi=!0,C=Tr,hl(f.type)?(Tv=C,Tr=ri(S.firstChild)):Tr=C),ia(d,f,f.pendingProps.children,E),OE(d,f),d===null&&(f.flags|=4194304),f.child;case 5:return d===null&&An&&((C=S=Tr)&&(S=Rte(S,f.type,f.pendingProps,vi),S!==null?(f.stateNode=S,Fa=f,Tr=ri(S.firstChild),vi=!1,C=!0):C=!1),C||pc(f)),Q(f),C=f.type,P=f.pendingProps,Y=d!==null?d.memoizedProps:null,S=P.children,mv(C,P)?S=null:Y!==null&&mv(C,Y)&&(f.flags|=32),f.memoizedState!==null&&(C=fb(d,f,Vee,null,null,E),am._currentValue=C),OE(d,f),ia(d,f,S,E),f.child;case 6:return d===null&&An&&((d=E=Tr)&&(E=Nte(E,f.pendingProps,vi),E!==null?(f.stateNode=E,Fa=f,Tr=null,d=!0):d=!1),d||pc(f)),null;case 13:return ok(d,f,E);case 4:return ie(f,f.stateNode.containerInfo),S=f.pendingProps,d===null?f.child=od(f,null,S,E):ia(d,f,S,E),f.child;case 11:return Z2(d,f,f.type,f.pendingProps,E);case 7:return ia(d,f,f.pendingProps,E),f.child;case 8:return ia(d,f,f.pendingProps.children,E),f.child;case 12:return ia(d,f,f.pendingProps.children,E),f.child;case 10:return S=f.pendingProps,Qo(f,f.type,S.value),ia(d,f,S.children,E),f.child;case 9:return C=f.type._context,S=f.pendingProps.children,Ec(f),C=Ta(C),S=S(C),f.flags|=1,ia(d,f,S,E),f.child;case 14:return ek(d,f,f.type,f.pendingProps,E);case 15:return tk(d,f,f.type,f.pendingProps,E);case 19:return ck(d,f,E);case 31:return S=f.pendingProps,E=f.mode,S={mode:S.mode,children:S.children},d===null?(E=LE(S,E),E.ref=f.ref,f.child=E,E.return=f,f=E):(E=oo(d.child,S),E.ref=f.ref,f.child=E,E.return=f,f=E),f;case 22:return nk(d,f,E);case 24:return Ec(f),S=Ta(Fr),d===null?(C=ab(),C===null&&(C=Jn,P=nb(),C.pooledCache=P,P.refCount++,P!==null&&(C.pooledCacheLanes|=E),C=P),f.memoizedState={parent:S,cache:C},ib(f),Qo(f,Fr,C)):((d.lanes&E)!==0&&(ob(d,f),kf(f,null,null,E),Pf()),C=d.memoizedState,P=f.memoizedState,C.parent!==S?(C={parent:S,cache:S},f.memoizedState=C,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=C),Qo(f,Fr,S)):(S=P.cache,Qo(f,Fr,S),S!==C.cache&&tb(f,[Fr],E,!0))),ia(d,f,f.pendingProps.children,E),f.child;case 29:throw f.pendingProps}throw Error(r(156,f.tag))}function go(d){d.flags|=4}function dk(d,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)d.flags&=-16777217;else if(d.flags|=16777216,!yj(f)){if(f=Is.current,f!==null&&((hn&4194048)===hn?Ai!==null:(hn&62914560)!==hn&&(hn&536870912)===0||f!==Ai))throw Mf=sb,WP;d.flags|=8192}}function ME(d,f){f!==null&&(d.flags|=4),d.flags&16384&&(f=d.tag!==22?Ke():536870912,d.lanes|=f,dd|=f)}function Vf(d,f){if(!An)switch(d.tailMode){case"hidden":f=d.tail;for(var E=null;f!==null;)f.alternate!==null&&(E=f),f=f.sibling;E===null?d.tail=null:E.sibling=null;break;case"collapsed":E=d.tail;for(var S=null;E!==null;)E.alternate!==null&&(S=E),E=E.sibling;S===null?f||d.tail===null?d.tail=null:d.tail.sibling=null:S.sibling=null}}function fr(d){var f=d.alternate!==null&&d.alternate.child===d.child,E=0,S=0;if(f)for(var C=d.child;C!==null;)E|=C.lanes|C.childLanes,S|=C.subtreeFlags&65011712,S|=C.flags&65011712,C.return=d,C=C.sibling;else for(C=d.child;C!==null;)E|=C.lanes|C.childLanes,S|=C.subtreeFlags,S|=C.flags,C.return=d,C=C.sibling;return d.subtreeFlags|=S,d.childLanes=E,f}function Jee(d,f,E){var S=f.pendingProps;switch(QS(f),f.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fr(f),null;case 1:return fr(f),null;case 3:return E=f.stateNode,S=null,d!==null&&(S=d.memoizedState.cache),f.memoizedState.cache!==S&&(f.flags|=2048),ho(Fr),W(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(d===null||d.child===null)&&(Nf(f)?go(f):d===null||d.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,VP())),fr(f),null;case 26:return E=f.memoizedState,d===null?(go(f),E!==null?(fr(f),dk(f,E)):(fr(f),f.flags&=-16777217)):E?E!==d.memoizedState?(go(f),fr(f),dk(f,E)):(fr(f),f.flags&=-16777217):(d.memoizedProps!==S&&go(f),fr(f),f.flags&=-16777217),null;case 27:se(f),E=ne.current;var C=f.type;if(d!==null&&f.stateNode!=null)d.memoizedProps!==S&&go(f);else{if(!S){if(f.stateNode===null)throw Error(r(166));return fr(f),null}d=te.current,Nf(f)?BP(f):(d=dj(C,S,E),f.stateNode=d,go(f))}return fr(f),null;case 5:if(se(f),E=f.type,d!==null&&f.stateNode!=null)d.memoizedProps!==S&&go(f);else{if(!S){if(f.stateNode===null)throw Error(r(166));return fr(f),null}if(d=te.current,Nf(f))BP(f);else{switch(C=qE(ne.current),d){case 1:d=C.createElementNS("http://www.w3.org/2000/svg",E);break;case 2:d=C.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;default:switch(E){case"svg":d=C.createElementNS("http://www.w3.org/2000/svg",E);break;case"math":d=C.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;case"script":d=C.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof S.is=="string"?C.createElement("select",{is:S.is}):C.createElement("select"),S.multiple?d.multiple=!0:S.size&&(d.size=S.size);break;default:d=typeof S.is=="string"?C.createElement(E,{is:S.is}):C.createElement(E)}}d[yt]=f,d[Yt]=S;e:for(C=f.child;C!==null;){if(C.tag===5||C.tag===6)d.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===f)break e;for(;C.sibling===null;){if(C.return===null||C.return===f)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}f.stateNode=d;e:switch(la(d,E,S),E){case"button":case"input":case"select":case"textarea":d=!!S.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&go(f)}}return fr(f),f.flags&=-16777217,null;case 6:if(d&&f.stateNode!=null)d.memoizedProps!==S&&go(f);else{if(typeof S!="string"&&f.stateNode===null)throw Error(r(166));if(d=ne.current,Nf(f)){if(d=f.stateNode,E=f.memoizedProps,S=null,C=Fa,C!==null)switch(C.tag){case 27:case 5:S=C.memoizedProps}d[yt]=f,d=!!(d.nodeValue===E||S!==null&&S.suppressHydrationWarning===!0||aj(d.nodeValue,E)),d||pc(f)}else d=qE(d).createTextNode(S),d[yt]=f,f.stateNode=d}return fr(f),null;case 13:if(S=f.memoizedState,d===null||d.memoizedState!==null&&d.memoizedState.dehydrated!==null){if(C=Nf(f),S!==null&&S.dehydrated!==null){if(d===null){if(!C)throw Error(r(318));if(C=f.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(r(317));C[yt]=f}else _f(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;fr(f),C=!1}else C=VP(),d!==null&&d.memoizedState!==null&&(d.memoizedState.hydrationErrors=C),C=!0;if(!C)return f.flags&256?(mo(f),f):(mo(f),null)}if(mo(f),(f.flags&128)!==0)return f.lanes=E,f;if(E=S!==null,d=d!==null&&d.memoizedState!==null,E){S=f.child,C=null,S.alternate!==null&&S.alternate.memoizedState!==null&&S.alternate.memoizedState.cachePool!==null&&(C=S.alternate.memoizedState.cachePool.pool);var P=null;S.memoizedState!==null&&S.memoizedState.cachePool!==null&&(P=S.memoizedState.cachePool.pool),P!==C&&(S.flags|=2048)}return E!==d&&E&&(f.child.flags|=8192),ME(f,f.updateQueue),fr(f),null;case 4:return W(),d===null&&cv(f.stateNode.containerInfo),fr(f),null;case 10:return ho(f.type),fr(f),null;case 19:if(Z($r),C=f.memoizedState,C===null)return fr(f),null;if(S=(f.flags&128)!==0,P=C.rendering,P===null)if(S)Vf(C,!1);else{if(yr!==0||d!==null&&(d.flags&128)!==0)for(d=f.child;d!==null;){if(P=wE(d),P!==null){for(f.flags|=128,Vf(C,!1),d=P.updateQueue,f.updateQueue=d,ME(f,d),f.subtreeFlags=0,d=E,E=f.child;E!==null;)FP(E,d),E=E.sibling;return V($r,$r.current&1|2),f.child}d=d.sibling}C.tail!==null&&re()>kE&&(f.flags|=128,S=!0,Vf(C,!1),f.lanes=4194304)}else{if(!S)if(d=wE(P),d!==null){if(f.flags|=128,S=!0,d=d.updateQueue,f.updateQueue=d,ME(f,d),Vf(C,!0),C.tail===null&&C.tailMode==="hidden"&&!P.alternate&&!An)return fr(f),null}else 2*re()-C.renderingStartTime>kE&&E!==536870912&&(f.flags|=128,S=!0,Vf(C,!1),f.lanes=4194304);C.isBackwards?(P.sibling=f.child,f.child=P):(d=C.last,d!==null?d.sibling=P:f.child=P,C.last=P)}return C.tail!==null?(f=C.tail,C.rendering=f,C.tail=f.sibling,C.renderingStartTime=re(),f.sibling=null,d=$r.current,V($r,S?d&1|2:d&1),f):(fr(f),null);case 22:case 23:return mo(f),db(),S=f.memoizedState!==null,d!==null?d.memoizedState!==null!==S&&(f.flags|=8192):S&&(f.flags|=8192),S?(E&536870912)!==0&&(f.flags&128)===0&&(fr(f),f.subtreeFlags&6&&(f.flags|=8192)):fr(f),E=f.updateQueue,E!==null&&ME(f,E.retryQueue),E=null,d!==null&&d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(E=d.memoizedState.cachePool.pool),S=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(S=f.memoizedState.cachePool.pool),S!==E&&(f.flags|=2048),d!==null&&Z(Tc),null;case 24:return E=null,d!==null&&(E=d.memoizedState.cache),f.memoizedState.cache!==E&&(f.flags|=2048),ho(Fr),fr(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function Zee(d,f){switch(QS(f),f.tag){case 1:return d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 3:return ho(Fr),W(),d=f.flags,(d&65536)!==0&&(d&128)===0?(f.flags=d&-65537|128,f):null;case 26:case 27:case 5:return se(f),null;case 13:if(mo(f),d=f.memoizedState,d!==null&&d.dehydrated!==null){if(f.alternate===null)throw Error(r(340));_f()}return d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 19:return Z($r),null;case 4:return W(),null;case 10:return ho(f.type),null;case 22:case 23:return mo(f),db(),d!==null&&Z(Tc),d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 24:return ho(Fr),null;case 25:return null;default:return null}}function hk(d,f){switch(QS(f),f.tag){case 3:ho(Fr),W();break;case 26:case 27:case 5:se(f);break;case 4:W();break;case 13:mo(f);break;case 19:Z($r);break;case 10:ho(f.type);break;case 22:case 23:mo(f),db(),d!==null&&Z(Tc);break;case 24:ho(Fr)}}function Gf(d,f){try{var E=f.updateQueue,S=E!==null?E.lastEffect:null;if(S!==null){var C=S.next;E=C;do{if((E.tag&d)===d){S=void 0;var P=E.create,Y=E.inst;S=P(),Y.destroy=S}E=E.next}while(E!==C)}}catch(ee){qn(f,f.return,ee)}}function al(d,f,E){try{var S=f.updateQueue,C=S!==null?S.lastEffect:null;if(C!==null){var P=C.next;S=P;do{if((S.tag&d)===d){var Y=S.inst,ee=Y.destroy;if(ee!==void 0){Y.destroy=void 0,C=f;var fe=E,ve=ee;try{ve()}catch(Pe){qn(C,fe,Pe)}}}S=S.next}while(S!==P)}}catch(Pe){qn(f,f.return,Pe)}}function fk(d){var f=d.updateQueue;if(f!==null){var E=d.stateNode;try{e2(f,E)}catch(S){qn(d,d.return,S)}}}function mk(d,f,E){E.props=xc(d.type,d.memoizedProps),E.state=d.memoizedState;try{E.componentWillUnmount()}catch(S){qn(d,f,S)}}function zf(d,f){try{var E=d.ref;if(E!==null){switch(d.tag){case 26:case 27:case 5:var S=d.stateNode;break;case 30:S=d.stateNode;break;default:S=d.stateNode}typeof E=="function"?d.refCleanup=E(S):E.current=S}}catch(C){qn(d,f,C)}}function Ri(d,f){var E=d.ref,S=d.refCleanup;if(E!==null)if(typeof S=="function")try{S()}catch(C){qn(d,f,C)}finally{d.refCleanup=null,d=d.alternate,d!=null&&(d.refCleanup=null)}else if(typeof E=="function")try{E(null)}catch(C){qn(d,f,C)}else E.current=null}function pk(d){var f=d.type,E=d.memoizedProps,S=d.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":E.autoFocus&&S.focus();break e;case"img":E.src?S.src=E.src:E.srcSet&&(S.srcset=E.srcSet)}}catch(C){qn(d,d.return,C)}}function Fb(d,f,E){try{var S=d.stateNode;xte(S,d.type,E,f),S[Yt]=f}catch(C){qn(d,d.return,C)}}function gk(d){return d.tag===5||d.tag===3||d.tag===26||d.tag===27&&hl(d.type)||d.tag===4}function $b(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||gk(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.tag===27&&hl(d.type)||d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function Bb(d,f,E){var S=d.tag;if(S===5||S===6)d=d.stateNode,f?(E.nodeType===9?E.body:E.nodeName==="HTML"?E.ownerDocument.body:E).insertBefore(d,f):(f=E.nodeType===9?E.body:E.nodeName==="HTML"?E.ownerDocument.body:E,f.appendChild(d),E=E._reactRootContainer,E!=null||f.onclick!==null||(f.onclick=zE));else if(S!==4&&(S===27&&hl(d.type)&&(E=d.stateNode,f=null),d=d.child,d!==null))for(Bb(d,f,E),d=d.sibling;d!==null;)Bb(d,f,E),d=d.sibling}function DE(d,f,E){var S=d.tag;if(S===5||S===6)d=d.stateNode,f?E.insertBefore(d,f):E.appendChild(d);else if(S!==4&&(S===27&&hl(d.type)&&(E=d.stateNode),d=d.child,d!==null))for(DE(d,f,E),d=d.sibling;d!==null;)DE(d,f,E),d=d.sibling}function Ek(d){var f=d.stateNode,E=d.memoizedProps;try{for(var S=d.type,C=f.attributes;C.length;)f.removeAttributeNode(C[0]);la(f,S,E),f[yt]=d,f[Yt]=E}catch(P){qn(d,d.return,P)}}var Eo=!1,Nr=!1,Hb=!1,Tk=typeof WeakSet=="function"?WeakSet:Set,qr=null;function ete(d,f){if(d=d.containerInfo,hv=JE,d=CP(d),$S(d)){if("selectionStart"in d)var E={start:d.selectionStart,end:d.selectionEnd};else e:{E=(E=d.ownerDocument)&&E.defaultView||window;var S=E.getSelection&&E.getSelection();if(S&&S.rangeCount!==0){E=S.anchorNode;var C=S.anchorOffset,P=S.focusNode;S=S.focusOffset;try{E.nodeType,P.nodeType}catch(Lt){E=null;break e}var Y=0,ee=-1,fe=-1,ve=0,Pe=0,He=d,Re=null;t:for(;;){for(var Ne;He!==E||C!==0&&He.nodeType!==3||(ee=Y+C),He!==P||S!==0&&He.nodeType!==3||(fe=Y+S),He.nodeType===3&&(Y+=He.nodeValue.length),(Ne=He.firstChild)!==null;)Re=He,He=Ne;for(;;){if(He===d)break t;if(Re===E&&++ve===C&&(ee=Y),Re===P&&++Pe===S&&(fe=Y),(Ne=He.nextSibling)!==null)break;He=Re,Re=He.parentNode}He=Ne}E=ee===-1||fe===-1?null:{start:ee,end:fe}}else E=null}E=E||{start:0,end:0}}else E=null;for(fv={focusedElem:d,selectionRange:E},JE=!1,qr=f;qr!==null;)if(f=qr,d=f.child,(f.subtreeFlags&1024)!==0&&d!==null)d.return=f,qr=d;else for(;qr!==null;){switch(f=qr,P=f.alternate,d=f.flags,f.tag){case 0:break;case 11:case 15:break;case 1:if((d&1024)!==0&&P!==null){d=void 0,E=f,C=P.memoizedProps,P=P.memoizedState,S=E.stateNode;try{var Ft=xc(E.type,C,E.elementType===E.type);d=S.getSnapshotBeforeUpdate(Ft,P),S.__reactInternalSnapshotBeforeUpdate=d}catch(Lt){qn(E,E.return,Lt)}}break;case 3:if((d&1024)!==0){if(d=f.stateNode.containerInfo,E=d.nodeType,E===9)gv(d);else if(E===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":gv(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((d&1024)!==0)throw Error(r(163))}if(d=f.sibling,d!==null){d.return=f.return,qr=d;break}qr=f.return}}function yk(d,f,E){var S=E.flags;switch(E.tag){case 0:case 11:case 15:sl(d,E),S&4&&Gf(5,E);break;case 1:if(sl(d,E),S&4)if(d=E.stateNode,f===null)try{d.componentDidMount()}catch(Y){qn(E,E.return,Y)}else{var C=xc(E.type,f.memoizedProps);f=f.memoizedState;try{d.componentDidUpdate(C,f,d.__reactInternalSnapshotBeforeUpdate)}catch(Y){qn(E,E.return,Y)}}S&64&&fk(E),S&512&&zf(E,E.return);break;case 3:if(sl(d,E),S&64&&(d=E.updateQueue,d!==null)){if(f=null,E.child!==null)switch(E.child.tag){case 27:case 5:f=E.child.stateNode;break;case 1:f=E.child.stateNode}try{e2(d,f)}catch(Y){qn(E,E.return,Y)}}break;case 27:f===null&&S&4&&Ek(E);case 26:case 5:sl(d,E),f===null&&S&4&&pk(E),S&512&&zf(E,E.return);break;case 12:sl(d,E);break;case 13:sl(d,E),S&4&&bk(d,E),S&64&&(d=E.memoizedState,d!==null&&(d=d.dehydrated,d!==null&&(E=cte.bind(null,E),_te(d,E))));break;case 22:if(S=E.memoizedState!==null||Eo,!S){f=f!==null&&f.memoizedState!==null||Nr,C=Eo;var P=Nr;Eo=S,(Nr=f)&&!P?il(d,E,(E.subtreeFlags&8772)!==0):sl(d,E),Eo=C,Nr=P}break;case 30:break;default:sl(d,E)}}function xk(d){var f=d.alternate;f!==null&&(d.alternate=null,xk(f)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(f=d.stateNode,f!==null&&kn(f)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}var lr=null,Wa=!1;function To(d,f,E){for(E=E.child;E!==null;)Sk(d,f,E),E=E.sibling}function Sk(d,f,E){if(ue&&typeof ue.onCommitFiberUnmount=="function")try{ue.onCommitFiberUnmount(oe,E)}catch(P){}switch(E.tag){case 26:Nr||Ri(E,f),To(d,f,E),E.memoizedState?E.memoizedState.count--:E.stateNode&&(E=E.stateNode,E.parentNode.removeChild(E));break;case 27:Nr||Ri(E,f);var S=lr,C=Wa;hl(E.type)&&(lr=E.stateNode,Wa=!1),To(d,f,E),em(E.stateNode),lr=S,Wa=C;break;case 5:Nr||Ri(E,f);case 6:if(S=lr,C=Wa,lr=null,To(d,f,E),lr=S,Wa=C,lr!==null)if(Wa)try{(lr.nodeType===9?lr.body:lr.nodeName==="HTML"?lr.ownerDocument.body:lr).removeChild(E.stateNode)}catch(P){qn(E,f,P)}else try{lr.removeChild(E.stateNode)}catch(P){qn(E,f,P)}break;case 18:lr!==null&&(Wa?(d=lr,cj(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,E.stateNode),lm(d)):cj(lr,E.stateNode));break;case 4:S=lr,C=Wa,lr=E.stateNode.containerInfo,Wa=!0,To(d,f,E),lr=S,Wa=C;break;case 0:case 11:case 14:case 15:Nr||al(2,E,f),Nr||al(4,E,f),To(d,f,E);break;case 1:Nr||(Ri(E,f),S=E.stateNode,typeof S.componentWillUnmount=="function"&&mk(E,f,S)),To(d,f,E);break;case 21:To(d,f,E);break;case 22:Nr=(S=Nr)||E.memoizedState!==null,To(d,f,E),Nr=S;break;default:To(d,f,E)}}function bk(d,f){if(f.memoizedState===null&&(d=f.alternate,d!==null&&(d=d.memoizedState,d!==null&&(d=d.dehydrated,d!==null))))try{lm(d)}catch(E){qn(f,f.return,E)}}function tte(d){switch(d.tag){case 13:case 19:var f=d.stateNode;return f===null&&(f=d.stateNode=new Tk),f;case 22:return d=d.stateNode,f=d._retryCache,f===null&&(f=d._retryCache=new Tk),f;default:throw Error(r(435,d.tag))}}function Vb(d,f){var E=tte(d);f.forEach(function(S){var C=ute.bind(null,d,S);E.has(S)||(E.add(S),S.then(C,C))})}function cs(d,f){var E=f.deletions;if(E!==null)for(var S=0;S<E.length;S++){var C=E[S],P=d,Y=f,ee=Y;e:for(;ee!==null;){switch(ee.tag){case 27:if(hl(ee.type)){lr=ee.stateNode,Wa=!1;break e}break;case 5:lr=ee.stateNode,Wa=!1;break e;case 3:case 4:lr=ee.stateNode.containerInfo,Wa=!0;break e}ee=ee.return}if(lr===null)throw Error(r(160));Sk(P,Y,C),lr=null,Wa=!1,P=C.alternate,P!==null&&(P.return=null),C.return=null}if(f.subtreeFlags&13878)for(f=f.child;f!==null;)vk(f,d),f=f.sibling}var ni=null;function vk(d,f){var E=d.alternate,S=d.flags;switch(d.tag){case 0:case 11:case 14:case 15:cs(f,d),us(d),S&4&&(al(3,d,d.return),Gf(3,d),al(5,d,d.return));break;case 1:cs(f,d),us(d),S&512&&(Nr||E===null||Ri(E,E.return)),S&64&&Eo&&(d=d.updateQueue,d!==null&&(S=d.callbacks,S!==null&&(E=d.shared.hiddenCallbacks,d.shared.hiddenCallbacks=E===null?S:E.concat(S))));break;case 26:var C=ni;if(cs(f,d),us(d),S&512&&(Nr||E===null||Ri(E,E.return)),S&4){var P=E!==null?E.memoizedState:null;if(S=d.memoizedState,E===null)if(S===null)if(d.stateNode===null){e:{S=d.type,E=d.memoizedProps,C=C.ownerDocument||C;t:switch(S){case"title":P=C.getElementsByTagName("title")[0],(!P||P[dr]||P[yt]||P.namespaceURI==="http://www.w3.org/2000/svg"||P.hasAttribute("itemprop"))&&(P=C.createElement(S),C.head.insertBefore(P,C.querySelector("head > title"))),la(P,S,E),P[yt]=d,Wt(P),S=P;break e;case"link":var Y=Ej("link","href",C).get(S+(E.href||""));if(Y){for(var ee=0;ee<Y.length;ee++)if(P=Y[ee],P.getAttribute("href")===(E.href==null||E.href===""?null:E.href)&&P.getAttribute("rel")===(E.rel==null?null:E.rel)&&P.getAttribute("title")===(E.title==null?null:E.title)&&P.getAttribute("crossorigin")===(E.crossOrigin==null?null:E.crossOrigin)){Y.splice(ee,1);break t}}P=C.createElement(S),la(P,S,E),C.head.appendChild(P);break;case"meta":if(Y=Ej("meta","content",C).get(S+(E.content||""))){for(ee=0;ee<Y.length;ee++)if(P=Y[ee],P.getAttribute("content")===(E.content==null?null:""+E.content)&&P.getAttribute("name")===(E.name==null?null:E.name)&&P.getAttribute("property")===(E.property==null?null:E.property)&&P.getAttribute("http-equiv")===(E.httpEquiv==null?null:E.httpEquiv)&&P.getAttribute("charset")===(E.charSet==null?null:E.charSet)){Y.splice(ee,1);break t}}P=C.createElement(S),la(P,S,E),C.head.appendChild(P);break;default:throw Error(r(468,S))}P[yt]=d,Wt(P),S=P}d.stateNode=S}else Tj(C,d.type,d.stateNode);else d.stateNode=gj(C,S,d.memoizedProps);else P!==S?(P===null?E.stateNode!==null&&(E=E.stateNode,E.parentNode.removeChild(E)):P.count--,S===null?Tj(C,d.type,d.stateNode):gj(C,S,d.memoizedProps)):S===null&&d.stateNode!==null&&Fb(d,d.memoizedProps,E.memoizedProps)}break;case 27:cs(f,d),us(d),S&512&&(Nr||E===null||Ri(E,E.return)),E!==null&&S&4&&Fb(d,d.memoizedProps,E.memoizedProps);break;case 5:if(cs(f,d),us(d),S&512&&(Nr||E===null||Ri(E,E.return)),d.flags&32){C=d.stateNode;try{bi(C,"")}catch(Ne){qn(d,d.return,Ne)}}S&4&&d.stateNode!=null&&(C=d.memoizedProps,Fb(d,C,E!==null?E.memoizedProps:C)),S&1024&&(Hb=!0);break;case 6:if(cs(f,d),us(d),S&4){if(d.stateNode===null)throw Error(r(162));S=d.memoizedProps,E=d.stateNode;try{E.nodeValue=S}catch(Ne){qn(d,d.return,Ne)}}break;case 3:if(XE=null,C=ni,ni=YE(f.containerInfo),cs(f,d),ni=C,us(d),S&4&&E!==null&&E.memoizedState.isDehydrated)try{lm(f.containerInfo)}catch(Ne){qn(d,d.return,Ne)}Hb&&(Hb=!1,Ak(d));break;case 4:S=ni,ni=YE(d.stateNode.containerInfo),cs(f,d),us(d),ni=S;break;case 12:cs(f,d),us(d);break;case 13:cs(f,d),us(d),d.child.flags&8192&&d.memoizedState!==null!=(E!==null&&E.memoizedState!==null)&&(Xb=re()),S&4&&(S=d.updateQueue,S!==null&&(d.updateQueue=null,Vb(d,S)));break;case 22:C=d.memoizedState!==null;var fe=E!==null&&E.memoizedState!==null,ve=Eo,Pe=Nr;if(Eo=ve||C,Nr=Pe||fe,cs(f,d),Nr=Pe,Eo=ve,us(d),S&8192)e:for(f=d.stateNode,f._visibility=C?f._visibility&-2:f._visibility|1,C&&(E===null||fe||Eo||Nr||Sc(d)),E=null,f=d;;){if(f.tag===5||f.tag===26){if(E===null){fe=E=f;try{if(P=fe.stateNode,C)Y=P.style,typeof Y.setProperty=="function"?Y.setProperty("display","none","important"):Y.display="none";else{ee=fe.stateNode;var He=fe.memoizedProps.style,Re=He!=null&&He.hasOwnProperty("display")?He.display:null;ee.style.display=Re==null||typeof Re=="boolean"?"":(""+Re).trim()}}catch(Ne){qn(fe,fe.return,Ne)}}}else if(f.tag===6){if(E===null){fe=f;try{fe.stateNode.nodeValue=C?"":fe.memoizedProps}catch(Ne){qn(fe,fe.return,Ne)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===d)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;E===f&&(E=null),f=f.return}E===f&&(E=null),f.sibling.return=f.return,f=f.sibling}S&4&&(S=d.updateQueue,S!==null&&(E=S.retryQueue,E!==null&&(S.retryQueue=null,Vb(d,E))));break;case 19:cs(f,d),us(d),S&4&&(S=d.updateQueue,S!==null&&(d.updateQueue=null,Vb(d,S)));break;case 30:break;case 21:break;default:cs(f,d),us(d)}}function us(d){var f=d.flags;if(f&2){try{for(var E,S=d.return;S!==null;){if(gk(S)){E=S;break}S=S.return}if(E==null)throw Error(r(160));switch(E.tag){case 27:var C=E.stateNode,P=$b(d);DE(d,P,C);break;case 5:var Y=E.stateNode;E.flags&32&&(bi(Y,""),E.flags&=-33);var ee=$b(d);DE(d,ee,Y);break;case 3:case 4:var fe=E.stateNode.containerInfo,ve=$b(d);Bb(d,ve,fe);break;default:throw Error(r(161))}}catch(Pe){qn(d,d.return,Pe)}d.flags&=-3}f&4096&&(d.flags&=-4097)}function Ak(d){if(d.subtreeFlags&1024)for(d=d.child;d!==null;){var f=d;Ak(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),d=d.sibling}}function sl(d,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)yk(d,f.alternate,f),f=f.sibling}function Sc(d){for(d=d.child;d!==null;){var f=d;switch(f.tag){case 0:case 11:case 14:case 15:al(4,f,f.return),Sc(f);break;case 1:Ri(f,f.return);var E=f.stateNode;typeof E.componentWillUnmount=="function"&&mk(f,f.return,E),Sc(f);break;case 27:em(f.stateNode);case 26:case 5:Ri(f,f.return),Sc(f);break;case 22:f.memoizedState===null&&Sc(f);break;case 30:Sc(f);break;default:Sc(f)}d=d.sibling}}function il(d,f,E){for(E=E&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var S=f.alternate,C=d,P=f,Y=P.flags;switch(P.tag){case 0:case 11:case 15:il(C,P,E),Gf(4,P);break;case 1:if(il(C,P,E),S=P,C=S.stateNode,typeof C.componentDidMount=="function")try{C.componentDidMount()}catch(ve){qn(S,S.return,ve)}if(S=P,C=S.updateQueue,C!==null){var ee=S.stateNode;try{var fe=C.shared.hiddenCallbacks;if(fe!==null)for(C.shared.hiddenCallbacks=null,C=0;C<fe.length;C++)ZP(fe[C],ee)}catch(ve){qn(S,S.return,ve)}}E&&Y&64&&fk(P),zf(P,P.return);break;case 27:Ek(P);case 26:case 5:il(C,P,E),E&&S===null&&Y&4&&pk(P),zf(P,P.return);break;case 12:il(C,P,E);break;case 13:il(C,P,E),E&&Y&4&&bk(C,P);break;case 22:P.memoizedState===null&&il(C,P,E),zf(P,P.return);break;case 30:break;default:il(C,P,E)}f=f.sibling}}function Gb(d,f){var E=null;d!==null&&d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(E=d.memoizedState.cachePool.pool),d=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(d=f.memoizedState.cachePool.pool),d!==E&&(d!=null&&d.refCount++,E!=null&&If(E))}function zb(d,f){d=null,f.alternate!==null&&(d=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==d&&(f.refCount++,d!=null&&If(d))}function Ni(d,f,E,S){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)Rk(d,f,E,S),f=f.sibling}function Rk(d,f,E,S){var C=f.flags;switch(f.tag){case 0:case 11:case 15:Ni(d,f,E,S),C&2048&&Gf(9,f);break;case 1:Ni(d,f,E,S);break;case 3:Ni(d,f,E,S),C&2048&&(d=null,f.alternate!==null&&(d=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==d&&(f.refCount++,d!=null&&If(d)));break;case 12:if(C&2048){Ni(d,f,E,S),d=f.stateNode;try{var P=f.memoizedProps,Y=P.id,ee=P.onPostCommit;typeof ee=="function"&&ee(Y,f.alternate===null?"mount":"update",d.passiveEffectDuration,-0)}catch(fe){qn(f,f.return,fe)}}else Ni(d,f,E,S);break;case 13:Ni(d,f,E,S);break;case 23:break;case 22:P=f.stateNode,Y=f.alternate,f.memoizedState!==null?P._visibility&2?Ni(d,f,E,S):qf(d,f):P._visibility&2?Ni(d,f,E,S):(P._visibility|=2,ld(d,f,E,S,(f.subtreeFlags&10256)!==0)),C&2048&&Gb(Y,f);break;case 24:Ni(d,f,E,S),C&2048&&zb(f.alternate,f);break;default:Ni(d,f,E,S)}}function ld(d,f,E,S,C){for(C=C&&(f.subtreeFlags&10256)!==0,f=f.child;f!==null;){var P=d,Y=f,ee=E,fe=S,ve=Y.flags;switch(Y.tag){case 0:case 11:case 15:ld(P,Y,ee,fe,C),Gf(8,Y);break;case 23:break;case 22:var Pe=Y.stateNode;Y.memoizedState!==null?Pe._visibility&2?ld(P,Y,ee,fe,C):qf(P,Y):(Pe._visibility|=2,ld(P,Y,ee,fe,C)),C&&ve&2048&&Gb(Y.alternate,Y);break;case 24:ld(P,Y,ee,fe,C),C&&ve&2048&&zb(Y.alternate,Y);break;default:ld(P,Y,ee,fe,C)}f=f.sibling}}function qf(d,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var E=d,S=f,C=S.flags;switch(S.tag){case 22:qf(E,S),C&2048&&Gb(S.alternate,S);break;case 24:qf(E,S),C&2048&&zb(S.alternate,S);break;default:qf(E,S)}f=f.sibling}}var Yf=8192;function cd(d){if(d.subtreeFlags&Yf)for(d=d.child;d!==null;)Nk(d),d=d.sibling}function Nk(d){switch(d.tag){case 26:cd(d),d.flags&Yf&&d.memoizedState!==null&&$te(ni,d.memoizedState,d.memoizedProps);break;case 5:cd(d);break;case 3:case 4:var f=ni;ni=YE(d.stateNode.containerInfo),cd(d),ni=f;break;case 22:d.memoizedState===null&&(f=d.alternate,f!==null&&f.memoizedState!==null?(f=Yf,Yf=16777216,cd(d),Yf=f):cd(d));break;default:cd(d)}}function _k(d){var f=d.alternate;if(f!==null&&(d=f.child,d!==null)){f.child=null;do f=d.sibling,d.sibling=null,d=f;while(d!==null)}}function Wf(d){var f=d.deletions;if((d.flags&16)!==0){if(f!==null)for(var E=0;E<f.length;E++){var S=f[E];qr=S,Ck(S,d)}_k(d)}if(d.subtreeFlags&10256)for(d=d.child;d!==null;)wk(d),d=d.sibling}function wk(d){switch(d.tag){case 0:case 11:case 15:Wf(d),d.flags&2048&&al(9,d,d.return);break;case 3:Wf(d);break;case 12:Wf(d);break;case 22:var f=d.stateNode;d.memoizedState!==null&&f._visibility&2&&(d.return===null||d.return.tag!==13)?(f._visibility&=-3,PE(d)):Wf(d);break;default:Wf(d)}}function PE(d){var f=d.deletions;if((d.flags&16)!==0){if(f!==null)for(var E=0;E<f.length;E++){var S=f[E];qr=S,Ck(S,d)}_k(d)}for(d=d.child;d!==null;){switch(f=d,f.tag){case 0:case 11:case 15:al(8,f,f.return),PE(f);break;case 22:E=f.stateNode,E._visibility&2&&(E._visibility&=-3,PE(f));break;default:PE(f)}d=d.sibling}}function Ck(d,f){for(;qr!==null;){var E=qr;switch(E.tag){case 0:case 11:case 15:al(8,E,f);break;case 23:case 22:if(E.memoizedState!==null&&E.memoizedState.cachePool!==null){var S=E.memoizedState.cachePool.pool;S!=null&&S.refCount++}break;case 24:If(E.memoizedState.cache)}if(S=E.child,S!==null)S.return=E,qr=S;else e:for(E=d;qr!==null;){S=qr;var C=S.sibling,P=S.return;if(xk(S),S===E){qr=null;break e}if(C!==null){C.return=P,qr=C;break e}qr=P}}}var nte={getCacheForType:function(d){var f=Ta(Fr),E=f.data.get(d);return E===void 0&&(E=d(),f.data.set(d,E)),E}},rte=typeof WeakMap=="function"?WeakMap:Map,Ln=0,Jn=null,sn=null,hn=0,Mn=0,ds=null,ol=!1,ud=!1,qb=!1,yo=0,yr=0,ll=0,bc=0,Yb=0,Os=0,dd=0,Xf=null,Xa=null,Wb=!1,Xb=0,kE=1/0,jE=null,cl=null,oa=0,ul=null,hd=null,fd=0,Kb=0,Qb=null,Ik=null,Kf=0,Jb=null;function hs(){if((Ln&2)!==0&&hn!==0)return hn&-hn;if(j.T!==null){var d=ed;return d!==0?d:sv()}return _t()}function Ok(){Os===0&&(Os=(hn&536870912)===0||An?Ie():536870912);var d=Is.current;return d!==null&&(d.flags|=32),Os}function fs(d,f,E){(d===Jn&&(Mn===2||Mn===9)||d.cancelPendingCommit!==null)&&(md(d,0),dl(d,hn,Os,!1)),De(d,E),((Ln&2)===0||d!==Jn)&&(d===Jn&&((Ln&2)===0&&(bc|=E),yr===4&&dl(d,hn,Os,!1)),_i(d))}function Lk(d,f,E){if((Ln&6)!==0)throw Error(r(327));var S=!E&&(f&124)===0&&(f&d.expiredLanes)===0||Ae(d,f),C=S?ite(d,f):tv(d,f,!0),P=S;do{if(C===0){ud&&!S&&dl(d,f,0,!1);break}else{if(E=d.current.alternate,P&&!ate(E)){C=tv(d,f,!1),P=!1;continue}if(C===2){if(P=f,d.errorRecoveryDisabledLanes&P)var Y=0;else Y=d.pendingLanes&-536870913,Y=Y!==0?Y:Y&536870912?536870912:0;if(Y!==0){f=Y;e:{var ee=d;C=Xf;var fe=ee.current.memoizedState.isDehydrated;if(fe&&(md(ee,Y).flags|=256),Y=tv(ee,Y,!1),Y!==2){if(qb&&!fe){ee.errorRecoveryDisabledLanes|=P,bc|=P,C=4;break e}P=Xa,Xa=C,P!==null&&(Xa===null?Xa=P:Xa.push.apply(Xa,P))}C=Y}if(P=!1,C!==2)continue}}if(C===1){md(d,0),dl(d,f,0,!0);break}e:{switch(S=d,P=C,P){case 0:case 1:throw Error(r(345));case 4:if((f&4194048)!==f)break;case 6:dl(S,f,Os,!ol);break e;case 2:Xa=null;break;case 3:case 5:break;default:throw Error(r(329))}if((f&62914560)===f&&(C=Xb+300-re(),10<C)){if(dl(S,f,Os,!ol),de(S,0,!0)!==0)break e;S.timeoutHandle=oj(Mk.bind(null,S,E,Xa,jE,Wb,f,Os,bc,dd,ol,P,2,-0,0),C);break e}Mk(S,E,Xa,jE,Wb,f,Os,bc,dd,ol,P,0,-0,0)}}break}while(!0);_i(d)}function Mk(d,f,E,S,C,P,Y,ee,fe,ve,Pe,He,Re,Ne){if(d.timeoutHandle=-1,He=f.subtreeFlags,(He&8192||(He&16785408)===16785408)&&(rm={stylesheets:null,count:0,unsuspend:Fte},Nk(f),He=Bte(),He!==null)){d.cancelPendingCommit=He($k.bind(null,d,f,P,E,S,C,Y,ee,fe,Pe,1,Re,Ne)),dl(d,P,Y,!ve);return}$k(d,f,P,E,S,C,Y,ee,fe)}function ate(d){for(var f=d;;){var E=f.tag;if((E===0||E===11||E===15)&&f.flags&16384&&(E=f.updateQueue,E!==null&&(E=E.stores,E!==null)))for(var S=0;S<E.length;S++){var C=E[S],P=C.getSnapshot;C=C.value;try{if(!os(P(),C))return!1}catch(Y){return!1}}if(E=f.child,f.subtreeFlags&16384&&E!==null)E.return=f,f=E;else{if(f===d)break;for(;f.sibling===null;){if(f.return===null||f.return===d)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function dl(d,f,E,S){f&=~Yb,f&=~bc,d.suspendedLanes|=f,d.pingedLanes&=~f,S&&(d.warmLanes|=f),S=d.expirationTimes;for(var C=f;0<C;){var P=31-Le(C),Y=1<<P;S[P]=-1,C&=~Y}E!==0&&Pt(d,E,f)}function UE(){return(Ln&6)===0?(Qf(0),!1):!0}function Zb(){if(sn!==null){if(Mn===0)var d=sn.return;else d=sn,uo=gc=null,gb(d),id=null,Bf=0,d=sn;for(;d!==null;)hk(d.alternate,d),d=d.return;sn=null}}function md(d,f){var E=d.timeoutHandle;E!==-1&&(d.timeoutHandle=-1,bte(E)),E=d.cancelPendingCommit,E!==null&&(d.cancelPendingCommit=null,E()),Zb(),Jn=d,sn=E=oo(d.current,null),hn=f,Mn=0,ds=null,ol=!1,ud=Ae(d,f),qb=!1,dd=Os=Yb=bc=ll=yr=0,Xa=Xf=null,Wb=!1,(f&8)!==0&&(f|=f&32);var S=d.entangledLanes;if(S!==0)for(d=d.entanglements,S&=f;0<S;){var C=31-Le(S),P=1<<C;f|=d[C],S&=~P}return yo=f,iE(),E}function Dk(d,f){nn=null,j.H=RE,f===Lf||f===pE?(f=QP(),Mn=3):f===WP?(f=QP(),Mn=4):Mn=f===J2?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,ds=f,sn===null&&(yr=1,IE(d,Ns(f,d.current)))}function Pk(){var d=j.H;return j.H=RE,d===null?RE:d}function kk(){var d=j.A;return j.A=nte,d}function ev(){yr=4,ol||(hn&4194048)!==hn&&Is.current!==null||(ud=!0),(ll&134217727)===0&&(bc&134217727)===0||Jn===null||dl(Jn,hn,Os,!1)}function tv(d,f,E){var S=Ln;Ln|=2;var C=Pk(),P=kk();(Jn!==d||hn!==f)&&(jE=null,md(d,f)),f=!1;var Y=yr;e:do try{if(Mn!==0&&sn!==null){var ee=sn,fe=ds;switch(Mn){case 8:Zb(),Y=6;break e;case 3:case 2:case 9:case 6:Is.current===null&&(f=!0);var ve=Mn;if(Mn=0,ds=null,pd(d,ee,fe,ve),E&&ud){Y=0;break e}break;default:ve=Mn,Mn=0,ds=null,pd(d,ee,fe,ve)}}ste(),Y=yr;break}catch(Pe){Dk(d,Pe)}while(!0);return f&&d.shellSuspendCounter++,uo=gc=null,Ln=S,j.H=C,j.A=P,sn===null&&(Jn=null,hn=0,iE()),Y}function ste(){for(;sn!==null;)jk(sn)}function ite(d,f){var E=Ln;Ln|=2;var S=Pk(),C=kk();Jn!==d||hn!==f?(jE=null,kE=re()+500,md(d,f)):ud=Ae(d,f);e:do try{if(Mn!==0&&sn!==null){f=sn;var P=ds;t:switch(Mn){case 1:Mn=0,ds=null,pd(d,f,P,1);break;case 2:case 9:if(XP(P)){Mn=0,ds=null,Uk(f);break}f=function(){Mn!==2&&Mn!==9||Jn!==d||(Mn=7),_i(d)},P.then(f,f);break e;case 3:Mn=7;break e;case 4:Mn=5;break e;case 7:XP(P)?(Mn=0,ds=null,Uk(f)):(Mn=0,ds=null,pd(d,f,P,7));break;case 5:var Y=null;switch(sn.tag){case 26:Y=sn.memoizedState;case 5:case 27:var ee=sn;if(!Y||yj(Y)){Mn=0,ds=null;var fe=ee.sibling;if(fe!==null)sn=fe;else{var ve=ee.return;ve!==null?(sn=ve,FE(ve)):sn=null}break t}}Mn=0,ds=null,pd(d,f,P,5);break;case 6:Mn=0,ds=null,pd(d,f,P,6);break;case 8:Zb(),yr=6;break e;default:throw Error(r(462))}}ote();break}catch(Pe){Dk(d,Pe)}while(!0);return uo=gc=null,j.H=S,j.A=C,Ln=E,sn!==null?0:(Jn=null,hn=0,iE(),yr)}function ote(){for(;sn!==null&&!pe();)jk(sn)}function jk(d){var f=uk(d.alternate,d,yo);d.memoizedProps=d.pendingProps,f===null?FE(d):sn=f}function Uk(d){var f=d,E=f.alternate;switch(f.tag){case 15:case 0:f=ak(E,f,f.pendingProps,f.type,void 0,hn);break;case 11:f=ak(E,f,f.pendingProps,f.type.render,f.ref,hn);break;case 5:gb(f);default:hk(E,f),f=sn=FP(f,yo),f=uk(E,f,yo)}d.memoizedProps=d.pendingProps,f===null?FE(d):sn=f}function pd(d,f,E,S){uo=gc=null,gb(f),id=null,Bf=0;var C=f.return;try{if(Kee(d,C,f,E,hn)){yr=1,IE(d,Ns(E,d.current)),sn=null;return}}catch(P){if(C!==null)throw sn=C,P;yr=1,IE(d,Ns(E,d.current)),sn=null;return}f.flags&32768?(An||S===1?d=!0:ud||(hn&536870912)!==0?d=!1:(ol=d=!0,(S===2||S===9||S===3||S===6)&&(S=Is.current,S!==null&&S.tag===13&&(S.flags|=16384))),Fk(f,d)):FE(f)}function FE(d){var f=d;do{if((f.flags&32768)!==0){Fk(f,ol);return}d=f.return;var E=Jee(f.alternate,f,yo);if(E!==null){sn=E;return}if(f=f.sibling,f!==null){sn=f;return}sn=f=d}while(f!==null);yr===0&&(yr=5)}function Fk(d,f){do{var E=Zee(d.alternate,d);if(E!==null){E.flags&=32767,sn=E;return}if(E=d.return,E!==null&&(E.flags|=32768,E.subtreeFlags=0,E.deletions=null),!f&&(d=d.sibling,d!==null)){sn=d;return}sn=d=E}while(d!==null);yr=6,sn=null}function $k(d,f,E,S,C,P,Y,ee,fe){d.cancelPendingCommit=null;do $E();while(oa!==0);if((Ln&6)!==0)throw Error(r(327));if(f!==null){if(f===d.current)throw Error(r(177));if(P=f.lanes|f.childLanes,P|=zS,nt(d,E,P,Y,ee,fe),d===Jn&&(sn=Jn=null,hn=0),hd=f,ul=d,fd=E,Kb=P,Qb=C,Ik=S,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(d.callbackNode=null,d.callbackPriority=0,dte(Je,function(){return zk(),null})):(d.callbackNode=null,d.callbackPriority=0),S=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||S){S=j.T,j.T=null,C=G.p,G.p=2,Y=Ln,Ln|=4;try{ete(d,f,E)}finally{Ln=Y,G.p=C,j.T=S}}oa=1,Bk(),Hk(),Vk()}}function Bk(){if(oa===1){oa=0;var d=ul,f=hd,E=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||E){E=j.T,j.T=null;var S=G.p;G.p=2;var C=Ln;Ln|=4;try{vk(f,d);var P=fv,Y=CP(d.containerInfo),ee=P.focusedElem,fe=P.selectionRange;if(Y!==ee&&ee&&ee.ownerDocument&&wP(ee.ownerDocument.documentElement,ee)){if(fe!==null&&$S(ee)){var ve=fe.start,Pe=fe.end;if(Pe===void 0&&(Pe=ve),"selectionStart"in ee)ee.selectionStart=ve,ee.selectionEnd=Math.min(Pe,ee.value.length);else{var He=ee.ownerDocument||document,Re=He&&He.defaultView||window;if(Re.getSelection){var Ne=Re.getSelection(),Ft=ee.textContent.length,Lt=Math.min(fe.start,Ft),$n=fe.end===void 0?Lt:Math.min(fe.end,Ft);!Ne.extend&&Lt>$n&&(Y=$n,$n=Lt,Lt=Y);var ye=_P(ee,Lt),ge=_P(ee,$n);if(ye&&ge&&(Ne.rangeCount!==1||Ne.anchorNode!==ye.node||Ne.anchorOffset!==ye.offset||Ne.focusNode!==ge.node||Ne.focusOffset!==ge.offset)){var be=He.createRange();be.setStart(ye.node,ye.offset),Ne.removeAllRanges(),Lt>$n?(Ne.addRange(be),Ne.extend(ge.node,ge.offset)):(be.setEnd(ge.node,ge.offset),Ne.addRange(be))}}}}for(He=[],Ne=ee;Ne=Ne.parentNode;)Ne.nodeType===1&&He.push({element:Ne,left:Ne.scrollLeft,top:Ne.scrollTop});for(typeof ee.focus=="function"&&ee.focus(),ee=0;ee<He.length;ee++){var Be=He[ee];Be.element.scrollLeft=Be.left,Be.element.scrollTop=Be.top}}JE=!!hv,fv=hv=null}finally{Ln=C,G.p=S,j.T=E}}d.current=f,oa=2}}function Hk(){if(oa===2){oa=0;var d=ul,f=hd,E=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||E){E=j.T,j.T=null;var S=G.p;G.p=2;var C=Ln;Ln|=4;try{yk(d,f.alternate,f)}finally{Ln=C,G.p=S,j.T=E}}oa=3}}function Vk(){if(oa===4||oa===3){oa=0,_e();var d=ul,f=hd,E=fd,S=Ik;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?oa=5:(oa=0,hd=ul=null,Gk(d,d.pendingLanes));var C=d.pendingLanes;if(C===0&&(cl=null),un(E),f=f.stateNode,ue&&typeof ue.onCommitFiberRoot=="function")try{ue.onCommitFiberRoot(oe,f,void 0,(f.current.flags&128)===128)}catch(fe){}if(S!==null){f=j.T,C=G.p,G.p=2,j.T=null;try{for(var P=d.onRecoverableError,Y=0;Y<S.length;Y++){var ee=S[Y];P(ee.value,{componentStack:ee.stack})}}finally{j.T=f,G.p=C}}(fd&3)!==0&&$E(),_i(d),C=d.pendingLanes,(E&4194090)!==0&&(C&42)!==0?d===Jb?Kf++:(Kf=0,Jb=d):Kf=0,Qf(0)}}function Gk(d,f){(d.pooledCacheLanes&=f)===0&&(f=d.pooledCache,f!=null&&(d.pooledCache=null,If(f)))}function $E(d){return Bk(),Hk(),Vk(),zk()}function zk(){if(oa!==5)return!1;var d=ul,f=Kb;Kb=0;var E=un(fd),S=j.T,C=G.p;try{G.p=32>E?32:E,j.T=null,E=Qb,Qb=null;var P=ul,Y=fd;if(oa=0,hd=ul=null,fd=0,(Ln&6)!==0)throw Error(r(331));var ee=Ln;if(Ln|=4,wk(P.current),Rk(P,P.current,Y,E),Ln=ee,Qf(0,!1),ue&&typeof ue.onPostCommitFiberRoot=="function")try{ue.onPostCommitFiberRoot(oe,P)}catch(fe){}return!0}finally{G.p=C,j.T=S,Gk(d,f)}}function qk(d,f,E){f=Ns(E,f),f=Ib(d.stateNode,f,2),d=el(d,f,2),d!==null&&(De(d,2),_i(d))}function qn(d,f,E){if(d.tag===3)qk(d,d,E);else for(;f!==null;){if(f.tag===3){qk(f,d,E);break}else if(f.tag===1){var S=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof S.componentDidCatch=="function"&&(cl===null||!cl.has(S))){d=Ns(E,d),E=K2(2),S=el(f,E,2),S!==null&&(Q2(E,S,f,d),De(S,2),_i(S));break}}f=f.return}}function nv(d,f,E){var S=d.pingCache;if(S===null){S=d.pingCache=new rte;var C=new Set;S.set(f,C)}else C=S.get(f),C===void 0&&(C=new Set,S.set(f,C));C.has(E)||(qb=!0,C.add(E),d=lte.bind(null,d,f,E),f.then(d,d))}function lte(d,f,E){var S=d.pingCache;S!==null&&S.delete(f),d.pingedLanes|=d.suspendedLanes&E,d.warmLanes&=~E,Jn===d&&(hn&E)===E&&(yr===4||yr===3&&(hn&62914560)===hn&&300>re()-Xb?(Ln&2)===0&&md(d,0):Yb|=E,dd===hn&&(dd=0)),_i(d)}function Yk(d,f){f===0&&(f=Ke()),d=Ku(d,f),d!==null&&(De(d,f),_i(d))}function cte(d){var f=d.memoizedState,E=0;f!==null&&(E=f.retryLane),Yk(d,E)}function ute(d,f){var E=0;switch(d.tag){case 13:var S=d.stateNode,C=d.memoizedState;C!==null&&(E=C.retryLane);break;case 19:S=d.stateNode;break;case 22:S=d.stateNode._retryCache;break;default:throw Error(r(314))}S!==null&&S.delete(f),Yk(d,E)}function dte(d,f){return xe(d,f)}var BE=null,gd=null,rv=!1,HE=!1,av=!1,vc=0;function _i(d){d!==gd&&d.next===null&&(gd===null?BE=gd=d:gd=gd.next=d),HE=!0,rv||(rv=!0,fte())}function Qf(d,f){if(!av&&HE){av=!0;do for(var E=!1,S=BE;S!==null;){if(d!==0){var C=S.pendingLanes;if(C===0)var P=0;else{var Y=S.suspendedLanes,ee=S.pingedLanes;P=(1<<31-Le(42|d)+1)-1,P&=C&~(Y&~ee),P=P&201326741?P&201326741|1:P?P|2:0}P!==0&&(E=!0,Qk(S,P))}else P=hn,P=de(S,S===Jn?P:0,S.cancelPendingCommit!==null||S.timeoutHandle!==-1),(P&3)===0||Ae(S,P)||(E=!0,Qk(S,P));S=S.next}while(E);av=!1}}function hte(){Wk()}function Wk(){HE=rv=!1;var d=0;vc!==0&&(Ste()&&(d=vc),vc=0);for(var f=re(),E=null,S=BE;S!==null;){var C=S.next,P=Xk(S,f);P===0?(S.next=null,E===null?BE=C:E.next=C,C===null&&(gd=E)):(E=S,(d!==0||(P&3)!==0)&&(HE=!0)),S=C}Qf(d)}function Xk(d,f){for(var E=d.suspendedLanes,S=d.pingedLanes,C=d.expirationTimes,P=d.pendingLanes&-62914561;0<P;){var Y=31-Le(P),ee=1<<Y,fe=C[Y];fe===-1?((ee&E)===0||(ee&S)!==0)&&(C[Y]=we(ee,f)):fe<=f&&(d.expiredLanes|=ee),P&=~ee}if(f=Jn,E=hn,E=de(d,d===f?E:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),S=d.callbackNode,E===0||d===f&&(Mn===2||Mn===9)||d.cancelPendingCommit!==null)return S!==null&&S!==null&&le(S),d.callbackNode=null,d.callbackPriority=0;if((E&3)===0||Ae(d,E)){if(f=E&-E,f===d.callbackPriority)return f;switch(S!==null&&le(S),un(E)){case 2:case 8:E=qe;break;case 32:E=Je;break;case 268435456:E=at;break;default:E=Je}return S=Kk.bind(null,d),E=xe(E,S),d.callbackPriority=f,d.callbackNode=E,f}return S!==null&&S!==null&&le(S),d.callbackPriority=2,d.callbackNode=null,2}function Kk(d,f){if(oa!==0&&oa!==5)return d.callbackNode=null,d.callbackPriority=0,null;var E=d.callbackNode;if($E()&&d.callbackNode!==E)return null;var S=hn;return S=de(d,d===Jn?S:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),S===0?null:(Lk(d,S,f),Xk(d,re()),d.callbackNode!=null&&d.callbackNode===E?Kk.bind(null,d):null)}function Qk(d,f){if($E())return null;Lk(d,f,!0)}function fte(){vte(function(){(Ln&6)!==0?xe($e,hte):Wk()})}function sv(){return vc===0&&(vc=Ie()),vc}function Jk(d){return d==null||typeof d=="symbol"||typeof d=="boolean"?null:typeof d=="function"?d:Zg(""+d)}function Zk(d,f){var E=f.ownerDocument.createElement("input");return E.name=f.name,E.value=f.value,d.id&&E.setAttribute("form",d.id),f.parentNode.insertBefore(E,f),d=new FormData(d),E.parentNode.removeChild(E),d}function mte(d,f,E,S,C){if(f==="submit"&&E&&E.stateNode===C){var P=Jk((C[Yt]||null).action),Y=S.submitter;Y&&(f=(f=Y[Yt]||null)?Jk(f.formAction):Y.getAttribute("formAction"),f!==null&&(P=f,Y=null));var ee=new rE("action","action",null,S,C);d.push({event:ee,listeners:[{instance:null,listener:function(){if(S.defaultPrevented){if(vc!==0){var fe=Y?Zk(C,Y):new FormData(C);Rb(E,{pending:!0,data:fe,method:C.method,action:P},null,fe)}}else typeof P=="function"&&(ee.preventDefault(),fe=Y?Zk(C,Y):new FormData(C),Rb(E,{pending:!0,data:fe,method:C.method,action:P},P,fe))},currentTarget:C}]})}}for(var iv=0;iv<GS.length;iv++){var ov=GS[iv],pte=ov.toLowerCase(),gte=ov[0].toUpperCase()+ov.slice(1);ti(pte,"on"+gte)}ti(LP,"onAnimationEnd"),ti(MP,"onAnimationIteration"),ti(DP,"onAnimationStart"),ti("dblclick","onDoubleClick"),ti("focusin","onFocus"),ti("focusout","onBlur"),ti(Mee,"onTransitionRun"),ti(Dee,"onTransitionStart"),ti(Pee,"onTransitionCancel"),ti(PP,"onTransitionEnd"),On("onMouseEnter",["mouseout","mouseover"]),On("onMouseLeave",["mouseout","mouseover"]),On("onPointerEnter",["pointerout","pointerover"]),On("onPointerLeave",["pointerout","pointerover"]),Vt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Ete=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Jf));function ej(d,f){f=(f&4)!==0;for(var E=0;E<d.length;E++){var S=d[E],C=S.event;S=S.listeners;e:{var P=void 0;if(f)for(var Y=S.length-1;0<=Y;Y--){var ee=S[Y],fe=ee.instance,ve=ee.currentTarget;if(ee=ee.listener,fe!==P&&C.isPropagationStopped())break e;P=ee,C.currentTarget=ve;try{P(C)}catch(Pe){CE(Pe)}C.currentTarget=null,P=fe}else for(Y=0;Y<S.length;Y++){if(ee=S[Y],fe=ee.instance,ve=ee.currentTarget,ee=ee.listener,fe!==P&&C.isPropagationStopped())break e;P=ee,C.currentTarget=ve;try{P(C)}catch(Pe){CE(Pe)}C.currentTarget=null,P=fe}}}}function on(d,f){var E=f[In];E===void 0&&(E=f[In]=new Set);var S=d+"__bubble";E.has(S)||(tj(f,d,2,!1),E.add(S))}function lv(d,f,E){var S=0;f&&(S|=4),tj(E,d,S,f)}var VE="_reactListening"+Math.random().toString(36).slice(2);function cv(d){if(!d[VE]){d[VE]=!0,wt.forEach(function(E){E!=="selectionchange"&&(Ete.has(E)||lv(E,!1,d),lv(E,!0,d))});var f=d.nodeType===9?d:d.ownerDocument;f===null||f[VE]||(f[VE]=!0,lv("selectionchange",!1,f))}}function tj(d,f,E,S){switch(Rj(f)){case 2:var C=Gte;break;case 8:C=zte;break;default:C=vv}E=C.bind(null,f,E,d),C=void 0,!OS||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(C=!0),S?C!==void 0?d.addEventListener(f,E,{capture:!0,passive:C}):d.addEventListener(f,E,!0):C!==void 0?d.addEventListener(f,E,{passive:C}):d.addEventListener(f,E,!1)}function uv(d,f,E,S,C){var P=S;if((f&1)===0&&(f&2)===0&&S!==null)e:for(;;){if(S===null)return;var Y=S.tag;if(Y===3||Y===4){var ee=S.stateNode.containerInfo;if(ee===C)break;if(Y===4)for(Y=S.return;Y!==null;){var fe=Y.tag;if((fe===3||fe===4)&&Y.stateNode.containerInfo===C)return;Y=Y.return}for(;ee!==null;){if(Y=dt(ee),Y===null)return;if(fe=Y.tag,fe===5||fe===6||fe===26||fe===27){S=P=Y;continue e}ee=ee.parentNode}}S=S.return}lP(function(){var ve=P,Pe=CS(E),He=[];e:{var Re=kP.get(d);if(Re!==void 0){var Ne=rE,Ft=d;switch(d){case"keypress":if(tE(E)===0)break e;case"keydown":case"keyup":Ne=dee;break;case"focusin":Ft="focus",Ne=PS;break;case"focusout":Ft="blur",Ne=PS;break;case"beforeblur":case"afterblur":Ne=PS;break;case"click":if(E.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=dP;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=ZZ;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=mee;break;case LP:case MP:case DP:Ne=nee;break;case PP:Ne=gee;break;case"scroll":case"scrollend":Ne=QZ;break;case"wheel":Ne=Tee;break;case"copy":case"cut":case"paste":Ne=aee;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=fP;break;case"toggle":case"beforetoggle":Ne=xee}var Lt=(f&4)!==0,$n=!Lt&&(d==="scroll"||d==="scrollend"),ye=Lt?Re!==null?Re+"Capture":null:Re;Lt=[];for(var ge=ve,be;ge!==null;){var Be=ge;if(be=Be.stateNode,Be=Be.tag,Be!==5&&Be!==26&&Be!==27||be===null||ye===null||(Be=Ef(ge,ye),Be!=null&&Lt.push(Zf(ge,Be,be))),$n)break;ge=ge.return}0<Lt.length&&(Re=new Ne(Re,Ft,null,E,Pe),He.push({event:Re,listeners:Lt}))}}if((f&7)===0){e:{if(Re=d==="mouseover"||d==="pointerover",Ne=d==="mouseout"||d==="pointerout",Re&&E!==wS&&(Ft=E.relatedTarget||E.fromElement)&&(dt(Ft)||Ft[tn]))break e;if((Ne||Re)&&(Re=Pe.window===Pe?Pe:(Re=Pe.ownerDocument)?Re.defaultView||Re.parentWindow:window,Ne?(Ft=E.relatedTarget||E.toElement,Ne=ve,Ft=Ft?dt(Ft):null,Ft!==null&&($n=s(Ft),Lt=Ft.tag,Ft!==$n||Lt!==5&&Lt!==27&&Lt!==6)&&(Ft=null)):(Ne=null,Ft=ve),Ne!==Ft)){if(Lt=dP,Be="onMouseLeave",ye="onMouseEnter",ge="mouse",(d==="pointerout"||d==="pointerover")&&(Lt=fP,Be="onPointerLeave",ye="onPointerEnter",ge="pointer"),$n=Ne==null?Re:jn(Ne),be=Ft==null?Re:jn(Ft),Re=new Lt(Be,ge+"leave",Ne,E,Pe),Re.target=$n,Re.relatedTarget=be,Be=null,dt(Pe)===ve&&(Lt=new Lt(ye,ge+"enter",Ft,E,Pe),Lt.target=be,Lt.relatedTarget=$n,Be=Lt),$n=Be,Ne&&Ft)t:{for(Lt=Ne,ye=Ft,ge=0,be=Lt;be;be=Ed(be))ge++;for(be=0,Be=ye;Be;Be=Ed(Be))be++;for(;0<ge-be;)Lt=Ed(Lt),ge--;for(;0<be-ge;)ye=Ed(ye),be--;for(;ge--;){if(Lt===ye||ye!==null&&Lt===ye.alternate)break t;Lt=Ed(Lt),ye=Ed(ye)}Lt=null}else Lt=null;Ne!==null&&nj(He,Re,Ne,Lt,!1),Ft!==null&&$n!==null&&nj(He,$n,Ft,Lt,!0)}}e:{if(Re=ve?jn(ve):window,Ne=Re.nodeName&&Re.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&Re.type==="file")var gt=SP;else if(yP(Re))if(bP)gt=Iee;else{gt=wee;var rn=_ee}else Ne=Re.nodeName,!Ne||Ne.toLowerCase()!=="input"||Re.type!=="checkbox"&&Re.type!=="radio"?ve&&_S(ve.elementType)&&(gt=SP):gt=Cee;if(gt&&(gt=gt(d,ve))){xP(He,gt,E,Pe);break e}rn&&rn(d,Re,ve),d==="focusout"&&ve&&Re.type==="number"&&ve.memoizedProps.value!=null&&Ea(Re,"number",Re.value)}switch(rn=ve?jn(ve):window,d){case"focusin":(yP(rn)||rn.contentEditable==="true")&&(Yu=rn,BS=ve,Rf=null);break;case"focusout":Rf=BS=Yu=null;break;case"mousedown":HS=!0;break;case"contextmenu":case"mouseup":case"dragend":HS=!1,IP(He,E,Pe);break;case"selectionchange":if(Lee)break;case"keydown":case"keyup":IP(He,E,Pe)}var St;if(jS)e:{switch(d){case"compositionstart":var Mt="onCompositionStart";break e;case"compositionend":Mt="onCompositionEnd";break e;case"compositionupdate":Mt="onCompositionUpdate";break e}Mt=void 0}else qu?EP(d,E)&&(Mt="onCompositionEnd"):d==="keydown"&&E.keyCode===229&&(Mt="onCompositionStart");Mt&&(mP&&E.locale!=="ko"&&(qu||Mt!=="onCompositionStart"?Mt==="onCompositionEnd"&&qu&&(St=cP()):(Ko=Pe,LS="value"in Ko?Ko.value:Ko.textContent,qu=!0)),rn=GE(ve,Mt),0<rn.length&&(Mt=new hP(Mt,d,null,E,Pe),He.push({event:Mt,listeners:rn}),St?Mt.data=St:(St=TP(E),St!==null&&(Mt.data=St)))),(St=bee?vee(d,E):Aee(d,E))&&(Mt=GE(ve,"onBeforeInput"),0<Mt.length&&(rn=new hP("onBeforeInput","beforeinput",null,E,Pe),He.push({event:rn,listeners:Mt}),rn.data=St)),mte(He,d,ve,E,Pe)}ej(He,f)})}function Zf(d,f,E){return{instance:d,listener:f,currentTarget:E}}function GE(d,f){for(var E=f+"Capture",S=[];d!==null;){var C=d,P=C.stateNode;if(C=C.tag,C!==5&&C!==26&&C!==27||P===null||(C=Ef(d,E),C!=null&&S.unshift(Zf(d,C,P)),C=Ef(d,f),C!=null&&S.push(Zf(d,C,P))),d.tag===3)return S;d=d.return}return[]}function Ed(d){if(d===null)return null;do d=d.return;while(d&&d.tag!==5&&d.tag!==27);return d||null}function nj(d,f,E,S,C){for(var P=f._reactName,Y=[];E!==null&&E!==S;){var ee=E,fe=ee.alternate,ve=ee.stateNode;if(ee=ee.tag,fe!==null&&fe===S)break;ee!==5&&ee!==26&&ee!==27||ve===null||(fe=ve,C?(ve=Ef(E,P),ve!=null&&Y.unshift(Zf(E,ve,fe))):C||(ve=Ef(E,P),ve!=null&&Y.push(Zf(E,ve,fe)))),E=E.return}Y.length!==0&&d.push({event:f,listeners:Y})}var Tte=/\r\n?/g,yte=/\u0000|\uFFFD/g;function rj(d){return(typeof d=="string"?d:""+d).replace(Tte,"\n").replace(yte,"")}function aj(d,f){return f=rj(f),rj(d)===f}function zE(){}function Fn(d,f,E,S,C,P){switch(E){case"children":typeof S=="string"?f==="body"||f==="textarea"&&S===""||bi(d,S):(typeof S=="number"||typeof S=="bigint")&&f!=="body"&&bi(d,""+S);break;case"className":Ar(d,"class",S);break;case"tabIndex":Ar(d,"tabindex",S);break;case"dir":case"role":case"viewBox":case"width":case"height":Ar(d,E,S);break;case"style":iP(d,S,P);break;case"data":if(f!=="object"){Ar(d,"data",S);break}case"src":case"href":if(S===""&&(f!=="a"||E!=="href")){d.removeAttribute(E);break}if(S==null||typeof S=="function"||typeof S=="symbol"||typeof S=="boolean"){d.removeAttribute(E);break}S=Zg(""+S),d.setAttribute(E,S);break;case"action":case"formAction":if(typeof S=="function"){d.setAttribute(E,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof P=="function"&&(E==="formAction"?(f!=="input"&&Fn(d,f,"name",C.name,C,null),Fn(d,f,"formEncType",C.formEncType,C,null),Fn(d,f,"formMethod",C.formMethod,C,null),Fn(d,f,"formTarget",C.formTarget,C,null)):(Fn(d,f,"encType",C.encType,C,null),Fn(d,f,"method",C.method,C,null),Fn(d,f,"target",C.target,C,null)));if(S==null||typeof S=="symbol"||typeof S=="boolean"){d.removeAttribute(E);break}S=Zg(""+S),d.setAttribute(E,S);break;case"onClick":S!=null&&(d.onclick=zE);break;case"onScroll":S!=null&&on("scroll",d);break;case"onScrollEnd":S!=null&&on("scrollend",d);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("__html"in S))throw Error(r(61));if(E=S.__html,E!=null){if(C.children!=null)throw Error(r(60));d.innerHTML=E}}break;case"multiple":d.multiple=S&&typeof S!="function"&&typeof S!="symbol";break;case"muted":d.muted=S&&typeof S!="function"&&typeof S!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(S==null||typeof S=="function"||typeof S=="boolean"||typeof S=="symbol"){d.removeAttribute("xlink:href");break}E=Zg(""+S),d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",E);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":S!=null&&typeof S!="function"&&typeof S!="symbol"?d.setAttribute(E,""+S):d.removeAttribute(E);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":S&&typeof S!="function"&&typeof S!="symbol"?d.setAttribute(E,""):d.removeAttribute(E);break;case"capture":case"download":S===!0?d.setAttribute(E,""):S!==!1&&S!=null&&typeof S!="function"&&typeof S!="symbol"?d.setAttribute(E,S):d.removeAttribute(E);break;case"cols":case"rows":case"size":case"span":S!=null&&typeof S!="function"&&typeof S!="symbol"&&!isNaN(S)&&1<=S?d.setAttribute(E,S):d.removeAttribute(E);break;case"rowSpan":case"start":S==null||typeof S=="function"||typeof S=="symbol"||isNaN(S)?d.removeAttribute(E):d.setAttribute(E,S);break;case"popover":on("beforetoggle",d),on("toggle",d),or(d,"popover",S);break;case"xlinkActuate":hr(d,"http://www.w3.org/1999/xlink","xlink:actuate",S);break;case"xlinkArcrole":hr(d,"http://www.w3.org/1999/xlink","xlink:arcrole",S);break;case"xlinkRole":hr(d,"http://www.w3.org/1999/xlink","xlink:role",S);break;case"xlinkShow":hr(d,"http://www.w3.org/1999/xlink","xlink:show",S);break;case"xlinkTitle":hr(d,"http://www.w3.org/1999/xlink","xlink:title",S);break;case"xlinkType":hr(d,"http://www.w3.org/1999/xlink","xlink:type",S);break;case"xmlBase":hr(d,"http://www.w3.org/XML/1998/namespace","xml:base",S);break;case"xmlLang":hr(d,"http://www.w3.org/XML/1998/namespace","xml:lang",S);break;case"xmlSpace":hr(d,"http://www.w3.org/XML/1998/namespace","xml:space",S);break;case"is":or(d,"is",S);break;case"innerText":case"textContent":break;default:(!(2<E.length)||E[0]!=="o"&&E[0]!=="O"||E[1]!=="n"&&E[1]!=="N")&&(E=XZ.get(E)||E,or(d,E,S))}}function dv(d,f,E,S,C,P){switch(E){case"style":iP(d,S,P);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("__html"in S))throw Error(r(61));if(E=S.__html,E!=null){if(C.children!=null)throw Error(r(60));d.innerHTML=E}}break;case"children":typeof S=="string"?bi(d,S):(typeof S=="number"||typeof S=="bigint")&&bi(d,""+S);break;case"onScroll":S!=null&&on("scroll",d);break;case"onScrollEnd":S!=null&&on("scrollend",d);break;case"onClick":S!=null&&(d.onclick=zE);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ct.hasOwnProperty(E))e:{if(E[0]==="o"&&E[1]==="n"&&(C=E.endsWith("Capture"),f=E.slice(2,C?E.length-7:void 0),P=d[Yt]||null,P=P!=null?P[E]:null,typeof P=="function"&&d.removeEventListener(f,P,C),typeof S=="function")){typeof P!="function"&&P!==null&&(E in d?d[E]=null:d.hasAttribute(E)&&d.removeAttribute(E)),d.addEventListener(f,S,C);break e}E in d?d[E]=S:S===!0?d.setAttribute(E,""):or(d,E,S)}}}function la(d,f,E){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":on("error",d),on("load",d);var S=!1,C=!1,P;for(P in E)if(E.hasOwnProperty(P)){var Y=E[P];if(Y!=null)switch(P){case"src":S=!0;break;case"srcSet":C=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:Fn(d,f,P,Y,E,null)}}C&&Fn(d,f,"srcSet",E.srcSet,E,null),S&&Fn(d,f,"src",E.src,E,null);return;case"input":on("invalid",d);var ee=P=Y=C=null,fe=null,ve=null;for(S in E)if(E.hasOwnProperty(S)){var Pe=E[S];if(Pe!=null)switch(S){case"name":C=Pe;break;case"type":Y=Pe;break;case"checked":fe=Pe;break;case"defaultChecked":ve=Pe;break;case"value":P=Pe;break;case"defaultValue":ee=Pe;break;case"children":case"dangerouslySetInnerHTML":if(Pe!=null)throw Error(r(137,f));break;default:Fn(d,f,S,Pe,E,null)}}gf(d,P,ee,fe,ve,Y,C,!1),Wo(d);return;case"select":on("invalid",d),S=Y=P=null;for(C in E)if(E.hasOwnProperty(C)&&(ee=E[C],ee!=null))switch(C){case"value":P=ee;break;case"defaultValue":Y=ee;break;case"multiple":S=ee;default:Fn(d,f,C,ee,E,null)}f=P,E=Y,d.multiple=!!S,f!=null?Xo(d,!!S,f,!1):E!=null&&Xo(d,!!S,E,!0);return;case"textarea":on("invalid",d),P=C=S=null;for(Y in E)if(E.hasOwnProperty(Y)&&(ee=E[Y],ee!=null))switch(Y){case"value":S=ee;break;case"defaultValue":C=ee;break;case"children":P=ee;break;case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(91));break;default:Fn(d,f,Y,ee,E,null)}Si(d,S,C,P),Wo(d);return;case"option":for(fe in E)if(E.hasOwnProperty(fe)&&(S=E[fe],S!=null))switch(fe){case"selected":d.selected=S&&typeof S!="function"&&typeof S!="symbol";break;default:Fn(d,f,fe,S,E,null)}return;case"dialog":on("beforetoggle",d),on("toggle",d),on("cancel",d),on("close",d);break;case"iframe":case"object":on("load",d);break;case"video":case"audio":for(S=0;S<Jf.length;S++)on(Jf[S],d);break;case"image":on("error",d),on("load",d);break;case"details":on("toggle",d);break;case"embed":case"source":case"link":on("error",d),on("load",d);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ve in E)if(E.hasOwnProperty(ve)&&(S=E[ve],S!=null))switch(ve){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:Fn(d,f,ve,S,E,null)}return;default:if(_S(f)){for(Pe in E)E.hasOwnProperty(Pe)&&(S=E[Pe],S!==void 0&&dv(d,f,Pe,S,E,void 0));return}}for(ee in E)E.hasOwnProperty(ee)&&(S=E[ee],S!=null&&Fn(d,f,ee,S,E,null))}function xte(d,f,E,S){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var C=null,P=null,Y=null,ee=null,fe=null,ve=null,Pe=null;for(Ne in E){var He=E[Ne];if(E.hasOwnProperty(Ne)&&He!=null)switch(Ne){case"checked":break;case"value":break;case"defaultValue":fe=He;default:S.hasOwnProperty(Ne)||Fn(d,f,Ne,null,S,He)}}for(var Re in S){var Ne=S[Re];if(He=E[Re],S.hasOwnProperty(Re)&&(Ne!=null||He!=null))switch(Re){case"type":P=Ne;break;case"name":C=Ne;break;case"checked":ve=Ne;break;case"defaultChecked":Pe=Ne;break;case"value":Y=Ne;break;case"defaultValue":ee=Ne;break;case"children":case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(r(137,f));break;default:Ne!==He&&Fn(d,f,Re,Ne,S,He)}}so(d,Y,ee,fe,ve,Pe,P,C);return;case"select":Ne=Y=ee=Re=null;for(P in E)if(fe=E[P],E.hasOwnProperty(P)&&fe!=null)switch(P){case"value":break;case"multiple":Ne=fe;default:S.hasOwnProperty(P)||Fn(d,f,P,null,S,fe)}for(C in S)if(P=S[C],fe=E[C],S.hasOwnProperty(C)&&(P!=null||fe!=null))switch(C){case"value":Re=P;break;case"defaultValue":ee=P;break;case"multiple":Y=P;default:P!==fe&&Fn(d,f,C,P,S,fe)}f=ee,E=Y,S=Ne,Re!=null?Xo(d,!!E,Re,!1):!!S!=!!E&&(f!=null?Xo(d,!!E,f,!0):Xo(d,!!E,E?[]:"",!1));return;case"textarea":Ne=Re=null;for(ee in E)if(C=E[ee],E.hasOwnProperty(ee)&&C!=null&&!S.hasOwnProperty(ee))switch(ee){case"value":break;case"children":break;default:Fn(d,f,ee,null,S,C)}for(Y in S)if(C=S[Y],P=E[Y],S.hasOwnProperty(Y)&&(C!=null||P!=null))switch(Y){case"value":Re=C;break;case"defaultValue":Ne=C;break;case"children":break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(r(91));break;default:C!==P&&Fn(d,f,Y,C,S,P)}Jg(d,Re,Ne);return;case"option":for(var Ft in E)if(Re=E[Ft],E.hasOwnProperty(Ft)&&Re!=null&&!S.hasOwnProperty(Ft))switch(Ft){case"selected":d.selected=!1;break;default:Fn(d,f,Ft,null,S,Re)}for(fe in S)if(Re=S[fe],Ne=E[fe],S.hasOwnProperty(fe)&&Re!==Ne&&(Re!=null||Ne!=null))switch(fe){case"selected":d.selected=Re&&typeof Re!="function"&&typeof Re!="symbol";break;default:Fn(d,f,fe,Re,S,Ne)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Lt in E)Re=E[Lt],E.hasOwnProperty(Lt)&&Re!=null&&!S.hasOwnProperty(Lt)&&Fn(d,f,Lt,null,S,Re);for(ve in S)if(Re=S[ve],Ne=E[ve],S.hasOwnProperty(ve)&&Re!==Ne&&(Re!=null||Ne!=null))switch(ve){case"children":case"dangerouslySetInnerHTML":if(Re!=null)throw Error(r(137,f));break;default:Fn(d,f,ve,Re,S,Ne)}return;default:if(_S(f)){for(var $n in E)Re=E[$n],E.hasOwnProperty($n)&&Re!==void 0&&!S.hasOwnProperty($n)&&dv(d,f,$n,void 0,S,Re);for(Pe in S)Re=S[Pe],Ne=E[Pe],!S.hasOwnProperty(Pe)||Re===Ne||Re===void 0&&Ne===void 0||dv(d,f,Pe,Re,S,Ne);return}}for(var ye in E)Re=E[ye],E.hasOwnProperty(ye)&&Re!=null&&!S.hasOwnProperty(ye)&&Fn(d,f,ye,null,S,Re);for(He in S)Re=S[He],Ne=E[He],!S.hasOwnProperty(He)||Re===Ne||Re==null&&Ne==null||Fn(d,f,He,Re,S,Ne)}var hv=null,fv=null;function qE(d){return d.nodeType===9?d:d.ownerDocument}function sj(d){switch(d){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ij(d,f){if(d===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return d===1&&f==="foreignObject"?0:d}function mv(d,f){return d==="textarea"||d==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var pv=null;function Ste(){var d=window.event;return d&&d.type==="popstate"?d===pv?!1:(pv=d,!0):(pv=null,!1)}var oj=typeof setTimeout=="function"?setTimeout:void 0,bte=typeof clearTimeout=="function"?clearTimeout:void 0,lj=typeof Promise=="function"?Promise:void 0,vte=typeof queueMicrotask=="function"?queueMicrotask:typeof lj!="undefined"?function(d){return lj.resolve(null).then(d).catch(Ate)}:oj;function Ate(d){setTimeout(function(){throw d})}function hl(d){return d==="head"}function cj(d,f){var E=f,S=0,C=0;do{var P=E.nextSibling;if(d.removeChild(E),P&&P.nodeType===8)if(E=P.data,E==="/$"){if(0<S&&8>S){E=S;var Y=d.ownerDocument;if(E&1&&em(Y.documentElement),E&2&&em(Y.body),E&4)for(E=Y.head,em(E),Y=E.firstChild;Y;){var ee=Y.nextSibling,fe=Y.nodeName;Y[dr]||fe==="SCRIPT"||fe==="STYLE"||fe==="LINK"&&Y.rel.toLowerCase()==="stylesheet"||E.removeChild(Y),Y=ee}}if(C===0){d.removeChild(P),lm(f);return}C--}else E==="$"||E==="$?"||E==="$!"?C++:S=E.charCodeAt(0)-48;else S=0;E=P}while(E);lm(f)}function gv(d){var f=d.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var E=f;switch(f=f.nextSibling,E.nodeName){case"HTML":case"HEAD":case"BODY":gv(E),kn(E);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(E.rel.toLowerCase()==="stylesheet")continue}d.removeChild(E)}}function Rte(d,f,E,S){for(;d.nodeType===1;){var C=E;if(d.nodeName.toLowerCase()!==f.toLowerCase()){if(!S&&(d.nodeName!=="INPUT"||d.type!=="hidden"))break}else if(S){if(!d[dr])switch(f){case"meta":if(!d.hasAttribute("itemprop"))break;return d;case"link":if(P=d.getAttribute("rel"),P==="stylesheet"&&d.hasAttribute("data-precedence"))break;if(P!==C.rel||d.getAttribute("href")!==(C.href==null||C.href===""?null:C.href)||d.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin)||d.getAttribute("title")!==(C.title==null?null:C.title))break;return d;case"style":if(d.hasAttribute("data-precedence"))break;return d;case"script":if(P=d.getAttribute("src"),(P!==(C.src==null?null:C.src)||d.getAttribute("type")!==(C.type==null?null:C.type)||d.getAttribute("crossorigin")!==(C.crossOrigin==null?null:C.crossOrigin))&&P&&d.hasAttribute("async")&&!d.hasAttribute("itemprop"))break;return d;default:return d}}else if(f==="input"&&d.type==="hidden"){var P=C.name==null?null:""+C.name;if(C.type==="hidden"&&d.getAttribute("name")===P)return d}else return d;if(d=ri(d.nextSibling),d===null)break}return null}function Nte(d,f,E){if(f==="")return null;for(;d.nodeType!==3;)if((d.nodeType!==1||d.nodeName!=="INPUT"||d.type!=="hidden")&&!E||(d=ri(d.nextSibling),d===null))return null;return d}function Ev(d){return d.data==="$!"||d.data==="$?"&&d.ownerDocument.readyState==="complete"}function _te(d,f){var E=d.ownerDocument;if(d.data!=="$?"||E.readyState==="complete")f();else{var S=function(){f(),E.removeEventListener("DOMContentLoaded",S)};E.addEventListener("DOMContentLoaded",S),d._reactRetry=S}}function ri(d){for(;d!=null;d=d.nextSibling){var f=d.nodeType;if(f===1||f===3)break;if(f===8){if(f=d.data,f==="$"||f==="$!"||f==="$?"||f==="F!"||f==="F")break;if(f==="/$")return null}}return d}var Tv=null;function uj(d){d=d.previousSibling;for(var f=0;d;){if(d.nodeType===8){var E=d.data;if(E==="$"||E==="$!"||E==="$?"){if(f===0)return d;f--}else E==="/$"&&f++}d=d.previousSibling}return null}function dj(d,f,E){switch(f=qE(E),d){case"html":if(d=f.documentElement,!d)throw Error(r(452));return d;case"head":if(d=f.head,!d)throw Error(r(453));return d;case"body":if(d=f.body,!d)throw Error(r(454));return d;default:throw Error(r(451))}}function em(d){for(var f=d.attributes;f.length;)d.removeAttributeNode(f[0]);kn(d)}var Ls=new Map,hj=new Set;function YE(d){return typeof d.getRootNode=="function"?d.getRootNode():d.nodeType===9?d:d.ownerDocument}var xo=G.d;G.d={f:wte,r:Cte,D:Ite,C:Ote,L:Lte,m:Mte,X:Pte,S:Dte,M:kte};function wte(){var d=xo.f(),f=UE();return d||f}function Cte(d){var f=kt(d);f!==null&&f.tag===5&&f.type==="form"?L2(f):xo.r(d)}var Td=typeof document=="undefined"?null:document;function fj(d,f,E){var S=Td;if(S&&typeof f=="string"&&f){var C=Ua(f);C='link[rel="'+d+'"][href="'+C+'"]',typeof E=="string"&&(C+='[crossorigin="'+E+'"]'),hj.has(C)||(hj.add(C),d={rel:d,crossOrigin:E,href:f},S.querySelector(C)===null&&(f=S.createElement("link"),la(f,"link",d),Wt(f),S.head.appendChild(f)))}}function Ite(d){xo.D(d),fj("dns-prefetch",d,null)}function Ote(d,f){xo.C(d,f),fj("preconnect",d,f)}function Lte(d,f,E){xo.L(d,f,E);var S=Td;if(S&&d&&f){var C='link[rel="preload"][as="'+Ua(f)+'"]';f==="image"&&E&&E.imageSrcSet?(C+='[imagesrcset="'+Ua(E.imageSrcSet)+'"]',typeof E.imageSizes=="string"&&(C+='[imagesizes="'+Ua(E.imageSizes)+'"]')):C+='[href="'+Ua(d)+'"]';var P=C;switch(f){case"style":P=yd(d);break;case"script":P=xd(d)}Ls.has(P)||(d=h({rel:"preload",href:f==="image"&&E&&E.imageSrcSet?void 0:d,as:f},E),Ls.set(P,d),S.querySelector(C)!==null||f==="style"&&S.querySelector(tm(P))||f==="script"&&S.querySelector(nm(P))||(f=S.createElement("link"),la(f,"link",d),Wt(f),S.head.appendChild(f)))}}function Mte(d,f){xo.m(d,f);var E=Td;if(E&&d){var S=f&&typeof f.as=="string"?f.as:"script",C='link[rel="modulepreload"][as="'+Ua(S)+'"][href="'+Ua(d)+'"]',P=C;switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":P=xd(d)}if(!Ls.has(P)&&(d=h({rel:"modulepreload",href:d},f),Ls.set(P,d),E.querySelector(C)===null)){switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(E.querySelector(nm(P)))return}S=E.createElement("link"),la(S,"link",d),Wt(S),E.head.appendChild(S)}}}function Dte(d,f,E){xo.S(d,f,E);var S=Td;if(S&&d){var C=Gn(S).hoistableStyles,P=yd(d);f=f||"default";var Y=C.get(P);if(!Y){var ee={loading:0,preload:null};if(Y=S.querySelector(tm(P)))ee.loading=5;else{d=h({rel:"stylesheet",href:d,"data-precedence":f},E),(E=Ls.get(P))&&yv(d,E);var fe=Y=S.createElement("link");Wt(fe),la(fe,"link",d),fe._p=new Promise(function(ve,Pe){fe.onload=ve,fe.onerror=Pe}),fe.addEventListener("load",function(){ee.loading|=1}),fe.addEventListener("error",function(){ee.loading|=2}),ee.loading|=4,WE(Y,f,S)}Y={type:"stylesheet",instance:Y,count:1,state:ee},C.set(P,Y)}}}function Pte(d,f){xo.X(d,f);var E=Td;if(E&&d){var S=Gn(E).hoistableScripts,C=xd(d),P=S.get(C);P||(P=E.querySelector(nm(C)),P||(d=h({src:d,async:!0},f),(f=Ls.get(C))&&xv(d,f),P=E.createElement("script"),Wt(P),la(P,"link",d),E.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},S.set(C,P))}}function kte(d,f){xo.M(d,f);var E=Td;if(E&&d){var S=Gn(E).hoistableScripts,C=xd(d),P=S.get(C);P||(P=E.querySelector(nm(C)),P||(d=h({src:d,async:!0,type:"module"},f),(f=Ls.get(C))&&xv(d,f),P=E.createElement("script"),Wt(P),la(P,"link",d),E.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},S.set(C,P))}}function mj(d,f,E,S){var C=(C=ne.current)?YE(C):null;if(!C)throw Error(r(446));switch(d){case"meta":case"title":return null;case"style":return typeof E.precedence=="string"&&typeof E.href=="string"?(f=yd(E.href),E=Gn(C).hoistableStyles,S=E.get(f),S||(S={type:"style",instance:null,count:0,state:null},E.set(f,S)),S):{type:"void",instance:null,count:0,state:null};case"link":if(E.rel==="stylesheet"&&typeof E.href=="string"&&typeof E.precedence=="string"){d=yd(E.href);var P=Gn(C).hoistableStyles,Y=P.get(d);if(Y||(C=C.ownerDocument||C,Y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},P.set(d,Y),(P=C.querySelector(tm(d)))&&!P._p&&(Y.instance=P,Y.state.loading=5),Ls.has(d)||(E={rel:"preload",as:"style",href:E.href,crossOrigin:E.crossOrigin,integrity:E.integrity,media:E.media,hrefLang:E.hrefLang,referrerPolicy:E.referrerPolicy},Ls.set(d,E),P||jte(C,d,E,Y.state))),f&&S===null)throw Error(r(528,""));return Y}if(f&&S!==null)throw Error(r(529,""));return null;case"script":return f=E.async,E=E.src,typeof E=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=xd(E),E=Gn(C).hoistableScripts,S=E.get(f),S||(S={type:"script",instance:null,count:0,state:null},E.set(f,S)),S):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,d))}}function yd(d){return'href="'+Ua(d)+'"'}function tm(d){return'link[rel="stylesheet"]['+d+"]"}function pj(d){return h({},d,{"data-precedence":d.precedence,precedence:null})}function jte(d,f,E,S){d.querySelector('link[rel="preload"][as="style"]['+f+"]")?S.loading=1:(f=d.createElement("link"),S.preload=f,f.addEventListener("load",function(){return S.loading|=1}),f.addEventListener("error",function(){return S.loading|=2}),la(f,"link",E),Wt(f),d.head.appendChild(f))}function xd(d){return'[src="'+Ua(d)+'"]'}function nm(d){return"script[async]"+d}function gj(d,f,E){if(f.count++,f.instance===null)switch(f.type){case"style":var S=d.querySelector('style[data-href~="'+Ua(E.href)+'"]');if(S)return f.instance=S,Wt(S),S;var C=h({},E,{"data-href":E.href,"data-precedence":E.precedence,href:null,precedence:null});return S=(d.ownerDocument||d).createElement("style"),Wt(S),la(S,"style",C),WE(S,E.precedence,d),f.instance=S;case"stylesheet":C=yd(E.href);var P=d.querySelector(tm(C));if(P)return f.state.loading|=4,f.instance=P,Wt(P),P;S=pj(E),(C=Ls.get(C))&&yv(S,C),P=(d.ownerDocument||d).createElement("link"),Wt(P);var Y=P;return Y._p=new Promise(function(ee,fe){Y.onload=ee,Y.onerror=fe}),la(P,"link",S),f.state.loading|=4,WE(P,E.precedence,d),f.instance=P;case"script":return P=xd(E.src),(C=d.querySelector(nm(P)))?(f.instance=C,Wt(C),C):(S=E,(C=Ls.get(P))&&(S=h({},E),xv(S,C)),d=d.ownerDocument||d,C=d.createElement("script"),Wt(C),la(C,"link",S),d.head.appendChild(C),f.instance=C);case"void":return null;default:throw Error(r(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(S=f.instance,f.state.loading|=4,WE(S,E.precedence,d));return f.instance}function WE(d,f,E){for(var S=E.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),C=S.length?S[S.length-1]:null,P=C,Y=0;Y<S.length;Y++){var ee=S[Y];if(ee.dataset.precedence===f)P=ee;else if(P!==C)break}P?P.parentNode.insertBefore(d,P.nextSibling):(f=E.nodeType===9?E.head:E,f.insertBefore(d,f.firstChild))}function yv(d,f){d.crossOrigin==null&&(d.crossOrigin=f.crossOrigin),d.referrerPolicy==null&&(d.referrerPolicy=f.referrerPolicy),d.title==null&&(d.title=f.title)}function xv(d,f){d.crossOrigin==null&&(d.crossOrigin=f.crossOrigin),d.referrerPolicy==null&&(d.referrerPolicy=f.referrerPolicy),d.integrity==null&&(d.integrity=f.integrity)}var XE=null;function Ej(d,f,E){if(XE===null){var S=new Map,C=XE=new Map;C.set(E,S)}else C=XE,S=C.get(E),S||(S=new Map,C.set(E,S));if(S.has(d))return S;for(S.set(d,null),E=E.getElementsByTagName(d),C=0;C<E.length;C++){var P=E[C];if(!(P[dr]||P[yt]||d==="link"&&P.getAttribute("rel")==="stylesheet")&&P.namespaceURI!=="http://www.w3.org/2000/svg"){var Y=P.getAttribute(f)||"";Y=d+Y;var ee=S.get(Y);ee?ee.push(P):S.set(Y,[P])}}return S}function Tj(d,f,E){d=d.ownerDocument||d,d.head.insertBefore(E,f==="title"?d.querySelector("head > title"):null)}function Ute(d,f,E){if(E===1||f.itemProp!=null)return!1;switch(d){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return d=f.disabled,typeof f.precedence=="string"&&d==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function yj(d){return!(d.type==="stylesheet"&&(d.state.loading&3)===0)}var rm=null;function Fte(){}function $te(d,f,E){if(rm===null)throw Error(r(475));var S=rm;if(f.type==="stylesheet"&&(typeof E.media!="string"||matchMedia(E.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var C=yd(E.href),P=d.querySelector(tm(C));if(P){d=P._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(S.count++,S=KE.bind(S),d.then(S,S)),f.state.loading|=4,f.instance=P,Wt(P);return}P=d.ownerDocument||d,E=pj(E),(C=Ls.get(C))&&yv(E,C),P=P.createElement("link"),Wt(P);var Y=P;Y._p=new Promise(function(ee,fe){Y.onload=ee,Y.onerror=fe}),la(P,"link",E),f.instance=P}S.stylesheets===null&&(S.stylesheets=new Map),S.stylesheets.set(f,d),(d=f.state.preload)&&(f.state.loading&3)===0&&(S.count++,f=KE.bind(S),d.addEventListener("load",f),d.addEventListener("error",f))}}function Bte(){if(rm===null)throw Error(r(475));var d=rm;return d.stylesheets&&d.count===0&&Sv(d,d.stylesheets),0<d.count?function(f){var E=setTimeout(function(){if(d.stylesheets&&Sv(d,d.stylesheets),d.unsuspend){var S=d.unsuspend;d.unsuspend=null,S()}},6e4);return d.unsuspend=f,function(){d.unsuspend=null,clearTimeout(E)}}:null}function KE(){if(this.count--,this.count===0){if(this.stylesheets)Sv(this,this.stylesheets);else if(this.unsuspend){var d=this.unsuspend;this.unsuspend=null,d()}}}var QE=null;function Sv(d,f){d.stylesheets=null,d.unsuspend!==null&&(d.count++,QE=new Map,f.forEach(Hte,d),QE=null,KE.call(d))}function Hte(d,f){if(!(f.state.loading&4)){var E=QE.get(d);if(E)var S=E.get(null);else{E=new Map,QE.set(d,E);for(var C=d.querySelectorAll("link[data-precedence],style[data-precedence]"),P=0;P<C.length;P++){var Y=C[P];(Y.nodeName==="LINK"||Y.getAttribute("media")!=="not all")&&(E.set(Y.dataset.precedence,Y),S=Y)}S&&E.set(null,S)}C=f.instance,Y=C.getAttribute("data-precedence"),P=E.get(Y)||S,P===S&&E.set(null,C),E.set(Y,C),this.count++,S=KE.bind(this),C.addEventListener("load",S),C.addEventListener("error",S),P?P.parentNode.insertBefore(C,P.nextSibling):(d=d.nodeType===9?d.head:d,d.insertBefore(C,d.firstChild)),f.state.loading|=4}}var am={$$typeof:A,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Vte(d,f,E,S,C,P,Y,ee){this.tag=1,this.containerInfo=d,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=it(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=it(0),this.hiddenUpdates=it(null),this.identifierPrefix=S,this.onUncaughtError=C,this.onCaughtError=P,this.onRecoverableError=Y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ee,this.incompleteTransitions=new Map}function xj(d,f,E,S,C,P,Y,ee,fe,ve,Pe,He){return d=new Vte(d,f,E,Y,ee,fe,ve,He),f=1,P===!0&&(f|=24),P=ls(3,null,null,f),d.current=P,P.stateNode=d,f=nb(),f.refCount++,d.pooledCache=f,f.refCount++,P.memoizedState={element:S,isDehydrated:E,cache:f},ib(P),d}function Sj(d){return d?(d=Qu,d):Qu}function bj(d,f,E,S,C,P){C=Sj(C),S.context===null?S.context=C:S.pendingContext=C,S=Zo(f),S.payload={element:E},P=P===void 0?null:P,P!==null&&(S.callback=P),E=el(d,S,f),E!==null&&(fs(E,d,f),Df(E,d,f))}function vj(d,f){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var E=d.retryLane;d.retryLane=E!==0&&E<f?E:f}}function bv(d,f){vj(d,f),(d=d.alternate)&&vj(d,f)}function Aj(d){if(d.tag===13){var f=Ku(d,67108864);f!==null&&fs(f,d,67108864),bv(d,67108864)}}var JE=!0;function Gte(d,f,E,S){var C=j.T;j.T=null;var P=G.p;try{G.p=2,vv(d,f,E,S)}finally{G.p=P,j.T=C}}function zte(d,f,E,S){var C=j.T;j.T=null;var P=G.p;try{G.p=8,vv(d,f,E,S)}finally{G.p=P,j.T=C}}function vv(d,f,E,S){if(JE){var C=Av(S);if(C===null)uv(d,f,S,ZE,E),Nj(d,S);else if(Yte(C,d,f,E,S))S.stopPropagation();else if(Nj(d,S),f&4&&-1<qte.indexOf(d)){for(;C!==null;){var P=kt(C);if(P!==null)switch(P.tag){case 3:if(P=P.stateNode,P.current.memoizedState.isDehydrated){var Y=Oe(P.pendingLanes);if(Y!==0){var ee=P;for(ee.pendingLanes|=2,ee.entangledLanes|=2;Y;){var fe=1<<31-Le(Y);ee.entanglements[1]|=fe,Y&=~fe}_i(P),(Ln&6)===0&&(kE=re()+500,Qf(0))}}break;case 13:ee=Ku(P,2),ee!==null&&fs(ee,P,2),UE(),bv(P,2)}if(P=Av(S),P===null&&uv(d,f,S,ZE,E),P===C)break;C=P}C!==null&&S.stopPropagation()}else uv(d,f,S,null,E)}}function Av(d){return d=CS(d),Rv(d)}var ZE=null;function Rv(d){if(ZE=null,d=dt(d),d!==null){var f=s(d);if(f===null)d=null;else{var E=f.tag;if(E===13){if(d=i(f),d!==null)return d;d=null}else if(E===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;d=null}else f!==d&&(d=null)}}return ZE=d,null}function Rj(d){switch(d){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Se()){case $e:return 2;case qe:return 8;case Je:case lt:return 32;case at:return 268435456;default:return 32}default:return 32}}var Nv=!1,fl=null,ml=null,pl=null,sm=new Map,im=new Map,gl=[],qte="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Nj(d,f){switch(d){case"focusin":case"focusout":fl=null;break;case"dragenter":case"dragleave":ml=null;break;case"mouseover":case"mouseout":pl=null;break;case"pointerover":case"pointerout":sm.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":im.delete(f.pointerId)}}function om(d,f,E,S,C,P){return d===null||d.nativeEvent!==P?(d={blockedOn:f,domEventName:E,eventSystemFlags:S,nativeEvent:P,targetContainers:[C]},f!==null&&(f=kt(f),f!==null&&Aj(f)),d):(d.eventSystemFlags|=S,f=d.targetContainers,C!==null&&f.indexOf(C)===-1&&f.push(C),d)}function Yte(d,f,E,S,C){switch(f){case"focusin":return fl=om(fl,d,f,E,S,C),!0;case"dragenter":return ml=om(ml,d,f,E,S,C),!0;case"mouseover":return pl=om(pl,d,f,E,S,C),!0;case"pointerover":var P=C.pointerId;return sm.set(P,om(sm.get(P)||null,d,f,E,S,C)),!0;case"gotpointercapture":return P=C.pointerId,im.set(P,om(im.get(P)||null,d,f,E,S,C)),!0}return!1}function _j(d){var f=dt(d.target);if(f!==null){var E=s(f);if(E!==null){if(f=E.tag,f===13){if(f=i(E),f!==null){d.blockedOn=f,et(d.priority,function(){if(E.tag===13){var S=hs();S=Bt(S);var C=Ku(E,S);C!==null&&fs(C,E,S),bv(E,S)}});return}}else if(f===3&&E.stateNode.current.memoizedState.isDehydrated){d.blockedOn=E.tag===3?E.stateNode.containerInfo:null;return}}}d.blockedOn=null}function eT(d){if(d.blockedOn!==null)return!1;for(var f=d.targetContainers;0<f.length;){var E=Av(d.nativeEvent);if(E===null){E=d.nativeEvent;var S=new E.constructor(E.type,E);wS=S,E.target.dispatchEvent(S),wS=null}else return f=kt(E),f!==null&&Aj(f),d.blockedOn=E,!1;f.shift()}return!0}function wj(d,f,E){eT(d)&&E.delete(f)}function Wte(){Nv=!1,fl!==null&&eT(fl)&&(fl=null),ml!==null&&eT(ml)&&(ml=null),pl!==null&&eT(pl)&&(pl=null),sm.forEach(wj),im.forEach(wj)}function tT(d,f){d.blockedOn===f&&(d.blockedOn=null,Nv||(Nv=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Wte)))}var nT=null;function Cj(d){nT!==d&&(nT=d,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){nT===d&&(nT=null);for(var f=0;f<d.length;f+=3){var E=d[f],S=d[f+1],C=d[f+2];if(typeof S!="function"){if(Rv(S||E)===null)continue;break}var P=kt(E);P!==null&&(d.splice(f,3),f-=3,Rb(P,{pending:!0,data:C,method:E.method,action:S},S,C))}}))}function lm(d){function f(fe){return tT(fe,d)}fl!==null&&tT(fl,d),ml!==null&&tT(ml,d),pl!==null&&tT(pl,d),sm.forEach(f),im.forEach(f);for(var E=0;E<gl.length;E++){var S=gl[E];S.blockedOn===d&&(S.blockedOn=null)}for(;0<gl.length&&(E=gl[0],E.blockedOn===null);)_j(E),E.blockedOn===null&&gl.shift();if(E=(d.ownerDocument||d).$$reactFormReplay,E!=null)for(S=0;S<E.length;S+=3){var C=E[S],P=E[S+1],Y=C[Yt]||null;if(typeof P=="function")Y||Cj(E);else if(Y){var ee=null;if(P&&P.hasAttribute("formAction")){if(C=P,Y=P[Yt]||null)ee=Y.formAction;else if(Rv(C)!==null)continue}else ee=Y.action;typeof ee=="function"?E[S+1]=ee:(E.splice(S,3),S-=3),Cj(E)}}}function _v(d){this._internalRoot=d}rT.prototype.render=_v.prototype.render=function(d){var f=this._internalRoot;if(f===null)throw Error(r(409));var E=f.current,S=hs();bj(E,S,d,f,null,null)},rT.prototype.unmount=_v.prototype.unmount=function(){var d=this._internalRoot;if(d!==null){this._internalRoot=null;var f=d.containerInfo;bj(d.current,2,null,d,null,null),UE(),f[tn]=null}};function rT(d){this._internalRoot=d}rT.prototype.unstable_scheduleHydration=function(d){if(d){var f=_t();d={blockedOn:null,target:d,priority:f};for(var E=0;E<gl.length&&f!==0&&f<gl[E].priority;E++);gl.splice(E,0,d),E===0&&_j(d)}};var Ij=t.version;if(Ij!=="19.1.0")throw Error(r(527,Ij,"19.1.0"));G.findDOMNode=function(d){var f=d._reactInternals;if(f===void 0)throw typeof d.render=="function"?Error(r(188)):(d=Object.keys(d).join(","),Error(r(268,d)));return d=c(f),d=d!==null?u(d):null,d=d===null?null:d.stateNode,d};var Xte={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var aT=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!aT.isDisabled&&aT.supportsFiber)try{oe=aT.inject(Xte),ue=aT}catch(d){}}return dm.createRoot=function(d,f){if(!a(d))throw Error(r(299));var E=!1,S="",C=q2,P=Y2,Y=W2,ee=null;return f!=null&&(f.unstable_strictMode===!0&&(E=!0),f.identifierPrefix!==void 0&&(S=f.identifierPrefix),f.onUncaughtError!==void 0&&(C=f.onUncaughtError),f.onCaughtError!==void 0&&(P=f.onCaughtError),f.onRecoverableError!==void 0&&(Y=f.onRecoverableError),f.unstable_transitionCallbacks!==void 0&&(ee=f.unstable_transitionCallbacks)),f=xj(d,1,!1,null,null,E,S,C,P,Y,ee,null),d[tn]=f.current,cv(d),new _v(f)},dm.hydrateRoot=function(d,f,E){if(!a(d))throw Error(r(299));var S=!1,C="",P=q2,Y=Y2,ee=W2,fe=null,ve=null;return E!=null&&(E.unstable_strictMode===!0&&(S=!0),E.identifierPrefix!==void 0&&(C=E.identifierPrefix),E.onUncaughtError!==void 0&&(P=E.onUncaughtError),E.onCaughtError!==void 0&&(Y=E.onCaughtError),E.onRecoverableError!==void 0&&(ee=E.onRecoverableError),E.unstable_transitionCallbacks!==void 0&&(fe=E.unstable_transitionCallbacks),E.formState!==void 0&&(ve=E.formState)),f=xj(d,1,!0,f,E!=null?E:null,S,C,P,Y,ee,fe,ve),f.context=Sj(null),E=f.current,S=hs(),S=Bt(S),C=Zo(S),C.callback=null,el(E,C,S),E=S,f.current.lanes=E,De(f,E),_i(f),d[tn]=f.current,cv(d),new rT(f)},dm.version="19.1.0",dm}var zj;function dne(){if(zj)return Ov.exports;zj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){}}return e(),Ov.exports=une(),Ov.exports}var hne=dne(),Pv,qj;function fne(){if(qj)return Pv;qj=1;var e=typeof Element!="undefined",t=typeof Map=="function",n=typeof Set=="function",r=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function a(s,i){if(s===i)return!0;if(s&&i&&typeof s=="object"&&typeof i=="object"){if(s.constructor!==i.constructor)return!1;var l,c,u;if(Array.isArray(s)){if(l=s.length,l!=i.length)return!1;for(c=l;c--!==0;)if(!a(s[c],i[c]))return!1;return!0}var h;if(t&&s instanceof Map&&i instanceof Map){if(s.size!==i.size)return!1;for(h=s.entries();!(c=h.next()).done;)if(!i.has(c.value[0]))return!1;for(h=s.entries();!(c=h.next()).done;)if(!a(c.value[1],i.get(c.value[0])))return!1;return!0}if(n&&s instanceof Set&&i instanceof Set){if(s.size!==i.size)return!1;for(h=s.entries();!(c=h.next()).done;)if(!i.has(c.value[0]))return!1;return!0}if(r&&ArrayBuffer.isView(s)&&ArrayBuffer.isView(i)){if(l=s.length,l!=i.length)return!1;for(c=l;c--!==0;)if(s[c]!==i[c])return!1;return!0}if(s.constructor===RegExp)return s.source===i.source&&s.flags===i.flags;if(s.valueOf!==Object.prototype.valueOf&&typeof s.valueOf=="function"&&typeof i.valueOf=="function")return s.valueOf()===i.valueOf();if(s.toString!==Object.prototype.toString&&typeof s.toString=="function"&&typeof i.toString=="function")return s.toString()===i.toString();if(u=Object.keys(s),l=u.length,l!==Object.keys(i).length)return!1;for(c=l;c--!==0;)if(!Object.prototype.hasOwnProperty.call(i,u[c]))return!1;if(e&&s instanceof Element)return!1;for(c=l;c--!==0;)if(!((u[c]==="_owner"||u[c]==="__v"||u[c]==="__o")&&s.$$typeof)&&!a(s[u[c]],i[u[c]]))return!1;return!0}return s!==s&&i!==i}return Pv=function(i,l){try{return a(i,l)}catch(c){if((c.message||"").match(/stack|recursion/i))return!1;throw c}},Pv}var mne=fne();const pne=ir(mne);var kv,Yj;function gne(){if(Yj)return kv;Yj=1;var e=function(t,n,r,a,s,i,l,c){if(!t){var u;if(n===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[r,a,s,i,l,c],m=0;u=new Error(n.replace(/%s/g,function(){return h[m++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};return kv=e,kv}var Ene=gne();const Wj=ir(Ene);var jv,Xj;function Tne(){return Xj||(Xj=1,jv=function(t,n,r,a){var s=r?r.call(a,t,n):void 0;if(s!==void 0)return!!s;if(t===n)return!0;if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;var i=Object.keys(t),l=Object.keys(n);if(i.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),u=0;u<i.length;u++){var h=i[u];if(!c(h))return!1;var m=t[h],p=n[h];if(s=r?r.call(a,m,p,h):void 0,s===!1||s===void 0&&m!==p)return!1}return!0}),jv}var yne=Tne();const xne=ir(yne);var S8=(e=>(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(S8||{}),Uv={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},Kj=Object.values(S8),v1={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Sne=Object.entries(v1).reduce((e,[t,n])=>(e[n]=t,e),{}),hi="data-rh",oh={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},lh=(e,t)=>{for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},bne=e=>{let t=lh(e,"title");const n=lh(e,oh.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,()=>t);const r=lh(e,oh.DEFAULT_TITLE);return t||r||void 0},vne=e=>lh(e,oh.ON_CHANGE_CLIENT_STATE)||(()=>{}),Fv=(e,t)=>t.filter(n=>typeof n[e]!="undefined").map(n=>n[e]).reduce((n,r)=>q(q({},n),r),{}),Ane=(e,t)=>t.filter(n=>typeof n.base!="undefined").map(n=>n.base).reverse().reduce((n,r)=>{if(!n.length){const a=Object.keys(r);for(let s=0;s<a.length;s+=1){const l=a[s].toLowerCase();if(e.indexOf(l)!==-1&&r[l])return n.concat(r)}}return n},[]),Rne=e=>console&&typeof console.warn=="function"&&void 0,hm=(e,t,n)=>{const r={};return n.filter(a=>Array.isArray(a[e])?!0:(typeof a[e]!="undefined"&&Rne("Helmet: ".concat(e,' should be of type "Array". Instead found type "').concat(typeof a[e],'"')),!1)).map(a=>a[e]).reverse().reduce((a,s)=>{const i={};s.filter(c=>{let u;const h=Object.keys(c);for(let p=0;p<h.length;p+=1){const g=h[p],T=g.toLowerCase();t.indexOf(T)!==-1&&!(u==="rel"&&c[u].toLowerCase()==="canonical")&&!(T==="rel"&&c[T].toLowerCase()==="stylesheet")&&(u=T),t.indexOf(g)!==-1&&(g==="innerHTML"||g==="cssText"||g==="itemprop")&&(u=g)}if(!u||!c[u])return!1;const m=c[u].toLowerCase();return r[u]||(r[u]={}),i[u]||(i[u]={}),r[u][m]?!1:(i[u][m]=!0,!0)}).reverse().forEach(c=>a.push(c));const l=Object.keys(i);for(let c=0;c<l.length;c+=1){const u=l[c],h=q(q({},r[u]),i[u]);r[u]=h}return a},[]).reverse()},Nne=(e,t)=>{if(Array.isArray(e)&&e.length){for(let n=0;n<e.length;n+=1)if(e[n][t])return!0}return!1},_ne=e=>({baseTag:Ane(["href"],e),bodyAttributes:Fv("bodyAttributes",e),defer:lh(e,oh.DEFER),encode:lh(e,oh.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Fv("htmlAttributes",e),linkTags:hm("link",["rel","href"],e),metaTags:hm("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:hm("noscript",["innerHTML"],e),onChangeClientState:vne(e),scriptTags:hm("script",["src","innerHTML"],e),styleTags:hm("style",["cssText"],e),title:bne(e),titleAttributes:Fv("titleAttributes",e),prioritizeSeoTags:Nne(e,oh.PRIORITIZE_SEO_TAGS)}),b8=e=>Array.isArray(e)?e.join(""):e,wne=(e,t)=>{const n=Object.keys(e);for(let r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1},$v=(e,t)=>Array.isArray(e)?e.reduce((n,r)=>(wne(r,t)?n.priority.push(r):n.default.push(r),n),{priority:[],default:[]}):{default:e,priority:[]},Qj=(e,t)=>he(q({},e),{[t]:void 0}),Cne=["noscript","script","style"],eI=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;"),v8=e=>Object.keys(e).reduce((t,n)=>{const r=typeof e[n]!="undefined"?"".concat(n,'="').concat(e[n],'"'):"".concat(n);return t?"".concat(t," ").concat(r):r},""),Ine=(e,t,n,r)=>{const a=v8(n),s=b8(t);return a?"<".concat(e," ").concat(hi,'="true" ').concat(a,">").concat(eI(s,r),"</").concat(e,">"):"<".concat(e," ").concat(hi,'="true">').concat(eI(s,r),"</").concat(e,">")},One=(e,t,n=!0)=>t.reduce((r,a)=>{const s=a,i=Object.keys(s).filter(u=>!(u==="innerHTML"||u==="cssText")).reduce((u,h)=>{const m=typeof s[h]=="undefined"?h:"".concat(h,'="').concat(eI(s[h],n),'"');return u?"".concat(u," ").concat(m):m},""),l=s.innerHTML||s.cssText||"",c=Cne.indexOf(e)===-1;return"".concat(r,"<").concat(e," ").concat(hi,'="true" ').concat(i).concat(c?"/>":">".concat(l,"</").concat(e,">"))},""),A8=(e,t={})=>Object.keys(e).reduce((n,r)=>{const a=v1[r];return n[a||r]=e[r],n},t),Lne=(e,t,n)=>{const r={key:t,[hi]:!0},a=A8(n,r);return[Ht.createElement("title",a,t)]},JT=(e,t)=>t.map((n,r)=>{const a={key:r,[hi]:!0};return Object.keys(n).forEach(s=>{const l=v1[s]||s;if(l==="innerHTML"||l==="cssText"){const c=n.innerHTML||n.cssText;a.dangerouslySetInnerHTML={__html:c}}else a[l]=n[s]}),Ht.createElement(e,a)}),Ps=(e,t,n=!0)=>{switch(e){case"title":return{toComponent:()=>Lne(e,t.title,t.titleAttributes),toString:()=>Ine(e,t.title,t.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>A8(t),toString:()=>v8(t)};default:return{toComponent:()=>JT(e,t),toString:()=>One(e,t,n)}}},Mne=({metaTags:e,linkTags:t,scriptTags:n,encode:r})=>{const a=$v(e,Uv.meta),s=$v(t,Uv.link),i=$v(n,Uv.script);return{priorityMethods:{toComponent:()=>[...JT("meta",a.priority),...JT("link",s.priority),...JT("script",i.priority)],toString:()=>"".concat(Ps("meta",a.priority,r)," ").concat(Ps("link",s.priority,r)," ").concat(Ps("script",i.priority,r))},metaTags:a.default,linkTags:s.default,scriptTags:i.default}},Dne=e=>{const{baseTag:t,bodyAttributes:n,encode:r=!0,htmlAttributes:a,noscriptTags:s,styleTags:i,title:l="",titleAttributes:c,prioritizeSeoTags:u}=e;let{linkTags:h,metaTags:m,scriptTags:p}=e,g={toComponent:()=>{},toString:()=>""};return u&&({priorityMethods:g,linkTags:h,metaTags:m,scriptTags:p}=Mne(e)),{priority:g,base:Ps("base",t,r),bodyAttributes:Ps("bodyAttributes",n,r),htmlAttributes:Ps("htmlAttributes",a,r),link:Ps("link",h,r),meta:Ps("meta",m,r),noscript:Ps("noscript",s,r),script:Ps("script",p,r),style:Ps("style",i,r),title:Ps("title",{title:l,titleAttributes:c},r)}},tI=Dne,lT=[],R8=!!(typeof window!="undefined"&&window.document&&window.document.createElement),nI=class{constructor(e,t){Kt(this,"instances",[]);Kt(this,"canUseDOM",R8);Kt(this,"context");Kt(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?lT:this.instances,add:e=>{(this.canUseDOM?lT:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?lT:this.instances).indexOf(e);(this.canUseDOM?lT:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=tI({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Pne={},N8=Ht.createContext(Pne),Zc,_8=(Zc=class extends v.Component{constructor(n){super(n);Kt(this,"helmetData");this.helmetData=new nI(this.props.context||{},Zc.canUseDOM)}render(){return Ht.createElement(N8.Provider,{value:this.helmetData.value},this.props.children)}},Kt(Zc,"canUseDOM",R8),Zc),Sd=(e,t)=>{const n=document.head||document.querySelector("head"),r=n.querySelectorAll("".concat(e,"[").concat(hi,"]")),a=[].slice.call(r),s=[];let i;return t&&t.length&&t.forEach(l=>{const c=document.createElement(e);for(const u in l)if(Object.prototype.hasOwnProperty.call(l,u))if(u==="innerHTML")c.innerHTML=l.innerHTML;else if(u==="cssText")c.styleSheet?c.styleSheet.cssText=l.cssText:c.appendChild(document.createTextNode(l.cssText));else{const h=u,m=typeof l[h]=="undefined"?"":l[h];c.setAttribute(u,m)}c.setAttribute(hi,"true"),a.some((u,h)=>(i=h,c.isEqualNode(u)))?a.splice(i,1):s.push(c)}),a.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),s.forEach(l=>n.appendChild(l)),{oldTags:a,newTags:s}},rI=(e,t)=>{const n=document.getElementsByTagName(e)[0];if(!n)return;const r=n.getAttribute(hi),a=r?r.split(","):[],s=[...a],i=Object.keys(t);for(const l of i){const c=t[l]||"";n.getAttribute(l)!==c&&n.setAttribute(l,c),a.indexOf(l)===-1&&a.push(l);const u=s.indexOf(l);u!==-1&&s.splice(u,1)}for(let l=s.length-1;l>=0;l-=1)n.removeAttribute(s[l]);a.length===s.length?n.removeAttribute(hi):n.getAttribute(hi)!==i.join(",")&&n.setAttribute(hi,i.join(","))},kne=(e,t)=>{typeof e!="undefined"&&document.title!==e&&(document.title=b8(e)),rI("title",t)},Jj=(e,t)=>{const{baseTag:n,bodyAttributes:r,htmlAttributes:a,linkTags:s,metaTags:i,noscriptTags:l,onChangeClientState:c,scriptTags:u,styleTags:h,title:m,titleAttributes:p}=e;rI("body",r),rI("html",a),kne(m,p);const g={baseTag:Sd("base",n),linkTags:Sd("link",s),metaTags:Sd("meta",i),noscriptTags:Sd("noscript",l),scriptTags:Sd("script",u),styleTags:Sd("style",h)},T={},y={};Object.keys(g).forEach(b=>{const{newTags:x,oldTags:R}=g[b];x.length&&(T[b]=x),R.length&&(y[b]=g[b].oldTags)}),t&&t(),c(e,T,y)},fm=null,jne=e=>{fm&&cancelAnimationFrame(fm),e.defer?fm=requestAnimationFrame(()=>{Jj(e,()=>{fm=null})}):(Jj(e),fm=null)},Une=jne,Zj=class extends v.Component{constructor(){super(...arguments);Kt(this,"rendered",!1)}shouldComponentUpdate(t){return!xne(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let r=null;const a=_ne(t.get().map(s=>{const i=q({},s.props);return delete i.context,i}));_8.canUseDOM?Une(a):tI&&(r=tI(a)),n(r)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},ZC,Fne=(ZC=class extends v.Component{shouldComponentUpdate(e){return!pne(Qj(this.props,"helmetData"),Qj(e,"helmetData"))}mapNestedChildrenToProps(e,t){if(!t)return null;switch(e.type){case"script":case"noscript":return{innerHTML:t};case"style":return{cssText:t};default:throw new Error("<".concat(e.type," /> elements are self-closing and can not contain children. Refer to our API for more information."))}}flattenArrayTypeChildren(e,t,n,r){return he(q({},t),{[e.type]:[...t[e.type]||[],q(q({},n),this.mapNestedChildrenToProps(e,r))]})}mapObjectTypeChildren(e,t,n,r){switch(e.type){case"title":return he(q({},t),{[e.type]:r,titleAttributes:q({},n)});case"body":return he(q({},t),{bodyAttributes:q({},n)});case"html":return he(q({},t),{htmlAttributes:q({},n)});default:return he(q({},t),{[e.type]:q({},n)})}}mapArrayTypeChildrenToProps(e,t){let n=q({},t);return Object.keys(e).forEach(r=>{n=he(q({},n),{[r]:e[r]})}),n}warnOnInvalidChildren(e,t){return Wj(Kj.some(n=>e.type===n),typeof e.type=="function"?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types ".concat(Kj.join(", ")," are allowed. Helmet does not support rendering <").concat(e.type,"> elements. Refer to our API for more information.")),Wj(!t||typeof t=="string"||Array.isArray(t)&&!t.some(n=>typeof n!="string"),"Helmet expects a string as a child of <".concat(e.type,">. Did you forget to wrap your children in braces? ( <").concat(e.type,">{``}</").concat(e.type,"> ) Refer to our API for more information.")),!0}mapChildrenToProps(e,t){let n={};return Ht.Children.forEach(e,r=>{if(!r||!r.props)return;const c=r.props,{children:a}=c,s=Tn(c,["children"]),i=Object.keys(s).reduce((u,h)=>(u[Sne[h]||h]=s[h],u),{});let{type:l}=r;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(r,a),l){case"Symbol(react.fragment)":t=this.mapChildrenToProps(a,t);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(r,n,i,a);break;default:t=this.mapObjectTypeChildren(r,t,i,a);break}}),this.mapArrayTypeChildrenToProps(n,t)}render(){const a=this.props,{children:e}=a,t=Tn(a,["children"]);let n=q({},t),{helmetData:r}=t;if(e&&(n=this.mapChildrenToProps(e,n)),r&&!(r instanceof nI)){const s=r;r=new nI(s.context,!0),delete n.helmetData}return r?Ht.createElement(Zj,he(q({},n),{context:r.value})):Ht.createElement(N8.Consumer,null,s=>Ht.createElement(Zj,he(q({},n),{context:s})))}},Kt(ZC,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),ZC),Ce=typeof window!="undefined"?window:void 0,rs=typeof globalThis!="undefined"?globalThis:Ce,w8=Array.prototype,eU=w8.forEach,tU=w8.indexOf,Es=rs==null?void 0:rs.navigator,mt=rs==null?void 0:rs.document,ts=rs==null?void 0:rs.location,aI=rs==null?void 0:rs.fetch,sI=rs!=null&&rs.XMLHttpRequest&&"withCredentials"in new rs.XMLHttpRequest?rs.XMLHttpRequest:void 0,nU=rs==null?void 0:rs.AbortController,Ja=Es==null?void 0:Es.userAgent,Ot=Ce!=null?Ce:{},_o={DEBUG:!1,LIB_VERSION:"1.261.7"};function ft(){return ft=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ft.apply(null,arguments)}function C8(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var $ne=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function an(e,t){return e.indexOf(t)!==-1}var w0=function(e){return e.trim()},iI=function(e){return e.replace(/^\$/,"")},Bne=Array.isArray,I8=Object.prototype,O8=I8.hasOwnProperty,C0=I8.toString,ar=Bne||function(e){return C0.call(e)==="[object Array]"},Hs=e=>typeof e=="function",Sr=e=>e===Object(e)&&!ar(e),Xd=e=>{if(Sr(e)){for(var t in e)if(O8.call(e,t))return!1;return!0}return!1},rt=e=>e===void 0,vr=e=>C0.call(e)=="[object String]",oI=e=>vr(e)&&e.trim().length===0,Ql=e=>e===null,Nn=e=>rt(e)||Ql(e),_a=e=>C0.call(e)=="[object Number]",Mi=e=>C0.call(e)==="[object Boolean]",Hne=e=>e instanceof FormData,Vne=e=>an($ne,e),Gne=[!0,"true",1,"1","yes"],Bv=e=>an(Gne,e),zne=[!1,"false",0,"0","no"];function Ts(e,t,n,r,a){return t>n&&(r.warn("min cannot be greater than max."),t=n),_a(e)?e>n?(r.warn(" cannot be  greater than max: "+n+". Using max value instead."),n):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+a),Ts(a||n,t,n,r))}let L8=class{stop(){this.t&&(clearInterval(this.t),this.t=void 0)}constructor(t){this.i=t,this.o={},this.h=()=>{Object.keys(this.o).forEach(n=>{var r=this.m(n)+this.S;r>=this.$?delete this.o[n]:this.k(n,r)})},this.m=n=>this.o[String(n)],this.k=(n,r)=>{this.o[String(n)]=r},this.consumeRateLimit=n=>{var r,a=(r=this.m(n))!=null?r:this.$;if((a=Math.max(a-1,0))===0)return!0;this.k(n,a);var s,i=a===0;return i&&((s=this.I)==null||s.call(this,n)),i},this.I=this.i.I,this.$=Ts(this.i.bucketSize,0,100,this.i.R),this.S=Ts(this.i.refillRate,0,this.$,this.i.R),this.P=Ts(this.i.refillInterval,0,864e5,this.i.R),this.t=setInterval(()=>{this.h()},this.P)}};var M8=e=>{var t={T:function(n){if(Ce&&(_o.DEBUG||Ot.POSTHOG_DEBUG)&&!rt(Ce.console)&&Ce.console){for(var r=("__rrweb_original__"in Ce.console[n])?Ce.console[n].__rrweb_original__:Ce.console[n],a=arguments.length,s=new Array(a>1?a-1:0),i=1;i<a;i++)s[i-1]=arguments[i];r(e,...s)}},info:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];t.T("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];t.T("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];t.T("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a]},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling "+n)},createLogger:n=>M8(e+" "+n)};return t},ht=M8("[PostHog.js]"),Vr=ht.createLogger,qne=Vr("[ExternalScriptsLoader]"),rU=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return qne.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=mt==null?void 0:mt.querySelectorAll("script");if(r){for(var a,s=function(){if(r[i].src===t){var c=r[i];return c.__posthog_loading_callback_fired?{v:n()}:(c.addEventListener("load",u=>{c.__posthog_loading_callback_fired=!0,n(void 0,u)}),c.onerror=u=>n(u),{v:void 0})}},i=0;i<r.length;i++)if(a=s())return a.v}var l=()=>{if(!mt)return n("document not found");var c=mt.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=t,c.onload=m=>{c.__posthog_loading_callback_fired=!0,n(void 0,m)},c.onerror=m=>n(m),e.config.prepare_external_dependency_script&&(c=e.config.prepare_external_dependency_script(c)),!c)return n("prepare_external_dependency_script returned null");var u,h=mt.querySelectorAll("body > script");h.length>0?(u=h[0].parentNode)==null||u.insertBefore(c,h[0]):mt.body.appendChild(c)};mt!=null&&mt.body?l():mt==null||mt.addEventListener("DOMContentLoaded",l)};Ot.__PosthogExtensions__=Ot.__PosthogExtensions__||{},Ot.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/"+t+".js?v="+e.version;if(t==="remote-config"&&(r="/array/"+e.config.token+"/config.js"),t==="toolbar"){var a=3e5;r=r+"&t="+Math.floor(Date.now()/a)*a}var s=e.requestRouter.endpointFor("assets",r);rU(e,s,n)},Ot.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);rU(e,r,n)};var yy={};function Ol(e,t,n){if(ar(e)){if(eU&&e.forEach===eU)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,a=e.length;r<a;r++)if(r in e&&t.call(n,e[r],r)===yy)return}}}function Bn(e,t,n){if(!Nn(e)){if(ar(e))return Ol(e,t,n);if(Hne(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===yy)return}else for(var a in e)if(O8.call(e,a)&&t.call(n,e[a],a)===yy)return}}var wr=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ol(n,function(a){for(var s in a)a[s]!==void 0&&(e[s]=a[s])}),e},I0=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ol(n,function(a){Ol(a,function(s){e.push(s)})}),e};function ZT(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var aU=function(e){try{return e()}catch(t){return}},Yne=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(a){ht.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ht.critical(a)}}},A1=function(e){var t={};return Bn(e,function(n,r){(vr(n)&&n.length>0||_a(n))&&(t[r]=n)}),t};function Wne(e,t){return n=e,r=s=>vr(s)&&!Ql(t)?s.slice(0,t):s,a=new Set,function s(i,l){return i!==Object(i)?r?r(i,l):i:a.has(i)?void 0:(a.add(i),ar(i)?(c=[],Ol(i,u=>{c.push(s(u))})):(c={},Bn(i,(u,h)=>{a.has(u)||(c[h]=s(u,h))})),c);var c}(n);var n,r,a}var Xne=["herokuapp.com","vercel.app","netlify.app"];function Kne(e){var t=e==null?void 0:e.hostname;if(!vr(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of Xne)if(n===r)return!1;return!0}function D8(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function pr(e,t,n,r){var{capture:a=!1,passive:s=!0}=r!=null?r:{};e==null||e.addEventListener(t,n,{capture:a,passive:s})}var P8="$people_distinct_id",np="__alias",rp="__timers",sU="$autocapture_disabled_server_side",lI="$heatmaps_enabled_server_side",iU="$exception_capture_enabled_server_side",cI="$error_tracking_suppression_rules",oU="$error_tracking_capture_extension_exceptions",lU="$web_vitals_enabled_server_side",k8="$dead_clicks_enabled_server_side",cU="$web_vitals_allowed_metrics",Hp="$session_recording_enabled_server_side",uU="$console_log_recording_enabled_server_side",dU="$session_recording_network_payload_capture",hU="$session_recording_masking",fU="$session_recording_canvas_recording",mU="$replay_sample_rate",pU="$replay_minimum_duration",xy="$replay_script_config",Sy="$sesid",ap="$session_is_sampled",uI="$session_recording_url_trigger_activated_session",dI="$session_recording_event_trigger_activated_session",Kd="$enabled_feature_flags",sp="$early_access_features",hI="$feature_flag_details",ip="$stored_person_properties",kc="$stored_group_properties",fI="$surveys",cT="$surveys_activated",by="$flag_call_reported",bo="$user_state",mI="$client_session_props",pI="$capture_rate_limit",gI="$initial_campaign_params",EI="$initial_referrer_info",vy="$initial_person_info",Ay="$epp",j8="__POSTHOG_TOOLBAR__",mm="$posthog_cookieless",Qne=[P8,np,"__cmpns",rp,Hp,lI,Sy,Kd,cI,bo,sp,hI,kc,ip,fI,by,mI,pI,gI,EI,Ay,vy];function gU(e){return e instanceof Element&&(e.id===j8||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function O0(e){return!!e&&e.nodeType===1}function Ll(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function U8(e){return!!e&&e.nodeType===3}function F8(e){return!!e&&e.nodeType===11}function R1(e){return e?w0(e).split(/\s+/):[]}function EU(e){var t=Ce==null?void 0:Ce.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Ry(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return R1(t)}function $8(e){return Nn(e)?null:w0(e).split(/(\s+)/).filter(t=>xh(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function L0(e){var t="";return yI(e)&&!V8(e)&&e.childNodes&&e.childNodes.length&&Bn(e.childNodes,function(n){var r;U8(n)&&n.textContent&&(t+=(r=$8(n.textContent))!==null&&r!==void 0?r:"")}),w0(t)}function B8(e){return rt(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var TI=["a","button","form","input","select","textarea","label"];function H8(e){var t=e.parentNode;return!(!t||!O0(t))&&t}function Jne(e,t,n,r,a){var s,i,l;if(n===void 0&&(n=void 0),!Ce||!e||Ll(e,"html")||!O0(e)||(s=n)!=null&&s.url_allowlist&&!EU(n.url_allowlist)||(i=n)!=null&&i.url_ignorelist&&EU(n.url_ignorelist))return!1;if((l=n)!=null&&l.dom_event_allowlist){var c=n.dom_event_allowlist;if(c&&!c.some(b=>t.type===b))return!1}for(var u=!1,h=[e],m=!0,p=e;p.parentNode&&!Ll(p,"body");)if(F8(p.parentNode))h.push(p.parentNode.host),p=p.parentNode.host;else{if(!(m=H8(p)))break;if(r||TI.indexOf(m.tagName.toLowerCase())>-1)u=!0;else{var g=Ce.getComputedStyle(m);g&&g.getPropertyValue("cursor")==="pointer"&&(u=!0)}h.push(m),p=m}if(!function(b,x){var R=x==null?void 0:x.element_allowlist;if(rt(R))return!0;var A,w=function(N){if(R.some(I=>N.tagName.toLowerCase()===I))return{v:!0}};for(var _ of b)if(A=w(_))return A.v;return!1}(h,n)||!function(b,x){var R=x==null?void 0:x.css_selector_allowlist;if(rt(R))return!0;var A,w=function(N){if(R.some(I=>N.matches(I)))return{v:!0}};for(var _ of b)if(A=w(_))return A.v;return!1}(h,n))return!1;var T=Ce.getComputedStyle(e);if(T&&T.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var y=e.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(a||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(a||["change","click"]).indexOf(t.type)>=0;default:return u?(a||["click"]).indexOf(t.type)>=0:(a||["click"]).indexOf(t.type)>=0&&(TI.indexOf(y)>-1||e.getAttribute("contenteditable")==="true")}}function yI(e){for(var t=e;t.parentNode&&!Ll(t,"body");t=t.parentNode){var n=Ry(t);if(an(n,"ph-sensitive")||an(n,"ph-no-capture"))return!1}if(an(Ry(e),"ph-include"))return!0;var r=e.type||"";if(vr(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var a=e.name||e.id||"";return!(vr(a)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,"")))}function V8(e){return!!(Ll(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Ll(e,"select")||Ll(e,"textarea")||e.getAttribute("contenteditable")==="true")}var G8="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Zne=new RegExp("^(?:"+G8+")$"),ere=new RegExp(G8),z8="\\d{3}-?\\d{2}-?\\d{4}",tre=new RegExp("^("+z8+")$"),nre=new RegExp("("+z8+")");function xh(e,t){return t===void 0&&(t=!0),!(Nn(e)||vr(e)&&(e=w0(e),(t?Zne:ere).test((e||"").replace(/[- ]/g,""))||(t?tre:nre).test(e)))}function q8(e){var t=L0(e);return xh(t=(t+" "+Y8(e)).trim())?t:""}function Y8(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Bn(e.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var a=L0(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+Y8(n)).trim())}catch(s){ht.error("[AutoCapture]",s)}}),t}function rre(e){return function(t){var n=t.map(r=>{var a,s,i="";if(r.tag_name&&(i+=r.tag_name),r.attr_class)for(var l of(r.attr_class.sort(),r.attr_class))i+="."+l.replace(/"/g,"");var c=ft({},r.text?{text:r.text}:{},{"nth-child":(a=r.nth_child)!==null&&a!==void 0?a:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),u={};return ZT(c).sort((h,m)=>{var[p]=h,[g]=m;return p.localeCompare(g)}).forEach(h=>{var[m,p]=h;return u[TU(m.toString())]=TU(p.toString())}),i+=":",i+=ZT(u).map(h=>{var[m,p]=h;return m+'="'+p+'"'}).join("")});return n.join(";")}(function(t){return t.map(n=>{var r,a,s={text:(r=n.$el_text)==null?void 0:r.slice(0,400),tag_name:n.tag_name,href:(a=n.attr__href)==null?void 0:a.slice(0,2048),attr_class:are(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return ZT(n).filter(i=>{var[l]=i;return l.indexOf("attr__")===0}).forEach(i=>{var[l,c]=i;return s.attributes[l]=c}),s})}(e))}function TU(e){return e.replace(/"|\\"/g,'\\"')}function are(e){var t=e.attr__class;return t?ar(t)?t:R1(t):void 0}class W8{constructor(){this.clicks=[]}isRageClick(t,n,r){var a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<30&&r-a.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var Hv="$copy_autocapture",Co=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),sre=["fatal","error","warning","log","info","debug"],ire=["localhost","127.0.0.1"],Sh=e=>{var t=mt==null?void 0:mt.createElement("a");return rt(t)?null:(t.href=e,t)},ore=function(e,t){var n,r;t===void 0&&(t="&");var a=[];return Bn(e,function(s,i){rt(s)||rt(i)||i==="undefined"||(n=encodeURIComponent((l=>l instanceof File)(s)?s.name:s.toString()),r=encodeURIComponent(i),a[a.length]=r+"="+n)}),a.join(t)},Ny=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;a<r.length;a++){var s=r[a].split("=");if(s[0]===t){n=s;break}}if(!ar(n)||n.length<2)return"";var i=n[1];try{i=decodeURIComponent(i)}catch(l){ht.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},N1=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),a=r[0]||"",s=r[1],i=a.split("?"),l=i[1],c=i[0],u=(l||"").split("&"),h=[],m=0;m<u.length;m++){var p=u[m].split("=");ar(p)&&(t.includes(p[0])?h.push(p[0]+"="+n):h.push(u[m]))}var g=c;return l!=null&&(g+="?"+h.join("&")),s!=null&&(g+="#"+s),g},_y=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},yU=Vr("[AutoCapture]");function Vv(e,t){return t.length>e?t.slice(0,e)+"...":t}function lre(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!O0(t));return t}function cre(e,t,n,r){var a=e.tagName.toLowerCase(),s={tag_name:a};TI.indexOf(a)>-1&&!n&&(a.toLowerCase()==="a"||a.toLowerCase()==="button"?s.$el_text=Vv(1024,q8(e)):s.$el_text=Vv(1024,L0(e)));var i=Ry(e);i.length>0&&(s.classes=i.filter(function(h){return h!==""})),Bn(e.attributes,function(h){var m;if((!V8(e)||["name","id","class","aria-label"].indexOf(h.name)!==-1)&&(r==null||!r.includes(h.name))&&!t&&xh(h.value)&&(m=h.name,!vr(m)||m.substring(0,10)!=="_ngcontent"&&m.substring(0,7)!=="_nghost")){var p=h.value;h.name==="class"&&(p=R1(p).join(" ")),s["attr__"+h.name]=Vv(1024,p)}});for(var l=1,c=1,u=e;u=lre(u);)l++,u.tagName===e.tagName&&c++;return s.nth_child=l,s.nth_of_type=c,s}function ure(e,t){for(var n,r,{e:a,maskAllElementAttributes:s,maskAllText:i,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],h=e;h.parentNode&&!Ll(h,"body");)F8(h.parentNode)?(u.push(h.parentNode.host),h=h.parentNode.host):(u.push(h.parentNode),h=h.parentNode);var m,p=[],g={},T=!1,y=!1;if(Bn(u,w=>{var _=yI(w);w.tagName.toLowerCase()==="a"&&(T=w.getAttribute("href"),T=_&&T&&xh(T)&&T),an(Ry(w),"ph-no-capture")&&(y=!0),p.push(cre(w,s,i,l));var N=function(I){if(!yI(I))return{};var D={};return Bn(I.attributes,function(M){if(M.name&&M.name.indexOf("data-ph-capture-attribute")===0){var O=M.name.replace("data-ph-capture-attribute-",""),L=M.value;O&&L&&xh(L)&&(D[O]=L)}}),D}(w);wr(g,N)}),y)return{props:{},explicitNoCapture:y};if(i||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=q8(e):p[0].$el_text=L0(e)),T){var b,x;p[0].attr__href=T;var R=(b=Sh(T))==null?void 0:b.host,A=Ce==null||(x=Ce.location)==null?void 0:x.host;R&&A&&R!==A&&(m=T)}return{props:wr({$event_type:a.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:rre(p)},(n=p[0])!=null&&n.$el_text?{$el_text:(r=p[0])==null?void 0:r.$el_text}:{},m&&a.type==="click"?{$external_click_url:m}:{},g)}}class dre{constructor(t){this.C=!1,this.M=null,this.rageclicks=new W8,this.O=!1,this.instance=t,this.F=null}get A(){var t,n,r=Sr(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)==null?void 0:t.map(a=>new RegExp(a)),r.url_ignorelist=(n=r.url_ignorelist)==null?void 0:n.map(a=>new RegExp(a)),r}D(){if(this.isBrowserSupported()){if(Ce&&mt){var t=r=>{r=r||(Ce==null?void 0:Ce.event);try{this.j(r)}catch(a){yU.error("Failed to capture event",a)}};if(pr(mt,"submit",t,{capture:!0}),pr(mt,"change",t,{capture:!0}),pr(mt,"click",t,{capture:!0}),this.A.capture_copied_text){var n=r=>{r=r||(Ce==null?void 0:Ce.event),this.j(r,Hv)};pr(mt,"copy",n,{capture:!0}),pr(mt,"cut",n,{capture:!0})}}}else yU.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.D(),this.C=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.O=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[sU]:!!t.autocapture_opt_out}),this.M=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.F=t}getElementSelectors(t){var n,r=[];return(n=this.F)==null||n.forEach(a=>{var s=mt==null?void 0:mt.querySelectorAll(a);s==null||s.forEach(i=>{t===i&&r.push(a)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)==null?void 0:t.props[sU],a=this.M;if(Ql(a)&&!Mi(r)&&!this.instance.L())return!1;var s=(n=this.M)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!s}j(t,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r,a=B8(t);U8(a)&&(a=a.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.j(t,"$rageclick");var s=n===Hv;if(a&&Jne(a,t,this.A,s,s?["copy","cut"]:void 0)){var{props:i,explicitNoCapture:l}=ure(a,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.O});if(l)return!1;var c=this.getElementSelectors(a);if(c&&c.length>0&&(i.$element_selectors=c),n===Hv){var u,h=$8(Ce==null||(u=Ce.getSelection())==null?void 0:u.toString()),m=t.type||"clipboard";if(!h)return!1;i.$selected_content=h,i.$copy_type=m}return this.instance.capture(n,i),!0}}}isBrowserSupported(){return Hs(mt==null?void 0:mt.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return _a(e)&&isFinite(e)&&Math.floor(e)===e});var xU="0123456789abcdef";class wy{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(a)||t<0||n<0||r<0||a<0||t>0xffffffffffff||n>4095||r>1073741823||a>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=a>>>24,s[13]=a>>>16,s[14]=a>>>8,s[15]=a,new wy(s)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+xU.charAt(this.bytes[n]>>>4)+xU.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new wy(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class hre{constructor(){this.N=0,this.U=0,this.q=new fre}generate(){var t=this.generateOrAbort();if(rt(t)){this.N=0;var n=this.generateOrAbort();if(rt(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.N)this.N=t,this.B();else{if(!(t+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.B())}return wy.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.q.nextUint32())}B(){this.U=1024*this.q.nextUint32()+(1023&this.q.nextUint32())}}var SU,X8=e=>{if(typeof UUIDV7_DENY_WEAK_RNG!="undefined"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Ce&&!rt(Ce.crypto)&&crypto.getRandomValues&&(X8=e=>crypto.getRandomValues(e));class fre{constructor(){this.H=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.H.length&&(X8(this.H),this.W=0),this.H[this.W++]}}var Nl=()=>mre().toString(),mre=()=>(SU||(SU=new hre)).generate(),pm="",pre=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function gre(e,t){if(t){var n=function(a,s){if(s===void 0&&(s=mt),pm)return pm;if(!s||["localhost","127.0.0.1"].includes(a))return"";for(var i=a.split("."),l=Math.min(i.length,8),c="dmn_chk_"+Nl();!pm&&l--;){var u=i.slice(l).join("."),h=c+"=1;domain=."+u+";path=/";s.cookie=h+";max-age=3",s.cookie.includes(c)&&(s.cookie=h+";max-age=0",pm=u)}return pm}(e);if(!n){var r=(a=>{var s=a.match(pre);return s?s[0]:""})(e);r!==n&&ht.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var ki={G:()=>!!mt,J:function(e){ht.error("cookieStore error: "+e)},V:function(e){if(mt){try{for(var t=e+"=",n=mt.cookie.split(";").filter(s=>s.length),r=0;r<n.length;r++){for(var a=n[r];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch(s){}return null}},K:function(e){var t;try{t=JSON.parse(ki.V(e))||{}}catch(n){}return t},Y:function(e,t,n,r,a){if(mt)try{var s="",i="",l=gre(mt.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),s="; expires="+c.toUTCString()}a&&(i="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+l+i;return u.length>3686.4&&ht.warn("cookieStore warning: large cookie, len="+u.length),mt.cookie=u,u}catch(h){return}},X:function(e,t){if(mt!=null&&mt.cookie)try{ki.Y(e,"",-1,t)}catch(n){return}}},Gv=null,Br={G:function(){if(!Ql(Gv))return Gv;var e=!0;if(rt(Ce))e=!1;else try{var t="__mplssupport__";Br.Y(t,"xyz"),Br.V(t)!=='"xyz"'&&(e=!1),Br.X(t)}catch(n){e=!1}return e||ht.error("localStorage unsupported; falling back to cookie store"),Gv=e,e},J:function(e){ht.error("localStorage error: "+e)},V:function(e){try{return Ce==null?void 0:Ce.localStorage.getItem(e)}catch(t){Br.J(t)}return null},K:function(e){try{return JSON.parse(Br.V(e))||{}}catch(t){}return null},Y:function(e,t){try{Ce==null||Ce.localStorage.setItem(e,JSON.stringify(t))}catch(n){Br.J(n)}},X:function(e){try{Ce==null||Ce.localStorage.removeItem(e)}catch(t){Br.J(t)}}},Ere=["distinct_id",Sy,ap,Ay,vy],uT=ft({},Br,{K:function(e){try{var t={};try{t=ki.K(e)||{}}catch(r){}var n=wr(t,JSON.parse(Br.V(e)||"{}"));return Br.Y(e,n),n}catch(r){}return null},Y:function(e,t,n,r,a,s){try{Br.Y(e,t,void 0,void 0,s);var i={};Ere.forEach(l=>{t[l]&&(i[l]=t[l])}),Object.keys(i).length&&ki.Y(e,i,n,r,a,s)}catch(l){Br.J(l)}},X:function(e,t){try{Ce==null||Ce.localStorage.removeItem(e),ki.X(e,t)}catch(n){Br.J(n)}}}),dT={},Tre={G:function(){return!0},J:function(e){ht.error("memoryStorage error: "+e)},V:function(e){return dT[e]||null},K:function(e){return dT[e]||null},Y:function(e,t){dT[e]=t},X:function(e){delete dT[e]}},Ac=null,fa={G:function(){if(!Ql(Ac))return Ac;if(Ac=!0,rt(Ce))Ac=!1;else try{var e="__support__";fa.Y(e,"xyz"),fa.V(e)!=='"xyz"'&&(Ac=!1),fa.X(e)}catch(t){Ac=!1}return Ac},J:function(e){ht.error("sessionStorage error: ",e)},V:function(e){try{return Ce==null?void 0:Ce.sessionStorage.getItem(e)}catch(t){fa.J(t)}return null},K:function(e){try{return JSON.parse(fa.V(e))||null}catch(t){}return null},Y:function(e,t){try{Ce==null||Ce.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){fa.J(n)}},X:function(e){try{Ce==null||Ce.sessionStorage.removeItem(e)}catch(t){fa.J(t)}}},vo=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});let yre=class{constructor(t){this._instance=t}get A(){return this._instance.config}get consent(){return this.Z()?vo.DENIED:this.tt}isOptedOut(){return this.A.cookieless_mode==="always"||this.consent===vo.DENIED||this.consent===vo.PENDING&&(this.A.opt_out_capturing_by_default||this.A.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===vo.DENIED}optInOut(t){this.it.Y(this.et,t?1:0,this.A.cookie_expiration,this.A.cross_subdomain_cookie,this.A.secure_cookie)}reset(){this.it.X(this.et,this.A.cross_subdomain_cookie)}get et(){var{token:t,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+t:"__ph_opt_in_out_"+t)}get tt(){var t=this.it.V(this.et);return Bv(t)?vo.GRANTED:an(zne,t)?vo.DENIED:vo.PENDING}get it(){if(!this.rt){var t=this.A.opt_out_capturing_persistence_type;this.rt=t==="localStorage"?Br:ki;var n=t==="localStorage"?ki:Br;n.V(this.et)&&(this.rt.V(this.et)||this.optInOut(Bv(n.V(this.et))),n.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!D8([Es==null?void 0:Es.doNotTrack,Es==null?void 0:Es.msDoNotTrack,Ot.doNotTrack],t=>Bv(t))}};var hT=Vr("[Dead Clicks]"),xre=()=>!0,Sre=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(k8)),r=e.instance.config.capture_dead_clicks;return Mi(r)?r:n};let K8=class{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[k8]:t==null?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt(()=>{this.ot()})}nt(t){var n,r;(n=Ot.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&t(),(r=Ot.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",a=>{a?hT.error("failed to load script",a):t()})}ot(){var t;if(mt){if(!this.st&&(t=Ot.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=Sr(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.st=Ot.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.st.start(mt),hT.info("starting...")}}else hT.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,hT.info("stopping..."))}};var gm=Vr("[ExceptionAutocapture]");let bre=class{constructor(t){var n,r,a;this.lt=()=>{var s;if(Ce&&this.isEnabled&&(s=Ot.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var i=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,l=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=Ot.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ht&&this.A.capture_unhandled_errors&&(this.ht=i(this.captureException.bind(this))),!this.ut&&this.A.capture_unhandled_rejections&&(this.ut=l(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=c(this.captureException.bind(this)))}catch(u){gm.error("failed to start",u),this.vt()}}},this._instance=t,this.ct=!((n=this._instance.persistence)==null||!n.props[iU]),this.A=this.ft(),this.gt=new L8({refillRate:(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(a=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&a!==void 0?a:10,refillInterval:1e4,R:gm}),this.startIfEnabled()}ft(){var t=this._instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Sr(t)?n=ft({},n,t):(rt(t)?this.ct:t)&&(n=ft({},n,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(gm.info("enabled"),this.nt(this.lt))}nt(t){var n,r;(n=Ot.__PosthogExtensions__)!=null&&n.errorWrappingFunctions&&t(),(r=Ot.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",a=>{if(a)return gm.error("failed to load script",a);t()})}vt(){var t,n,r;(t=this.ht)==null||t.call(this),this.ht=void 0,(n=this.ut)==null||n.call(this),this.ut=void 0,(r=this.dt)==null||r.call(this),this.dt=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.ct=!!n||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[iU]:this.ct}),this.startIfEnabled()}captureException(t){var n,r=this._instance.requestRouter.endpointFor("ui");t.$exception_personURL=r+"/project/"+this._instance.config.token+"/person/"+this._instance.get_distinct_id();var a=(n=t.$exception_list[0].type)!==null&&n!==void 0?n:"Exception";this.gt.consumeRateLimit(a)?gm.info("Skipping exception capture because of client rate limiting.",{exception:t.$exception_list[0].type}):this._instance.exceptions.sendExceptionEvent(t)}};function Q8(e){return!rt(Event)&&J8(e,Event)}function J8(e,t){try{return e instanceof t}catch(n){return!1}}function Z8(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return J8(e,Error)}}function ey(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function zv(e){return ey(e,"DOMError")}var bU=/\(error: (.*)\)/,vU=50,Qd="?";function qv(e,t,n,r){var a={platform:"web:javascript",filename:e,function:t==="<anonymous>"?Qd:t,in_app:!0};return rt(n)||(a.lineno=n),rt(r)||(a.colno=r),a}var vre=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Are=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Rre=/\((\S*)(?::(\d+))(?::(\d+))\)/,Nre=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,_re=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wre=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort((a,s)=>a[0]-s[0]).map(a=>a[1]);return function(a,s){s===void 0&&(s=0);for(var i=[],l=a.split("\n"),c=s;c<l.length;c++){var u=l[c];if(!(u.length>1024)){var h=bU.test(u)?u.replace(bU,"$1"):u;if(!h.match(/\S*Error: /)){for(var m of r){var p=m(h);if(p){i.push(p);break}}if(i.length>=vU)break}}}return function(g){if(!g.length)return[];var T=Array.from(g);return T.reverse(),T.slice(0,vU).map(y=>ft({},y,{filename:y.filename||Cre(T).filename,function:y.function||Qd}))}(i)}}([30,e=>{var t=vre.exec(e);if(t){var[,n,r,a]=t;return qv(n,Qd,+r,+a)}var s=Are.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){var i=Rre.exec(s[2]);i&&(s[2]=i[1],s[3]=i[2],s[4]=i[3])}var[l,c]=RU(s[1]||Qd,s[2]);return qv(c,l,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}}],[50,e=>{var t=Nre.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=_re.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],a=t[1]||Qd;return[a,r]=RU(a,r),qv(r,a,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function Cre(e){return e[e.length-1]||{}}var fT,AU,Yv,RU=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:Qd,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Ire=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function _1(e,t){t===void 0&&(t=0);var n=e.stacktrace||e.stack||"",r=function(i){return i&&Ore.test(i.message)?1:0}(e);try{var a=wre,s=function(i,l){var c=function(u){var h=globalThis._posthogChunkIds;if(!h)return{};var m=Object.keys(h);return Yv&&m.length===AU||(AU=m.length,Yv=m.reduce((p,g)=>{fT||(fT={});var T=fT[g];if(T)p[T[0]]=T[1];else for(var y=u(g),b=y.length-1;b>=0;b--){var x=y[b],R=x==null?void 0:x.filename,A=h[g];if(R&&A){p[R]=A,fT[g]=[R,A];break}}return p},{})),Yv}(l);return i.forEach(u=>{u.filename&&(u.chunk_id=c[u.filename])}),i}(a(n,r),a);return s.slice(0,s.length-t)}catch(i){}return[]}var Ore=/Minified React error #\d+;/i;function Lre(e,t){var n,r,a=_1(e),s=(n=t==null?void 0:t.handled)===null||n===void 0||n,i=(r=t==null?void 0:t.synthetic)!==null&&r!==void 0&&r;return{type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(l){var c=l.message;return c.error&&typeof c.error.message=="string"?String(c.error.message):String(c)}(e),stacktrace:{frames:a,type:"raw"},mechanism:{handled:s,synthetic:i}}}function eq(e,t){var n=Lre(e,t);return e.cause&&Z8(e.cause)&&e.cause!==e?[n,...eq(e.cause,{handled:t==null?void 0:t.handled,synthetic:t==null?void 0:t.synthetic})]:[n]}function Wv(e,t){return{$exception_list:eq(e,t),$exception_level:"error"}}function Xv(e,t){var n,r,a,s=(n=t==null?void 0:t.handled)===null||n===void 0||n,i=(r=t==null?void 0:t.synthetic)===null||r===void 0||r,l={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(a=t==null?void 0:t.defaultExceptionType)!==null&&a!==void 0?a:"Error",value:e||(t==null?void 0:t.defaultExceptionMessage),mechanism:{handled:s,synthetic:i}};if(t!=null&&t.syntheticException){var c=_1(t.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:"error"}}function Mre(e){return vr(e)&&!oI(e)&&sre.indexOf(e)>=0}function Dre(e,t){var n,r,a=(n=t==null?void 0:t.handled)===null||n===void 0||n,s=(r=t==null?void 0:t.synthetic)===null||r===void 0||r,i=t!=null&&t.overrideExceptionType?t.overrideExceptionType:Q8(e)?e.constructor.name:"Error",l="Non-Error 'exception' captured with keys: "+function(h,m){m===void 0&&(m=40);var p=Object.keys(h);if(p.sort(),!p.length)return"[object has no keys]";for(var g=p.length;g>0;g--){var T=p.slice(0,g).join(", ");if(!(T.length>m))return g===p.length||T.length<=m?T:T.slice(0,m)+"..."}return""}(e),c={type:i,value:l,mechanism:{handled:a,synthetic:s}};if(t!=null&&t.syntheticException){var u=_1(t==null?void 0:t.syntheticException,1);u.length&&(c.stacktrace={frames:u,type:"raw"})}return{$exception_list:[c],$exception_level:Mre(e.level)?e.level:"error"}}function Pre(e,t){var{error:n,event:r}=e,a={$exception_list:[]},s=n||r;if(zv(s)||function(p){return ey(p,"DOMException")}(s)){var i=s;if(function(p){return"stack"in p}(s))a=Wv(s,t);else{var l=i.name||(zv(i)?"DOMError":"DOMException"),c=i.message?l+": "+i.message:l;a=Xv(c,ft({},t,{overrideExceptionType:zv(i)?"DOMError":"DOMException",defaultExceptionMessage:c}))}return"code"in i&&(a.$exception_DOMException_code=""+i.code),a}if(function(p){return ey(p,"ErrorEvent")}(s)&&s.error)return Wv(s.error,t);if(Z8(s))return Wv(s,t);if(function(p){return ey(p,"Object")}(s)||Q8(s))return Dre(s,t);if(rt(n)&&vr(r)){var u="Error",h=r,m=r.match(Ire);return m&&(u=m[1],h=m[2]),Xv(h,ft({},t,{overrideExceptionType:u,defaultExceptionMessage:h}))}return Xv(s,t)}function NU(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],a=n(r);return Hs(a)&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=a,()=>{e[t]=r}}catch(s){return()=>{}}}let kre=class{constructor(t){var n;this._instance=t,this._t=(Ce==null||(n=Ce.location)==null?void 0:n.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(ht.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.bt&&this.bt(),this.bt=void 0,ht.info("History API monitoring stopped")}monitorHistoryChanges(){var t,n;if(Ce&&Ce.history){var r=this;(t=Ce.history.pushState)!=null&&t.__posthog_wrapped__||NU(Ce.history,"pushState",a=>function(s,i,l){a.call(this,s,i,l),r.yt("pushState")}),(n=Ce.history.replaceState)!=null&&n.__posthog_wrapped__||NU(Ce.history,"replaceState",a=>function(s,i,l){a.call(this,s,i,l),r.yt("replaceState")}),this.wt()}}yt(t){try{var n,r=Ce==null||(n=Ce.location)==null?void 0:n.pathname;if(!r)return;r!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:t}),this._t=r}catch(a){ht.error("Error capturing "+t+" pageview",a)}}wt(){if(!this.bt){var t=()=>{this.yt("popstate")};pr(Ce,"popstate",t),this.bt=()=>{Ce&&Ce.removeEventListener("popstate",t)}}}};function Cy(e){var t,n;return((t=JSON.stringify(e,(n=[],function(r,a){if(Sr(a)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(a)?"[Circular]":(n.push(a),a)}return a})))==null?void 0:t.length)||0}function xI(e,t){if(t===void 0&&(t=66060288e-1),e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),r=e.data.slice(0,n),a=e.data.slice(n);return[xI({size:Cy(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),xI({size:Cy(a),data:a,sessionId:e.sessionId,windowId:e.windowId})].flatMap(s=>s)}return[e]}var Ao=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Ao||{}),ci=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(ci||{}),SI="[SessionRecording]",bI="redacted",mT={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},jre=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Ure=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Fre=["/s/","/e/","/i/"];function _U(e,t,n,r){if(Nn(e))return e;var a=(t==null?void 0:t["content-length"])||function(s){return new Blob([s]).size}(e);return vr(a)&&(a=parseInt(a)),a>n?SI+" "+r+" body too large to record ("+a+" bytes)":e}function wU(e,t){if(Nn(e))return e;var n=e;return xh(n,!1)||(n=SI+" "+t+" body "+bI),Bn(Ure,r=>{var a,s;(a=n)!=null&&a.length&&((s=n)==null?void 0:s.indexOf(r))!==-1&&(n=SI+" "+t+" body "+bI+" as might contain: "+r)}),n}var $re=(e,t)=>{var n,r,a,s={payloadSizeLimitBytes:mT.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...mT.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...mT.payloadHostDenyList]},i=e.session_recording.recordHeaders!==!1&&t.recordHeaders,l=e.session_recording.recordBody!==!1&&t.recordBody,c=e.capture_performance!==!1&&t.recordPerformance,u=(n=s,a=Math.min(1e6,(r=n.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),p=>(p!=null&&p.requestBody&&(p.requestBody=_U(p.requestBody,p.requestHeaders,a,"Request")),p!=null&&p.responseBody&&(p.responseBody=_U(p.responseBody,p.responseHeaders,a,"Response")),p)),h=p=>{return u(((y,b)=>{var x,R=Sh(y.name),A=b.indexOf("http")===0?(x=Sh(b))==null?void 0:x.pathname:b;A==="/"&&(A="");var w=R==null?void 0:R.pathname.replace(A||"","");if(!(R&&w&&Fre.some(_=>w.indexOf(_)===0)))return y})((T=(g=p).requestHeaders,Nn(T)||Bn(Object.keys(T!=null?T:{}),y=>{jre.includes(y.toLowerCase())&&(T[y]=bI)}),g),e.api_host));var g,T},m=Hs(e.session_recording.maskNetworkRequestFn);return m&&Hs(e.session_recording.maskCapturedNetworkRequestFn)&&ht.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),m&&(e.session_recording.maskCapturedNetworkRequestFn=p=>{var g=e.session_recording.maskNetworkRequestFn({url:p.name});return ft({},p,{name:g==null?void 0:g.url})}),s.maskRequestFn=Hs(e.session_recording.maskCapturedNetworkRequestFn)?p=>{var g,T=h(p);return T&&(g=e.session_recording.maskCapturedNetworkRequestFn==null?void 0:e.session_recording.maskCapturedNetworkRequestFn(T))!==null&&g!==void 0?g:void 0}:p=>function(g){if(!rt(g))return g.requestBody=wU(g.requestBody,"Request"),g.responseBody=wU(g.responseBody,"Response"),g}(h(p)),ft({},mT,s,{recordHeaders:i,recordBody:l,recordPerformance:c,recordInitialRequests:c})};class Bre{constructor(t,n){var r,a;n===void 0&&(n={}),this.St={},this.$t=s=>{if(!this.St[s]){var i,l;this.St[s]=!0;var c=this.kt(s);(i=(l=this.i).onBlockedNode)==null||i.call(l,s,c)}},this.xt=s=>{var i=this.kt(s);if((i==null?void 0:i.nodeName)!=="svg"&&i instanceof Element){var l=i.closest("svg");if(l)return[this._rrweb.mirror.getId(l),l]}return[s,i]},this.kt=s=>this._rrweb.mirror.getNode(s),this.Et=s=>{var i,l,c,u,h,m,p,g;return((i=(l=s.removes)==null?void 0:l.length)!==null&&i!==void 0?i:0)+((c=(u=s.attributes)==null?void 0:u.length)!==null&&c!==void 0?c:0)+((h=(m=s.texts)==null?void 0:m.length)!==null&&h!==void 0?h:0)+((p=(g=s.adds)==null?void 0:g.length)!==null&&p!==void 0?p:0)},this.throttleMutations=s=>{if(s.type!==3||s.data.source!==0)return s;var i=s.data,l=this.Et(i);i.attributes&&(i.attributes=i.attributes.filter(u=>{var[h]=this.xt(u.id);return!this.gt.consumeRateLimit(h)&&u}));var c=this.Et(i);return c!==0||l===c?s:void 0},this._rrweb=t,this.i=n,this.gt=new L8({bucketSize:(r=this.i.bucketSize)!==null&&r!==void 0?r:100,refillRate:(a=this.i.refillRate)!==null&&a!==void 0?a:10,refillInterval:1e3,I:this.$t,R:ht})}}var Vs=Uint8Array,as=Uint16Array,bh=Uint32Array,w1=new Vs([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),C1=new Vs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),CU=new Vs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tq=function(e,t){for(var n=new as(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var a=new bh(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)a[s]=s-n[r]<<5|r;return[n,a]},nq=tq(w1,2),Hre=nq[0],vI=nq[1];Hre[28]=258,vI[258]=28;for(var IU=tq(C1,0)[1],rq=new as(32768),sr=0;sr<32768;++sr){var Rc=(43690&sr)>>>1|(21845&sr)<<1;Rc=(61680&(Rc=(52428&Rc)>>>2|(13107&Rc)<<2))>>>4|(3855&Rc)<<4,rq[sr]=((65280&Rc)>>>8|(255&Rc)<<8)>>>1}var xp=function(e,t,n){for(var r=e.length,a=0,s=new as(t);a<r;++a)++s[e[a]-1];var i,l=new as(t);for(a=0;a<t;++a)l[a]=l[a-1]+s[a-1]<<1;for(i=new as(r),a=0;a<r;++a)i[a]=rq[l[e[a]-1]++]>>>15-e[a];return i},lu=new Vs(288);for(sr=0;sr<144;++sr)lu[sr]=8;for(sr=144;sr<256;++sr)lu[sr]=9;for(sr=256;sr<280;++sr)lu[sr]=7;for(sr=280;sr<288;++sr)lu[sr]=8;var Iy=new Vs(32);for(sr=0;sr<32;++sr)Iy[sr]=5;var Vre=xp(lu,9),Gre=xp(Iy,5),aq=function(e){return(e/8>>0)+(7&e&&1)},sq=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof as?as:e instanceof bh?bh:Vs)(n-t);return r.set(e.subarray(t,n)),r},So=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},Em=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},Kv=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var a=n.length,s=n.slice();if(!a)return[new Vs(0),0];if(a==1){var i=new Vs(n[0].s+1);return i[n[0].s]=1,[i,1]}n.sort(function(_,N){return _.f-N.f}),n.push({s:-1,f:25001});var l=n[0],c=n[1],u=0,h=1,m=2;for(n[0]={s:-1,f:l.f+c.f,l,r:c};h!=a-1;)l=n[n[u].f<n[m].f?u++:m++],c=n[u!=h&&n[u].f<n[m].f?u++:m++],n[h++]={s:-1,f:l.f+c.f,l,r:c};var p=s[0].s;for(r=1;r<a;++r)s[r].s>p&&(p=s[r].s);var g=new as(p+1),T=AI(n[h-1],g,0);if(T>t){r=0;var y=0,b=T-t,x=1<<b;for(s.sort(function(_,N){return g[N.s]-g[_.s]||_.f-N.f});r<a;++r){var R=s[r].s;if(!(g[R]>t))break;y+=x-(1<<T-g[R]),g[R]=t}for(y>>>=b;y>0;){var A=s[r].s;g[A]<t?y-=1<<t-g[A]++-1:++r}for(;r>=0&&y;--r){var w=s[r].s;g[w]==t&&(--g[w],++y)}T=t}return[new Vs(g),T]},AI=function(e,t,n){return e.s==-1?Math.max(AI(e.l,t,n+1),AI(e.r,t,n+1)):t[e.s]=n},OU=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new as(++t),r=0,a=e[0],s=1,i=function(c){n[r++]=c},l=1;l<=t;++l)if(e[l]==a&&l!=t)++s;else{if(!a&&s>2){for(;s>138;s-=138)i(32754);s>2&&(i(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(i(a),--s;s>6;s-=6)i(8304);s>2&&(i(s-3<<5|8208),s=0)}for(;s--;)i(a);s=1,a=e[l]}return[n.subarray(0,r),t]},Tm=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},RI=function(e,t,n){var r=n.length,a=aq(t+2);e[a]=255&r,e[a+1]=r>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var s=0;s<r;++s)e[a+s+4]=n[s];return 8*(a+4+r)},LU=function(e,t,n,r,a,s,i,l,c,u,h){So(t,h++,n),++a[256];for(var m=Kv(a,15),p=m[0],g=m[1],T=Kv(s,15),y=T[0],b=T[1],x=OU(p),R=x[0],A=x[1],w=OU(y),_=w[0],N=w[1],I=new as(19),D=0;D<R.length;++D)I[31&R[D]]++;for(D=0;D<_.length;++D)I[31&_[D]]++;for(var M=Kv(I,7),O=M[0],L=M[1],k=19;k>4&&!O[CU[k-1]];--k);var F,U,B,j,G=u+5<<3,K=Tm(a,lu)+Tm(s,Iy)+i,J=Tm(a,p)+Tm(s,y)+i+14+3*k+Tm(I,O)+(2*I[16]+3*I[17]+7*I[18]);if(G<=K&&G<=J)return RI(t,h,e.subarray(c,c+u));if(So(t,h,1+(J<K)),h+=2,J<K){F=xp(p,g),U=p,B=xp(y,b),j=y;var $=xp(O,L);for(So(t,h,A-257),So(t,h+5,N-1),So(t,h+10,k-4),h+=14,D=0;D<k;++D)So(t,h+3*D,O[CU[D]]);h+=3*k;for(var X=[R,_],Z=0;Z<2;++Z){var V=X[Z];for(D=0;D<V.length;++D){var te=31&V[D];So(t,h,$[te]),h+=O[te],te>15&&(So(t,h,V[D]>>>5&127),h+=V[D]>>>12)}}}else F=Vre,U=lu,B=Gre,j=Iy;for(D=0;D<l;++D)if(r[D]>255){te=r[D]>>>18&31,Em(t,h,F[te+257]),h+=U[te+257],te>7&&(So(t,h,r[D]>>>23&31),h+=w1[te]);var ae=31&r[D];Em(t,h,B[ae]),h+=j[ae],ae>3&&(Em(t,h,r[D]>>>5&8191),h+=C1[ae])}else Em(t,h,F[r[D]]),h+=U[r[D]];return Em(t,h,F[256]),h+U[256]},zre=new bh([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qre=function(){for(var e=new bh(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Yre=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=qre[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},Wre=function(e,t,n,r,a){return function(s,i,l,c,u,h){var m=s.length,p=new Vs(c+m+5*(1+Math.floor(m/7e3))+u),g=p.subarray(c,p.length-u),T=0;if(!i||m<8)for(var y=0;y<=m;y+=65535){var b=y+65535;b<m?T=RI(g,T,s.subarray(y,b)):(g[y]=h,T=RI(g,T,s.subarray(y,m)))}else{for(var x=zre[i-1],R=x>>>13,A=8191&x,w=(1<<l)-1,_=new as(32768),N=new as(w+1),I=Math.ceil(l/3),D=2*I,M=function(re){return(s[re]^s[re+1]<<I^s[re+2]<<D)&w},O=new bh(25e3),L=new as(288),k=new as(32),F=0,U=0,B=(y=0,0),j=0,G=0;y<m;++y){var K=M(y),J=32767&y,$=N[K];if(_[J]=$,N[K]=J,j<=y){var X=m-y;if((F>7e3||B>24576)&&X>423){T=LU(s,g,0,O,L,k,U,B,G,y-G,T),B=F=U=0,G=y;for(var Z=0;Z<286;++Z)L[Z]=0;for(Z=0;Z<30;++Z)k[Z]=0}var V=2,te=0,ae=A,ne=J-$&32767;if(X>2&&K==M(y-ne))for(var ce=Math.min(R,X)-1,ie=Math.min(32767,y),W=Math.min(258,X);ne<=ie&&--ae&&J!=$;){if(s[y+V]==s[y+V-ne]){for(var Q=0;Q<W&&s[y+Q]==s[y+Q-ne];++Q);if(Q>V){if(V=Q,te=ne,Q>ce)break;var se=Math.min(ne,Q-2),z=0;for(Z=0;Z<se;++Z){var xe=y-ne+Z+32768&32767,le=xe-_[xe]+32768&32767;le>z&&(z=le,$=xe)}}}ne+=(J=$)-($=_[J])+32768&32767}if(te){O[B++]=268435456|vI[V]<<18|IU[te];var pe=31&vI[V],_e=31&IU[te];U+=w1[pe]+C1[_e],++L[257+pe],++k[_e],j=y+V,++F}else O[B++]=s[y],++L[s[y]]}}T=LU(s,g,h,O,L,k,U,B,G,y-G,T)}return sq(p,0,c+aq(T)+u)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},NI=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Xre=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&NI(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},Kre=function(e){return 10+(e.filename&&e.filename.length+1||0)};function iq(e,t){t===void 0&&(t={});var n=Yre(),r=e.length;n.p(e);var a=Wre(e,t,Kre(t),8),s=a.length;return Xre(a,t),NI(a,s-8,n.d()),NI(a,s-4,r),a}function oq(e,t){var n=e.length;if(typeof TextEncoder!="undefined")return new TextEncoder().encode(e);for(var r=new Vs(e.length+(e.length>>>1)),a=0,s=function(u){r[a++]=u},i=0;i<n;++i){if(a+5>r.length){var l=new Vs(a+8+(n-i<<1));l.set(r),r=l}var c=e.charCodeAt(i);c<128||t?s(c):c<2048?(s(192|c>>>6),s(128|63&c)):c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++i))>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|63&c)):(s(224|c>>>12),s(128|c>>>6&63),s(128|63&c))}return sq(r,0,a)}function Qre(e,t){return function(n){for(var r=0,a=0;a<n.length;a++)r=(r<<5)-r+n.charCodeAt(a),r|=0;return Math.abs(r)}(e)%100<Ts(100*t,0,100,ht)}var Mo="disabled",I1="sampled",Oy="active",cu="buffering",O1="paused",L1="trigger",ji=L1+"_activated",La=L1+"_pending",zi=L1+"_"+Mo;function MU(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let lq=class{constructor(t){this.It=t}triggerStatus(t){var n=this.It.map(r=>r.triggerStatus(t));return n.includes(ji)?ji:n.includes(La)?La:zi}stop(){this.It.forEach(t=>t.stop())}},cq=class{constructor(t){this.It=t}triggerStatus(t){var n=new Set;for(var r of this.It)n.add(r.triggerStatus(t));switch(n.delete(zi),n.size){case 0:return zi;case 1:return Array.from(n)[0];default:return La}}stop(){this.It.forEach(t=>t.stop())}};class Jre{triggerStatus(){return La}stop(){}}class Zre{constructor(t){this.Rt=[],this.Pt=[],this.urlBlocked=!1,this._instance=t}onRemoteConfig(t){var n,r;this.Rt=((n=t.sessionRecording)==null?void 0:n.urlTriggers)||[],this.Pt=((r=t.sessionRecording)==null?void 0:r.urlBlocklist)||[]}Tt(t){var n;return this.Rt.length===0?zi:((n=this._instance)==null?void 0:n.get_property(uI))===t?ji:La}triggerStatus(t){var n=this.Tt(t),r=n===ji?ji:n===La?La:zi;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlTriggerConditions(t,n,r){if(Ce!==void 0&&Ce.location.href){var a=Ce.location.href,s=this.urlBlocked,i=MU(a,this.Pt);s&&i||(i&&!s?t():!i&&s&&n(),MU(a,this.Rt)&&r("url"))}}stop(){}}class eae{constructor(t){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ct=()=>{},this._instance=t}triggerStatus(){var t=La;return Nn(this.linkedFlag)&&(t=zi),this.linkedFlagSeen&&(t=ji),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:t}),t}onRemoteConfig(t,n){var r;if(this.linkedFlag=((r=t.sessionRecording)==null?void 0:r.linkedFlag)||null,!Nn(this.linkedFlag)&&!this.linkedFlagSeen){var a=vr(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=vr(this.linkedFlag)?null:this.linkedFlag.variant;this.Ct=this._instance.onFeatureFlags((i,l)=>{var c=!1;if(Sr(l)&&a in l){var u=l[a];c=Mi(u)?u===!0:s?u===s:!!u}this.linkedFlagSeen=c,c&&n(a,s)})}}stop(){this.Ct()}}class tae{constructor(t){this.Mt=[],this._instance=t}onRemoteConfig(t){var n;this.Mt=((n=t.sessionRecording)==null?void 0:n.eventTriggers)||[]}Ot(t){var n;return this.Mt.length===0?zi:((n=this._instance)==null?void 0:n.get_property(dI))===t?ji:La}triggerStatus(t){var n=this.Ot(t),r=n===ji?ji:n===La?La:zi;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}stop(){}}function nae(e){return e.isRecordingEnabled?cu:Mo}function rae(e){if(!e.receivedFlags)return cu;if(!e.isRecordingEnabled)return Mo;if(e.urlTriggerMatching.urlBlocked)return O1;var t=e.isSampled===!0,n=new lq([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?I1:n===ji?Oy:n===La?cu:e.isSampled===!1?Mo:Oy}function aae(e){if(!e.receivedFlags)return cu;if(!e.isRecordingEnabled)return Mo;if(e.urlTriggerMatching.urlBlocked)return O1;var t=new cq([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),n=t!==zi,r=Mi(e.isSampled);return n&&t===La?cu:n&&t===zi||r&&!e.isSampled?Mo:e.isSampled===!0?I1:Oy}var op="[SessionRecording]",Wr=Vr(op);function pT(){var e;return Ot==null||(e=Ot.__PosthogExtensions__)==null||(e=e.rrweb)==null?void 0:e.record}var sae=3e5,iae=[ci.MouseMove,ci.MouseInteraction,ci.Scroll,ci.ViewportResize,ci.Input,ci.TouchMove,ci.MediaInteraction,ci.Drag],DU=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Nc(e){return function(t,n){for(var r="",a=0;a<t.length;){var s=t[a++];r+=String.fromCharCode(s)}return r}(iq(oq(JSON.stringify(e))))}function PU(e){return e.type===Ao.Custom&&e.data.tag==="sessionIdle"}class kU{get sessionId(){return this.Ft}get At(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Dt}get jt(){if(!this._instance.sessionManager)throw new Error(op+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Lt(){var t,n;return this.Nt.triggerStatus(this.sessionId)===La?6e4:(t=(n=this._instance.config.session_recording)==null?void 0:n.full_snapshot_interval_millis)!==null&&t!==void 0?t:sae}get zt(){var t=this._instance.get_property(ap);return Mi(t)?t:null}get Ut(){var t,n,r=(t=this.H)==null?void 0:t.data[((n=this.H)==null?void 0:n.data.length)-1],{sessionStartTimestamp:a}=this.jt.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-a:null}get qt(){var t=!!this._instance.get_property(Hp),n=!this._instance.config.disable_session_recording;return Ce&&t&&n}get Bt(){var t=!!this._instance.get_property(uU),n=this._instance.config.enable_recording_console_log;return n!=null?n:t}get Ht(){var t,n,r,a,s,i,l=this._instance.config.session_recording.captureCanvas,c=this._instance.get_property(fU),u=(t=(n=l==null?void 0:l.recordCanvas)!==null&&n!==void 0?n:c==null?void 0:c.enabled)!==null&&t!==void 0&&t,h=(r=(a=l==null?void 0:l.canvasFps)!==null&&a!==void 0?a:c==null?void 0:c.fps)!==null&&r!==void 0?r:4,m=(s=(i=l==null?void 0:l.canvasQuality)!==null&&i!==void 0?i:c==null?void 0:c.quality)!==null&&s!==void 0?s:.4;if(typeof m=="string"){var p=parseFloat(m);m=isNaN(p)?.4:p}return{enabled:u,fps:Ts(h,0,12,Wr.createLogger("canvas recording fps"),4),quality:Ts(m,0,1,Wr.createLogger("canvas recording quality"),.4)}}get Wt(){var t,n,r=this._instance.get_property(dU),a={recordHeaders:(t=this._instance.config.session_recording)==null?void 0:t.recordHeaders,recordBody:(n=this._instance.config.session_recording)==null?void 0:n.recordBody},s=(a==null?void 0:a.recordHeaders)||(r==null?void 0:r.recordHeaders),i=(a==null?void 0:a.recordBody)||(r==null?void 0:r.recordBody),l=Sr(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,c=!!(Mi(l)?l:r!=null&&r.capturePerformance);return s||i||c?{recordHeaders:s,recordBody:i,recordPerformance:c}:void 0}get Gt(){var t,n,r,a,s,i,l=this._instance.get_property(hU),c={maskAllInputs:(t=this._instance.config.session_recording)==null?void 0:t.maskAllInputs,maskTextSelector:(n=this._instance.config.session_recording)==null?void 0:n.maskTextSelector,blockSelector:(r=this._instance.config.session_recording)==null?void 0:r.blockSelector},u=(a=c==null?void 0:c.maskAllInputs)!==null&&a!==void 0?a:l==null?void 0:l.maskAllInputs,h=(s=c==null?void 0:c.maskTextSelector)!==null&&s!==void 0?s:l==null?void 0:l.maskTextSelector,m=(i=c==null?void 0:c.blockSelector)!==null&&i!==void 0?i:l==null?void 0:l.blockSelector;return rt(u)&&rt(h)&&rt(m)?void 0:{maskAllInputs:u==null||u,maskTextSelector:h,blockSelector:m}}get Jt(){var t=this._instance.get_property(mU);return _a(t)?t:null}get Vt(){var t=this._instance.get_property(pU);return _a(t)?t:null}get status(){return this.Kt?this.Yt({receivedFlags:this.Kt,isRecordingEnabled:this.qt,isSampled:this.zt,urlTriggerMatching:this.Xt,eventTriggerMatching:this.Qt,linkedFlagMatching:this.Zt,sessionId:this.sessionId}):cu}constructor(t){if(this.Yt=nae,this.Kt=!1,this.ti=[],this.ii="unknown",this.ei=Date.now(),this.Nt=new Jre,this.ri=void 0,this.si=void 0,this.ni=void 0,this.oi=void 0,this.ai=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.li=()=>{this.hi()},this.ui=()=>{this.di("browser offline",{})},this.vi=()=>{this.di("browser online",{})},this.ci=()=>{if(mt!=null&&mt.visibilityState){var a="window "+mt.visibilityState;this.di(a,{})}},this._instance=t,this.Dt=!1,this.fi="/s/",this.pi=void 0,this.Kt=!1,!this._instance.sessionManager)throw Wr.error("started without valid sessionManager"),new Error(op+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(op+' cannot be used with cookieless_mode="always"');this.Zt=new eae(this._instance),this.Xt=new Zre(this._instance),this.Qt=new tae(this._instance);var{sessionId:n,windowId:r}=this.jt.checkAndGetSessionAndWindowId();this.Ft=n,this.gi=r,this.H=this.mi(),this.At>=this.jt.sessionTimeoutMs&&Wr.warn("session_idle_threshold_ms ("+this.At+") is greater than the session timeout ("+this.jt.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(t){this.qt?(this.bi(t),pr(Ce,"beforeunload",this.li),pr(Ce,"offline",this.ui),pr(Ce,"online",this.vi),pr(Ce,"visibilitychange",this.ci),this.yi(),this.wi(),Nn(this.ri)&&(this.ri=this._instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var r=n!=null&&n.properties.$current_url?this.Si(n==null?void 0:n.properties.$current_url):"";if(!r)return;this.di("$pageview",{href:r})}}catch(a){Wr.error("Could not add $pageview to rrweb session",a)}})),this.si||(this.si=this.jt.onSessionId((n,r,a)=>{var s,i;a&&(this.di("$session_id_change",{sessionId:n,windowId:r,changeReason:a}),(s=this._instance)==null||(s=s.persistence)==null||s.unregister(dI),(i=this._instance)==null||(i=i.persistence)==null||i.unregister(uI))}))):this.stopRecording()}stopRecording(){var t,n,r,a;this.Dt&&this.pi&&(this.pi(),this.pi=void 0,this.Dt=!1,Ce==null||Ce.removeEventListener("beforeunload",this.li),Ce==null||Ce.removeEventListener("offline",this.ui),Ce==null||Ce.removeEventListener("online",this.vi),Ce==null||Ce.removeEventListener("visibilitychange",this.ci),this.mi(),clearInterval(this.$i),(t=this.ri)==null||t.call(this),this.ri=void 0,(n=this.ai)==null||n.call(this),this.ai=void 0,(r=this.si)==null||r.call(this),this.si=void 0,(a=this.oi)==null||a.call(this),this.oi=void 0,this.Qt.stop(),this.Xt.stop(),this.Zt.stop(),Wr.info("stopped"))}ki(){var t;(t=this._instance.persistence)==null||t.unregister(ap)}xi(t){var n,r=this.Ft!==t,a=this.Jt;if(_a(a)){var s=this.zt,i=r||!Mi(s),l=i?Qre(t,a):s;i&&(l?this.Ei(I1):Wr.warn("Sample rate ("+a+") has determined that this sessionId ("+t+") will not be sent to the server."),this.di("samplingDecisionMade",{sampleRate:a,isSampled:l})),(n=this._instance.persistence)==null||n.register({[ap]:l})}else this.ki()}onRemoteConfig(t){var n,r,a,s;this.di("$remote_config_received",t),this.Ii(t),(n=t.sessionRecording)!=null&&n.endpoint&&(this.fi=(s=t.sessionRecording)==null?void 0:s.endpoint),this.yi(),((r=t.sessionRecording)==null?void 0:r.triggerMatchType)==="any"?(this.Yt=rae,this.Nt=new lq([this.Qt,this.Xt])):(this.Yt=aae,this.Nt=new cq([this.Qt,this.Xt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:(a=t.sessionRecording)==null?void 0:a.triggerMatchType}),this.Xt.onRemoteConfig(t),this.Qt.onRemoteConfig(t),this.Zt.onRemoteConfig(t,(i,l)=>{this.Ei("linked_flag_matched",{flag:i,variant:l})}),this.Kt=!0,this.startIfEnabledOrStop()}yi(){_a(this.Jt)&&Nn(this.oi)&&(this.oi=this.jt.onSessionId(t=>{this.xi(t)}))}Ii(t){if(this._instance.persistence){var n,r=this._instance.persistence,a=()=>{var s,i,l,c,u,h,m,p,g,T=(s=t.sessionRecording)==null?void 0:s.sampleRate,y=Nn(T)?null:parseFloat(T);Nn(y)&&this.ki();var b=(i=t.sessionRecording)==null?void 0:i.minimumDurationMilliseconds;r.register({[Hp]:!!t.sessionRecording,[uU]:(l=t.sessionRecording)==null?void 0:l.consoleLogRecordingEnabled,[dU]:ft({capturePerformance:t.capturePerformance},(c=t.sessionRecording)==null?void 0:c.networkPayloadCapture),[hU]:(u=t.sessionRecording)==null?void 0:u.masking,[fU]:{enabled:(h=t.sessionRecording)==null?void 0:h.recordCanvas,fps:(m=t.sessionRecording)==null?void 0:m.canvasFps,quality:(p=t.sessionRecording)==null?void 0:p.canvasQuality},[mU]:y,[pU]:rt(b)?null:b,[xy]:(g=t.sessionRecording)==null?void 0:g.scriptConfig})};a(),(n=this.ni)==null||n.call(this),this.ni=this.jt.onSessionId(a)}}log(t,n){var r;n===void 0&&(n="log"),(r=this._instance.sessionRecording)==null||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:n,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}bi(t){if(!rt(Object.assign)&&!rt(Array.from)&&!(this.Dt||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var n;this.Dt=!0,this.jt.checkAndGetSessionAndWindowId(),pT()?this.Ri():(n=Ot.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.Pi,r=>{if(r)return Wr.error("could not load recorder",r);this.Ri()}),Wr.info("starting"),this.status===Oy&&this.Ei(t||"recording_initialized")}}get Pi(){var t;return((t=this._instance)==null||(t=t.persistence)==null||(t=t.get_property(xy))==null?void 0:t.script)||"recorder"}Ti(t){var n;return t.type===3&&iae.indexOf((n=t.data)==null?void 0:n.source)!==-1}Ci(t){var n=this.Ti(t);n||this.ii||t.timestamp-this.ei>this.At&&(this.ii=!0,clearInterval(this.$i),this.di("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.ei,threshold:this.At,bufferLength:this.H.data.length,bufferSize:this.H.size}),this.hi());var r=!1;if(n&&(this.ei=t.timestamp,this.ii)){var a=this.ii==="unknown";this.ii=!1,a||(this.di("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!this.ii){var{windowId:s,sessionId:i}=this.jt.checkAndGetSessionAndWindowId(!n,t.timestamp),l=this.Ft!==i,c=this.gi!==s;this.gi=s,this.Ft=i,l||c?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&this.Mi()}}Oi(t){try{return t.rrwebMethod(),!0}catch(n){return this.ti.length<10?this.ti.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):Wr.warn("could not emit queued rrweb event.",n,t),!1}}di(t,n){return this.Oi(DU(()=>pT().addCustomEvent(t,n)))}Fi(){return this.Oi(DU(()=>pT().takeFullSnapshot()))}Ri(){var t,n,r,a,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},i=this._instance.config.session_recording;for(var[l,c]of Object.entries(i||{}))l in s&&(l==="maskInputOptions"?s.maskInputOptions=ft({password:!0},c):s[l]=c);this.Ht&&this.Ht.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.Ht.fps},s.dataURLOptions={type:"image/webp",quality:this.Ht.quality}),this.Gt&&(s.maskAllInputs=(n=this.Gt.maskAllInputs)===null||n===void 0||n,s.maskTextSelector=(r=this.Gt.maskTextSelector)!==null&&r!==void 0?r:void 0,s.blockSelector=(a=this.Gt.blockSelector)!==null&&a!==void 0?a:void 0);var u=pT();if(u){this.Ai=(t=this.Ai)!==null&&t!==void 0?t:new Bre(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(m,p)=>{var g="Too many mutations on node '"+m+"'. Rate limiting. This could be due to SVG animations or something similar";Wr.info(g,{node:p}),this.log(op+" "+g,"warn")}});var h=this.Di();this.pi=u(ft({emit:m=>{this.onRRwebEmit(m)},plugins:h},s)),this.ei=Date.now(),this.ii=Mi(this.ii)?this.ii:"unknown",this.di("$session_options",{sessionRecordingOptions:s,activePlugins:h.map(m=>m==null?void 0:m.name)}),this.di("$posthog_config",{config:this._instance.config})}else Wr.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Mi(){if(this.$i&&clearInterval(this.$i),this.ii!==!0){var t=this.Lt;t&&(this.$i=setInterval(()=>{this.Fi()},t))}}Di(){var t,n,r=[],a=(t=Ot.__PosthogExtensions__)==null||(t=t.rrwebPlugins)==null?void 0:t.getRecordConsolePlugin;a&&this.Bt&&r.push(a());var s=(n=Ot.__PosthogExtensions__)==null||(n=n.rrwebPlugins)==null?void 0:n.getRecordNetworkPlugin;return this.Wt&&Hs(s)&&(!ire.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(s($re(this._instance.config,this.Wt))):Wr.info("NetworkCapture not started because we are on localhost.")),r}onRRwebEmit(t){var n;if(this.ji(),t&&Sr(t)){if(t.type===Ao.Meta){var r=this.Si(t.data.href);if(this.Li=r,!r)return;t.data.href=r}else this.Ni();if(this.Xt.checkUrlTriggerConditions(()=>this.zi(),()=>this.Ui(),p=>this.qi(p)),!this.Xt.urlBlocked||(a=t).type===Ao.Custom&&a.data.tag==="recording paused"){var a;t.type===Ao.FullSnapshot&&this.Mi(),t.type===Ao.FullSnapshot&&this.Kt&&this.Nt.triggerStatus(this.sessionId)===La&&this.mi();var s=this.Ai?this.Ai.throttleMutations(t):t;if(s){var i=function(p){var g=p;if(g&&Sr(g)&&g.type===6&&Sr(g.data)&&g.data.plugin==="rrweb/console@1"){g.data.payload.payload.length>10&&(g.data.payload.payload=g.data.payload.payload.slice(0,10),g.data.payload.payload.push("...[truncated]"));for(var T=[],y=0;y<g.data.payload.payload.length;y++)g.data.payload.payload[y]&&g.data.payload.payload[y].length>2e3?T.push(g.data.payload.payload[y].slice(0,2e3)+"...[truncated]"):T.push(g.data.payload.payload[y]);return g.data.payload.payload=T,p}return p}(s);if(this.Ci(i),this.ii!==!0||PU(i)){if(PU(i)){var l=i.data.payload;if(l){var c=l.lastActivityTimestamp,u=l.threshold;i.timestamp=c+u}}var h=(n=this._instance.config.session_recording.compress_events)===null||n===void 0||n?function(p){if(Cy(p)<1024)return p;try{if(p.type===Ao.FullSnapshot)return ft({},p,{data:Nc(p.data),cv:"2024-10"});if(p.type===Ao.IncrementalSnapshot&&p.data.source===ci.Mutation)return ft({},p,{cv:"2024-10",data:ft({},p.data,{texts:Nc(p.data.texts),attributes:Nc(p.data.attributes),removes:Nc(p.data.removes),adds:Nc(p.data.adds)})});if(p.type===Ao.IncrementalSnapshot&&p.data.source===ci.StyleSheetRule)return ft({},p,{cv:"2024-10",data:ft({},p.data,{adds:p.data.adds?Nc(p.data.adds):void 0,removes:p.data.removes?Nc(p.data.removes):void 0})})}catch(g){Wr.error("could not compress event - will use uncompressed event",g)}return p}(i):i,m={$snapshot_bytes:Cy(h),$snapshot_data:h,$session_id:this.Ft,$window_id:this.gi};this.status!==Mo?this.Bi(m):this.mi()}}}}}Ni(){if(!this._instance.config.capture_pageview&&Ce){var t=this.Si(Ce.location.href);this.Li!==t&&(this.di("$url_changed",{href:t}),this.Li=t)}}ji(){if(this.ti.length){var t=[...this.ti];this.ti=[],t.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this.Oi(n)})}}Si(t){var n=this._instance.config.session_recording;if(n.maskNetworkRequestFn){var r,a={url:t};return(r=a=n.maskNetworkRequestFn(a))==null?void 0:r.url}return t}mi(){return this.H={size:0,data:[],sessionId:this.Ft,windowId:this.gi},this.H}hi(){this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0);var t=this.Vt,n=this.Ut,r=_a(n)&&n>=0,a=_a(t)&&r&&n<t;return this.status===cu||this.status===O1||this.status===Mo||a?(this.Hi=setTimeout(()=>{this.hi()},2e3),this.H):(this.H.data.length>0&&xI(this.H).forEach(s=>{this.Wi({$snapshot_bytes:s.size,$snapshot_data:s.data,$session_id:s.sessionId,$window_id:s.windowId,$lib:"web",$lib_version:_o.LIB_VERSION})}),this.mi())}Bi(t){var n,r=2+(((n=this.H)==null?void 0:n.data.length)||0);!this.ii&&(this.H.size+t.$snapshot_bytes+r>943718.4||this.H.sessionId!==this.Ft)&&(this.H=this.hi()),this.H.size+=t.$snapshot_bytes,this.H.data.push(t.$snapshot_data),this.Hi||this.ii||(this.Hi=setTimeout(()=>{this.hi()},2e3))}Wi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.fi),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}qi(t){var n;this.Nt.triggerStatus(this.sessionId)===La&&((n=this._instance)==null||(n=n.persistence)==null||n.register({[t==="url"?uI:dI]:this.Ft}),this.hi(),this.Ei(t+"_trigger_matched"))}zi(){this.Xt.urlBlocked||(this.Xt.urlBlocked=!0,clearInterval(this.$i),Wr.info("recording paused due to URL blocker"),this.di("recording paused",{reason:"url blocker"}))}Ui(){this.Xt.urlBlocked&&(this.Xt.urlBlocked=!1,this.Fi(),this.Mi(),this.di("recording resumed",{reason:"left blocked url"}),Wr.info("recording resumed"))}wi(){this.Qt.Mt.length!==0&&Nn(this.ai)&&(this.ai=this._instance.on("eventCaptured",t=>{try{this.Qt.Mt.includes(t.event)&&this.qi("event")}catch(n){Wr.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this.Zt.linkedFlagSeen=!0,this.Fi(),this.Ei("linked_flag_overridden")}overrideSampling(){var t;(t=this._instance.persistence)==null||t.register({[ap]:!0}),this.Fi(),this.Ei("sampling_overridden")}overrideTrigger(t){this.qi(t)}Ei(t,n){this._instance.register_for_session({$session_recording_start_reason:t}),Wr.info(t.replace("_"," "),n),an(["recording_initialized","session_id_changed"],t)||this.di(t,n)}get sdkDebugProperties(){var{sessionStartTimestamp:t}=this.jt.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.H.data.length,$sdk_debug_replay_internal_buffer_size:this.H.size,$sdk_debug_current_session_duration:this.Ut,$sdk_debug_session_start:t}}}var Qv=Vr("[SegmentIntegration]");function oae(e,t){var n=e.config.segment;if(!n)return t();(function(r,a){var s=r.config.segment;if(!s)return a();var i=c=>{var u=()=>c.anonymousId()||Nl();r.config.get_device_id=u,c.id()&&(r.register({distinct_id:c.id(),$device_id:u()}),r.persistence.set_property(bo,"identified")),a()},l=s.user();"then"in l&&Hs(l.then)?l.then(c=>i(c)):i(l)})(e,()=>{n.register((r=>{Promise&&Promise.resolve||Qv.warn("This browser does not have Promise support, and can not use the segment integration");var a=(s,i)=>{if(!i)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(Qv.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(Qv.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var l=r.calculateEventProperties(i,s.event.properties);return s.event.properties=Object.assign({},l,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>a(s,s.event.event),page:s=>a(s,"$pageview"),identify:s=>a(s,"$identify"),screen:s=>a(s,"$screen")}})(e)).then(()=>{t()})})}var uq="posthog-js";function dq(e,t){var{organization:n,projectId:r,prefix:a,severityAllowList:s=["error"]}=t===void 0?{}:t;return i=>{var l,c,u,h,m;if(!(s==="*"||s.includes(i.level))||!e.__loaded)return i;i.tags||(i.tags={});var p=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());i.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=((l=i.exception)==null?void 0:l.values)||[],T=g.map(b=>ft({},b,{stacktrace:b.stacktrace?ft({},b.stacktrace,{type:"raw",frames:(b.stacktrace.frames||[]).map(x=>ft({},x,{platform:"web:javascript"}))}):void 0})),y={$exception_message:((c=g[0])==null?void 0:c.value)||i.message,$exception_type:(u=g[0])==null?void 0:u.type,$exception_personURL:p,$exception_level:i.level,$exception_list:T,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:((h=g[0])==null?void 0:h.value)||i.message,$sentry_exception_type:(m=g[0])==null?void 0:m.type,$sentry_tags:i.tags};return n&&r&&(y.$sentry_url=(a||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+i.event_id),e.exceptions.sendExceptionEvent(y),i}}class lae{constructor(t,n,r,a,s){this.name=uq,this.setupOnce=function(i){i(dq(t,{organization:n,projectId:r,prefix:a,severityAllowList:s}))}}}var cae=Ce!=null&&Ce.location?_y(Ce.location.hash,"__posthog")||_y(location.hash,"state"):null,jU="_postHogToolbarParams",UU=Vr("[Toolbar]"),Al=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(Al||{});class uae{constructor(t){this.instance=t}Gi(t){Ot.ph_toolbar_state=t}Ji(){var t;return(t=Ot.ph_toolbar_state)!==null&&t!==void 0?t:Al.UNINITIALIZED}maybeLoadToolbar(t,n,r){if(t===void 0&&(t=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),!Ce||!mt)return!1;t=t!=null?t:Ce.location,r=r!=null?r:Ce.history;try{if(!n){try{Ce.localStorage.setItem("test","test"),Ce.localStorage.removeItem("test")}catch(l){return!1}n=Ce==null?void 0:Ce.localStorage}var a,s=cae||_y(t.hash,"__posthog")||_y(t.hash,"state"),i=s?aU(()=>JSON.parse(atob(decodeURIComponent(s))))||aU(()=>JSON.parse(decodeURIComponent(s))):null;return i&&i.action==="ph_authorize"?((a=i).source="url",a&&Object.keys(a).length>0&&(i.desiredHash?t.hash=i.desiredHash:r?r.replaceState(r.state,"",t.pathname+t.search):t.hash="")):((a=JSON.parse(n.getItem(jU)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch(l){return!1}}Vi(t){var n=Ot.ph_load_toolbar||Ot.ph_load_editor;!Nn(n)&&Hs(n)?n(t,this.instance):UU.warn("No toolbar load function found")}loadToolbar(t){var n=!(mt==null||!mt.getElementById(j8));if(!Ce||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,a=ft({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(Ce.localStorage.setItem(jU,JSON.stringify(ft({},a,{source:void 0}))),this.Ji()===Al.LOADED)this.Vi(a);else if(this.Ji()===Al.UNINITIALIZED){var s;this.Gi(Al.LOADING),(s=Ot.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",i=>{if(i)return UU.error("[Toolbar] Failed to load",i),void this.Gi(Al.UNINITIALIZED);this.Gi(Al.LOADED),this.Vi(a)}),pr(Ce,"turbolinks:load",()=>{this.Gi(Al.UNINITIALIZED),this.loadToolbar(a)})}return!0}Ki(t){return this.loadToolbar(t)}maybeLoadEditor(t,n,r){return t===void 0&&(t=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(t,n,r)}}var dae=Vr("[TracingHeaders]");class hae{constructor(t){this.Yi=void 0,this.Xi=void 0,this.lt=()=>{var n,r;rt(this.Yi)&&((n=Ot.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),rt(this.Xi)&&((r=Ot.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}nt(t){var n,r;(n=Ot.__PosthogExtensions__)!=null&&n.tracingHeadersPatchFns&&t(),(r=Ot.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",a=>{if(a)return dae.error("failed to load script",a);t()})}startIfEnabledOrStop(){var t,n;this._instance.config.__add_tracing_headers?this.nt(this.lt):((t=this.Yi)==null||t.call(this),(n=this.Xi)==null||n.call(this),this.Yi=void 0,this.Xi=void 0)}}var Tl=Vr("[Web Vitals]"),FU=9e5;class fae{constructor(t){var n;this.Qi=!1,this.C=!1,this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zi=()=>{clearTimeout(this.te),this.H.metrics.length!==0&&(this._instance.capture("$web_vitals",this.H.metrics.reduce((r,a)=>ft({},r,{["$web_vitals_"+a.name+"_event"]:ft({},a),["$web_vitals_"+a.name+"_value"]:a.value}),{})),this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ie=r=>{var a,s=(a=this._instance.sessionManager)==null?void 0:a.checkAndGetSessionAndWindowId(!0);if(rt(s))Tl.error("Could not read session ID. Dropping metrics!");else{this.H=this.H||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.ee();rt(i)||(Nn(r==null?void 0:r.name)||Nn(r==null?void 0:r.value)?Tl.error("Invalid metric received",r):this.re&&r.value>=this.re?Tl.error("Ignoring metric with value >= "+this.re,r):(this.H.url!==i&&(this.Zi(),this.te=setTimeout(this.Zi,this.flushToCaptureTimeoutMs)),rt(this.H.url)&&(this.H.url=i),this.H.firstMetricTimestamp=rt(this.H.firstMetricTimestamp)?Date.now():this.H.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.H.metrics.push(ft({},r,{$current_url:i,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.H.metrics.length===this.allowedMetrics.length&&this.Zi()))}},this.lt=()=>{var r,a,s,i,l=Ot.__PosthogExtensions__;rt(l)||rt(l.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:a,onFCP:s,onINP:i}=l.postHogWebVitalsCallbacks),r&&a&&s&&i?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.ie.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&a(this.ie.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ie.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.ie.bind(this)),this.C=!0):Tl.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.Qi=!((n=this._instance.persistence)==null||!n.props[lU]),this.startIfEnabled()}get allowedMetrics(){var t,n,r=Sr(this._instance.config.capture_performance)?(t=this._instance.config.capture_performance)==null?void 0:t.web_vitals_allowed_metrics:void 0;return rt(r)?((n=this._instance.persistence)==null?void 0:n.props[cU])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Sr(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get re(){var t=Sr(this._instance.config.capture_performance)&&_a(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:FU;return 0<t&&t<=6e4?FU:t}get isEnabled(){var t=ts==null?void 0:ts.protocol;if(t!=="http:"&&t!=="https:")return Tl.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=Sr(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Mi(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Mi(n)?n:this.Qi}startIfEnabled(){this.isEnabled&&!this.C&&(Tl.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(t){var n=Sr(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=Sr(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[lU]:n}),this._instance.persistence.register({[cU]:r})),this.Qi=n,this.startIfEnabled()}nt(t){var n,r;(n=Ot.__PosthogExtensions__)!=null&&n.postHogWebVitalsCallbacks&&t(),(r=Ot.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"web-vitals",a=>{a?Tl.error("failed to load script",a):t()})}ee(){var t=Ce?Ce.location.href:void 0;return t||Tl.error("Could not determine current URL"),t}}var mae=Vr("[Heatmaps]");function $U(e){return Sr(e)&&"clientX"in e&&"clientY"in e&&_a(e.clientX)&&_a(e.clientY)}class pae{constructor(t){var n;this.rageclicks=new W8,this.Qi=!1,this.C=!1,this.se=null,this.instance=t,this.Qi=!((n=this.instance.persistence)==null||!n.props[lI])}get flushIntervalMilliseconds(){var t=5e3;return Sr(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return rt(this.instance.config.capture_heatmaps)?rt(this.instance.config.enable_heatmaps)?this.Qi:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.C)return;mae.info("starting..."),this.ne(),this.se=setInterval(this.oe.bind(this),this.flushIntervalMilliseconds)}else{var t,n;clearInterval((t=this.se)!==null&&t!==void 0?t:void 0),(n=this.ae)==null||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[lI]:n}),this.Qi=n,this.startIfEnabled()}getAndClearBuffer(){var t=this.H;return this.H=void 0,t}le(t){this.he(t.originalEvent,"deadclick")}ne(){Ce&&mt&&(pr(Ce,"beforeunload",this.oe.bind(this)),pr(mt,"click",t=>this.he(t||(Ce==null?void 0:Ce.event)),{capture:!0}),pr(mt,"mousemove",t=>this.ue(t||(Ce==null?void 0:Ce.event)),{capture:!0}),this.ae=new K8(this.instance,xre,this.le.bind(this)),this.ae.startIfEnabled(),this.C=!0)}de(t,n){var r=this.instance.scrollManager.scrollY(),a=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=function(l,c,u){for(var h=l;h&&O0(h)&&!Ll(h,"body");){if(h===u)return!1;if(an(c,Ce==null?void 0:Ce.getComputedStyle(h).position))return!0;h=H8(h)}return!1}(B8(t),["fixed","sticky"],s);return{x:t.clientX+(i?0:a),y:t.clientY+(i?0:r),target_fixed:i,type:n}}he(t,n){var r;if(n===void 0&&(n="click"),!gU(t.target)&&$U(t)){var a=this.de(t,n);(r=this.rageclicks)!=null&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.ve(ft({},a,{type:"rageclick"})),this.ve(a)}}ue(t){!gU(t.target)&&$U(t)&&(clearTimeout(this.ce),this.ce=setTimeout(()=>{this.ve(this.de(t,"mousemove"))},500))}ve(t){if(Ce){var n=Ce.location.href;this.H=this.H||{},this.H[n]||(this.H[n]=[]),this.H[n].push(t)}}oe(){this.H&&!Xd(this.H)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class gae{constructor(t){this._instance=t}doPageView(t,n){var r,a=this.fe(t,n);return this.pe={pathname:(r=Ce==null?void 0:Ce.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.fe(t,(n=this.pe)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.pe)==null?void 0:t.pageViewId}}fe(t,n){var r=this.pe;if(!r)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:i,lastScrollY:l,maxScrollY:c,maxContentHeight:u,lastContentY:h,maxContentY:m}=s;if(!(rt(i)||rt(l)||rt(c)||rt(u)||rt(h)||rt(m))){i=Math.ceil(i),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h),m=Math.ceil(m);var p=i<=1?1:Ts(l/i,0,1,ht),g=i<=1?1:Ts(c/i,0,1,ht),T=u<=1?1:Ts(h/u,0,1,ht),y=u<=1?1:Ts(m/u,0,1,ht);a=wr(a,{$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:T,$prev_pageview_max_content:m,$prev_pageview_max_content_percentage:y})}}return r.pathname&&(a.$prev_pageview_pathname=r.pathname),r.timestamp&&(a.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),a}}var Eae=function(e){var t,n,r,a,s="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,a=0;a<r;a++){var i=e.charCodeAt(a),l=null;i<128?n++:l=i>127&&i<2048?String.fromCharCode(i>>6|192,63&i|128):String.fromCharCode(i>>12|224,i>>6&63|128,63&i|128),Ql(l)||(n>t&&(s+=e.substring(t,n)),s+=l,t=n=a+1)}return n>t&&(s+=e.substring(t,e.length)),s},Tae=!!sI||!!aI,BU="text/plain",Ly=(e,t)=>{var[n,r]=e.split("?"),a=ft({},t);r==null||r.split("&").forEach(i=>{var[l]=i.split("=");delete a[l]});var s=ore(a);return n+"?"+(s=s?(r?r+"&":"")+s:r)},lp=(e,t)=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r,t),Jv=e=>{var{data:t,compression:n}=e;if(t){if(n===Co.GZipJS){var r=iq(oq(lp(t)),{mtime:0}),a=new Blob([r],{type:BU});return{contentType:BU,body:a,estimatedSize:a.size}}if(n===Co.Base64){var s=function(c){var u,h,m,p,g,T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y=0,b=0,x="",R=[];if(!c)return c;c=Eae(c);do u=(g=c.charCodeAt(y++)<<16|c.charCodeAt(y++)<<8|c.charCodeAt(y++))>>18&63,h=g>>12&63,m=g>>6&63,p=63&g,R[b++]=T.charAt(u)+T.charAt(h)+T.charAt(m)+T.charAt(p);while(y<c.length);switch(x=R.join(""),c.length%3){case 1:x=x.slice(0,-2)+"==";break;case 2:x=x.slice(0,-1)+"="}return x}(lp(t)),i=(c=>"data="+encodeURIComponent(typeof c=="string"?c:lp(c)))(s);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var l=lp(t);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},Sp=[];aI&&Sp.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:a,estimatedSize:s}=(t=Jv(e))!==null&&t!==void 0?t:{},i=new Headers;Bn(e.headers,function(h,m){i.append(m,h)}),r&&i.append("Content-Type",r);var l=e.url,c=null;if(nU){var u=new nU;c={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}aI(l,ft({method:(e==null?void 0:e.method)||"GET",headers:i,keepalive:e.method==="POST"&&(s||0)<52428.8,body:a,signal:(n=c)==null?void 0:n.signal},e.fetchOptions)).then(h=>h.text().then(m=>{var p={statusCode:h.status,text:m};if(h.status===200)try{p.json=JSON.parse(m)}catch(g){ht.error(g)}e.callback==null||e.callback(p)})).catch(h=>{ht.error(h),e.callback==null||e.callback({statusCode:0,text:h})}).finally(()=>c?clearTimeout(c.timeout):null)}}),sI&&Sp.push({transport:"XHR",method:e=>{var t,n=new sI;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:a}=(t=Jv(e))!==null&&t!==void 0?t:{};Bn(e.headers,function(s,i){n.setRequestHeader(i,s)}),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch(i){}e.callback==null||e.callback(s)}},n.send(a)}}),Es!=null&&Es.sendBeacon&&Sp.push({transport:"sendBeacon",method:e=>{var t=Ly(e.url,{beacon:"1"});try{var n,{contentType:r,body:a}=(n=Jv(e))!==null&&n!==void 0?n:{},s=typeof a=="string"?new Blob([a],{type:r}):a;Es.sendBeacon(t,s)}catch(i){}}});var vh=function(e,t){if(!function(n){try{new RegExp(n)}catch(r){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(n){return!1}};function HU(e,t,n){return lp({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var yae={exact:(e,t)=>t.some(n=>e.some(r=>n===r)),is_not:(e,t)=>t.every(n=>e.every(r=>n!==r)),regex:(e,t)=>t.some(n=>e.some(r=>vh(n,r))),not_regex:(e,t)=>t.every(n=>e.every(r=>!vh(n,r))),icontains:(e,t)=>t.map(gT).some(n=>e.map(gT).some(r=>n.includes(r))),not_icontains:(e,t)=>t.map(gT).every(n=>e.map(gT).every(r=>!n.includes(r)))},gT=e=>e.toLowerCase(),VU=Vr("[Error tracking]");class xae{constructor(t){var n,r;this.ge=[],this._instance=t,this.ge=(n=(r=this._instance.persistence)==null?void 0:r.get_property(cI))!==null&&n!==void 0?n:[]}onRemoteConfig(t){var n,r,a,s=(n=(r=t.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],i=(a=t.errorTracking)==null?void 0:a.captureExtensionExceptions;this.ge=s,this._instance.persistence&&this._instance.persistence.register({[cI]:this.ge,[oU]:i})}get _e(){var t,n=!!this._instance.get_property(oU),r=this._instance.config.error_tracking.captureExtensionExceptions;return(t=r!=null?r:n)!==null&&t!==void 0&&t}sendExceptionEvent(t){if(this.me(t))VU.info("Skipping exception capture because a suppression rule matched");else{if(this._e||!this.be(t))return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"});VU.info("Skipping exception capture because it was thrown by an extension")}}me(t){var n=t.$exception_list;if(!n||!ar(n)||n.length===0)return!1;var r=n.reduce((a,s)=>{var{type:i,value:l}=s;return vr(i)&&i.length>0&&a.$exception_types.push(i),vr(l)&&l.length>0&&a.$exception_values.push(l),a},{$exception_types:[],$exception_values:[]});return this.ge.some(a=>{var s=a.values.map(i=>{var l,c=yae[i.operator],u=ar(i.value)?i.value:[i.value],h=(l=r[i.key])!==null&&l!==void 0?l:[];return u.length>0&&c(u,h)});return a.type==="OR"?s.some(Boolean):s.every(Boolean)})}be(t){var n=t.$exception_list;return!(!n||!ar(n))&&n.flatMap(r=>{var a,s;return(a=(s=r.stacktrace)==null?void 0:s.frames)!==null&&a!==void 0?a:[]}).some(r=>r.filename&&r.filename.startsWith("chrome-extension://"))}}var Gs="Mobile",My="iOS",Di="Android",Vp="Tablet",hq=Di+" "+Vp,fq="iPad",mq="Apple",pq=mq+" Watch",Gp="Safari",Ah="BlackBerry",gq="Samsung",Eq=gq+"Browser",Tq=gq+" Internet",uu="Chrome",Sae=uu+" OS",yq=uu+" "+My,M1="Internet Explorer",xq=M1+" "+Gs,D1="Opera",bae=D1+" Mini",P1="Edge",Sq="Microsoft "+P1,ch="Firefox",bq=ch+" "+My,zp="Nintendo",qp="PlayStation",uh="Xbox",vq=Di+" "+Gs,Aq=Gs+" "+Gp,cp="Windows",_I=cp+" Phone",GU="Nokia",wI="Ouya",Rq="Generic",vae=Rq+" "+Gs.toLowerCase(),Nq=Rq+" "+Vp.toLowerCase(),CI="Konqueror",Ba="(\\d+(\\.\\d+)?)",Zv=new RegExp("Version/"+Ba),Aae=new RegExp(uh,"i"),Rae=new RegExp(qp+" \\w+","i"),Nae=new RegExp(zp+" \\w+","i"),k1=new RegExp(Ah+"|PlayBook|BB10","i"),_ae={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},wae=(e,t)=>t&&an(t,mq)||function(n){return an(n,Gp)&&!an(n,uu)&&!an(n,Di)}(e),_q=function(e,t){return t=t||"",an(e," OPR/")&&an(e,"Mini")?bae:an(e," OPR/")?D1:k1.test(e)?Ah:an(e,"IE"+Gs)||an(e,"WPDesktop")?xq:an(e,Eq)?Tq:an(e,P1)||an(e,"Edg/")?Sq:an(e,"FBIOS")?"Facebook "+Gs:an(e,"UCWEB")||an(e,"UCBrowser")?"UC Browser":an(e,"CriOS")?yq:an(e,"CrMo")||an(e,uu)?uu:an(e,Di)&&an(e,Gp)?vq:an(e,"FxiOS")?bq:an(e.toLowerCase(),CI.toLowerCase())?CI:wae(e,t)?an(e,Gs)?Aq:Gp:an(e,ch)?ch:an(e,"MSIE")||an(e,"Trident/")?M1:an(e,"Gecko")?ch:""},Cae={[xq]:[new RegExp("rv:"+Ba)],[Sq]:[new RegExp(P1+"?\\/"+Ba)],[uu]:[new RegExp("("+uu+"|CrMo)\\/"+Ba)],[yq]:[new RegExp("CriOS\\/"+Ba)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ba)],[Gp]:[Zv],[Aq]:[Zv],[D1]:[new RegExp("(Opera|OPR)\\/"+Ba)],[ch]:[new RegExp(ch+"\\/"+Ba)],[bq]:[new RegExp("FxiOS\\/"+Ba)],[CI]:[new RegExp("Konqueror[:/]?"+Ba,"i")],[Ah]:[new RegExp(Ah+" "+Ba),Zv],[vq]:[new RegExp("android\\s"+Ba,"i")],[Tq]:[new RegExp(Eq+"\\/"+Ba)],[M1]:[new RegExp("(rv:|MSIE )"+Ba)],Mozilla:[new RegExp("rv:"+Ba)]},Iae=function(e,t){var n=_q(e,t),r=Cae[n];if(rt(r))return null;for(var a=0;a<r.length;a++){var s=r[a],i=e.match(s);if(i)return parseFloat(i[i.length-2])}return null},zU=[[new RegExp(uh+"; "+uh+" (.*?)[);]","i"),e=>[uh,e&&e[1]||""]],[new RegExp(zp,"i"),[zp,""]],[new RegExp(qp,"i"),[qp,""]],[k1,[Ah,""]],[new RegExp(cp,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[_I,""];if(new RegExp(Gs).test(t)&&!/IEMobile\b/.test(t))return[cp+" "+Gs,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],a=_ae[r]||"";return/arm/i.test(t)&&(a="RT"),[cp,a]}return[cp,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[My,t.join(".")]}return[My,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=rt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Di+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Di+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Di,t.join(".")]}return[Di,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Sae,""]],[/Linux|debian/i,["Linux",""]]],qU=function(e){return Nae.test(e)?zp:Rae.test(e)?qp:Aae.test(e)?uh:new RegExp(wI,"i").test(e)?wI:new RegExp("("+_I+"|WPDesktop)","i").test(e)?_I:/iPad/.test(e)?fq:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?pq:k1.test(e)?Ah:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(GU,"i").test(e)?GU:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(Gs).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Di:hq:Di:new RegExp("(pda|"+Gs+")","i").test(e)?vae:new RegExp(Vp,"i").test(e)&&!new RegExp(Vp+" pc","i").test(e)?Nq:""},ET="https?://(.*)",M0=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oae=I0(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],M0),j1="<masked>",Lae=["li_fat_id"];function wq(e,t,n){if(!mt)return{};var r,a=t?I0([],M0,n||[]):[],s=Cq(N1(mt.URL,a,j1),e),i=(r={},Bn(Lae,function(l){var c=ki.V(l);r[l]=c||null}),r);return wr(i,s)}function Cq(e,t){var n=Oae.concat(t||[]),r={};return Bn(n,function(a){var s=Ny(e,a);r[a]=s||null}),r}function Iq(e){var t=function(s){return s?s.search(ET+"google.([^/?]*)")===0?"google":s.search(ET+"bing.com")===0?"bing":s.search(ET+"yahoo.com")===0?"yahoo":s.search(ET+"duckduckgo.com")===0?"duckduckgo":null:null}(e),n=t!="yahoo"?"q":"p",r={};if(!Ql(t)){r.$search_engine=t;var a=mt?Ny(mt.referrer,n):"";a.length&&(r.ph_keyword=a)}return r}function YU(){return navigator.language||navigator.userLanguage}function Oq(){return(mt==null?void 0:mt.referrer)||"$direct"}function Lq(e,t){var n=e?I0([],M0,t||[]):[],r=ts==null?void 0:ts.href.substring(0,1e3);return{r:Oq().substring(0,1e3),u:r?N1(r,n,j1):void 0}}function Mq(e){var t,{r:n,u:r}=e,a={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=Sh(n))==null?void 0:t.host};if(r){a.$current_url=r;var s=Sh(r);a.$host=s==null?void 0:s.host,a.$pathname=s==null?void 0:s.pathname;var i=Cq(r);wr(a,i)}if(n){var l=Iq(n);wr(a,l)}return a}function Dq(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Mae(){try{return new Date().getTimezoneOffset()}catch(e){return}}function Dae(e,t){if(!Ja)return{};var n,r,a,s=e?I0([],M0,t||[]):[],[i,l]=function(c){for(var u=0;u<zU.length;u++){var[h,m]=zU[u],p=h.exec(c),g=p&&(Hs(m)?m(p,c):m);if(g)return g}return["",""]}(Ja);return wr(A1({$os:i,$os_version:l,$browser:_q(Ja,navigator.vendor),$device:qU(Ja),$device_type:(r=Ja,a=qU(r),a===fq||a===hq||a==="Kobo"||a==="Kindle Fire"||a===Nq?Vp:a===zp||a===uh||a===qp||a===wI?"Console":a===pq?"Wearable":a?Gs:"Desktop"),$timezone:Dq(),$timezone_offset:Mae()}),{$current_url:N1(ts==null?void 0:ts.href,s,j1),$host:ts==null?void 0:ts.host,$pathname:ts==null?void 0:ts.pathname,$raw_user_agent:Ja.length>1e3?Ja.substring(0,997)+"...":Ja,$browser_version:Iae(Ja,navigator.vendor),$browser_language:YU(),$browser_language_prefix:(n=YU(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:Ce==null?void 0:Ce.screen.height,$screen_width:Ce==null?void 0:Ce.screen.width,$viewport_height:Ce==null?void 0:Ce.innerHeight,$viewport_width:Ce==null?void 0:Ce.innerWidth,$lib:"web",$lib_version:_o.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Ii=Vr("[FeatureFlags]"),eA="$active_feature_flags",bd="$override_feature_flags",WU="$feature_flag_payloads",ym="$override_feature_flag_payloads",XU="$feature_flag_request_id",KU=e=>{var t={};for(var[n,r]of ZT(e||{}))r&&(t[n]=r);return t},Pae=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(n=>{var r;return[n,(r=t[n].variant)!==null&&r!==void 0?r:t[n].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(n=>t[n].enabled).filter(n=>{var r;return(r=t[n].metadata)==null?void 0:r.payload}).map(n=>{var r;return[n,(r=t[n].metadata)==null?void 0:r.payload]}))):Ii.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e},kae=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class jae{constructor(t){this.ye=!1,this.we=!1,this.Se=!1,this.$e=!1,this.ke=!1,this.xe=!1,this.Ee=!1,this._instance=t,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.xe=!0;else{var t=!this.Ie&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Re({disableFlags:t})}}get hasLoadedFlags(){return this.we}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(hI),n=this._instance.get_property(bd),r=this._instance.get_property(ym);if(!r&&!n)return t||{};var a=wr({},t||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var i of s){var l,c,u=a[i],h=n==null?void 0:n[i],m=rt(h)?(l=u==null?void 0:u.enabled)!==null&&l!==void 0&&l:!!h,p=rt(h)?u.variant:typeof h=="string"?h:void 0,g=r==null?void 0:r[i],T=ft({},u,{enabled:m,variant:m?p!=null?p:u==null?void 0:u.variant:void 0});m!==(u==null?void 0:u.enabled)&&(T.original_enabled=u==null?void 0:u.enabled),p!==(u==null?void 0:u.variant)&&(T.original_variant=u==null?void 0:u.variant),g&&(T.metadata=ft({},u==null?void 0:u.metadata,{payload:g,original_payload:u==null||(c=u.metadata)==null?void 0:c.payload})),a[i]=T}return this.ye||(Ii.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:a}),this.ye=!0),a}getFlagVariants(){var t=this._instance.get_property(Kd),n=this._instance.get_property(bd);if(!n)return t||{};for(var r=wr({},t),a=Object.keys(n),s=0;s<a.length;s++)r[a[s]]=n[a[s]];return this.ye||(Ii.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this.ye=!0),r}getFlagPayloads(){var t=this._instance.get_property(WU),n=this._instance.get_property(ym);if(!n)return t||{};for(var r=wr({},t||{}),a=Object.keys(n),s=0;s<a.length;s++)r[a[s]]=n[a[s]];return this.ye||(Ii.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:r}),this.ye=!0),r}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Ie||(this.Ie=setTimeout(()=>{this.Re()},5))}Pe(){clearTimeout(this.Ie),this.Ie=void 0}ensureFlagsLoaded(){this.we||this.Se||this.Ie||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.$e=t}Re(t){var n;if(this.Pe(),!this._instance.L())if(this.Se)this.ke=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:ft({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(ip)||{}),group_properties:this._instance.get_property(kc)};(t!=null&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0);var a=this._instance.config.__preview_remote_config,s=a?"/flags/?v=2":"/flags/?v=2&config=true",i=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("api",s+i);a&&(r.timezone=Dq()),this.Se=!0,this._instance.Te({method:"POST",url:l,data:r,compression:this._instance.config.disable_compression?void 0:Co.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var u,h,m=!0;if(c.statusCode===200&&(this.ke||(this.$anon_distinct_id=void 0),m=!1),this.Se=!1,this.xe||(this.xe=!0,this._instance.Ce((h=c.json)!==null&&h!==void 0?h:{})),!r.disable_flags||this.ke)if(this.Ee=!m,c.json&&(u=c.json.quotaLimited)!=null&&u.includes(kae.FeatureFlags))Ii.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var p;r.disable_flags||this.receivedFeatureFlags((p=c.json)!==null&&p!==void 0?p:{},m),this.ke&&(this.ke=!1,this.Re())}}})}}getFeatureFlag(t,n){if(n===void 0&&(n={}),this.we||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[t],a=""+r,s=this._instance.get_property(XU)||void 0,i=this._instance.get_property(by)||{};if((n.send_event||!("send_event"in n))&&(!(t in i)||!i[t].includes(a))){var l,c,u,h,m,p,g,T,y;ar(i[t])?i[t].push(a):i[t]=[a],(l=this._instance.persistence)==null||l.register({[by]:i});var b=this.getFeatureFlagDetails(t),x={$feature_flag:t,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:((c=this._instance.config.bootstrap)==null||(c=c.featureFlags)==null?void 0:c[t])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[t])||null,$used_bootstrap_value:!this.Ee};rt(b==null||(h=b.metadata)==null?void 0:h.version)||(x.$feature_flag_version=b.metadata.version);var R,A=(m=b==null||(p=b.reason)==null?void 0:p.description)!==null&&m!==void 0?m:b==null||(g=b.reason)==null?void 0:g.code;A&&(x.$feature_flag_reason=A),b!=null&&(T=b.metadata)!=null&&T.id&&(x.$feature_flag_id=b.metadata.id),rt(b==null?void 0:b.original_variant)&&rt(b==null?void 0:b.original_enabled)||(x.$feature_flag_original_response=rt(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(y=b.metadata)!=null&&y.original_payload&&(x.$feature_flag_original_payload=b==null||(R=b.metadata)==null?void 0:R.original_payload),this._instance.capture("$feature_flag_called",x)}return r}Ii.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var r=this._instance.config.token;this._instance.Te({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:r},compression:this._instance.config.disable_compression?void 0:Co.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:a=>{var s,i=(s=a.json)==null?void 0:s.featureFlagPayloads;n((i==null?void 0:i[t])||void 0)}})}isFeatureEnabled(t,n){if(n===void 0&&(n={}),this.we||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,n);Ii.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==t)}receivedFeatureFlags(t,n){if(this._instance.persistence){this.we=!0;var r=this.getFlagVariants(),a=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(i,l,c,u,h){c===void 0&&(c={}),u===void 0&&(u={}),h===void 0&&(h={});var m=Pae(i),p=m.flags,g=m.featureFlags,T=m.featureFlagPayloads;if(g){var y=i.requestId;if(ar(g)){Ii.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(g)for(var x=0;x<g.length;x++)b[g[x]]=!0;l&&l.register({[eA]:g,[Kd]:b})}else{var R=g,A=T,w=p;i.errorsWhileComputingFlags&&(R=ft({},c,R),A=ft({},u,A),w=ft({},h,w)),l&&l.register(ft({[eA]:Object.keys(KU(R)),[Kd]:R||{},[WU]:A||{},[hI]:w||{}},y?{[XU]:y}:{}))}}})(t,this._instance.persistence,r,a,s),this.Me(n)}}override(t,n){n===void 0&&(n=!1),Ii.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return Ii.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this._instance.persistence.unregister(bd),this._instance.persistence.unregister(ym),void this.Me();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.ye=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(bd);else if(r.flags)if(ar(r.flags)){for(var a={},s=0;s<r.flags.length;s++)a[r.flags[s]]=!0;this._instance.persistence.register({[bd]:a})}else this._instance.persistence.register({[bd]:r.flags})}return"payloads"in r&&(r.payloads===!1?this._instance.persistence.unregister(ym):r.payloads&&this._instance.persistence.register({[ym]:r.payloads})),void this.Me()}this.Me()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.we){var{flags:n,flagVariants:r}=this.Oe();t(n,r)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n,r){var a,s=(this._instance.get_property(sp)||[]).find(u=>u.flagKey===t),i={["$feature_enrollment/"+t]:n},l={$feature_flag:t,$feature_enrollment:n,$set:i};s&&(l.$early_access_feature_name=s.name),r&&(l.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",l),this.setPersonPropertiesForFlags(i,!1);var c=ft({},this.getFlagVariants(),{[t]:n});(a=this._instance.persistence)==null||a.register({[eA]:Object.keys(KU(c)),[Kd]:c}),this.Me()}getEarlyAccessFeatures(t,n,r){n===void 0&&(n=!1);var a=this._instance.get_property(sp),s=r?"&"+r.map(i=>"stage="+i).join("&"):"";if(a&&!n)return t(a);this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:i=>{var l,c;if(i.json){var u=i.json.earlyAccessFeatures;return(l=this._instance.persistence)==null||l.unregister(sp),(c=this._instance.persistence)==null||c.register({[sp]:u}),t(u)}}})}Oe(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,a)=>(r[a]=n[a],r),{})}}Me(t){var{flags:n,flagVariants:r}=this.Oe();this.featureFlagEventHandlers.forEach(a=>a(n,r,{errorsLoading:t}))}setPersonPropertiesForFlags(t,n){n===void 0&&(n=!0);var r=this._instance.get_property(ip)||{};this._instance.register({[ip]:ft({},r,t)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ip)}setGroupPropertiesForFlags(t,n){n===void 0&&(n=!0);var r=this._instance.get_property(kc)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(a=>{r[a]=ft({},r[a],t[a]),delete t[a]}),this._instance.register({[kc]:ft({},r,t)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this._instance.get_property(kc)||{};this._instance.register({[kc]:ft({},n,{[t]:{}})})}else this._instance.unregister(kc)}reset(){this.we=!1,this.Se=!1,this.$e=!1,this.ke=!1,this.xe=!1,this.Ee=!1,this.$anon_distinct_id=void 0,this.Pe(),this.ye=!1}}var Uae=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class tA{constructor(t,n){this.A=t,this.props={},this.Fe=!1,this.Ae=(r=>{var a="";return r.token&&(a=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+a+"_posthog"})(t),this.it=this.De(t),this.load(),t.debug&&ht.info("Persistence loaded",t.persistence,ft({},this.props)),this.update_config(t,t,n),this.save()}isDisabled(){return!!this.je}De(t){Uae.indexOf(t.persistence.toLowerCase())===-1&&(ht.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&Br.G()?Br:n==="localstorage+cookie"&&uT.G()?uT:n==="sessionstorage"&&fa.G()?fa:n==="memory"?Tre:n==="cookie"?ki:uT.G()?uT:ki}properties(){var t={};return Bn(this.props,function(n,r){if(r===Kd&&Sr(n))for(var a=Object.keys(n),s=0;s<a.length;s++)t["$feature/"+a[s]]=n[a[s]];else l=r,c=!1,(Ql(i=Qne)?c:tU&&i.indexOf===tU?i.indexOf(l)!=-1:(Bn(i,function(u){if(c||(c=u===l))return yy}),c))||(t[r]=n);var i,l,c}),t}load(){if(!this.je){var t=this.it.K(this.Ae);t&&(this.props=wr({},t))}}save(){this.je||this.it.Y(this.Ae,this.props,this.Le,this.Ne,this.ze,this.A.debug)}remove(){this.it.X(this.Ae,!1),this.it.X(this.Ae,!0)}clear(){this.remove(),this.props={}}register_once(t,n,r){if(Sr(t)){rt(n)&&(n="None"),this.Le=rt(r)?this.Ue:r;var a=!1;if(Bn(t,(s,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==n||(this.props[i]=s,a=!0)}),a)return this.save(),!0}return!1}register(t,n){if(Sr(t)){this.Le=rt(n)?this.Ue:n;var r=!1;if(Bn(t,(a,s)=>{t.hasOwnProperty(s)&&this.props[s]!==a&&(this.props[s]=a,r=!0)}),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.Fe){var t=wq(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);Xd(A1(t))||this.register(t),this.Fe=!0}}update_search_keyword(){var t;this.register((t=mt==null?void 0:mt.referrer)?Iq(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Oq(),$referring_domain:mt!=null&&mt.referrer&&((t=Sh(mt.referrer))==null?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[gI]||this.props[EI]||this.register_once({[vy]:Lq(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Bn([EI,gI],i=>{var l=this.props[i];l&&Bn(l,function(c,u){t["$initial_"+iI(u)]=c})});var n,r,a=this.props[vy];if(a){var s=(n=Mq(a),r={},Bn(n,function(i,l){r["$initial_"+iI(l)]=i}),r);wr(t,s)}return t}safe_merge(t){return Bn(this.props,function(n,r){r in t||(t[r]=n)}),t}update_config(t,n,r){if(this.Ue=this.Le=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!r),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var a=this.De(t),s=this.props;this.clear(),this.it=a,this.props=s,this.save()}}set_disabled(t){this.je=t,this.je?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ne&&(this.Ne=t,this.remove(),this.save())}set_secure(t){t!==this.ze&&(this.ze=t,this.remove(),this.save())}set_event_timer(t,n){var r=this.props[rp]||{};r[t]=n,this.props[rp]=r,this.save()}remove_event_timer(t){var n=(this.props[rp]||{})[t];return rt(n)||(delete this.props[rp][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}class Pq{constructor(){this.qe={},this.qe={}}on(t,n){return this.qe[t]||(this.qe[t]=[]),this.qe[t].push(n),()=>{this.qe[t]=this.qe[t].filter(r=>r!==n)}}emit(t,n){for(var r of this.qe[t]||[])r(n);for(var a of this.qe["*"]||[])a(t,n)}}class $c{constructor(t){this.Be=new Pq,this.He=(n,r)=>this.We(n,r)&&this.Ge(n,r)&&this.Je(n,r),this.We=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=t,this.Ve=new Set,this.Ke=new Set}init(){var t;if(!rt((t=this._instance)==null?void 0:t.Ye)){var n;(n=this._instance)==null||n.Ye((r,a)=>{this.on(r,a)})}}register(t){var n,r;if(!rt((n=this._instance)==null?void 0:n.Ye)&&(t.forEach(i=>{var l,c;(l=this.Ke)==null||l.add(i),(c=i.steps)==null||c.forEach(u=>{var h;(h=this.Ve)==null||h.add((u==null?void 0:u.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var a,s=new Set;t.forEach(i=>{var l;(l=i.steps)==null||l.forEach(c=>{c!=null&&c.selector&&s.add(c==null?void 0:c.selector)})}),(a=this._instance)==null||a.autocapture.setElementSelectors(s)}}on(t,n){var r;n!=null&&t.length!=0&&(this.Ve.has(t)||this.Ve.has(n==null?void 0:n.event))&&this.Ke&&((r=this.Ke)==null?void 0:r.size)>0&&this.Ke.forEach(a=>{this.Xe(n,a)&&this.Be.emit("actionCaptured",a.name)})}Qe(t){this.onAction("actionCaptured",n=>t(n))}Xe(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.He(t,r))return!0;return!1}onAction(t,n){return this.Be.on(t,n)}Ge(t,n){if(n!=null&&n.url){var r,a=t==null||(r=t.properties)==null?void 0:r.$current_url;if(!a||typeof a!="string"||!$c.Ze(a,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static Ze(t,n,r){switch(r){case"regex":return!!Ce&&vh(t,n);case"exact":return n===t;case"contains":var a=$c.tr(n).replace(/_/g,".").replace(/%/g,".*");return vh(t,a);default:return!1}}static tr(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Je(t,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.ir(t).some(s=>!(n!=null&&n.href&&!$c.Ze(s.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||s.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!$c.Ze(s.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!$c.Ze(s.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact"))))return!1;if(n!=null&&n.selector){var r,a=t==null||(r=t.properties)==null?void 0:r.$element_selectors;if(!a||!a.includes(n==null?void 0:n.selector))return!1}return!0}ir(t){return(t==null?void 0:t.properties.$elements)==null?[]:t==null?void 0:t.properties.$elements}}(function(e){return e.Button="button",e.Tab="tab",e.Selector="selector",e})({});(function(e){return e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger",e})({});var nA=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({});(function(e){return e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link",e})({});(function(e){return e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question",e})({});(function(e){return e.Once="once",e.Recurring="recurring",e.Always="always",e})({});var rA=function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e}({}),QU=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e}({}),Lr=Vr("[Surveys]"),II="seenSurvey_",Fae=(e,t)=>{var n="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(n="$survey_"+t+"/"+e.id+"/"+e.current_iteration),n},JU=e=>{var t=""+II+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+II+e.id+"_"+e.current_iteration),t},$ae=[nA.Popover,nA.Widget,nA.API];class Bae{constructor(t){this._instance=t,this.er=new Map,this.rr=new Map}register(t){var n;rt((n=this._instance)==null?void 0:n.Ye)||(this.sr(t),this.nr(t))}nr(t){var n=t.filter(r=>{var a,s;return((a=r.conditions)==null?void 0:a.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});n.length!==0&&(this.ar==null&&(this.ar=new $c(this._instance),this.ar.init(),this.ar.Qe(r=>{this.onAction(r)})),n.forEach(r=>{var a,s,i,l,c;r.conditions&&(a=r.conditions)!=null&&a.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((i=r.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0&&((l=this.ar)==null||l.register(r.conditions.actions.values),(c=r.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach(u=>{if(u&&u.name){var h=this.rr.get(u.name);h&&h.push(r.id),this.rr.set(u.name,h||[r.id])}}))}))}sr(t){var n;t.filter(r=>{var a,s;return((a=r.conditions)==null?void 0:a.events)&&((s=r.conditions)==null||(s=s.events)==null||(s=s.values)==null?void 0:s.length)>0}).length!==0&&((n=this._instance)==null||n.Ye((r,a)=>{this.onEvent(r,a)}),t.forEach(r=>{var a;(a=r.conditions)==null||(a=a.events)==null||(a=a.values)==null||a.forEach(s=>{if(s&&s.name){var i=this.er.get(s.name);i&&i.push(r.id),this.er.set(s.name,i||[r.id])}})}))}onEvent(t,n){var r,a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[cT])||[];if(t==="survey shown"&&n&&a.length>0){var s;Lr.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:n,existingActivatedSurveys:a});var i=n==null||(s=n.properties)==null?void 0:s.$survey_id;if(i){var l=a.indexOf(i);l>=0&&(a.splice(l,1),this.lr(a))}}else this.er.has(t)&&(Lr.info("survey event matched, updating activated surveys",{event:t,surveys:this.er.get(t)}),this.lr(a.concat(this.er.get(t)||[])))}onAction(t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[cT])||[];this.rr.has(t)&&this.lr(r.concat(this.rr.get(t)||[]))}lr(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[cT]:[...new Set(t)]})}getSurveys(){var t,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[cT];return n||[]}getEventToSurveys(){return this.er}hr(){return this.ar}}class Hae{constructor(t){this.ur=void 0,this._surveyManager=null,this.dr=!1,this.vr=!1,this.cr=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var n=t.surveys;if(Nn(n))return Lr.warn("Flags not loaded yet. Not loading surveys.");var r=ar(n);this.ur=r?n.length>0:n,Lr.info("flags response received, isSurveysEnabled: "+this.ur),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(II)||r!=null&&r.startsWith("inProgressSurvey_"))&&t.push(r)}t.forEach(a=>localStorage.removeItem(a))}loadIfEnabled(){if(!this._surveyManager)if(this.vr)Lr.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Lr.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode)Lr.info("Not loading surveys in cookieless mode.");else{var t=Ot==null?void 0:Ot.__PosthogExtensions__;if(t){if(!rt(this.ur)||this._instance.config.advanced_enable_surveys){var n=this.ur||this._instance.config.advanced_enable_surveys;this.vr=!0;try{var r=t.generateSurveys;if(r)return void this.pr(r,n);var a=t.loadExternalDependency;if(!a)return void this.gr("PostHog loadExternalDependency extension not found.");a(this._instance,"surveys",s=>{s||!t.generateSurveys?this.gr("Could not load surveys script",s):this.pr(t.generateSurveys,n)})}catch(s){throw this.gr("Error initializing surveys",s),s}finally{this.vr=!1}}}else Lr.error("PostHog Extensions not found.")}}pr(t,n){this._surveyManager=t(this._instance,n),this._surveyEventReceiver=new Bae(this._instance),Lr.info("Surveys loaded successfully"),this._r({isLoaded:!0})}gr(t,n){Lr.error(t,n),this._r({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.cr.push(t),this._surveyManager&&this._r({isLoaded:!0}),()=>{this.cr=this.cr.filter(n=>n!==t)}}getSurveys(t,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return Lr.info("Disabled. Not loading surveys."),t([]);var r=this._instance.get_property(fI);if(r&&!n)return t(r,{isLoaded:!0});if(this.dr)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.dr=!0,this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:a=>{var s;this.dr=!1;var i=a.statusCode;if(i!==200||!a.json){var l="Surveys API could not be loaded, status: "+i;return Lr.error(l),t([],{isLoaded:!1,error:l})}var c,u=a.json.surveys||[],h=u.filter(m=>function(p){return!(!p.start_date||p.end_date)}(m)&&(function(p){var g;return!((g=p.conditions)==null||(g=g.events)==null||(g=g.values)==null||!g.length)}(m)||function(p){var g;return!((g=p.conditions)==null||(g=g.actions)==null||(g=g.values)==null||!g.length)}(m)));return h.length>0&&((c=this._surveyEventReceiver)==null||c.register(h)),(s=this._instance.persistence)==null||s.register({[fI]:u}),t(u,{isLoaded:!0})}})}catch(a){throw this.dr=!1,a}}_r(t){for(var n of this.cr)try{if(!t.isLoaded)return n([],t);this.getSurveys(n)}catch(r){Lr.error("Error in survey callback",r)}}getActiveMatchingSurveys(t,n){if(n===void 0&&(n=!1),!Nn(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,n);Lr.warn("init was not called")}mr(t){var n=null;return this.getSurveys(r=>{var a;n=(a=r.find(s=>s.id===t))!==null&&a!==void 0?a:null}),n}br(t){if(Nn(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof t=="string"?this.mr(t):t;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Nn(this._surveyManager))return Lr.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.br(t);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(t,n){return Nn(this._surveyManager)?(Lr.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(r=>{this.getSurveys(a=>{var s,i=(s=a.find(c=>c.id===t))!==null&&s!==void 0?s:null;if(i){var l=this.br(i);r({visible:l.eligible,disabledReason:l.reason})}else r({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(t,n){if(Nn(this._surveyManager))Lr.warn("init was not called");else{var r=this.mr(t);if(r)if($ae.includes(r.type)){var a=mt==null?void 0:mt.querySelector(n);a?this._surveyManager.renderSurvey(r,a):Lr.warn("Survey element not found")}else Lr.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Lr.warn("Survey not found")}}}var ZU=Vr("[RateLimiter]");class Vae{constructor(t){var n,r;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=a=>{var s=a.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(i=>{ZU.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void ZU.warn('could not rate limit - continuing. Error: "'+(i==null?void 0:i.message)+'"',{text:s})}},this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)==null?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=t.config.rate_limiting)==null?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var n,r,a;t===void 0&&(t=!1);var s=new Date().getTime(),i=(n=(r=this.instance.persistence)==null?void 0:r.get_property(pI))!==null&&n!==void 0?n:{tokens:this.captureEventsBurstLimit,last:s};i.tokens+=(s-i.last)/1e3*this.captureEventsPerSecond,i.last=s,i.tokens>this.captureEventsBurstLimit&&(i.tokens=this.captureEventsBurstLimit);var l=i.tokens<1;return l||t||(i.tokens=Math.max(0,i.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(a=this.instance.persistence)==null||a.set_property(pI,i),{isRateLimited:l,remainingTokens:i.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var _c=Vr("[RemoteConfig]");class Gae{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Ot._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}yr(t){var n,r;(n=Ot.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Ot.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):(_c.error("PostHog Extensions not found. Cannot load remote config."),t())}wr(t){this._instance.Te({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return _c.info("Using preloaded remote config",this.remoteConfig),void this.Ce(this.remoteConfig);if(this._instance.L())return void _c.warn("Remote config is disabled. Falling back to local config.");this.yr(t=>{if(!t)return _c.info("No config found after loading remote JS config. Falling back to JSON."),void this.wr(n=>{this.Ce(n)});this.Ce(t)})}catch(t){_c.error("Error loading remote config",t)}}Ce(t){t?this._instance.config.__preview_remote_config?(this._instance.Ce(t),t.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):_c.info("__preview_remote_config is disabled. Logging config instead",t):_c.error("Failed to fetch remote config from PostHog.")}}var OI=3e3;class zae{constructor(t,n){this.Sr=!0,this.$r=[],this.kr=Ts((n==null?void 0:n.flush_interval_ms)||OI,250,5e3,ht.createLogger("flush interval"),OI),this.Er=t}enqueue(t){this.$r.push(t),this.Ir||this.Rr()}unload(){this.Pr();var t=this.$r.length>0?this.Tr():{},n=Object.values(t);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Er(ft({},r,{transport:"sendBeacon"}))})}enable(){this.Sr=!1,this.Rr()}Rr(){var t=this;this.Sr||(this.Ir=setTimeout(()=>{if(this.Pr(),this.$r.length>0){var n=this.Tr(),r=function(){var s=n[a],i=new Date().getTime();s.data&&ar(s.data)&&Bn(s.data,l=>{l.offset=Math.abs(l.timestamp-i),delete l.timestamp}),t.Er(s)};for(var a in n)r()}},this.kr))}Pr(){clearTimeout(this.Ir),this.Ir=void 0}Tr(){var t={};return Bn(this.$r,n=>{var r,a=n,s=(a?a.batchKey:null)||a.url;rt(t[s])&&(t[s]=ft({},a,{data:[]})),(r=t[s].data)==null||r.push(a.data)}),this.$r=[],t}}var qae=["retriesPerformedSoFar"];class Yae{constructor(t){this.Cr=!1,this.Mr=3e3,this.$r=[],this._instance=t,this.$r=[],this.Or=!0,!rt(Ce)&&"onLine"in Ce.navigator&&(this.Or=Ce.navigator.onLine,pr(Ce,"online",()=>{this.Or=!0,this.oe()}),pr(Ce,"offline",()=>{this.Or=!1}))}get length(){return this.$r.length}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=C8(t,qae);_a(n)&&n>0&&(r.url=Ly(r.url,{retry_count:n})),this._instance.Te(ft({},r,{callback:a=>{a.statusCode!==200&&(a.statusCode<400||a.statusCode>=500)&&(n!=null?n:0)<10?this.Fr(ft({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(a)}}))}Fr(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=function(i){var l=3e3*Math.pow(2,i),c=l/2,u=Math.min(18e5,l),h=(Math.random()-.5)*(u-c);return Math.ceil(u+h)}(n),a=Date.now()+r;this.$r.push({retryAt:a,requestOptions:t});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),ht.warn(s),this.Cr||(this.Cr=!0,this.Ar())}Ar(){this.Dr&&clearTimeout(this.Dr),this.Dr=setTimeout(()=>{this.Or&&this.$r.length>0&&this.oe(),this.Ar()},this.Mr)}oe(){var t=Date.now(),n=[],r=this.$r.filter(s=>s.retryAt<t||(n.push(s),!1));if(this.$r=n,r.length>0)for(var{requestOptions:a}of r)this.retriableRequest(a)}unload(){for(var{requestOptions:t}of(this.Dr&&(clearTimeout(this.Dr),this.Dr=void 0),this.$r))try{this._instance.Te(ft({},t,{transport:"sendBeacon"}))}catch(n){ht.error(n)}this.$r=[]}}class Wae{constructor(t){this.jr=()=>{var n,r,a,s;this.Lr||(this.Lr={});var i=this.scrollElement(),l=this.scrollY(),c=i?Math.max(0,i.scrollHeight-i.clientHeight):0,u=l+((i==null?void 0:i.clientHeight)||0),h=(i==null?void 0:i.scrollHeight)||0;this.Lr.lastScrollY=Math.ceil(l),this.Lr.maxScrollY=Math.max(l,(n=this.Lr.maxScrollY)!==null&&n!==void 0?n:0),this.Lr.maxScrollHeight=Math.max(c,(r=this.Lr.maxScrollHeight)!==null&&r!==void 0?r:0),this.Lr.lastContentY=u,this.Lr.maxContentY=Math.max(u,(a=this.Lr.maxContentY)!==null&&a!==void 0?a:0),this.Lr.maxContentHeight=Math.max(h,(s=this.Lr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=t}getContext(){return this.Lr}resetContext(){var t=this.Lr;return setTimeout(this.jr,0),t}startMeasuringScrollPosition(){pr(Ce,"scroll",this.jr,{capture:!0}),pr(Ce,"scrollend",this.jr,{capture:!0}),pr(Ce,"resize",this.jr)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Ce==null?void 0:Ce.document.documentElement;var t=ar(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of t){var r=Ce==null?void 0:Ce.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return Ce&&(Ce.scrollY||Ce.pageYOffset||Ce.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Ce&&(Ce.scrollX||Ce.pageXOffset||Ce.document.documentElement.scrollLeft)||0}}var Xae=e=>Lq(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties);class eF{constructor(t,n,r,a){this.Nr=s=>{var i=this.zr();if(!i||i.sessionId!==s){var l={sessionId:s,props:this.Ur(this._instance)};this.qr.register({[mI]:l})}},this._instance=t,this.Br=n,this.qr=r,this.Ur=a||Xae,this.Br.onSessionId(this.Nr)}zr(){return this.qr.props[mI]}getSetOnceProps(){var t,n=(t=this.zr())==null?void 0:t.props;return n?"r"in n?Mq(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return Bn(A1(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_"+iI(r)]=n}),t}}var aA=Vr("[SessionId]");class tF{constructor(t,n,r){var a;if(this.Hr=[],this.Wr=(h,m)=>Math.abs(h-m)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=t.config,this.qr=t.persistence,this.gi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Gr=n||Nl,this.Jr=r||Nl;var s=this.A.persistence_name||this.A.token,i=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Ts(i,60,36e3,aA.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Vr(),this.Kr="ph_"+s+"_window_id",this.Yr="ph_"+s+"_primary_window_exists",this.Xr()){var l=fa.K(this.Kr),c=fa.K(this.Yr);l&&!c?this.gi=l:fa.X(this.Kr),fa.Y(this.Yr,!0)}if((a=this.A.bootstrap)!=null&&a.sessionID)try{var u=(h=>{var m=h.replace(/-/g,"");if(m.length!==32)throw new Error("Not a valid UUID");if(m[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(m.substring(0,12),16)})(this.A.bootstrap.sessionID);this.Qr(this.A.bootstrap.sessionID,new Date().getTime(),u)}catch(h){aA.error("Invalid sessionID in bootstrap",h)}this.Zr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return rt(this.Hr)&&(this.Hr=[]),this.Hr.push(t),this.Ft&&t(this.Ft,this.gi),()=>{this.Hr=this.Hr.filter(n=>n!==t)}}Xr(){return this.A.persistence!=="memory"&&!this.qr.je&&fa.G()}ts(t){t!==this.gi&&(this.gi=t,this.Xr()&&fa.Y(this.Kr,t))}es(){return this.gi?this.gi:this.Xr()?fa.K(this.Kr):null}Qr(t,n,r){t===this.Ft&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ft=t,this.qr.register({[Sy]:[n,t,r]}))}rs(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var t=this.qr.props[Sy];return ar(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Qr(null,null,null)}Zr(){pr(Ce,"beforeunload",()=>{this.Xr()&&fa.X(this.Yr)},{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[a,s,i]=this.rs(),l=this.es(),c=_a(i)&&i>0&&Math.abs(r-i)>864e5,u=!1,h=!s,m=!t&&this.Wr(r,a);h||m||c?(s=this.Gr(),l=this.Jr(),aA.info("new session ID generated",{sessionId:s,windowId:l,changeReason:{noSessionId:h,activityTimeout:m,sessionPastMaximumLength:c}}),i=r,u=!0):l||(l=this.Jr(),u=!0);var p=a===0||!t||c?r:a,g=i===0?new Date().getTime():i;return this.ts(l),this.Qr(s,p,g),t||this.Vr(),u&&this.Hr.forEach(T=>T(s,l,u?{noSessionId:h,activityTimeout:m,sessionPastMaximumLength:c}:void 0)),{sessionId:s,windowId:l,sessionStartTimestamp:g,changeReason:u?{noSessionId:h,activityTimeout:m,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:a}}Vr(){clearTimeout(this.ss),this.ss=setTimeout(()=>{var[t]=this.rs();this.Wr(new Date().getTime(),t)&&this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var Kae=["$set_once","$set"],yl=Vr("[SiteApps]");class Qae{constructor(t){this._instance=t,this.ns=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}os(t,n){if(n){var r=this.globalsForEvent(n);this.ns.push(r),this.ns.length>1e3&&(this.ns=this.ns.slice(10))}}get siteAppLoaders(){var t;return(t=Ot._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ye(this.os.bind(this));this.ls=()=>{t(),this.ns=[],this.ls=void 0}}}globalsForEvent(t){var n,r,a,s,i,l,c;if(!t)throw new Error("Event payload is required");var u={},h=this._instance.get_property("$groups")||[],m=this._instance.get_property("$stored_group_properties")||{};for(var[p,g]of Object.entries(m))u[p]={id:h[p],type:p,properties:g};var{$set_once:T,$set:y}=t;return{event:ft({},C8(t,Kae),{properties:ft({},t.properties,y?{$set:ft({},(n=(r=t.properties)==null?void 0:r.$set)!==null&&n!==void 0?n:{},y)}:{},T?{$set_once:ft({},(a=(s=t.properties)==null?void 0:s.$set_once)!==null&&a!==void 0?a:{},T)}:{}),elements_chain:(i=(l=t.properties)==null?void 0:l.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(c=t.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var n=this.apps[t.id],r=()=>{var l;!n.errored&&this.ns.length&&(yl.info("Processing "+this.ns.length+" events for site app with id "+t.id),this.ns.forEach(c=>n.processEvent==null?void 0:n.processEvent(c)),n.processedBuffer=!0),Object.values(this.apps).every(c=>c.processedBuffer||c.errored)&&((l=this.ls)==null||l.call(this))},a=!1,s=l=>{n.errored=!l,n.loaded=!0,yl.info("Site app with id "+t.id+" "+(l?"loaded":"errored")),a&&r()};try{var{processEvent:i}=t.init({posthog:this._instance,callback:l=>{s(l)}});i&&(n.processEvent=i),a=!0}catch(l){yl.error("Error while initializing PostHog app with config id "+t.id,l),s(!1)}if(a&&n.loaded)try{r()}catch(l){yl.error("Error while processing buffered events PostHog app with config id "+t.id,l),n.errored=!0}}hs(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}us(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(n)}catch(a){yl.error("Error while processing event "+t.event+" for site app "+r.id,a)}}}onRemoteConfig(t){var n,r,a,s=this;if((n=this.siteAppLoaders)!=null&&n.length)return this.isEnabled?(this.hs(),void this._instance.on("eventCaptured",u=>this.us(u))):void yl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.ls)==null||r.call(this),(a=t.siteApps)!=null&&a.length)if(this.isEnabled){var i=function(u){var h;Ot["__$$ph_site_app_"+u]=s._instance,(h=Ot.__PosthogExtensions__)==null||h.loadSiteApp==null||h.loadSiteApp(s._instance,c,m=>{if(m)return yl.error("Error while initializing PostHog app with config id "+u,m)})};for(var{id:l,url:c}of t.siteApps)i(l)}else yl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Jae=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],nF=function(e,t){if(!e)return!1;var n=e.toLowerCase();return Jae.concat(t||[]).some(r=>{var a=r.toLowerCase();return n.indexOf(a)!==-1})},kq=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&nF(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some(a=>nF(a==null?void 0:a.brand,t)))return!0}catch(a){}return!!e.webdriver},up=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),rF="i.posthog.com";class Zae{constructor(t){this.ds={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get uiHost(){var t,n=(t=this.instance.config.ui_host)==null?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+rF,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.ds[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ds[this.apiHost]=up.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ds[this.apiHost]=up.EU:this.ds[this.apiHost]=up.CUSTOM),this.ds[this.apiHost]}endpointFor(t,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),t==="ui")return this.uiHost+n;if(this.region===up.CUSTOM)return this.apiHost+n;var r=rF+n;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var ese={icontains:(e,t)=>!!Ce&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Ce&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Ce&&vh(t.href,e),not_regex:(e,t)=>!!Ce&&!vh(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class va{constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(a=>{va.vs("retrieved web experiments from the server"),n.cs=new Map,a.forEach(s=>{if(s.feature_flag_key){var i;n.cs&&(va.vs("setting flag key ",s.feature_flag_key," to web experiment ",s),(i=n.cs)==null||i.set(s.feature_flag_key,s));var l=n._instance.getFeatureFlag(s.feature_flag_key);vr(l)&&s.variants[l]&&n.fs(s.name,l,s.variants[l].transforms)}else if(s.variants)for(var c in s.variants){var u=s.variants[c];va.ps(u)&&n.fs(s.name,c,u.transforms)}})},r)},this._instance=t,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(t){if(this._is_bot())va.vs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(Nn(this.cs))return this.cs=new Map,this.loadIfEnabled(),void this.previewWebExperiment();va.vs("applying feature flags",t),t.forEach(n=>{var r;if(this.cs&&(r=this.cs)!=null&&r.has(n)){var a,s=this._instance.getFeatureFlag(n),i=(a=this.cs)==null?void 0:a.get(n);s&&i!=null&&i.variants[s]&&this.fs(i.name,s,i.variants[s].transforms)}})}}previewWebExperiment(){var t=va.getWindowLocation();if(t!=null&&t.search){var n=Ny(t==null?void 0:t.search,"__experiment_id"),r=Ny(t==null?void 0:t.search,"__experiment_variant");n&&r&&(va.vs("previewing web experiments "+n+" && "+r),this.getWebExperiments(a=>{this.gs(parseInt(n),r,a)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this._instance.config.disable_web_experiments&&!r)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return t([]);var i=s.json.experiments||[];return t(i)}})}gs(t,n,r){var a=r.filter(s=>s.id===t);a&&a.length>0&&(va.vs("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.fs(a[0].name,n,a[0].variants[n].transforms))}static ps(t){return!Nn(t.conditions)&&va._s(t)&&va.bs(t)}static _s(t){var n;if(Nn(t.conditions)||Nn((n=t.conditions)==null?void 0:n.url))return!0;var r,a,s,i=va.getWindowLocation();return!!i&&((r=t.conditions)==null||!r.url||ese[(a=(s=t.conditions)==null?void 0:s.urlMatchType)!==null&&a!==void 0?a:"icontains"](t.conditions.url,i))}static getWindowLocation(){return Ce==null?void 0:Ce.location}static bs(t){var n;if(Nn(t.conditions)||Nn((n=t.conditions)==null?void 0:n.utm))return!0;var r=wq();if(r.utm_source){var a,s,i,l,c,u,h,m,p=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((s=t.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,g=(i=t.conditions)==null||(i=i.utm)==null||!i.utm_source||((l=t.conditions)==null||(l=l.utm)==null?void 0:l.utm_source)==r.utm_source,T=(c=t.conditions)==null||(c=c.utm)==null||!c.utm_medium||((u=t.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,y=(h=t.conditions)==null||(h=h.utm)==null||!h.utm_term||((m=t.conditions)==null||(m=m.utm)==null?void 0:m.utm_term)==r.utm_term;return p&&T&&y&&g}return!1}static vs(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];ht.info("[WebExperiments] "+t,r)}fs(t,n,r){this._is_bot()?va.vs("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(a=>{if(a.selector){var s;va.vs("applying transform of variant "+n+" for experiment "+t+" ",a);var i=(s=document)==null?void 0:s.querySelectorAll(a.selector);i==null||i.forEach(l=>{var c=l;a.html&&(c.innerHTML=a.html),a.css&&c.setAttribute("style",a.css)})}}):va.vs("Control variants leave the page unmodified.")}_is_bot(){return Es&&this._instance?kq(Es,this._instance.config.custom_blocked_useragents):void 0}}var tse=Vr("[PostHog ExternalIntegrations]"),nse={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class rse{constructor(t){this._instance=t}nt(t,n){var r;(r=Ot.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,t,a=>{if(a)return tse.error("failed to load script",a);n()})}startIfEnabledOrStop(){var t=this,n=function(i){var l,c,u;!a||(l=Ot.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[i]||t.nt(nse[i],()=>{var h;(h=Ot.__PosthogExtensions__)==null||(h=h.integrations)==null||(h=h[i])==null||h.start(t._instance)}),!a&&(c=Ot.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[i]&&((u=Ot.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[i])==null||u.stop())};for(var[r,a]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var LI="[SessionRecording]",TT=Vr(LI);class ase{get started(){var t;return!((t=this.ys)==null||!t.isStarted)}get status(){var t;return this.qt?((t=this.ys)==null?void 0:t.status)||"lazy_loading":Mo}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this._instance=t,!this._instance.sessionManager)throw TT.error("started without valid sessionManager"),new Error(LI+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(LI+' cannot be used with cookieless_mode="always"')}get qt(){var t=!!this._instance.get_property(Hp),n=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return Ce&&t&&n&&!r}startIfEnabledOrStop(t){var n;if(!this.qt||(n=this.ys)==null||!n.isStarted){var r=!rt(Object.assign)&&!rt(Array.from);this.qt&&r?(this.ws(t),TT.info("starting")):this.stopRecording()}}ws(t){var n,r,a;this.qt&&(Ot!=null&&(n=Ot.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=Ot.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Ri(t):(a=Ot.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this._instance,this.Pi,s=>{if(s)return TT.error("could not load recorder",s);this.Ri(t)}))}stopRecording(){var t;(t=this.ys)==null||t.stop()}onRemoteConfig(t){this.Ss=t;var n,r=this._instance.persistence;r&&r.register({[Hp]:!!t.sessionRecording,[xy]:(n=t.sessionRecording)==null?void 0:n.scriptConfig}),this.ys?(this.ys.onRemoteConfig(t),this.Ss=void 0):this.ws(),this.startIfEnabledOrStop()}log(t,n){var r;n===void 0&&(n="log"),(r=this.ys)!=null&&r.log?this.ys.log(t,n):TT.warn("log called before recorder was ready")}get Pi(){var t;return((t=this._instance)==null||(t=t.persistence)==null||(t=t.get_property(xy))==null?void 0:t.script)||"lazy-recorder"}Ri(t){var n,r;if((n=Ot.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.ys||(this.ys=(r=Ot.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture,this.Ss&&(this.ys.onRemoteConfig(this.Ss),this.Ss=void 0)),this.ys.start(t)}onRRwebEmit(t){var n;(n=this.ys)==null||n.onRRwebEmit==null||n.onRRwebEmit(t)}overrideLinkedFlag(){var t;(t=this.ys)==null||t.overrideLinkedFlag()}overrideSampling(){var t;(t=this.ys)==null||t.overrideSampling()}overrideTrigger(t){var n;(n=this.ys)==null||n.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.ys)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}}var bp={},MI=()=>{},Vd="posthog",jq=!Tae&&(Ja==null?void 0:Ja.indexOf("MSIE"))===-1&&(Ja==null?void 0:Ja.indexOf("Mozilla"))===-1,aF=e=>{var t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Kne(mt==null?void 0:mt.location),persistence:"localStorage+cookie",persistence_name:"",loaded:MI,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:e!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:e!=null?e:"unset",debug:ts&&vr(ts==null?void 0:ts.search)&&ts.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Ce==null||(t=Ce.location)==null?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;ht.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:OI},error_tracking:{},_onCapture:MI}},sF=e=>{var t={};rt(e.process_person)||(t.person_profiles=e.process_person),rt(e.xhr_headers)||(t.request_headers=e.xhr_headers),rt(e.cookie_name)||(t.persistence_name=e.cookie_name),rt(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),rt(e.store_google)||(t.save_campaign_params=e.store_google),rt(e.verbose)||(t.debug=e.verbose);var n=wr({},t,e);return ar(e.property_blacklist)&&(rt(e.property_denylist)?n.property_denylist=e.property_blacklist:ar(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:ht.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class sse{constructor(){this.__forceAllowLocalhost=!1}get $s(){return this.__forceAllowLocalhost}set $s(t){ht.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class D0{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){this.webPerformance=new sse,this.ks=!1,this.version=_o.LIB_VERSION,this.xs=new Pq,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=aF(),this.SentryIntegration=lae,this.sentryIntegration=t=>function(n,r){var a=dq(n,r);return{name:uq,processEvent:s=>a(s)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Es=!1,this.Is=null,this.Rs=null,this.Ps=null,this.featureFlags=new jae(this),this.toolbar=new uae(this),this.scrollManager=new Wae(this),this.pageViewManager=new gae(this),this.surveys=new Hae(this),this.experiments=new va(this),this.exceptions=new xae(this),this.rateLimiter=new Vae(this),this.requestRouter=new Zae(this),this.consent=new yre(this),this.externalIntegrations=new rse(this),this.people={set:(t,n,r)=>{var a=vr(t)?{[t]:n}:t;this.setPersonProperties(a),r==null||r({})},set_once:(t,n,r)=>{var a=vr(t)?{[t]:n}:t;this.setPersonProperties(void 0,a),r==null||r({})}},this.on("eventCaptured",t=>ht.info('send "'+(t==null?void 0:t.event)+'"',t))}init(t,n,r){if(r&&r!==Vd){var a,s=(a=bp[r])!==null&&a!==void 0?a:new D0;return s._init(t,n,r),bp[r]=s,bp[Vd][r]=s,s}return this._init(t,n,r)}_init(t,n,r){var a,s;if(n===void 0&&(n={}),rt(t)||oI(t))return ht.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return ht.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Ts=n,this.Cs=[],n.person_profiles&&(this.Rs=n.person_profiles),this.set_config(wr({},aF(n.defaults),sF(n),{name:r,token:t})),this.config.on_xhr_error&&ht.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Co.GZipJS;var i=this.Ms();this.persistence=new tA(this.config,i),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new tA(ft({},this.config,{persistence:"sessionStorage"}),i);var l=ft({},this.persistence.props),c=ft({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Os=new zae(A=>this.Fs(A),this.config.request_queue_config),this.As=new Yae(this),this.__request_queue=[];var u=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new tF(this),this.sessionPropsManager=new eF(this,this.sessionManager,this.persistence)),new hae(this).startIfEnabledOrStop(),this.siteApps=new Qae(this),(a=this.siteApps)==null||a.init(),u||(this.config.__preview_lazy_load_replay?this.sessionRecording=new ase(this):this.sessionRecording=new kU(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new dre(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new pae(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new fae(this),this.exceptionObserver=new bre(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new K8(this,Sre),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new kre(this),this.historyAutocapture.startIfEnabled(),_o.DEBUG=_o.DEBUG||this.config.debug,_o.DEBUG&&ht.info("Starting in debug mode",{this:this,config:n,thisC:ft({},this.config),p:l,s:c}),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var h,m,p=this.config.get_device_id(Nl()),g=(h=n.bootstrap)!=null&&h.isIdentifiedID?p:n.bootstrap.distinctID;this.persistence.set_property(bo,(m=n.bootstrap)!=null&&m.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:g})}if(this.Ds()){var T,y,b=Object.keys(((T=n.bootstrap)==null?void 0:T.featureFlags)||{}).filter(A=>{var w;return!((w=n.bootstrap)==null||(w=w.featureFlags)==null||!w[A])}).reduce((A,w)=>{var _;return A[w]=((_=n.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[w])||!1,A},{}),x=Object.keys(((y=n.bootstrap)==null?void 0:y.featureFlagPayloads)||{}).filter(A=>b[A]).reduce((A,w)=>{var _,N;return(_=n.bootstrap)!=null&&(_=_.featureFlagPayloads)!=null&&_[w]&&(A[w]=(N=n.bootstrap)==null||(N=N.featureFlagPayloads)==null?void 0:N[w]),A},{});this.featureFlags.receivedFeatureFlags({featureFlags:b,featureFlagPayloads:x})}if(u)this.register_once({distinct_id:mm,$device_id:null},"");else if(!this.get_distinct_id()){var R=this.config.get_device_id(Nl());this.register_once({distinct_id:R,$device_id:R},""),this.persistence.set_property(bo,"anonymous")}return pr(Ce,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?oae(this,()=>this.js()):this.js(),Hs(this.config._onCapture)&&this.config._onCapture!==MI&&(ht.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",A=>this.config._onCapture(A.event,A))),this.config.ip&&ht.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Ce(t){var n,r,a,s,i,l,c,u;if(!mt||!mt.body)return ht.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ce(t)},500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=an(t.supportedCompression,Co.GZipJS)?Co.GZipJS:an(t.supportedCompression,Co.Base64)?Co.Base64:void 0),(n=t.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Rs?this.Rs:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(t),(a=this.sessionRecording)==null||a.onRemoteConfig(t),(s=this.autocapture)==null||s.onRemoteConfig(t),(i=this.heatmaps)==null||i.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(t),(c=this.exceptionObserver)==null||c.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(t)}js(){try{this.config.loaded(this)}catch(t){ht.critical("`loaded` function failed",t)}this.Ls(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Ns()},1),new Gae(this).load(),this.featureFlags.flags()}Ls(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Os)==null||t.enable())}_dom_loaded(){this.is_capturing()&&Ol(this.__request_queue,t=>this.Fs(t)),this.__request_queue=[],this.Ls()}_handle_unload(){var t,n;this.config.request_batching?(this.zs()&&this.capture("$pageleave"),(t=this.Os)==null||t.unload(),(n=this.As)==null||n.unload()):this.zs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Te(t){this.__loaded&&(jq?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Ly(t.url,{ip:this.config.ip?1:0}),t.headers=ft({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,a,s,i=ft({},n);i.timeout=i.timeout||6e4,i.url=Ly(i.url,{_:new Date().getTime().toString(),ver:_o.LIB_VERSION,compression:i.compression});var l=(r=i.transport)!==null&&r!==void 0?r:"fetch",c=(a=(s=D8(Sp,u=>u.transport===l))==null?void 0:s.method)!==null&&a!==void 0?a:Sp[0].method;if(!c)throw new Error("No available transport method");c(i)})(ft({},t,{callback:n=>{var r,a;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(a=this.config).on_request_error)==null||r.call(a,n)),t.callback==null||t.callback(n)}}))))}Fs(t){this.As?this.As.retriableRequest(t):this.Te(t)}_execute_array(t){var n,r=[],a=[],s=[];Ol(t,l=>{l&&(n=l[0],ar(n)?s.push(l):Hs(l)?l.call(this):ar(l)&&n==="alias"?r.push(l):ar(l)&&n.indexOf("capture")!==-1&&Hs(this[n])?s.push(l):a.push(l))});var i=function(l,c){Ol(l,function(u){if(ar(u[0])){var h=c;Bn(u,function(m){h=h[m[0]].apply(h,m.slice(1))})}else this[u[0]].apply(this,u.slice(1))},c)};i(r,this),i(a,this),i(s,this)}Ds(){var t,n;return((t=this.config.bootstrap)==null?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,r){var a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Os){if(this.is_capturing())if(!rt(t)&&vr(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){n!=null&&n.$current_url&&!vr(n==null?void 0:n.$current_url)&&(ht.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var i=new Date,l=(r==null?void 0:r.timestamp)||i,c=Nl(),u={uuid:c,event:t,properties:this.calculateEventProperties(t,n||{},l,c)};s&&(u.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),r!=null&&r.$set&&(u.$set=r==null?void 0:r.$set);var h,m=this.Us(r==null?void 0:r.$set_once);if(m&&(u.$set_once=m),(u=Wne(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,rt(r==null?void 0:r.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=i),t===rA.DISMISSED||t===rA.SENT){var p=n==null?void 0:n[QU.SURVEY_ID],g=n==null?void 0:n[QU.SURVEY_ITERATION];h={id:p,current_iteration:g},localStorage.getItem(JU(h))||localStorage.setItem(JU(h),"true"),u.$set=ft({},u.$set,{[Fae({id:p,current_iteration:g},t===rA.SENT?"responded":"dismissed")]:!0})}var T=ft({},u.properties.$set,u.$set);if(Xd(T)||this.setPersonPropertiesForFlags(T),!Nn(this.config.before_send)){var y=this.qs(u);if(!y)return;u=y}this.xs.emit("eventCaptured",u);var b={method:"POST",url:(a=r==null?void 0:r._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Fs(b):this.Os.enqueue(b),u}ht.critical("This capture call is ignored due to client rate limiting.")}}else ht.error("No event name provided to posthog.capture")}else ht.uninitializedWarning("posthog.capture")}Ye(t){return this.on("eventCaptured",n=>t(n.event,n))}calculateEventProperties(t,n,r,a,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var i=s?void 0:this.persistence.remove_event_timer(t),l=ft({},n);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),t==="$snapshot"){var c=ft({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=c.distinct_id,(!vr(l.distinct_id)&&!_a(l.distinct_id)||oI(l.distinct_id))&&ht.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,h=Dae(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:m,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());l.$session_id=m,l.$window_id=p}this.sessionPropsManager&&wr(l,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&wr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=(g=this.As)==null?void 0:g.length}catch(x){l.$sdk_debug_error_capturing_properties=String(x)}if(this.requestRouter.region===up.CUSTOM&&(l.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||s?t!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,a),l=wr(l,u),t==="$pageview"&&mt&&(l.title=mt.title),!rt(i)){var T=r.getTime()-i;l.$duration=parseFloat((T/1e3).toFixed(3))}Ja&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=wr({},h,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),ar(this.config.property_denylist)?Bn(this.config.property_denylist,function(x){delete l[x]}):ht.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(ht.error("sanitize_properties is deprecated. Use before_send instead"),l=y(l,t));var b=this.Bs();return l.$process_person_profile=b,b&&!s&&this.Hs("_calculate_event_properties"),l}Us(t){var n;if(!this.persistence||!this.Bs()||this.ks)return t;var r=this.persistence.get_initial_props(),a=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),s=wr({},r,a||{},t||{}),i=this.config.sanitize_properties;return i&&(ht.error("sanitize_properties is deprecated. Use before_send instead"),s=i(s,"$set_once")),this.ks=!0,Xd(s)?void 0:s}register(t,n){var r;(r=this.persistence)==null||r.register(t,n)}register_once(t,n,r){var a;(a=this.persistence)==null||a.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)==null||n.register(t)}unregister(t){var n;(n=this.persistence)==null||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)==null||n.unregister(t)}Ws(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch(r){return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n,r)}getEarlyAccessFeatures(t,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(t,n,r)}on(t,n){return this.xs.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t,n){n===void 0&&(n=!1),this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(t,n)}identify(t,n,r){if(!this.__loaded||!this.persistence)return ht.uninitializedWarning("posthog.identify");if(_a(t)&&(t=t.toString(),ht.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))ht.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==mm){if(this.Hs("posthog.identify")){var a=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=a;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==a&&t!==this.get_property(np)&&(this.unregister(np),this.register({distinct_id:t}));var i=(this.persistence.get_property(bo)||"anonymous")==="anonymous";t!==a&&i?(this.persistence.set_property(bo,"identified"),this.setPersonPropertiesForFlags(ft({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:r||{}}),this.Ps=HU(t,n,r),this.featureFlags.setAnonymousDistinctId(a)):(n||r)&&this.setPersonProperties(n,r),t!==a&&(this.reloadFeatureFlags(),this.unregister(by))}}else ht.critical('The string "'+mm+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else ht.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this.Hs("posthog.setPersonProperties")){var r=HU(this.get_distinct_id(),t,n);this.Ps!==r?(this.setPersonPropertiesForFlags(ft({},n||{},t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.Ps=r):ht.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,r){if(t&&n){if(this.Hs("posthog.group")){var a=this.getGroups();a[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:ft({},a,{[t]:n})}),r&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[t]:r})),a[t]===n||r||this.reloadFeatureFlags()}}else ht.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,n){n===void 0&&(n=!0),this.Hs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,r,a,s;if(ht.info("reset"),!this.__loaded)return ht.uninitializedWarning("posthog.reset");var i=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(a=this.persistence)==null||a.set_property(bo,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Ps=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:mm,$device_id:null},"");else{var l=this.config.get_device_id(Nl());this.register_once({distinct_id:l,$device_id:t?l:i},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(t!=null&&t.withTimestamp&&r){var s,i=(s=t.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-i,0)}return a}alias(t,n){return t===this.get_property(P8)?(ht.critical("Attempting to create alias for existing People user - aborting."),-2):this.Hs("posthog.alias")?(rt(n)&&(n=this.get_distinct_id()),t!==n?(this.Ws(np,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(ht.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=ft({},this.config);if(Sr(t)){var r,a,s,i,l;wr(this.config,sF(t));var c=this.Ms();(r=this.persistence)==null||r.update_config(this.config,n,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new tA(ft({},this.config,{persistence:"sessionStorage"}),c),Br.G()&&Br.V("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(_o.DEBUG=!0,ht.info("set_config",{config:t,oldConfig:n,newConfig:ft({},this.config)})),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(s=this.autocapture)==null||s.startIfEnabled(),(i=this.heatmaps)==null||i.startIfEnabled(),this.surveys.loadIfEnabled(),this.Gs(),(l=this.externalIntegrations)==null||l.startIfEnabledOrStop()}}startSessionRecording(t){var n=t===!0,r={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(r).some(Boolean)){var a,s,i,l,c;(a=this.sessionManager)==null||a.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),r.url_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("url")),r.event_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)==null||!t.started)}captureException(t,n){var r=new Error("PostHog syntheticException");return this.exceptions.sendExceptionEvent(ft({},Pre((a=>a instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:r}),n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)==null?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)==null?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Vd;return n!==Vd&&(n=Vd+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(bo))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(bo))==="identified"}Bs(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Xd(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[np])&&((n=this.persistence)==null||(n=n.props)==null||!n[Ay]))}zs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Bs()||this.Hs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Hs(t){return this.config.person_profiles==="never"?(ht.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ws(Ay,!0),!0)}Ms(){if(this.config.cookieless_mode==="always")return!0;var t=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||t&&!!n}Gs(){var t,n,r,a,s=this.Ms();return((t=this.persistence)==null?void 0:t.je)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.je)!==s&&((a=this.sessionPersistence)==null||a.set_disabled(s)),s}opt_in_capturing(t){if(this.config.cookieless_mode!=="always"){var n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new tF(this),this.persistence&&(this.sessionPropsManager=new eF(this,this.sessionManager,this.persistence)),this.sessionRecording=new kU(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Gs(),(rt(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((n=t==null?void 0:t.captureEventName)!==null&&n!==void 0?n:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ns()}else ht.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Gs(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:mm,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,this.Ns())):ht.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===vo.GRANTED?"granted":t===vo.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Gs()}_is_bot(){return Es?kq(Es,this.config.custom_blocked_useragents):void 0}Ns(){mt&&(mt.visibilityState==="visible"?this.Es||(this.Es=!0,this.capture("$pageview",{title:mt.title},{send_instantly:!0}),this.Is&&(mt.removeEventListener("visibilitychange",this.Is),this.Is=null)):this.Is||(this.Is=this.Ns.bind(this),pr(mt,"visibilitychange",this.Is)))}debug(t){t===!1?(Ce==null||Ce.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Ce==null||Ce.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var t,n,r,a,s,i,l,c=this.Ts||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(ht.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",a=!1,s=ht,i=(n="advanced_disable_flags")in(t=c)&&!rt(t[n]),l=r in t&&!rt(t[r]),i?t[n]:l?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),t[r]):a)}qs(t){if(Nn(this.config.before_send))return t;var n=ar(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var a of n){if(r=a(r),Nn(r)){var s="Event '"+t.event+"' was rejected in beforeSend function";return Vne(t.event)?ht.warn(s+". This can cause unexpected behavior."):ht.info(s),null}r.properties&&!Xd(r.properties)||ht.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var t;return(t=this.pageViewManager.pe)==null?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=Yne(e.prototype[t[n]])})(D0,["identify"]);var iF,Gd=(iF=bp[Vd]=new D0,function(){function e(){e.done||(e.done=!0,jq=!1,Bn(bp,function(t){t._dom_loaded()}))}mt!=null&&mt.addEventListener?mt.readyState==="complete"?e():pr(mt,"DOMContentLoaded",e,{capture:!1}):Ce&&ht.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),iF),U1=v.createContext({client:Gd});function Uq(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(var s=0,i=r;s<i.length;s++){var l=i[s];if(!a.includes(l)||!Uq(e[l],t[l],n))return!1}return!0}function ise(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,s=v.useRef(null),i=v.useMemo(function(){return n||Gd},[n,r,JSON.stringify(a)]);return v.useEffect(function(){if(!n){var l=s.current;l?(l.apiKey,a&&!Uq(a,l.options)&&Gd.set_config(a),s.current={apiKey:r,options:a!=null?a:{}}):(Gd.__loaded,Gd.init(r,a),s.current={apiKey:r,options:a!=null?a:{}})}},[n,r,JSON.stringify(a)]),Ht.createElement(U1.Provider,{value:{client:i}},t)}var Fq=function(){var e=v.useContext(U1).client;return e},DI=function(e,t){return DI=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])},DI(e,t)};function ose(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");DI(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var sA=function(e){return typeof e=="function"},lse={componentStack:null,exceptionEvent:null,error:null};(function(e){ose(t,e);function t(n){var r=e.call(this,n)||this;return r.state=lse,r}return t.prototype.componentDidCatch=function(n,r){var a=this.props.additionalProperties,s;sA(a)?s=a(n):typeof a=="object"&&(s=a);var i=this.context.client,l=i.captureException(n,s),c=r.componentStack;this.setState({error:n,componentStack:c,exceptionEvent:l})},t.prototype.render=function(){var n=this.props,r=n.children,a=n.fallback,s=this.state;if(s.componentStack==null)return sA(r)?r():r;var i=sA(a)?Ht.createElement(a,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent}):a;return Ht.isValidElement(i)?i:Ht.createElement(Ht.Fragment,null)},t.contextType=U1,t})(Ht.Component);var Gh=x8();/**
 * @remix-run/router v1.23.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Yp(){return Yp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Yp.apply(this,arguments)}var _l;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(_l||(_l={}));const oF="popstate";function cse(e){e===void 0&&(e={});function t(r,a){let{pathname:s,search:i,hash:l}=r.location;return PI("",{pathname:s,search:i,hash:l},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(r,a){return typeof a=="string"?a:Dy(a)}return dse(t,n,null,e)}function Dr(e,t){if(e===!1||e===null||typeof e=="undefined")throw new Error(t)}function $q(e,t){if(!e)try{throw new Error(t)}catch(n){}}function use(){return Math.random().toString(36).substr(2,8)}function lF(e,t){return{usr:e.state,key:e.key,idx:t}}function PI(e,t,n,r){return n===void 0&&(n=null),Yp({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?zh(t):t,{state:n,key:t&&t.key||r||use()})}function Dy(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function zh(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function dse(e,t,n,r){r===void 0&&(r={});let{window:a=document.defaultView,v5Compat:s=!1}=r,i=a.history,l=_l.Pop,c=null,u=h();u==null&&(u=0,i.replaceState(Yp({},i.state,{idx:u}),""));function h(){return(i.state||{idx:null}).idx}function m(){l=_l.Pop;let b=h(),x=b==null?null:b-u;u=b,c&&c({action:l,location:y.location,delta:x})}function p(b,x){l=_l.Push;let R=PI(y.location,b,x);u=h()+1;let A=lF(R,u),w=y.createHref(R);try{i.pushState(A,"",w)}catch(_){if(_ instanceof DOMException&&_.name==="DataCloneError")throw _;a.location.assign(w)}s&&c&&c({action:l,location:y.location,delta:1})}function g(b,x){l=_l.Replace;let R=PI(y.location,b,x);u=h();let A=lF(R,u),w=y.createHref(R);i.replaceState(A,"",w),s&&c&&c({action:l,location:y.location,delta:0})}function T(b){let x=a.location.origin!=="null"?a.location.origin:a.location.href,R=typeof b=="string"?b:Dy(b);return R=R.replace(/ $/,"%20"),Dr(x,"No window.location.(origin|href) available to create URL for href: "+R),new URL(R,x)}let y={get action(){return l},get location(){return e(a,i)},listen(b){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(oF,m),c=b,()=>{a.removeEventListener(oF,m),c=null}},createHref(b){return t(a,b)},createURL:T,encodeLocation(b){let x=T(b);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:p,replace:g,go(b){return i.go(b)}};return y}var cF;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(cF||(cF={}));function hse(e,t,n){return n===void 0&&(n="/"),fse(e,t,n)}function fse(e,t,n,r){let a=typeof t=="string"?zh(t):t,s=F1(a.pathname||"/",n);if(s==null)return null;let i=Bq(e);mse(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let u=Nse(s);l=vse(i[c],u)}return l}function Bq(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let a=(s,i,l)=>{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:i,route:s};c.relativePath.startsWith("/")&&(Dr(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=Ml([r,c.relativePath]),h=n.concat(c);s.children&&s.children.length>0&&(Dr(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Bq(s.children,t,h,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:Sse(u,s.index),routesMeta:h})};return e.forEach((s,i)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))a(s,i);else for(let c of Hq(s.path))a(s,i,c)}),t}function Hq(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return a?[s,""]:[s];let i=Hq(r.join("/")),l=[];return l.push(...i.map(c=>c===""?s:[s,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function mse(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:bse(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const pse=/^:[\w-]+$/,gse=3,Ese=2,Tse=1,yse=10,xse=-2,uF=e=>e==="*";function Sse(e,t){let n=e.split("/"),r=n.length;return n.some(uF)&&(r+=xse),t&&(r+=Ese),n.filter(a=>!uF(a)).reduce((a,s)=>a+(pse.test(s)?gse:s===""?Tse:yse),r)}function bse(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function vse(e,t,n){let{routesMeta:r}=e,a={},s="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,h=s==="/"?t:t.slice(s.length)||"/",m=Ase({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},h),p=c.route;if(!m)return null;Object.assign(a,m.params),i.push({params:a,pathname:Ml([s,m.pathname]),pathnameBase:Ise(Ml([s,m.pathnameBase])),route:p}),m.pathnameBase!=="/"&&(s=Ml([s,m.pathnameBase]))}return i}function Ase(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Rse(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((u,h,m)=>{let{paramName:p,isOptional:g}=h;if(p==="*"){let y=l[m]||"";i=s.slice(0,s.length-y.length).replace(/(.)\/+$/,"$1")}const T=l[m];return g&&!T?u[p]=void 0:u[p]=(T||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:i,pattern:e}}function Rse(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),$q(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Nse(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return $q(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function F1(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function _se(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?zh(e):e;return{pathname:n?n.startsWith("/")?n:wse(n,t):t,search:Ose(r),hash:Lse(a)}}function wse(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function iA(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Cse(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Vq(e,t){let n=Cse(e);return t?n.map((r,a)=>a===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Gq(e,t,n,r){r===void 0&&(r=!1);let a;typeof e=="string"?a=zh(e):(a=Yp({},e),Dr(!a.pathname||!a.pathname.includes("?"),iA("?","pathname","search",a)),Dr(!a.pathname||!a.pathname.includes("#"),iA("#","pathname","hash",a)),Dr(!a.search||!a.search.includes("#"),iA("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,l;if(i==null)l=n;else{let m=t.length-1;if(!r&&i.startsWith("..")){let p=i.split("/");for(;p[0]==="..";)p.shift(),m-=1;a.pathname=p.join("/")}l=m>=0?t[m]:"/"}let c=_se(a,l),u=i&&i!=="/"&&i.endsWith("/"),h=(s||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||h)&&(c.pathname+="/"),c}const Ml=e=>e.join("/").replace(/\/\/+/g,"/"),Ise=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ose=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Lse=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Mse(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const zq=["post","put","patch","delete"];new Set(zq);const Dse=["get",...zq];new Set(Dse);/**
 * React Router v6.30.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Wp(){return Wp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wp.apply(this,arguments)}const $1=v.createContext(null),Pse=v.createContext(null),Cu=v.createContext(null),P0=v.createContext(null),Jl=v.createContext({outlet:null,matches:[],isDataRoute:!1}),qq=v.createContext(null);function kse(e,t){let{relative:n}=t===void 0?{}:t;Cg()||Dr(!1);let{basename:r,navigator:a}=v.useContext(Cu),{hash:s,pathname:i,search:l}=Wq(e,{relative:n}),c=i;return r!=="/"&&(c=i==="/"?r:Ml([r,i])),a.createHref({pathname:c,search:l,hash:s})}function Cg(){return v.useContext(P0)!=null}function Iu(){return Cg()||Dr(!1),v.useContext(P0).location}function Yq(e){v.useContext(Cu).static||v.useLayoutEffect(e)}function xi(){let{isDataRoute:e}=v.useContext(Jl);return e?Kse():jse()}function jse(){Cg()||Dr(!1);let e=v.useContext($1),{basename:t,future:n,navigator:r}=v.useContext(Cu),{matches:a}=v.useContext(Jl),{pathname:s}=Iu(),i=JSON.stringify(Vq(a,n.v7_relativeSplatPath)),l=v.useRef(!1);return Yq(()=>{l.current=!0}),v.useCallback(function(u,h){if(h===void 0&&(h={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let m=Gq(u,JSON.parse(i),s,h.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:Ml([t,m.pathname])),(h.replace?r.replace:r.push)(m,h.state,h)},[t,r,i,s,e])}function Use(){let{matches:e}=v.useContext(Jl),t=e[e.length-1];return t?t.params:{}}function Wq(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=v.useContext(Cu),{matches:a}=v.useContext(Jl),{pathname:s}=Iu(),i=JSON.stringify(Vq(a,r.v7_relativeSplatPath));return v.useMemo(()=>Gq(e,JSON.parse(i),s,n==="path"),[e,i,s,n])}function Fse(e,t){return $se(e,t)}function $se(e,t,n,r){Cg()||Dr(!1);let{navigator:a,static:s}=v.useContext(Cu),{matches:i}=v.useContext(Jl),l=i[i.length-1],c=l?l.params:{};l&&l.pathname;let u=l?l.pathnameBase:"/";l&&l.route;let h=Iu(),m;if(t){var p;let x=typeof t=="string"?zh(t):t;u==="/"||(p=x.pathname)!=null&&p.startsWith(u)||Dr(!1),m=x}else m=h;let g=m.pathname||"/",T=g;if(u!=="/"){let x=u.replace(/^\//,"").split("/");T="/"+g.replace(/^\//,"").split("/").slice(x.length).join("/")}let y=hse(e,{pathname:T}),b=zse(y&&y.map(x=>Object.assign({},x,{params:Object.assign({},c,x.params),pathname:Ml([u,a.encodeLocation?a.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?u:Ml([u,a.encodeLocation?a.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,n,r);return t&&b?v.createElement(P0.Provider,{value:{location:Wp({pathname:"/",search:"",hash:"",state:null,key:"default"},m),navigationType:_l.Pop}},b):b}function Bse(){let e=Xse(),t=Mse(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:a},n):null,null)}const Hse=v.createElement(Bse,null);class Vse extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){}render(){return this.state.error!==void 0?v.createElement(Jl.Provider,{value:this.props.routeContext},v.createElement(qq.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Gse(e){let{routeContext:t,match:n,children:r}=e,a=v.useContext($1);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Jl.Provider,{value:t},r)}function zse(e,t,n,r){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let i=e,l=(a=n)==null?void 0:a.errors;if(l!=null){let h=i.findIndex(m=>m.route.id&&(l==null?void 0:l[m.route.id])!==void 0);h>=0||Dr(!1),i=i.slice(0,Math.min(i.length,h+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let h=0;h<i.length;h++){let m=i[h];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(u=h),m.route.id){let{loaderData:p,errors:g}=n,T=m.route.loader&&p[m.route.id]===void 0&&(!g||g[m.route.id]===void 0);if(m.route.lazy||T){c=!0,u>=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((h,m,p)=>{let g,T=!1,y=null,b=null;n&&(g=l&&m.route.id?l[m.route.id]:void 0,y=m.route.errorElement||Hse,c&&(u<0&&p===0?(Qse("route-fallback"),T=!0,b=null):u===p&&(T=!0,b=m.route.hydrateFallbackElement||null)));let x=t.concat(i.slice(0,p+1)),R=()=>{let A;return g?A=y:T?A=b:m.route.Component?A=v.createElement(m.route.Component,null):m.route.element?A=m.route.element:A=h,v.createElement(Gse,{match:m,routeContext:{outlet:h,matches:x,isDataRoute:n!=null},children:A})};return n&&(m.route.ErrorBoundary||m.route.errorElement||p===0)?v.createElement(Vse,{location:n.location,revalidation:n.revalidation,component:y,error:g,children:R(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):R()},null)}var Xq=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Xq||{}),Kq=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Kq||{});function qse(e){let t=v.useContext($1);return t||Dr(!1),t}function Yse(e){let t=v.useContext(Pse);return t||Dr(!1),t}function Wse(e){let t=v.useContext(Jl);return t||Dr(!1),t}function Qq(e){let t=Wse(),n=t.matches[t.matches.length-1];return n.route.id||Dr(!1),n.route.id}function Xse(){var e;let t=v.useContext(qq),n=Yse(),r=Qq();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Kse(){let{router:e}=qse(Xq.UseNavigateStable),t=Qq(Kq.UseNavigateStable),n=v.useRef(!1);return Yq(()=>{n.current=!0}),v.useCallback(function(a,s){s===void 0&&(s={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Wp({fromRouteId:t},s)))},[e,t])}const dF={};function Qse(e,t,n){dF[e]||(dF[e]=!0)}function Jse(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function jc(e){Dr(!1)}function Zse(e){let{basename:t="/",children:n=null,location:r,navigationType:a=_l.Pop,navigator:s,static:i=!1,future:l}=e;Cg()&&Dr(!1);let c=t.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:c,navigator:s,static:i,future:Wp({v7_relativeSplatPath:!1},l)}),[c,l,s,i]);typeof r=="string"&&(r=zh(r));let{pathname:h="/",search:m="",hash:p="",state:g=null,key:T="default"}=r,y=v.useMemo(()=>{let b=F1(h,c);return b==null?null:{location:{pathname:b,search:m,hash:p,state:g,key:T},navigationType:a}},[c,h,m,p,g,T,a]);return y==null?null:v.createElement(Cu.Provider,{value:u},v.createElement(P0.Provider,{children:n,value:y}))}function eie(e){let{children:t,location:n}=e;return Fse(kI(t),n)}new Promise(()=>{});function kI(e,t){t===void 0&&(t=[]);let n=[];return v.Children.forEach(e,(r,a)=>{if(!v.isValidElement(r))return;let s=[...t,a];if(r.type===v.Fragment){n.push.apply(n,kI(r.props.children,s));return}r.type!==jc&&Dr(!1),!r.props.index||!r.props.children||Dr(!1);let i={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=kI(r.props.children,s)),n.push(i)}),n}/**
 * React Router DOM v6.30.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function jI(){return jI=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jI.apply(this,arguments)}function tie(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,s;for(s=0;s<r.length;s++)a=r[s],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function nie(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function rie(e,t){return e.button===0&&(!t||t==="_self")&&!nie(e)}function UI(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function aie(e,t){let n=UI(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(s=>{n.append(a,s)})}),n}const sie=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],iie="6";try{window.__reactRouterVersion=iie}catch(e){}const oie="startTransition",hF=ine[oie];function lie(e){let{basename:t,children:n,future:r,window:a}=e,s=v.useRef();s.current==null&&(s.current=cse({window:a,v5Compat:!0}));let i=s.current,[l,c]=v.useState({action:i.action,location:i.location}),{v7_startTransition:u}=r||{},h=v.useCallback(m=>{u&&hF?hF(()=>c(m)):c(m)},[c,u]);return v.useLayoutEffect(()=>i.listen(h),[i,h]),v.useEffect(()=>Jse(r),[r]),v.createElement(Zse,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:i,future:r})}const cie=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined",uie=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,die=v.forwardRef(function(t,n){let{onClick:r,relative:a,reloadDocument:s,replace:i,state:l,target:c,to:u,preventScrollReset:h,viewTransition:m}=t,p=tie(t,sie),{basename:g}=v.useContext(Cu),T,y=!1;if(typeof u=="string"&&uie.test(u)&&(T=u,cie))try{let A=new URL(window.location.href),w=u.startsWith("//")?new URL(A.protocol+u):new URL(u),_=F1(w.pathname,g);w.origin===A.origin&&_!=null?u=_+w.search+w.hash:y=!0}catch(A){}let b=kse(u,{relative:a}),x=hie(u,{replace:i,state:l,target:c,preventScrollReset:h,relative:a,viewTransition:m});function R(A){r&&r(A),A.defaultPrevented||x(A)}return v.createElement("a",jI({},p,{href:T||b,onClick:y||s?r:R,ref:n,target:c}))});var fF;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(fF||(fF={}));var mF;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(mF||(mF={}));function hie(e,t){let{target:n,replace:r,state:a,preventScrollReset:s,relative:i,viewTransition:l}=t===void 0?{}:t,c=xi(),u=Iu(),h=Wq(e,{relative:i});return v.useCallback(m=>{if(rie(m,n)){m.preventDefault();let p=r!==void 0?r:Dy(u)===Dy(h);c(e,{replace:p,state:a,preventScrollReset:s,relative:i,viewTransition:l})}},[u,c,h,r,a,n,e,s,i,l])}function fie(e){let t=v.useRef(UI(e)),n=v.useRef(!1),r=Iu(),a=v.useMemo(()=>aie(r.search,n.current?null:t.current),[r.search]),s=xi(),i=v.useCallback((l,c)=>{const u=UI(typeof l=="function"?l(a):l);n.current=!0,s("?"+u,c)},[s,a]);return[a,i]}const mie="modulepreload",pie=function(e){return"/"+e},pF={},fn=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let i=function(u){return Promise.all(u.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=i(n.map(u=>{if(u=pie(u),u in pF)return;pF[u]=!0;const h=u.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(document.querySelector('link[href="'.concat(u,'"]').concat(m)))return;const p=document.createElement("link");if(p.rel=h?"stylesheet":mie,h||(p.as="script"),p.crossOrigin="",p.href=u,c&&p.setAttribute("nonce",c),document.head.appendChild(p),h)return new Promise((g,T)=>{p.addEventListener("load",g),p.addEventListener("error",()=>T(new Error("Unable to preload CSS for ".concat(u))))})}))}function s(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return a.then(i=>{for(const l of i||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},gF=e=>{let t;const n=new Set,r=(u,h)=>{const m=typeof u=="function"?u(t):u;if(!Object.is(m,t)){const p=t;t=(h!=null?h:typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(g=>g(t,p))}},a=()=>t,l={setState:r,getState:a,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=t=e(r,a,l);return l},gie=e=>e?gF(e):gF,Eie=e=>e;function Tie(e,t=Eie){const n=Ht.useSyncExternalStore(e.subscribe,()=>t(e.getState()),()=>t(e.getInitialState()));return Ht.useDebugValue(n),n}const EF=e=>{const t=gie(e),n=r=>Tie(t,r);return Object.assign(n,t),n},Ki=e=>e?EF(e):EF,yie="1.29.1-dev132.0",yT="https://unpkg.com/@duckdb/duckdb-wasm@".concat(yie,"/dist"),xm=!1;function TF(e){return H(this,null,function*(){try{const n=yield(yield fetch(e)).blob();return URL.createObjectURL(n)}catch(t){throw t}})}const xT={mvp:{mainModule:"".concat(yT,"/duckdb-mvp.wasm"),mainWorker:"".concat(yT,"/duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(yT,"/duckdb-eh.wasm"),mainWorker:"".concat(yT,"/duckdb-browser-eh.worker.js")}};function xie(){return H(this,null,function*(){try{const[e,t]=yield Promise.all([TF(xT.mvp.mainWorker),TF(xT.eh.mainWorker)]);return{mvp:{mainModule:xT.mvp.mainModule,mainWorker:e},eh:{mainModule:xT.eh.mainModule,mainWorker:t}}}catch(e){throw e}})}function Sie(){return H(this,null,function*(){return xie()})}const oA={MEMORY_LIMIT:"4GB",TEMP_DIRECTORY:"/tmp/duckdb",REQUIRED_EXTENSIONS:["json","parquet"]};function Jq(e){var t,n;try{(t=e.mvp)!=null&&t.mainWorker&&typeof e.mvp.mainWorker=="string"&&URL.revokeObjectURL(e.mvp.mainWorker),(n=e.eh)!=null&&n.mainWorker&&typeof e.eh.mainWorker=="string"&&URL.revokeObjectURL(e.eh.mainWorker)}catch(r){}}let Hc=null;function bie(){return H(this,null,function*(){try{Hc=yield Sie();const e=yield Zte(Hc),t=new Worker(e.mainWorker),n=new ene,r=new tne(n,t);yield r.instantiate(e.mainModule,e.pthreadWorker);const a=yield r.connect();return yield vie(a),{db:r,conn:a}}catch(e){throw Hc&&Jq(Hc),new Error("Failed to initialize DuckDB: ".concat(e instanceof Error?e.message:String(e)))}})}function vie(e){return H(this,null,function*(){try{yield e.query("PRAGMA memory_limit='".concat(oA.MEMORY_LIMIT,"'"));try{yield e.query("PRAGMA temp_directory='".concat(oA.TEMP_DIRECTORY,"'"))}catch(t){}for(const t of oA.REQUIRED_EXTENSIONS)try{yield e.query("INSTALL ".concat(t)),yield e.query("LOAD ".concat(t))}catch(n){}}catch(t){}})}function Aie(){Hc&&(Jq(Hc),Hc=null)}var Nt=(e=>(e.Unknown="unknown",e.Text="text",e.Number="number",e.Boolean="boolean",e.Date="date",e.Array="array",e.Object="object",e))(Nt||{});function Zq(e){return e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim()}function Rie(e){return/^\s*SELECT\b/i.test(e)}function Nie(e,t,n){const a=Zq(e).replace(";","");return a.toUpperCase().includes("LIMIT")?e:"".concat(a," LIMIT ").concat(t," OFFSET ").concat(n)}function _ie(e){const t=e.replace(";","");return"SELECT CAST(COUNT(*) AS INTEGER) as total_rows FROM (".concat(t,") as count_query")}function FI(e){if(typeof e=="bigint")return e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER?Number(e):e.toString();if(Array.isArray(e))return e.map(FI);if(e!==null&&typeof e=="object"){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=FI(e[n]));return t}return e}function wie(e){return e.map(t=>{const n={};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const a=t[r];typeof a=="bigint"?a<=Number.MAX_SAFE_INTEGER&&a>=Number.MIN_SAFE_INTEGER?n[r]=Number(a):n[r]=a.toString():n[r]=a}return n})}function Cie(l,c,u){return H(this,arguments,function*({sql:e,page:t,pageSize:n,applyPagination:r=!0,countTotalRows:a=!0},s,i){const h=performance.now();try{let m=e;const p=Array.from(i.keys());for(const I of p){const D=new RegExp("\\b".concat(I,'\\b(?=(?:[^"]*"[^"]*")*[^"]*$)'),"g"),M=i.get(I)||'"'.concat(I,'"');m=m.replace(D,M)}const g=Zq(m),T=Rie(g);let y=0,b=0;if(T&&a){const I=_ie(m);try{const M=(yield s.query(I)).toArray();if(M&&M.length>0){const O=M[0].total_rows;typeof O=="bigint"?y=Number(O):y=O||0,b=Math.ceil(y/n)}else y=0,b=0}catch(D){y=0,b=1}}else y=0,b=1;let x=m;if(T&&r&&!g.toUpperCase().includes("LIMIT")){const I=(t-1)*n;x=Nie(m,n,I)}const R=yield s.query(x),w=performance.now()-h,_=wie(R.toArray()),N=R.schema.fields.map(I=>I.name);return y===0&&_.length>0&&(T?(y=(t-1)*n+_.length,b=_.length<n?t:t+1):(y=_.length,b=1)),{data:_,columns:N,totalRows:y,page:t,pageSize:n,totalPages:b,queryTime:w}}catch(m){throw m}})}function Iie(e,t){return H(this,null,function*(){try{const n="\n      SELECT type \n      FROM sqlite_master \n      WHERE name = '".concat(t,"' \n      AND type IN ('table', 'view')\n    "),a=(yield e.query(n)).toArray();if(a.length>0)return a[0].type;try{const s="\n        SELECT table_name\n        FROM information_schema.views \n        WHERE table_name = '".concat(t,"'\n        AND table_schema = 'main'\n      ");if((yield e.query(s)).toArray().length>0)return"view"}catch(s){}try{const s='"'.concat(t,'"');return yield e.query("SELECT 1 FROM ".concat(s," LIMIT 0")),"table"}catch(s){return null}}catch(n){return null}})}function lA(e){const t=e.toLowerCase();return!!(["duckdb_columns","duckdb_constraints","duckdb_databases","duckdb_indexes","duckdb_logs","duckdb_schemas","duckdb_tables","duckdb_types","duckdb_views","sqlite_master","sqlite_schema","sqlite_temp_master","sqlite_temp_schema","pragma_database_list","information_schema"].includes(t)||["sqlite_","pragma_","duckdb_","information_schema","pg_"].some(a=>t.startsWith(a)))}function Oie(n){return H(this,arguments,function*(e,t=new Map){try{const r="\n      SELECT name, type\n      FROM sqlite_master \n      WHERE type IN ('table', 'view')\n      AND name NOT LIKE 'sqlite_%'\n      AND name NOT LIKE 'duckdb_%'\n      AND name NOT LIKE 'pragma_%'\n      ORDER BY type, name\n    ";let a=[];try{a=(yield e.query(r)).toArray()}catch(h){}let s=[];try{s=(yield e.query("\n        SELECT table_name as name, 'view' as type\n        FROM information_schema.views\n        WHERE table_schema = 'main'\n        AND table_name NOT LIKE 'sqlite_%'\n        AND table_name NOT LIKE 'duckdb_%' \n        AND table_name NOT LIKE 'pragma_%'\n      ")).toArray()}catch(h){try{a=(yield e.query("\n          SELECT table_name as name, 'table' as type\n          FROM information_schema.tables \n          WHERE table_schema = 'main' \n          AND table_type = 'BASE TABLE'\n          AND table_name NOT LIKE 'sqlite_%'\n          AND table_name NOT LIKE 'duckdb_%'\n        ")).toArray()}catch(m){}}const i=new Map;a.forEach(h=>{lA(h.name)||i.set(h.name,{name:h.name,type:h.type})}),s.forEach(h=>{!lA(h.name)&&!i.has(h.name)&&i.set(h.name,{name:h.name,type:"view"})});const l=[];for(const h of i.values()){const m=h.name,p=h.type,g='"'.concat(m,'"'),T=!t.has(m)&&!lA(m)&&m!=="employees_sample";let y;if(p==="table")try{const b="SELECT COUNT(*) as count FROM ".concat(g),R=(yield e.query(b)).toArray()[0];y=typeof R.count=="bigint"?Number(R.count):R.count}catch(b){}else y=void 0;l.push({name:m,escapedName:g,isUserCreated:T,rowCount:y,type:p})}const c=l.filter(h=>h.isUserCreated),u=l.filter(h=>!h.isUserCreated);return c}catch(r){throw new Error("Failed to discover tables: ".concat(r instanceof Error?r.message:String(r)))}})}function Lie(e){const t=e.trim().toUpperCase(),n=[],r=[];let a=!1,s;const i=[{regex:/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?["`]([^"`]+)["`]\.["`]([^"`]+)["`]/gi,command:"CREATE TABLE",isMotherDuck:!0},{regex:/CREATE\s+VIEW\s+(?:IF\s+NOT\s+EXISTS\s+)?["`]([^"`]+)["`]\.["`]([^"`]+)["`]/gi,command:"CREATE VIEW",isMotherDuck:!0},{regex:/DROP\s+TABLE\s+(?:IF\s+EXISTS\s+)?["`]([^"`]+)["`]\.["`]([^"`]+)["`]/gi,command:"DROP TABLE",isMotherDuck:!0},{regex:/DROP\s+VIEW\s+(?:IF\s+EXISTS\s+)?["`]([^"`]+)["`]\.["`]([^"`]+)["`]/gi,command:"DROP VIEW",isMotherDuck:!0},{regex:/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(["`]?)(\w+)\1(?!\s*\.)/gi,command:"CREATE TABLE",isMotherDuck:!1},{regex:/CREATE\s+VIEW\s+(?:IF\s+NOT\s+EXISTS\s+)?(["`]?)(\w+)\1(?!\s*\.)/gi,command:"CREATE VIEW",isMotherDuck:!1},{regex:/DROP\s+TABLE\s+(?:IF\s+EXISTS\s+)?(["`]?)(\w+)\1(?!\s*\.)/gi,command:"DROP TABLE",isMotherDuck:!1},{regex:/DROP\s+VIEW\s+(?:IF\s+EXISTS\s+)?(["`]?)(\w+)\1(?!\s*\.)/gi,command:"DROP VIEW",isMotherDuck:!1}];let l=!1;for(const c of i){let u;const h=new RegExp(c.regex.source,c.regex.flags);for(;(u=h.exec(t))!==null;)l=!0,n.push(c.command),c.isMotherDuck&&(a=!0,u[1]&&!s&&(s=u[1])),u[2]&&r.push(u[2].toLowerCase())}return{isModifying:l,commands:[...new Set(n)],possibleTableNames:[...new Set(r)],isMotherDuck:a,database:s}}function Mie(e,t,n){return H(this,null,function*(){const r=n||'"'.concat(t,'"');try{let a;try{const s="DESCRIBE ".concat(r);a=yield e.query(s)}catch(s){const i="PRAGMA table_info(".concat(r,")");a=yield e.query(i)}return a.toArray().map(s=>({name:s.column_name||s.name||"",type:s.column_type||s.type||s.data_type||""}))}catch(a){return[]}})}const yF=e=>H(null,null,function*(){var i;const n=(yield e.text()).split("\n").slice(0,10),r=["	","|",";",","," "];let a=null,s=0;for(const l of r){const c=((i=n[0])==null?void 0:i.split(l).length)||0;c>s&&c>1&&(s=c,a=l)}return a&&s>1&&n.slice(0,5).every(c=>c.split(a).length===s||c.trim()==="")?{format:"delimited_direct",separator:a,hasHeader:!0,preview:n}:{format:"single_column",preview:n}});function xF(e,t,n,r=!1){return H(this,null,function*(){let a=!1,s="";const i=r?"read_csv":"read_csv_auto";try{r?s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n          header=true, \n          auto_detect=true,\n          strict_mode=false\n        )"):s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n          header=true, \n          auto_detect=true\n        )"),yield e.query(s),a=!0}catch(l){try{yield e.query("DROP TABLE IF EXISTS ".concat(t)),s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n          header=true, \n          auto_detect=true,\n          strict_mode=false,\n          sample_size=-1,\n          ignore_errors=true\n        )"),yield e.query(s),a=!0}catch(c){try{yield e.query("DROP TABLE IF EXISTS ".concat(t)),s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n            header=true, \n            all_varchar=true,\n            strict_mode=false,\n            ignore_errors=true\n          )"),yield e.query(s),a=!0}catch(u){try{yield e.query("DROP TABLE IF EXISTS ".concat(t)),s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n              header=true, \n              all_varchar=true,\n              strict_mode=false,\n              ignore_errors=true,\n              max_line_size=1048576,\n              normalize_names=true\n            )"),yield e.query(s),a=!0}catch(h){throw new Error("Failed to import CSV file. Last error: ".concat(h instanceof Error?h.message:String(h)))}}}}if(!a)throw new Error("Failed to import CSV file after trying multiple approaches")})}function Die(e,t,n){return H(this,null,function*(){let r=!1,a="";try{a="CREATE VIEW ".concat(t," AS SELECT * FROM read_csv('").concat(n,"', \n        header=true, \n        auto_detect=true,\n        strict_mode=false,\n        parallel=false\n      )"),yield e.query(a),r=!0}catch(s){try{a="CREATE VIEW ".concat(t," AS SELECT * FROM read_csv('").concat(n,"', \n          header=true, \n          all_varchar=true,\n          strict_mode=false,\n          ignore_errors=true,\n          sample_size=-1,\n          parallel=false\n        )"),yield e.query(a),r=!0}catch(i){throw new Error("Failed to create CSV view: ".concat(i instanceof Error?i.message:String(i)))}}if(!r)throw new Error("Failed to create CSV view after trying multiple approaches")})}const Pie=[[1,"John Doe","Engineering",75e3],[2,"Jane Smith","Marketing",65e3],[3,"Mike Johnson","Engineering",8e4],[4,"Sarah Wilson","HR",55e3],[5,"David Brown","Engineering",9e4],[6,"Emily Davis","Marketing",6e4],[7,"Chris Taylor","Sales",7e4],[8,"Lisa Anderson","Engineering",85e3],[9,"Tom Wilson","Sales",72e3],[10,"Amy Clark","HR",58e3],[11,"Kevin Martinez","Engineering",95e3],[12,"Rachel Garcia","Marketing",63e3],[13,"Mark Thompson","Sales",68e3],[14,"Jennifer Lee","Engineering",82e3],[15,"Robert White","HR",52e3]];function SF(e,t,n,r=!1){return H(this,null,function*(){let a=!1,s="";const i="read_json";try{s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n        auto_detect=true\n      )"),yield e.query(s),a=!0}catch(l){try{yield e.query("DROP TABLE IF EXISTS ".concat(t)),s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n          auto_detect=true,\n          sample_size=-1,\n          union_by_name=true,\n          ignore_errors=true\n        )"),yield e.query(s),a=!0}catch(c){try{yield e.query("DROP TABLE IF EXISTS ".concat(t)),s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n            format='newline_delimited',\n            ignore_errors=true,\n            sample_size=-1\n          )"),yield e.query(s),a=!0}catch(u){try{yield e.query("DROP TABLE IF EXISTS ".concat(t)),s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n              format='records',\n              maximum_depth=5,\n              ignore_errors=true,\n              sample_size=10000\n            )"),yield e.query(s),a=!0}catch(h){try{yield e.query("DROP TABLE IF EXISTS ".concat(t)),s="CREATE TABLE ".concat(t," AS SELECT * FROM ").concat(i,"('").concat(n,"', \n                format='auto',\n                ignore_errors=true,\n                maximum_depth=3,\n                sample_size=5000,\n                union_by_name=true\n              )"),yield e.query(s),a=!0}catch(m){throw new Error("Failed to import JSON file. The file may have mixed or complex structures. Last error: ".concat(m instanceof Error?m.message:String(m)))}}}}}if(!a)throw new Error("Failed to import JSON file after trying multiple approaches")})}function kie(e,t,n){return H(this,null,function*(){let r=!1,a="";try{a="CREATE VIEW ".concat(t," AS SELECT * FROM read_json('").concat(n,"', \n        auto_detect=true\n      )"),yield e.query(a),r=!0}catch(s){try{a="CREATE VIEW ".concat(t," AS SELECT * FROM read_json('").concat(n,"', \n          auto_detect=true,\n          ignore_errors=true,\n          union_by_name=true,\n          sample_size=-1,\n          maximum_depth=5\n        )"),yield e.query(a),r=!0}catch(i){try{a="CREATE VIEW ".concat(t," AS SELECT * FROM read_json('").concat(n,"', \n            format='newline_delimited',\n            ignore_errors=true,\n            sample_size=10000\n          )"),yield e.query(a),r=!0}catch(l){throw new Error("Failed to create JSON view: ".concat(l instanceof Error?l.message:String(l)))}}}if(!r)throw new Error("Failed to create JSON view after trying multiple approaches")})}const B1=e=>/^\s*(CREATE|DROP|ALTER)\s+/i.test(e)?!0:/\s+LIMIT\s+\d+/i.test(e),eY=(e,t,n)=>{if(/^\s*(CREATE|DROP|ALTER)\s+/i.test(e)||B1(e))return e.trim();const r=(t-1)*n;let a=e.trim();return a.endsWith(";")&&(a=a.slice(0,-1).trim()),"".concat(a," LIMIT ").concat(n," OFFSET ").concat(r)},jie=Object.freeze(Object.defineProperty({__proto__:null,addLimitIfMissing:eY,hasLimitClause:B1},Symbol.toStringTag,{value:"Module"})),Dt=Ki((e,t)=>({db:null,connection:null,isInitializing:!1,isInitialized:!1,error:null,registeredTables:new Map,hasSampleTable:!1,sampleTableName:"employees_sample",isLoading:!1,processingProgress:0,processingStatus:"",schemaCache:new Map,lastSchemaCacheUpdate:0,lastTableRefresh:0,motherDuckClient:null,motherDuckConnected:!1,motherDuckConnecting:!1,motherDuckError:null,motherDuckDatabases:[],selectedMotherDuckDatabase:null,motherDuckSchemas:new Map,postgresConnections:new Map,postgresActiveConnections:new Set,postgresVirtualTables:new Map,postgresError:null,postgresSchemas:new Map,postgresAutoImportThreshold:10*1024*1024,initialize:()=>H(null,null,function*(){if(t().isInitialized||t().isInitializing)return t().isInitialized;e({isInitializing:!0,error:null});try{const{db:n,conn:r}=yield bie();return e({db:n,connection:r,isInitialized:!0,isInitializing:!1}),yield t().createSampleTable(),!0}catch(n){return e({error:"Failed to initialize DuckDB: ".concat(n instanceof Error?n.message:String(n)),isInitializing:!1}),!1}}),createSampleTable:()=>H(null,null,function*(){const{connection:n,isInitialized:r,sampleTableName:a}=t();if(!n||!r)throw new Error("DuckDB is not initialized");try{const s='"'.concat(a,'"'),i="\n        CREATE TABLE ".concat(s," (\n          id INTEGER,\n          name VARCHAR,\n          department VARCHAR,\n          salary INTEGER\n        )\n      ");yield n.query(i);const l=Pie.map(h=>"(".concat(h[0],", '").concat(h[1],"', '").concat(h[2],"', ").concat(h[3],")")).join(", "),c="\n        INSERT INTO ".concat(s," (id, name, department, salary)\n        VALUES ").concat(l,"\n      ");yield n.query(c);const u=new Map(t().registeredTables);u.set(a,s),e({registeredTables:u,hasSampleTable:!0}),yield t().refreshSchemaCache()}catch(s){throw s}}),refreshSchemaCache:()=>H(null,null,function*(){const{connection:n,registeredTables:r}=t();if(n)try{const a=new Map,s=Array.from(r.entries());for(const[i,l]of s)try{const c="PRAGMA table_info(".concat(l,")"),h=(yield n.query(c)).toArray().map(m=>({name:m.name,type:m.type}));a.set(i,h)}catch(c){}e(i=>({schemaCache:new Map([...i.schemaCache,...a]),lastSchemaCacheUpdate:Date.now()}))}catch(a){}}),createTable:(n,r,a)=>H(null,null,function*(){const{connection:s,isInitialized:i}=t();if((!s||!i)&&(yield t().initialize(),!t().connection))throw new Error("DuckDB is not initialized");try{e({isLoading:!0,processingStatus:"Creating table structure..."});const l=b=>{switch(b){case Nt.Number:return"DOUBLE";case Nt.Boolean:return"BOOLEAN";case Nt.Date:return"VARCHAR";case Nt.Array:case Nt.Object:return"TEXT";default:return"VARCHAR"}},c=r.map((b,x)=>{const R=x<a.length?l(a[x]):"VARCHAR";return'"'.concat(b.replace(/"/g,'""'),'" ').concat(R)}).join(", "),u='"'.concat(n,'"'),h="DROP TABLE IF EXISTS ".concat(u);yield t().connection.query(h);const m="CREATE TABLE ".concat(u," (").concat(c,")");yield t().connection.query(m);const p=new Map(t().registeredTables);p.set(n,u),e({registeredTables:p});const g="SELECT name FROM sqlite_master WHERE type='table' AND name='".concat(n,"'");if((yield t().connection.query(g)).toArray().length===0)throw new Error('Table "'.concat(n,'" was not created successfully'));return e({isLoading:!1}),yield t().refreshSchemaCache(),u}catch(l){throw e({error:"Failed to create table: ".concat(l instanceof Error?l.message:String(l)),isLoading:!1}),l}}),insertData:(n,r,a)=>H(null,null,function*(){const{connection:s,isInitialized:i,registeredTables:l}=t();if(!s||!i)throw new Error("DuckDB is not initialized");const c=l.get(n)||'"'.concat(n,'"');try{e({isLoading:!0,processingStatus:"Inserting data into ".concat(n,"...")});const u="PRAGMA table_info(".concat(c,")"),m=(yield s.query(u)).toArray().map(y=>y.name),p=1e3,g=Math.ceil(r.length/p);let T=0;for(let y=0;y<r.length;y+=p){const b=Math.floor(y/p)+1,x=r.slice(y,y+p),R=x.map((A,w)=>{try{const _=A.map((N,I)=>{if(N==null||N==="")return"NULL";const D=Number(N);if(!isNaN(D)&&N.trim()!=="")return N;const M=N.toLowerCase();return M==="true"||M==="false"?M.toUpperCase():"'".concat(N.replace(/'/g,"''"),"'")});return"(".concat(_.join(", "),")")}catch(_){throw _}}).join(",\n");if(R.length>0){const A=m.map(_=>'"'.concat(_,'"')).join(", "),w="INSERT INTO ".concat(c," (").concat(A,") VALUES ").concat(R);try{if(yield s.query(w),T+=x.length,b%10,a){const _=Math.min((y+x.length)/r.length,1);a(_),e({processingProgress:_})}yield new Promise(_=>{requestAnimationFrame(_)})}catch(_){throw _}}}try{const y="SELECT COUNT(*) as count FROM ".concat(c),x=(yield s.query(y)).toArray()[0].count;r.length}catch(y){}return e({isLoading:!1,processingProgress:0,processingStatus:""}),yield t().refreshSchemaCache(),!0}catch(u){throw e({error:"Failed to insert data: ".concat(u instanceof Error?u.message:String(u)),isLoading:!1,processingProgress:0,processingStatus:""}),u}}),loadData:(n,r,a,s,i)=>H(null,null,function*(){try{t().isInitialized||(yield t().initialize());const l=a?"".concat(a.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_")):"imported_data";return yield t().createTable(l,r,s),yield t().insertData(l,n,i),l}catch(l){throw l}}),registerTableManually:(n,r,a)=>H(null,null,function*(){const s=new Map(t().registeredTables);s.set(n,r),e(q({registeredTables:s,lastTableRefresh:Date.now()},a))}),executeQuery:n=>H(null,null,function*(){var i,l;const{connection:r,isInitialized:a,registeredTables:s}=t();if((!r||!a)&&(yield t().initialize(),!t().connection))return e({error:"DuckDB is not initialized"}),null;try{e({isLoading:!0,error:null});const c=/"([^"]+)"\."([^"]+)"/g,u=[...n.matchAll(c)];if(u.length>0){const{postgresVirtualTables:p,postgresActiveConnections:g}=t();let T=null;for(const[y,b]of u){for(const[x,R]of p)if(R.schemaName===y&&R.tableName===b){T=R.connectionId;break}if(T)break}if(T&&g.has(T))try{const{postgreSQLService:y}=yield fn(()=>H(null,null,function*(){const{postgreSQLService:x}=yield Promise.resolve().then(()=>Am);return{postgreSQLService:x}}),void 0),b=yield y.executeQuery(T,{sql:n,timeout:3e4});if(e({isLoading:!1}),b.success&&b.data){const x=((i=b.columns)==null?void 0:i.map(w=>w.name))||[],R=b.data||[];return{toArray:()=>R,columns:x,columnNames:x,numCols:x.length,numRows:R.length}}else throw new Error(((l=b.error)==null?void 0:l.message)||"PostgreSQL query execution failed")}catch(y){return e({error:"PostgreSQL query error: ".concat(y instanceof Error?y.message:String(y)),isLoading:!1}),null}}let h=n;try{const T=(yield t().connection.query("SELECT name FROM sqlite_master WHERE type='table'")).toArray(),y=Array.from(s.keys());for(const b of y){const x=new RegExp("\\b".concat(b,'\\b(?=(?:[^"]*"[^"]*")*[^"]*$)'),"g"),R=s.get(b)||'"'.concat(b,'"');h=h.replace(x,R)}}catch(p){}const m=yield r.query(h);return e({isLoading:!1}),m}catch(c){return e({error:"Query execution error: ".concat(c instanceof Error?c.message:String(c)),isLoading:!1}),null}}),getAvailableTables:()=>Array.from(t().registeredTables.keys()),getObjectType:n=>H(null,null,function*(){const{connection:r,isInitialized:a}=t();return!r||!a?null:yield Iie(r,n)}),getTableSchema:n=>H(null,null,function*(){const{connection:r,isInitialized:a,registeredTables:s,schemaCache:i,postgresVirtualTables:l}=t();if(!r||!a)return null;if(i.has(n))return i.get(n);try{let c=!1,u=null;if(n.includes(".")){for(const[m,p]of l)if("".concat(p.schemaName,".").concat(p.tableName)===n){c=!0,u=p;break}}let h;if(c&&u)h=u.columns||[];else{const m=s.get(n)||'"'.concat(n,'"'),p="PRAGMA table_info(".concat(m,")");h=(yield r.query(p)).toArray().map(T=>({name:T.name,type:T.type}))}return e(m=>({schemaCache:new Map(m.schemaCache).set(n,h)})),h}catch(c){return null}}),resetError:()=>e({error:null}),cleanupDB:()=>H(null,null,function*(){const{db:n,connection:r}=t();r&&(yield r.close()),n&&(yield n.terminate()),Aie(),e({db:null,connection:null,isInitialized:!1,registeredTables:new Map,hasSampleTable:!1,schemaCache:new Map,lastSchemaCacheUpdate:0})}),dropTable:n=>H(null,null,function*(){const{connection:r}=t();if(!r)return!1;try{const a=n.replace(/[^a-zA-Z0-9_]/g,"_"),s='DROP TABLE IF EXISTS "'.concat(a,'"');yield r.query(s);const i=new Map(t().registeredTables);for(const[l,c]of i)if(c===a||c==='"'.concat(a,'"')){i.delete(l);break}return e({registeredTables:i,lastSchemaCacheUpdate:0}),!0}catch(a){return e({error:"Failed to drop table: ".concat(a)}),!1}}),dropView:n=>H(null,null,function*(){const{connection:r}=t();if(!r)return!1;try{const a=n.replace(/[^a-zA-Z0-9_]/g,"_"),s='DROP VIEW IF EXISTS "'.concat(a,'"');yield r.query(s);const i=new Map(t().registeredTables);for(const[l,c]of i)if(c===a||c==='"'.concat(a,'"')){i.delete(l);break}return e({registeredTables:i,lastSchemaCacheUpdate:0}),!0}catch(a){return e({error:"Failed to drop view: ".concat(a)}),!1}}),dropTableOrView:n=>H(null,null,function*(){const{connection:r}=t();if(!r)return!1;try{const a=n.replace(/[^a-zA-Z0-9_]/g,"_"),s=yield t().getObjectType(a);if(s==="table")return yield t().dropTable(a);if(s==="view")return yield t().dropView(a);{const i=yield t().dropTable(a),l=yield t().dropView(a);return i||l}}catch(a){return e({error:"Failed to drop table/view: ".concat(a)}),!1}}),importFileDirectlyStreaming:(n,r,a)=>H(null,null,function*(){var u;const{connection:s,isInitialized:i}=t();if((!s||!i)&&(yield t().initialize(),!t().connection||!t().db))throw new Error("DuckDB is not initialized");const l=(u=r.split(".").pop())==null?void 0:u.toLowerCase(),c=a/(1024*1024);try{e({isLoading:!0,error:null,processingStatus:"Preparing to import file...",processingProgress:.1});const h=yield n.getFile();if(e({processingStatus:"Analyzing file for optimal import strategy...",processingProgress:.2}),l==="duckdb"||l==="db"){e({processingStatus:"Attaching DuckDB database file..."});let y=r.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_");const b=Array.from(t().registeredTables.keys());new Set(b.filter(A=>A.includes(".")).map(A=>A.split(".")[0])).has(y)&&(y="".concat(y,"_").concat(Date.now()));const R=yield t().db.connect();try{const A="attach_".concat(Date.now(),".").concat(l);yield t().db.registerFileHandle(A,h,wi.BROWSER_FILEREADER,!0),e({processingStatus:"Attaching database as '".concat(y,"'..."),processingProgress:.4});try{yield R.query("DETACH ".concat(y))}catch(O){}const w="ATTACH '".concat(A,"' AS ").concat(y," (READ_ONLY)");yield R.query(w),e({processingStatus:"Discovering tables in attached database...",processingProgress:.6});const _="\n            SELECT table_name \n            FROM information_schema.tables \n            WHERE table_catalog = '".concat(y,"'\n            AND table_type = 'BASE TABLE'\n          "),I=(yield R.query(_)).toArray(),D=new Map(t().registeredTables),M=r.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_");for(const O of I){const L=O.table_name,k="".concat(y,".").concat(L);if(D.set(k,'"'.concat(y,'"."').concat(L,'"')),y!==M){const F="".concat(M,".").concat(L);D.set(F,'"'.concat(y,'"."').concat(L,'"'))}}return yield R.close(),e({registeredTables:D,isLoading:!1,processingStatus:"Attached database: ".concat(I.length," table(s) available"),processingProgress:1}),yield t().refreshSchemaCache(),{tableName:y,rowCount:I.length,isDatabaseFile:!0,attachedTables:I.map(O=>O.table_name),fileSizeMB:c}}catch(A){throw yield R.close(),A}}if(l==="txt"){e({processingStatus:"Analyzing TXT file structure..."});const T=yield yF(h);if(T.format==="delimited_direct"&&T.separator){const I={",":"comma","	":"tab","|":"pipe",";":"semicolon"," ":"space"}[T.separator]||"custom";e({processingStatus:"TXT file is ".concat(I,"-delimited, importing directly...")});const M=r.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_"),O='"'.concat(M,'"');yield t().dropTableOrView(M);const L=yield t().db.connect();try{const k="import_".concat(Date.now(),".csv");yield t().db.registerFileHandle(k,h,wi.BROWSER_FILEREADER,!1),e({processingStatus:"Creating table from ".concat(I,"-delimited TXT...")});let F=!1;try{const X="CREATE TABLE ".concat(O," AS SELECT * FROM read_csv('").concat(k,"', \n                header=true, \n                delim='").concat(T.separator,"',\n                quote='\"',\n                escape='\"',\n                strict_mode=false,\n                auto_detect=true,\n                parallel=false\n              )");yield L.query(X),F=!0}catch(X){try{yield t().connection.query("DROP TABLE IF EXISTS ".concat(O));const Z="CREATE TABLE ".concat(O," AS SELECT * FROM read_csv('").concat(k,"', \n                  header=true, \n                  delim='").concat(T.separator,"',\n                  strict_mode=false,\n                  ignore_errors=true,\n                  auto_detect=true,\n                  parallel=false\n                )");yield L.query(Z),F=!0}catch(Z){try{yield t().connection.query("DROP TABLE IF EXISTS ".concat(O));const V="CREATE TABLE ".concat(O," AS SELECT * FROM read_csv('").concat(k,"', \n                    header=true, \n                    delim='").concat(T.separator,"',\n                    strict_mode=false,\n                    ignore_errors=true,\n                    all_varchar=true,\n                    parallel=false\n                  )");yield L.query(V),F=!0}catch(V){throw new Error("Failed to import ".concat(I,"-delimited TXT file: ").concat(V instanceof Error?V.message:String(V)))}}}if(!F)throw new Error("Failed to import ".concat(I,"-delimited TXT file"));yield L.close();const U="SELECT COUNT(*) as count FROM ".concat(O),j=(yield t().connection.query(U)).toArray()[0].count,G="PRAGMA table_info(".concat(O,")"),J=(yield t().connection.query(G)).toArray(),$=new Map(t().registeredTables);return $.set(M,O),e({registeredTables:$,isLoading:!1,processingStatus:"TXT imported: ".concat((c||a).toFixed(2),"MB table with ").concat(j," rows, ").concat(J.length," columns (").concat(I,"-delimited)"),processingProgress:1}),yield t().refreshSchemaCache(),{tableName:M,rowCount:j,columnCount:J.length,isView:!1,convertedToCsv:!1,fileSizeMB:c||a,instantImport:!1,txtFormat:"delimited_direct",delimiter:T.separator,delimiterName:I}}catch(k){throw yield L.close(),k}}e({processingStatus:"Converting single-column TXT to CSV..."});const x="line_content\n"+(yield h.text()).split("\n").filter(I=>I.trim()!=="").map(I=>{const D=I.trim().replace(/"/g,'""');return D.includes(",")?'"'.concat(D,'"'):D}).join("\n"),R=r.replace(/\.[^/.]+$/,""),A=new File([x],"".concat(R,"_converted.csv"),{type:"text/csv"}),w=R.replace(/[^a-zA-Z0-9_]/g,"_"),_='"'.concat(w,'"');yield t().dropTableOrView(w);const N=yield t().db.connect();try{const I="import_".concat(Date.now(),".csv");yield t().db.registerFileHandle(I,A,wi.BROWSER_FILEREADER,!1),e({processingStatus:"Creating table from single-column TXT..."});const D="CREATE TABLE ".concat(_," AS SELECT * FROM read_csv('").concat(I,"', header=true, auto_detect=true)");yield N.query(D),yield N.close();const M="SELECT COUNT(*) as count FROM ".concat(_),L=(yield t().connection.query(M)).toArray()[0].count,k=new Map(t().registeredTables);return k.set(w,_),e({registeredTables:k,isLoading:!1,processingStatus:"TXT converted: ".concat((c||a).toFixed(2),"MB table with ").concat(L," rows (single-column)"),processingProgress:1}),yield t().refreshSchemaCache(),{tableName:w,rowCount:L,isView:!1,convertedToCsv:!0,fileSizeMB:c||a,instantImport:!1,txtFormat:"single_column"}}catch(I){throw yield N.close(),I}}if(l==="xlsx"||l==="xls"){if(c>100)throw new Error("Excel files over 100MB are not supported due to browser memory limitations. Current file: ".concat(c.toFixed(2),"MB. Please convert to CSV or Parquet format."));e({processingStatus:"Converting Excel file to CSV..."});const y=yield fn(()=>import("./xlsx-CBGSz583.js"),[]),b=yield h.arrayBuffer(),x=y.read(new Uint8Array(b),{type:"array"}),R=x.SheetNames[0],A=x.Sheets[R],w=y.utils.sheet_to_csv(A),_=r.replace(/\.[^/.]+$/,""),N=new File([w],"".concat(_,"_converted.csv"),{type:"text/csv"}),I=_.replace(/[^a-zA-Z0-9_]/g,"_"),D='"'.concat(I,'"');yield t().dropTableOrView(I);const M=yield t().db.connect();try{const O="import_".concat(Date.now(),".csv");yield t().db.registerFileHandle(O,N,wi.BROWSER_FILEREADER,!1),e({processingStatus:"Creating table from converted Excel data..."});const L="CREATE TABLE ".concat(D," AS SELECT * FROM read_csv('").concat(O,"', strict_mode=false)");yield M.query(L),yield M.close();const k="SELECT COUNT(*) as count FROM ".concat(D),U=(yield t().connection.query(k)).toArray()[0].count,B=new Map(t().registeredTables);return B.set(I,D),e({registeredTables:B,isLoading:!1,processingStatus:"Excel converted: ".concat(c.toFixed(2),"MB table with ").concat(U," rows"),processingProgress:1}),yield t().refreshSchemaCache(),{tableName:I,rowCount:U,isView:!1,convertedToCsv:!0,fileSizeMB:c,instantImport:!1}}catch(O){throw yield M.close(),O}}const m=r.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_"),p='"'.concat(m,'"');try{const T=yield t().getObjectType(m);T==="table"?yield t().connection.query("DROP TABLE IF EXISTS ".concat(p)):T==="view"&&(yield t().connection.query("DROP VIEW IF EXISTS ".concat(p)))}catch(T){try{yield t().connection.query("DROP TABLE IF EXISTS ".concat(p))}catch(y){try{yield t().connection.query("DROP VIEW IF EXISTS ".concat(p))}catch(b){}}}e({processingProgress:.3});const g=yield t().db.connect();try{const T="hybrid_".concat(Date.now(),".").concat(l);yield t().db.registerFileHandle(T,h,wi.BROWSER_FILEREADER,!0),e({processingProgress:.5});const y=c<=500;let b="";const x=y?"TABLE":"VIEW";if(l==="csv")y?(e({processingStatus:"Creating CSV table (".concat(c.toFixed(2),"MB)...")}),yield xF(g,p,T,!0)):(e({processingStatus:"Creating instant CSV view (".concat(c.toFixed(2),"MB)...")}),yield Die(g,p,T));else if(l==="json")y?(e({processingStatus:"Creating JSON table (".concat(c.toFixed(2),"MB)...")}),yield SF(g,p,T,!0)):(e({processingStatus:"Creating instant JSON view (".concat(c.toFixed(2),"MB)...")}),yield kie(g,p,T));else if(l==="parquet")y?(e({processingStatus:"Creating Parquet table (".concat(c.toFixed(2),"MB)...")}),b="CREATE TABLE ".concat(p," AS SELECT * FROM read_parquet('").concat(T,"')")):(e({processingStatus:"Creating instant Parquet view (".concat(c.toFixed(2),"MB)...")}),b="CREATE VIEW ".concat(p," AS SELECT * FROM read_parquet('").concat(T,"')"));else throw new Error("Unsupported file type: ".concat(l));e({processingProgress:.7}),yield g.query(b),e({processingProgress:.85}),yield g.close();let R=null,A="";if(y){e({processingStatus:"Verifying table and counting rows..."});try{const _="SELECT COUNT(*) as count FROM ".concat(p);R=(yield t().connection.query(_)).toArray()[0].count,A="Table created: ".concat(c.toFixed(2),"MB ").concat(l.toUpperCase()," with ").concat(R," rows")}catch(_){throw new Error("Error verifying table. The table may be empty or corrupted.")}}else A="View created: ".concat(c.toFixed(2),"MB ").concat(l.toUpperCase()," file ready to query");e({processingProgress:.95});const w=new Map(t().registeredTables);return w.set(m,p),e({registeredTables:w,isLoading:!1,processingStatus:A,processingProgress:1}),yield t().refreshSchemaCache(),{tableName:m,rowCount:R,isView:!y,fileSizeMB:c,fileType:l,instantImport:!y}}catch(T){throw g&&(yield g.close()),T}}catch(h){let m=h instanceof Error?h.message:String(h);if(h instanceof Error){const p=h.message.toLowerCase();p.includes("call stack")||p.includes("maximum call stack")?m="File structure too complex for ".concat(c.toFixed(2),"MB file. Try converting to Parquet format or simplifying the file structure."):p.includes("memory")||p.includes("out of bounds")?c<=500?m="Memory limit exceeded with ".concat(c.toFixed(2),"MB file during table creation. Try using a device with more RAM or the file may be too complex for table import."):m="Memory limit exceeded with ".concat(c.toFixed(2),"MB file. Try using a device with more RAM or converting to Parquet format."):p.includes("worker")||p.includes("terminate")?m="Browser crashed processing ".concat(c.toFixed(2),"MB file. File may be corrupted or too complex for browser processing."):(p.includes("unsupported")||p.includes("format"))&&(m="File format not supported or file may be corrupted. Supported formats: CSV, JSON, Parquet, Excel (.xlsx/.xls), TXT, DuckDB (.duckdb/.db).")}throw e({error:"Import failed: ".concat(m),isLoading:!1,processingProgress:0,processingStatus:"Import failed"}),h}}),importFileDirectly:n=>H(null,null,function*(){var s;const{connection:r,isInitialized:a}=t();if((!r||!a)&&(yield t().initialize(),!t().connection||!t().db))throw new Error("DuckDB is not initialized");try{e({isLoading:!0,error:null,processingStatus:"Preparing to import file...",processingProgress:.1});const i=n.name,l=(s=n.name.split(".").pop())==null?void 0:s.toLowerCase(),c=n.size/(1024*1024);if(l==="duckdb"||l==="db"){e({processingStatus:"Attaching DuckDB database file..."});let g=i.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_");const T=Array.from(t().registeredTables.keys());new Set(T.filter(x=>x.includes(".")).map(x=>x.split(".")[0])).has(g)&&(g="".concat(g,"_").concat(Date.now()));const b=yield t().db.connect();try{const x="attach_".concat(Date.now(),".").concat(l);yield t().db.registerFileHandle(x,n,wi.BROWSER_FILEREADER,!0),e({processingStatus:"Attaching database as '".concat(g,"'..."),processingProgress:.4});try{yield b.query("DETACH ".concat(g))}catch(D){}const R="ATTACH '".concat(x,"' AS ").concat(g," (READ_ONLY)");yield b.query(R),e({processingStatus:"Discovering tables in attached database...",processingProgress:.6});const A="\n            SELECT table_name \n            FROM information_schema.tables \n            WHERE table_catalog = '".concat(g,"'\n            AND table_type = 'BASE TABLE'\n          "),_=(yield b.query(A)).toArray(),N=new Map(t().registeredTables),I=i.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_");for(const D of _){const M=D.table_name,O="".concat(g,".").concat(M);if(N.set(O,'"'.concat(g,'"."').concat(M,'"')),g!==I){const L="".concat(I,".").concat(M);N.set(L,'"'.concat(g,'"."').concat(M,'"'))}}return yield b.close(),e({registeredTables:N,isLoading:!1,processingStatus:"Attached database: ".concat(_.length," table(s) available"),processingProgress:1}),yield t().refreshSchemaCache(),{tableName:g,rowCount:_.length,isDatabaseFile:!0,attachedTables:_.map(D=>D.table_name),fileSizeMB:c}}catch(x){throw yield b.close(),x}}if(l==="txt"){e({processingStatus:"Analyzing TXT file structure..."});const p=yield yF(n);if(p.format==="delimited_direct"&&p.separator){const _={",":"comma","	":"tab","|":"pipe",";":"semicolon"," ":"space"}[p.separator]||"custom";e({processingStatus:"TXT file is ".concat(_,"-delimited, importing directly...")});const I=i.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_"),D='"'.concat(I,'"');yield t().dropTableOrView(I);const M=yield t().db.connect();try{const O="import_".concat(Date.now(),".csv");yield t().db.registerFileHandle(O,n,wi.BROWSER_FILEREADER,!1),e({processingStatus:"Creating table from ".concat(_,"-delimited TXT...")});let L=!1;try{const J="CREATE TABLE ".concat(D," AS SELECT * FROM read_csv('").concat(O,"', \n                header=true, \n                delim='").concat(p.separator,"',\n                quote='\"',\n                escape='\"',\n                strict_mode=false,\n                auto_detect=true,\n                parallel=false\n              )");yield M.query(J),L=!0}catch(J){try{yield t().connection.query("DROP TABLE IF EXISTS ".concat(D));const $="CREATE TABLE ".concat(D," AS SELECT * FROM read_csv('").concat(O,"', \n                  header=true, \n                  delim='").concat(p.separator,"',\n                  strict_mode=false,\n                  ignore_errors=true,\n                  auto_detect=true,\n                  parallel=false\n                )");yield M.query($),L=!0}catch($){try{yield t().connection.query("DROP TABLE IF EXISTS ".concat(D));const X="CREATE TABLE ".concat(D," AS SELECT * FROM read_csv('").concat(O,"', \n                    header=true, \n                    delim='").concat(p.separator,"',\n                    strict_mode=false,\n                    ignore_errors=true,\n                    all_varchar=true,\n                    parallel=false\n                  )");yield M.query(X),L=!0}catch(X){throw new Error("Failed to import ".concat(_,"-delimited TXT file: ").concat(X instanceof Error?X.message:String(X)))}}}if(!L)throw new Error("Failed to import ".concat(_,"-delimited TXT file"));yield M.close();const k="SELECT COUNT(*) as count FROM ".concat(D),U=(yield t().connection.query(k)).toArray()[0].count,B="PRAGMA table_info(".concat(D,")"),G=(yield t().connection.query(B)).toArray(),K=new Map(t().registeredTables);return K.set(I,D),e({registeredTables:K,isLoading:!1,processingStatus:"TXT imported: ".concat((c||c).toFixed(2),"MB table with ").concat(U," rows, ").concat(G.length," columns (").concat(_,"-delimited)"),processingProgress:1}),yield t().refreshSchemaCache(),{tableName:I,rowCount:U,columnCount:G.length,isView:!1,convertedToCsv:!1,fileSizeMB:c,instantImport:!1,txtFormat:"delimited_direct",delimiter:p.separator,delimiterName:_}}catch(O){throw yield M.close(),O}}e({processingStatus:"Converting single-column TXT to CSV..."});const y="line_content\n"+(yield n.text()).split("\n").filter(_=>_.trim()!=="").map(_=>{const N=_.trim().replace(/"/g,'""');return N.includes(",")?'"'.concat(N,'"'):N}).join("\n"),b=i.replace(/\.[^/.]+$/,""),x=new File([y],"".concat(b,"_converted.csv"),{type:"text/csv"}),R=b.replace(/[^a-zA-Z0-9_]/g,"_"),A='"'.concat(R,'"');yield t().dropTableOrView(R);const w=yield t().db.connect();try{const _="import_".concat(Date.now(),".csv");yield t().db.registerFileHandle(_,x,wi.BROWSER_FILEREADER,!1),e({processingStatus:"Creating table from single-column TXT..."});const N="CREATE TABLE ".concat(A," AS SELECT * FROM read_csv('").concat(_,"', header=true, auto_detect=true)");yield w.query(N),yield w.close();const I="SELECT COUNT(*) as count FROM ".concat(A),M=(yield t().connection.query(I)).toArray()[0].count,O=new Map(t().registeredTables);return O.set(R,A),e({registeredTables:O,isLoading:!1,processingStatus:"TXT converted: ".concat(c.toFixed(2),"MB table with ").concat(M," rows (single-column)"),processingProgress:1}),yield t().refreshSchemaCache(),{tableName:R,rowCount:M,isView:!1,convertedToCsv:!0,fileSizeMB:c,instantImport:!1,txtFormat:"single_column"}}catch(_){throw yield w.close(),_}}if(l==="xlsx"||l==="xls")try{e({processingStatus:"Converting Excel file to CSV format...",processingProgress:.15});const p=yield fn(()=>import("./xlsx-CBGSz583.js"),[]),g=yield n.arrayBuffer(),T=new Uint8Array(g);e({processingProgress:.3});const y=p.read(T,{type:"array"}),b=y.SheetNames[0],x=y.Sheets[b];e({processingStatus:'Converting Excel sheet "'.concat(b,'" to CSV...'),processingProgress:.5});const R=p.utils.sheet_to_csv(x),A=n.name.replace(/\.[^/.]+$/,""),w="".concat(A,"_converted.csv"),_=new Blob([R],{type:"text/csv"}),N=new File([_],w,{type:"text/csv"});e({processingStatus:"Importing converted CSV data...",processingProgress:.6});const I=A.replace(/[^a-zA-Z0-9_]/g,"_"),D='"'.concat(I,'"'),M="DROP TABLE IF EXISTS ".concat(D);yield t().connection.query(M);const O=yield t().db.connect();try{const L="import_".concat(Date.now(),".csv");yield t().db.registerFileHandle(L,N,wi.BROWSER_FILEREADER,!1),e({processingProgress:.7});const k="\n              CREATE TABLE ".concat(D," AS \n              SELECT * FROM read_csv_auto('").concat(L,"', header=true, auto_detect=true)\n            ");yield O.query(k),yield O.close();const F="SELECT COUNT(*) as count FROM ".concat(D),B=(yield t().connection.query(F)).toArray()[0].count,j=new Map(t().registeredTables);return j.set(I,D),e({registeredTables:j,isLoading:!1,processingStatus:"Import complete (converted from Excel to CSV)",processingProgress:1}),yield t().refreshSchemaCache(),{tableName:I,rowCount:B,originalFormat:l,convertedToCsv:!0}}catch(L){throw yield O.close(),L}}catch(p){throw new Error("Excel conversion failed: ".concat(p instanceof Error?p.message:String(p)))}const u=n.name.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_"),h='"'.concat(u,'"');yield t().dropTableOrView(u),e({processingProgress:.2});const m=yield t().db.connect();try{const p="import_".concat(Date.now(),".").concat(l);if(yield t().db.registerFileHandle(p,n,wi.BROWSER_FILEREADER,!0),e({processingProgress:.4}),l==="csv")e({processingStatus:"Importing CSV file..."}),yield xF(m,h,p,!1);else if(l==="json")e({processingStatus:"Importing JSON file..."}),yield SF(m,h,p,!1);else if(l==="parquet"){e({processingStatus:"Importing Parquet file..."});const g="\n            CREATE TABLE ".concat(h," AS \n            SELECT * FROM read_parquet('").concat(p,"')\n          ");yield m.query(g)}else throw new Error("Unsupported file type: ".concat(l));e({processingProgress:.9}),yield m.close();try{const g="SELECT COUNT(*) as count FROM ".concat(h),y=(yield t().connection.query(g)).toArray()[0].count,b=new Map(t().registeredTables);return b.set(u,h),e({registeredTables:b,isLoading:!1,processingStatus:"Import complete",processingProgress:1}),yield t().refreshSchemaCache(),{tableName:u,rowCount:y}}catch(g){throw new Error("Error verifying import. The table may be empty or corrupted.")}}catch(p){throw m&&(yield m.close()),p}}catch(i){let l="Import failed: ".concat(i instanceof Error?i.message:String(i));if(i instanceof Error){const c=i.message.toLowerCase();c.includes("memory")||c.includes("out of bounds")?l="Import failed: The file is too large for browser memory limits. Try a smaller file or convert Excel to CSV format.":c.includes("function")||c.includes("signature")?l="Import failed: This operation is not supported in the browser version of DuckDB. Try a different approach or convert to CSV.":(c.includes("xlsx")||c.includes("excel"))&&(l="Excel import failed: Excel files are challenging to process in browsers. For best results, convert to CSV format.")}throw e({error:l,isLoading:!1,processingProgress:0,processingStatus:"Import failed"}),i}}),executePaginatedQuery:(n,r,a,s=!0,i=!0)=>H(null,null,function*(){var p,g;const{connection:l,isInitialized:c,registeredTables:u,motherDuckConnected:h,motherDuckClient:m}=t();if((!l||!c)&&(yield t().initialize(),!t().connection))return e({error:"DuckDB is not initialized"}),null;try{e({isLoading:!0,error:null});const{postgresVirtualTables:T,postgresActiveConnections:y}=t(),{analyzeQuery:b}=yield fn(()=>H(null,null,function*(){const{analyzeQuery:w}=yield import("./queryRouter-CVdRPOTz.js");return{analyzeQuery:w}}),[]),x=b(n,T,y,new Set);if(x.target==="postgresql"&&x.connectionId)try{const{postgreSQLService:w}=yield fn(()=>H(null,null,function*(){const{postgreSQLService:I}=yield Promise.resolve().then(()=>Am);return{postgreSQLService:I}}),void 0);let _=n;if(s){const{addLimitIfMissing:I}=yield fn(()=>H(null,null,function*(){const{addLimitIfMissing:D}=yield Promise.resolve().then(()=>jie);return{addLimitIfMissing:D}}),void 0);_=I(n,r,a)}const N=yield w.executeQuery(x.connectionId,{sql:_,timeout:3e4});if(e({isLoading:!1}),N.success&&N.data){const I=((p=N.columns)==null?void 0:p.map(O=>O.name))||[],D=N.data||[];return{data:D,columns:I,totalRows:i?D.length:-1,page:r,pageSize:a,totalPages:i?Math.ceil(D.length/a):-1}}else throw new Error(((g=N.error)==null?void 0:g.message)||"PostgreSQL query execution failed")}catch(w){throw e({error:"PostgreSQL query error: ".concat(w instanceof Error?w.message:String(w)),isLoading:!1}),w}else if(x.target==="hybrid")throw e({isLoading:!1}),new Error("Cross-database query not supported yet!\n\n".concat(x.reasoning));const R=t().transformQueryForExecution(n),A=t().isMotherDuckQuery(R);if(A.isHybrid)throw e({isLoading:!1}),new Error("Cross-database query detected!\n\nThis query references both local and MotherDuck tables:\n• Local: ".concat(A.localTables.join(", "),"\n• MotherDuck: ").concat(A.motherDuckTables.map(w=>"".concat(w.database,".").concat(w.name)).join(", "),"\n\nDataKit will support cross database queries in future.\nPlease run separate queries for each database."));if(A.isMotherDuck&&h&&m){if(/^\s*(CREATE|DROP|ALTER)\s+/i.test(R)){const N=Date.now(),I=yield t().executeMotherDuckQuery(R,A.targetDatabase),D=Date.now()-N;return e({isLoading:!1}),A.targetDatabase&&setTimeout(()=>{t().refreshMotherDuckSchemas(A.targetDatabase)},500),{data:[],columns:[],totalRows:0,totalPages:1,currentPage:1,pageSize:a,queryTime:D}}if(B1(R)){const N=Date.now(),I=yield t().executeMotherDuckQuery(R,A.targetDatabase),D=Date.now()-N,M=I&&I.length>0?Object.keys(I[0]):[];return e({isLoading:!1}),{data:Array.isArray(I)?I:[],columns:M,totalRows:I.length,totalPages:1,currentPage:1,pageSize:I.length,queryTime:D}}else{const N=eY(R,r,a),I=Date.now(),D=yield t().executeMotherDuckQuery(N,A.targetDatabase),M=Date.now()-I;let O=D?D.length:0;try{let k=n.trim();k.endsWith(";")&&(k=k.slice(0,-1).trim());const F=k.replace(/SELECT\s+.*?\s+FROM/i,"SELECT COUNT(*) as total FROM"),U=yield t().executeMotherDuckQuery(F,A.targetDatabase);if(U&&U[0]){const B=U[0].total;O=typeof B=="bigint"?Number(B):B||D.length}}catch(k){O=D.length}const L=D&&D.length>0?Object.keys(D[0]):[];return e({isLoading:!1}),{data:Array.isArray(D)?D:[],columns:L,totalRows:O,totalPages:Math.ceil(O/a),currentPage:r,pageSize:a,queryTime:M}}}else{if(A.motherDuckTables.length>0&&!h)throw e({isLoading:!1}),new Error("This query references MotherDuck tables but you're not connected:\n".concat(A.motherDuckTables.map(w=>"• ".concat(w.database,".").concat(w.name)).join("\n"),"\n\nPlease connect to MotherDuck first."));{const w=yield Cie({sql:R,page:r,pageSize:a,applyPagination:s,countTotalRows:i},l,u);if(r===1)try{yield t().autoDetectTableChanges(n)}catch(_){}return e({isLoading:!1}),w}}}catch(T){throw e({error:"Query execution error: ".concat(T instanceof Error?T.message:String(T)),isLoading:!1}),T}}),extractTableReferences:n=>{const r=[];return[/(?:FROM|JOIN)\s+(?:"([^"]+)"\.)?(?:"([^"]+)"|([a-zA-Z_][a-zA-Z0-9_]*))(?:\s+(?:AS\s+)?(?:[a-zA-Z_][a-zA-Z0-9_]*))?/gi,/INSERT\s+INTO\s+(?:"([^"]+)"\.)?(?:"([^"]+)"|([a-zA-Z_][a-zA-Z0-9_]*))(?:\s+(?:AS\s+)?(?:[a-zA-Z_][a-zA-Z0-9_]*))?/gi,/UPDATE\s+(?:"([^"]+)"\.)?(?:"([^"]+)"|([a-zA-Z_][a-zA-Z0-9_]*))(?:\s+(?:AS\s+)?(?:[a-zA-Z_][a-zA-Z0-9_]*))?/gi,/CREATE\s+(?:TABLE|VIEW)\s+(?:IF\s+NOT\s+EXISTS\s+)?(?:"([^"]+)"\.)?(?:"([^"]+)"|([a-zA-Z_][a-zA-Z0-9_]*))/gi,/DROP\s+(?:TABLE|VIEW)\s+(?:IF\s+EXISTS\s+)?(?:"([^"]+)"\.)?(?:"([^"]+)"|([a-zA-Z_][a-zA-Z0-9_]*))/gi,/ALTER\s+TABLE\s+(?:"([^"]+)"\.)?(?:"([^"]+)"|([a-zA-Z_][a-zA-Z0-9_]*))/gi].forEach(i=>{let l;for(;(l=i.exec(n))!==null;){const[,c,u,h]=l,m=u||h;if(m)if(!c&&m.includes(".")){const[p,...g]=m.split("."),T=g.join(".");if(g.length===1&&p&&T){const y=t(),b=new Set;y.registeredTables.forEach((x,R)=>{if(R.includes(".")){const[A]=R.split(".");b.add(A)}}),b.has(p)?r.push({name:T,database:p}):r.push({name:m,database:c||void 0})}else r.push({name:m,database:c||void 0})}else r.push({name:m,database:c||void 0})}}),r.filter((i,l,c)=>l===c.findIndex(u=>u.name===i.name&&u.database===i.database))},transformQueryForExecution:n=>{const r=t(),{registeredTables:a}=r,s=new Set;if(a.forEach((c,u)=>{if(u.includes(".")){const[h]=u.split(".");s.add(h)}}),s.size===0)return n;let i=n;const l=/"([^"]+)\.([^"]+)"/g;return i=n.replace(l,(c,u,h)=>s.has(u)&&h?'"'.concat(u,'"."').concat(h,'"'):c),i},isMotherDuckQuery:n=>{const r=t(),{registeredTables:a,motherDuckSchemas:s}=r,i=t().extractTableReferences(n);if(i.length===0)return{isMotherDuck:!1,localTables:[],motherDuckTables:[],isHybrid:!1};const l=[],c=[],u=/^\s*(CREATE|DROP|ALTER)\s+/i.test(n),h=new Set;a.forEach((T,y)=>{if(y.includes(".")){const[b]=y.split(".");h.add(b)}}),i.forEach(T=>{if(T.database){if(h.has(T.database)){const x="".concat(T.database,".").concat(T.name);a.has(x),l.push(x);return}if(u){s.has(T.database)||r.motherDuckConnected?c.push({name:T.name,database:T.database}):l.push("".concat(T.database,".").concat(T.name));return}if(s.has(T.database)){if((s.get(T.database)||[]).some(A=>A.name===T.name)){c.push({name:T.name,database:T.database});return}c.push({name:T.name,database:T.database});return}else{l.push("".concat(T.database,".").concat(T.name));return}}if(a.has(T.name)){l.push(T.name);return}let y=!1;s.forEach((b,x)=>{b.some(A=>A.name===T.name)&&!y&&(c.push({name:T.name,database:x}),y=!0)}),y||l.push(T.name)});const m=l.length>0&&c.length>0,p=c.length>0&&l.length===0,g=c.length>0?c[0].database:void 0;return{isMotherDuck:p,targetDatabase:g,localTables:l,motherDuckTables:c,isHybrid:m}},executeChartQuery:(c,u,h,...m)=>H(null,[c,u,h,...m],function*(n,r,a,s="sum",i=100,l=[]){const{connection:p,isInitialized:g}=t();if(!p||!g)throw new Error("DuckDB is not initialized");try{let T="";l.length>0&&(T="WHERE "+l.map(x=>'"'.concat(x.field,'" ').concat(x.operator," '").concat(x.value,"'")).join(" AND "));const y='\n      SELECT \n        "'.concat(r,'" as dimension, \n        ').concat(s,'("').concat(a,'") as value,\n        COUNT(*) as count\n      FROM "').concat(n,'"\n      ').concat(T,'\n      GROUP BY "').concat(r,'"\n      ORDER BY value DESC\n      LIMIT ').concat(i,"\n    ");return(yield p.query(y)).toArray().map(x=>({dimension:x.dimension,value:typeof x.value=="bigint"?Number(x.value):x.value,count:typeof x.count=="bigint"?Number(x.count):x.count}))}catch(T){throw T}}),refreshAllTables:()=>H(null,null,function*(){const{connection:n,isInitialized:r}=t();if(!(!n||!r))try{const a=t().registeredTables,s=new Map(a),i=new Map(t().schemaCache),l=yield Oie(n,a);let c=0;for(const m of l)if(!a.has(m.name)){s.set(m.name,m.escapedName);try{const p=yield Mie(n,m.name,m.escapedName);i.set(m.name,p),c++;const g=m.type==="view"?"view":"table"}catch(p){}}const u=a.size,h=s.size;if(e({registeredTables:s,schemaCache:i,lastTableRefresh:Date.now()}),c>0){const m=l.filter(g=>g.type==="table").length,p=l.filter(g=>g.type==="view").length}}catch(a){}}),autoDetectTableChanges:n=>H(null,null,function*(){const{connection:r,isInitialized:a}=t();if(!(!r||!a))try{const s=Lie(n);if(s.isModifying)if(s.isMotherDuck&&s.database){yield new Promise(i=>setTimeout(i,500));try{yield t().refreshMotherDuckSchemas(s.database)}catch(i){}}else yield new Promise(i=>setTimeout(i,100)),yield t().refreshAllTables()}catch(s){}}),connectToMotherDuck:n=>H(null,null,function*(){var r;e({motherDuckConnecting:!0,motherDuckError:null});try{const{MDConnection:a}=yield fn(()=>H(null,null,function*(){const{MDConnection:c}=yield import("./index-Dd3aEmC1.js");return{MDConnection:c}}),__vite__mapDeps([0,1])),s=yield a.create({mdToken:n});yield s.isInitialized();const i=yield s.evaluateQuery("SHOW DATABASES");let l=[];if((r=i==null?void 0:i.data)!=null&&r.toRows&&(l=i.data.toRows().map(u=>({name:u.database_name||u.name||u.Database||u[0]||"",shared:u.shared||!1})).filter(u=>u.name&&u.name!=="system"&&u.name!=="temp")),e({motherDuckClient:s,motherDuckConnected:!0,motherDuckConnecting:!1,motherDuckDatabases:l,selectedMotherDuckDatabase:l.length>0?l[0].name:null}),l.length>0)try{yield t().refreshMotherDuckSchemas(l[0].name)}catch(c){}}catch(a){const s=a instanceof Error?a.message:"Connection failed";throw e({motherDuckConnecting:!1,motherDuckError:s}),a}}),disconnectFromMotherDuck:()=>H(null,null,function*(){const{motherDuckClient:n}=t();try{n&&(yield n.close())}catch(r){}e({motherDuckClient:null,motherDuckConnected:!1,motherDuckConnecting:!1,motherDuckError:null,motherDuckDatabases:[],selectedMotherDuckDatabase:null,motherDuckSchemas:new Map})}),executeMotherDuckQuery:(n,r)=>H(null,null,function*(){var l,c;const{motherDuckClient:a,selectedMotherDuckDatabase:s}=t();if(!a)throw new Error("MotherDuck client not available");const i=r||s;try{const u=/"\w+"\."\w+"/.test(n)||n.includes('"'.concat(i,'".'));let h=n;!u&&i&&(yield a.evaluateQuery("USE ".concat(i)));const m=yield a.evaluateQuery(h);let p=[];if((l=m==null?void 0:m.data)!=null&&l.toRows?p=m.data.toRows():(c=m==null?void 0:m.data)!=null&&c.toArray?p=m.data.toArray():Array.isArray(m==null?void 0:m.data)?p=m.data:p=[],n.toLowerCase().includes("limit")){const g=n.match(/limit\s+(\d+)/i);if(g){const T=parseInt(g[1],10);p.length>T*2&&(p=p.slice(0,T))}}return p}catch(u){throw u}}),refreshMotherDuckSchemas:n=>H(null,null,function*(){var a,s,i;const{motherDuckClient:r}=t();if(!r)throw new Error("MotherDuck client not available");try{yield r.evaluateQuery("USE ".concat(n));const l=yield r.evaluateQuery("SHOW TABLES");let c=new Set,u=[];(a=l==null?void 0:l.data)!=null&&a.toRows&&l.data.toRows().forEach(m=>{const p=m.name||m.table_name||m[0]||"";p&&(c.add(p),u.push({name:p,type:"table"}))});try{const h=yield r.evaluateQuery("SHOW VIEWS");(s=h==null?void 0:h.data)!=null&&s.toRows&&h.data.toRows().forEach(p=>{const g=p.name||p.view_name||p[0]||"";g&&(c.has(g)&&(u=u.filter(T=>T.name!==g)),u.push({name:g,type:"view"}))})}catch(h){}try{const h=yield r.evaluateQuery("\n        SELECT table_name, table_type \n        FROM information_schema.tables \n        WHERE table_schema = '".concat(n,"'\n      "));if((i=h==null?void 0:h.data)!=null&&i.toRows){const m=h.data.toRows(),p=new Map;m.forEach(g=>{if(g.table_name&&g.table_type){const T=g.table_type.toLowerCase().includes("view")?"view":"table";p.set(g.table_name,T)}}),u=u.map(g=>he(q({},g),{type:p.get(g.name)||g.type}))}}catch(h){}e(h=>({motherDuckSchemas:new Map(h.motherDuckSchemas).set(n,u)}))}catch(l){throw l}}),getAllAvailableTables:()=>{const n=t(),r=[];return Array.from(n.registeredTables.keys()).forEach(a=>{r.push({name:a,source:"local"})}),n.motherDuckSchemas.forEach((a,s)=>{a.forEach(i=>{r.push({name:i.name,source:"motherduck",database:s})})}),r},listAttachedDatabases:()=>H(null,null,function*(){const{connection:n,isInitialized:r}=t();if(!n||!r)return[];try{const s=(yield n.query("\n        SELECT DISTINCT table_catalog as database_name\n        FROM information_schema.tables\n        WHERE table_catalog NOT IN ('memory', 'system', 'temp')\n      ")).toArray(),i=[];for(const l of s){const c=l.database_name,h=(yield n.query("\n          SELECT COUNT(*) as count\n          FROM information_schema.tables\n          WHERE table_catalog = '".concat(c,"'\n          AND table_type = 'BASE TABLE'\n        "))).toArray()[0].count;i.push({name:c,tables:h})}return i}catch(a){return[]}}),detachDatabase:n=>H(null,null,function*(){const{connection:r,isInitialized:a}=t();if(!r||!a)throw new Error("DuckDB is not initialized");try{yield r.query("DETACH ".concat(n));const s=new Map(t().registeredTables),i=[];s.forEach((l,c)=>{c.startsWith("".concat(n,"."))&&i.push(c)}),i.forEach(l=>s.delete(l)),e({registeredTables:s}),yield t().refreshSchemaCache()}catch(s){throw s}}),connectToPostgreSQL:n=>H(null,null,function*(){try{const{usePostgreSQLStore:r}=yield fn(()=>H(null,null,function*(){const{usePostgreSQLStore:i}=yield Promise.resolve().then(()=>Bge);return{usePostgreSQLStore:i}}),void 0),s=r.getState().connections.find(i=>i.id===n);if(!s)throw new Error("PostgreSQL connection ".concat(n," not found"));e(i=>({postgresConnections:new Map(i.postgresConnections).set(n,s),postgresActiveConnections:new Set(i.postgresActiveConnections).add(n),postgresError:null}))}catch(r){const a=r instanceof Error?r.message:"Failed to connect to PostgreSQL";throw e({postgresError:a}),r}}),disconnectFromPostgreSQL:n=>H(null,null,function*(){try{e(r=>{const a=new Map(r.postgresConnections);a.delete(n);const s=new Set(r.postgresActiveConnections);s.delete(n);const i=new Map(r.postgresVirtualTables);for(const[c,u]of i)u.connectionId===n&&i.delete(c);const l=new Map(r.postgresSchemas);return l.delete(n),{postgresConnections:a,postgresActiveConnections:s,postgresVirtualTables:i,postgresSchemas:l}})}catch(r){const a=r instanceof Error?r.message:"Failed to disconnect from PostgreSQL";throw e({postgresError:a}),r}}),addVirtualPostgreSQLTable:(n,r,a=[])=>{const s="".concat(n,".").concat(r.schemaName,".").concat(r.tableName);e(i=>{var c;const l=new Map(i.postgresVirtualTables);return l.set(s,{connectionId:n,schemaName:r.schemaName,tableName:r.tableName,tableType:r.tableType,columns:a.length>0?a:((c=r.columns)==null?void 0:c.map(u=>({name:u.columnName,type:u.dataType})))||[],isImported:!1,estimatedSize:r.size&&parseInt(r.size.replace(/[^0-9]/g,""))||0}),{postgresVirtualTables:l}})},removeVirtualPostgreSQLTable:n=>{e(r=>{const a=new Map(r.postgresVirtualTables);return a.delete(n),{postgresVirtualTables:a}})},refreshPostgreSQLVirtualSchemas:n=>H(null,null,function*(){try{const{postgreSQLService:r}=yield fn(()=>H(null,null,function*(){const{postgreSQLService:l}=yield Promise.resolve().then(()=>Am);return{postgreSQLService:l}}),void 0),a=yield r.getSchemas(n),s=yield r.getAllTables(n),i=new Map;s.forEach(l=>{const c=l.schemaName;i.has(c)||i.set(c,[]),i.get(c).push({name:l.tableName,type:l.tableType,tableType:l.tableType})}),e(l=>{const c=new Map(l.postgresSchemas);for(const[u,h]of i)c.set("".concat(n,".").concat(u),h);return{postgresSchemas:c}})}catch(r){const a=r instanceof Error?r.message:"Failed to refresh PostgreSQL schemas";throw e({postgresError:a}),r}}),executePostgreSQLQuery:(n,r)=>H(null,null,function*(){try{const{postgreSQLService:a}=yield fn(()=>H(null,null,function*(){const{postgreSQLService:i}=yield Promise.resolve().then(()=>Am);return{postgreSQLService:i}}),void 0);return yield a.executeQuery(r,{sql:n})}catch(a){const s=a instanceof Error?a.message:"PostgreSQL query execution failed";throw e({postgresError:s}),a}}),getAllAvailableTablesWithPostgreSQL:()=>{const n=t(),r=[];return n.getAvailableTables().forEach(s=>{r.push({name:s,source:"local"})}),n.motherDuckConnected&&n.motherDuckDatabases.forEach(s=>{(n.motherDuckSchemas.get(s.name)||[]).forEach(l=>{r.push({name:"".concat(s.name,".").concat(l.name),source:"motherduck",database:s.name})})}),n.postgresVirtualTables.forEach((s,i)=>{r.push({name:"".concat(s.schemaName,".").concat(s.tableName),source:"postgresql",connectionId:s.connectionId,isVirtual:!s.isImported})}),r},isPostgreSQLQuery:n=>{const r=t();n.toLowerCase();const a=[],s=[],i=r.extractTableReferences(n);for(const h of i){let m=!1;for(const[p,g]of r.postgresVirtualTables)if(h.name===g.tableName||h.name==="".concat(g.schemaName,".").concat(g.tableName)){s.push({name:h.name,connectionId:g.connectionId,schemaName:g.schemaName}),m=!0;break}!m&&r.getAvailableTables().includes(h.name)&&a.push(h.name)}const l=s.length>0,c=s.length>0&&a.length>0,u=s.length>0?s[0].connectionId:void 0;return{isPostgreSQL:l,targetConnection:u,localTables:a,postgreSQLTables:s,isHybrid:c}},setPostgreSQLAutoImportThreshold:n=>{e({postgresAutoImportThreshold:n})},importPostgreSQLTableData:(n,r=!1)=>H(null,null,function*(){const a=t(),s=a.postgresVirtualTables.get(n);if(!s)throw new Error("Virtual table ".concat(n," not found"));if(!(s.isImported&&!r))try{const{postgreSQLService:i}=yield fn(()=>H(null,null,function*(){const{postgreSQLService:c}=yield Promise.resolve().then(()=>Am);return{postgreSQLService:c}}),void 0);if(!s.estimatedSize||s.estimatedSize<=a.postgresAutoImportThreshold||r){const c=yield i.fetchTableDataForImport(s.connectionId,s.schemaName,s.tableName,{sampleOnly:!r}),u="pg_".concat(s.connectionId,"_").concat(s.schemaName,"_").concat(s.tableName).replace(/[^a-zA-Z0-9_]/g,"_");if(yield a.createTable(u,c.columns.map(h=>h.name),c.columns.map(()=>Nt.Text)),c.data.length>1){const h=c.data.slice(1);yield a.insertData(u,h)}e(h=>{const m=new Map(h.postgresVirtualTables),p=he(q({},s),{isImported:!0,localTableName:u});return m.set(n,p),{postgresVirtualTables:m}})}}catch(i){const l=i instanceof Error?i.message:"Failed to import PostgreSQL table data";throw e({postgresError:l}),i}})})),bF={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_API_BASE_URL:"https://api.datakit.page/api",VITE_FEEDBACK_API_ENDPOINT:"https://feedback.datakit.page/api/feedback",VITE_PUBLIC_POSTHOG_HOST:"https://eu.i.posthog.com",VITE_PUBLIC_POSTHOG_KEY:"phc_2N0wObe0l2IxmeQL2TfA5wLlPX47lRhOe7XLaFY4XQG"},$I=new Map,ST=e=>{const t=$I.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([n,r])=>[n,r.getState()])):{}},Uie=(e,t,n)=>{if(e===void 0)return{type:"untracked",connection:t.connect(n)};const r=$I.get(n.name);if(r)return q({type:"tracked",store:e},r);const a={connection:t.connect(n),stores:{}};return $I.set(n.name,a),q({type:"tracked",store:e},a)},Fie=(e,t={})=>(n,r,a)=>{const y=t,{enabled:s,anonymousActionType:i,store:l}=y,c=Tn(y,["enabled","anonymousActionType","store"]);let u;try{u=(s!=null?s:(bF?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(x){}if(!u)return e(n,r,a);const b=Uie(l,u,c),{connection:h}=b,m=Tn(b,["connection"]);let p=!0;a.setState=(x,R,A)=>{const w=n(x,R);if(!p)return w;const _=A===void 0?{type:i||"anonymous"}:typeof A=="string"?{type:A}:A;return l===void 0?(h==null||h.send(_,r()),w):(h==null||h.send(he(q({},_),{type:"".concat(l,"/").concat(_.type)}),he(q({},ST(c.name)),{[l]:a.getState()})),w)};const g=(...x)=>{const R=p;p=!1,n(...x),p=R},T=e(a.setState,r,a);if(m.type==="untracked"?h==null||h.init(T):(m.stores[m.store]=a,h==null||h.init(Object.fromEntries(Object.entries(m.stores).map(([x,R])=>[x,x===m.store?T:R.getState()])))),a.dispatchFromDevtools&&typeof a.dispatch=="function"){let x=!1;const R=a.dispatch;a.dispatch=(...A)=>{(bF?"production":void 0)!=="production"&&A[0].type==="__setState"&&!x&&(x=!0),R(...A)}}return h.subscribe(x=>{var R;switch(x.type){case"ACTION":return typeof x.payload!="string"?void 0:cA(x.payload,A=>{if(A.type==="__setState"){if(l===void 0){g(A.state);return}Object.keys(A.state).length;const w=A.state[l];if(w==null)return;JSON.stringify(a.getState())!==JSON.stringify(w)&&g(w);return}a.dispatchFromDevtools&&typeof a.dispatch=="function"&&a.dispatch(A)});case"DISPATCH":switch(x.payload.type){case"RESET":return g(T),l===void 0?h==null?void 0:h.init(a.getState()):h==null?void 0:h.init(ST(c.name));case"COMMIT":if(l===void 0){h==null||h.init(a.getState());return}return h==null?void 0:h.init(ST(c.name));case"ROLLBACK":return cA(x.state,A=>{if(l===void 0){g(A),h==null||h.init(a.getState());return}g(A[l]),h==null||h.init(ST(c.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return cA(x.state,A=>{if(l===void 0){g(A);return}JSON.stringify(a.getState())!==JSON.stringify(A[l])&&g(A[l])});case"IMPORT_STATE":{const{nextLiftedState:A}=x.payload,w=(R=A.computedStates.slice(-1)[0])==null?void 0:R.state;if(!w)return;g(l===void 0?w:w[l]),h==null||h.send(null,A);return}case"PAUSE_RECORDING":return p=!p}return}}),T},H1=Fie,cA=(e,t)=>{let n;try{n=JSON.parse(e)}catch(r){}n!==void 0&&t(n)};function $ie(e,t){let n;try{n=e()}catch(a){return}return{getItem:a=>{var s;const i=c=>c===null?null:JSON.parse(c,void 0),l=(s=n.getItem(a))!=null?s:null;return l instanceof Promise?l.then(i):i(l)},setItem:(a,s)=>n.setItem(a,JSON.stringify(s,void 0)),removeItem:a=>n.removeItem(a)}}const BI=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return BI(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return BI(r)(n)}}}},Bie=(e,t)=>(n,r,a)=>{let s=q({storage:$ie(()=>localStorage),partialize:y=>y,version:0,merge:(y,b)=>q(q({},b),y)},t),i=!1;const l=new Set,c=new Set;let u=s.storage;if(!u)return e((...y)=>{n(...y)},r,a);const h=()=>{const y=s.partialize(q({},r()));return u.setItem(s.name,{state:y,version:s.version})},m=a.setState;a.setState=(y,b)=>{m(y,b),h()};const p=e((...y)=>{n(...y),h()},r,a);a.getInitialState=()=>p;let g;const T=()=>{var y,b;if(!u)return;i=!1,l.forEach(R=>{var A;return R((A=r())!=null?A:p)});const x=((b=s.onRehydrateStorage)==null?void 0:b.call(s,(y=r())!=null?y:p))||void 0;return BI(u.getItem.bind(u))(s.name).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==s.version){if(s.migrate){const A=s.migrate(R.state,R.version);return A instanceof Promise?A.then(w=>[!0,w]):[!0,A]}}else return[!1,R.state];return[!1,void 0]}).then(R=>{var A;const[w,_]=R;if(g=s.merge(_,(A=r())!=null?A:p),n(g,!0),w)return h()}).then(()=>{x==null||x(g,void 0),g=r(),i=!0,c.forEach(R=>R(g))}).catch(R=>{x==null||x(void 0,R)})};return a.persist={setOptions:y=>{s=q(q({},s),y),y.storage&&(u=y.storage)},clearStorage:()=>{u==null||u.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>T(),hasHydrated:()=>i,onHydrate:y=>(l.add(y),()=>{l.delete(y)}),onFinishHydration:y=>(c.add(y),()=>{c.delete(y)})},s.skipHydration||T(),g||p},V1=Bie,Hie=(e,t,n)=>{},Vie=(e,t,n)=>{},Gie="https://api.datakit.page/api";class zie{constructor(t){Kt(this,"baseURL");Kt(this,"isRefreshing",!1);Kt(this,"refreshPromise",null);this.baseURL=t}getAuthHeaders(){return H(this,null,function*(){return{}})}refreshToken(){return H(this,null,function*(){if(this.isRefreshing)return this.refreshPromise?this.refreshPromise:void 0;this.isRefreshing=!0,this.refreshPromise=this.performTokenRefresh();try{yield this.refreshPromise}finally{this.isRefreshing=!1,this.refreshPromise=null}})}performTokenRefresh(){return H(this,null,function*(){if(!(yield fetch("".concat(this.baseURL,"/auth/refresh"),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Token refresh failed")})}handleResponse(t,n){return H(this,null,function*(){if(!t.ok){if(t.status===401&&n&&!n.options.skipAuth){const a=n.options._retryCount||0;if(a>=1)throw new Error("Session expired. Please log in again.");try{yield this.refreshToken();const s=he(q({},n.options),{_retryCount:a+1});return this.request(n.endpoint,s)}catch(s){throw new Error("Session expired. Please log in again.")}}let r="Request failed with status ".concat(t.status);try{r=(yield t.json()).message||r}catch(a){}throw new Error(r)}return t.status===204||t.headers.get("content-length")==="0"?{}:t.json()})}request(r){return H(this,arguments,function*(t,n={}){const m=n,{skipAuth:a=!1,headers:s={}}=m,i=Tn(m,["skipAuth","headers"]),l=a?{}:yield this.getAuthHeaders(),c=q(q({"Content-Type":"application/json"},l),s),u="".concat(this.baseURL).concat(t),h=i.method||"GET";Hie(h,u,i.body?JSON.parse(i.body):void 0);try{const p=yield fetch(u,he(q({},i),{headers:c,credentials:"include"})),g=yield this.handleResponse(p,{endpoint:t,options:n});return Vie(u,g),g}catch(p){throw p}})}get(t,n){return H(this,null,function*(){return this.request(t,he(q({},n),{method:"GET"}))})}post(t,n,r){return H(this,null,function*(){return this.request(t,he(q({},r),{method:"POST",body:n?JSON.stringify(n):void 0}))})}put(t,n,r){return H(this,null,function*(){return this.request(t,he(q({},r),{method:"PUT",body:n?JSON.stringify(n):void 0}))})}patch(t,n,r){return H(this,null,function*(){return this.request(t,he(q({},r),{method:"PATCH",body:n?JSON.stringify(n):void 0}))})}delete(t,n){return H(this,null,function*(){return this.request(t,he(q({},n),{method:"DELETE"}))})}stream(t,n,r){return H(this,null,function*(){const m=r||{},{skipAuth:a=!1,headers:s={},_retryCount:i=0}=m,l=Tn(m,["skipAuth","headers","_retryCount"]),c=a?{}:yield this.getAuthHeaders(),u=q(q({"Content-Type":"application/json"},c),s),h="".concat(this.baseURL).concat(t);try{const p=yield fetch(h,he(q({},l),{method:"POST",headers:u,credentials:"include",body:n?JSON.stringify(n):void 0}));if(!p.ok){if(p.status===401&&!a){if(i>=1)throw new Error("Session expired. Please log in again.");try{yield this.refreshToken();const T=he(q({},r),{_retryCount:i+1});return this.stream(t,n,T)}catch(T){throw new Error("Session expired. Please log in again.")}}let g="Request failed with status ".concat(p.status);try{g=(yield p.json()).message||g}catch(T){}throw new Error(g)}return p}catch(p){throw p}})}}const xt=new zie(Gie);class qie{checkAuthStatus(){return H(this,null,function*(){try{const t=yield xt.get("/auth/status",{skipAuth:!0});return t==null?void 0:t.authenticated}catch(t){return!1}})}login(t){return H(this,null,function*(){return xt.post("/auth/login",t,{skipAuth:!0})})}signup(t){return H(this,null,function*(){return xt.post("/auth/signup",t,{skipAuth:!0})})}getCurrentUser(){return H(this,null,function*(){return xt.get("/auth/me")})}logout(){return H(this,null,function*(){return xt.post("/auth/logout",{},{skipAuth:!0})})}requestPasswordReset(t){return H(this,null,function*(){return xt.post("/auth/password-reset",{email:t},{skipAuth:!0})})}resetPassword(t,n){return H(this,null,function*(){return xt.post("/auth/password-reset/confirm",{token:t,newPassword:n},{skipAuth:!0})})}verifyEmail(t){return H(this,null,function*(){return xt.post("/auth/verify-email",{token:t},{skipAuth:!0})})}resendVerificationEmail(){return H(this,null,function*(){return xt.post("/auth/resend-verification")})}}const vd=new qie;class Yie{getProfile(){return H(this,null,function*(){return xt.get("/users/profile")})}updateProfile(t){return H(this,null,function*(){return xt.patch("/users/profile",t)})}changePassword(t,n){return H(this,null,function*(){return xt.post("/users/change-password",{currentPassword:t,newPassword:n})})}deleteAccount(t){return H(this,null,function*(){return xt.delete("/users/account",{body:JSON.stringify({password:t})})})}getSettings(){return H(this,null,function*(){return xt.get("/users/settings")})}updateSettings(t){return H(this,null,function*(){return xt.patch("/users/settings",t)})}getCreditUsage(t,n,r){return H(this,null,function*(){const a=new URLSearchParams;t&&a.append("startDate",t),n&&a.append("endDate",n),r&&a.append("limit",r.toString());const s=a.toString();return xt.get("/credits/usage".concat(s?"?".concat(s):""))})}getCreditStats(){return H(this,null,function*(){return xt.get("/credits/stats")})}checkCredits(t,n){return H(this,null,function*(){return xt.post("/credits/check",{model:t,estimatedTokens:n})})}getCurrentSubscription(){return H(this,null,function*(){return xt.get("/subscriptions/current")})}createCheckoutSession(t){return H(this,null,function*(){return xt.post("/subscriptions/create-checkout-session",{priceId:t})})}createPortalSession(){return H(this,null,function*(){return xt.post("/subscriptions/create-portal-session")})}cancelSubscription(){return H(this,null,function*(){return xt.post("/subscriptions/cancel")})}joinWaitlist(t,n){return H(this,null,function*(){return xt.post("/waitlist/signup",{email:t,featureName:n})})}getMyWaitlistEntries(){return H(this,null,function*(){return xt.get("/waitlist/my-entries")})}}const ty=new Yie,oi={getWorkspaces(){return H(this,null,function*(){return yield xt.get("/workspaces")})},getWorkspace(e){return H(this,null,function*(){return yield xt.get("/workspaces/".concat(e))})},createWorkspace(e){return H(this,null,function*(){return yield xt.post("/workspaces",e)})},updateWorkspace(e,t){return H(this,null,function*(){return yield xt.patch("/workspaces/".concat(e),t)})},switchWorkspace(e){return H(this,null,function*(){yield xt.post("/workspaces/".concat(e,"/switch"))})},deleteWorkspace(e){return H(this,null,function*(){yield xt.delete("/workspaces/".concat(e))})},getMembers(e){return H(this,null,function*(){return yield xt.get("/workspaces/".concat(e,"/members"))})},inviteMember(e,t){return H(this,null,function*(){return yield xt.post("/workspaces/".concat(e,"/members/invite"),t)})},acceptInvite(e){return H(this,null,function*(){yield xt.post("/workspaces/accept-invite",null,{params:{token:e}})})},removeMember(e,t){return H(this,null,function*(){yield xt.delete("/workspaces/".concat(e,"/members/").concat(t))})},updateMemberRole(e,t,n){return H(this,null,function*(){yield xt.patch("/workspaces/".concat(e,"/members/").concat(t,"/role"),{role:n})})}},qh=Ki()(H1((e,t)=>({user:null,isAuthenticated:!1,isLoading:!1,error:null,settings:null,hasInitialized:!1,currentWorkspace:null,login:n=>H(null,null,function*(){e({isLoading:!0,error:null});try{const r=yield vd.login(n);e({user:r.user,isAuthenticated:!0,isLoading:!1,error:null});try{yield t().loadUserSettings()}catch(a){}try{yield t().loadCurrentWorkspace()}catch(a){}try{const{useAIStore:a}=yield fn(()=>H(null,null,function*(){const{useAIStore:l}=yield Promise.resolve().then(()=>EO);return{useAIStore:l}}),void 0),{setActiveProvider:s,setActiveModel:i}=a.getState();s("datakit"),i("datakit-smart")}catch(a){}}catch(r){throw e({error:r instanceof Error?r.message:"Login failed",isLoading:!1,isAuthenticated:!1}),r}}),signup:n=>H(null,null,function*(){e({isLoading:!0,error:null});try{const r=yield vd.signup(n);e({user:r.user,isAuthenticated:!0,isLoading:!1,error:null});try{const{useAIStore:a}=yield fn(()=>H(null,null,function*(){const{useAIStore:l}=yield Promise.resolve().then(()=>EO);return{useAIStore:l}}),void 0),{setActiveProvider:s,setActiveModel:i}=a.getState();s("datakit"),i("datakit-smart")}catch(a){}}catch(r){throw e({error:r instanceof Error?r.message:"Signup failed",isLoading:!1,isAuthenticated:!1}),r}}),logout:()=>H(null,null,function*(){e({user:null,isAuthenticated:!1,settings:null,error:null,isLoading:!1,hasInitialized:!1});try{yield vd.logout()}catch(n){}}),checkAuth:()=>H(null,null,function*(){const n=t();if(!(n.isLoading||n.hasInitialized)){e({isLoading:!0});try{if(yield vd.checkAuthStatus()){const a=yield vd.getCurrentUser();e({user:a,isAuthenticated:!0,isLoading:!1,error:null,hasInitialized:!0})}else e({isAuthenticated:!1,user:null,isLoading:!1,error:null,settings:null,hasInitialized:!0})}catch(r){e({isAuthenticated:!1,user:null,isLoading:!1,error:null,settings:null,hasInitialized:!0})}}}),updateProfile:n=>H(null,null,function*(){const{user:r}=t();if(!r)throw new Error("Not authenticated");e({isLoading:!0,error:null});try{const a=yield ty.updateProfile(n);e({user:a,isLoading:!1,error:null})}catch(a){throw e({error:a instanceof Error?a.message:"Profile update failed",isLoading:!1}),a}}),updateSettings:n=>H(null,null,function*(){try{const r=yield ty.updateSettings(n);e({settings:r})}catch(r){const a=t().settings||{},s=q(q({},a),n);e({settings:s})}}),loadUserSettings:()=>H(null,null,function*(){try{const n=yield ty.getSettings();e({settings:n})}catch(n){}}),switchWorkspace:n=>H(null,null,function*(){try{yield oi.switchWorkspace(n);const r=yield vd.getCurrentUser();e({user:r}),yield t().loadCurrentWorkspace()}catch(r){throw r}}),loadCurrentWorkspace:()=>H(null,null,function*(){const{user:n}=t();if(n!=null&&n.currentWorkspaceId)try{const r=yield oi.getWorkspace(n.currentWorkspaceId);e({currentWorkspace:r})}catch(r){}}),setError:n=>e({error:n}),clearError:()=>e({error:null})}),{name:"AuthStore"})),Wie=(e,t,n,r)=>{var s,i,l,c;const a=[n,q({code:t},r||{})];if((i=(s=e==null?void 0:e.services)==null?void 0:s.logger)!=null&&i.forward)return e.services.logger.forward(a,"warn","react-i18next::",!0);eu(a[0])&&(a[0]="react-i18next:: ".concat(a[0])),(c=(l=e==null?void 0:e.services)==null?void 0:l.logger)!=null&&c.warn?e.services.logger.warn(...a):console!=null&&console.warn},vF={},HI=(e,t,n,r)=>{eu(n)&&vF[n]||(eu(n)&&(vF[n]=new Date),Wie(e,t,n,r))},tY=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}},VI=(e,t,n)=>{e.loadNamespaces(t,tY(e,n))},AF=(e,t,n,r)=>{if(eu(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return VI(e,n,r);n.forEach(a=>{e.options.ns.indexOf(a)<0&&e.options.ns.push(a)}),e.loadLanguages(t,tY(e,r))},Xie=(e,t,n={})=>!t.languages||!t.languages.length?(HI(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(r,a)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&r.services.backendConnector.backend&&r.isLanguageChangingTo&&!a(r.isLanguageChangingTo,e))return!1}}),eu=e=>typeof e=="string",Kie=e=>typeof e=="object"&&e!==null,Qie=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Jie={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},Zie=e=>Jie[e],eoe=e=>e.replace(Qie,Zie);let GI={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:eoe};const toe=(e={})=>{GI=q(q({},GI),e)},noe=()=>GI;let nY;const roe=e=>{nY=e},aoe=()=>nY,soe={type:"3rdParty",init(e){toe(e.options.react),roe(e)}},ioe=v.createContext();class ooe{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const loe=(e,t)=>{const n=v.useRef();return v.useEffect(()=>{n.current=e},[e,t]),n.current},rY=(e,t,n,r)=>e.getFixedT(t,n,r),coe=(e,t,n,r)=>v.useCallback(rY(e,t,n,r),[e,t,n,r]),Ze=(e,t={})=>{var w,_,N,I;const{i18n:n}=t,{i18n:r,defaultNS:a}=v.useContext(ioe)||{},s=n||r||aoe();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new ooe),!s){HI(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const D=(O,L)=>eu(L)?L:Kie(L)&&eu(L.defaultValue)?L.defaultValue:Array.isArray(O)?O[O.length-1]:O,M=[D,{},!1];return M.t=D,M.i18n={},M.ready=!1,M}(w=s.options.react)!=null&&w.wait&&HI(s,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const i=q(q(q({},noe()),s.options.react),t),{useSuspense:l,keyPrefix:c}=i;let u=a||((_=s.options)==null?void 0:_.defaultNS);u=eu(u)?[u]:u||["translation"],(I=(N=s.reportNamespaces).addUsedNamespaces)==null||I.call(N,u);const h=(s.isInitialized||s.initializedStoreOnce)&&u.every(D=>Xie(D,s,i)),m=coe(s,t.lng||null,i.nsMode==="fallback"?u:u[0],c),p=()=>m,g=()=>rY(s,t.lng||null,i.nsMode==="fallback"?u:u[0],c),[T,y]=v.useState(p);let b=u.join();t.lng&&(b="".concat(t.lng).concat(b));const x=loe(b),R=v.useRef(!0);v.useEffect(()=>{const{bindI18n:D,bindI18nStore:M}=i;R.current=!0,!h&&!l&&(t.lng?AF(s,t.lng,u,()=>{R.current&&y(g)}):VI(s,u,()=>{R.current&&y(g)})),h&&x&&x!==b&&R.current&&y(g);const O=()=>{R.current&&y(g)};return D&&(s==null||s.on(D,O)),M&&(s==null||s.store.on(M,O)),()=>{R.current=!1,s&&D&&(D==null||D.split(" ").forEach(L=>s.off(L,O))),M&&s&&M.split(" ").forEach(L=>s.store.off(L,O))}},[s,b]),v.useEffect(()=>{R.current&&h&&y(p)},[s,c,h]);const A=[T,s,h];if(A.t=T,A.i18n=s,A.ready=h,h||!h&&!l)return A;throw new Promise(D=>{t.lng?AF(s,t.lng,u,()=>D()):VI(s,u,()=>D())})},G1=v.createContext({});function z1(e){const t=v.useRef(null);return t.current===null&&(t.current=e()),t.current}const q1=typeof window!="undefined",aY=q1?v.useLayoutEffect:v.useEffect,k0=v.createContext(null),Y1=v.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class uoe extends v.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,a=r instanceof HTMLElement&&r.offsetWidth||0,s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft,s.right=a-s.width-s.left}return null}componentDidUpdate(){}render(){return this.props.children}}function doe({children:e,isPresent:t,anchorX:n}){const r=v.useId(),a=v.useRef(null),s=v.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:i}=v.useContext(Y1);return v.useInsertionEffect(()=>{const{width:l,height:c,top:u,left:h,right:m}=s.current;if(t||!a.current||!l||!c)return;const p=n==="left"?"left: ".concat(h):"right: ".concat(m);a.current.dataset.motionPopId=r;const g=document.createElement("style");return i&&(g.nonce=i),document.head.appendChild(g),g.sheet&&g.sheet.insertRule('\n          [data-motion-pop-id="'.concat(r,'"] {\n            position: absolute !important;\n            width: ').concat(l,"px !important;\n            height: ").concat(c,"px !important;\n            ").concat(p,"px !important;\n            top: ").concat(u,"px !important;\n          }\n        ")),()=>{document.head.contains(g)&&document.head.removeChild(g)}},[t]),o.jsx(uoe,{isPresent:t,childRef:a,sizeRef:s,children:v.cloneElement(e,{ref:a})})}const hoe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:s,mode:i,anchorX:l})=>{const c=z1(foe),u=v.useId();let h=!0,m=v.useMemo(()=>(h=!1,{id:u,initial:t,isPresent:n,custom:a,onExitComplete:p=>{c.set(p,!0);for(const g of c.values())if(!g)return;r&&r()},register:p=>(c.set(p,!1),()=>c.delete(p))}),[n,c,r]);return s&&h&&(m=q({},m)),v.useMemo(()=>{c.forEach((p,g)=>c.set(g,!1))},[n]),v.useEffect(()=>{!n&&!c.size&&r&&r()},[n]),i==="popLayout"&&(e=o.jsx(doe,{isPresent:n,anchorX:l,children:e})),o.jsx(k0.Provider,{value:m,children:e})};function foe(){return new Map}function sY(e=!0){const t=v.useContext(k0);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:a}=t,s=v.useId();v.useEffect(()=>{if(e)return a(s)},[e]);const i=v.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,i]:[!0]}const bT=e=>e.key||"";function RF(e){const t=[];return v.Children.forEach(e,n=>{v.isValidElement(n)&&t.push(n)}),t}const At=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:a=!0,mode:s="sync",propagate:i=!1,anchorX:l="left"})=>{const[c,u]=sY(i),h=v.useMemo(()=>RF(e),[e]),m=i&&!c?[]:h.map(bT),p=v.useRef(!0),g=v.useRef(h),T=z1(()=>new Map),[y,b]=v.useState(h),[x,R]=v.useState(h);aY(()=>{p.current=!1,g.current=h;for(let _=0;_<x.length;_++){const N=bT(x[_]);m.includes(N)?T.delete(N):T.get(N)!==!0&&T.set(N,!1)}},[x,m.length,m.join("-")]);const A=[];if(h!==y){let _=[...h];for(let N=0;N<x.length;N++){const I=x[N],D=bT(I);m.includes(D)||(_.splice(N,0,I),A.push(I))}return s==="wait"&&A.length&&(_=A),R(RF(_)),b(h),null}const{forceRender:w}=v.useContext(G1);return o.jsx(o.Fragment,{children:x.map(_=>{const N=bT(_),I=i&&!c?!1:h===x||m.includes(N),D=()=>{if(T.has(N))T.set(N,!0);else return;let M=!0;T.forEach(O=>{O||(M=!1)}),M&&(w==null||w(),R(g.current),i&&(u==null||u()),r&&r())};return o.jsx(hoe,{isPresent:I,initial:!p.current||n?void 0:!1,custom:t,presenceAffectsLayout:a,mode:s,onExitComplete:I?void 0:D,anchorX:l,children:_},N)})})};function W1(e,t){e.indexOf(t)===-1&&e.push(t)}function X1(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Do=(e,t,n)=>n>t?t:n<e?e:n;let K1=()=>{};const Po={},iY=e=>new RegExp("^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$","u").test(e),oY=e=>new RegExp("^0[^.\\s]+$","u").test(e);function Q1(e){let t;return()=>(t===void 0&&(t=e()),t)}const zs=e=>e,moe=(e,t)=>n=>t(e(n)),Ig=(...e)=>e.reduce(moe),Xp=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class J1{constructor(){this.subscriptions=[]}add(t){return W1(this.subscriptions,t),()=>X1(this.subscriptions,t)}notify(t,n,r){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](t,n,r);else for(let s=0;s<a;s++){const i=this.subscriptions[s];i&&i(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ui=e=>e*1e3,Fi=e=>e/1e3;function lY(e,t){return t?e*(1e3/t):0}const cY=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,poe=1e-7,goe=12;function Eoe(e,t,n,r,a){let s,i,l=0;do i=t+(n-t)/2,s=cY(i,r,a)-e,s>0?n=i:t=i;while(Math.abs(s)>poe&&++l<goe);return i}function Og(e,t,n,r){if(e===t&&n===r)return zs;const a=s=>Eoe(s,0,1,e,n);return s=>s===0||s===1?s:cY(a(s),t,r)}const uY=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,dY=e=>t=>1-e(1-t),hY=Og(.33,1.53,.69,.99),Z1=dY(hY),fY=uY(Z1),mY=e=>(e*=2)<1?.5*Z1(e):.5*(2-Math.pow(2,-10*(e-1))),eL=e=>1-Math.sin(Math.acos(e)),pY=dY(eL),gY=uY(eL),Toe=Og(.42,0,1,1),yoe=Og(0,0,.58,1),EY=Og(.42,0,.58,1),xoe=e=>Array.isArray(e)&&typeof e[0]!="number",TY=e=>Array.isArray(e)&&typeof e[0]=="number",Soe={linear:zs,easeIn:Toe,easeInOut:EY,easeOut:yoe,circIn:eL,circInOut:gY,circOut:pY,backIn:Z1,backInOut:fY,backOut:hY,anticipate:mY},boe=e=>typeof e=="string",NF=e=>{if(TY(e)){K1(e.length===4);const[t,n,r,a]=e;return Og(t,n,r,a)}else if(boe(e))return Soe[e];return e},vT=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],_F={value:null};function voe(e,t){let n=new Set,r=new Set,a=!1,s=!1;const i=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},c=0;function u(m){i.has(m)&&(h.schedule(m),e()),c++,m(l)}const h={schedule:(m,p=!1,g=!1)=>{const y=g&&a?n:r;return p&&i.add(m),y.has(m)||y.add(m),m},cancel:m=>{r.delete(m),i.delete(m)},process:m=>{if(l=m,a){s=!0;return}a=!0,[n,r]=[r,n],n.forEach(u),t&&_F.value&&_F.value.frameloop[t].push(c),c=0,n.clear(),a=!1,s&&(s=!1,h.process(m))}};return h}const Aoe=40;function yY(e,t){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,i=vT.reduce((A,w)=>(A[w]=voe(s,t?w:void 0),A),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:h,update:m,preRender:p,render:g,postRender:T}=i,y=()=>{const A=Po.useManualTiming?a.timestamp:performance.now();n=!1,Po.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(A-a.timestamp,Aoe),1)),a.timestamp=A,a.isProcessing=!0,l.process(a),c.process(a),u.process(a),h.process(a),m.process(a),p.process(a),g.process(a),T.process(a),a.isProcessing=!1,n&&t&&(r=!1,e(y))},b=()=>{n=!0,r=!0,a.isProcessing||e(y)};return{schedule:vT.reduce((A,w)=>{const _=i[w];return A[w]=(N,I=!1,D=!1)=>(n||b(),_.schedule(N,I,D)),A},{}),cancel:A=>{for(let w=0;w<vT.length;w++)i[vT[w]].cancel(A)},state:a,steps:i}}const{schedule:Er,cancel:jl,state:da,steps:uA}=yY(typeof requestAnimationFrame!="undefined"?requestAnimationFrame:zs,!0);let ny;function Roe(){ny=void 0}const ss={now:()=>(ny===void 0&&ss.set(da.isProcessing||Po.useManualTiming?da.timestamp:performance.now()),ny),set:e=>{ny=e,queueMicrotask(Roe)}},xY=e=>t=>typeof t=="string"&&t.startsWith(e),tL=xY("--"),Noe=xY("var(--"),nL=e=>Noe(e)?_oe.test(e.split("/*")[0].trim()):!1,_oe=new RegExp("var\\(--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)$","iu"),Yh={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Kp=he(q({},Yh),{transform:e=>Do(0,1,e)}),AT=he(q({},Yh),{default:1}),vp=e=>Math.round(e*1e5)/1e5,rL=new RegExp("-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)","gu");function woe(e){return e==null}const Coe=new RegExp("^(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))$","iu"),aL=(e,t)=>n=>!!(typeof n=="string"&&Coe.test(n)&&n.startsWith(e)||t&&!woe(n)&&Object.prototype.hasOwnProperty.call(n,t)),SY=(e,t,n)=>r=>{if(typeof r!="string")return r;const[a,s,i,l]=r.match(rL);return{[e]:parseFloat(a),[t]:parseFloat(s),[n]:parseFloat(i),alpha:l!==void 0?parseFloat(l):1}},Ioe=e=>Do(0,255,e),dA=he(q({},Yh),{transform:e=>Math.round(Ioe(e))}),Vc={test:aL("rgb","red"),parse:SY("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+dA.transform(e)+", "+dA.transform(t)+", "+dA.transform(n)+", "+vp(Kp.transform(r))+")"};function Ooe(e){let t="",n="",r="",a="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),a=e.substring(4,5),t+=t,n+=n,r+=r,a+=a),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:a?parseInt(a,16)/255:1}}const zI={test:aL("#"),parse:Ooe,transform:Vc.transform},Lg=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>"".concat(t).concat(e)}),Rl=Lg("deg"),$i=Lg("%"),$t=Lg("px"),Loe=Lg("vh"),Moe=Lg("vw"),wF=he(q({},$i),{parse:e=>$i.parse(e)/100,transform:e=>$i.transform(e*100)}),Jd={test:aL("hsl","hue"),parse:SY("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+$i.transform(vp(t))+", "+$i.transform(vp(n))+", "+vp(Kp.transform(r))+")"},Ra={test:e=>Vc.test(e)||zI.test(e)||Jd.test(e),parse:e=>Vc.test(e)?Vc.parse(e):Jd.test(e)?Jd.parse(e):zI.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Vc.transform(e):Jd.transform(e)},Doe=new RegExp("(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))","giu");function Poe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(rL))==null?void 0:t.length)||0)+(((n=e.match(Doe))==null?void 0:n.length)||0)>0}const bY="number",vY="color",koe="var",joe="var(",CF="${}",Uoe=new RegExp("var\\s*\\(\\s*--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)|#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\)|-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)","giu");function Qp(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},a=[];let s=0;const l=t.replace(Uoe,c=>(Ra.test(c)?(r.color.push(s),a.push(vY),n.push(Ra.parse(c))):c.startsWith(joe)?(r.var.push(s),a.push(koe),n.push(c)):(r.number.push(s),a.push(bY),n.push(parseFloat(c))),++s,CF)).split(CF);return{values:n,split:l,indexes:r,types:a}}function AY(e){return Qp(e).values}function RY(e){const{split:t,types:n}=Qp(e),r=t.length;return a=>{let s="";for(let i=0;i<r;i++)if(s+=t[i],a[i]!==void 0){const l=n[i];l===bY?s+=vp(a[i]):l===vY?s+=Ra.transform(a[i]):s+=a[i]}return s}}const Foe=e=>typeof e=="number"?0:e;function $oe(e){const t=AY(e);return RY(e)(t.map(Foe))}const Ul={test:Poe,parse:AY,createTransformer:RY,getAnimatableNone:$oe};function hA(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Boe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let a=0,s=0,i=0;if(!t)a=s=i=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;a=hA(c,l,e+1/3),s=hA(c,l,e),i=hA(c,l,e-1/3)}return{red:Math.round(a*255),green:Math.round(s*255),blue:Math.round(i*255),alpha:r}}function Py(e,t){return n=>n>0?t:e}const gr=(e,t,n)=>e+(t-e)*n,fA=(e,t,n)=>{const r=e*e,a=n*(t*t-r)+r;return a<0?0:Math.sqrt(a)},Hoe=[zI,Vc,Jd],Voe=e=>Hoe.find(t=>t.test(e));function IF(e){const t=Voe(e);if(!t)return!1;let n=t.parse(e);return t===Jd&&(n=Boe(n)),n}const OF=(e,t)=>{const n=IF(e),r=IF(t);if(!n||!r)return Py(e,t);const a=q({},n);return s=>(a.red=fA(n.red,r.red,s),a.green=fA(n.green,r.green,s),a.blue=fA(n.blue,r.blue,s),a.alpha=gr(n.alpha,r.alpha,s),Vc.transform(a))},qI=new Set(["none","hidden"]);function Goe(e,t){return qI.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function zoe(e,t){return n=>gr(e,t,n)}function sL(e){return typeof e=="number"?zoe:typeof e=="string"?nL(e)?Py:Ra.test(e)?OF:Woe:Array.isArray(e)?NY:typeof e=="object"?Ra.test(e)?OF:qoe:Py}function NY(e,t){const n=[...e],r=n.length,a=e.map((s,i)=>sL(s)(s,t[i]));return s=>{for(let i=0;i<r;i++)n[i]=a[i](s);return n}}function qoe(e,t){const n=q(q({},e),t),r={};for(const a in n)e[a]!==void 0&&t[a]!==void 0&&(r[a]=sL(e[a])(e[a],t[a]));return a=>{for(const s in r)n[s]=r[s](a);return n}}function Yoe(e,t){var a;const n=[],r={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const i=t.types[s],l=e.indexes[i][r[i]],c=(a=e.values[l])!=null?a:0;n[s]=c,r[i]++}return n}const Woe=(e,t)=>{const n=Ul.createTransformer(t),r=Qp(e),a=Qp(t);return r.indexes.var.length===a.indexes.var.length&&r.indexes.color.length===a.indexes.color.length&&r.indexes.number.length>=a.indexes.number.length?qI.has(e)&&!a.values.length||qI.has(t)&&!r.values.length?Goe(e,t):Ig(NY(Yoe(r,a),a.values),n):Py(e,t)};function _Y(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?gr(e,t,n):sL(e)(e,t)}const Xoe=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Er.update(t,n),stop:()=>jl(t),now:()=>da.isProcessing?da.timestamp:ss.now()}},wY=(e,t,n=10)=>{let r="";const a=Math.max(Math.round(t/n),2);for(let s=0;s<a;s++)r+=e(s/(a-1))+", ";return"linear(".concat(r.substring(0,r.length-2),")")},ky=2e4;function iL(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<ky;)t+=n,r=e.next(t);return t>=ky?1/0:t}function Koe(e,t=100,n){const r=n(he(q({},e),{keyframes:[0,t]})),a=Math.min(iL(r),ky);return{type:"keyframes",ease:s=>r.next(a*s).value/t,duration:Fi(a)}}const Qoe=5;function CY(e,t,n){const r=Math.max(t-Qoe,0);return lY(n-e(r),t-r)}const xr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},LF=.001;function Joe({duration:e=xr.duration,bounce:t=xr.bounce,velocity:n=xr.velocity,mass:r=xr.mass}){let a,s,i=1-t;i=Do(xr.minDamping,xr.maxDamping,i),e=Do(xr.minDuration,xr.maxDuration,Fi(e)),i<1?(a=u=>{const h=u*i,m=h*e,p=h-n,g=YI(u,i),T=Math.exp(-m);return LF-p/g*T},s=u=>{const m=u*i*e,p=m*n+n,g=Math.pow(i,2)*Math.pow(u,2)*e,T=Math.exp(-m),y=YI(Math.pow(u,2),i);return(-a(u)+LF>0?-1:1)*((p-g)*T)/y}):(a=u=>{const h=Math.exp(-u*e),m=(u-n)*e+1;return-.001+h*m},s=u=>{const h=Math.exp(-u*e),m=(n-u)*(e*e);return h*m});const l=5/e,c=ele(a,s,l);if(e=Ui(e),isNaN(c))return{stiffness:xr.stiffness,damping:xr.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:i*2*Math.sqrt(r*u),duration:e}}}const Zoe=12;function ele(e,t,n){let r=n;for(let a=1;a<Zoe;a++)r=r-e(r)/t(r);return r}function YI(e,t){return e*Math.sqrt(1-t*t)}const tle=["duration","bounce"],nle=["stiffness","damping","mass"];function MF(e,t){return t.some(n=>e[n]!==void 0)}function rle(e){let t=q({velocity:xr.velocity,stiffness:xr.stiffness,damping:xr.damping,mass:xr.mass,isResolvedFromDuration:!1},e);if(!MF(e,nle)&&MF(e,tle))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),a=r*r,s=2*Do(.05,1,1-(e.bounce||0))*Math.sqrt(a);t=he(q({},t),{mass:xr.mass,stiffness:a,damping:s})}else{const n=Joe(e);t=he(q(q({},t),n),{mass:xr.mass}),t.isResolvedFromDuration=!0}return t}function jy(e=xr.visualDuration,t=xr.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:a}=n;const s=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],l={done:!1,value:s},{stiffness:c,damping:u,mass:h,duration:m,velocity:p,isResolvedFromDuration:g}=rle(he(q({},n),{velocity:-Fi(n.velocity||0)})),T=p||0,y=u/(2*Math.sqrt(c*h)),b=i-s,x=Fi(Math.sqrt(c/h)),R=Math.abs(b)<5;r||(r=R?xr.restSpeed.granular:xr.restSpeed.default),a||(a=R?xr.restDelta.granular:xr.restDelta.default);let A;if(y<1){const _=YI(x,y);A=N=>{const I=Math.exp(-y*x*N);return i-I*((T+y*x*b)/_*Math.sin(_*N)+b*Math.cos(_*N))}}else if(y===1)A=_=>i-Math.exp(-x*_)*(b+(T+x*b)*_);else{const _=x*Math.sqrt(y*y-1);A=N=>{const I=Math.exp(-y*x*N),D=Math.min(_*N,300);return i-I*((T+y*x*b)*Math.sinh(D)+_*b*Math.cosh(D))/_}}const w={calculatedDuration:g&&m||null,next:_=>{const N=A(_);if(g)l.done=_>=m;else{let I=_===0?T:0;y<1&&(I=_===0?Ui(T):CY(A,_,N));const D=Math.abs(I)<=r,M=Math.abs(i-N)<=a;l.done=D&&M}return l.value=l.done?i:N,l},toString:()=>{const _=Math.min(iL(w),ky),N=wY(I=>w.next(_*I).value,_,30);return _+"ms "+N},toTransition:()=>{}};return w}jy.applyToOptions=e=>{const t=Koe(e,100,jy);return e.ease=t.ease,e.duration=Ui(t.duration),e.type="keyframes",e};function WI({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:s=500,modifyTarget:i,min:l,max:c,restDelta:u=.5,restSpeed:h}){const m=e[0],p={done:!1,value:m},g=D=>l!==void 0&&D<l||c!==void 0&&D>c,T=D=>l===void 0?c:c===void 0||Math.abs(l-D)<Math.abs(c-D)?l:c;let y=n*t;const b=m+y,x=i===void 0?b:i(b);x!==b&&(y=x-m);const R=D=>-y*Math.exp(-D/r),A=D=>x+R(D),w=D=>{const M=R(D),O=A(D);p.done=Math.abs(M)<=u,p.value=p.done?x:O};let _,N;const I=D=>{g(p.value)&&(_=D,N=jy({keyframes:[p.value,T(p.value)],velocity:CY(A,D,p.value),damping:a,stiffness:s,restDelta:u,restSpeed:h}))};return I(0),{calculatedDuration:null,next:D=>{let M=!1;return!N&&_===void 0&&(M=!0,w(D),I(D)),_!==void 0&&D>=_?N.next(D-_):(!M&&w(D),p)}}}function ale(e,t,n){const r=[],a=n||Po.mix||_Y,s=e.length-1;for(let i=0;i<s;i++){let l=a(e[i],e[i+1]);if(t){const c=Array.isArray(t)?t[i]||zs:t;l=Ig(c,l)}r.push(l)}return r}function sle(e,t,{clamp:n=!0,ease:r,mixer:a}={}){const s=e.length;if(K1(s===t.length),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=ale(t,r,a),c=l.length,u=h=>{if(i&&h<e[0])return t[0];let m=0;if(c>1)for(;m<e.length-2&&!(h<e[m+1]);m++);const p=Xp(e[m],e[m+1],h);return l[m](p)};return n?h=>u(Do(e[0],e[s-1],h)):u}function ile(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const a=Xp(0,t,r);e.push(gr(n,1,a))}}function ole(e){const t=[0];return ile(t,e.length-1),t}function lle(e,t){return e.map(n=>n*t)}function cle(e,t){return e.map(()=>t||EY).splice(0,e.length-1)}function Ap({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const a=xoe(r)?r.map(NF):NF(r),s={done:!1,value:t[0]},i=lle(n&&n.length===t.length?n:ole(t),e),l=sle(i,t,{ease:Array.isArray(a)?a:cle(t,a)});return{calculatedDuration:e,next:c=>(s.value=l(c),s.done=c>=e,s)}}const ule=e=>e!==null;function oL(e,{repeat:t,repeatType:n="loop"},r,a=1){const s=e.filter(ule),l=a<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!l||r===void 0?s[l]:r}const dle={decay:WI,inertia:WI,tween:Ap,keyframes:Ap,spring:jy};function IY(e){typeof e.type=="string"&&(e.type=dle[e.type])}class lL{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const hle=e=>e/100;class cL extends lL{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=(n=!0)=>{var r,a;if(n){const{motionValue:s}=this.options;s&&s.updatedAt!==ss.now()&&this.tick(ss.now())}this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(a=(r=this.options).onStop)==null||a.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;IY(t);const{type:n=Ap,repeat:r=0,repeatDelay:a=0,repeatType:s,velocity:i=0}=t;let{keyframes:l}=t;const c=n||Ap;c!==Ap&&typeof l[0]!="number"&&(this.mixKeyframes=Ig(hle,_Y(l[0],l[1])),l=[0,100]);const u=c(he(q({},t),{keyframes:l}));s==="mirror"&&(this.mirroredGenerator=c(he(q({},t),{keyframes:[...l].reverse(),velocity:-i}))),u.calculatedDuration===null&&(u.calculatedDuration=iL(u));const{calculatedDuration:h}=u;this.calculatedDuration=h,this.resolvedDuration=h+a,this.totalDuration=this.resolvedDuration*(r+1)-a,this.generator=u}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:a,mixKeyframes:s,mirroredGenerator:i,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:h,repeat:m,repeatType:p,repeatDelay:g,type:T,onUpdate:y,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-a/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const x=this.currentTime-u*(this.playbackSpeed>=0?1:-1),R=this.playbackSpeed>=0?x<0:x>a;this.currentTime=Math.max(x,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let A=this.currentTime,w=r;if(m){const D=Math.min(this.currentTime,a)/l;let M=Math.floor(D),O=D%1;!O&&D>=1&&(O=1),O===1&&M--,M=Math.min(M,m+1),!!(M%2)&&(p==="reverse"?(O=1-O,g&&(O-=g/l)):p==="mirror"&&(w=i)),A=Do(0,1,O)*l}const _=R?{done:!1,value:h[0]}:w.next(A);s&&(_.value=s(_.value));let{done:N}=_;!R&&c!==null&&(N=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return I&&T!==WI&&(_.value=oL(h,this.options,b,this.speed)),y&&y(_.value),I&&this.finish(),_}then(t,n){return this.finished.then(t,n)}get duration(){return Fi(this.calculatedDuration)}get time(){return Fi(this.currentTime)}set time(t){var n;t=Ui(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(ss.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Fi(this.currentTime))}play(){var a,s;if(this.isStopped)return;const{driver:t=Xoe,startTime:n}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),(s=(a=this.options).onPlay)==null||s.call(a);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n!=null?n:r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(ss.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function fle(e){var t;for(let n=1;n<e.length;n++)(t=e[n])!=null||(e[n]=e[n-1])}const Gc=e=>e*180/Math.PI,XI=e=>{const t=Gc(Math.atan2(e[1],e[0]));return KI(t)},mle={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:XI,rotateZ:XI,skewX:e=>Gc(Math.atan(e[1])),skewY:e=>Gc(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},KI=e=>(e=e%360,e<0&&(e+=360),e),DF=XI,PF=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),kF=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),ple={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:PF,scaleY:kF,scale:e=>(PF(e)+kF(e))/2,rotateX:e=>KI(Gc(Math.atan2(e[6],e[5]))),rotateY:e=>KI(Gc(Math.atan2(-e[2],e[0]))),rotateZ:DF,rotate:DF,skewX:e=>Gc(Math.atan(e[4])),skewY:e=>Gc(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function jF(e){return e.includes("scale")?1:0}function QI(e,t){if(!e||e==="none")return jF(t);const n=e.match(new RegExp("^matrix3d\\(([-\\d.e\\s,]+)\\)$","u"));let r,a;if(n)r=ple,a=n;else{const l=e.match(new RegExp("^matrix\\(([-\\d.e\\s,]+)\\)$","u"));r=mle,a=l}if(!a)return jF(t);const s=r[t],i=a[1].split(",").map(Ele);return typeof s=="function"?s(i):i[s]}const gle=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return QI(n,t)};function Ele(e){return parseFloat(e.trim())}const Wh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xh=new Set(Wh),UF=e=>e===Yh||e===$t,Tle=new Set(["x","y","z"]),yle=Wh.filter(e=>!Tle.has(e));function xle(e){const t=[];return yle.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const tu={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>QI(t,"x"),y:(e,{transform:t})=>QI(t,"y")};tu.translateX=tu.x;tu.translateY=tu.y;const nu=new Set;let JI=!1,ZI=!1,eO=!1;function OY(){if(ZI){const e=Array.from(nu).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const a=xle(r);a.length&&(n.set(r,a),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const a=n.get(r);a&&a.forEach(([s,i])=>{var l;(l=r.getValue(s))==null||l.set(i)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}ZI=!1,JI=!1,nu.forEach(e=>e.complete(eO)),nu.clear()}function LY(){nu.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ZI=!0)})}function Sle(){eO=!0,LY(),OY(),eO=!1}class uL{constructor(t,n,r,a,s,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=a,this.element=s,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(nu.add(this),JI||(JI=!0,Er.read(LY),Er.resolveKeyframes(OY))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:a}=this;if(t[0]===null){const s=a==null?void 0:a.get(),i=t[t.length-1];if(s!==void 0)t[0]=s;else if(r&&n){const l=r.readValue(n,i);l!=null&&(t[0]=l)}t[0]===void 0&&(t[0]=i),a&&s===void 0&&a.set(t[0])}fle(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),nu.delete(this)}cancel(){this.state==="scheduled"&&(nu.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const ble=e=>e.startsWith("--");function vle(e,t,n){ble(t)?e.style.setProperty(t,n):e.style[t]=n}const Ale=Q1(()=>window.ScrollTimeline!==void 0),Rle={};function Nle(e,t){const n=Q1(e);return()=>{var r;return(r=Rle[t])!=null?r:n()}}const MY=Nle(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),dp=([e,t,n,r])=>"cubic-bezier(".concat(e,", ").concat(t,", ").concat(n,", ").concat(r,")"),FF={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dp([0,.65,.55,1]),circOut:dp([.55,0,1,.45]),backIn:dp([.31,.01,.66,-.59]),backOut:dp([.33,1.53,.69,.99])};function DY(e,t){if(e)return typeof e=="function"?MY()?wY(e,t):"ease-out":TY(e)?dp(e):Array.isArray(e)?e.map(n=>DY(n,t)||FF.easeOut):FF[e]}function _le(e,t,n,{delay:r=0,duration:a=300,repeat:s=0,repeatType:i="loop",ease:l="easeOut",times:c}={},u=void 0){const h={[t]:n};c&&(h.offset=c);const m=DY(l,a);Array.isArray(m)&&(h.easing=m);const p={delay:r,duration:a,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:s+1,direction:i==="reverse"?"alternate":"normal"};return u&&(p.pseudoElement=u),e.animate(h,p)}function PY(e){return typeof e=="function"&&"applyToOptions"in e}function wle(n){var r=n,{type:e}=r,t=Tn(r,["type"]);var a,s;return PY(e)&&MY()?e.applyToOptions(t):((a=t.duration)!=null||(t.duration=300),(s=t.ease)!=null||(t.ease="easeOut"),t)}class Cle extends lL{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:r,keyframes:a,pseudoElement:s,allowFlatten:i=!1,finalKeyframe:l,onComplete:c}=t;this.isPseudoElement=!!s,this.allowFlatten=i,this.options=t,K1(typeof t.type!="string");const u=wle(t);this.animation=_le(n,r,a,u,s),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const h=oL(a,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(h):vle(n,r,h),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Fi(Number(t))}get time(){return Fi(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=Ui(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&Ale()?(this.animation.timeline=t,zs):n(this)}}const kY={anticipate:mY,backInOut:fY,circInOut:gY};function Ile(e){return e in kY}function Ole(e){typeof e.ease=="string"&&Ile(e.ease)&&(e.ease=kY[e.ease])}const $F=10;class Lle extends Cle{constructor(t){Ole(t),IY(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){var h;const u=this.options,{motionValue:n,onUpdate:r,onComplete:a,element:s}=u,i=Tn(u,["motionValue","onUpdate","onComplete","element"]);if(!n)return;if(t!==void 0){n.set(t);return}const l=new cL(he(q({},i),{autoplay:!1})),c=Ui((h=this.finishedTime)!=null?h:this.time);n.setWithVelocity(l.sample(c-$F).value,l.sample(c).value,$F),l.stop()}}const BF=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ul.test(e)||e==="0")&&!e.startsWith("url("));function Mle(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Dle(e,t,n,r){const a=e[0];if(a===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],i=BF(a,t),l=BF(s,t);return!i||!l?!1:Mle(e)||(n==="spring"||PY(n))&&r}const Ple=new Set(["opacity","clipPath","filter","transform"]),kle=Q1(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function jle(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:a,damping:s,type:i}=e;if(!t||!t.owner||!(t.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=t.owner.getProps();return kle()&&n&&Ple.has(n)&&(n!=="transform"||!c)&&!l&&!r&&a!=="mirror"&&s!==0&&i!=="inertia"}const Ule=40;class Fle extends lL{constructor(p){var g=p,{autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:a=0,repeatDelay:s=0,repeatType:i="loop",keyframes:l,name:c,motionValue:u,element:h}=g,m=Tn(g,["autoplay","delay","type","repeat","repeatDelay","repeatType","keyframes","name","motionValue","element"]);var b;super(),this.stop=()=>{var x,R;this._animation&&(this._animation.stop(),(x=this.stopTimeline)==null||x.call(this)),(R=this.keyframeResolver)==null||R.cancel()},this.createdAt=ss.now();const T=q({autoplay:t,delay:n,type:r,repeat:a,repeatDelay:s,repeatType:i,name:c,motionValue:u,element:h},m),y=(h==null?void 0:h.KeyframeResolver)||uL;this.keyframeResolver=new y(l,(x,R,A)=>this.onKeyframesResolved(x,R,T,!A),c,u,h),(b=this.keyframeResolver)==null||b.scheduleResolve()}onKeyframesResolved(t,n,r,a){this.keyframeResolver=void 0;const{name:s,type:i,velocity:l,delay:c,isHandoff:u,onUpdate:h}=r;this.resolvedAt=ss.now(),Dle(t,s,i,l)||((Po.instantAnimations||!c)&&(h==null||h(oL(t,r,n))),t[0]=t[t.length-1],r.duration=0,r.repeat=0);const m=a?this.resolvedAt?this.resolvedAt-this.createdAt>Ule?this.resolvedAt:this.createdAt:this.createdAt:void 0,p=he(q({startTime:m,finalKeyframe:n},r),{keyframes:t}),g=!u&&jle(p)?new Lle(he(q({},p),{element:p.motionValue.owner.current})):new cL(p);g.finished.then(()=>this.notifyFinished()).catch(zs),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Sle()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const $le=new RegExp("^var\\(--(?:([\\w-]+)|([\\w-]+), ?([a-zA-Z\\d ()%#.,-]+))\\)","u");function Ble(e){const t=$le.exec(e);if(!t)return[,];const[,n,r,a]=t;return["--".concat(n!=null?n:r),a]}function jY(e,t,n=1){const[r,a]=Ble(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const i=s.trim();return iY(i)?parseFloat(i):i}return nL(a)?jY(a,t,n+1):a}function dL(e,t){var n,r;return(r=(n=e==null?void 0:e[t])!=null?n:e==null?void 0:e.default)!=null?r:e}const UY=new Set(["width","height","top","left","right","bottom",...Wh]),Hle={test:e=>e==="auto",parse:e=>e},FY=e=>t=>t.test(e),$Y=[Yh,$t,$i,Rl,Moe,Loe,Hle],HF=e=>$Y.find(FY(e));function Vle(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||oY(e):!0}const Gle=new Set(["brightness","contrast","saturate","opacity"]);function zle(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(rL)||[];if(!r)return e;const a=n.replace(r,"");let s=Gle.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+a+")"}const qle=new RegExp("\\b([a-z-]*)\\(.*?\\)","gu"),tO=he(q({},Ul),{getAnimatableNone:e=>{const t=e.match(qle);return t?t.map(zle).join(" "):e}}),VF=he(q({},Yh),{transform:Math.round}),Yle={rotate:Rl,rotateX:Rl,rotateY:Rl,rotateZ:Rl,scale:AT,scaleX:AT,scaleY:AT,scaleZ:AT,skew:Rl,skewX:Rl,skewY:Rl,distance:$t,translateX:$t,translateY:$t,translateZ:$t,x:$t,y:$t,z:$t,perspective:$t,transformPerspective:$t,opacity:Kp,originX:wF,originY:wF,originZ:$t},hL=he(q({borderWidth:$t,borderTopWidth:$t,borderRightWidth:$t,borderBottomWidth:$t,borderLeftWidth:$t,borderRadius:$t,radius:$t,borderTopLeftRadius:$t,borderTopRightRadius:$t,borderBottomRightRadius:$t,borderBottomLeftRadius:$t,width:$t,maxWidth:$t,height:$t,maxHeight:$t,top:$t,right:$t,bottom:$t,left:$t,padding:$t,paddingTop:$t,paddingRight:$t,paddingBottom:$t,paddingLeft:$t,margin:$t,marginTop:$t,marginRight:$t,marginBottom:$t,marginLeft:$t,backgroundPositionX:$t,backgroundPositionY:$t},Yle),{zIndex:VF,fillOpacity:Kp,strokeOpacity:Kp,numOctaves:VF}),Wle=he(q({},hL),{color:Ra,backgroundColor:Ra,outlineColor:Ra,fill:Ra,stroke:Ra,borderColor:Ra,borderTopColor:Ra,borderRightColor:Ra,borderBottomColor:Ra,borderLeftColor:Ra,filter:tO,WebkitFilter:tO}),BY=e=>Wle[e];function HY(e,t){let n=BY(e);return n!==tO&&(n=Ul),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Xle=new Set(["auto","none","0"]);function Kle(e,t,n){let r=0,a;for(;r<e.length&&!a;){const s=e[r];typeof s=="string"&&!Xle.has(s)&&Qp(s).values.length&&(a=e[r]),r++}if(a&&n)for(const s of t)e[s]=HY(n,a)}class Qle extends uL{constructor(t,n,r,a,s){super(t,n,r,a,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c<t.length;c++){let u=t[c];if(typeof u=="string"&&(u=u.trim(),nL(u))){const h=jY(u,n.current);h!==void 0&&(t[c]=h),c===t.length-1&&(this.finalKeyframe=u)}}if(this.resolveNoneKeyframes(),!UY.has(r)||t.length!==2)return;const[a,s]=t,i=HF(a),l=HF(s);if(i!==l)if(UF(i)&&UF(l))for(let c=0;c<t.length;c++){const u=t[c];typeof u=="string"&&(t[c]=parseFloat(u))}else tu[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let a=0;a<t.length;a++)(t[a]===null||Vle(t[a]))&&r.push(a);r.length&&Kle(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=tu[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const a=n[n.length-1];a!==void 0&&t.getValue(r,a).jump(a,!1)}measureEndState(){var l;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const a=t.getValue(n);a&&a.jump(this.measuredOrigin,!1);const s=r.length-1,i=r[s];r[s]=tu[n](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{t.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function Jle(e,t,n){var r;if(e instanceof EventTarget)return[e];if(typeof e=="string"){let a=document;const s=(r=n==null?void 0:n[e])!=null?r:a.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}const GF=30,Zle=e=>!isNaN(parseFloat(e));class ece{constructor(t,n={}){this.version="__VERSION__",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,a=!0)=>{var i,l;const s=ss.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const c of this.dependents)c.dirty();a&&((l=this.events.renderRequest)==null||l.notify(this.current))},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=ss.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Zle(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new J1);const r=this.events[t].add(n);return t==="change"?()=>{r(),Er.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=ss.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>GF)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,GF);return lY(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Rh(e,t){return new ece(e,t)}const VY=(e,t)=>t&&typeof e=="number"?t.transform(e):e,{schedule:fL}=yY(queueMicrotask,!1),li={x:!1,y:!1};function GY(){return li.x||li.y}function tce(e){return e==="x"||e==="y"?li[e]?null:(li[e]=!0,()=>{li[e]=!1}):li.x||li.y?null:(li.x=li.y=!0,()=>{li.x=li.y=!1})}function zY(e,t){const n=Jle(e),r=new AbortController,a=he(q({passive:!0},t),{signal:r.signal});return[n,a,()=>r.abort()]}function zF(e){return!(e.pointerType==="touch"||GY())}function nce(e,t,n={}){const[r,a,s]=zY(e,n),i=l=>{if(!zF(l))return;const{target:c}=l,u=t(c,l);if(typeof u!="function"||!c)return;const h=m=>{zF(m)&&(u(m),c.removeEventListener("pointerleave",h))};c.addEventListener("pointerleave",h,a)};return r.forEach(l=>{l.addEventListener("pointerenter",i,a)}),s}const qY=(e,t)=>t?e===t?!0:qY(e,t.parentElement):!1,mL=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,rce=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function ace(e){return rce.has(e.tagName)||e.tabIndex!==-1}const ry=new WeakSet;function qF(e){return t=>{t.key==="Enter"&&e(t)}}function mA(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const sce=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=qF(()=>{if(ry.has(n))return;mA(n,"down");const a=qF(()=>{mA(n,"up")}),s=()=>mA(n,"cancel");n.addEventListener("keyup",a,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function YF(e){return mL(e)&&!GY()}function ice(e,t,n={}){const[r,a,s]=zY(e,n),i=l=>{const c=l.currentTarget;if(!YF(l))return;ry.add(c);const u=t(c,l),h=(g,T)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",p),ry.has(c)&&ry.delete(c),YF(g)&&typeof u=="function"&&u(g,{success:T})},m=g=>{h(g,c===window||c===document||n.useGlobalTarget||qY(c,g.target))},p=g=>{h(g,!1)};window.addEventListener("pointerup",m,a),window.addEventListener("pointercancel",p,a)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",i,a),l instanceof HTMLElement&&(l.addEventListener("focus",u=>sce(u,a)),!ace(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),s}const oce=[...$Y,Ra,Ul],lce=e=>oce.find(FY(e)),YY=v.createContext({strict:!1}),WF={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Nh={};for(const e in WF)Nh[e]={isEnabled:t=>WF[e].some(n=>!!t[n])};function cce(e){for(const t in e)Nh[t]=q(q({},Nh[t]),e[t])}const uce=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Uy(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||uce.has(e)}let WY=e=>!Uy(e);function dce(e){e&&(WY=t=>t.startsWith("on")?!Uy(t):e(t))}try{dce(require("@emotion/is-prop-valid").default)}catch(e){}function hce(e,t,n){const r={};for(const a in e)a==="values"&&typeof e.values=="object"||(WY(a)||n===!0&&Uy(a)||!t&&!Uy(a)||e.draggable&&a.startsWith("onDrag"))&&(r[a]=e[a]);return r}function fce(e){if(typeof Proxy=="undefined")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,a)=>a==="create"?e:(t.has(a)||t.set(a,e(a)),t.get(a))})}const j0=v.createContext({});function U0(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Jp(e){return typeof e=="string"||Array.isArray(e)}const pL=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],gL=["initial",...pL];function F0(e){return U0(e.animate)||gL.some(t=>Jp(e[t]))}function XY(e){return!!(F0(e)||e.variants)}function mce(e,t){if(F0(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Jp(n)?n:void 0,animate:Jp(r)?r:void 0}}return e.inherit!==!1?t:{}}function pce(e){const{initial:t,animate:n}=mce(e,v.useContext(j0));return v.useMemo(()=>({initial:t,animate:n}),[XF(t),XF(n)])}function XF(e){return Array.isArray(e)?e.join(" "):e}const gce=Symbol.for("motionComponentSymbol");function Zd(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Ece(e,t,n){return v.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Zd(n)&&(n.current=r))},[t])}const EL=e=>e.replace(new RegExp("([a-z])([A-Z])","gu"),"$1-$2").toLowerCase(),Tce="framerAppearId",KY="data-"+EL(Tce),QY=v.createContext({});function yce(e,t,n,r,a){var y,b;const{visualElement:s}=v.useContext(j0),i=v.useContext(YY),l=v.useContext(k0),c=v.useContext(Y1).reducedMotion,u=v.useRef(null);r=r||i.renderer,!u.current&&r&&(u.current=r(e,{visualState:t,parent:s,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const h=u.current,m=v.useContext(QY);h&&!h.projection&&a&&(h.type==="html"||h.type==="svg")&&xce(u.current,n,a,m);const p=v.useRef(!1);v.useInsertionEffect(()=>{h&&p.current&&h.update(n,l)});const g=n[KY],T=v.useRef(!!g&&!((y=window.MotionHandoffIsComplete)!=null&&y.call(window,g))&&((b=window.MotionHasOptimisedAnimation)==null?void 0:b.call(window,g)));return aY(()=>{h&&(p.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),fL.render(h.render),T.current&&h.animationState&&h.animationState.animateChanges())}),v.useEffect(()=>{h&&(!T.current&&h.animationState&&h.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var x;(x=window.MotionHandoffMarkAsComplete)==null||x.call(window,g)}),T.current=!1))}),h}function xce(e,t,n,r){const{layoutId:a,layout:s,drag:i,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:JY(e.parent)),e.projection.setOptions({layoutId:a,layout:s,alwaysMeasureLayout:!!i||l&&Zd(l),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:c,layoutRoot:u})}function JY(e){if(e)return e.options.allowProjection!==!1?e.projection:JY(e.parent)}function Sce({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:a}){var l,c;e&&cce(e);function s(u,h){let m;const p=he(q(q({},v.useContext(Y1)),u),{layoutId:bce(u)}),{isStatic:g}=p,T=pce(u),y=r(u,g);if(!g&&q1){vce();const b=Ace(p);m=b.MeasureLayout,T.visualElement=yce(a,y,p,t,b.ProjectionNode)}return o.jsxs(j0.Provider,{value:T,children:[m&&T.visualElement?o.jsx(m,q({visualElement:T.visualElement},p)):null,n(a,u,Ece(y,T.visualElement,h),y,g,T.visualElement)]})}s.displayName="motion.".concat(typeof a=="string"?a:"create(".concat((c=(l=a.displayName)!=null?l:a.name)!=null?c:"",")"));const i=v.forwardRef(s);return i[gce]=a,i}function bce({layoutId:e}){const t=v.useContext(G1).id;return t&&e!==void 0?t+"-"+e:e}function vce(e,t){v.useContext(YY).strict}function Ace(e){const{drag:t,layout:n}=Nh;if(!t&&!n)return{};const r=q(q({},t),n);return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const Zp={};function Rce(e){for(const t in e)Zp[t]=e[t],tL(t)&&(Zp[t].isCSSVariable=!0)}function ZY(e,{layout:t,layoutId:n}){return Xh.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Zp[e]||e==="opacity")}const wa=e=>!!(e&&e.getVelocity),Nce={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},_ce=Wh.length;function wce(e,t,n){let r="",a=!0;for(let s=0;s<_ce;s++){const i=Wh[s],l=e[i];if(l===void 0)continue;let c=!0;if(typeof l=="number"?c=l===(i.startsWith("scale")?1:0):c=parseFloat(l)===0,!c||n){const u=VY(l,hL[i]);if(!c){a=!1;const h=Nce[i]||i;r+="".concat(h,"(").concat(u,") ")}n&&(t[i]=u)}}return r=r.trim(),n?r=n(t,a?"":r):a&&(r="none"),r}function TL(e,t,n){const{style:r,vars:a,transformOrigin:s}=e;let i=!1,l=!1;for(const c in t){const u=t[c];if(Xh.has(c)){i=!0;continue}else if(tL(c)){a[c]=u;continue}else{const h=VY(u,hL[c]);c.startsWith("origin")?(l=!0,s[c]=h):r[c]=h}}if(t.transform||(i||n?r.transform=wce(t,e.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:h=0}=s;r.transformOrigin="".concat(c," ").concat(u," ").concat(h)}}const yL=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function eW(e,t,n){for(const r in t)!wa(t[r])&&!ZY(r,n)&&(e[r]=t[r])}function Cce({transformTemplate:e},t){return v.useMemo(()=>{const n=yL();return TL(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Ice(e,t){const n=e.style||{},r={};return eW(r,n,e),Object.assign(r,Cce(e,t)),r}function Oce(e,t){const n={},r=Ice(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":"pan-".concat(e.drag==="x"?"y":"x")),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}const Lce=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function xL(e){return typeof e!="string"||e.includes("-")?!1:!!(Lce.indexOf(e)>-1||new RegExp("[A-Z]","u").test(e))}const Mce={offset:"stroke-dashoffset",array:"stroke-dasharray"},Dce={offset:"strokeDashoffset",array:"strokeDasharray"};function Pce(e,t,n=1,r=0,a=!0){e.pathLength=1;const s=a?Mce:Dce;e[s.offset]=$t.transform(-r);const i=$t.transform(t),l=$t.transform(n);e[s.array]="".concat(i," ").concat(l)}function tW(e,m,c,u,h){var p=m,{attrX:t,attrY:n,attrScale:r,pathLength:a,pathSpacing:s=1,pathOffset:i=0}=p,l=Tn(p,["attrX","attrY","attrScale","pathLength","pathSpacing","pathOffset"]);var y,b;if(TL(e,l,u),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:g,style:T}=e;g.transform&&(T.transform=g.transform,delete g.transform),(T.transform||g.transformOrigin)&&(T.transformOrigin=(y=g.transformOrigin)!=null?y:"50% 50%",delete g.transformOrigin),T.transform&&(T.transformBox=(b=h==null?void 0:h.transformBox)!=null?b:"fill-box",delete g.transformBox),t!==void 0&&(g.x=t),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),a!==void 0&&Pce(g,a,s,i,!1)}const nW=()=>he(q({},yL()),{attrs:{}}),rW=e=>typeof e=="string"&&e.toLowerCase()==="svg";function kce(e,t,n,r){const a=v.useMemo(()=>{const s=nW();return tW(s,t,rW(r),e.transformTemplate,e.style),he(q({},s.attrs),{style:q({},s.style)})},[t]);if(e.style){const s={};eW(s,e.style,e),a.style=q(q({},s),a.style)}return a}function jce(e=!1){return(n,r,a,{latestValues:s},i)=>{const c=(xL(n)?kce:Oce)(r,s,i,n),u=hce(r,typeof n=="string",e),h=n!==v.Fragment?he(q(q({},u),c),{ref:a}):{},{children:m}=r,p=v.useMemo(()=>wa(m)?m.get():m,[m]);return v.createElement(n,he(q({},h),{children:p}))}}function KF(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function SL(e,t,n,r){if(typeof t=="function"){const[a,s]=KF(r);t=t(n!==void 0?n:e.custom,a,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[a,s]=KF(r);t=t(n!==void 0?n:e.custom,a,s)}return t}function ay(e){return wa(e)?e.get():e}function Uce({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,a){return{latestValues:Fce(n,r,a,e),renderState:t()}}const aW=e=>(t,n)=>{const r=v.useContext(j0),a=v.useContext(k0),s=()=>Uce(e,t,r,a);return n?s():z1(s)};function Fce(e,t,n,r){const a={},s=r(e,{});for(const g in s)a[g]=ay(s[g]);let{initial:i,animate:l}=e;const c=F0(e),u=XY(e);t&&u&&!c&&e.inherit!==!1&&(i===void 0&&(i=t.initial),l===void 0&&(l=t.animate));let h=n?n.initial===!1:!1;h=h||i===!1;const m=h?l:i;if(m&&typeof m!="boolean"&&!U0(m)){const g=Array.isArray(m)?m:[m];for(let T=0;T<g.length;T++){const y=SL(e,g[T]);if(y){const p=y,{transitionEnd:b,transition:x}=p,R=Tn(p,["transitionEnd","transition"]);for(const A in R){let w=R[A];if(Array.isArray(w)){const _=h?w.length-1:0;w=w[_]}w!==null&&(a[A]=w)}for(const A in b)a[A]=b[A]}}}return a}function bL(e,t,n){var s;const{style:r}=e,a={};for(const i in r)(wa(r[i])||t.style&&wa(t.style[i])||ZY(i,e)||((s=n==null?void 0:n.getValue(i))==null?void 0:s.liveStyle)!==void 0)&&(a[i]=r[i]);return a}const $ce={useVisualState:aW({scrapeMotionValuesFromProps:bL,createRenderState:yL})};function sW(e,t,n){const r=bL(e,t,n);for(const a in e)if(wa(e[a])||wa(t[a])){const s=Wh.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;r[s]=e[a]}return r}const Bce={useVisualState:aW({scrapeMotionValuesFromProps:sW,createRenderState:nW})};function Hce(e,t){return function(r,{forwardMotionProps:a}={forwardMotionProps:!1}){const s=xL(r)?Bce:$ce,i=he(q({},s),{preloadedFeatures:e,useRender:jce(a),createVisualElement:t,Component:r});return Sce(i)}}function eg(e,t,n){const r=e.getProps();return SL(r,t,n!==void 0?n:r.custom,e)}const nO=e=>Array.isArray(e);function Vce(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Rh(n))}function Gce(e){return nO(e)?e[e.length-1]||0:e}function zce(e,t){let i=eg(e,t)||{},{transitionEnd:r={},transition:a={}}=i,s=Tn(i,["transitionEnd","transition"]);s=q(q({},s),r);for(const l in s){const c=Gce(s[l]);Vce(e,l,c)}}function qce(e){return!!(wa(e)&&e.add)}function rO(e,t){const n=e.getValue("willChange");if(qce(n))return n.add(t);if(!n&&Po.WillChange){const r=new Po.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function iW(e){return e.props[KY]}const Yce=e=>e!==null;function Wce(e,{repeat:t,repeatType:n="loop"},r){const a=e.filter(Yce),s=t&&n!=="loop"&&t%2===1?0:a.length-1;return a[s]}const Xce={type:"spring",stiffness:500,damping:25,restSpeed:10},Kce=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Qce={type:"keyframes",duration:.8},Jce={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Zce=(e,{keyframes:t})=>t.length>2?Qce:Xh.has(e)?e.startsWith("scale")?Kce(t[1]):Xce:Jce;function eue(m){var p=m,{when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:a,repeat:s,repeatType:i,repeatDelay:l,from:c,elapsed:u}=p,h=Tn(p,["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);return!!Object.keys(h).length}const vL=(e,t,n,r={},a,s)=>i=>{const l=dL(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Ui(c);const h=he(q({keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity()},l),{delay:-u,onUpdate:p=>{t.set(p),l.onUpdate&&l.onUpdate(p)},onComplete:()=>{i(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:s?void 0:a});eue(l)||Object.assign(h,Zce(e,h)),h.duration&&(h.duration=Ui(h.duration)),h.repeatDelay&&(h.repeatDelay=Ui(h.repeatDelay)),h.from!==void 0&&(h.keyframes[0]=h.from);let m=!1;if((h.type===!1||h.duration===0&&!h.repeatDelay)&&(h.duration=0,h.delay===0&&(m=!0)),(Po.instantAnimations||Po.skipAnimations)&&(m=!0,h.duration=0,h.delay=0),h.allowFlatten=!l.type&&!l.ease,m&&!s&&t.get()!==void 0){const p=Wce(h.keyframes,l);if(p!==void 0){Er.update(()=>{h.onUpdate(p),h.onComplete()});return}}return l.isSync?new cL(h):new Fle(h)};function tue({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function oW(e,t,{delay:n=0,transitionOverride:r,type:a}={}){var m;let h=t,{transition:s=e.getDefaultTransition(),transitionEnd:i}=h,l=Tn(h,["transition","transitionEnd"]);r&&(s=r);const c=[],u=a&&e.animationState&&e.animationState.getState()[a];for(const p in l){const g=e.getValue(p,(m=e.latestValues[p])!=null?m:null),T=l[p];if(T===void 0||u&&tue(u,p))continue;const y=q({delay:n},dL(s||{},p)),b=g.get();if(b!==void 0&&!g.isAnimating&&!Array.isArray(T)&&T===b&&!y.velocity)continue;let x=!1;if(window.MotionHandoffAnimation){const A=iW(e);if(A){const w=window.MotionHandoffAnimation(A,p,Er);w!==null&&(y.startTime=w,x=!0)}}rO(e,p),g.start(vL(p,g,T,e.shouldReduceMotion&&UY.has(p)?{type:!1}:y,e,x));const R=g.animation;R&&c.push(R)}return i&&Promise.all(c).then(()=>{Er.update(()=>{i&&zce(e,i)})}),c}function aO(e,t,n={}){var c;const r=eg(e,t,n.type==="exit"?(c=e.presenceContext)==null?void 0:c.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(a=n.transitionOverride);const s=r?()=>Promise.all(oW(e,r,n)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:h=0,staggerChildren:m,staggerDirection:p}=a;return nue(e,t,h+u,m,p,n)}:()=>Promise.resolve(),{when:l}=a;if(l){const[u,h]=l==="beforeChildren"?[s,i]:[i,s];return u().then(()=>h())}else return Promise.all([s(),i(n.delay)])}function nue(e,t,n=0,r=0,a=1,s){const i=[],l=(e.variantChildren.size-1)*r,c=a===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(rue).forEach((u,h)=>{u.notify("AnimationStart",t),i.push(aO(u,t,he(q({},s),{delay:n+c(h)})).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(i)}function rue(e,t){return e.sortNodePosition(t)}function aue(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const a=t.map(s=>aO(e,s,n));r=Promise.all(a)}else if(typeof t=="string")r=aO(e,t,n);else{const a=typeof t=="function"?eg(e,t,n.custom):t;r=Promise.all(oW(e,a,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}function lW(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const sue=gL.length;function cW(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?cW(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<sue;n++){const r=gL[n],a=e.props[r];(Jp(a)||a===!1)&&(t[r]=a)}return t}const iue=[...pL].reverse(),oue=pL.length;function lue(e){return t=>Promise.all(t.map(({animation:n,options:r})=>aue(e,n,r)))}function cue(e){let t=lue(e),n=QF(),r=!0;const a=c=>(u,h)=>{var p;const m=eg(e,h,c==="exit"?(p=e.presenceContext)==null?void 0:p.custom:void 0);if(m){const g=m,{transition:T,transitionEnd:y}=g,b=Tn(g,["transition","transitionEnd"]);u=q(q(q({},u),b),y)}return u};function s(c){t=c(e)}function i(c){const{props:u}=e,h=cW(e.parent)||{},m=[],p=new Set;let g={},T=1/0;for(let b=0;b<oue;b++){const x=iue[b],R=n[x],A=u[x]!==void 0?u[x]:h[x],w=Jp(A),_=x===c?R.isActive:null;_===!1&&(T=b);let N=A===h[x]&&A!==u[x]&&w;if(N&&r&&e.manuallyAnimateOnMount&&(N=!1),R.protectedKeys=q({},g),!R.isActive&&_===null||!A&&!R.prevProp||U0(A)||typeof A=="boolean")continue;const I=uue(R.prevProp,A);let D=I||x===c&&R.isActive&&!N&&w||b>T&&w,M=!1;const O=Array.isArray(A)?A:[A];let L=O.reduce(a(x),{});_===!1&&(L={});const{prevResolvedValues:k={}}=R,F=q(q({},k),L),U=G=>{D=!0,p.has(G)&&(M=!0,p.delete(G)),R.needsAnimating[G]=!0;const K=e.getValue(G);K&&(K.liveStyle=!1)};for(const G in F){const K=L[G],J=k[G];if(g.hasOwnProperty(G))continue;let $=!1;nO(K)&&nO(J)?$=!lW(K,J):$=K!==J,$?K!=null?U(G):p.add(G):K!==void 0&&p.has(G)?U(G):R.protectedKeys[G]=!0}R.prevProp=A,R.prevResolvedValues=L,R.isActive&&(g=q(q({},g),L)),r&&e.blockInitialAnimation&&(D=!1),D&&(!(N&&I)||M)&&m.push(...O.map(G=>({animation:G,options:{type:x}})))}if(p.size){const b={};if(typeof u.initial!="boolean"){const x=eg(e,Array.isArray(u.initial)?u.initial[0]:u.initial);x&&x.transition&&(b.transition=x.transition)}p.forEach(x=>{const R=e.getBaseTarget(x),A=e.getValue(x);A&&(A.liveStyle=!0),b[x]=R!=null?R:null}),m.push({animation:b})}let y=!!m.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(y=!1),r=!1,y?t(m):Promise.resolve()}function l(c,u){var m;if(n[c].isActive===u)return Promise.resolve();(m=e.variantChildren)==null||m.forEach(p=>{var g;return(g=p.animationState)==null?void 0:g.setActive(c,u)}),n[c].isActive=u;const h=i(c);for(const p in n)n[p].protectedKeys={};return h}return{animateChanges:i,setActive:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=QF(),r=!0}}}function uue(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!lW(t,e):!1}function wc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function QF(){return{animate:wc(!0),whileInView:wc(),whileHover:wc(),whileTap:wc(),whileDrag:wc(),whileFocus:wc(),exit:wc()}}class Zl{constructor(t){this.isMounted=!1,this.node=t}update(){}}class due extends Zl{constructor(t){super(t),t.animationState||(t.animationState=cue(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();U0(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let hue=0;class fue extends Zl{constructor(){super(...arguments),this.id=hue++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const a=this.node.animationState.setActive("exit",!t);n&&!t&&a.then(()=>{n(this.id)})}mount(){const{register:t,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const mue={animation:{Feature:due},exit:{Feature:fue}};function tg(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Mg(e){return{point:{x:e.pageX,y:e.pageY}}}const pue=e=>t=>mL(t)&&e(t,Mg(t));function Rp(e,t,n,r){return tg(e,t,pue(n),r)}function uW({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function gue({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Eue(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}const dW=1e-4,Tue=1-dW,yue=1+dW,hW=.01,xue=0-hW,Sue=0+hW;function Va(e){return e.max-e.min}function bue(e,t,n){return Math.abs(e-t)<=n}function JF(e,t,n,r=.5){e.origin=r,e.originPoint=gr(t.min,t.max,e.origin),e.scale=Va(n)/Va(t),e.translate=gr(n.min,n.max,e.origin)-e.originPoint,(e.scale>=Tue&&e.scale<=yue||isNaN(e.scale))&&(e.scale=1),(e.translate>=xue&&e.translate<=Sue||isNaN(e.translate))&&(e.translate=0)}function Np(e,t,n,r){JF(e.x,t.x,n.x,r?r.originX:void 0),JF(e.y,t.y,n.y,r?r.originY:void 0)}function ZF(e,t,n){e.min=n.min+t.min,e.max=e.min+Va(t)}function vue(e,t,n){ZF(e.x,t.x,n.x),ZF(e.y,t.y,n.y)}function e5(e,t,n){e.min=t.min-n.min,e.max=e.min+Va(t)}function _p(e,t,n){e5(e.x,t.x,n.x),e5(e.y,t.y,n.y)}const t5=()=>({translate:0,scale:1,origin:0,originPoint:0}),eh=()=>({x:t5(),y:t5()}),n5=()=>({min:0,max:0}),_r=()=>({x:n5(),y:n5()});function Ds(e){return[e("x"),e("y")]}function pA(e){return e===void 0||e===1}function sO({scale:e,scaleX:t,scaleY:n}){return!pA(e)||!pA(t)||!pA(n)}function Uc(e){return sO(e)||fW(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function fW(e){return r5(e.x)||r5(e.y)}function r5(e){return e&&e!=="0%"}function Fy(e,t,n){const r=e-n,a=t*r;return n+a}function a5(e,t,n,r,a){return a!==void 0&&(e=Fy(e,a,r)),Fy(e,n,r)+t}function iO(e,t=0,n=1,r,a){e.min=a5(e.min,t,n,r,a),e.max=a5(e.max,t,n,r,a)}function mW(e,{x:t,y:n}){iO(e.x,t.translate,t.scale,t.originPoint),iO(e.y,n.translate,n.scale,n.originPoint)}const s5=.999999999999,i5=1.0000000000001;function Aue(e,t,n,r=!1){const a=n.length;if(!a)return;t.x=t.y=1;let s,i;for(let l=0;l<a;l++){s=n[l],i=s.projectionDelta;const{visualElement:c}=s.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&nh(e,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,mW(e,i)),r&&Uc(s.latestValues)&&nh(e,s.latestValues))}t.x<i5&&t.x>s5&&(t.x=1),t.y<i5&&t.y>s5&&(t.y=1)}function th(e,t){e.min=e.min+t,e.max=e.max+t}function o5(e,t,n,r,a=.5){const s=gr(e.min,e.max,a);iO(e,t,n,s,r)}function nh(e,t){o5(e.x,t.x,t.scaleX,t.scale,t.originX),o5(e.y,t.y,t.scaleY,t.scale,t.originY)}function pW(e,t){return uW(Eue(e.getBoundingClientRect(),t))}function Rue(e,t,n){const r=pW(e,n),{scroll:a}=t;return a&&(th(r.x,a.offset.x),th(r.y,a.offset.y)),r}const gW=({current:e})=>e?e.ownerDocument.defaultView:null,l5=(e,t)=>Math.abs(e-t);function Nue(e,t){const n=l5(e.x,t.x),r=l5(e.y,t.y);return Math.sqrt(cm(n,2)+cm(r,2))}class EW{constructor(t,n,{transformPagePoint:r,contextWindow:a,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=EA(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=Nue(m.offset,{x:0,y:0})>=3;if(!p&&!g)return;const{point:T}=m,{timestamp:y}=da;this.history.push(he(q({},T),{timestamp:y}));const{onStart:b,onMove:x}=this.handlers;p||(b&&b(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,m)},this.handlePointerMove=(m,p)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=gA(p,this.transformPagePoint),Er.update(this.updatePoint,!0)},this.handlePointerUp=(m,p)=>{this.end();const{onEnd:g,onSessionEnd:T,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=EA(m.type==="pointercancel"?this.lastMoveEventInfo:gA(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(m,b),T&&T(m,b)},!mL(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=a||window;const i=Mg(t),l=gA(i,this.transformPagePoint),{point:c}=l,{timestamp:u}=da;this.history=[he(q({},c),{timestamp:u})];const{onSessionStart:h}=n;h&&h(t,EA(l,this.history)),this.removeListeners=Ig(Rp(this.contextWindow,"pointermove",this.handlePointerMove),Rp(this.contextWindow,"pointerup",this.handlePointerUp),Rp(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),jl(this.updatePoint)}}function gA(e,t){return t?{point:t(e.point)}:e}function c5(e,t){return{x:e.x-t.x,y:e.y-t.y}}function EA({point:e},t){return{point:e,delta:c5(e,TW(t)),offset:c5(e,_ue(t)),velocity:wue(t,.1)}}function _ue(e){return e[0]}function TW(e){return e[e.length-1]}function wue(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const a=TW(e);for(;n>=0&&(r=e[n],!(a.timestamp-r.timestamp>Ui(t)));)n--;if(!r)return{x:0,y:0};const s=Fi(a.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const i={x:(a.x-r.x)/s,y:(a.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function Cue(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?gr(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?gr(n,e,r.max):Math.min(e,n)),e}function u5(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function Iue(e,{top:t,left:n,bottom:r,right:a}){return{x:u5(e.x,n,a),y:u5(e.y,t,r)}}function d5(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function Oue(e,t){return{x:d5(e.x,t.x),y:d5(e.y,t.y)}}function Lue(e,t){let n=.5;const r=Va(e),a=Va(t);return a>r?n=Xp(t.min,t.max-r,e.min):r>a&&(n=Xp(e.min,e.max-a,t.min)),Do(0,1,n)}function Mue(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const oO=.35;function Due(e=oO){return e===!1?e=0:e===!0&&(e=oO),{x:h5(e,"left","right"),y:h5(e,"top","bottom")}}function h5(e,t,n){return{min:f5(e,t),max:f5(e,n)}}function f5(e,t){return typeof e=="number"?e:e[t]||0}const Pue=new WeakMap;class kue{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_r(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const a=h=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Mg(h).point)},s=(h,m)=>{const{drag:p,dragPropagation:g,onDragStart:T}=this.getProps();if(p&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=tce(p),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ds(b=>{let x=this.getAxisMotionValue(b).get()||0;if($i.test(x)){const{projection:R}=this.visualElement;if(R&&R.layout){const A=R.layout.layoutBox[b];A&&(x=Va(A)*(parseFloat(x)/100))}}this.originPoint[b]=x}),T&&Er.postRender(()=>T(h,m)),rO(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},i=(h,m)=>{const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:T,onDrag:y}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:b}=m;if(g&&this.currentDirection===null){this.currentDirection=jue(b),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),y&&y(h,m)},l=(h,m)=>this.stop(h,m),c=()=>Ds(h=>{var m;return this.getAnimationState(h)==="paused"&&((m=this.getAxisMotionValue(h).animation)==null?void 0:m.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new EW(t,{onSessionStart:a,onStart:s,onMove:i,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:gW(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:a}=n;this.startAnimation(a);const{onDragEnd:s}=this.getProps();s&&Er.postRender(()=>s(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:a}=this.getProps();if(!r||!RT(t,a,this.currentDirection))return;const s=this.getAxisMotionValue(t);let i=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(i=Cue(i,this.constraints[t],this.elastic[t])),s.set(i)}resolveConstraints(){var s;const{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,a=this.constraints;t&&Zd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=Iue(r.layoutBox,t):this.constraints=!1,this.elastic=Due(n),a!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ds(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=Mue(r.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Zd(t))return!1;const r=t.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const s=Rue(r,a.root,this.visualElement.getTransformPagePoint());let i=Oue(a.layout.layoutBox,s);if(n){const l=n(gue(i));this.hasMutatedConstraints=!!l,l&&(i=uW(l))}return i}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:a,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Ds(h=>{if(!RT(h,n,this.currentDirection))return;let m=c&&c[h]||{};i&&(m={min:0,max:0});const p=a?200:1e6,g=a?40:1e7,T=q(q({type:"inertia",velocity:r?t[h]:0,bounceStiffness:p,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10},s),m);return this.startAxisValueAnimation(h,T)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return rO(this.visualElement,t),r.start(vL(t,r,0,n,this.visualElement,!1))}stopAnimation(){Ds(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){Ds(t=>{var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)==null?void 0:n.state}getAxisMotionValue(t){const n="_drag".concat(t.toUpperCase()),r=this.visualElement.getProps(),a=r[n];return a||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Ds(n=>{const{drag:r}=this.getProps();if(!RT(n,r,this.currentDirection))return;const{projection:a}=this.visualElement,s=this.getAxisMotionValue(n);if(a&&a.layout){const{min:i,max:l}=a.layout.layoutBox[n];s.set(t[n]-gr(i,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Zd(n)||!r||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};Ds(i=>{const l=this.getAxisMotionValue(i);if(l&&this.constraints!==!1){const c=l.get();a[i]=Lue({min:c,max:c},this.constraints[i])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ds(i=>{if(!RT(i,t,null))return;const l=this.getAxisMotionValue(i),{min:c,max:u}=this.constraints[i];l.set(gr(c,u,a[i]))})}addListeners(){if(!this.visualElement.current)return;Pue.set(this.visualElement,this);const t=this.visualElement.current,n=Rp(t,"pointerdown",c=>{const{drag:u,dragListener:h=!0}=this.getProps();u&&h&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Zd(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,s=a.addEventListener("measure",r);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),Er.read(r);const i=tg(window,"resize",()=>this.scalePositionWithinConstraints()),l=a.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(Ds(h=>{const m=this.getAxisMotionValue(h);m&&(this.originPoint[h]+=c[h].translate,m.set(m.get()+c[h].translate))}),this.visualElement.render())});return()=>{i(),n(),s(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:a=!1,dragConstraints:s=!1,dragElastic:i=oO,dragMomentum:l=!0}=t;return he(q({},t),{drag:n,dragDirectionLock:r,dragPropagation:a,dragConstraints:s,dragElastic:i,dragMomentum:l})}}function RT(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function jue(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Uue extends Zl{constructor(t){super(t),this.removeGroupControls=zs,this.removeListeners=zs,this.controls=new kue(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||zs}unmount(){this.removeGroupControls(),this.removeListeners()}}const m5=e=>(t,n)=>{e&&Er.postRender(()=>e(t,n))};class Fue extends Zl{constructor(){super(...arguments),this.removePointerDownListener=zs}onPointerDown(t){this.session=new EW(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:gW(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:a}=this.node.getProps();return{onSessionStart:m5(t),onStart:m5(n),onMove:r,onEnd:(s,i)=>{delete this.session,a&&Er.postRender(()=>a(s,i))}}}mount(){this.removePointerDownListener=Rp(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const sy={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function p5(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Sm={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if($t.test(e))e=parseFloat(e);else return e;const n=p5(e,t.target.x),r=p5(e,t.target.y);return"".concat(n,"% ").concat(r,"%")}},$ue={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,a=Ul.parse(e);if(a.length>5)return r;const s=Ul.createTransformer(e),i=typeof a[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;a[0+i]/=l,a[1+i]/=c;const u=gr(l,c,.5);return typeof a[2+i]=="number"&&(a[2+i]/=u),typeof a[3+i]=="number"&&(a[3+i]/=u),s(a)}};class Bue extends v.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:a}=this.props,{projection:s}=t;Rce(Hue),s&&(n.group&&n.group.add(s),r&&r.register&&a&&r.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions(he(q({},s.options),{onExitComplete:()=>this.safeToRemove()}))),sy.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:a,isPresent:s}=this.props,{projection:i}=r;return i&&(i.isPresent=s,a||t.layoutDependency!==n||n===void 0||t.isPresent!==s?i.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?i.promote():i.relegate()||Er.postRender(()=>{const l=i.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),fL.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:a}=t;a&&(a.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(a),r&&r.deregister&&r.deregister(a))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function yW(e){const[t,n]=sY(),r=v.useContext(G1);return o.jsx(Bue,he(q({},e),{layoutGroup:r,switchLayoutGroup:v.useContext(QY),isPresent:t,safeToRemove:n}))}const Hue={borderRadius:he(q({},Sm),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:Sm,borderTopRightRadius:Sm,borderBottomLeftRadius:Sm,borderBottomRightRadius:Sm,boxShadow:$ue};function Vue(e,t,n){const r=wa(e)?e:Rh(e);return r.start(vL("",r,t,n)),r.animation}function Gue(e){return e instanceof SVGElement&&e.tagName!=="svg"}const zue=(e,t)=>e.depth-t.depth;class que{constructor(){this.children=[],this.isDirty=!1}add(t){W1(this.children,t),this.isDirty=!0}remove(t){X1(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(zue),this.isDirty=!1,this.children.forEach(t)}}function Yue(e,t){const n=ss.now(),r=({timestamp:a})=>{const s=a-n;s>=t&&(jl(r),e(s-t))};return Er.setup(r,!0),()=>jl(r)}const xW=["TopLeft","TopRight","BottomLeft","BottomRight"],Wue=xW.length,g5=e=>typeof e=="string"?parseFloat(e):e,E5=e=>typeof e=="number"||$t.test(e);function Xue(e,t,n,r,a,s){var i,l,c,u;a?(e.opacity=gr(0,(i=n.opacity)!=null?i:1,Kue(r)),e.opacityExit=gr((l=t.opacity)!=null?l:1,0,Que(r))):s&&(e.opacity=gr((c=t.opacity)!=null?c:1,(u=n.opacity)!=null?u:1,r));for(let h=0;h<Wue;h++){const m="border".concat(xW[h],"Radius");let p=T5(t,m),g=T5(n,m);if(p===void 0&&g===void 0)continue;p||(p=0),g||(g=0),p===0||g===0||E5(p)===E5(g)?(e[m]=Math.max(gr(g5(p),g5(g),r),0),($i.test(g)||$i.test(p))&&(e[m]+="%")):e[m]=g}(t.rotate||n.rotate)&&(e.rotate=gr(t.rotate||0,n.rotate||0,r))}function T5(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const Kue=SW(0,.5,pY),Que=SW(.5,.95,zs);function SW(e,t,n){return r=>r<e?0:r>t?1:n(Xp(e,t,r))}function y5(e,t){e.min=t.min,e.max=t.max}function Ms(e,t){y5(e.x,t.x),y5(e.y,t.y)}function x5(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function S5(e,t,n,r,a){return e-=t,e=Fy(e,1/n,r),a!==void 0&&(e=Fy(e,1/a,r)),e}function Jue(e,t=0,n=1,r=.5,a,s=e,i=e){if($i.test(t)&&(t=parseFloat(t),t=gr(i.min,i.max,t/100)-i.min),typeof t!="number")return;let l=gr(s.min,s.max,r);e===s&&(l-=t),e.min=S5(e.min,t,n,l,a),e.max=S5(e.max,t,n,l,a)}function b5(e,t,[n,r,a],s,i){Jue(e,t[n],t[r],t[a],t.scale,s,i)}const Zue=["x","scaleX","originX"],ede=["y","scaleY","originY"];function v5(e,t,n,r){b5(e.x,t,Zue,n?n.x:void 0,r?r.x:void 0),b5(e.y,t,ede,n?n.y:void 0,r?r.y:void 0)}function A5(e){return e.translate===0&&e.scale===1}function bW(e){return A5(e.x)&&A5(e.y)}function R5(e,t){return e.min===t.min&&e.max===t.max}function tde(e,t){return R5(e.x,t.x)&&R5(e.y,t.y)}function N5(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function vW(e,t){return N5(e.x,t.x)&&N5(e.y,t.y)}function _5(e){return Va(e.x)/Va(e.y)}function w5(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class nde{constructor(){this.members=[]}add(t){W1(this.members,t),t.scheduleRender()}remove(t){if(X1(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(a=>t===a);if(n===0)return!1;let r;for(let a=n;a>=0;a--){const s=this.members[a];if(s.isPresent!==!1){r=s;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:a}=t.options;a===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function rde(e,t,n){let r="";const a=e.x.translate/t.x,s=e.y.translate/t.y,i=(n==null?void 0:n.z)||0;if((a||s||i)&&(r="translate3d(".concat(a,"px, ").concat(s,"px, ").concat(i,"px) ")),(t.x!==1||t.y!==1)&&(r+="scale(".concat(1/t.x,", ").concat(1/t.y,") ")),n){const{transformPerspective:u,rotate:h,rotateX:m,rotateY:p,skewX:g,skewY:T}=n;u&&(r="perspective(".concat(u,"px) ").concat(r)),h&&(r+="rotate(".concat(h,"deg) ")),m&&(r+="rotateX(".concat(m,"deg) ")),p&&(r+="rotateY(".concat(p,"deg) ")),g&&(r+="skewX(".concat(g,"deg) ")),T&&(r+="skewY(".concat(T,"deg) "))}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+="scale(".concat(l,", ").concat(c,")")),r||"none"}const TA=["","X","Y","Z"],ade={visibility:"hidden"},sde=1e3;let ide=0;function yA(e,t,n,r){const{latestValues:a}=t;a[e]&&(n[e]=a[e],t.setStaticValue(e,0),r&&(r[e]=0))}function AW(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=iW(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:a,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Er,!(a||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&AW(r)}function RW({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:a}){return class{constructor(i={},l=t==null?void 0:t()){this.id=ide++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(cde),this.nodes.forEach(mde),this.nodes.forEach(pde),this.nodes.forEach(ude)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new que)}addEventListener(i,l){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new J1),this.eventHandlers.get(i).add(l)}notifyListeners(i,...l){const c=this.eventHandlers.get(i);c&&c.notify(...l)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=Gue(i),this.instance=i;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),e){let h;const m=()=>this.root.updateBlockedByResize=!1;e(i,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=Yue(m,250),sy.hasAnimatedSinceResize&&(sy.hasAnimatedSinceResize=!1,this.nodes.forEach(I5))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:m,hasRelativeLayoutChanged:p,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const T=this.options.transition||u.getDefaultTransition()||xde,{onLayoutAnimationStart:y,onLayoutAnimationComplete:b}=u.getProps(),x=!this.targetLayout||!vW(this.targetLayout,g),R=!m&&p;if(this.options.layoutRoot||this.resumeFrom||R||m&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,R);const A=he(q({},dL(T,"layout")),{onPlay:y,onComplete:b});(u.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else m||I5(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),jl(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(gde),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&AW(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h<this.path.length;h++){const m=this.path[h];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(C5);return}this.isUpdating||this.nodes.forEach(hde),this.isUpdating=!1,this.nodes.forEach(fde),this.nodes.forEach(ode),this.nodes.forEach(lde),this.clearAllSnapshots();const l=ss.now();da.delta=Do(0,1e3/60,l-da.timestamp),da.timestamp=l,da.isProcessing=!0,uA.update.process(da),uA.preRender.process(da),uA.render.process(da),da.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,fL.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(dde),this.sharedNodes.forEach(Ede)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Er.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Er.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Va(this.snapshot.measuredBox.x)&&!Va(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected=_r(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!a)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!bW(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,h=u!==this.prevTransformTemplateValue;i&&this.instance&&(l||Uc(this.latestValues)||h)&&(a(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return i&&(c=this.removeTransform(c)),Sde(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:i}=this.options;if(!i)return _r();const l=i.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(bde))){const{scroll:h}=this.root;h&&(th(l.x,h.offset.x),th(l.y,h.offset.y))}return l}removeElementScroll(i){var c;const l=_r();if(Ms(l,i),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const h=this.path[u],{scroll:m,options:p}=h;h!==this.root&&m&&p.layoutScroll&&(m.wasRoot&&Ms(l,i),th(l.x,m.offset.x),th(l.y,m.offset.y))}return l}applyTransform(i,l=!1){const c=_r();Ms(c,i);for(let u=0;u<this.path.length;u++){const h=this.path[u];!l&&h.options.layoutScroll&&h.scroll&&h!==h.root&&nh(c,{x:-h.scroll.offset.x,y:-h.scroll.offset.y}),Uc(h.latestValues)&&nh(c,h.latestValues)}return Uc(this.latestValues)&&nh(c,this.latestValues),c}removeTransform(i){const l=_r();Ms(l,i);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!Uc(u.latestValues))continue;sO(u.latestValues)&&u.updateSnapshot();const h=_r(),m=u.measurePageBox();Ms(h,m),v5(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,h)}return Uc(this.latestValues)&&v5(l,this.latestValues),l}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options=he(q(q({},this.options),i),{crossfade:i.crossfade!==void 0?i.crossfade:!0})}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==da.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var p;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(i||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:m}=this.options;if(!(!this.layout||!(h||m))){if(this.resolvedRelativeTargetAt=da.timestamp,!this.targetDelta&&!this.relativeTarget){const g=this.getClosestProjectingParent();g&&g.layout&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_r(),this.relativeTargetOrigin=_r(),_p(this.relativeTargetOrigin,this.layout.layoutBox,g.layout.layoutBox),Ms(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=_r(),this.targetWithTransforms=_r()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),vue(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ms(this.target,this.layout.layoutBox),mW(this.target,this.targetDelta)):Ms(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const g=this.getClosestProjectingParent();g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?(this.relativeParent=g,this.forceRelativeParentToResolveTarget(),this.relativeTarget=_r(),this.relativeTargetOrigin=_r(),_p(this.relativeTargetOrigin,this.target,g.target),Ms(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||sO(this.parent.latestValues)||fW(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var T;const i=this.getLead(),l=!!this.resumingFrom||this!==i;let c=!0;if((this.isProjectionDirty||(T=this.parent)!=null&&T.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===da.timestamp&&(c=!1),c)return;const{layout:u,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||h))return;Ms(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,p=this.treeScale.y;Aue(this.layoutCorrected,this.treeScale,this.path,l),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=_r());const{target:g}=i;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(x5(this.prevProjectionDelta.x,this.projectionDelta.x),x5(this.prevProjectionDelta.y,this.projectionDelta.y)),Np(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==p||!w5(this.projectionDelta.x,this.prevProjectionDelta.x)||!w5(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),i){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=eh(),this.projectionDelta=eh(),this.projectionDeltaWithTransform=eh()}setAnimationOrigin(i,l=!1){const c=this.snapshot,u=c?c.latestValues:{},h=q({},this.latestValues),m=eh();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const p=_r(),g=c?c.source:void 0,T=this.layout?this.layout.source:void 0,y=g!==T,b=this.getStack(),x=!b||b.members.length<=1,R=!!(y&&!x&&this.options.crossfade===!0&&!this.path.some(yde));this.animationProgress=0;let A;this.mixTargetDelta=w=>{const _=w/1e3;O5(m.x,i.x,_),O5(m.y,i.y,_),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(_p(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Tde(this.relativeTarget,this.relativeTargetOrigin,p,_),A&&tde(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=_r()),Ms(A,this.relativeTarget)),y&&(this.animationValues=h,Xue(h,u,this.latestValues,_,R,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(!1),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(!1),this.pendingAnimation&&(jl(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Er.update(()=>{sy.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Rh(0)),this.currentAnimation=Vue(this.motionValue,[0,1e3],he(q({},i),{isSync:!0,onUpdate:h=>{this.mixTargetDelta(h),i.onUpdate&&i.onUpdate(h)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}})),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(sde),this.currentAnimation.stop(!1)),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:h}=i;if(!(!l||!c||!u)){if(this!==i&&this.layout&&u&&NW(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||_r();const m=Va(this.layout.layoutBox.x);c.x.min=i.target.x.min,c.x.max=c.x.min+m;const p=Va(this.layout.layoutBox.y);c.y.min=i.target.y.min,c.y.max=c.y.min+p}Ms(l,c),nh(l,h),Np(this.projectionDeltaWithTransform,this.layoutCorrected,l,h)}}registerSharedNode(i,l){this.sharedNodes.has(i)||this.sharedNodes.set(i,new nde),this.sharedNodes.get(i).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var l;const{layoutId:i}=this.options;return i?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:i}=this.options;return i?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),i&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let l=!1;const{latestValues:c}=i;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&yA("z",i,u,this.animationValues);for(let h=0;h<TA.length;h++)yA("rotate".concat(TA[h]),i,u,this.animationValues),yA("skew".concat(TA[h]),i,u,this.animationValues);i.render();for(const h in u)i.setStaticValue(h,u[h]),this.animationValues&&(this.animationValues[h]=u[h]);i.scheduleRender()}getProjectionStyles(i){var g,T;if(!this.instance||this.isSVG)return;if(!this.isVisible)return ade;const l={visibility:""},c=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,l.opacity="",l.pointerEvents=ay(i==null?void 0:i.pointerEvents)||"",l.transform=c?c(this.latestValues,""):"none",l;const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){const y={};return this.options.layoutId&&(y.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,y.pointerEvents=ay(i==null?void 0:i.pointerEvents)||""),this.hasProjected&&!Uc(this.latestValues)&&(y.transform=c?c({},""):"none",this.hasProjected=!1),y}const h=u.animationValues||u.latestValues;this.applyTransformsToTarget(),l.transform=rde(this.projectionDeltaWithTransform,this.treeScale,h),c&&(l.transform=c(h,l.transform));const{x:m,y:p}=this.projectionDelta;l.transformOrigin="".concat(m.origin*100,"% ").concat(p.origin*100,"% 0"),u.animationValues?l.opacity=u===this?(T=(g=h.opacity)!=null?g:this.latestValues.opacity)!=null?T:1:this.preserveOpacity?this.latestValues.opacity:h.opacityExit:l.opacity=u===this?h.opacity!==void 0?h.opacity:"":h.opacityExit!==void 0?h.opacityExit:0;for(const y in Zp){if(h[y]===void 0)continue;const{correct:b,applyTo:x,isCSSVariable:R}=Zp[y],A=l.transform==="none"?h[y]:b(h[y],u);if(x){const w=x.length;for(let _=0;_<w;_++)l[x[_]]=A}else R?this.options.visualElement.renderState.vars[y]=A:l[y]=A}return this.options.layoutId&&(l.pointerEvents=u===this?ay(i==null?void 0:i.pointerEvents)||"":"none"),l}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var l;return(l=i.currentAnimation)==null?void 0:l.stop(!1)}),this.root.nodes.forEach(C5),this.root.sharedNodes.clear()}}}function ode(e){e.updateLayout()}function lde(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:a}=e.layout,{animationType:s}=e.options,i=t.source!==e.layout.source;s==="size"?Ds(m=>{const p=i?t.measuredBox[m]:t.layoutBox[m],g=Va(p);p.min=r[m].min,p.max=p.min+g}):NW(s,t.layoutBox,r)&&Ds(m=>{const p=i?t.measuredBox[m]:t.layoutBox[m],g=Va(r[m]);p.max=p.min+g,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[m].max=e.relativeTarget[m].min+g)});const l=eh();Np(l,r,t.layoutBox);const c=eh();i?Np(c,e.applyTransform(a,!0),t.measuredBox):Np(c,r,t.layoutBox);const u=!bW(l);let h=!1;if(!e.resumeFrom){const m=e.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:p,layout:g}=m;if(p&&g){const T=_r();_p(T,t.layoutBox,p.layoutBox);const y=_r();_p(y,r,g.layoutBox),vW(T,y)||(h=!0),m.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=T,e.relativeParent=m)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:h})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function cde(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function ude(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function dde(e){e.clearSnapshot()}function C5(e){e.clearMeasurements()}function hde(e){e.isLayoutDirty=!1}function fde(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function I5(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function mde(e){e.resolveTargetDelta()}function pde(e){e.calcProjection()}function gde(e){e.resetSkewAndRotation()}function Ede(e){e.removeLeadSnapshot()}function O5(e,t,n){e.translate=gr(t.translate,0,n),e.scale=gr(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function L5(e,t,n,r){e.min=gr(t.min,n.min,r),e.max=gr(t.max,n.max,r)}function Tde(e,t,n,r){L5(e.x,t.x,n.x,r),L5(e.y,t.y,n.y,r)}function yde(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const xde={duration:.45,ease:[.4,0,.1,1]},M5=e=>typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),D5=M5("applewebkit/")&&!M5("chrome/")?Math.round:zs;function P5(e){e.min=D5(e.min),e.max=D5(e.max)}function Sde(e){P5(e.x),P5(e.y)}function NW(e,t,n){return e==="position"||e==="preserve-aspect"&&!bue(_5(t),_5(n),.2)}function bde(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const vde=RW({attachResizeListener:(e,t)=>tg(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),xA={current:void 0},_W=RW({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!xA.current){const e=new vde({});e.mount(window),e.setOptions({layoutScroll:!0}),xA.current=e}return xA.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Ade={pan:{Feature:Fue},drag:{Feature:Uue,ProjectionNode:_W,MeasureLayout:yW}};function k5(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const a="onHover"+n,s=r[a];s&&Er.postRender(()=>s(t,Mg(t)))}class Rde extends Zl{mount(){const{current:t}=this.node;t&&(this.unmount=nce(t,(n,r)=>(k5(this.node,r,"Start"),a=>k5(this.node,a,"End"))))}unmount(){}}class Nde extends Zl{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(n){t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ig(tg(this.node.current,"focus",()=>this.onFocus()),tg(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function j5(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const a="onTap"+(n==="End"?"":n),s=r[a];s&&Er.postRender(()=>s(t,Mg(t)))}class _de extends Zl{mount(){const{current:t}=this.node;t&&(this.unmount=ice(t,(n,r)=>(j5(this.node,r,"Start"),(a,{success:s})=>j5(this.node,a,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const lO=new WeakMap,SA=new WeakMap,wde=e=>{const t=lO.get(e.target);t&&t(e)},Cde=e=>{e.forEach(wde)};function Ide(n){var r=n,{root:e}=r,t=Tn(r,["root"]);const a=e||document;SA.has(a)||SA.set(a,{});const s=SA.get(a),i=JSON.stringify(t);return s[i]||(s[i]=new IntersectionObserver(Cde,q({root:e},t))),s[i]}function Ode(e,t,n){const r=Ide(t);return lO.set(e,n),r.observe(e),()=>{lO.delete(e),r.unobserve(e)}}const Lde={some:0,all:1};class Mde extends Zl{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:a="some",once:s}=t,i={root:n?n.current:void 0,rootMargin:r,threshold:typeof a=="number"?a:Lde[a]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:h,onViewportLeave:m}=this.node.getProps(),p=u?h:m;p&&p(c)};return Ode(this.node.current,i,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver=="undefined")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(Dde(t,n))&&this.startObserver()}unmount(){}}function Dde({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Pde={inView:{Feature:Mde},tap:{Feature:_de},focus:{Feature:Nde},hover:{Feature:Rde}},kde={layout:{ProjectionNode:_W,MeasureLayout:yW}},cO={current:null},wW={current:!1};function jde(){if(wW.current=!0,!!q1)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>cO.current=e.matches;e.addListener(t),t()}else cO.current=!1}const Ude=new WeakMap;function Fde(e,t,n){for(const r in t){const a=t[r],s=n[r];if(wa(a))e.addValue(r,a);else if(wa(s))e.addValue(r,Rh(a,{owner:e}));else if(s!==a)if(e.hasValue(r)){const i=e.getValue(r);i.liveStyle===!0?i.jump(a):i.hasAnimated||i.set(a)}else{const i=e.getStaticValue(r);e.addValue(r,Rh(i!==void 0?i:a,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const U5=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class $de{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:a,blockInitialAnimation:s,visualState:i},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=uL,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const g=ss.now();this.renderScheduledAt<g&&(this.renderScheduledAt=g,Er.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=i;this.latestValues=c,this.baseTarget=q({},c),this.initialValues=n.initial?q({},c):{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=a,this.options=l,this.blockInitialAnimation=!!s,this.isControllingVariants=F0(n),this.isVariantNode=XY(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const p=this.scrapeMotionValuesFromProps(n,{},this),{willChange:h}=p,m=Tn(p,["willChange"]);for(const g in m){const T=m[g];c[g]!==void 0&&wa(T)&&T.set(c[g],!1)}}mount(t){this.current=t,Ude.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),wW.current||jde(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:cO.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),jl(this.notifyUpdate),jl(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Xh.has(t);r&&this.onBindTransform&&this.onBindTransform();const a=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Er.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{a(),s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Nh){const n=Nh[t];if(!n)continue;const{isEnabled:r,Feature:a}=n;if(!this.features[t]&&a&&r(this.props)&&(this.features[t]=new a(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_r()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<U5.length;r++){const a=U5[r];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const s="on"+a,i=t[s];i&&(this.propEventSubscriptions[a]=this.on(a,i))}this.prevMotionValues=Fde(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Rh(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var a;let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(a=this.getBaseTargetFromProps(this.props,t))!=null?a:this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(iY(r)||oY(r))?r=parseFloat(r):!lce(r)&&Ul.test(n)&&(r=HY(t,n)),this.setBaseTarget(t,wa(r)?r.get():r)),wa(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var s;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const i=SL(this.props,n,(s=this.presenceContext)==null?void 0:s.custom);i&&(r=i[t])}if(n&&r!==void 0)return r;const a=this.getBaseTargetFromProps(this.props,t);return a!==void 0&&!wa(a)?a:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new J1),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class CW extends $de{constructor(){super(...arguments),this.KeyframeResolver=Qle}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;wa(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent="".concat(n))}))}}function IW(e,{style:t,vars:n},r,a){Object.assign(e.style,t,a&&a.getProjectionStyles(r));for(const s in n)e.style.setProperty(s,n[s])}function Bde(e){return window.getComputedStyle(e)}class Hde extends CW{constructor(){super(...arguments),this.type="html",this.renderInstance=IW}readValueFromInstance(t,n){if(Xh.has(n))return gle(t,n);{const r=Bde(t),a=(tL(n)?r.getPropertyValue(n):r[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(t,{transformPagePoint:n}){return pW(t,n)}build(t,n,r){TL(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return bL(t,n,r)}}const OW=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Vde(e,t,n,r){IW(e,t,void 0,r);for(const a in t.attrs)e.setAttribute(OW.has(a)?a:EL(a),t.attrs[a])}class Gde extends CW{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=_r}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Xh.has(n)){const r=BY(n);return r&&r.default||0}return n=OW.has(n)?n:EL(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return sW(t,n,r)}build(t,n,r){tW(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,a){Vde(t,n,r,a)}mount(t){this.isSVGTag=rW(t.tagName),super.mount(t)}}const zde=(e,t)=>xL(e)?new Gde(t):new Hde(t,{allowProjection:e!==v.Fragment}),qde=Hce(q(q(q(q({},mue),Pde),Ade),kde),zde),me=fce(qde);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yde=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Wde=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),F5=e=>{const t=Wde(e);return t.charAt(0).toUpperCase()+t.slice(1)},LW=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Xde=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var Kde={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qde=v.forwardRef((u,c)=>{var h=u,{color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:s,iconNode:i}=h,l=Tn(h,["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"]);return v.createElement("svg",q(q(he(q({ref:c},Kde),{width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:LW("lucide",a)}),!s&&!Xde(l)&&{"aria-hidden":"true"}),l),[...i.map(([m,p])=>v.createElement(m,p)),...Array.isArray(s)?s:[s]])});/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ue=(e,t)=>{const n=v.forwardRef((i,s)=>{var l=i,{className:r}=l,a=Tn(l,["className"]);return v.createElement(Qde,q({ref:s,iconNode:t,className:LW("lucide-".concat(Yde(F5(e))),"lucide-".concat(e),r)},a))});return n.displayName=F5(e),n};/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jde=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],MW=Ue("arrow-down",Jde);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zde=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],ehe=Ue("arrow-left-right",Zde);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const the=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],AL=Ue("arrow-left",the);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nhe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],rhe=Ue("arrow-right",nhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ahe=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],she=Ue("arrow-up-down",ahe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ihe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],DW=Ue("arrow-up",ihe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ohe=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],PW=Ue("bell",ohe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lhe=[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]],che=Ue("binary",lhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uhe=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],dhe=Ue("bold",uhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hhe=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],kW=Ue("braces",hhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fhe=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],jW=Ue("brain",fhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mhe=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],phe=Ue("calculator",mhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ghe=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Fl=Ue("calendar",ghe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ehe=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]],The=Ue("chart-area",Ehe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yhe=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],ko=Ue("chart-column",yhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xhe=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],She=Ue("chart-line",xhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bhe=[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]],vhe=Ue("chart-no-axes-column-increasing",bhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ahe=[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]],UW=Ue("chart-pie",Ahe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rhe=[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]],Nhe=Ue("chart-scatter",Rhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _he=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Pr=Ue("check",_he);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const whe=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],br=Ue("chevron-down",whe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Che=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Dg=Ue("chevron-left",Che);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ihe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],nr=Ue("chevron-right",Ihe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ohe=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$0=Ue("chevron-up",Ohe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lhe=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],FW=Ue("chevrons-left",Lhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mhe=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],$W=Ue("chevrons-right",Mhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dhe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Cn=Ue("circle-alert",Dhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Phe=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Zr=Ue("circle-check-big",Phe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const khe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],$5=Ue("circle-help",khe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jhe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Uhe=Ue("circle-x",jhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fhe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],bA=Ue("circle",Fhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $he=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],du=Ue("clock",$he);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bhe=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],dh=Ue("cloud",Bhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hhe=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],B0=Ue("code-xml",Hhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vhe=[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]],RL=Ue("code",Vhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ghe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],zhe=Ue("columns-2",Ghe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qhe=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],NL=Ue("command",qhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yhe=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],Whe=Ue("container",Yhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xhe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],gi=Ue("copy",Xhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Khe=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],H0=Ue("cpu",Khe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qhe=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],BW=Ue("credit-card",Qhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jhe=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],Zhe=Ue("crown",Jhe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const efe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Xs=Ue("database",efe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tfe=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],Hr=Ue("download",tfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nfe=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],_L=Ue("ellipsis-vertical",nfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rfe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],qi=Ue("external-link",rfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const afe=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],wL=Ue("eye-off",afe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sfe=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Jr=Ue("eye",sfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ife=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],ofe=Ue("file-code",ife);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lfe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],wp=Ue("file-plus",lfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cfe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],CL=Ue("file-spreadsheet",cfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ufe=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Xn=Ue("file-text",ufe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dfe=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ng=Ue("folder-open",dfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hfe=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],B5=Ue("folder-plus",hfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ffe=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],NT=Ue("folder",ffe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mfe=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],pfe=Ue("funnel",mfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gfe=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],Efe=Ue("github",gfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tfe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],HW=Ue("globe",Tfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yfe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],uO=Ue("grid-3x3",yfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xfe=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],dO=Ue("grip-vertical",xfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sfe=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],hO=Ue("hard-drive",Sfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bfe=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],hu=Ue("hash",bfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vfe=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]],Afe=Ue("hexagon",vfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rfe=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Nfe=Ue("history",Rfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _fe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],wfe=Ue("image",_fe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cfe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],jo=Ue("info",Cfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ife=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],Ofe=Ue("italic",Ife);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lfe=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Mfe=Ue("key",Lfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dfe=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],H5=Ue("languages",Dfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pfe=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],_T=Ue("layers",Pfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kfe=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],IL=Ue("link",kfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jfe=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],hh=Ue("list",jfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ufe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Hn=Ue("loader-circle",Ufe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ffe=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],vA=Ue("loader",Ffe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $fe=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],_h=Ue("lock",$fe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bfe=[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]],iy=Ue("log-out",Bfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hfe=[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]],V5=Ue("log-in",Hfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vfe=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],OL=Ue("mail",Vfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gfe=[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],zfe=Ue("maximize-2",Gfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qfe=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],G5=Ue("maximize",qfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yfe=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],LL=Ue("message-square",Yfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wfe=[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]],Xfe=Ue("minimize-2",Wfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kfe=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],fO=Ue("minimize",Kfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qfe=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],z5=Ue("monitor",Qfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jfe=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Zfe=Ue("moon",Jfe);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eme=[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]],VW=Ue("notebook",eme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tme=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Dl=Ue("package",tme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nme=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],rme=Ue("palette",nme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ame=[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]],ML=Ue("pen-line",ame);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sme=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ime=Ue("pen",sme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ome=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],$l=Ue("play",ome);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lme=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ru=Ue("plus",lme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cme=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],ume=Ue("power",cme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dme=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],hme=Ue("quote",dme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fme=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],ma=Ue("refresh-cw",fme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mme=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],DL=Ue("save",mme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pme=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qi=Ue("search",pme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gme=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Eme=Ue("send",gme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tme=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],$y=Ue("server",Tme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yme=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],qs=Ue("settings",yme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xme=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Sme=Ue("share-2",xme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bme=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],V0=Ue("shield",bme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vme=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],PL=Ue("square-pen",vme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ame=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],q5=Ue("square",Ame);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rme=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],Nme=Ue("star",Rme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _me=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],wme=Ue("sun",_me);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cme=[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],GW=Ue("table-properties",Cme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ime=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],Bl=Ue("table",Ime);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ome=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],Lme=Ue("terminal",Ome);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mme=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],zW=Ue("toggle-left",Mme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dme=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],Hl=Ue("trash-2",Dme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pme=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],kme=Ue("trash",Pme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jme=[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]],qW=Ue("trending-up",jme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ume=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Ma=Ue("triangle-alert",Ume);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fme=[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]],Kh=Ue("type",Fme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $me=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]],G0=Ue("upload",$me);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bme=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],YW=Ue("user-plus",Bme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hme=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],z0=Ue("user",Hme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vme=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],kL=Ue("users",Vme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gme=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ur=Ue("x",Gme);/**
 * @license lucide-react v0.507.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zme=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],mO=Ue("zap",zme),qme=({onAccept:e,onDecline:t,onClose:n})=>{const{t:r}=Ze(),[a,s]=v.useState(!1),[i,l]=v.useState(!1),c=()=>{l(!0),setTimeout(()=>{e()},3e3)};return o.jsx(me.div,{initial:{opacity:0,y:50,x:-20},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:50,x:-20},transition:{type:"spring",stiffness:400,damping:25,opacity:{duration:.3}},className:"fixed bottom-4 left-4 z-50 max-w-xs will-change-transform",style:{transform:"translate3d(0, 0, 0)"},children:o.jsx("div",{className:"bg-black border border-white/10 rounded-lg shadow-2xl p-4",children:o.jsx(At,{mode:"wait",children:i?o.jsxs(me.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.4},className:"text-center py-2",children:[o.jsx("div",{className:"flex items-center justify-center mb-2",children:o.jsx("span",{className:"text-white font-medium text-sm",children:r("consent.thanks.title",{defaultValue:"Thank you!"})})}),o.jsx("p",{className:"text-white/70 text-xs",children:r("consent.thanks.message",{defaultValue:"You help us make DataKit better for everyone."})})]},"thanks"):o.jsxs(me.div,{initial:{opacity:1},exit:{opacity:0,scale:.95},transition:{duration:.2},children:[o.jsxs("div",{className:"flex items-start justify-between mb-3",children:[o.jsx("h3",{className:"font-medium text-sm text-white",children:r("consent.header.title",{defaultValue:"Help us improve DataKit"})}),o.jsx("button",{onClick:n,className:"text-white/50 hover:text-white/80 transition-colors ml-2",children:o.jsx(ur,{className:"w-3 h-3 cursor-pointer"})})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("p",{className:"text-white/70 text-xs leading-relaxed mb-3",children:r("consent.description",{defaultValue:"We collect basic anonymous metrics to improve app stability. With your consent, we can enable enhanced analytics for better features. Your data files never leave the browser."})}),o.jsxs("button",{onClick:()=>s(!a),className:"flex items-center justify-between w-full text-xs text-white/60 hover:text-white/80 transition-colors mb-2",children:[o.jsx("span",{children:r("consent.dropdown.title",{defaultValue:"What do we collect?"})}),a?o.jsx($0,{className:"w-3 h-3"}):o.jsx(br,{className:"w-3 h-3"})]}),o.jsx(At,{children:a&&o.jsx(me.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:o.jsxs("div",{className:"bg-white/5 rounded p-3 mb-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-white/80 text-xs font-medium mb-1",children:r("consent.collection.basic.title",{defaultValue:"Basic (No Consent Needed):"})}),o.jsxs("ul",{className:"text-white/60 text-xs space-y-0.5 pl-2",children:[o.jsxs("li",{children:["• ",r("consent.collection.basic.pageViews",{defaultValue:"Page views & navigation"})]}),o.jsxs("li",{children:["• ",r("consent.collection.basic.performance",{defaultValue:"Performance metrics"})]}),o.jsxs("li",{children:["• ",r("consent.collection.basic.errors",{defaultValue:"Error reports (to fix bugs)"})]}),o.jsxs("li",{children:["• ",r("consent.collection.basic.recordings",{defaultValue:"Session recordings (heavily masked)"})]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-white/80 text-xs font-medium mb-1",children:r("consent.collection.advanced.title",{defaultValue:"Advanced (With Consent):"})}),o.jsxs("ul",{className:"text-white/60 text-xs space-y-0.5 pl-2",children:[o.jsxs("li",{children:["• ",r("consent.collection.advanced.featureUsage",{defaultValue:"Detailed feature usage"})]}),o.jsxs("li",{children:["• ",r("consent.collection.advanced.recordings",{defaultValue:"Session recordings"})]}),o.jsxs("li",{children:["• ",r("consent.collection.advanced.fileTypes",{defaultValue:"File types & sizes (not content)"})]}),o.jsxs("li",{children:["• ",r("consent.collection.advanced.journeyTracking",{defaultValue:"User journey tracking"})]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-white/80 text-xs font-medium mb-1",children:r("consent.collection.never.title",{defaultValue:"Never collected:"})}),o.jsxs("ul",{className:"text-white/60 text-xs space-y-0.5 pl-2",children:[o.jsxs("li",{children:["• ",r("consent.collection.never.dataFiles",{defaultValue:"Your data files or content"})]}),o.jsxs("li",{children:["• ",r("consent.collection.never.sqlQueries",{defaultValue:"SQL queries you write"})]}),o.jsxs("li",{children:["• ",r("consent.collection.never.personalInfo",{defaultValue:"Personal information"})]})]})]})]}),o.jsx("a",{href:"/privacy",className:"text-xs text-white/50 hover:text-white/70 transition-colors underline mt-2 block",children:r("consent.privacyPolicy",{defaultValue:"View full privacy policy"})})]})})})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:t,className:"flex-1 px-3 py-1.5 text-xs text-white/70 hover:text-white border border-white/20 hover:border-white/40 rounded transition-colors",children:r("consent.buttons.decline",{defaultValue:"Decline"})}),o.jsx("button",{onClick:c,className:"flex-1 px-3 py-1.5 text-xs bg-white text-black hover:bg-white/90 rounded transition-colors font-medium",children:r("consent.buttons.accept",{defaultValue:"Accept"})})]})]},"consent")})})})},jL=()=>{const{t:e}=Ze(),[t,n]=v.useState(!1),[r,a]=v.useState(!1),[s,i]=v.useState(!1),l=Fq();v.useEffect(()=>{const T=localStorage.getItem("datakit-analytics-consent");if(T!==null){a(!0),T==="true"?(i(!0),l&&(l.set_config({autocapture:!0,capture_pageview:!0,session_recording:{maskAllInputs:!1,maskAllText:!1,maskAllImages:!1,blockAllMedia:!1,maskTextSelector:"",maskInputOptions:{password:!0,email:!0}}}),l.capture("$pageview",{tracking_level:"enhanced"}))):l&&l.set_config({autocapture:!1,capture_pageview:!1,session_recording:{maskAllInputs:!0,maskAllText:!0,maskAllImages:!0,blockAllMedia:!0,maskTextSelector:"*"}});return}l&&!r&&l.capture("$pageview",{tracking_level:"basic"});const y=setTimeout(()=>{r||n(!0)},3e3);return()=>clearTimeout(y)},[r,l]);const c=()=>{localStorage.setItem("datakit-analytics-consent","true"),i(!0),l&&(l.set_config({autocapture:!0,capture_pageview:!0,session_recording:{maskAllInputs:!1,maskAllText:!1,maskAllImages:!1,blockAllMedia:!1,maskTextSelector:"",maskInputOptions:{password:!0,email:!0}}}),l.capture("consent_granted",{timestamp:new Date().toISOString()}),l.capture("$pageview",{tracking_level:"enhanced"})),n(!1),a(!0)},u=()=>{localStorage.setItem("datakit-analytics-consent","false"),i(!1),l&&(l.set_config({autocapture:!1,capture_pageview:!1,session_recording:{maskAllInputs:!0,maskAllText:!0,maskAllImages:!0,blockAllMedia:!0,maskTextSelector:"*"}}),l.capture("consent_declined",{timestamp:new Date().toISOString(),tracking_level:"basic"})),n(!1),a(!0)},h=()=>{n(!1)},m=["app_loaded","page_view","feature_accessed","error_occurred","performance_metric"],p=v.useCallback((T,y)=>{if(!l)return;m.some(x=>T.includes(x))?l.capture(T,he(q({},y),{tracking_level:"basic",timestamp:new Date().toISOString()})):s&&l.capture(T,he(q({},y),{tracking_level:"enhanced",timestamp:new Date().toISOString()}))},[l,s]),g=v.useCallback(T=>{l&&l.capture("$pageview",{$current_url:T||window.location.href,tracking_level:s?"enhanced":"basic"})},[l,s]);return{showPopup:t,analyticsEnabled:s,handleAccept:c,handleDecline:u,handleClose:h,trackEvent:p,trackPageview:g,ConsentPopup:()=>o.jsx(At,{children:t&&o.jsx(qme,{onAccept:c,onDecline:u,onClose:h})})}},Yme=({isVisible:e,onClose:t,title:n,message:r,icon:a="check",duration:s=5e3})=>{Ht.useEffect(()=>{if(e&&s>0){const l=setTimeout(t,s);return()=>clearTimeout(l)}},[e,s,t]);const i=()=>{switch(a){case"user":return o.jsx(z0,{className:"w-4 h-4 text-green-400"});case"shield":return o.jsx(V0,{className:"w-4 h-4 text-green-400"});case"check":default:return o.jsx(Pr,{className:"w-4 h-4 text-green-400"})}};return o.jsx(At,{children:e&&o.jsx(me.div,{initial:{opacity:0,y:-50,x:20},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:-50,x:20},transition:{type:"spring",stiffness:400,damping:25,opacity:{duration:.3}},className:"max-w-sm",children:o.jsxs("div",{className:"bg-black border border-green-500/20 rounded-lg shadow-2xl p-4 backdrop-blur-sm",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-green-500/10 rounded-full flex items-center justify-center border border-green-500/20",children:i()}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm text-white mb-1",children:n}),o.jsx("p",{className:"text-white/70 text-xs leading-relaxed",children:r})]}),o.jsx("button",{onClick:t,className:"text-white/50 hover:text-white/80 transition-colors ml-2 flex-shrink-0",children:o.jsx(ur,{className:"w-3 h-3"})})]})})]}),s>0&&o.jsx("div",{className:"mt-3 h-0.5 bg-white/10 rounded-full overflow-hidden",children:o.jsx(me.div,{initial:{width:"100%"},animate:{width:"0%"},transition:{duration:s/1e3,ease:"linear"},className:"h-full bg-green-500/50"})})]})})})},Wme=({isVisible:e,onClose:t,title:n,message:r,icon:a="alert-triangle",duration:s=8e3})=>{Ht.useEffect(()=>{if(e&&s>0){const l=setTimeout(t,s);return()=>clearTimeout(l)}},[e,s,t]);const i=()=>{switch(a){case"alert-circle":return o.jsx(Cn,{className:"w-4 h-4 text-red-400"});case"x-circle":return o.jsx(Uhe,{className:"w-4 h-4 text-red-400"});case"alert-triangle":default:return o.jsx(Ma,{className:"w-4 h-4 text-red-400"})}};return o.jsx(At,{children:e&&o.jsx(me.div,{initial:{opacity:0,y:-50,x:20},animate:{opacity:1,y:0,x:0},exit:{opacity:0,y:-50,x:20},transition:{type:"spring",stiffness:400,damping:25,opacity:{duration:.3}},className:"max-w-sm",children:o.jsxs("div",{className:"bg-black border border-red-500/20 rounded-lg shadow-2xl p-4 backdrop-blur-sm",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"flex-shrink-0 w-8 h-8 bg-red-500/10 rounded-full flex items-center justify-center border border-red-500/20",children:i()}),o.jsx("div",{className:"flex-1 min-w-0",children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm text-white mb-1",children:n}),o.jsx("p",{className:"text-white/70 text-xs leading-relaxed",children:r})]}),o.jsx("button",{onClick:t,className:"text-white/50 hover:text-white/80 transition-colors ml-2 flex-shrink-0",children:o.jsx(ur,{className:"w-3 h-3"})})]})})]}),s>0&&o.jsx("div",{className:"mt-3 h-0.5 bg-white/10 rounded-full overflow-hidden",children:o.jsx(me.div,{initial:{width:"100%"},animate:{width:"0%"},transition:{duration:s/1e3,ease:"linear"},className:"h-full bg-red-500/50"})})]})})})},WW=v.createContext(void 0),Xme=({children:e})=>{const[t,n]=v.useState([]),r=v.useCallback((i,l,c={})=>{const h={id:Math.random().toString(36).substr(2,9),type:"success",title:i,message:l,icon:c.icon||"check",duration:c.duration||5e3};n(m=>[...m,h])},[]),a=v.useCallback((i,l,c={})=>{const h={id:Math.random().toString(36).substr(2,9),type:"error",title:i,message:l,icon:c.icon||"alert-triangle",duration:c.duration||8e3};n(m=>[...m,h])},[]),s=v.useCallback(i=>{n(l=>l.filter(c=>c.id!==i))},[]);return o.jsxs(WW.Provider,{value:{showSuccess:r,showError:a,removeNotification:s},children:[e,t.map((i,l)=>o.jsx("div",{style:{position:"fixed",top:"".concat(1+l*6,"rem"),right:"1rem",zIndex:50+l},children:i.type==="success"?o.jsx(Yme,{isVisible:!0,onClose:()=>s(i.id),title:i.title,message:i.message,icon:i.icon,duration:i.duration}):o.jsx(Wme,{isVisible:!0,onClose:()=>s(i.id),title:i.title,message:i.message,icon:i.icon,duration:i.duration})},i.id))]})},ec=()=>{const e=v.useContext(WW);if(e===void 0)throw new Error("useNotifications must be used within a NotificationProvider");return e},q0=()=>{const{analyticsEnabled:e,trackEvent:t}=jL(),n=Fq(),r=v.useCallback(T=>{t(T.name,T.props)},[t]),a=v.useCallback(T=>{const y={source_file_type:T.sourceType,is_streaming_import:T.isStreamingImport,row_count:String(T.rowCount),file_size:T.fileSize};r({name:"performance_metric",props:q({metric_type:"file_upload"},y)}),e&&r({name:"file_upload",props:y})},[r,e]),s=v.useCallback((T,y)=>{r({name:"performance_metric",props:{metric_type:"query_execution",query_type:T,execution_time_ms:y}}),e&&r({name:"query_executed",props:{query_type:T,execution_time_ms:y}})},[r,e]),i=v.useCallback((T,y)=>{r({name:"feature_accessed",props:{feature:"visualization",chart_type:T}}),e&&r({name:"visualization_created",props:{chart_type:T,data_points:y}})},[r,e]),l=v.useCallback((T,y)=>{r({name:"page_view",props:{page:y,previous_page:T}}),e&&r({name:"tab_changed",props:{from_tab:T,to_tab:y}})},[r,e]),c=v.useCallback((T,y)=>{r({name:"feature_accessed",props:{feature:T,context:y||"unknown"}}),e&&r({name:"feature_used",props:{feature_name:T,context:y||"unknown",timestamp:new Date().toISOString()}})},[r,e]),u=v.useCallback((T,y)=>{var x;const b=typeof T=="string"?{message:T,name:"Error"}:{message:T.message,name:T.name,stack:(x=T.stack)==null?void 0:x.substring(0,500)};r({name:"error_occurred",props:{error_name:b.name,error_message:b.message,context:y||"unknown"}})},[r]),h=v.useCallback((T,y,b)=>{r({name:"performance_metric",props:{metric_name:T,metric_value:y,metric_unit:b||"ms"}})},[r]),m=v.useCallback((T,y)=>{e&&n&&n.identify(T,y)},[e,n]),p=v.useCallback(()=>{n&&n.reset()},[n]),g=v.useCallback((T,y=!1)=>n&&n.isFeatureEnabled(T)||y,[n]);return{track:r,trackFileUpload:a,trackQuery:s,trackVisualization:i,trackTabChange:l,trackFeatureUsage:c,trackError:u,trackPerformance:h,identifyUser:m,resetUser:p,isFeatureEnabled:g}},Kme=()=>{const{user:e,isAuthenticated:t}=qh(),{identifyUser:n,resetUser:r,track:a}=q0(),{analyticsEnabled:s}=jL();v.useEffect(()=>{t&&e&&s?(n(e.id,{email:e.email,name:e.name,created_at:e.created_at,subscription_tier:e.subscription_tier||"free",workspace_count:e.workspace_count||0}),a({name:"user_logged_in",props:{method:"email",subscription_tier:e.subscription_tier||"free"}})):!t&&!e&&(r(),a({name:"user_logged_out",props:{}}))},[t,e,s,n,r,a])},Ut=({children:e,content:t,placement:n="right",delay:r=300,color:a="default"})=>{const[s,i]=Ht.useState(!1),[l,c]=Ht.useState(!1),u=Ht.useRef(null),h={default:"bg-black/90",primary:"bg-primary/90",secondary:"bg-secondary/90"},m={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",right:"left-full top-1/2 -translate-y-1/2 ml-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2","bottom-left":"top-full right-0 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2"},p={top:{default:"top-full left-1/2 -translate-x-1/2 border-t-black/90 border-l-transparent border-r-transparent border-b-transparent",primary:"top-full left-1/2 -translate-x-1/2 border-t-primary/90 border-l-transparent border-r-transparent border-b-transparent",secondary:"top-full left-1/2 -translate-x-1/2 border-t-secondary/90 border-l-transparent border-r-transparent border-b-transparent"},right:{default:"right-full top-1/2 -translate-y-1/2 border-r-black/90 border-t-transparent border-b-transparent border-l-transparent",primary:"right-full top-1/2 -translate-y-1/2 border-r-primary/90 border-t-transparent border-b-transparent border-l-transparent",secondary:"right-full top-1/2 -translate-y-1/2 border-r-secondary/90 border-t-transparent border-b-transparent border-l-transparent"},bottom:{default:"bottom-full left-1/2 -translate-x-1/2 border-b-black/90 border-l-transparent border-r-transparent border-t-transparent",primary:"bottom-full left-1/2 -translate-x-1/2 border-b-primary/90 border-l-transparent border-r-transparent border-t-transparent",secondary:"bottom-full left-1/2 -translate-x-1/2 border-b-secondary/90 border-l-transparent border-r-transparent border-t-transparent"},left:{default:"left-full top-1/2 -translate-y-1/2 border-l-black/90 border-t-transparent border-b-transparent border-r-transparent",primary:"left-full top-1/2 -translate-y-1/2 border-l-primary/90 border-t-transparent border-b-transparent border-r-transparent",secondary:"left-full top-1/2 -translate-y-1/2 border-l-secondary/90 border-t-transparent border-b-transparent border-r-transparent"},"bottom-left":{default:"bottom-full right-2 border-b-black/90 border-l-transparent border-r-transparent border-t-transparent",primary:"bottom-full right-2 border-b-primary/90 border-l-transparent border-r-transparent border-t-transparent",secondary:"bottom-full right-2 border-b-secondary/90 border-l-transparent border-r-transparent border-t-transparent"}},g=()=>{c(!0),u.current=setTimeout(()=>{i(!0)},r)},T=()=>{c(!1),u.current&&(clearTimeout(u.current),u.current=null),i(!1)};return Ht.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),o.jsxs("div",{className:"relative inline-block",onMouseEnter:g,onMouseLeave:T,children:[e,o.jsx(At,{children:s&&l&&o.jsxs(me.div,{className:"absolute ".concat(m[n]," z-[1000]"),initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},children:[o.jsx("div",{className:"".concat(h[a]," text-white rounded-md px-2.5 py-1.5 text-xs font-medium whitespace-nowrap shadow-lg border border-white/30"),children:t}),o.jsx("div",{className:"absolute w-0 h-0 border-4 ".concat(p[n][a])})]})})]})};function Qh(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Qme(e,t){let n;const r=()=>{if(n)return n;const a=indexedDB.open(e);return a.onupgradeneeded=()=>a.result.createObjectStore(t),n=Qh(a),n.then(s=>{s.onclose=()=>n=void 0},()=>{}),n};return(a,s)=>r().then(i=>s(i.transaction(t,a).objectStore(t)))}let AA;function Y0(){return AA||(AA=Qme("keyval-store","keyval")),AA}function wT(e,t=Y0()){return t("readonly",n=>Qh(n.get(e)))}function CT(e,t,n=Y0()){return n("readwrite",r=>(r.put(t,e),Qh(r.transaction)))}function Jme(e,t=Y0()){return t("readwrite",n=>(n.delete(e),Qh(n.transaction)))}function Zme(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Qh(e.transaction)}function epe(e=Y0()){return e("readonly",t=>{if(t.getAllKeys)return Qh(t.getAllKeys());const n=[];return Zme(t,r=>n.push(r.key)).then(()=>n)})}var tr=(e=>(e.CSV="CSV",e.JSON="JSON",e.PARQUET="Parquet",e.XLSX="xlsx",e.TXT="TXT",e.TSV="TSV",e.TABLE="TABLE",e))(tr||{});const Y5={files:[],activeFileId:null,splitView:{isActive:!1,leftFileId:null,rightFileId:null,splitRatio:.5},activeTab:"preview",jsonViewMode:"table",sidebarCollapsed:!1,isInIframe:!1,showColumnStats:!1,emptyStateViewMode:"preview",showAIAssistant:!0,assistantSidebarWidth:400,recentQueries:[],savedQueries:[],pendingQuery:null,pendingNotebookCode:null,isRemoteModalOpen:!1,activeProviderRemoteModal:"huggingface",workspaceFiles:[]},tpe=50,npe=()=>"file_".concat(Date.now(),"_").concat(Math.random().toString(36).substr(2,9)),rpe=(e,t)=>{const n=e.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_").toLowerCase(),r=t.split("_").pop()||"unknown";return"".concat(n,"_").concat(r)},XW=()=>{try{return window.self!==window.top}catch(e){return!0}},ape=()=>{try{if(XW())return!0;const e=localStorage.getItem("sidebar-collapsed");return e!==null?e==="true":!0}catch(e){return!0}},ut=Ki((e,t)=>he(q(he(q({},Y5),{sidebarCollapsed:ape(),isInIframe:XW(),showColumnStats:localStorage.getItem("show-column-stats")==="true"}),(setTimeout(()=>{t().loadWorkspaceFilesFromStorage()},0),{})),{addFile:n=>{if(n.isDatabaseAttachment)return"db-attachment-".concat(Date.now());const r=npe(),a=n.tableName||rpe(n.fileName,r),s={id:r,fileName:n.fileName,data:n.data,columnTypes:n.columnTypes,sourceType:n.sourceType||tr.CSV,rawData:n.rawData||null,jsonSchema:n.schema||null,rowCount:n.rowCount,columnCount:n.columnCount,loadedToDuckDB:n.loadedToDuckDB,tableName:a,isRemote:n.isRemote||!1,remoteURL:n.remoteURL,remoteProvider:n.remoteProvider,googleSheets:n.googleSheets,postgresql:n.postgresql,importedAt:Date.now(),lastAccessedAt:Date.now(),sqlState:{query:"SELECT * FROM ".concat(a," LIMIT 100"),history:[],lastExecutedAt:void 0},aiState:{messages:[],conversationId:"conv_".concat(r,"_").concat(Date.now()),currentResponse:null,streamingResponse:"",isProcessing:!1,currentError:null,currentTokenUsage:null,visualizationTokenUsage:null,queryResults:null,visualizations:[],tableContext:{tableName:a,schema:[],rowCount:n.rowCount,description:"".concat(n.fileName," - ").concat(n.columnCount," columns")},createdAt:Date.now(),lastMessageAt:void 0,lastSavedAt:Date.now()}};return e(i=>({files:[...i.files,s],activeFileId:r})),t().files.length===1&&t().loadQueriesFromStorage(),r},removeFile:n=>{var a;const r=t().files.find(s=>s.id===n);if(e(s=>{const i=s.files.filter(u=>u.id!==n);let l=s.activeFileId;const c=i.map(u=>{var h;return((h=u.splitView)==null?void 0:h.partnerId)===n?he(q({},u),{splitView:void 0}):u});if(s.activeFileId===n)if(c.length>0){const u=s.files.findIndex(m=>m.id===n);l=c[Math.min(u,c.length-1)].id}else l=null;return{files:c,activeFileId:l}}),r!=null&&r.loadedToDuckDB&&r.tableName){const{dropTableOrView:s,registeredTables:i}=Dt.getState();s(r.tableName).then(l=>{if(l){const c=new Map(i);c.delete(r.tableName),Dt.setState({registeredTables:c})}}).catch(l=>{})}(a=r==null?void 0:r.metadata)!=null&&a.isQueryResult&&fn(()=>H(null,null,function*(){const{useFolderStore:s}=yield Promise.resolve().then(()=>dpe);return{useFolderStore:s}}),void 0).then(({useFolderStore:s})=>{const{tempFolderId:i,getNodeById:l,removeNode:c}=s.getState();if(i){const u=l(i);if(u&&u.children){const h=u.children.find(m=>{var p;return m.type==="file"&&((p=m.fileData)==null?void 0:p.tableName)===r.tableName});h&&c(h.id)}}}).catch(console.error)},setActiveFile:n=>{e(r=>({files:r.files.map(s=>{if(s.id===n){const i={lastAccessedAt:Date.now()};return s.sqlState||(i.sqlState={query:"",history:[],lastExecutedAt:void 0}),s.aiState||(i.aiState={messages:[],conversationId:"conv_".concat(n,"_").concat(Date.now()),currentResponse:null,streamingResponse:"",isProcessing:!1,currentError:null,currentTokenUsage:null,visualizationTokenUsage:null,queryResults:null,visualizations:[],tableContext:{tableName:s.tableName,schema:[],rowCount:s.rowCount,description:"".concat(s.fileName," - ").concat(s.columnCount," columns")},createdAt:Date.now(),lastMessageAt:void 0,lastSavedAt:Date.now()}),q(q({},s),i)}return s}),activeFileId:n}))},closeAllFiles:()=>{e({files:[],activeFileId:null})},closeOthersFiles:n=>{e(r=>({files:r.files.filter(a=>a.id===n),activeFileId:n}))},updateFile:(n,r)=>{e(a=>({files:a.files.map(s=>s.id===n?he(q(q({},s),r),{lastAccessedAt:Date.now()}):s)}))},setActiveTab:n=>e({activeTab:n}),setJsonViewMode:n=>e({jsonViewMode:n}),toggleSidebar:()=>{const n=!t().sidebarCollapsed;localStorage.setItem("sidebar-collapsed",String(n)),e({sidebarCollapsed:n})},setSidebarCollapsed:n=>{localStorage.setItem("sidebar-collapsed",String(n)),e({sidebarCollapsed:n})},setIsInIframe:n=>{e({isInIframe:n})},toggleColumnStats:()=>{const n=!t().showColumnStats;localStorage.setItem("show-column-stats",String(n)),e({showColumnStats:n})},setShowColumnStats:n=>{localStorage.setItem("show-column-stats",String(n)),e({showColumnStats:n})},toggleAIAssistant:()=>{const n=!t().showAIAssistant;e({showAIAssistant:n})},setShowAIAssistant:n=>{e({showAIAssistant:n})},setAssistantSidebarWidth:n=>{e({assistantSidebarWidth:n})},changeViewMode:n=>{var s;const{activeFileId:r,updateFile:a}=t();if(r){a(r,{viewMode:n});const i=t().files.find(c=>c.id===r),l=t();if(n==="query"&&(i!=null&&i.tableName)&&!l.pendingQuery&&!((s=i.sqlState)!=null&&s.query)){const c="SELECT * FROM ".concat(i.tableName," LIMIT 100");t().setPendingQuery(c)}else if(n==="notebook"&&(i!=null&&i.tableName)){const c='import pandas as pd\nimport duckdb\n\n# Query the table\ncon = duckdb.connect()\ndf = con.execute("SELECT * FROM '.concat(i.tableName,' LIMIT 100").df()\n\n# Display basic information\nprint(f"Shape: {df.shape}")\nprint(f"\\nFirst 5 rows:")\ndf.head()');t().setPendingNotebookCode(c)}}else e({emptyStateViewMode:n})},setSplitView:(n,r)=>{e(a=>({files:a.files.map(i=>i.id===n?he(q({},i),{splitView:{isActive:!0,partnerId:r,position:"left"}}):i.id===r?he(q({},i),{splitView:{isActive:!0,partnerId:n,position:"right"}}):i),splitView:{isActive:!0,leftFileId:n,rightFileId:r,splitRatio:.5}}))},closeSplitView:()=>{e(n=>({files:n.files.map(a=>{var s;return(s=a.splitView)!=null&&s.isActive?he(q({},a),{splitView:void 0}):a}),splitView:{isActive:!1,leftFileId:null,rightFileId:null,splitRatio:.5}}))},updateSplitRatio:n=>{e(r=>({splitView:he(q({},r.splitView),{splitRatio:Math.max(.1,Math.min(.9,n))})}))},swapSplitFiles:()=>{e(n=>{const r=n.splitView.leftFileId,a=n.splitView.rightFileId;return{files:n.files.map(i=>i.id===r&&i.splitView?he(q({},i),{splitView:he(q({},i.splitView),{position:"right"})}):i.id===a&&i.splitView?he(q({},i),{splitView:he(q({},i.splitView),{position:"left"})}):i),splitView:he(q({},n.splitView),{leftFileId:n.splitView.rightFileId,rightFileId:n.splitView.leftFileId})}})},setFileSplitView:(n,r,a="left")=>{e(s=>({files:s.files.map(l=>l.id===n?he(q({},l),{splitView:r?{isActive:!0,partnerId:r,position:a}:void 0}):l)}))},clearFileSplitView:n=>{e(r=>({files:r.files.map(s=>{var i;return s.id===n||((i=s.splitView)==null?void 0:i.partnerId)===n?he(q({},s),{splitView:void 0}):s})}))},setData:n=>{const r=t(),a=r.files.find(s=>s.id===r.activeFileId);a&&n&&t().updateFile(a.id,{data:n})},loadData:n=>{t().addFile(n)},resetState:()=>e(he(q({},Y5),{sidebarCollapsed:t().sidebarCollapsed})),addRecentQuery:n=>{if(!n.trim())return;const r="recent-query:".concat(Date.now()),a={id:r,name:"Query at ".concat(new Date().toLocaleString()),query:n,timestamp:Date.now(),isFavorite:!1};CT(r,a).catch(console.error),e(s=>({recentQueries:[a,...s.recentQueries.filter(i=>i.query!==n).slice(0,tpe-1)]}))},loadQueriesFromStorage:()=>H(null,null,function*(){try{const n=yield epe(),r=n.filter(u=>String(u).startsWith("saved-query:")),a=n.filter(u=>String(u).startsWith("recent-query:")),s=r.map(u=>wT(u)),i=yield Promise.all(s),l=a.map(u=>wT(u)),c=yield Promise.all(l);e({savedQueries:i.sort((u,h)=>h.timestamp-u.timestamp),recentQueries:c.sort((u,h)=>h.timestamp-u.timestamp)})}catch(n){}}),saveQuery:(n,r)=>{if(!n.trim())return;const a="saved-query:".concat(Date.now()),s={id:a,name:r||"Saved Query ".concat(new Date().toLocaleString()),query:n,timestamp:Date.now(),isFavorite:!0};CT(a,s).catch(console.error),e(i=>({savedQueries:[s,...i.savedQueries]}))},deleteQuery:n=>{Jme(n).catch(console.error),n.startsWith("saved-query:")?e(r=>({savedQueries:r.savedQueries.filter(a=>a.id!==n)})):e(r=>({recentQueries:r.recentQueries.filter(a=>a.id!==n)}))},setIsRemoteModalOpen:n=>{e({isRemoteModalOpen:n})},setActiveProviderRemoteModal:n=>{e({activeProviderRemoteModal:n})},setPendingQuery:n=>{e({pendingQuery:n})},setPendingNotebookCode:n=>{e({pendingNotebookCode:n})},addFileToWorkspace:n=>{e(r=>({workspaceFiles:[...r.workspaceFiles,n]})),t().saveWorkspaceFilesToStorage()},removeFileFromWorkspace:n=>{const r=t().workspaceFiles.find(a=>a.id===n);e(a=>{let s=a.files;r&&(s=a.files.filter(c=>{const u=c.fileName||"",h=r.name||"";return u!==h}));let i=a.activeFileId;const l=r&&a.files.some(c=>c.id===a.activeFileId&&c.fileName===r.name);return l&&s.length>0?i=s[0].id:l&&(i=null),{workspaceFiles:a.workspaceFiles.filter(c=>c.id!==n),files:s,activeFileId:i}}),t().saveWorkspaceFilesToStorage()},loadWorkspaceFilesFromStorage:()=>H(null,null,function*(){try{const n=yield wT("datakit-workspace-files");let r={};try{r=(yield wT("datakit-file-handles"))||{}}catch(a){}if(n&&Array.isArray(n)){const a=n.map(s=>he(q({},s),{handle:r[s.id]||void 0}));e({workspaceFiles:a})}}catch(n){}}),saveWorkspaceFilesToStorage:()=>H(null,null,function*(){try{const n=t().workspaceFiles,r=n.map(a=>he(q({},a),{handle:void 0}));yield CT("datakit-workspace-files",r);try{const a={};n.forEach(s=>{s.handle&&(a[s.id]=s.handle)}),Object.keys(a).length>0&&(yield CT("datakit-file-handles",a))}catch(a){}}catch(n){}}),updateWorkspaceFile:(n,r)=>{e(a=>({workspaceFiles:a.workspaceFiles.map(s=>s.id===n?q(q({},s),r):s)})),t().saveWorkspaceFilesToStorage()}})),W5=Object.freeze(Object.defineProperty({__proto__:null,useAppStore:ut},Symbol.toStringTag,{value:"Module"})),ca=[];for(let e=0;e<256;++e)ca.push((e+256).toString(16).slice(1));function spe(e,t=0){return(ca[e[t+0]]+ca[e[t+1]]+ca[e[t+2]]+ca[e[t+3]]+"-"+ca[e[t+4]]+ca[e[t+5]]+"-"+ca[e[t+6]]+ca[e[t+7]]+"-"+ca[e[t+8]]+ca[e[t+9]]+"-"+ca[e[t+10]]+ca[e[t+11]]+ca[e[t+12]]+ca[e[t+13]]+ca[e[t+14]]+ca[e[t+15]]).toLowerCase()}let RA;const ipe=new Uint8Array(16);function ope(){if(!RA){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");RA=crypto.getRandomValues.bind(crypto)}return RA(ipe)}const lpe=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),X5={randomUUID:lpe};function cpe(e,t,n){var a,s,i;e=e||{};const r=(i=(s=e.random)!=null?s:(a=e.rng)==null?void 0:a.call(e))!=null?i:ope();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,spe(r)}function upe(e,t,n){return X5.randomUUID?X5.randomUUID():cpe(e)}function ai(e){const t=[];e.forEach(r=>{r.type==="folder"&&(r.children=[])}),e.forEach(r=>{if(r.parentId===null)t.push(r);else{const a=e.get(r.parentId);a&&a.type==="folder"&&(a.children||(a.children=[]),a.children.push(r))}});const n=r=>{r.sort((a,s)=>a.type!==s.type?a.type==="folder"?-1:1:a.name.localeCompare(s.name)),r.forEach(a=>{a.children&&n(a.children)})};return n(t),t}const xs=Ki()(V1((e,t)=>({roots:[],nodeMap:new Map,selectedIds:new Set,expandedIds:new Set,draftFolderId:null,remoteFolderId:null,tempFolderId:null,initializeStore:()=>{const n=t();if(!n.draftFolderId){const r=t().createFolder("Draft",null),a=new Map(t().nodeMap),s=a.get(r);if(s){s.folderData=he(q({},s.folderData),{isDraft:!0});const i=ai(a);e({draftFolderId:r,nodeMap:a,roots:i})}}if(!n.remoteFolderId){const r=t().createFolder("Remote Sources",null),a=new Map(t().nodeMap),s=a.get(r);if(s){s.folderData=he(q({},s.folderData),{isRemote:!0});const i=ai(a);e({remoteFolderId:r,nodeMap:a,roots:i})}}},addNode:(n,r)=>{const a=upe(),s=Date.now(),i=he(q({},n),{id:a,parentId:r||null,createdAt:s,modifiedAt:s,children:n.type==="folder"?[]:void 0}),l=new Map(t().nodeMap);l.set(a,i);const c=ai(l);return e({nodeMap:l,roots:c}),a},removeNode:n=>{const r=new Map(t().nodeMap),a=new Set(t().selectedIds),s=new Set(t().expandedIds),i=c=>{const u=r.get(c);u&&(u.children&&u.children.forEach(h=>i(h.id)),r.delete(c),a.delete(c),s.delete(c))};i(n);const l=ai(r);e({nodeMap:r,roots:l,selectedIds:a,expandedIds:s})},moveNode:(n,r)=>{const a=new Map(t().nodeMap),s=a.get(n);if(!s)return;if(r){let l=a.get(r);for(;l;){if(l.id===n)return;l=l.parentId?a.get(l.parentId):void 0}}s.parentId=r,s.modifiedAt=Date.now();const i=ai(a);e({nodeMap:a,roots:i})},renameNode:(n,r)=>{const a=new Map(t().nodeMap),s=a.get(n);if(s){const i=s.name;s.name=r,s.modifiedAt=Date.now(),s.type==="file"&&fn(()=>H(null,null,function*(){const{useAppStore:c}=yield Promise.resolve().then(()=>W5);return{useAppStore:c}}),void 0).then(({useAppStore:c})=>{const{workspaceFiles:u,updateWorkspaceFile:h,files:m,updateFile:p}=c.getState(),g=u.find(T=>T.name===i);if(g){const T={name:r};g.originalName||(T.originalName=i),h(g.id,T);const y=m.find(b=>b.fileName===i);y&&p(y.id,{fileName:r})}}).catch(console.error);const l=ai(a);e({nodeMap:a,roots:l})}},createFolder:(n,r=null)=>t().addNode({name:n,type:"folder",folderData:{}},r),toggleFolder:n=>{const r=new Set(t().expandedIds);r.has(n)?r.delete(n):r.add(n),e({expandedIds:r})},expandFolder:n=>{const r=new Set(t().expandedIds);r.add(n),e({expandedIds:r})},collapseFolder:n=>{const r=new Set(t().expandedIds);r.delete(n),e({expandedIds:r})},linkFolder:(n,r=null)=>H(null,null,function*(){var i;const a=t().createFolder(n.name,r),s=t().getNodeById(a);if(s){s.folderData=he(q({},s.folderData),{isLinked:!0,directoryHandle:n});try{try{for(var l=iT(n.values()),c,u,h;c=!(u=yield l.next()).done;c=!1){const m=u.value;if(m.kind==="file"){const p=yield m.getFile(),g=(i=p.name.split(".").pop())==null?void 0:i.toLowerCase();if(g&&["csv","json","xlsx","xls","parquet","txt","duckdb","db"].includes(g)){t().addFile(p,{handle:m,size:p.size,lastModified:p.lastModified,fileType:g,isLoaded:!1},a);const{useAppStore:y}=yield fn(()=>H(null,null,function*(){const{useAppStore:R}=yield Promise.resolve().then(()=>W5);return{useAppStore:R}}),void 0),{addFileToWorkspace:b}=y.getState(),x={id:"file-".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),name:p.name,originalName:p.name,type:g==="xlsx"||g==="xls"?"excel":g,size:p.size,lastModified:p.lastModified,handle:m};b(x)}}else m.kind==="directory"&&t().getParentChain(a).length<3&&(yield t().linkFolder(m,a))}}catch(u){h=[u]}finally{try{c&&(u=l.return)&&(yield u.call(l))}finally{if(h)throw h[0]}}}catch(m){}}}),addFile:(n,r,a)=>{const s=t();let i=a||s.draftFolderId;return i||(s.draftFolderId||t().initializeStore(),i=t().draftFolderId),t().addNode({name:n.name,type:"file",fileData:he(q({},r),{size:n.size,lastModified:n.lastModified})},i)},updateFileData:(n,r)=>{const a=new Map(t().nodeMap),s=a.get(n);if(s&&s.type==="file"){s.fileData=q(q({},s.fileData),r),s.modifiedAt=Date.now();const i=ai(a);e({nodeMap:a,roots:i})}},markFileAsLoaded:(n,r)=>{t().updateFileData(n,{isLoaded:!0,tableName:r})},selectNode:(n,r=!1)=>{const a=new Set(r?t().selectedIds:[]);a.add(n),e({selectedIds:a})},clearSelection:()=>{e({selectedIds:new Set})},getNodeById:n=>t().nodeMap.get(n),getChildren:n=>{if(n===null)return t().roots;const r=t().nodeMap.get(n);return(r==null?void 0:r.children)||[]},getParentChain:n=>{const r=[];let a=t().nodeMap.get(n);for(;a&&a.parentId;){const s=t().nodeMap.get(a.parentId);if(s)r.unshift(s),a=s;else break}return r},findNodeByPath:n=>{const r=n.split("/").filter(i=>i);let a=t().roots,s;for(const i of r){if(s=a.find(l=>l.name===i),!s)return;s.type==="folder"&&s.children&&(a=s.children)}return s},exportTree:()=>{const n=t();return JSON.stringify({roots:n.roots,nodeMap:Array.from(n.nodeMap.entries()),draftFolderId:n.draftFolderId,remoteFolderId:n.remoteFolderId,tempFolderId:n.tempFolderId},null,2)},importTree:n=>{try{const r=JSON.parse(n),a=new Map(r.nodeMap),s=ai(a);e({roots:s,nodeMap:a,draftFolderId:r.draftFolderId,remoteFolderId:r.remoteFolderId,tempFolderId:r.tempFolderId,selectedIds:new Set,expandedIds:new Set})}catch(r){}},ensureDraftFolder:()=>{const n=t();if(!n.draftFolderId){const r=t().createFolder("Draft",null),a=new Map(t().nodeMap),s=a.get(r);if(s){s.folderData=he(q({},s.folderData),{isDraft:!0});const i=ai(a);e({draftFolderId:r,nodeMap:a,roots:i})}return r}return n.draftFolderId},ensureRemoteFolder:()=>{const n=t();if(!n.remoteFolderId){const r=t().createFolder("Remote Sources",null),a=new Map(t().nodeMap),s=a.get(r);if(s){s.folderData=he(q({},s.folderData),{isRemote:!0});const i=ai(a);e({remoteFolderId:r,nodeMap:a,roots:i})}return r}return n.remoteFolderId},ensureTempFolder:()=>{const n=t();if(!n.tempFolderId){const r=t().createFolder("Temporary Tables",null),a=new Map(t().nodeMap),s=a.get(r);if(s){s.folderData=he(q({},s.folderData),{isTemp:!0});const i=ai(a);e({tempFolderId:r,nodeMap:a,roots:i})}return r}return n.tempFolderId},cleanupTempFolder:()=>{const n=t();if(n.tempFolderId){const r=t().getNodeById(n.tempFolderId);r&&r.children&&r.children.forEach(a=>{t().removeNode(a.id)})}},clearAll:()=>{e({roots:[],nodeMap:new Map,selectedIds:new Set,expandedIds:new Set,draftFolderId:null,remoteFolderId:null,tempFolderId:null})}}),{name:"folder-tree-storage",partialize:e=>{const t=new Map(e.nodeMap);let n=[...e.roots];return e.tempFolderId&&(t.delete(e.tempFolderId),n=n.filter(r=>r.id!==e.tempFolderId)),{roots:n,nodeMap:Array.from(t.entries()),expandedIds:Array.from(e.expandedIds),draftFolderId:e.draftFolderId,remoteFolderId:e.remoteFolderId}},onRehydrateStorage:()=>e=>{e&&(e.nodeMap=new Map(e.nodeMap),e.expandedIds=new Set(e.expandedIds),e.selectedIds=new Set,e.tempFolderId=null,e.initializeStore())}})),dpe=Object.freeze(Object.defineProperty({__proto__:null,useFolderStore:xs},Symbol.toStringTag,{value:"Module"})),hpe=({onFileDrop:e,isProcessing:t=!1})=>{const{t:n}=Ze(),[r,a]=v.useState(!1),[s,i]=v.useState(0),{selectedIds:l,getNodeById:c,draftFolderId:u}=xs(),h=v.useCallback(()=>{const b=Array.from(l)[0];if(b){const x=c(b);if((x==null?void 0:x.type)==="folder")return{id:b,name:x.name};if(x!=null&&x.parentId){const R=c(x.parentId);if(R)return{id:R.id,name:R.name}}}if(u){const x=c(u);return{id:u,name:(x==null?void 0:x.name)||"Draft"}}return{id:"draft-fallback",name:"Draft"}},[l,c,u]),m=v.useCallback(b=>{var x;b.preventDefault(),(x=b.dataTransfer)!=null&&x.types.includes("Files")&&(i(R=>R+1),s===0&&a(!0))},[s]),p=v.useCallback(b=>{b.preventDefault(),i(x=>{const R=x-1;return R===0&&a(!1),R})},[]),g=v.useCallback(b=>{b.preventDefault(),b.dataTransfer&&(b.dataTransfer.dropEffect="copy")},[]),T=v.useCallback(b=>H(null,null,function*(){var N,I;b.preventDefault(),a(!1),i(0);const x=Array.from(((N=b.dataTransfer)==null?void 0:N.files)||[]);if(x.length===0)return;const R=["csv","json","xlsx","xls","parquet","txt","duckdb","db"],A=x.filter(D=>{var O;const M=(O=D.name.split(".").pop())==null?void 0:O.toLowerCase();return M&&R.includes(M)});if(A.length===0){alert(n("dropZone.unsupportedFiles","No supported files found. Supported formats: CSV, JSON, Excel, Parquet, TXT, DuckDB"));return}const w=h(),_=w.id==="draft-fallback"?u||void 0:w.id;try{const D=Array.from(((I=b.dataTransfer)==null?void 0:I.items)||[]),M=[];for(let O=0;O<D.length;O++){const L=D[O];try{if(L!=null&&L.getAsFileSystemHandle){const k=yield L.getAsFileSystemHandle();(k==null?void 0:k.kind)==="file"?M.push(k):M.push(void 0)}else M.push(void 0)}catch(k){M.push(void 0)}}e&&(yield e(A,_,M))}catch(D){}}),[e,h,n,u]);v.useEffect(()=>{const b=w=>m(w),x=w=>p(w),R=w=>g(w),A=w=>T(w);return document.addEventListener("dragenter",b),document.addEventListener("dragleave",x),document.addEventListener("dragover",R),document.addEventListener("drop",A),()=>{document.removeEventListener("dragenter",b),document.removeEventListener("dragleave",x),document.removeEventListener("dragover",R),document.removeEventListener("drop",A)}},[m,p,g,T]);const y=h();return o.jsx(At,{children:r&&o.jsxs(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 z-[9999] pointer-events-none",children:[o.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-8",children:o.jsxs(me.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},transition:{type:"spring",stiffness:300,damping:30},className:"relative bg-dark backdrop-blur-md rounded-2xl border-2 border-dashed border-primary p-12 max-w-md w-full mx-auto text-center",children:[o.jsx(me.div,{animate:{scale:[1,1.1,1]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"mb-6",children:o.jsx(G0,{className:"w-16 h-16 text-primary mx-auto"})}),o.jsx("div",{children:t?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"text-2xl font-bold text-primary mb-2",children:n("dropZone.processing","Processing Files...")}),o.jsx("p",{className:"text-white/70",children:n("dropZone.processingMessage","Please wait while we import your files")})]}):o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"text-2xl font-bold text-white mb-2",children:n("dropZone.title","Drop Files to Import")}),o.jsx("p",{className:"text-white/70 mb-4",children:n("dropZone.description","Release to add files to your workspace")}),o.jsxs("div",{className:"flex items-center justify-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[o.jsx(ng,{className:"w-4 h-4 text-primary"}),o.jsx("span",{className:"text-sm text-white font-medium",children:n("dropZone.targetFolder","Target: {{folder}}",{folder:y.name})})]})]})}),!t&&o.jsx(me.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},className:"text-xs text-white/50 mt-4",children:n("dropZone.supportedFormats","CSV, JSON, Excel, Parquet, TXT, DuckDB")}),o.jsx(me.div,{className:"absolute inset-0 rounded-2xl border-2 border-primary/30",animate:{scale:[1,1.02,1],opacity:[.3,.6,.3]},transition:{duration:2,repeat:1/0,ease:"easeInOut"}})]})})]})})};function fpe(){const[e,t]=v.useState([]),[n,r]=v.useState(!1),[a,s]=v.useState(null);v.useEffect(()=>{try{const T=localStorage.getItem("datakit_recent_files");if(T){const y=JSON.parse(T);t(y)}}catch(T){}},[]),v.useEffect(()=>{if(e.length>0)try{const T=e.map(x=>{var R=x,{handle:y}=R,b=Tn(R,["handle"]);return b});localStorage.setItem("datakit_recent_files",JSON.stringify(T))}catch(T){}},[e]);const i=v.useCallback((T,y)=>{var R;const b=((R=T.name.split(".").pop())==null?void 0:R.toLowerCase())||"",x={name:T.name,size:T.size,type:b,lastAccessed:Date.now(),handle:y};return t(A=>{const w=A.filter(_=>_.name!==T.name);return[x,...w].slice(0,10)}),x},[]),l=v.useCallback(()=>H(null,null,function*(){r(!0),s(null);try{if(!("showOpenFilePicker"in window))throw new Error("File System Access API not supported");const[T]=yield window.showOpenFilePicker({types:[{description:"Data Files",accept:{"text/csv":[".csv"],"application/json":[".json"],"application/vnd.apache.parquet":[".parquet"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.ms-excel":[".xls"],"text/plain":[".txt"]}}],multiple:!1}),y=yield T.getFile();return i(y,T),r(!1),{handle:T,file:y}}catch(T){if(T instanceof Error&&T.name==="AbortError")return r(!1),null;const y=T instanceof Error?T.message:"Unknown error accessing file";return s(y),r(!1),null}}),[i]),c=v.useCallback(()=>H(null,null,function*(){const T=yield l();return(T==null?void 0:T.file)||null}),[l]),u=v.useCallback(T=>H(null,null,function*(){try{return T.stream()}catch(y){const b=y instanceof Error?y.message:"Unknown error getting file stream";throw s(b),y}}),[]),h=v.useCallback(T=>H(null,null,function*(){try{return(yield T.getFile()).stream()}catch(y){const b=y instanceof Error?y.message:"Unknown error getting file from handle";return s(b),null}}),[]),m=v.useCallback(T=>H(null,null,function*(){r(!0),s(null);try{if(T.handle){const y=yield T.handle.getFile();return t(b=>b.map(x=>x.name===T.name?he(q({},x),{lastAccessed:Date.now()}):x)),r(!1),{handle:T.handle,file:y}}else throw new Error("File is no longer accessible. Please bring it again.")}catch(y){const b=y instanceof Error?y.message:"Unknown error opening recent file";return s(b),r(!1),null}}),[]),p=v.useCallback(T=>H(null,null,function*(){const y=yield m(T);return(y==null?void 0:y.file)||null}),[m]),g=v.useCallback(()=>{t([]),localStorage.removeItem("datakit_recent_files")},[]);return{recentFiles:e,isLoading:n,error:a,addRecentFile:i,requestFile:c,requestFileHandle:l,getFileStream:u,getStreamFromHandle:h,openRecentFile:p,getRecentFileHandle:m,clearRecentFiles:g}}class ha{static detectSourceType(t){var r;switch((r=t.split(".").pop())==null?void 0:r.toLowerCase()){case"json":case"jsonl":case"ndjson":return tr.JSON;case"xlsx":case"xls":return tr.XLSX;case"parquet":return tr.PARQUET;case"txt":return tr.TXT;case"tsv":return tr.TSV;case"csv":default:return tr.CSV}}static detectColumnTypes(t,n){return t.map((r,a)=>{const s=n.slice(1,20).map(u=>u[a]).filter(u=>u&&u.trim());return s.length===0?Nt.Text:s.filter(u=>!isNaN(Number(u))&&u.trim()!=="").length>s.length*.8?Nt.Number:s.filter(u=>["true","false","1","0","yes","no"].includes(u.toLowerCase())).length>s.length*.8?Nt.Boolean:s.filter(u=>!isNaN(Date.parse(u))).length>s.length*.6?Nt.Date:Nt.Text})}static createDataLoadResult(t,n,r={}){var s;const a=r.tableName||n.replace(/[^a-zA-Z0-9_]/g,"_").toLowerCase();return{data:t.data,columnTypes:t.columnTypes,fileName:n,rowCount:t.rowCount,columnCount:t.columnCount,sourceType:t.sourceType,rawData:r.rawData,loadedToDuckDB:(s=r.loadedToDuckDB)!=null?s:!1,tableName:a,isRemote:r.isRemote,remoteURL:r.remoteURL,remoteProvider:r.remoteProvider,isStreamingImport:r.isStreamingImport,convertedFromExcel:r.convertedFromExcel}}static shouldUseStreaming(t){return t/1048576>10}static isFileTooLarge(t){return t/1073741824>1}static getFileSizeCategory(t){const n=t/1048576;return n<1?"small":n<50?"medium":n<500?"large":"huge"}static formatFileSize(t){const n=["B","KB","MB","GB"];if(t===0)return"0 B";const r=Math.floor(Math.log(t)/Math.log(1024)),a=(t/Math.pow(1024,r)).toFixed(1);return"".concat(a," ").concat(n[r])}static validateFile(t,n){const r=[],a=[],s=[],i=this.getFileSizeCategory(n);return this.isFileTooLarge(n)?(a.push("File is too large (".concat(this.formatFileSize(n),"). Maximum supported size is 2GB.")),s.push("Consider splitting the file or using a server-side processing solution.")):i==="large"?(r.push("Large file detected (".concat(this.formatFileSize(n),"). Processing may take some time.")),s.push("Streaming import will be used automatically for better performance.")):this.shouldUseStreaming(n)&&r.push("File size (".concat(this.formatFileSize(n),") will use streaming import.")),this.detectSourceType(t)===tr.XLSX&&(r.push("Excel files will be converted to CSV format for processing."),s.push("For best performance, consider converting to CSV format before importing.")),{isValid:a.length===0,warnings:r,errors:a,recommendations:s}}}const zc=e=>e.toArray().map(t=>{const n=t.type.toLowerCase();return n.includes("int")||n.includes("float")||n.includes("double")||n.includes("decimal")||n.includes("number")?Nt.Number:n.includes("bool")?Nt.Boolean:n.includes("date")||n.includes("time")||n.includes("timestamp")?Nt.Date:n.includes("json")||n.includes("object")||n.includes("map")?Nt.Object:n.includes("array")||n.includes("list")?Nt.Array:Nt.Text});function KW(){const[e,t]=v.useState(!1),[n,r]=v.useState(""),[a,s]=v.useState(0),[i,l]=v.useState(null),{importFileDirectly:c,importFileDirectlyStreaming:u,executeQuery:h,processingProgress:m}=Dt(),{addRecentFile:p}=fpe(),g=v.useCallback((b,x)=>{const R=b.toArray().map(w=>w.name);return[R,...x.toArray().map(w=>R.map(_=>w[_]===null||w[_]===void 0?"":String(w[_])))]},[]),T=v.useCallback((b,x,R)=>H(null,null,function*(){var A;try{t(!0),l(null);const w=ha.getFileSizeCategory(x.size),_=ha.formatFileSize(x.size),N=ha.shouldUseStreaming(x.size);r("Starting ".concat(N?"streaming ":"","import for: ").concat(x.name," (").concat(_,")")),p(x);const I=(A=x.name.split(".").pop())==null?void 0:A.toLowerCase(),D=ha.detectSourceType(x.name);let M=!1;I==="xlsx"||I==="xls"?(r("Converting Excel file to CSV for reliable processing..."),M=!0):r(I==="parquet"?"".concat(N?"Streaming ":"","Parquet file import..."):N?"Streaming ".concat(I==null?void 0:I.toUpperCase()," file import (large file detected)..."):"Importing ".concat(I==null?void 0:I.toUpperCase()," file..."));const O=setInterval(()=>{s(m*100)},100);try{let L;if(N||I==="parquet"?L=yield u(b,x.name,x.size):L=yield c(x),L!=null&&L.isDatabaseFile){r("Successfully attached database '".concat(L.tableName,"' with ").concat(L.rowCount," table(s)"));const K={data:[],columnTypes:[],fileName:x.name,rowCount:L.rowCount,columnCount:0,sourceType:D,loadedToDuckDB:!0,tableName:L.tableName,isDatabaseAttachment:!0,attachedTables:L.attachedTables,isStreamingImport:N};return R&&R(K),K}M&&L.convertedToCsv?r("Successfully imported Excel data via CSV conversion (".concat(L.rowCount.toLocaleString()," rows)")):r(N?"Successfully streamed rows from ".concat(x.name):"Successfully imported rows from ".concat(x.name));const k=yield h('PRAGMA table_info("'.concat(L.tableName,'")'));if(!k)throw new Error("Failed to get table schema");const F=yield h('SELECT * FROM "'.concat(L.tableName,'" LIMIT 1000'));if(!F)throw new Error("Failed to get data sample");const U=g(k,F),B=zc(k),j=k.toArray().map(K=>K.name),G={data:U,columnTypes:B,fileName:x.name,rowCount:L.rowCount,columnCount:j.length,sourceType:D,loadedToDuckDB:!0,tableName:L.tableName,convertedFromExcel:M&&L.convertedToCsv,isStreamingImport:N};return R&&R(G),G}finally{clearInterval(O)}}catch(w){const _=w instanceof Error?w.message:String(w);throw _.toLowerCase().includes("excel")?l("Excel import error: ".concat(_,". Consider converting to CSV format first.")):_.toLowerCase().includes("memory")?l("Memory error: ".concat(_,". File may be too large for browser processing.")):l("Error: ".concat(_)),r("Import failed"),w}finally{t(!1)}}),[c,u,h,m,p,zc,g]);return{processFile:v.useCallback((b,x)=>H(null,null,function*(){try{t(!0),l(null);const R=ha.validateFile(b.name,b.size),A=ha.formatFileSize(b.size),w=ha.getFileSizeCategory(b.size),_=800*1024*1024;if(b.size>_){const D="File too large (".concat(A,") for legacy import. Please use a modern browser (Chrome/Edge) with streaming support for files over 800MB.");throw alert(D),new Error(D)}R.warnings.length>0,r("Starting import process for: ".concat(b.name," (").concat(A,")")),p(b);const N=ha.detectSourceType(b.name),I=setInterval(()=>{s(m*100)},100);try{const D=yield c(b),M=yield h('PRAGMA table_info("'.concat(D.tableName,'")'));if(!M)throw new Error("Failed to get table schema");const O=yield h('SELECT * FROM "'.concat(D.tableName,'" LIMIT 1000'));if(!O)throw new Error("Failed to get data sample");const L=g(M,O),k=zc(M),F=M.toArray().map(B=>B.name),U={data:L,columnTypes:k,fileName:b.name,rowCount:D.rowCount,columnCount:F.length,sourceType:N,loadedToDuckDB:!0,tableName:D.tableName};return x&&x(U),U}finally{clearInterval(I)}}catch(R){const A=R instanceof Error?R.message:String(R);throw ha.isFileTooLarge(b.size)?l("File too large (".concat(ha.formatFileSize(b.size),"). Maximum supported size is 2GB.")):l("Error: ".concat(A)),r("Import failed"),R}finally{t(!1)}}),[p,c,h,m,zc,g]),processFileStreaming:T,isProcessing:e,loadingStatus:n,loadingProgress:a,processingError:i,setLoadingStatus:r,setProcessingError:l}}const NA=()=>"showOpenFilePicker"in window&&"FileSystemFileHandle"in window,K5={types:[{description:"Data Files",accept:{"text/csv":[".csv"],"application/json":[".json"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.ms-excel":[".xls"],"application/x-parquet":[".parquet"],"application/vnd.apache.parquet":[".parquet"],"text/plain":[".txt"],"application/octet-stream":[".duckdb",".db"]}}],excludeAcceptAllOption:!1},UL=()=>{const{t:e}=Ze(),t=q0(),{showSuccess:n,showError:r}=ec(),{addFile:a,addFileToWorkspace:s}=ut(),{addFile:i,draftFolderId:l,expandFolder:c}=xs(),{processFile:u,processFileStreaming:h,isProcessing:m}=KW(),p=v.useCallback((A,w)=>{var I;const _=((I=A.name.split(".").pop())==null?void 0:I.toLowerCase())||"txt",N=_==="xlsx"||_==="xls"?"excel":_;return{id:"file-".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),name:A.name,type:N,size:A.size,lastModified:A.lastModified,handle:w}},[]),g=v.useCallback((A,w,_,N)=>{var B,j;const{files:I,setActiveFile:D,workspaceFiles:M}=ut.getState(),O=I.find(G=>G.fileName===A.name);if(O){if(D(O.id),N){const G=((B=A.name.split(".").pop())==null?void 0:B.toLowerCase())||"txt",{getChildren:K}=xs.getState();if(!K(N).find(X=>X.type==="file"&&X.name===A.name)){if(i(A,{handle:_,size:A.size,lastModified:A.lastModified,fileType:G,isLoaded:!0,tableName:w.tableName},N),!M.find(Z=>Z.name===A.name)){const Z=p(A,_);s(Z)}c(N)}}return O.id}const L=a(w),k=M.find(G=>G.name===A.name);if(k){if(_&&!k.handle){const{updateWorkspaceFile:G}=ut.getState();G(k.id,{handle:_})}}else{const G=p(A,_);s(G)}const F=((j=A.name.split(".").pop())==null?void 0:j.toLowerCase())||"txt",U=N||l||void 0;return i(A,{handle:_,size:A.size,lastModified:A.lastModified,fileType:F,isLoaded:!0,tableName:w.tableName},U),U&&c(U),t.trackFileUpload(w),n(e("layout.sidebar.fileImported"),e("layout.sidebar.fileImportedMessage",{fileName:A.name}),{icon:"check",duration:5e3}),L},[a,s,i,p,l,c,t,n,e]),T=v.useCallback((A,w,_,N)=>H(null,null,function*(){try{const I=yield h(A,w,_);if(I)return g(w,I,A,N),I}catch(I){throw r(e("sidebar.importError"),I instanceof Error?I.message:"Failed to import file"),I}}),[h,g,r,e]),y=v.useCallback((A,w,_)=>H(null,null,function*(){try{const N=yield u(A,w);if(N)return g(A,N,void 0,_),N}catch(N){throw r(e("sidebar.importError"),N instanceof Error?N.message:"Failed to import file"),N}}),[u,g,r,e]),b=v.useCallback((A,w,_=!0)=>H(null,null,function*(){if(NA())try{const N=yield window.showOpenFilePicker(he(q({},K5),{multiple:_})),I=[];for(const D of N){const M=yield D.getFile(),O=yield T(D,M,A,w);O&&I.push(O)}return I}catch(N){if(N.name==="AbortError")return[]}return new Promise(N=>{const I=document.createElement("input");I.type="file",I.multiple=_,I.accept=".csv,.json,.xlsx,.xls,.parquet,.txt,.duckdb,.db",I.onchange=D=>H(null,null,function*(){const M=Array.from(D.target.files||[]),O=[];for(const L of M){const k=yield y(L,A,w);k&&O.push(k)}N(O)}),I.click()})}),[T,y]),x=v.useCallback((A,w,_)=>H(null,null,function*(){const N=[];for(const I of A)try{const D=yield y(I,w,_);D&&N.push(D)}catch(D){}return N}),[y]),R=v.useCallback((A,w)=>H(null,null,function*(){if(A.handle)try{if((yield A.handle.requestPermission({mode:"read"}))==="granted"){const N=yield A.handle.getFile(),I=A.originalName||A.name;if(N.name===I)return yield T(A.handle,N,w);throw new Error("File name mismatch")}else throw new Error("Permission denied for stored file handle")}catch(_){}if(NA())try{const[_]=yield window.showOpenFilePicker(he(q({},K5),{multiple:!1})),N=yield _.getFile(),I=A.originalName||A.name;if(N.name===I){const{updateWorkspaceFile:D}=ut.getState();return D(A.id,{handle:_}),yield T(_,N,w)}else throw new Error("Please select the correct file: ".concat(I))}catch(_){throw _.name!=="AbortError"&&r(e("sidebar.fileLoadError","Failed to Load File"),_ instanceof Error?_.message:"Failed to select file"),_}else throw r(e("sidebar.fileLoadError","Failed to Load File"),"File handle not available and browser does not support file picker. Please re-import the file."),new Error("File handle not available")}),[T,r,e]);return{importFile:y,importFileWithHandle:T,importFiles:x,openFilePicker:b,reopenWorkspaceFile:R,isFileSystemAccessSupported:NA(),isProcessing:m,handleButtonClick:()=>b(),handleFileSelect:x}};function QW(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=QW(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function JW(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=QW(e))&&(r&&(r+=" "),r+=t);return r}function mpe(){for(var e=0,t,n,r="";e<arguments.length;)(t=arguments[e++])&&(n=ZW(t))&&(r&&(r+=" "),r+=n);return r}function ZW(e){if(typeof e=="string")return e;for(var t,n="",r=0;r<e.length;r++)e[r]&&(t=ZW(e[r]))&&(n&&(n+=" "),n+=t);return n}var FL="-";function ppe(e){var t=Epe(e),n=e.conflictingClassGroups,r=e.conflictingClassGroupModifiers,a=r===void 0?{}:r;function s(l){var c=l.split(FL);return c[0]===""&&c.length!==1&&c.shift(),e7(c,t)||gpe(l)}function i(l,c){var u=n[l]||[];return c&&a[l]?[].concat(u,a[l]):u}return{getClassGroupId:s,getConflictingClassGroupIds:i}}function e7(e,t){var i;if(e.length===0)return t.classGroupId;var n=e[0],r=t.nextPart.get(n),a=r?e7(e.slice(1),r):void 0;if(a)return a;if(t.validators.length!==0){var s=e.join(FL);return(i=t.validators.find(function(l){var c=l.validator;return c(s)}))==null?void 0:i.classGroupId}}var Q5=/^\[(.+)\]$/;function gpe(e){if(Q5.test(e)){var t=Q5.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}}function Epe(e){var t=e.theme,n=e.prefix,r={nextPart:new Map,validators:[]},a=ype(Object.entries(e.classGroups),n);return a.forEach(function(s){var i=s[0],l=s[1];pO(l,r,i,t)}),r}function pO(e,t,n,r){e.forEach(function(a){if(typeof a=="string"){var s=a===""?t:J5(t,a);s.classGroupId=n;return}if(typeof a=="function"){if(Tpe(a)){pO(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(function(i){var l=i[0],c=i[1];pO(c,J5(t,l),n,r)})})}function J5(e,t){var n=e;return t.split(FL).forEach(function(r){n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function Tpe(e){return e.isThemeGetter}function ype(e,t){return t?e.map(function(n){var r=n[0],a=n[1],s=a.map(function(i){return typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(function(l){var c=l[0],u=l[1];return[t+c,u]})):i});return[r,s]}):e}function xpe(e){if(e<1)return{get:function(){},set:function(){}};var t=0,n=new Map,r=new Map;function a(s,i){n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)}return{get:function(i){var l=n.get(i);if(l!==void 0)return l;if((l=r.get(i))!==void 0)return a(i,l),l},set:function(i,l){n.has(i)?n.set(i,l):a(i,l)}}}var t7="!";function Spe(e){var t=e.separator||":",n=t.length===1,r=t[0],a=t.length;return function(i){for(var l=[],c=0,u=0,h,m=0;m<i.length;m++){var p=i[m];if(c===0){if(p===r&&(n||i.slice(m,m+a)===t)){l.push(i.slice(u,m)),u=m+a;continue}if(p==="/"){h=m;continue}}p==="["?c++:p==="]"&&c--}var g=l.length===0?i:i.substring(u),T=g.startsWith(t7),y=T?g.substring(1):g,b=h&&h>u?h-u:void 0;return{modifiers:l,hasImportantModifier:T,baseClassName:y,maybePostfixModifierPosition:b}}}function bpe(e){if(e.length<=1)return e;var t=[],n=[];return e.forEach(function(r){var a=r[0]==="[";a?(t.push.apply(t,n.sort().concat([r])),n=[]):n.push(r)}),t.push.apply(t,n.sort()),t}function vpe(e){return q({cache:xpe(e.cacheSize),splitModifiers:Spe(e)},ppe(e))}var Ape=/\s+/;function Rpe(e,t){var n=t.splitModifiers,r=t.getClassGroupId,a=t.getConflictingClassGroupIds,s=new Set;return e.trim().split(Ape).map(function(i){var l=n(i),c=l.modifiers,u=l.hasImportantModifier,h=l.baseClassName,m=l.maybePostfixModifierPosition,p=r(m?h.substring(0,m):h),g=!!m;if(!p){if(!m)return{isTailwindClass:!1,originalClassName:i};if(p=r(h),!p)return{isTailwindClass:!1,originalClassName:i};g=!1}var T=bpe(c).join(":"),y=u?T+t7:T;return{isTailwindClass:!0,modifierId:y,classGroupId:p,originalClassName:i,hasPostfixModifier:g}}).reverse().filter(function(i){if(!i.isTailwindClass)return!0;var l=i.modifierId,c=i.classGroupId,u=i.hasPostfixModifier,h=l+c;return s.has(h)?!1:(s.add(h),a(c,u).forEach(function(m){return s.add(l+m)}),!0)}).reverse().map(function(i){return i.originalClassName}).join(" ")}function Npe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,a,s,i=l;function l(u){var h=t[0],m=t.slice(1),p=m.reduce(function(g,T){return T(g)},h());return r=vpe(p),a=r.cache.get,s=r.cache.set,i=c,c(u)}function c(u){var h=a(u);if(h)return h;var m=Rpe(u,r);return s(u,m),m}return function(){return i(mpe.apply(null,arguments))}}function rr(e){var t=function(r){return r[e]||[]};return t.isThemeGetter=!0,t}var n7=/^\[(?:([a-z-]+):)?(.+)\]$/i,_pe=/^\d+\/\d+$/,wpe=new Set(["px","full","screen"]),Cpe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ipe=/\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$/,Ope=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;function si(e){return qc(e)||wpe.has(e)||_pe.test(e)||gO(e)}function gO(e){return Ou(e,"length",jpe)}function Lpe(e){return Ou(e,"size",r7)}function Mpe(e){return Ou(e,"position",r7)}function Dpe(e){return Ou(e,"url",Upe)}function IT(e){return Ou(e,"number",qc)}function qc(e){return!Number.isNaN(Number(e))}function Ppe(e){return e.endsWith("%")&&qc(e.slice(0,-1))}function bm(e){return Z5(e)||Ou(e,"number",Z5)}function dn(e){return n7.test(e)}function vm(){return!0}function xl(e){return Cpe.test(e)}function kpe(e){return Ou(e,"",Fpe)}function Ou(e,t,n){var r=n7.exec(e);return r?r[1]?r[1]===t:n(r[2]):!1}function jpe(e){return Ipe.test(e)}function r7(){return!1}function Upe(e){return e.startsWith("url(")}function Z5(e){return Number.isInteger(Number(e))}function Fpe(e){return Ope.test(e)}function $pe(){var e=rr("colors"),t=rr("spacing"),n=rr("blur"),r=rr("brightness"),a=rr("borderColor"),s=rr("borderRadius"),i=rr("borderSpacing"),l=rr("borderWidth"),c=rr("contrast"),u=rr("grayscale"),h=rr("hueRotate"),m=rr("invert"),p=rr("gap"),g=rr("gradientColorStops"),T=rr("gradientColorStopPositions"),y=rr("inset"),b=rr("margin"),x=rr("opacity"),R=rr("padding"),A=rr("saturate"),w=rr("scale"),_=rr("sepia"),N=rr("skew"),I=rr("space"),D=rr("translate"),M=function(){return["auto","contain","none"]},O=function(){return["auto","hidden","clip","visible","scroll"]},L=function(){return["auto",dn,t]},k=function(){return[dn,t]},F=function(){return["",si]},U=function(){return["auto",qc,dn]},B=function(){return["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"]},j=function(){return["solid","dashed","dotted","double","none"]},G=function(){return["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"]},K=function(){return["start","end","center","between","around","evenly","stretch"]},J=function(){return["","0",dn]},$=function(){return["auto","avoid","all","avoid-page","page","left","right","column"]},X=function(){return[qc,IT]},Z=function(){return[qc,dn]};return{cacheSize:500,theme:{colors:[vm],spacing:[si],blur:["none","",xl,dn],brightness:X(),borderColor:[e],borderRadius:["none","","full",xl,dn],borderSpacing:k(),borderWidth:F(),contrast:X(),grayscale:J(),hueRotate:Z(),invert:J(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[Ppe,gO],inset:L(),margin:L(),opacity:X(),padding:k(),saturate:X(),scale:X(),sepia:J(),skew:Z(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",dn]}],container:["container"],columns:[{columns:[xl]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"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"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[].concat(B(),[dn])}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",bm]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dn]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",bm]}],"grid-cols":[{"grid-cols":[vm]}],"col-start-end":[{col:["auto",{span:["full",bm]},dn]}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":[vm]}],"row-start-end":[{row:["auto",{span:[bm]},dn]}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dn]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal"].concat(K())}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal"].concat(K(),["baseline"])}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[].concat(K(),["baseline"])}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[R]}],px:[{px:[R]}],py:[{py:[R]}],ps:[{ps:[R]}],pe:[{pe:[R]}],pt:[{pt:[R]}],pr:[{pr:[R]}],pb:[{pb:[R]}],pl:[{pl:[R]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",dn,t]}],"min-w":[{"min-w":["min","max","fit",dn,si]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[xl]},xl,dn]}],h:[{h:[dn,t,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",dn,si]}],"max-h":[{"max-h":[dn,t,"min","max","fit"]}],"font-size":[{text:["base",xl,gO]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",IT]}],"font-family":[{font:[vm]}],"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-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",dn]}],"line-clamp":[{"line-clamp":["none",qc,IT]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",dn,si]}],"list-image":[{"list-image":["none",dn]}],"list-style-type":[{list:["none","disc","decimal",dn]}],"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:[].concat(j(),["wavy"])}],"text-decoration-thickness":[{decoration:["auto","from-font",si]}],"underline-offset":[{"underline-offset":["auto",dn,si]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dn]}],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",dn]}],"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:[].concat(B(),[Mpe])}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Lpe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Dpe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[T]}],"gradient-via-pos":[{via:[T]}],"gradient-to-pos":[{to:[T]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[].concat(j(),["hidden"])}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:j()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:[""].concat(j())}],"outline-offset":[{"outline-offset":[dn,si]}],"outline-w":[{outline:[si]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[si]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",xl,kpe]}],"shadow-color":[{shadow:[vm]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":G()}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",xl,dn]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[m]}],saturate:[{saturate:[A]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[A]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"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",dn]}],duration:[{duration:Z()}],ease:[{ease:["linear","in","out","in-out",dn]}],delay:[{delay:Z()}],animate:[{animate:["none","spin","ping","pulse","bounce",dn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[bm,dn]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dn]}],accent:[{accent:["auto",e]}],appearance:["appearance-none"],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",dn]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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","pinch-zoom","manipulation",{pan:["x","left","right","y","up","down"]}]}],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",dn]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[si,IT]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"]},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"],"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"],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-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"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}var Bpe=Npe($pe);function Qe(...e){return Bpe(JW(e))}const e3=({onOpenFolder:e,onRemoteClick:t,className:n,collapsed:r=!1})=>{const{t:a}=Ze(),[s,i]=v.useState(!1),[l,c]=v.useState(!1),[u,h]=v.useState({top:0,left:0}),m=v.useRef(null),p=v.useRef(null),g=v.useRef(null),{createFolder:T,exportTree:y,draftFolderId:b}=xs(),{openFilePicker:x}=UL(),R=()=>{const F=prompt(a("workspace.toolbar.newFolderPrompt","Enter folder name:"));F!=null&&F.trim()&&T(F.trim(),null)},A=()=>H(null,null,function*(){if(!("showDirectoryPicker"in window)){alert(a("workspace.toolbar.browserNotSupported","Your browser does not support folder access. Please use Chrome or Edge."));return}try{const F=yield window.showDirectoryPicker({mode:"read"});e&&e();const{linkFolder:U}=xs.getState();yield U(F,null)}catch(F){F.name}}),w=()=>{const F=y(),U=new Blob([F],{type:"application/json"}),B=URL.createObjectURL(U),j=document.createElement("a");j.href=B,j.download="datakit-folder-structure.json",document.body.appendChild(j),j.click(),document.body.removeChild(j),URL.revokeObjectURL(B)},_=()=>{const F=document.createElement("input");F.type="file",F.accept=".json",F.onchange=U=>H(null,null,function*(){var j;const B=(j=U.target.files)==null?void 0:j[0];if(B){const G=yield B.text(),{importTree:K}=xs.getState();K(G)}}),F.click()},N=()=>H(null,null,function*(){try{yield x(void 0,b||void 0,!0)}catch(F){}}),I=()=>{if(m.current){const F=m.current.getBoundingClientRect(),U=320,B=8;let j=F.left+F.width/2-U/2,G=F.bottom+B;const K=window.innerWidth,J=window.innerHeight;j<16&&(j=16),j+U>K-16&&(j=K-U-16),G+400>J-16&&(G=F.top-400-B),h({top:G,left:j})}},D=()=>{g.current&&(clearTimeout(g.current),g.current=null),p.current=setTimeout(()=>{I(),c(!0)},300)},M=()=>{p.current&&(clearTimeout(p.current),p.current=null),g.current=setTimeout(()=>{c(!1)},200)},O=()=>{g.current&&(clearTimeout(g.current),g.current=null)},L=()=>{c(!1)};v.useEffect(()=>()=>{p.current&&clearTimeout(p.current),g.current&&clearTimeout(g.current)},[]);const k=()=>l?Gh.createPortal(o.jsx(At,{children:o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 pointer-events-none bg-black/20",children:o.jsxs(me.div,{"data-help-modal":!0,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.2},className:"absolute bg-black backdrop-blur-sm border border-white/20 rounded-xl shadow-2xl p-6 w-80 pointer-events-auto",style:{top:u.top,left:u.left,transformOrigin:"top center"},onMouseEnter:O,onMouseLeave:L,children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"text-lg font-semibold text-white",children:a("workspace.toolbar.helpModal.title","Workspace Guide")}),o.jsx("button",{onClick:()=>c(!1),className:"p-1 hover:bg-white/10 rounded-md transition-colors",children:o.jsx(ur,{size:18,className:"text-white/60 hover:text-white"})})]}),o.jsxs("div",{className:"space-y-4 text-sm text-white/80",children:[o.jsx("div",{children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(wp,{size:16,className:"text-primary mt-0.5 flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-white",children:a("workspace.toolbar.helpModal.importFiles.title","Import Files")}),o.jsx("div",{className:"text-white/60 text-xs",children:a("workspace.toolbar.helpModal.importFiles.description","Add files with persistent access")})]})]}),o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(B5,{size:16,className:"text-primary mt-0.5 flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-white",children:a("workspace.toolbar.helpModal.newFolder.title","New Folder")}),o.jsx("div",{className:"text-white/60 text-xs",children:a("workspace.toolbar.helpModal.newFolder.description","Organize your data")})]})]}),o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ng,{size:16,className:"text-primary mt-0.5 flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-white",children:a("workspace.toolbar.helpModal.openFolder.title","Open Folder")}),o.jsx("div",{className:"text-white/60 text-xs",children:a("workspace.toolbar.helpModal.openFolder.description","Import folders from your computer")})]})]}),o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(dh,{size:16,className:"text-primary mt-0.5 flex-shrink-0"}),o.jsxs("div",{children:[o.jsx("div",{className:"font-medium text-white",children:a("workspace.toolbar.helpModal.remoteSources.title","Remote Sources")}),o.jsx("div",{className:"text-white/60 text-xs",children:a("workspace.toolbar.helpModal.remoteSources.description","Connect to databases and cloud storage")})]})]})]})}),o.jsx("div",{className:"pt-2 border-t border-white/10",children:o.jsxs("div",{className:"text-white/60 text-xs",children:[o.jsxs("strong",{children:[a("common.labels.tip","Tip"),":"]})," ",a("workspace.toolbar.helpModal.tip","Files location persist between sessions and can be accessed directly from your computer.")]})})]})]})})}),document.body):null;return r?o.jsxs("div",{className:Qe("flex flex-col items-center gap-2 px-2 py-3 border-b border-white/10",n),children:[o.jsx(Ut,{placement:"right",content:a("workspace.toolbar.uploadFiles","Import"),children:o.jsx("button",{onClick:N,className:"p-2 hover:bg-white/10 rounded-md transition-colors w-8 h-8 flex items-center justify-center","aria-label":a("workspace.toolbar.uploadFiles","Import Files"),children:o.jsx(wp,{size:16,className:"text-white/70 hover:text-white"})})}),o.jsx(Ut,{placement:"right",content:a("workspace.toolbar.remoteSources","Remote Sources"),children:o.jsx("button",{onClick:t,className:"p-2 hover:bg-white/10 rounded-md transition-colors w-8 h-8 flex items-center justify-center","aria-label":a("workspace.toolbar.remoteSources","Remote Sources"),children:o.jsx(dh,{size:16,className:"text-white/70 hover:text-white"})})}),o.jsx(k,{})]}):o.jsxs("div",{className:Qe("flex items-center justify-between px-3 py-2 border-b border-white/10",n),children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ut,{placement:"bottom",content:a("workspace.toolbar.uploadFiles","Import"),children:o.jsx("button",{onClick:N,className:"p-1.5 hover:bg-white/10 rounded-md transition-colors","aria-label":a("workspace.toolbar.uploadFiles","Import Files"),children:o.jsx(wp,{size:18,className:"text-white/70 hover:text-white"})})}),o.jsx(Ut,{placement:"bottom",content:a("workspace.toolbar.newFolder","New Folder"),children:o.jsx("button",{onClick:R,className:"p-1.5 hover:bg-white/10 rounded-md transition-colors","aria-label":a("workspace.toolbar.newFolder","New Folder"),children:o.jsx(B5,{size:18,className:"text-white/70 hover:text-white"})})}),o.jsx(Ut,{placement:"bottom",content:a("workspace.toolbar.openFolder","Open Folder"),children:o.jsx("button",{onClick:A,className:"p-1.5 hover:bg-white/10 rounded-md transition-colors","aria-label":a("workspace.toolbar.openFolder","Open Folder"),children:o.jsx(ng,{size:18,className:"text-white/70 hover:text-white"})})}),o.jsx(Ut,{placement:"bottom",content:a("workspace.toolbar.remoteSources","Remote Sources"),children:o.jsx("button",{onClick:t,className:"p-1.5 hover:bg-white/10 rounded-md transition-colors","aria-label":a("workspace.toolbar.remoteSources","Remote Sources"),children:o.jsx(dh,{size:18,className:"text-white/70 hover:text-white"})})})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{ref:m,onMouseEnter:D,onMouseLeave:M,className:"p-1.5 hover:bg-white/10 rounded-md transition-colors","aria-label":a("workspace.toolbar.helpTooltip","Help - How the workspace works"),children:o.jsx(jo,{size:16,className:"text-white/50 hover:text-white/70"})}),o.jsx("div",{className:"relative",children:s&&o.jsxs("div",{className:"absolute right-0 top-full mt-1 bg-black border border-white/15 rounded-md shadow-xl overflow-hidden z-50 min-w-[160px]",onMouseLeave:()=>i(!1),children:[o.jsxs("button",{onClick:()=>{w(),i(!1)},className:"flex items-center gap-2 px-3 py-2 hover:bg-white/5 w-full text-left text-xs",children:[o.jsx(Hr,{size:14}),a("workspace.toolbar.exportStructure","Export Structure")]}),o.jsxs("button",{onClick:()=>{_(),i(!1)},className:"flex items-center gap-2 px-3 py-2 hover:bg-white/5 w-full text-left text-xs",children:[o.jsx(G0,{size:14}),a("workspace.toolbar.importStructure","Import Structure")]})]})})]}),o.jsx(k,{})]})},Hpe=({onFileSelect:e,onFolderSelect:t,className:n})=>{const{t:r}=Ze(),[a,s]=v.useState(null),[i,l]=v.useState(null),[c,u]=v.useState(""),[h,m]=v.useState(null),[p,g]=v.useState(null),[T,y]=v.useState(""),b=v.useRef(null),x=v.useRef(null),{roots:R,expandedIds:A,selectedIds:w,toggleFolder:_,selectNode:N,removeNode:I,renameNode:D,moveNode:M,createFolder:O,getNodeById:L,draftFolderId:k}=xs(),{removeFile:F,removeFileFromWorkspace:U,workspaceFiles:B,files:j,activeFileId:G}=ut(),{dropTable:K}=Dt(),J=v.useCallback(re=>H(null,null,function*(){var Se;try{if(re.type==="file"){const $e=j.find(Je=>Je.fileName===re.name);$e&&F($e.id);const qe=B.find(Je=>Je.name===re.name);if(qe&&U(qe.id),(Se=re.fileData)!=null&&Se.tableName)try{yield K(re.fileData.tableName)}catch(Je){}}I(re.id)}catch($e){I(re.id)}}),[j,B,F,U,K,I]),$=v.useCallback(()=>H(null,null,function*(){try{const re=L(k);if(!re||!re.children)return;const Se=re.children.filter($e=>$e.type==="file");for(const $e of Se)yield J($e)}catch(re){}}),[k,L,J]);v.useEffect(()=>{const re=Se=>{a&&x.current&&!x.current.contains(Se.target)&&s(null)};if(a)return document.addEventListener("mousedown",re),()=>{document.removeEventListener("mousedown",re)}},[a]);const X=re=>{const Se={size:16,strokeWidth:1.5};switch(re){case"csv":case"excel":return o.jsx(CL,he(q({},Se),{className:"text-emerald-400"}));case"json":return o.jsx(kW,he(q({},Se),{className:"text-amber-400"}));case"parquet":return o.jsx(Dl,he(q({},Se),{className:"text-cyan-400"}));case"txt":return o.jsx(Xn,he(q({},Se),{className:"text-slate-400"}));case"duckdb":return o.jsx(Xs,he(q({},Se),{className:"text-violet-400"}));case"remote":return o.jsx(dh,he(q({},Se),{className:"text-blue-400"}));case"query":return o.jsx(GW,he(q({},Se),{className:"text-blue-400"}));default:return o.jsx(Xn,he(q({},Se),{className:"text-white/50"}))}},Z=re=>{if(!re)return"";const Se=["B","KB","MB","GB"],$e=Math.floor(Math.log(re)/Math.log(1024)),qe=(re/Math.pow(1024,$e)).toFixed(1);return qe!=="0"?"".concat(qe," ").concat(Se[$e]):""},V=(re,Se)=>{b.current={nodeId:Se.id,type:Se.type,parentId:Se.parentId},re.dataTransfer.effectAllowed="move"},te=(re,Se)=>{var $e;re.preventDefault(),re.stopPropagation(),Se.type==="folder"&&(($e=b.current)==null?void 0:$e.nodeId)!==Se.id&&(re.dataTransfer.dropEffect="move",m(Se.id))},ae=re=>{re.preventDefault(),re.stopPropagation(),m(null)},ne=(re,Se)=>{re.preventDefault(),re.stopPropagation();const $e=b.current;if($e&&Se.type==="folder"&&$e.nodeId!==Se.id){let qe=L(Se.id),Je=!0;for(;qe;){if(qe.id===$e.nodeId){Je=!1;break}qe=qe.parentId?L(qe.parentId):void 0}Je&&M($e.nodeId,Se.id)}m(null),b.current=null},ce=(re,Se)=>{Se.stopPropagation(),a&&a!==re.id&&s(null),re.type==="folder"?(_(re.id),t==null||t(re)):e==null||e(re),N(re.id,Se.metaKey||Se.ctrlKey)},ie=(re,Se)=>{var $e;Se.stopPropagation(),re.type==="folder"&&(($e=re.folderData)!=null&&$e.isDraft)&&confirm("Clear all files from Draft folder? This will remove all files and their data.")&&$()},W=(re,Se)=>{Se.preventDefault(),Se.stopPropagation(),s(re.id),N(re.id,Se.metaKey||Se.ctrlKey)},Q=re=>{l(re.id),u(re.name),s(null)},se=re=>{c.trim()&&D(re,c.trim()),l(null),u("")},z=re=>{g(re||"root"),y("New Folder"),s(null)},xe=()=>{if(T.trim()){const re=p==="root"?null:p;O(T.trim(),re)}g(null),y("")},le=re=>{if(re.type!=="file"||!G)return!1;const Se=j.find($e=>$e.id===G);return Se?re.name===Se.fileName:!1},pe=(re,Se=0,$e=!1,qe=[])=>{var ue,Ee,Le,ke,Ge,tt,ct,Te,Oe,de,Ae,we;const Je=A.has(re.id),lt=w.has(re.id),at=h===re.id,ot=i===re.id,st=a===re.id,oe=le(re);return o.jsxs("div",{className:"relative overflow-visible",children:[Se>0&&re.type==="folder"&&o.jsxs("div",{className:"absolute left-0 top-0 h-full flex",children:[qe.map((Ie,Ke)=>o.jsx("div",{className:"w-4 flex justify-center",children:Ie&&o.jsx("div",{className:"w-px h-full bg-white/8"})},Ke)),o.jsx("div",{className:"w-4 flex justify-center relative",children:o.jsx("div",{className:"absolute top-0 w-px bg-white/8",style:{height:$e?"16px":"100%"}})})]}),Se>0&&re.type==="file"&&o.jsx("div",{className:"absolute w-px h-full bg-white/8",style:{left:"".concat((Se-1)*16+8,"px")}}),o.jsxs("div",{className:Qe("group flex items-center gap-1 py-1.5 cursor-pointer transition-all relative",oe&&re.type==="file"&&"bg-primary/20 border-l-2 border-primary z-10",lt&&!oe&&"bg-white/5",!lt&&!oe&&"hover:bg-white/5",at&&"bg-primary/20 ring-1 ring-primary",re.type==="file"&&!oe&&"ml-0.5"),style:{paddingLeft:"".concat(6+Se*20+(re.type==="file"?12:0)-(oe?2:0),"px"),paddingRight:oe&&re.type==="file"?"12px":"8px"},onClick:Ie=>ce(re,Ie),onDoubleClick:Ie=>ie(re,Ie),onContextMenu:Ie=>W(re,Ie),draggable:!0,onDragStart:Ie=>V(Ie,re),onDragOver:Ie=>te(Ie,re),onDragLeave:ae,onDrop:Ie=>ne(Ie,re),children:[oe&&re.type==="file"&&o.jsx("div",{className:"absolute top-0 -right-2 w-4 h-full bg-darkNav z-20"}),re.type==="folder"&&o.jsx("button",{onClick:Ie=>{Ie.stopPropagation(),_(re.id)},className:"p-0.5 hover:bg-white/10 rounded",children:Je?o.jsx(br,{size:14,className:"text-white/60"}):o.jsx(nr,{size:14,className:"text-white/60"})}),o.jsx("div",{className:Qe("flex-shrink-0",re.type==="file"&&"ml-1"),children:re.type==="folder"?Je?o.jsx(ng,{size:16,className:"text-primary/70"}):o.jsx(NT,{size:16,className:"text-primary/70"}):o.jsx("div",{className:"flex items-center gap-1",children:X((ue=re.fileData)==null?void 0:ue.fileType)})}),ot?o.jsx("input",{type:"text",value:c,onChange:Ie=>u(Ie.target.value),onKeyDown:Ie=>{Ie.key==="Enter"&&se(re.id),Ie.key==="Escape"&&(l(null),u("")),Ie.stopPropagation()},onClick:Ie=>Ie.stopPropagation(),onBlur:()=>se(re.id),className:"flex-1 bg-white/10 border border-white/20 rounded px-1 py-0 text-xs text-white outline-none focus:border-primary",autoFocus:!0}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:Qe("flex-1 text-xs truncate",((Ee=re.fileData)==null?void 0:Ee.isLoaded)===!1&&"opacity-50",oe&&"text-white font-medium",re.type==="file"&&!oe&&"text-white/80 font-normal",re.type==="folder"&&"text-white font-medium"),children:re.name}),re.type==="file"&&((Le=re.fileData)==null?void 0:Le.fileType)!=="query"&&o.jsx(o.Fragment,{children:((ke=re.fileData)==null?void 0:ke.size)&&re.fileData.size>0&&o.jsx("span",{className:"text-[10px] text-white/40",children:Z(re.fileData.size)})}),((Ge=re.folderData)==null?void 0:Ge.isLinked)&&o.jsx("span",{className:"text-[10px] text-blue-400/60",children:"Linked"}),o.jsx("button",{onClick:Ie=>{Ie.stopPropagation(),s(st?null:re.id)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-white/10 rounded transition-opacity",children:o.jsx(_L,{size:14,className:"text-white/60"})})]})]}),o.jsx(At,{children:st&&o.jsxs(me.div,{ref:x,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.1},className:"absolute right-4 bg-black border border-white/15 rounded-md shadow-xl overflow-hidden z-50 min-w-[140px]",onMouseLeave:()=>s(null),children:[re.type==="folder"&&o.jsxs("button",{onClick:Ie=>{Ie.stopPropagation(),z(re.id)},className:"flex items-center gap-2 px-3 py-1.5 hover:bg-white/5 w-full text-left text-xs",children:[o.jsx(ru,{size:14}),"New Folder"]}),re.type==="folder"&&((tt=re.folderData)==null?void 0:tt.isDraft)&&o.jsxs("button",{onClick:Ie=>{Ie.stopPropagation(),confirm("Clear all files from Draft folder? This will remove all files and their data.")&&$(),s(null)},className:"flex items-center gap-2 px-3 py-1.5 hover:bg-white/5 w-full text-left text-xs text-orange-400",children:[o.jsx(Hl,{size:14}),"Clear Folder"]}),o.jsxs("button",{onClick:Ie=>{Ie.stopPropagation(),Q(re)},className:"flex items-center gap-2 px-3 py-1.5 hover:bg-white/5 w-full text-left text-xs",children:[o.jsx(ime,{size:14}),"Rename"]}),!((ct=re.folderData)!=null&&ct.isDraft)&&!((Te=re.folderData)!=null&&Te.isRemote)&&o.jsxs("button",{onClick:Ie=>{Ie.stopPropagation(),confirm('Delete "'.concat(re.name,'"?'))&&J(re),s(null)},className:"flex items-center gap-2 px-3 py-1.5 hover:bg-white/5 w-full text-left text-xs text-red-400",children:[o.jsx(Hl,{size:14}),"Delete"]})]})}),re.type==="folder"&&Je&&o.jsxs(o.Fragment,{children:[p===re.id&&o.jsxs("div",{className:"flex items-center gap-1 py-1",style:{paddingLeft:"".concat(8+(Se+1)*20,"px"),paddingRight:"8px"},children:[o.jsx(NT,{size:16,className:"text-primary/70"}),o.jsx("input",{type:"text",value:T,onChange:Ie=>y(Ie.target.value),onKeyDown:Ie=>{Ie.key==="Enter"&&xe(),Ie.key==="Escape"&&(g(null),y(""))},onBlur:xe,className:"flex-1 bg-white/10 border border-white/20 rounded px-1 py-0 text-xs text-white outline-none focus:border-primary",autoFocus:!0})]}),(Oe=re.children)==null?void 0:Oe.map((Ie,Ke)=>{var nt;const it=Ke===(((nt=re.children)==null?void 0:nt.length)||0)-1,De=[...qe,!$e];return pe(Ie,Se+1,it,De)}),(!re.children||re.children.length===0)&&p!==re.id&&o.jsx("div",{className:"py-2 text-[10px] text-white/30 italic",style:{paddingLeft:"".concat(8+(Se+1)*20+12,"px"),paddingRight:"8px"},children:(de=re.folderData)!=null&&de.isDraft?"Drag files here to organize":(Ae=re.folderData)!=null&&Ae.isTemp?"Query results will appear here":(we=re.folderData)!=null&&we.isRemote?"Remote data sources will appear here":"Empty folder"})]})]},re.id)},_e=re=>{re.target===re.currentTarget&&a&&s(null)};return o.jsxs("div",{className:Qe("py-2",n),onClick:_e,children:[p==="root"&&o.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 mb-1",children:[o.jsx(NT,{size:16,className:"text-primary/70"}),o.jsx("input",{type:"text",value:T,onChange:re=>y(re.target.value),onKeyDown:re=>{re.key==="Enter"&&xe(),re.key==="Escape"&&(g(null),y(""))},onBlur:xe,className:"flex-1 bg-white/10 border border-white/20 rounded px-1 py-0 text-xs text-white outline-none focus:border-primary",autoFocus:!0})]}),o.jsx("div",{className:"space-y-0.5 overflow-visible",children:R.filter(re=>{var Se;return(Se=re.folderData)!=null&&Se.isTemp?re.children&&re.children.length>0:!0}).map((re,Se,$e)=>{const qe=Se===$e.length-1;return pe(re,0,qe,[])})}),R.filter(re=>{var Se;return(Se=re.folderData)!=null&&Se.isTemp?re.children&&re.children.length>0:!0}).length===0&&o.jsxs("div",{className:"px-4 py-8 text-center",children:[o.jsx(NT,{className:"h-8 w-8 text-white/20 mx-auto mb-2"}),o.jsx("p",{className:"text-xs text-white/40",children:"No files or folders"}),o.jsx("p",{className:"text-[10px] text-white/30 mt-1",children:'Click "New Folder" above to get started'})]})]})},$L=e=>{const t=document.documentElement,n=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,a=parseInt(e.slice(5,7),16)/255,s=Math.max(n,r,a),i=Math.min(n,r,a),l=(s+i)/2;let c=0,u=0;s!==i&&(u=l>.5?(s-i)/(2-s-i):(s-i)/(s+i),s===n?c=(r-a)/(s-i)+(r<a?6:0):s===r?c=(a-n)/(s-i)+2:c=(n-r)/(s-i)+4,c=Math.round(c*60)),u=Math.round(u*100);const h=Math.round(l*100);t.style.setProperty("--primary","hsl(".concat(c," ").concat(u,"% ").concat(h,"%)")),t.style.setProperty("--ring","hsl(".concat(c," ").concat(u,"% ").concat(h,"%)"))},Vpe=({variant:e="default"})=>{const{i18n:t,t:n}=Ze(),[r,a]=v.useState(!1),[s,i]=v.useState("#00B8A9"),l=v.useRef(null),[c,u]=v.useState(null),h=[{code:"en",name:"English",nativeName:"English",flag:"🇺🇸"},{code:"pt",name:"Portuguese",nativeName:"Português",flag:"🇧🇷"}],m=[{color:"#00B8A9",name:"Teal"},{color:"#3498db",name:"Blue"},{color:"#9b59b6",name:"Purple"},{color:"#e74c3c",name:"Red"},{color:"#f1c40f",name:"Yellow"},{color:"#2ecc71",name:"Green"},{color:"#ff6b6b",name:"Coral"},{color:"#fff",name:"White"}],p=h.find(x=>x.code===t.language)||h[0];v.useEffect(()=>{const x=localStorage.getItem("theme-primary-color");x&&i(x)},[]);const g=()=>{e==="sidebar"&&l.current&&u(l.current.getBoundingClientRect()),a(!r)},T=x=>{t.changeLanguage(x)},y=x=>{i(x),$L(x),localStorage.setItem("theme-primary-color",x)},b=()=>o.jsx(At,{children:r&&o.jsxs(o.Fragment,{children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 z-40",onClick:()=>a(!1)}),o.jsx(me.div,{initial:{opacity:0,scale:.95,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:8},transition:{type:"spring",stiffness:400,damping:25,duration:.2},className:"fixed p-4 bg-darkNav/90 backdrop-blur-xl border border-white/20 rounded-xl shadow-2xl z-50 w-56",style:{top:e==="sidebar"&&c?c.top-280:void 0,left:e==="sidebar"&&c?Math.min(c.left-120,window.innerWidth-300):void 0},children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(qs,{size:14,className:"text-white/60"}),o.jsx("span",{className:"text-sm font-medium text-white",children:n("settingsPopover.title",{defaultValue:"Settings"})})]}),o.jsx(me.button,{whileHover:{scale:1.1},whileTap:{scale:.9},onClick:()=>a(!1),className:"p-1 rounded-md text-white/40 hover:text-white/80 hover:bg-white/5 transition-colors",children:o.jsx(ur,{size:14})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-xs text-white/60",children:n("settingsPopover.language",{defaultValue:"Language"})}),o.jsx("div",{className:"space-y-1",children:h.map(x=>o.jsxs(me.button,{whileHover:{scale:1.02,x:2},whileTap:{scale:.98},className:"w-full flex items-center justify-between p-2.5 rounded-lg text-left transition-all duration-200 group ".concat(p.code===x.code?"bg-primary/15 text-white border border-primary/25 shadow-sm":"text-white/75 hover:text-white hover:bg-white/5 border border-transparent hover:border-white/10"),onClick:()=>T(x.code),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-lg filter drop-shadow-sm",children:x.flag}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium ".concat(p.code===x.code?"text-white":"text-white/90"),children:x.name}),o.jsx("span",{className:"text-xs text-white/40",children:x.nativeName})]})]}),p.code===x.code&&o.jsx(me.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:25},children:o.jsx(Pr,{size:12,className:"text-primary"})})]},x.code))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-xs text-white/60",children:n("settingsPopover.presets",{defaultValue:"Presets"})}),o.jsx("div",{className:"grid grid-cols-4 gap-2",children:m.map(({color:x,name:R})=>o.jsx(me.button,{whileHover:{scale:1.1},whileTap:{scale:.9},className:"w-10 h-10 rounded-lg border-2 transition-all ".concat(s===x?"border-white/60 ring-2 ring-white/30":"border-white/20 hover:border-white/40"),style:{backgroundColor:x},onClick:()=>y(x),title:R},x))})]})]})})]})});return o.jsxs("div",{className:"relative flex items-center",children:[o.jsxs(me.button,{ref:l,whileHover:{scale:1.05},whileTap:{scale:.95},className:"flex items-center gap-2 px-2.5 py-2 rounded-lg text-white/60 hover:text-white hover:bg-white/5 transition-all duration-200 border border-transparent hover:border-white/10",onClick:g,children:[o.jsx("div",{className:"w-4 h-4 rounded-full border border-white/30 shadow-sm",style:{backgroundColor:s}}),o.jsx("span",{className:"text-xl filter drop-shadow-sm",children:p.flag})]}),e==="sidebar"&&typeof document!="undefined"&&Gh.createPortal(b(),document.body),e==="default"&&b()]})},Gpe=new Map([["datakit",[{id:"datakit-smart",name:"Smart",provider:"datakit",type:"chat",contextWindow:2e5,costPer1kTokens:{input:.3,output:1.5},capabilities:[],requiresApiKey:!1,description:"Powered by Claude 3.5 Sonnet - Best for complex analysis"},{id:"datakit-fast",name:"Fast",provider:"datakit",type:"chat",contextWindow:2e5,costPer1kTokens:{input:.08,output:.4},capabilities:[],requiresApiKey:!1,description:"Powered by Claude 3.5 Haiku - Economical"}]],["ollama",[{id:"llama3.2",name:"Llama 3.2",provider:"ollama",type:"chat",contextWindow:128e3,costPer1kTokens:{input:0,output:0},capabilities:[],requiresApiKey:!1,isLocal:!0,description:"Latest Llama model - Great for general tasks"},{id:"mistral",name:"Mistral",provider:"ollama",type:"chat",contextWindow:8192,costPer1kTokens:{input:0,output:0},capabilities:[],requiresApiKey:!1,isLocal:!0,description:"Fast and efficient model"},{id:"codellama",name:"Code Llama",provider:"ollama",type:"chat",contextWindow:16384,costPer1kTokens:{input:0,output:0},capabilities:[],requiresApiKey:!1,isLocal:!0,description:"Specialized for code and SQL generation"}]],["openai",[{id:"gpt-4o-2024-11-20",name:"GPT-4o",provider:"openai",type:"chat",contextWindow:128e3,costPer1kTokens:{input:.0025,output:.01},capabilities:[],requiresApiKey:!0},{id:"gpt-4o-mini",name:"GPT-4o Mini",provider:"openai",type:"chat",contextWindow:128e3,costPer1kTokens:{input:15e-5,output:6e-4},capabilities:[],requiresApiKey:!0}]],["anthropic",[{id:"claude-sonnet-4-5-20250929",name:"Claude Sonnet 4.5",provider:"anthropic",type:"chat",contextWindow:2e5,costPer1kTokens:{input:.003,output:.015},capabilities:[],requiresApiKey:!0},{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4",provider:"anthropic",type:"chat",contextWindow:2e5,costPer1kTokens:{input:8e-4,output:.004},capabilities:[],requiresApiKey:!0}]],["groq",[{id:"llama-3.1-70b-versatile",name:"Llama 3.1 70B (Free)",provider:"groq",type:"chat",contextWindow:131072,costPer1kTokens:{input:0,output:0},capabilities:[],requiresApiKey:!0},{id:"llama-3.1-8b-instant",name:"Llama 3.1 8B (Free)",provider:"groq",type:"chat",contextWindow:131072,costPer1kTokens:{input:0,output:0},capabilities:[],requiresApiKey:!0}]]]),ys=Ki()(V1((e,t)=>({activeProvider:void 0,activeModel:null,availableModels:Gpe,localModels:[],apiKeys:new Map,currentPrompt:"",queryHistory:[],isProcessing:!1,currentQueryId:null,queryResults:null,currentResponse:null,streamingResponse:"",currentTokenUsage:null,visualizationTokenUsage:null,currentError:null,currentConversation:[],conversationId:null,currentMessageIndex:-1,fileConversations:new Map,fileResponseStates:new Map,multiTableContexts:[],systemPrompt:"You are a SQL expert helping users query their data using DuckDB syntax.",mcpConnections:[],activeMCPConnection:null,showModelSelector:!1,showApiKeyModal:!1,splitViewMode:"horizontal",promptEditorHeight:200,sidebarWidth:280,showDataContext:!0,showQueryHistory:!1,autoExecuteSQL:!0,showCostEstimates:!0,maxHistoryItems:50,setActiveProvider:n=>e({activeProvider:n}),setActiveModel:n=>e({activeModel:n}),setApiKey:(n,r)=>{e(a=>{const s=new Map(a.apiKeys);return s.set(n,r),{apiKeys:s}})},validateApiKey:n=>H(null,null,function*(){return!!t().apiKeys.get(n)}),updateOllamaModels:n=>{e(s=>{const i=new Map(s.availableModels),l=n.map(c=>({id:c.name||c.model,name:c.name||c.model,provider:"ollama",type:"chat",contextWindow:null,costPer1kTokens:null,capabilities:[],requiresApiKey:!1,isLocal:!0,description:"".concat(r(c.size)," - Modified ").concat(a(c.modified_at))}));return i.set("ollama",l),{availableModels:i}});function r(s){return(s/1073741824).toFixed(1)+" GB"}function a(s){return new Date(s).toLocaleDateString()}},setCurrentPrompt:n=>e({currentPrompt:n}),addQueryToHistory:n=>{e(r=>{const a=[n,...r.queryHistory];return a.length>r.maxHistoryItems&&a.pop(),{queryHistory:a}})},clearQueryHistory:()=>e({queryHistory:[]}),setProcessing:n=>{e(r=>{var s;const a={isProcessing:n};if((s=r.conversationId)!=null&&s.startsWith("file_")){const i=r.conversationId.replace("file_",""),l=new Map(r.fileResponseStates),c=l.get(i)||{currentResponse:null,streamingResponse:"",currentError:null,isProcessing:!1};l.set(i,he(q({},c),{isProcessing:n})),a.fileResponseStates=l}return a})},setQueryResults:n=>e({queryResults:n}),setCurrentResponse:n=>{e(r=>{var s;const a={currentResponse:n};if((s=r.conversationId)!=null&&s.startsWith("file_")){const i=r.conversationId.replace("file_",""),l=new Map(r.fileResponseStates),c=l.get(i)||{currentResponse:null,streamingResponse:"",currentError:null,isProcessing:!1};l.set(i,he(q({},c),{currentResponse:n})),a.fileResponseStates=l}return a})},setStreamingResponse:n=>{e(r=>{var s;const a={streamingResponse:n};if((s=r.conversationId)!=null&&s.startsWith("file_")){const i=r.conversationId.replace("file_",""),l=new Map(r.fileResponseStates),c=l.get(i)||{currentResponse:null,streamingResponse:"",currentError:null,isProcessing:!1};l.set(i,he(q({},c),{streamingResponse:n})),a.fileResponseStates=l}return a})},setCurrentTokenUsage:n=>e({currentTokenUsage:n}),setVisualizationTokenUsage:n=>e({visualizationTokenUsage:n}),setCurrentError:n=>{e(r=>{var s;const a={currentError:n};if((s=r.conversationId)!=null&&s.startsWith("file_")){const i=r.conversationId.replace("file_",""),l=new Map(r.fileResponseStates),c=l.get(i)||{currentResponse:null,streamingResponse:"",currentError:null,isProcessing:!1};l.set(i,he(q({},c),{currentError:n})),a.fileResponseStates=l}return a})},addTableContext:n=>{e(r=>r.multiTableContexts.find(s=>s.tableName===n.tableName)?r:{multiTableContexts:[...r.multiTableContexts,he(q({},n),{isSelected:!0})]})},removeTableContext:n=>{e(r=>({multiTableContexts:r.multiTableContexts.filter(a=>a.tableName!==n)}))},toggleTableContext:n=>{e(r=>({multiTableContexts:r.multiTableContexts.map(a=>a.tableName===n?he(q({},a),{isSelected:!a.isSelected}):a)}))},clearTableContexts:()=>e({multiTableContexts:[]}),addMessageToConversation:n=>{e(r=>{const a=[...r.currentConversation,n];a.length>20&&a.splice(0,a.length-20);let s=r.currentMessageIndex;return n.role==="user"&&(s=a.filter(l=>l.role==="user").length),{currentConversation:a,currentMessageIndex:s}})},clearConversation:()=>{e(n=>{var a;const r={currentConversation:[],conversationId:null,currentResponse:null,streamingResponse:"",currentError:null,currentMessageIndex:-1};if((a=n.conversationId)!=null&&a.startsWith("file_")){const s=n.conversationId.replace("file_",""),i=new Map(n.fileResponseStates);i.delete(s),r.fileResponseStates=i}return r})},startNewConversation:()=>{const n=Date.now().toString();e({currentConversation:[],conversationId:n,currentResponse:null,streamingResponse:"",currentError:null,currentMessageIndex:-1})},navigateToMessage:n=>{e({currentMessageIndex:n})},navigateToNextMessage:()=>{e(n=>{const a=n.currentConversation.filter(s=>s.role==="user").length;return n.currentMessageIndex<a?{currentMessageIndex:n.currentMessageIndex+1}:n})},navigateToPreviousMessage:()=>{e(n=>n.currentMessageIndex>0?{currentMessageIndex:n.currentMessageIndex-1}:n)},setActiveFileConversation:n=>{e(r=>{if(!n)return{currentConversation:[],conversationId:null,currentMessageIndex:-1,currentResponse:null,streamingResponse:"",currentError:null,isProcessing:!1};const a=r.fileConversations.get(n)||[],s=r.fileResponseStates.get(n)||{currentResponse:null,streamingResponse:"",currentError:null,isProcessing:!1};return{currentConversation:a,conversationId:"file_".concat(n),currentMessageIndex:a.filter(i=>i.role==="user").length,currentResponse:s.currentResponse,streamingResponse:s.streamingResponse,currentError:s.currentError,isProcessing:s.isProcessing}})},addMessageToFileConversation:(n,r)=>{e(a=>{const s=new Map(a.fileConversations),l=[...s.get(n)||[],r];l.length>20&&l.splice(0,l.length-20),s.set(n,l);const c=a.conversationId==="file_".concat(n);let u={fileConversations:s};if(c){let h=a.currentMessageIndex;r.role==="user"&&(h=l.filter(p=>p.role==="user").length),u=he(q({},u),{currentConversation:l,currentMessageIndex:h})}return u})},clearFileConversation:n=>{e(r=>{const a=new Map(r.fileConversations),s=new Map(r.fileResponseStates);a.delete(n),s.delete(n);const i=r.conversationId==="file_".concat(n);let l={fileConversations:a,fileResponseStates:s};return i&&(l=he(q({},l),{currentConversation:[],currentMessageIndex:-1,currentResponse:null,streamingResponse:"",currentError:null,isProcessing:!1})),l})},downloadLocalModel:n=>H(null,null,function*(){var r;try{const{aiService:a}=yield fn(()=>H(null,null,function*(){const{aiService:l}=yield Promise.resolve().then(()=>tTe);return{aiService:l}}),void 0),{modelManager:s}=yield fn(()=>H(null,null,function*(){const{modelManager:l}=yield Promise.resolve().then(()=>RBe);return{modelManager:l}}),void 0);e({isProcessing:!0}),yield a.loadLocalModel(n,l=>{e(c=>({localModels:c.localModels.map(u=>u.id===n?he(q({},u),{downloadProgress:l}):u)}))});const i=(r=t().availableModels.get("local"))==null?void 0:r.find(l=>l.id===n);i&&s.markModelDownloaded(i)}catch(a){}finally{e({isProcessing:!1})}}),removeLocalModel:n=>{e(r=>({localModels:r.localModels.filter(a=>a.id!==n)}))},updateModelDownloadProgress:(n,r)=>{e(a=>({localModels:a.localModels.map(s=>s.id===n?he(q({},s),{downloadProgress:r}):s)}))},addMCPConnection:n=>{e(r=>({mcpConnections:[...r.mcpConnections,n]}))},removeMCPConnection:n=>{e(r=>({mcpConnections:r.mcpConnections.filter(a=>a.id!==n),activeMCPConnection:r.activeMCPConnection===n?null:r.activeMCPConnection}))},setActiveMCPConnection:n=>{e({activeMCPConnection:n})},updateMCPConnectionStatus:(n,r)=>{e(a=>({mcpConnections:a.mcpConnections.map(s=>s.id===n?he(q({},s),{status:r}):s)}))},toggleModelSelector:()=>{e(n=>({showModelSelector:!n.showModelSelector}))},toggleApiKeyModal:()=>{e(n=>({showApiKeyModal:!n.showApiKeyModal}))},setSplitViewMode:n=>e({splitViewMode:n}),setPromptEditorHeight:n=>e({promptEditorHeight:n}),setSidebarWidth:n=>e({sidebarWidth:n}),toggleDataContext:()=>{e(n=>({showDataContext:!n.showDataContext}))},toggleQueryHistory:()=>{e(n=>({showQueryHistory:!n.showQueryHistory}))},updateSettings:n=>{e(r=>q(q({},r),n))},initializeModels:()=>{const n=t();if(!n.activeModel&&n.availableModels.get(n.activeProvider)){const r=n.availableModels.get(n.activeProvider);r&&r.length>0&&e({activeModel:r[0].id})}}}),{name:"ai-store",partialize:e=>({activeProvider:e.activeProvider,activeModel:e.activeModel,apiKeys:Array.from(e.apiKeys.entries()),queryHistory:e.queryHistory.slice(0,10),mcpConnections:e.mcpConnections,promptEditorHeight:e.promptEditorHeight,sidebarWidth:e.sidebarWidth,splitViewMode:e.splitViewMode,autoExecuteSQL:e.autoExecuteSQL,showCostEstimates:e.showCostEstimates,maxHistoryItems:e.maxHistoryItems,systemPrompt:e.systemPrompt}),onRehydrateStorage:()=>e=>{e&&(Array.isArray(e.apiKeys)&&(e.apiKeys=new Map(e.apiKeys)),e.initializeModels())}})),EO=Object.freeze(Object.defineProperty({__proto__:null,useAIStore:ys},Symbol.toStringTag,{value:"Module"})),ea=()=>{const e=qh();return{user:e.user,isAuthenticated:e.isAuthenticated,isLoading:e.isLoading,error:e.error,settings:e.settings,login:e.login,signup:e.signup,logout:e.logout,updateProfile:e.updateProfile,updateSettings:e.updateSettings,setError:e.setError,clearError:e.clearError}};function t3(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zpe(...e){return t=>{let n=!1;const r=e.map(a=>{const s=t3(a,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let a=0;a<r.length;a++){const s=r[a];typeof s=="function"?s():t3(e[a],null)}}}}function qpe(...e){return v.useCallback(zpe(...e),e)}function Ype(e){const t=Xpe(e),n=v.forwardRef((r,a)=>{const u=r,{children:s}=u,i=Tn(u,["children"]),l=v.Children.toArray(s),c=l.find(Qpe);if(c){const h=c.props.children,m=l.map(p=>p===c?v.Children.count(h)>1?v.Children.only(null):v.isValidElement(h)?h.props.children:null:p);return o.jsx(t,he(q({},i),{ref:a,children:v.isValidElement(h)?v.cloneElement(h,void 0,m):null}))}return o.jsx(t,he(q({},i),{ref:a,children:s}))});return n.displayName="".concat(e,".Slot"),n}var Wpe=Ype("Slot");function Xpe(e){const t=v.forwardRef((n,r)=>{const c=n,{children:a}=c,s=Tn(c,["children"]),i=v.isValidElement(a)?Zpe(a):void 0,l=qpe(i,r);if(v.isValidElement(a)){const u=Jpe(s,a.props);return a.type!==v.Fragment&&(u.ref=l),v.cloneElement(a,u)}return v.Children.count(a)>1?v.Children.only(null):null});return t.displayName="".concat(e,".SlotClone"),t}var Kpe=Symbol("radix.slottable");function Qpe(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Kpe}function Jpe(e,t){const n=q({},t);for(const r in t){const a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...l)=>{const c=s(...l);return a(...l),c}:a&&(n[r]=a):r==="style"?n[r]=q(q({},a),s):r==="className"&&(n[r]=[a,s].filter(Boolean).join(" "))}return q(q({},e),n)}function Zpe(e){var r,a;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const n3=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,r3=JW,ege=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return r3(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:s}=t,i=Object.keys(a).map(u=>{const h=n==null?void 0:n[u],m=s==null?void 0:s[u];if(h===null)return null;const p=n3(h)||n3(m);return a[u][p]}),l=n&&Object.entries(n).reduce((u,h)=>{let[m,p]=h;return p===void 0||(u[m]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,h)=>{let T=h,{class:m,className:p}=T,g=Tn(T,["class","className"]);return Object.entries(g).every(y=>{let[b,x]=y;return Array.isArray(x)?x.includes(q(q({},s),l)[b]):q(q({},s),l)[b]===x})?[...u,m,p]:u},[]);return r3(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},tge=ege("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:text-accent-foreground hover:border-primary dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function je(s){var i=s,{className:e,variant:t,size:n,asChild:r=!1}=i,a=Tn(i,["className","variant","size","asChild"]);const l=r?Wpe:"button";return o.jsx(l,q({"data-slot":"button",className:Qe(tge({variant:t,size:n,className:e}))},a))}const TO=({size:e="md",color:t="currentColor",className:n=""})=>{const r={sm:"w-1 h-1",md:"w-1.5 h-1.5",lg:"w-2 h-2"},a={animate:{transition:{staggerChildren:.2,repeat:1/0,repeatType:"loop"}}},s={initial:{opacity:.3,scale:.8},animate:{opacity:[.3,1,.3],scale:[.8,1,.8],transition:{duration:.6,ease:"easeInOut",repeat:1/0,repeatType:"loop"}}};return o.jsx(me.div,{className:"flex items-center gap-1 ".concat(n),variants:a,initial:"initial",animate:"animate",children:[0,1,2].map(i=>o.jsx(me.div,{className:"".concat(r[e]," rounded-full"),style:{backgroundColor:t},variants:s},i))})},a3=["password","123456","123456789","welcome","admin","password123"].map(e=>e.toLowerCase());class s3{static validatePassword(t){const n=[],r={minLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumbers:!1,hasSpecialChars:!1,noCommonPatterns:!1,noPersonalInfo:!0};if(r.minLength=t.length>=12,r.minLength||n.push("Must be at least 12 characters long"),r.hasUppercase=/[A-Z]/.test(t),r.hasUppercase||n.push("Must contain at least one uppercase letter"),r.hasLowercase=/[a-z]/.test(t),r.hasLowercase||n.push("Must contain at least one lowercase letter"),r.hasNumbers=/\d/.test(t),r.hasNumbers||n.push("Must contain at least one number"),r.hasSpecialChars=/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~`]/.test(t),r.hasSpecialChars||n.push("Must contain at least one special character"),r.noCommonPatterns=this.checkCommonPatterns(t),r.noCommonPatterns||n.push("Contains common patterns (avoid sequences like 123, abc, or repeated characters)"),t.length>128)return n.push("Must not exceed 128 characters"),{isValid:!1,score:0,feedback:n,requirements:r};const a=this.calculateStrengthScore(t,r),s=Object.values(r).every(i=>i)&&n.length===0;return this.hasRepeatedCharacters(t)&&n.push("Avoid excessive repeated characters"),this.hasKeyboardPatterns(t)&&n.push("Avoid keyboard patterns like qwerty or asdf"),{isValid:s&&n.length===0,score:a,feedback:n,requirements:r}}static validatePasswordWithPersonalInfo(t){const n=this.validatePassword(t);return this.isCommonPassword(t)&&(n.feedback.push("This password is too common. Please choose a more unique password."),n.isValid=!1),n}static getPasswordRequirements(){return{requirements:["At least 12 characters long","At least one uppercase letter (A-Z)","At least one lowercase letter (a-z)","At least one number (0-9)","At least one special character (!@#$%^&*...)","No common patterns or sequences","No personal information (name, email)","Maximum 128 characters"],strengthLevels:[{score:0,label:"Very Weak",color:"#ff4444"},{score:1,label:"Weak",color:"#ff8800"},{score:2,label:"Fair",color:"#ffaa00"},{score:3,label:"Good",color:"#88cc00"},{score:4,label:"Strong",color:"#00cc44"}]}}static getStrengthDescription(t){const r=this.getPasswordRequirements().strengthLevels.find(a=>a.score===t);return(r==null?void 0:r.label)||"Unknown"}static getStrengthColor(t){const r=this.getPasswordRequirements().strengthLevels.find(a=>a.score===t);return(r==null?void 0:r.color)||"#666"}static checkCommonPatterns(t){return![/123456|234567|345678|456789|567890|678901|789012|890123|901234/,/abcdef|bcdefg|cdefgh|defghi|efghij|fghijk|ghijkl|hijklm|ijklmn|jklmno|klmnop|lmnopq|mnopqr|nopqrs|opqrst|pqrstu|qrstuv|rstuvw|stuvwx|tuvwxy|uvwxyz/i,/(.)\1{2,}/,/1111|2222|3333|4444|5555|6666|7777|8888|9999|0000/,/\b(19|20)\d{2}\b/].some(r=>r.test(t))}static hasRepeatedCharacters(t){return/(.)\1{2,}/.test(t)}static hasKeyboardPatterns(t){return[/qwerty|qwertz|azerty/i,/asdf|asdfg|asdfgh/i,/zxcv|zxcvb|zxcvbn/i,/1qaz|2wsx|3edc|4rfv|5tgb|6yhn|7ujm|8ik|9ol|0p/i].some(r=>r.test(t))}static calculateStrengthScore(t,n){let r=0;return n.minLength&&(r+=.5),n.hasUppercase&&(r+=.5),n.hasLowercase&&(r+=.5),n.hasNumbers&&(r+=.5),n.hasSpecialChars&&(r+=.5),n.noCommonPatterns&&(r+=.5),t.length>=16&&(r+=.5),/[^\w\s]/.test(t)&&(r+=.5),this.hasCharacterVariety(t)&&(r+=.5),Math.min(Math.round(r),4)}static hasCharacterVariety(t){return[/[a-z]/,/[A-Z]/,/\d/,/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/,/[~`]/].filter(r=>r.test(t)).length>=4}static validateAgainstPersonalInfo(t,n){var s;const r=[],a=t.toLowerCase();if(n.email){const i=n.email.toLowerCase().split("@"),l=i[0],c=(s=i[1])==null?void 0:s.split(".")[0];a.includes(l)&&l.length>2&&r.push("Password should not contain your email address"),c&&a.includes(c)&&c.length>2&&r.push("Password should not contain your email domain")}if(n.name){const i=n.name.toLowerCase().split(" ");for(const l of i)if(l.length>2&&a.includes(l)){r.push("Password should not contain your name");break}}return{isValid:r.length===0,feedback:r}}static isCommonPassword(t){const n=t.toLowerCase();return a3.includes(n)?!0:a3.some(r=>r.length>=4&&n.includes(r))}}const Vl=({isOpen:e,onClose:t,defaultMode:n="login",onLoginSuccess:r})=>{const{t:a}=Ze(),s=xi(),i=Iu(),[l,c]=v.useState(n);v.useEffect(()=>{c(n)},[n]);const[u,h]=v.useState(!1),[m,p]=v.useState({email:"",password:"",name:""}),[g,T]=v.useState(null),[y,b]=v.useState(null),{login:x,signup:R,isLoading:A,error:w,clearError:_}=ea(),{showSuccess:N}=ec(),I=()=>{i.pathname.startsWith("/settings")?s("/"):t()};v.useEffect(()=>{e&&b(s3.getPasswordRequirements())},[e]);const D=v.useCallback(F=>{if(!F||F.length<1){T(null);return}const U=s3.validatePasswordWithPersonalInfo(F,{email:m.email,name:m.name});T(U)},[m.email,m.name,m.password]);v.useEffect(()=>{l==="signup"&&m.password?D(m.password):T(null)},[m.password,l,D]);const M=F=>{const{name:U,value:B}=F.target;p(j=>he(q({},j),{[U]:B})),w&&_()},O=F=>H(null,null,function*(){if(F.preventDefault(),!(l==="signup"&&g&&!g.isValid))try{l==="login"?(yield x({email:m.email,password:m.password}),N(a("auth.messages.welcomeSuccess"),a("auth.messages.welcomeSuccessDesc"),{icon:"shield",duration:3e3}),r==null||r()):(yield R({email:m.email,password:m.password,name:m.name}),N(a("auth.messages.accountCreated"),a("auth.messages.accountCreatedDesc"),{icon:"user",duration:6e3}),r==null||r()),I()}catch(U){}}),L=()=>{c(l==="login"?"signup":"login"),_(),p({email:"",password:"",name:""}),T(null)},k=({met:F,text:U})=>o.jsxs(me.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"flex items-center gap-2 text-xs ".concat(F?"text-green-400":"text-white/60"),children:[o.jsx("div",{className:"w-3 h-3 rounded-full flex items-center justify-center ".concat(F?"bg-green-500":"bg-white/20"),children:F&&o.jsx(Pr,{size:8,className:"text-white"})}),o.jsx("span",{children:U})]});return o.jsx(At,{children:e&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:I,children:o.jsxs(me.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",stiffness:300,damping:30,duration:.3},className:"bg-black backdrop-blur-xl border border-white/20 rounded-lg shadow-2xl w-full max-w-md relative max-h-[90vh] overflow-y-auto",onClick:F=>F.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/10",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("h2",{className:"text-lg font-medium text-white",children:a(l==="login"?"auth.modal.welcomeBack":"auth.modal.joinDataKit")})}),o.jsx("button",{onClick:I,className:"text-white/70 hover:text-white transition-colors",children:o.jsx(ur,{size:20})})]}),o.jsxs("div",{className:"p-6",children:[o.jsxs("form",{onSubmit:O,className:"space-y-4",children:[l==="signup"&&o.jsxs(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},children:[o.jsx("label",{className:"block text-sm font-medium text-white/90 mb-2",children:a("auth.fields.fullName")}),o.jsxs("div",{className:"relative",children:[o.jsx(z0,{size:16,className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-white/50"}),o.jsx("input",{type:"text",name:"name",value:m.name,onChange:M,className:"w-full pl-10 pr-4 py-3 bg-background/20 border border-white/20 rounded-md text-white placeholder-white/50 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-colors",placeholder:a("auth.placeholders.enterName"),required:!0})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/90 mb-2",children:a("auth.fields.emailAddress")}),o.jsxs("div",{className:"relative",children:[o.jsx(OL,{size:16,className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-white/50"}),o.jsx("input",{type:"email",name:"email",value:m.email,onChange:M,className:"w-full pl-10 pr-4 py-3 bg-background/20 border border-white/20 rounded-md text-white placeholder-white/50 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-colors",placeholder:a("auth.placeholders.enterEmail"),required:!0})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/90 mb-2",children:a("auth.fields.password")}),o.jsxs("div",{className:"relative",children:[o.jsx(_h,{size:16,className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-white/50"}),o.jsx("input",{type:u?"text":"password",name:"password",value:m.password,onChange:M,className:"w-full pl-10 pr-10 py-3 bg-background/20 border border-white/20 rounded-md text-white placeholder-white/50 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-colors",placeholder:a(l==="login"?"auth.placeholders.enterPassword":"auth.placeholders.createPassword"),required:!0,minLength:l==="signup"?12:6}),o.jsx("button",{type:"button",onClick:()=>h(!u),className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-white/50 hover:text-white/70 transition-colors",children:u?o.jsx(wL,{size:16}):o.jsx(Jr,{size:16})})]}),l==="signup"&&m.password&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mt-3 space-y-3",children:g&&o.jsxs("div",{className:"bg-background/10 rounded-md p-3 border border-white/5",children:[o.jsx("h4",{className:"text-xs font-medium text-white/90 mb-2",children:a("auth.password.requirements")}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(k,{met:g.requirements.minLength,text:a("auth.password.minLength")}),o.jsx(k,{met:g.requirements.hasUppercase,text:a("auth.password.hasUppercase")}),o.jsx(k,{met:g.requirements.hasLowercase,text:a("auth.password.hasLowercase")}),o.jsx(k,{met:g.requirements.hasNumbers,text:a("auth.password.hasNumbers")}),o.jsx(k,{met:g.requirements.hasSpecialChars,text:a("auth.password.hasSpecialChars")}),o.jsx(k,{met:g.requirements.noCommonPatterns,text:a("auth.password.noCommonPatterns")})]})]})})]}),w&&o.jsxs(me.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:[o.jsx(Cn,{size:16,className:"text-destructive flex-shrink-0"}),o.jsx("span",{className:"text-sm text-destructive",children:w})]}),o.jsx(je,{variant:"outline",type:"submit",className:"w-full py-3",disabled:A||l==="signup"&&g&&!g.isValid,children:a(A?l==="login"?"auth.loading.signingIn":"auth.loading.creatingAccount":l==="login"?"auth.modal.signIn":"auth.modal.createAccount")})]}),o.jsxs("div",{className:"mt-6 text-center",children:[o.jsx("span",{className:"text-sm text-white/70",children:a(l==="login"?"auth.modal.dontHaveAccount":"auth.modal.alreadyHaveAccount")}),o.jsx("button",{onClick:L,className:"text-sm text-primary hover:text-primary-foreground transition-colors font-medium cursor-pointer",children:a(l==="login"?"auth.modal.signUp":"auth.modal.signIn")})]}),l==="signup"&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},className:"mt-4 text-center",children:o.jsxs("p",{className:"text-xs text-white/60",children:[a("auth.messages.privacyNotice")," ",o.jsxs("a",{href:"/privacy",target:"_blank",className:"text-primary hover:text-primary-foreground transition-colors inline-flex items-center gap-1",children:[a("auth.modal.privacyPolicy"),o.jsx(qi,{size:10})]})]})}),l==="signup"&&o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.1},className:"mt-6 p-4 bg-gradient-to-r from-primary/10 to-secondary/10 rounded-md border border-primary/20",children:[o.jsx("h3",{className:"text-sm font-medium text-white/90 mb-3 flex items-center gap-2",children:a("auth.benefits.title")}),o.jsxs("ul",{className:"text-xs text-white/70 space-y-2",children:[o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-1 h-1 bg-primary rounded-full"}),a("auth.benefits.aiAccess")]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-1 h-1 bg-primary rounded-full"}),a("auth.benefits.cloudConnectors")]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-1 h-1 bg-primary rounded-full"}),a("auth.benefits.exportReports")]}),o.jsxs("li",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-1 h-1 bg-primary rounded-full"}),a("auth.benefits.prioritySupport")]})]})]})]})]})})})},nge=({variant:e="header",className:t=""})=>{const{t:n}=Ze(),{user:r,isAuthenticated:a,logout:s,isLoading:i}=ea(),{setActiveProvider:l}=ys(),{showSuccess:c}=ec(),[u,h]=v.useState(!1),[m,p]=v.useState("login"),[g,T]=v.useState(!1),y=v.useRef(null);v.useEffect(()=>{const w=_=>{y.current&&!y.current.contains(_.target)&&T(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]);const b=()=>H(null,null,function*(){yield s(),T(!1),c(n("auth.userMenu.signOutSuccess",{defaultValue:"Signed out successfully"}),n("auth.userMenu.signOutMessage",{defaultValue:"You've been securely signed out of DataKit."}),{icon:"shield",duration:3e3})}),x=()=>{T(!1),window.location.href="/settings"},R=w=>{p(w),h(!0)};if(i)return o.jsx("div",{className:"flex items-center justify-center py-2",children:o.jsx(TO,{size:"sm"})});if(!a)return e==="collapsed"?o.jsxs("div",{className:"flex gap-1 items-center",children:[o.jsx(me.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>R("login"),className:"p-2 text-white/70 hover:text-white hover:bg-white/5 rounded transition-colors ".concat(t),title:n("auth.userMenu.signIn",{defaultValue:"Sign In"}),children:o.jsx(V5,{size:14})}),o.jsx(me.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:()=>R("signup"),className:"p-2 bg-primary/10 hover:bg-primary/20 border border-primary/30 hover:border-primary/50 rounded transition-all duration-200",title:n("auth.userMenu.signUp",{defaultValue:"Sign Up"}),children:o.jsx(YW,{size:14,className:"text-primary"})}),o.jsx(Vl,{isOpen:u,onClose:()=>h(!1),defaultMode:m,onLoginSuccess:()=>l("datakit")})]}):o.jsxs("div",{className:"w-full space-y-2",children:[o.jsx(me.button,{whileHover:{scale:1.02,boxShadow:"0 0 15px rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:()=>R("signup"),className:"w-full py-2 px-3 bg-white/8 hover:bg-white/12 border border-white/20 hover:border-white/30 rounded-lg transition-all duration-300 group",disabled:i,children:o.jsx("div",{className:"flex items-center justify-center",children:o.jsx("span",{className:"text-xs font-medium text-white group-hover:text-white transition-colors cursor-pointer",children:n("auth.userMenu.getStartedFree",{defaultValue:"Get Started Free"})})})}),o.jsxs(je,{variant:"outline",size:"sm",onClick:()=>R("login"),className:"w-full border border-white/30 hover:border-white/40 ".concat(t),disabled:i,children:[i?o.jsx(TO,{size:"sm"}):o.jsx(V5,{size:14,className:"mr-1"}),o.jsx("span",{className:"text-xs",children:i?"":n("auth.userMenu.signIn",{defaultValue:"Sign In"})})]}),o.jsx(Vl,{isOpen:u,onClose:()=>h(!1),defaultMode:m,onLoginSuccess:()=>l("datakit")})]});const A=r!=null&&r.name?r.name.split(" ").map(w=>w[0]).join("").toUpperCase().slice(0,2):(r==null?void 0:r.email[0].toUpperCase())||"?";return e==="collapsed"?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative",ref:y,children:o.jsx("button",{onClick:()=>T(!g),className:"p-2 text-white/80 hover:text-white hover:bg-white/5 rounded transition-colors ".concat(t),title:(r==null?void 0:r.name)||(r==null?void 0:r.email),children:o.jsx("div",{className:"w-6 h-6 bg-primary rounded-full flex items-center justify-center text-xs font-medium text-white",children:r!=null&&r.avatarUrl?o.jsx("img",{src:r.avatarUrl,alt:r.name||r.email,className:"w-full h-full rounded-full object-cover"}):A})})}),o.jsx(At,{children:g&&o.jsxs(o.Fragment,{children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-40",onClick:()=>T(!1)}),o.jsxs(me.div,{initial:{opacity:0,scale:.95,x:-10},animate:{opacity:1,scale:1,x:0},exit:{opacity:0,scale:.95,x:-10},transition:{type:"spring",stiffness:400,damping:30,duration:.15},className:"fixed left-20 bottom-20 w-48 bg-black/90 backdrop-blur-xl border border-white/20 rounded-lg shadow-2xl py-1 z-50",children:[o.jsxs("div",{className:"px-3 py-2 border-b border-white/10",children:[o.jsx("div",{className:"text-sm font-medium text-white",children:(r==null?void 0:r.name)||n("auth.userMenu.user",{defaultValue:"User"})}),o.jsx("div",{className:"text-xs text-white/60",children:r==null?void 0:r.email})]}),o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:x,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors",children:[o.jsx(qs,{size:14}),n("auth.userMenu.settings",{defaultValue:"Settings"})]}),o.jsx("hr",{className:"border-white/10 my-1"}),o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:b,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors",children:[o.jsx(iy,{size:14}),n("auth.userMenu.signOut",{defaultValue:"Sign Out"})]})]})]})})]}):e==="sidebar"?o.jsxs("div",{className:"relative",ref:y,children:[o.jsxs("button",{onClick:()=>T(!g),className:"w-full flex items-center gap-2 py-2 px-1 rounded text-white/80 hover:text-white hover:bg-white/5 transition-colors cursor-pointer ".concat(t),children:[o.jsx("div",{className:"w-6 h-6 bg-primary rounded-full flex items-center justify-center text-xs font-medium text-white",children:r!=null&&r.avatarUrl?o.jsx("img",{src:r.avatarUrl,alt:r.name||r.email,className:"w-full h-full rounded-full object-cover"}):A}),o.jsxs("div",{className:"flex-1 text-left min-w-0",children:[o.jsx("div",{className:"text-sm font-medium truncate",children:(r==null?void 0:r.name)||n("auth.userMenu.user",{defaultValue:"User"})}),o.jsx("div",{className:"text-xs text-white/60 truncate",children:r==null?void 0:r.email})]}),o.jsx(br,{size:14,className:"transition-transform ".concat(g?"rotate-180":"")})]}),o.jsx(At,{children:g&&o.jsxs(o.Fragment,{children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed left-0 top-0 bottom-0 w-64 z-40",onClick:()=>T(!1)}),o.jsxs(me.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{type:"spring",stiffness:300,damping:30,duration:.2},className:"absolute bottom-full left-0 mb-2 w-full bg-black/90 backdrop-blur-xl border border-white/20 rounded-lg shadow-2xl py-1 z-50",children:[o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:x,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors cursor-pointer",children:[o.jsx(qs,{size:14}),n("auth.userMenu.settings",{defaultValue:"Settings"})]}),o.jsx("hr",{className:"border-white/10 my-1"}),o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:b,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors cursor-pointer",children:[o.jsx(iy,{size:14}),n("auth.userMenu.signOut",{defaultValue:"Sign Out"})]})]})]})})]}):o.jsxs("div",{className:"relative",ref:y,children:[o.jsxs("button",{onClick:()=>T(!g),className:"flex items-center gap-2 p-2 rounded text-white/80 hover:text-white hover:bg-white/5 transition-colors ".concat(t),children:[o.jsx("div",{className:"w-6 h-6 bg-primary rounded-full flex items-center justify-center text-xs font-medium text-white",children:r!=null&&r.avatarUrl?o.jsx("img",{src:r.avatarUrl,alt:r.name||r.email,className:"w-full h-full rounded-full object-cover"}):A}),o.jsx(br,{size:14,className:"transition-transform ".concat(g?"rotate-180":"")})]}),o.jsx(At,{children:g&&o.jsxs(o.Fragment,{children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-40",onClick:()=>T(!1)}),o.jsxs(me.div,{initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{type:"spring",stiffness:300,damping:30,duration:.2},className:"absolute right-0 top-full mt-2 w-48 bg-darkNav/90 backdrop-blur-xl border border-white/20 rounded-lg shadow-2xl py-1 z-50",children:[o.jsxs("div",{className:"px-3 py-2 border-b border-white/10",children:[o.jsx("div",{className:"text-sm font-medium text-white",children:(r==null?void 0:r.name)||n("auth.userMenu.user",{defaultValue:"User"})}),o.jsx("div",{className:"text-xs text-white/60",children:r==null?void 0:r.email})]}),o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:x,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors",children:[o.jsx(qs,{size:14}),n("auth.userMenu.settings",{defaultValue:"Settings"})]}),o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:()=>{T(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors",children:[o.jsx(BW,{size:14}),n("auth.userMenu.billing",{defaultValue:"Billing"})]}),o.jsx("hr",{className:"border-white/10 my-1"}),o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:b,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors",children:[o.jsx(iy,{size:14}),n("auth.userMenu.signOut",{defaultValue:"Sign Out"})]})]})]})})]})},yO="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='256'%20height='256'%20viewBox='0%200%2024%2024'%20fill='%23ffffff'%3e%3cpath%20fill='%23ffffff'%20d='M12%200C5.363%200%200%205.363%200%2012s5.363%2012%2012%2012s12-5.363%2012-12S18.637%200%2012%200zM9.502%207.03a4.974%204.974%200%200%201%204.97%204.97a4.974%204.974%200%200%201-4.97%204.97A4.974%204.974%200%200%201%204.532%2012a4.974%204.974%200%200%201%204.97-4.97zm6.563%203.183h2.351c.98%200%201.787.782%201.787%201.762s-.807%201.789-1.787%201.789h-2.351v-3.551z'/%3e%3c/svg%3e",fu=({className:e="h-5 w-5"})=>o.jsxs("svg",{className:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M19.5 22H4.5C3.39543 22 2.5 21.1046 2.5 20V4C2.5 2.89543 3.39543 2 4.5 2H14.5L21.5 9V20C21.5 21.1046 20.6046 22 19.5 22Z",fill:"#0F9D58",stroke:"white",strokeWidth:"0.75"}),o.jsx("path",{d:"M14.5 2V6.5C14.5 7.88071 15.6193 9 17 9H21.5L14.5 2Z",fill:"#87CEAC"}),o.jsx("rect",{x:"6.5",y:"12",width:"11",height:"7",fill:"white"}),o.jsx("path",{d:"M6.5 12H17.5V19H6.5V12ZM8.5 14V15.5H10V14H8.5ZM8.5 16.5V18H10V16.5H8.5ZM11 14V15.5H12.5V14H11ZM13.5 14V15.5H15.5V14H13.5ZM11 16.5V18H12.5V16.5H11ZM13.5 16.5V18H15.5V16.5H13.5Z",fill:"#0F9D58"})]}),rge=e=>{const t=e.toLowerCase();return t==="csv"||t==="tsv"?tr.CSV:t==="json"||t==="jsonl"?tr.JSON:t==="xlsx"||t==="xls"?tr.XLSX:t==="parquet"?tr.PARQUET:t==="txt"?tr.TXT:tr.CSV},i3=e=>{try{const t=e.split("/"),r=t[t.length-1].split("?")[0];if(r.endsWith(".gz")){const i=r.slice(0,-3).split(".");return i.length>1?i.pop():"txt"}const a=r.split(".");return a.length>1?a.pop():"txt"}catch(t){return"txt"}},_A=["https://api.allorigins.win/raw?url=","https://corsproxy.io/?","https://cors-anywhere.herokuapp.com/"];function age(){const[e,t]=v.useState(!1),[n,r]=v.useState(0),[a,s]=v.useState(""),[i,l]=v.useState(null),c=Dt(),u=v.useCallback(x=>{try{let R,A,w,_;if(x.startsWith("s3://")){const D=x.replace("s3://","").split("/");if(R=D[0],A=D.slice(1).join("/"),!R||!A)return{isValid:!1,error:"S3 URL must include both bucket and key (s3://bucket/path/file.ext)"};_="https://".concat(R,".s3.amazonaws.com/").concat(A)}else if(x.includes(".s3.")||x.includes("s3.amazonaws.com")){_=x;const D=new URL(x);if(D.hostname.startsWith("s3.")){const M=D.pathname.substring(1).split("/");R=M[0],A=M.slice(1).join("/"),w=D.hostname.split(".")[1]}else{R=D.hostname.split(".")[0],A=D.pathname.substring(1);const M=D.hostname.split(".");w=M.length>3?M[2]:"us-east-1"}}else return{isValid:!1,error:"Must be a valid S3 URL (s3://bucket/key or https://bucket.s3.amazonaws.com/key)"};const N=i3(A),I=["csv","tsv","json","jsonl","xlsx","xls","parquet","txt"];return I.includes(N)?{isValid:!0,bucket:R,key:A,region:w,httpsUrl:_,extension:N}:{isValid:!1,error:"Unsupported file format: .".concat(N,". Supported: ").concat(I.join(", "))}}catch(R){return{isValid:!1,error:"Invalid S3 URL format: ".concat(R instanceof Error?R.message:"Unknown error")}}},[]),h=v.useCallback(x=>H(null,null,function*(){try{return(yield fetch(x,{method:"HEAD",mode:"cors",signal:AbortSignal.timeout(5e3)})).ok}catch(R){return!1}}),[]),m=v.useCallback((x,R)=>H(null,null,function*(){var _;const A=((_=x.split("/").pop())==null?void 0:_.split("?")[0])||"s3_file";if(s("Testing direct access to ".concat(A,"...")),yield h(x)){s("Direct access available for ".concat(A));const N=yield p(x,R);return he(q({},N),{method:"direct"})}s("Direct access blocked, trying CORS proxies for ".concat(A,"..."));for(let N=0;N<_A.length;N++){const I=_A[N]+encodeURIComponent(x);try{s("Trying CORS proxy ".concat(N+1,"/").concat(_A.length," for ").concat(A,"..."));const D=yield fetch(I,{mode:"cors"});if(D.ok){const M=yield D.blob(),O=M.size;return s("Successfully downloaded ".concat(A," via proxy")),{blob:M,method:"proxy",fileName:A,fileSize:O}}}catch(D){}}throw new Error("Cannot access S3 file due to CORS restrictions. Try:\n• AWS CLI: aws s3 cp ".concat(x," ./data.ext --no-sign-request\n• Download manually and use local file import"))}),[h]),p=v.useCallback((x,R)=>H(null,null,function*(){var U,B;const A=((U=x.split("/").pop())==null?void 0:U.split("?")[0])||"s3_file",w=yield fetch(x,{method:"HEAD",mode:"cors"}).catch(()=>null),_=w==null?void 0:w.headers.get("content-length"),N=_?parseInt(_,10):0;s("Downloading ".concat(A).concat(N?" (".concat((N/1024/1024).toFixed(1),"MB)"):"","..."));const I=yield fetch(x,{mode:"cors"});if(!I.ok)throw I.status===403?new Error("Access denied. This S3 object may not be publicly accessible."):I.status===404?new Error("File not found in S3 bucket."):new Error("HTTP ".concat(I.status,": ").concat(I.statusText));const D=(B=I.body)==null?void 0:B.getReader();if(!D){const j=yield I.blob();return{blob:j,fileName:A,fileSize:j.size}}const M=[];let O=0;for(;;){const{done:j,value:G}=yield D.read();if(j)break;if(M.push(G),O+=G.length,R&&R(O,N||void 0),N>0){const K=O/N;r(K*.5)}}const L=new Uint8Array(O);let k=0;for(const j of M)L.set(j,k),k+=j.length;return{blob:new Blob([L]),fileName:A,fileSize:O}}),[]),g=v.useCallback(x=>H(null,null,function*(){var R;try{const A=(R=new Response(x).body)==null?void 0:R.pipeThrough(new DecompressionStream("gzip"));if(A)return yield new Response(A).blob();throw new Error("DecompressionStream not available")}catch(A){throw new Error("Failed to decompress .gz file. Your browser may not support this feature.")}}),[]),T=v.useCallback((x,R)=>H(null,null,function*(){try{t(!0),r(0),l(null),s("Validating S3 URL...");const A=u(x);if(!A.isValid)throw new Error(A.error||"Invalid S3 URL");const{bucket:w,key:_,region:N,httpsUrl:I,extension:D}=A;r(.1);const{blob:M,method:O,fileName:L,fileSize:k}=yield m(I);r(.5),s("Processing file with DuckDB...");let F=M,U=D;if(_.endsWith(".gz")){s("Decompressing .gz file..."),r(.55);try{F=yield g(M),U=i3(_.replace(".gz",""))}catch(W){}r(.6)}const j=(R||L.replace(/\.(gz)$/,"")||"imported_s3_file").replace(/[^a-zA-Z0-9_-]/g,"_"),G="".concat(j,".").concat(U),J={csv:"text/csv",tsv:"text/tab-separated-values",json:"application/json",parquet:"application/octet-stream",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xls:"application/vnd.ms-excel",txt:"text/plain"}[U]||"application/octet-stream",$=new File([F],G,{type:J}),X=yield c.importFileDirectly($);r(.8),s("Getting data preview...");const Z=yield c.executeQuery('PRAGMA table_info("'.concat(X.tableName,'")'));if(!Z)throw new Error("Failed to get table schema");const V=yield c.executeQuery('SELECT * FROM "'.concat(X.tableName,'" LIMIT 1000'));if(!V)throw new Error("Failed to get data sample");const te=Z.toArray().map(W=>W.name),ae=[te,...V.toArray().map(W=>te.map(Q=>{const se=W[Q];return se!=null?String(se):""}))],ne=Z.toArray().map(W=>{const Q=W.type.toLowerCase();return Q.includes("int")||Q.includes("float")||Q.includes("double")?Nt.Number:Q.includes("bool")?Nt.Boolean:Q.includes("date")||Q.includes("time")?Nt.Date:Q.includes("json")||Q.includes("object")?Nt.Object:Q.includes("array")||Q.includes("list")?Nt.Array:Nt.Text}),ce=rge(U);return r(1),s("Successfully imported ".concat(X.rowCount.toLocaleString()," rows from S3")),{data:ae,columnTypes:ne,fileName:G,rowCount:X.rowCount,columnCount:te.length,sourceType:ce,loadedToDuckDB:!0,tableName:X.tableName,s3:{bucket:w,key:_,region:N,url:x,fileSize:k,method:O}}}catch(A){const w=A instanceof Error?A.message:"Unknown error";throw l(w),A}finally{t(!1),setTimeout(()=>{r(0),s("")},2e3)}}),[c,u,m,g]),y=v.useCallback(x=>H(null,null,function*(){try{const R=u(x);return!R.isValid||!R.httpsUrl?!1:yield h(R.httpsUrl)}catch(R){return!1}}),[u,h]),b=v.useCallback(x=>u(x),[u]);return{isImporting:e,importProgress:n,importStatus:a,error:i,importFromS3:T,testS3Access:y,validateS3Url:b,parseS3Url:u,resetError:()=>l(null)}}const a7=[{id:"noaa-ghcn-stations",name:"NOAA Weather Stations",description:"Complete global list of NOAA weather stations with coordinates and metadata.",category:"weather",format:["TXT"],size:"4.5 MB",lastUpdated:"2024-12-01",url:"s3://noaa-ghcn-pds/ghcnd-stations.txt",s3Url:"s3://noaa-ghcn-pds/ghcnd-stations.txt",httpUrl:"https://noaa-ghcn-pds.s3.amazonaws.com/ghcnd-stations.txt",documentation:"https://registry.opendata.aws/noaa-ghcn/",tags:["weather","stations","global","coordinates","metadata"],featured:!0,provider:"aws",license:"CC0-1.0",updateFrequency:"Monthly",bucket:"noaa-ghcn-pds",region:"us-east-1",corsStatus:"proxy-required"},{id:"openaq-single-day-sample",name:"OpenAQ Air Quality",description:"Single day of global air quality measurements from OpenAQ. PM2.5, NO2, O3 pollution data.",category:"health",format:["CSV"],size:"5 MB",lastUpdated:"2024-12-01",url:"s3://openaq-data-archive/records/csv.gz/locationid=2178/year=2022/month=05/location-2178-20220503.csv.gz",s3Url:"s3://openaq-data-archive/records/csv.gz/locationid=2178/year=2022/month=05/location-2178-20220503.csv.gz",httpUrl:"https://openaq-data-archive.s3.amazonaws.com/records/csv.gz/locationid=2178/year=2022/month=05/location-2178-20220503.csv.gz",documentation:"https://docs.openaq.org/docs/accessing-openaq-archive-data",tags:["air-quality","pollution","pm25","environmental","global"],featured:!0,provider:"aws",license:"CC BY 4.0",updateFrequency:"Daily",bucket:"openaq-data-archive",region:"us-east-1",corsStatus:"proxy-required"},{id:"noaa-ghcn-historical-1763",name:"NOAA Weather Data 1763",description:"The very first weather data in NOAA dataset from 1763.",category:"weather",format:["CSV"],size:"64 KB",lastUpdated:"2024-12-01",url:"s3://noaa-ghcn-pds/csv/by_year/1763.csv",s3Url:"s3://noaa-ghcn-pds/csv/by_year/1763.csv",httpUrl:"https://noaa-ghcn-pds.s3.amazonaws.com/csv/by_year/1763.csv",documentation:"https://registry.opendata.aws/noaa-ghcn/",tags:["weather","historical","1763","earliest","colonial"],featured:!1,provider:"aws",license:"CC0-1.0",updateFrequency:"Static",bucket:"noaa-ghcn-pds",region:"us-east-1",corsStatus:"proxy-required"}],xO=[{id:"iris-dataset",name:"Iris Flower Dataset",description:"Classic machine learning dataset with 150 samples of iris flowers and their measurements.",category:"sample",format:["CSV"],size:"4 KB",lastUpdated:"2024-01-01",url:"https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv",httpUrl:"https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv",documentation:"https://en.wikipedia.org/wiki/Iris_flower_data_set",tags:["machine-learning","classification","flowers","small","beginner"],featured:!0,provider:"github",license:"Public Domain",updateFrequency:"Static",repository:"mwaskom/seaborn-data",branch:"master",path:"iris.csv"},{id:"titanic-dataset",name:"Titanic Passenger Data",description:"Passenger data from the Titanic disaster, commonly used for data analysis tutorials.",category:"sample",format:["CSV"],size:"59 KB",lastUpdated:"2024-01-01",url:"https://raw.githubusercontent.com/mwaskom/seaborn-data/master/titanic.csv",httpUrl:"https://raw.githubusercontent.com/mwaskom/seaborn-data/master/titanic.csv",documentation:"https://www.kaggle.com/c/titanic",tags:["historical","demographics","survival-analysis","tutorial","beginner"],featured:!0,provider:"github",license:"Public Domain",updateFrequency:"Static",repository:"mwaskom/seaborn-data",branch:"master",path:"titanic.csv"},{id:"covid-19-global",name:"COVID-19 Global Data",description:"Time series data of COVID-19 cases, deaths, and recoveries by country.",category:"health",format:["CSV"],size:"12 MB",lastUpdated:"2024-12-01",url:"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv",httpUrl:"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv",documentation:"https://github.com/CSSEGISandData/COVID-19",tags:["health","pandemic","time-series","global","medium"],featured:!1,provider:"github",license:"Public Domain",updateFrequency:"Daily",repository:"CSSEGISandData/COVID-19",branch:"master",path:"csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv"},{id:"us-population-census",name:"US Population by State",description:"US Census population data by state from 1900-2020. Useful for demographic analysis.",category:"government",format:["CSV"],size:"45 KB",lastUpdated:"2024-01-01",url:"https://raw.githubusercontent.com/plotly/datasets/master/1962_2006_walmart_store_openings.csv",httpUrl:"https://raw.githubusercontent.com/plotly/datasets/master/1962_2006_walmart_store_openings.csv",documentation:"https://github.com/plotly/datasets",tags:["demographics","census","government","historical","small"],featured:!1,provider:"github",license:"MIT",updateFrequency:"Static",repository:"plotly/datasets",branch:"master",path:"1962_2006_walmart_store_openings.csv"},{id:"tesla-stock-data",name:"Tesla Stock Prices",description:"Historical Tesla (TSLA) stock price data with OHLCV information.",category:"finance",format:["CSV"],size:"89 KB",lastUpdated:"2024-01-01",url:"https://raw.githubusercontent.com/plotly/datasets/master/tesla-stock-price.csv",httpUrl:"https://raw.githubusercontent.com/plotly/datasets/master/tesla-stock-price.csv",documentation:"https://github.com/plotly/datasets",tags:["finance","stocks","tesla","time-series","small"],featured:!1,provider:"github",license:"MIT",updateFrequency:"Static",repository:"plotly/datasets",branch:"master",path:"tesla-stock-price.csv"}],SO=[{id:"rajpurkar/squad",name:"SQuAD",description:"Stanford Question Answering Dataset - A reading comprehension dataset with 100k+ question-answer pairs",provider:"huggingface",category:"nlp",size:"35.1MB",format:["parquet"],tags:["question-answering","english","text"],featured:!1,downloads:5e4,likes:245,task:"Question Answering",gated:!1,lastModified:"2023-10-15",repository:"rajpurkar/squad",url:"https://huggingface.co/datasets/rajpurkar/squad"},{id:"stanfordnlp/imdb",name:"IMDB Movie Reviews",description:"Large Movie Review Dataset for binary sentiment classification with 50k highly polar movie reviews",provider:"huggingface",category:"nlp",size:"66.9MB",format:["parquet"],tags:["sentiment-analysis","text-classification","english"],featured:!1,downloads:75e3,likes:312,task:"Sentiment Analysis",gated:!1,lastModified:"2023-11-20",repository:"stanfordnlp/imdb",url:"https://huggingface.co/datasets/stanfordnlp/imdb"},{id:"alesforce/wikitext",name:"WikiText-103",description:"Collection of over 100 million tokens extracted from Wikipedia articles for language modeling",provider:"huggingface",category:"nlp",size:"181MB",format:["parquet"],tags:["language-modeling","text-generation","english"],featured:!1,downloads:25e3,likes:145,task:"Language Modeling",gated:!1,lastModified:"2023-09-12",repository:"Salesforce/wikitext",url:"https://huggingface.co/datasets/wikitext"},{id:"uoft-cs/cifar10",name:"CIFAR-10",description:"60k 32x32 color images in 10 classes, with 6k images per class. Classic computer vision dataset",provider:"huggingface",category:"computer-vision",size:"132MB",format:["parquet"],tags:["image-classification","computer-vision","10-classes"],featured:!1,downloads:45e3,likes:278,task:"Image Classification",gated:!1,lastModified:"2023-10-05",repository:"uoft-cs/cifar10",url:"https://huggingface.co/datasets/cifar10"},{id:"zalando-datasets/fashion_mnist",name:"Fashion-MNIST",description:"Drop-in replacement for MNIST with 70k grayscale images of fashion items in 10 categories",provider:"huggingface",category:"computer-vision",size:"29.5MB",format:["parquet"],tags:["image-classification","fashion","mnist-alternative"],featured:!1,downloads:18e3,likes:156,task:"Image Classification",gated:!1,lastModified:"2023-09-18",repository:"zalando-datasets/fashion_mnist",url:"https://huggingface.co/datasets/fashion_mnist"},{id:"scikit-learn/iris",name:"Iris Dataset",description:"Classic dataset with 150 instances of iris flowers with 4 features each, perfect for ML beginners",provider:"huggingface",category:"tabular",size:"4.8KB",format:["parquet"],tags:["classification","tabular","flowers","classic"],featured:!1,downloads:15e3,likes:95,task:"Classification",gated:!1,lastModified:"2023-07-22",repository:"scikit-learn/iris",url:"https://huggingface.co/datasets/scikit-learn/iris"},{id:"sahil2801/CodeAlpaca-20k",name:"Code Alpaca",description:"20k instruction-following data for code generation, covering various programming tasks",provider:"huggingface",category:"code",size:"11.2MB",format:["parquet"],tags:["code-generation","instruction-following","programming"],featured:!1,downloads:8900,likes:145,task:"Code Generation",gated:!1,lastModified:"2023-10-30",repository:"sahil2801/CodeAlpaca-20k",url:"https://huggingface.co/datasets/sahil2801/CodeAlpaca-20k"},{id:"google-research-datasets/conceptual_captions",name:"Conceptual Captions",description:"3.3M image-caption pairs extracted from billions of web pages for vision-language tasks",provider:"huggingface",category:"multimodal",size:"450MB",format:["parquet"],tags:["image-captioning","vision-language","web-scraping"],featured:!1,downloads:6500,likes:123,task:"Image Captioning",gated:!1,lastModified:"2023-09-25",repository:"google-research-datasets/conceptual_captions",url:"https://huggingface.co/datasets/google-research-datasets/conceptual_captions"},{id:"qiaojin/PubMedQA",name:"PubMedQA",description:"273k biomedical question-answer pairs derived from PubMed abstracts for medical QA",provider:"huggingface",category:"medical",size:"156MB",format:["parquet"],tags:["question-answering","medical","biomedical"],featured:!1,downloads:3100,likes:89,task:"Medical QA",gated:!1,lastModified:"2023-08-20",repository:"qiaojin/PubMedQA",url:"https://huggingface.co/datasets/pubmed_qa"}],s7="https://huggingface.co/api",W0="https://datasets-server.huggingface.co";function i7(n){return H(this,arguments,function*(e,t={}){const{limit:r=20,author:a,authToken:s,sort:i="downloads",direction:l="desc"}=t;try{const c=new URLSearchParams({search:e,limit:r.toString(),sort:i,direction:l==="desc"?"-1":"1",full:"true"});a&&c.append("author",a);const u="".concat(s7,"/datasets?").concat(c.toString()),h={Accept:"application/json"};s&&(h.Authorization="Bearer ".concat(s));const m=yield fetch(u,{headers:h});if(!m.ok)throw new Error("Search failed: ".concat(m.status," ").concat(m.statusText));return(yield m.json()).map(g=>{var T,y,b,x,R,A,w,_;return{id:g.id,name:g.id.split("/").pop()||g.id,fullName:g.id,description:((T=g.cardData)==null?void 0:T.description)||g.description||"No description available",author:g.author||g.id.split("/")[0],downloads:g.downloads||0,likes:g.likes||0,tags:g.tags||[],task:((b=(y=g.cardData)==null?void 0:y.task_categories)==null?void 0:b[0])||"general",lastModified:g.lastModified,gated:g.gated||!1,private:g.private||!1,size:((R=(x=g.cardData)==null?void 0:x.size_categories)==null?void 0:R[0])||"unknown",languages:((A=g.cardData)==null?void 0:A.language)||[],multilinguality:((w=g.cardData)==null?void 0:w.multilinguality)||[],featured:((_=g.tags)==null?void 0:_.includes("featured"))||!1}})}catch(c){throw new Error("Failed to search datasets: ".concat(c instanceof Error?c.message:"Unknown error"))}})}function BL(e,t){return H(this,null,function*(){try{const n={Accept:"application/json"};t&&(n.Authorization="Bearer ".concat(t));const r="".concat(W0,"/splits?dataset=").concat(encodeURIComponent(e)),a=yield fetch(r,{headers:n});if(!a.ok)return{splits:[],configs:[]};const i=(yield a.json()).splits||[],l=new Map;i.forEach(u=>{l.has(u.config)||l.set(u.config,{config_name:u.config,dataset:u.dataset,splits:[]}),l.get(u.config).splits.push(u.split)});const c=Array.from(l.values());return{splits:i,configs:c}}catch(n){throw new Error("Failed to get dataset splits: ".concat(n instanceof Error?n.message:"Unknown error"))}})}function wh(e){if(!e||typeof e!="string")return{isValid:!1,error:"Dataset ID is required",fullId:e||""};const t=e.trim();let n=t,r,a;const s=n.lastIndexOf("/");if(s>-1){const c=n.substring(s+1),u=n.substring(0,s);(["train","test","validation","val","dev","eval"].includes(c.toLowerCase())||c.match(/^(train|test|val|validation|dev|eval)[\d_-]*$/i))&&(a=c,n=u)}const i=n.indexOf(":");i>-1&&(r=n.substring(i+1),n=n.substring(0,i));const l=n.split("/");if(l.length===1){const c=l[0];return!c||c.length===0?{isValid:!1,error:"Dataset name cannot be empty",fullId:t}:{isValid:!0,organization:void 0,dataset:c,config:r,split:a,fullId:t}}else if(l.length===2){const[c,u]=l;return!c||!u||c.length===0||u.length===0?{isValid:!1,error:"Both organization and dataset name are required",fullId:t}:{isValid:!0,organization:c,dataset:u,config:r,split:a,fullId:t}}else return{isValid:!1,error:"Invalid dataset ID format. Expected: organization/dataset[:config][/split]",fullId:t}}function HL(e,t){return H(this,null,function*(){try{const n=wh(e),r=n.organization?"".concat(n.organization,"/").concat(n.dataset):n.dataset,{configs:a}=yield BL(r,t),s=[];for(const l of a)try{const c="".concat(W0,"/parquet?dataset=").concat(encodeURIComponent(r),"&config=").concat(encodeURIComponent(l.config_name)),u={Accept:"application/json"};t&&(u.Authorization="Bearer ".concat(t));const h=yield fetch(c,{headers:u});if(h.ok){const m=yield h.json();m.parquet_files&&m.parquet_files.length>0&&m.parquet_files.forEach(p=>{s.push({type:"parquet",url:p.url,split:p.split,config:p.config,size:p.size,filename:p.filename})})}}catch(c){}let i="parquet";return s.length===0&&(i="download"),{formats:s,recommendedFormat:i,availableConfigs:a}}catch(n){throw new Error("Failed to detect available formats: ".concat(n instanceof Error?n.message:"Unknown error"))}})}function VL(e,t){return H(this,null,function*(){var n;try{const r=wh(e),a=r.organization?"".concat(r.organization,"/").concat(r.dataset):r.dataset,s="".concat(s7,"/datasets/").concat(encodeURIComponent(a)),i={Accept:"application/json"};t&&(i.Authorization="Bearer ".concat(t));const l=yield fetch(s,{headers:i});if(!l.ok)throw new Error("Failed to get dataset info: ".concat(l.status," ").concat(l.statusText));const c=yield l.json(),{splits:u,configs:h}=yield BL(a,t);return{id:a,name:c.id.split("/").pop()||c.id,description:((n=c.cardData)==null?void 0:n.description)||c.description||"No description available",author:c.author||c.id.split("/")[0],downloads:c.downloads||0,likes:c.likes||0,tags:c.tags||[],lastModified:c.lastModified,gated:c.gated||!1,private:c.private||!1,configs:h,splits:u,features:{}}}catch(r){throw new Error("Failed to get dataset information: ".concat(r instanceof Error?r.message:"Unknown error"))}})}function sge(e,t="default",n){return H(this,null,function*(){try{const r=wh(e),a=r.organization?"".concat(r.organization,"/").concat(r.dataset):r.dataset,s={Accept:"application/json"};n&&(s.Authorization="Bearer ".concat(n));const i="".concat(W0,"/parquet?dataset=").concat(encodeURIComponent(a),"&config=").concat(encodeURIComponent(t)),l=yield fetch(i,{headers:s});if(!l.ok)throw new Error("Failed to get parquet files: ".concat(l.status," ").concat(l.statusText));return{parquet_files:(yield l.json()).parquet_files||[]}}catch(r){throw new Error("Failed to get parquet files: ".concat(r instanceof Error?r.message:"Unknown error"))}})}function ige(e,t){return H(this,null,function*(){try{const n=wh(e),r=n.organization?"".concat(n.organization,"/").concat(n.dataset):n.dataset,a="".concat(W0,"/is-valid?dataset=").concat(encodeURIComponent(r)),s={Accept:"application/json"};t&&(s.Authorization="Bearer ".concat(t));const i=yield fetch(a,{headers:s});if(i.ok){const l=yield i.json();return l.preview||l.viewer||l.search||!1}return!1}catch(n){return!1}})}const o3=[...a7,...xO,...SO];function GL(e){const[t,n]=v.useState([]),[r,a]=v.useState([]),[s,i]=v.useState(!1),[l,c]=v.useState(!1),[u,h]=v.useState(null),m=v.useCallback(()=>H(null,null,function*(){try{i(!0),h(null);let k=[];switch(e){case"aws":k=a7;break;case"github":k=xO;break;case"custom-url":k=xO;break;case"huggingface":k=SO;break;case"all":default:k=o3;break}k.sort((F,U)=>{if(F.featured&&!U.featured)return-1;if(!F.featured&&U.featured)return 1;if(F.provider!==U.provider){const B={huggingface:0,aws:1,github:2,gcs:3,direct:4};return B[F.provider]-B[U.provider]}return F.name.localeCompare(U.name)}),n(k)}catch(k){h("Failed to load datasets. Please try again.")}finally{i(!1)}}),[e]),p=v.useCallback((U,...B)=>H(null,[U,...B],function*(k,F={}){try{if(c(!0),h(null),e==="huggingface"){const G=(yield i7(k,{limit:F.limit||20,author:F.author,authToken:F.authToken,sort:"downloads",direction:"desc"})).map(K=>({id:K.id,name:K.name,description:K.description,downloads:K.downloads,likes:K.likes,lastModified:K.lastModified,size:K.size}));if(a(G),G.length===0){const K=SO.filter(J=>J.name.toLowerCase().includes(k.toLowerCase())||J.description.toLowerCase().includes(k.toLowerCase())||J.tags.some($=>$.toLowerCase().includes(k.toLowerCase())));a(K)}}else{const j=k.toLowerCase(),K=(e==="all"?o3:t).filter(J=>J.name.toLowerCase().includes(j)||J.description.toLowerCase().includes(j)||J.tags.some($=>$.toLowerCase().includes(j))||J.repository&&J.repository.toLowerCase().includes(j));a(K)}}catch(j){h("Search failed. Please try again.")}finally{c(!1)}}),[e,t]),g=v.useCallback(k=>k==="all"?t:t.filter(F=>F.category===k),[t]),T=v.useCallback(k=>t.filter(F=>F.provider===k),[t]),y=v.useCallback(k=>t.filter(F=>F.tags.some(U=>U.toLowerCase().includes(k.toLowerCase()))),[t]),b=v.useCallback(k=>t.filter(F=>F.format.some(U=>U.toLowerCase()===k.toLowerCase())),[t]),x=v.useCallback(k=>t.filter(F=>F.task&&F.task.toLowerCase().includes(k.toLowerCase())),[t]),R=v.useCallback(k=>{if(!k.trim())return t;const F=k.toLowerCase();return t.filter(U=>U.name.toLowerCase().includes(F)||U.description.toLowerCase().includes(F)||U.tags.some(B=>B.toLowerCase().includes(F))||U.provider.toLowerCase().includes(F)||U.repository&&U.repository.toLowerCase().includes(F)||U.task&&U.task.toLowerCase().includes(F))},[t]),A=v.useCallback(()=>t.filter(k=>k.featured),[t]),w=v.useCallback(k=>t.find(F=>F.id===k),[t]),_=v.useCallback(()=>{const k=new Set;return t.forEach(F=>{F.tags.forEach(U=>k.add(U))}),Array.from(k).sort()},[t]),N=v.useCallback(k=>t.filter(F=>{const U=F.size.toLowerCase();return k==="small"?U.includes("kb")||U.includes("mb")&&parseFloat(U)<1:k==="medium"?U.includes("mb")&&parseFloat(U)>=1&&parseFloat(U)<=50:U.includes("mb")&&parseFloat(U)>50}),[t]),I=v.useCallback(()=>{const k=new Map;return t.forEach(F=>{const U=k.get(F.category)||0;k.set(F.category,U+1)}),Array.from(k.entries()).map(([F,U])=>({category:F,count:U}))},[t]),D=v.useCallback((k=10)=>{const F=new Map;return t.forEach(U=>{U.tags.forEach(B=>{F.set(B,(F.get(B)||0)+1)})}),Array.from(F.entries()).sort(([,U],[,B])=>B-U).slice(0,k).map(([U,B])=>({tag:U,count:B}))},[t]),M=v.useCallback(()=>({total:t.length,providers:[...new Set(t.map(F=>F.provider))],categories:[...new Set(t.map(F=>F.category))],formats:[...new Set(t.flatMap(F=>F.format))],featured:t.filter(F=>F.featured).length,byProvider:{huggingface:t.filter(F=>F.provider==="huggingface").length,aws:t.filter(F=>F.provider==="aws").length,github:t.filter(F=>F.provider==="github").length,gcs:t.filter(F=>F.provider==="gcs").length,direct:t.filter(F=>F.provider==="direct").length},bySize:{small:N("small").length,medium:N("medium").length,large:N("large").length}}),[t,N]),O=v.useCallback(()=>m(),[m]),L=v.useCallback(()=>{a([])},[]);return{datasets:t,searchResults:r,loading:s,isSearching:l,error:u,fetchDatasets:m,refreshDatasets:O,searchDatasets:p,clearSearchResults:L,getDatasetsByCategory:g,getDatasetsByProvider:T,getDatasetsByTag:y,getDatasetsByFormat:b,getDatasetsBySize:N,getDatasetsByTask:x,searchDatasetsLocal:R,getFeaturedDatasets:A,getDatasetById:w,getCategories:I,getStats:M,getAllTags:_,getPopularTags:D,resetError:()=>h(null)}}const oge=({dataset:e,onImport:t,isImporting:n})=>{const{t:r}=Ze();return o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"bg-white/5 border border-white/10 rounded-lg p-4 hover:bg-white/8 hover:border-white/20 transition-all duration-200",children:[o.jsxs("div",{className:"mb-3",children:[o.jsxs("div",{className:"flex items-center mb-1",children:[o.jsx("h4",{className:"text-sm font-medium text-white truncate mr-2",children:e.name}),e.featured&&o.jsx("span",{className:"bg-primary/20 text-primary text-xs px-2 py-0.5 rounded",children:r("importModal.s3.dataset.featured")})]}),o.jsx("p",{className:"text-xs text-white/70 line-clamp-2 leading-relaxed",children:e.description})]}),o.jsx("div",{className:"flex items-center justify-between text-xs text-white/60 mb-3",children:o.jsxs("div",{className:"flex items-center space-x-3",children:[o.jsxs("span",{className:"flex items-center",children:[o.jsx(HW,{className:"h-3 w-3 mr-1"}),e.region]}),o.jsx("span",{className:"bg-white/10 text-white/80 px-1.5 py-0.5 rounded",children:e.format.join(", ")}),o.jsx("span",{className:"text-white/50",children:e.size})]})}),o.jsx(je,{size:"sm",variant:"outline",onClick:()=>t(e),disabled:n,className:"w-full text-xs h-8",children:n?o.jsxs(o.Fragment,{children:[o.jsx(Hn,{className:"h-3 w-3 mr-1 animate-spin"}),r("importModal.s3.dataset.importing")]}):o.jsxs(o.Fragment,{children:[o.jsx(Hr,{className:"h-3 w-3 mr-1"}),r("importModal.s3.dataset.import")]})})]})},lge=({onImport:e})=>{const{t}=Ze(),[n,r]=v.useState(""),[a,s]=v.useState(null),{datasets:i,loading:l,fetchDatasets:c}=GL("aws"),{importFromS3:u,isImporting:h,importStatus:m,validateS3Url:p}=age();v.useEffect(()=>{c()},[c]);const g=R=>{if(s(null),!R.trim())return s(t("importModal.s3.validation.urlRequired")),!1;const A=p(R);return A.isValid?!0:(s(A.error||t("importModal.s3.validation.invalidUrl")),!1)},T=R=>H(null,null,function*(){if(R.preventDefault(),g(n))try{const A=yield u(n),w=he(q({},A),{isRemote:!0,remoteProvider:"s3",remoteURL:n});e(w)}catch(A){}}),y=R=>H(null,null,function*(){try{const A=yield u(R.s3Url,R.name.replace(/[^a-zA-Z0-9_-]/g,"_")),w=he(q({},A),{isRemote:!0,remoteProvider:"s3",remoteURL:R.s3Url,dataset:{id:R.id,name:R.name,category:R.category,bucket:R.bucket,region:R.region}});e(w)}catch(A){}}),b=n.trim()?p(n):null,x=b==null?void 0:b.isValid;return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o.jsxs("form",{onSubmit:T,className:"space-y-4 mb-8",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"s3-url",className:"block text-sm font-medium text-white/80 mb-2",children:t("importModal.s3.urlLabel")}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{id:"s3-url",type:"text",placeholder:t("importModal.s3.urlPlaceholder"),className:Qe("w-full px-3 py-3 h-12 bg-black/30 border border-white/20 rounded-lg text-white/90 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/50 placeholder:text-white/40 transition-all",a&&"border-destructive focus:ring-destructive/50 focus:border-destructive",x&&"border-green-500/50 focus:ring-green-500/50 focus:border-green-500"),value:n,onChange:R=>r(R.target.value),disabled:h}),o.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:h?o.jsx(Hn,{className:"h-4 w-4 text-white/40 animate-spin"}):x?o.jsx("div",{className:"bg-green-500/20 text-green-500 p-1.5 rounded-full",children:o.jsx(Zr,{className:"h-4 w-4"})}):n?o.jsx("div",{className:"bg-red-500/20 text-red-500 p-1.5 rounded-full",children:o.jsx(Cn,{className:"h-4 w-4"})}):null})]}),a&&o.jsxs(me.p,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"mt-2 text-xs text-destructive flex items-center",children:[o.jsx(Cn,{className:"h-3 w-3 mr-1 flex-shrink-0"}),a]}),x&&(b==null?void 0:b.bucket)&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mt-3 overflow-hidden",children:o.jsxs("div",{className:"bg-green-500/10 rounded-lg border border-green-500/20 p-4",children:[o.jsxs("div",{className:"flex items-center text-sm text-white/90 mb-2",children:[o.jsx(Xs,{className:"h-4 w-4 mr-2 text-green-500"}),o.jsx("span",{className:"font-medium font-mono",children:b.bucket}),b.region&&o.jsx("span",{className:"ml-2 text-xs bg-green-500/20 text-green-500 px-2 py-0.5 rounded",children:b.region})]}),o.jsxs("div",{className:"flex items-center text-xs text-white/70",children:[o.jsx(Zr,{className:"h-3.5 w-3.5 mr-1.5 text-white/50"}),o.jsx("span",{children:t("importModal.s3.status.validUrl")})]})]})})]}),o.jsx("div",{className:"flex justify-end",children:o.jsx(je,{variant:"outline",type:"submit",className:Qe("px-6 py-2.5",x?"border-green-700 hover:border-green-700":void 0),disabled:h||!n.trim()||!x,children:h?o.jsxs(o.Fragment,{children:[o.jsx(Hn,{className:"h-4 w-4 mr-2 animate-spin"}),t("importModal.s3.actions.importing")]}):o.jsxs(o.Fragment,{children:[t("importModal.s3.actions.importFromS3"),o.jsx(nr,{className:"h-4 w-4 ml-1"})]})})}),o.jsx(At,{children:h&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-4 overflow-hidden",children:o.jsx("div",{className:"bg-primary/10 border border-primary/20 rounded-lg p-4",children:o.jsx("div",{className:"flex items-center text-sm",children:o.jsx("p",{className:"text-primary font-medium",children:m})})})})})]}),o.jsxs("div",{className:"border-t border-white/10 pt-6",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("h4",{className:"text-base font-medium text-white mb-2 flex items-center",children:t("importModal.s3.examples.title")}),o.jsx("p",{className:"text-sm text-white/60",children:t("importModal.s3.examples.description")})]}),l?o.jsxs("div",{className:"flex items-center justify-center py-8",children:[o.jsx(Hn,{className:"h-5 w-5 animate-spin text-primary mr-2"}),o.jsx("span",{className:"text-white/60",children:t("importModal.s3.loading.datasets")})]}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map(R=>o.jsx(oge,{dataset:R,onImport:y,isImporting:h},R.id))})]})]}),o.jsx("div",{className:"border-t border-white/10 p-4 bg-white/5",children:o.jsxs("div",{className:"text-xs text-white/60",children:[o.jsxs("div",{className:"flex items-center mb-2",children:[o.jsx(V0,{className:"h-3 w-3 mr-1.5 text-primary"}),o.jsxs("span",{className:"font-medium text-white/80",children:[t("importModal.s3.footer.title"),":"]})]}),o.jsxs("ul",{className:"space-y-1 ml-4",children:[o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("importModal.s3.footer.corsInfo")]}),o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("importModal.s3.footer.supportedFormats")]}),o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("importModal.s3.footer.autoDetection")]})]})]})})]})};function cge(){const[e,t]=v.useState(!1),[n,r]=v.useState(""),[a,s]=v.useState(0),[i,l]=v.useState(null),{importFileDirectly:c,executeQuery:u}=Dt(),h=v.useCallback((b,x)=>{const R=b.toArray().map(w=>w.name);return[R,...x.toArray().map(w=>R.map(_=>w[_]===null||w[_]===void 0?"":String(w[_])))]},[]),m=v.useCallback(b=>{var x,R;try{const A=new URL(b),_=A.pathname.split("/").pop()||"",N=_.includes(".")?(x=_.split(".").pop())==null?void 0:x.toLowerCase():"";if(!["http:","https:"].includes(A.protocol))return{isValid:!1,error:"URL must use HTTP or HTTPS protocol"};let I="direct";A.hostname.includes("github.com")||A.hostname.includes("githubusercontent.com")?I="github":A.hostname.includes("amazonaws.com")||A.hostname.includes("s3")?I="aws":(A.hostname.includes("googleapis.com")||A.hostname.includes("gcs"))&&(I="gcs");let D;const M={csv:"csv",tsv:"tsv",json:"json",jsonl:"jsonl",ndjson:"jsonl",parquet:"parquet",xlsx:"excel",xls:"excel",txt:"text",gz:"compressed"};if(N&&M[N]&&(D=M[N],N==="gz")){const L=(R=_.split(".").slice(-2,-1)[0])==null?void 0:R.toLowerCase();L&&M[L]&&(D=M[L])}if(I==="github"&&!A.hostname.includes("raw.githubusercontent.com")&&A.hostname==="github.com"&&A.pathname.includes("/blob/"))return{isValid:!1,error:"Please use GitHub raw URL (raw.githubusercontent.com) instead of blob URL"};let O="";return I==="direct"&&!A.hostname.includes("cors")&&!A.hostname.includes("api")&&(O="Direct URLs may have CORS restrictions"),{isValid:!0,detectedFormat:D,source:I,filename:_,extension:N,error:O||void 0}}catch(A){return{isValid:!1,error:"Invalid URL format"}}},[]),p=v.useCallback((b,x)=>H(null,null,function*(){try{t(!0),l(null),s(0),r("Validating URL...");const R=m(b);if(!R.isValid)throw new Error(R.error||"Invalid URL");const A=R.filename||"unknown_file",w=x||A;s(.1),r("Checking file accessibility...");let _=null;try{const Z=yield fetch(b,{method:"HEAD"});if(Z.ok){const V=Z.headers.get("content-length");if(_=V?parseInt(V):null,_&&ha.isFileTooLarge(_))throw new Error("File is too large (".concat(ha.formatFileSize(_),"). Maximum supported size is 2GB for browser processing."))}}catch(Z){}if(s(.2),_){const Z=ha.getFileSizeCategory(_),V=ha.formatFileSize(_);r(Z==="large"||Z==="huge"?"Downloading large file (".concat(V,")..."):"Downloading file (".concat(V,")..."))}else r("Downloading file...");const N=yield fetch(b);if(!N.ok)throw new Error("Failed to download file: ".concat(N.status," ").concat(N.statusText));s(.4),r("Creating virtual file...");const I=N.headers.get("content-type")||"",D=N.headers.get("content-length"),M=D?parseInt(D):null,O=yield N.blob(),L=new File([O],A,{type:I||"application/octet-stream",lastModified:Date.now()});s(.5),r("Processing file with DuckDB...");const k=ha.validateFile(L.name,L.size),F=ha.formatFileSize(L.size),U=ha.detectSourceType(L.name);k.warnings.length>0;const B=yield c(L);s(.8),r("Fetching schema and sample data...");const j=yield u('PRAGMA table_info("'.concat(B.tableName,'")'));if(!j)throw new Error("Failed to get table schema");const G=yield u('SELECT * FROM "'.concat(B.tableName,'" LIMIT 1000'));if(!G)throw new Error("Failed to get data sample");s(.9),r("Finalizing import...");const K=h(j,G),J=zc(j),$=j.toArray().map(Z=>Z.name),X={data:K,columnTypes:J,fileName:w,rowCount:B.rowCount,columnCount:$.length,sourceType:U,loadedToDuckDB:!0,tableName:B.tableName,isRemote:!0,remoteURL:b,remoteProvider:"custom-url",rawData:O};return s(1),r("Import completed successfully!"),setTimeout(()=>{t(!1),r(""),s(0)},1e3),X}catch(R){const A=R instanceof Error?R.message:"Failed to import from URL";throw l(A),r("Import failed: ".concat(A)),setTimeout(()=>{t(!1)},1e3),R}}),[m,c,u]),g=v.useCallback(b=>H(null,null,function*(){try{const x=m(b);if(!x.isValid)return{accessible:!1,error:x.error};const R=yield fetch(b,{method:"HEAD"});return{accessible:R.ok,status:R.status,contentType:R.headers.get("content-type"),contentLength:R.headers.get("content-length"),error:R.ok?null:"HTTP ".concat(R.status,": ").concat(R.statusText)}}catch(x){return{accessible:!1,error:x instanceof Error?x.message:"Network error"}}}),[m]),T=v.useCallback(()=>{l(null)},[]),y=v.useCallback(()=>{t(!1),r(""),s(0),l(null)},[]);return{isImporting:e,importStatus:n,importProgress:a,error:i,importFromURL:p,validateURL:m,testURL:g,clearError:T,reset:y,isIdle:!e&&!i&&a===0,isComplete:!e&&a===1}}const uge=({dataset:e,onImport:t,isImporting:n})=>{const{t:r}=Ze();return o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"bg-white/5 border border-white/10 rounded-lg p-4 hover:bg-white/8 hover:border-white/20 transition-all duration-200",children:[o.jsxs("div",{className:"mb-3",children:[o.jsxs("div",{className:"flex items-center mb-1",children:[o.jsx("h4",{className:"text-sm font-medium text-white truncate mr-2",children:e.name}),e.featured&&o.jsx("span",{className:"bg-primary/20 text-primary text-xs px-2 py-0.5 rounded",children:r("import.customUrl.dataset.featured",{defaultValue:"Featured"})})]}),o.jsx("p",{className:"text-xs text-white/70 line-clamp-2 leading-relaxed",children:e.description})]}),o.jsx("div",{className:"flex items-center justify-between text-xs text-white/60 mb-3",children:o.jsxs("div",{className:"flex items-center space-x-3",children:[o.jsxs("span",{className:"flex items-center",children:[e.provider==="github"?o.jsx(Efe,{className:"h-3 w-3 mr-1"}):o.jsx(HW,{className:"h-3 w-3 mr-1"}),e.provider]}),o.jsx("span",{className:"bg-white/10 text-white/80 px-1.5 py-0.5 rounded",children:e.format.join(", ")}),o.jsx("span",{className:"text-white/50",children:e.size})]})}),o.jsx(je,{size:"sm",variant:"outline",onClick:()=>t(e),disabled:n,className:"w-full text-xs h-8",children:n?o.jsxs(o.Fragment,{children:[o.jsx(Hn,{className:"h-3 w-3 mr-1 animate-spin"}),r("import.customUrl.dataset.importing",{defaultValue:"Importing"})]}):o.jsxs(o.Fragment,{children:[o.jsx(Hr,{className:"h-3 w-3 mr-1"}),r("import.customUrl.dataset.import",{defaultValue:"Import Dataset"})]})})]})},dge=({onImport:e})=>{var R;const{t}=Ze(),[n,r]=v.useState(""),[a,s]=v.useState(null),{datasets:i,loading:l,fetchDatasets:c}=GL("custom-url"),{importFromURL:u,isImporting:h,importStatus:m,validateURL:p}=cge();v.useEffect(()=>{c()},[c]);const g=A=>{if(s(null),!A.trim())return s(t("import.customUrl.validation.enterUrl",{defaultValue:"Please enter a URL"})),!1;const w=p(A);return w.isValid?!0:(s(w.error||t("import.customUrl.validation.validUrl",{defaultValue:"Please enter a valid URL"})),!1)},T=A=>H(null,null,function*(){if(A.preventDefault(),g(n))try{const w=yield u(n);e(w)}catch(w){}}),y=A=>H(null,null,function*(){try{const w=yield u(A.url);e(w)}catch(w){}}),b=n.trim()?p(n):null,x=b==null?void 0:b.isValid;return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o.jsxs("form",{onSubmit:T,className:"space-y-4 mb-8",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"custom-url",className:"block text-sm font-medium text-white/80 mb-2",children:t("import.customUrl.form.fileUrlLabel",{defaultValue:"File URL (public access)"})}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{id:"custom-url",type:"text",placeholder:t("import.customUrl.form.placeholder",{defaultValue:"https://raw.githubusercontent.com/user/repo/main/data.csv"}),className:Qe("w-full px-3 py-3 h-12 bg-black/30 border border-white/20 rounded-lg text-white/90 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/50 placeholder:text-white/40 transition-all",a&&"border-destructive focus:ring-destructive/50 focus:border-destructive",x&&"border-green-500/50 focus:ring-green-500/50 focus:border-green-500"),value:n,onChange:A=>r(A.target.value),disabled:h}),o.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:h?o.jsx(Hn,{className:"h-4 w-4 text-white/40 animate-spin"}):x?o.jsx("div",{className:"bg-green-500/20 text-green-500 p-1.5 rounded-full",children:o.jsx(Zr,{className:"h-4 w-4"})}):n?o.jsx("div",{className:"bg-red-500/20 text-red-500 p-1.5 rounded-full",children:o.jsx(Cn,{className:"h-4 w-4"})}):null})]}),a&&o.jsxs(me.p,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"mt-2 text-xs text-destructive flex items-center",children:[o.jsx(Cn,{className:"h-3 w-3 mr-1 flex-shrink-0"}),a]}),x&&(b==null?void 0:b.detectedFormat)&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mt-3 overflow-hidden",children:o.jsxs("div",{className:"bg-green-500/10 rounded-lg border border-green-500/20 p-4",children:[o.jsxs("div",{className:"flex items-center text-sm text-white/90 mb-2",children:[o.jsx(Xn,{className:"h-4 w-4 mr-2 text-green-500"}),o.jsx("span",{className:"font-medium",children:t("import.customUrl.validation.fileDetected",{format:(R=b.detectedFormat)==null?void 0:R.toUpperCase(),defaultValue:"{{format}} file detected"})}),b.source&&o.jsx("span",{className:"ml-2 text-xs bg-green-500/20 text-green-500 px-2 py-0.5 rounded",children:b.source})]}),o.jsxs("div",{className:"flex items-center text-xs text-white/70",children:[o.jsx(Zr,{className:"h-3.5 w-3.5 mr-1.5 text-white/50"}),o.jsx("span",{children:t("import.customUrl.validation.readyToImport",{defaultValue:"Valid URL - ready to import"})})]}),o.jsx("div",{className:"mt-2 pt-2 border-t border-green-500/20",children:o.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-green-400 hover:text-green-300 flex items-center",children:[o.jsx(qi,{className:"h-3 w-3 mr-1"}),t("import.customUrl.actions.openFileUrl",{defaultValue:"Open file URL"})]})})]})})]}),o.jsx("div",{className:"flex justify-end",children:o.jsx(je,{variant:"outline",type:"submit",className:Qe("px-6 py-2.5",x?"border-green-700 hover:bg-green-700":void 0),disabled:h||!n.trim()||!x,children:h?o.jsxs(o.Fragment,{children:[o.jsx(Hn,{className:"h-4 w-4 mr-2 animate-spin"}),t("import.customUrl.actions.importing",{defaultValue:"Importing"})]}):o.jsxs(o.Fragment,{children:[t("import.customUrl.actions.importFromUrl",{defaultValue:"Import from URL"}),o.jsx(nr,{className:"h-4 w-4 ml-1"})]})})}),o.jsx(At,{children:h&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-4 overflow-hidden",children:o.jsx("div",{className:"bg-primary/10 border border-primary/20 rounded-lg p-4",children:o.jsx("div",{className:"flex items-center text-sm",children:o.jsx("p",{className:"text-primary font-medium",children:m})})})})})]}),o.jsxs("div",{className:"border-t border-white/10 pt-6",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("h4",{className:"text-base font-medium text-white mb-2 flex items-center",children:t("import.customUrl.examples.title",{defaultValue:"Example Datasets"})}),o.jsx("p",{className:"text-sm text-white/60",children:t("import.customUrl.examples.subtitle",{defaultValue:"Try these curated public datasets from GitHub"})})]}),l?o.jsxs("div",{className:"flex items-center justify-center py-8",children:[o.jsx(Hn,{className:"h-5 w-5 animate-spin text-primary mr-2"}),o.jsx("span",{className:"text-white/60",children:t("import.customUrl.examples.loading",{defaultValue:"Loading datasets..."})})]}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map(A=>o.jsx(uge,{dataset:A,onImport:y,isImporting:h},A.id))})]})]}),o.jsx("div",{className:"border-t border-white/10 p-4 bg-white/5",children:o.jsxs("div",{className:"text-xs text-white/60",children:[o.jsxs("div",{className:"flex items-center mb-2",children:[o.jsx(IL,{className:"h-3 w-3 mr-1.5 text-primary"}),o.jsx("span",{className:"font-medium text-white/80",children:t("import.customUrl.footer.supportedUrls",{defaultValue:"Supported URLs:"})})]}),o.jsxs("ul",{className:"space-y-1 ml-4",children:[o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("import.customUrl.footer.directFiles",{defaultValue:"Direct file URLs (CSV, JSON, Parquet, Excel)"})]}),o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("import.customUrl.footer.publicRepos",{defaultValue:"Public data repositories and APIs"})]})]})]})})]})},hge=({className:e="",compact:t=!1})=>t?o.jsxs("div",{className:"bg-white/5 p-3 rounded border border-white/10 text-xs ".concat(e),children:[o.jsxs("h4",{className:"text-white/90 font-medium flex items-center mb-2",children:[o.jsx(fu,{className:"h-3.5 w-3.5 mr-1.5 text-green-500"}),o.jsx("span",{children:"How to publish your sheet:"})]}),o.jsxs("div",{className:"flex items-center space-x-2 text-white/70 bg-black/20 p-1.5 rounded",children:[o.jsx("span",{className:"bg-green-500/20 text-green-500 px-1.5 h-5 rounded-full flex items-center justify-center text-[10px] font-medium",children:"1"}),o.jsx("span",{className:"flex-1",children:"File → Share → Publish to web"}),o.jsx(nr,{className:"h-3.5 w-3.5 text-white/40"})]}),o.jsx("div",{className:"mt-2",children:o.jsxs("a",{href:"https://support.google.com/docs/answer/183965",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary flex items-center hover:underline",children:[o.jsx(qi,{className:"h-3 w-3 mr-1"}),"Google's guide to publishing"]})})]}):o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.3},className:"bg-gradient-to-b from-white/5 to-white/[0.02] p-4 rounded-lg border border-white/10 ".concat(e),children:[o.jsxs("h3",{className:"text-white font-medium flex items-center text-sm mb-2",children:[o.jsx(fu,{className:"h-4 w-4 mr-2 text-green-500"}),"How to Publish Your Google Sheet"]}),o.jsxs("div",{className:"space-y-3 mt-3",children:[o.jsxs("div",{className:"flex items-start",children:[o.jsx("div",{className:"bg-green-500/20 text-green-500 h-5 w-5 rounded-full flex items-center justify-center mr-3 flex-shrink-0 text-xs font-medium",children:"1"}),o.jsx("div",{className:"bg-black/20 rounded p-2 flex-1 border border-white/5",children:o.jsx("p",{className:"text-white/90 text-sm",children:"Open your Google Sheet in your browser"})})]}),o.jsxs("div",{className:"flex items-start",children:[o.jsx("div",{className:"bg-green-500/20 text-green-500 h-5 w-5 rounded-full flex items-center justify-center mr-3 flex-shrink-0 text-xs font-medium",children:"2"}),o.jsx("div",{className:"bg-black/20 rounded p-2 flex-1 border border-white/5",children:o.jsxs("p",{className:"text-white/90 text-sm flex items-center",children:[o.jsx(Sme,{className:"h-3.5 w-3.5 mr-1.5 text-white/50"}),o.jsxs("span",{children:["Click ",o.jsx("strong",{children:"File"})," → ",o.jsx("strong",{children:"Share"})," → ",o.jsx("strong",{children:"Publish to web"})]})]})})]}),o.jsxs("div",{className:"flex items-start",children:[o.jsx("div",{className:"bg-green-500/20 text-green-500 h-5 w-5 rounded-full flex items-center justify-center mr-3 flex-shrink-0 text-xs font-medium",children:"3"}),o.jsxs("div",{className:"bg-black/20 rounded p-2 flex-1 border border-white/5",children:[o.jsxs("p",{className:"text-white/90 text-sm",children:["Under ",o.jsx("strong",{children:'"Link"'})," tab, select:"]}),o.jsxs("div",{className:"mt-1 pl-2 space-y-1",children:[o.jsxs("p",{className:"text-white/60 text-xs flex items-center",children:[o.jsx("span",{className:"h-1.5 w-1.5 bg-white/40 rounded-full mr-1.5"}),"Entire Document (or specific sheet)"]}),o.jsxs("p",{className:"text-white/60 text-xs flex items-center",children:[o.jsx("span",{className:"h-1.5 w-1.5 bg-white/40 rounded-full mr-1.5"}),"CSV (.csv), or Excel (.xlsx)"]})]})]})]}),o.jsxs("div",{className:"flex items-start",children:[o.jsx("div",{className:"bg-green-500/20 text-green-500 h-5 w-5 rounded-full flex items-center justify-center mr-3 flex-shrink-0 text-xs font-medium",children:"4"}),o.jsxs("div",{className:"bg-black/20 rounded p-2 flex-1 border border-white/5",children:[o.jsxs("p",{className:"text-white/90 text-sm",children:["Click ",o.jsx("strong",{children:'"Publish"'})," and then ",o.jsx("strong",{children:'"Copy link"'})]}),o.jsx("p",{className:"mt-1 text-white/60 text-xs",children:"You can paste this link directly into DataKit"})]})]})]}),o.jsxs("div",{className:"mt-4 bg-amber-500/10 p-3 rounded border border-amber-500/20 flex items-start",children:[o.jsx(Cn,{className:"text-amber-400 h-4 w-4 mr-2 flex-shrink-0 mt-0.5"}),o.jsxs("p",{className:"text-xs text-white/70",children:[o.jsx("span",{className:"text-amber-400 font-medium",children:"Important:"})," Publishing makes your sheet publicly accessible. Do not publish sheets containing sensitive or private data."]})]}),o.jsxs("a",{href:"https://support.google.com/docs/answer/183965",target:"_blank",rel:"noopener noreferrer",className:"mt-3 text-xs text-primary flex items-center hover:underline",children:[o.jsx(qi,{className:"h-3 w-3 mr-1"}),"Google's official guide to publishing"]})]});function zL(e){const t={isGoogleSheet:!1,docId:null,sheetId:null,sheetName:null,format:null,exportUrl:null,originalUrl:e};try{if(!e)return t;const n=new URL(e);if(!n.hostname.includes("docs.google.com")||!n.pathname.includes("/spreadsheets/"))return t;t.isGoogleSheet=!0,t.sheetId=n.searchParams.get("gid")||null,t.sheetName=n.searchParams.get("sheet")||null;let r="";if(e.includes("/d/")){const a=e.match(/\/d\/([a-zA-Z0-9_-]+)/);a&&a[1]&&(r=a[1])}else if(e.includes("/e/")){const a=e.match(/\/e\/([a-zA-Z0-9_-]+)/);a&&a[1]&&(r=a[1])}if(t.docId=r,e.includes("output=csv")?t.format="csv":e.includes("output=xlsx")?t.format="xlsx":e.includes("pubhtml")?t.format="html":t.format="csv",r)if(e.includes("/pub")){const a=e.split("?")[0],s=t.format,i=t.sheetId?"&gid=".concat(t.sheetId):"";t.exportUrl="".concat(a,"?output=").concat(s).concat(i)}else t.exportUrl=fge(r,t.format,t.sheetId);return t}catch(n){return t}}function fge(e,t="csv",n=null){const r="https://docs.google.com/spreadsheets/d/".concat(e,"/export"),a="format=".concat(t),s=n?"&gid=".concat(n):"";return"".concat(r,"?").concat(a).concat(s)}function mge(e){return H(this,null,function*(){if(!e.exportUrl)throw new Error("No export URL available to fetch the Google Sheet");try{const t=yield fetch(e.exportUrl);if(!t.ok)throw new Error("Failed to fetch Google Sheet: ".concat(t.statusText," (").concat(t.status,")"));const n=t.headers.get("content-length"),r=n?parseInt(n,10):0,a=e.format||"csv",s=Date.now(),i="google_sheet_".concat(s,".").concat(a);let l,c;if(a==="csv"){const u=yield t.text();l=new File([u],i,{type:"text/csv"}),c=tr.CSV;const h=pge(u);return{file:l,sheetName:e.sheetName||"Sheet1",size:r,rows:h,dataSourceType:c}}else if(a==="xlsx"){const u=yield t.blob();return l=new File([u],i,{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),c=tr.XLSX,{file:l,sheetName:e.sheetName||"Sheet1",size:r,rows:-1,dataSourceType:c}}else throw new Error("Unsupported format: ".concat(a))}catch(t){throw t}})}function pge(e){return e.split("\n").length-1}function gge(e){return H(this,null,function*(){try{const t=zL(e);if(!t.isGoogleSheet||!t.exportUrl)return{accessible:!1,error:"Not a valid Google Sheets URL"};const n=yield fetch(t.exportUrl,{method:"HEAD"});if(!n.ok)return{accessible:!1,error:"Server returned status ".concat(n.status,": ").concat(n.statusText)};const r=n.headers.get("content-length"),a=r?parseInt(r,10):void 0;return{accessible:!0,format:t.format||"csv",contentLength:a}}catch(t){return{accessible:!1,error:t instanceof Error?t.message:"Unknown error checking Google Sheet"}}})}function Ege(e){if(e.sheetName)return e.sheetName;try{const n=new URL(e.originalUrl).pathname;if(n.includes("/pub")){const r=n.match(/\/d\/([^\/]+)/);if(r&&r[1])return"Google Sheet: ".concat(r[1])}return"Google Sheet"}catch(t){return"Google Sheet"}}function Tge(){const[e,t]=v.useState(!1),[n,r]=v.useState(""),[a,s]=v.useState(0),[i,l]=v.useState(null),{importFileDirectly:c,executeQuery:u,processingProgress:h}=Dt();return{importFromGoogleSheets:v.useCallback(p=>H(null,null,function*(){try{t(!0),l(null),r("Analyzing Google Sheets URL..."),s(.05);const g=zL(p);if(!g.isGoogleSheet)throw new Error("The URL provided is not a valid Google Sheets URL");if(!g.exportUrl)throw new Error("Could not generate a valid export URL for this Google Sheet");r("Checking Google Sheet accessibility..."),s(.1);const T=yield gge(p);if(!T.accessible)throw new Error("Google Sheet is not accessible: ".concat(T.error||"Unknown error"));T.contentLength&&T.contentLength>5*1024*1024&&r("⚠️ This is a large Google Sheet and may take longer to import..."),r("Fetching Google Sheet data (".concat(g.format||"csv"," format)...")),s(.2);const{file:y,sheetName:b,size:x,rows:R,dataSourceType:A}=yield mge(g);R>0?r("Processing Google Sheet with approximately ".concat(R.toLocaleString()," rows...")):r("Processing Google Sheet data..."),s(.3);const w=setInterval(()=>{const _=.3+h*.6;s(_)},100);try{r("Importing data to DuckDB...");const _=yield c(y);r("Getting table schema..."),s(.92);const N=yield u('PRAGMA table_info("'.concat(_.tableName,'")'));if(!N)throw new Error("Failed to get table schema");r("Loading data preview..."),s(.95);const I=yield u('SELECT * FROM "'.concat(_.tableName,'" LIMIT 1000'));if(!I)throw new Error("Failed to get data sample");const D=N.toArray().map(F=>F.name),M=[D,...I.toArray().map(F=>D.map(U=>F[U]===null||F[U]===void 0?"":String(F[U])))],O=N.toArray().map(F=>{const U=F.type.toLowerCase();return U.includes("int")||U.includes("float")||U.includes("double")||U.includes("decimal")||U.includes("number")?Nt.Number:U.includes("bool")?Nt.Boolean:U.includes("date")||U.includes("time")||U.includes("timestamp")?Nt.Date:U.includes("json")||U.includes("object")||U.includes("map")?Nt.Object:U.includes("array")||U.includes("list")?Nt.Array:Nt.Text}),L=Ege(g),k={data:M,columnTypes:O,fileName:"Google Sheet: ".concat(L),rowCount:_.rowCount,columnCount:D.length,sourceType:A,loadedToDuckDB:!0,tableName:_.tableName,isRemote:!0,remoteURL:p,remoteProvider:"google_sheets",googleSheets:{sheetName:g.sheetName||"Sheet1",docId:g.docId,sheetId:g.sheetId,format:g.format,importedAt:Date.now()}};return r("Import complete!"),s(1),k}finally{clearInterval(w)}}catch(g){const T=g instanceof Error?g.message:String(g);throw l(T),r("Import failed"),g}finally{t(!1)}}),[c,u,h]),isImporting:e,importStatus:n,importProgress:a,error:i,setError:l}}const yge=({onImport:e})=>{const{t}=Ze(),[n,r]=v.useState(""),[a,s]=v.useState(null),[i,l]=v.useState(!1),[c,u]=v.useState(null),{importFromGoogleSheets:h,isImporting:m,importStatus:p,importProgress:g,error:T}=Tge();v.useEffect(()=>{if(!n.trim()){l(!1),u(null),s(null);return}try{const x=zL(n);l(x.isGoogleSheet),u(x),s(null)}catch(x){l(!1),u(null)}},[n]);const y=x=>{if(s(null),!x.trim())return s(t("importModal.googleSheets.validation.urlRequired")),!1;try{return new URL(x),i?!0:(s(t("importModal.googleSheets.validation.invalidPublishedUrl")),!1)}catch(R){return s(t("importModal.googleSheets.validation.invalidUrl")),!1}},b=x=>H(null,null,function*(){if(x.preventDefault(),y(n))try{const R=yield h(n),A=he(q({},R),{isRemote:!0,remoteProvider:"google-sheets",remoteURL:n,googleSheets:{url:n,sheetName:c==null?void 0:c.sheetName,format:c==null?void 0:c.format}});e(A)}catch(R){}});return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o.jsxs("form",{onSubmit:b,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{htmlFor:"google-sheets-url",className:"block text-sm font-medium text-white/80 mb-2",children:t("importModal.googleSheets.urlLabel")}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{id:"google-sheets-url",type:"text",placeholder:t("importModal.googleSheets.urlPlaceholder"),className:Qe("w-full px-3 py-3 h-12 bg-black/30 border border-white/20 rounded-lg text-white/90 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/50 placeholder:text-white/40 transition-all",a&&"border-destructive focus:ring-destructive/50 focus:border-destructive",i&&"border-green-500/50 focus:ring-green-500/50 focus:border-green-500"),value:n,onChange:x=>r(x.target.value),disabled:m}),o.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:m?o.jsx(Hn,{className:"h-4 w-4 text-white/40 animate-spin"}):i?o.jsx("div",{className:"bg-green-500/20 text-green-500 p-1.5 rounded-full",children:o.jsx(Pr,{className:"h-4 w-4"})}):n?o.jsx("div",{className:"bg-red-500/20 text-red-500 p-1.5 rounded-full",children:o.jsx(Cn,{className:"h-4 w-4"})}):null})]}),a&&o.jsxs(me.p,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"mt-2 text-xs text-destructive flex items-center",children:[o.jsx(Cn,{className:"h-3 w-3 mr-1 flex-shrink-0"}),a]}),i&&c&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mt-3 overflow-hidden",children:o.jsxs("div",{className:"bg-green-500/10 rounded-lg border border-green-500/20 p-4",children:[o.jsxs("div",{className:"flex items-center text-sm text-white/90 mb-2",children:[o.jsx(CL,{className:"h-4 w-4 mr-2 text-green-500"}),o.jsx("span",{className:"font-medium",children:c.sheetName||"Google Sheet"}),c.format&&o.jsx("span",{className:"ml-2 text-xs bg-green-500/20 text-green-500 px-2 py-0.5 rounded",children:c.format.toUpperCase()})]}),o.jsxs("div",{className:"flex items-center text-xs text-white/70",children:[o.jsx(Bl,{className:"h-3.5 w-3.5 mr-1.5 text-white/50"}),o.jsx("span",{children:t("importModal.googleSheets.status.readyToImport")})]}),o.jsx("div",{className:"mt-2 pt-2 border-t border-green-500/20",children:o.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-green-400 hover:text-green-300 flex items-center",children:[o.jsx(qi,{className:"h-3 w-3 mr-1"}),t("importModal.googleSheets.actions.openInSheets")]})})]})})]}),o.jsx("div",{className:"flex justify-end",children:o.jsx(je,{type:"submit",variant:"outline",className:Qe("px-6 py-2.5",i?"border-green-700 hover:border-green-700":void 0),disabled:m||!n.trim()||!i,children:m?o.jsxs(o.Fragment,{children:[o.jsx(Hn,{className:"h-4 w-4 mr-2 animate-spin"}),t("importModal.googleSheets.actions.importing")]}):o.jsxs(o.Fragment,{children:[t("importModal.googleSheets.actions.importSheet"),o.jsx(nr,{className:"h-4 w-4 ml-1"})]})})}),o.jsx(At,{children:m&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-4 overflow-hidden",children:o.jsxs("div",{className:"bg-green-500/10 border border-green-500/20 rounded-lg p-4",children:[o.jsx("div",{className:"flex items-center text-sm",children:o.jsx("p",{className:"text-green-400 font-medium",children:p})}),o.jsx("div",{className:"w-full bg-black/30 h-2 mt-3 rounded-full overflow-hidden",children:o.jsx(me.div,{className:"bg-green-500 h-full rounded-full",initial:{width:"5%"},animate:{width:"".concat(Math.max(5,g*100),"%")},transition:{duration:.3}})})]})})})]}),o.jsx("div",{className:"mt-6",children:o.jsx(hge,{compact:!1})}),o.jsx(At,{children:T&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-4 overflow-hidden",children:o.jsx("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4",children:o.jsxs("div",{className:"flex items-start",children:[o.jsx(Cn,{className:"h-4 w-4 mr-2 flex-shrink-0 mt-0.5 text-destructive"}),o.jsx("p",{className:"text-destructive text-sm",children:T})]})})})})]}),o.jsx("div",{className:"border-t border-white/10 p-4 bg-white/5",children:o.jsxs("div",{className:"text-xs text-white/60",children:[o.jsxs("div",{className:"flex items-center mb-2",children:[o.jsx(fu,{className:"h-3 w-3 mr-1.5 text-green-500"}),o.jsxs("span",{className:"font-medium text-white/80",children:[t("importModal.googleSheets.requirements.title"),":"]})]}),o.jsxs("ul",{className:"space-y-1 ml-4",children:[o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("importModal.googleSheets.requirements.published")]}),o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("importModal.googleSheets.requirements.formats")]}),o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("importModal.googleSheets.requirements.noAuth")]})]})]})})]})},xge={GC_TRIGGER:.85};function l3(){if("memory"in performance){const e=performance.memory,t=e.usedJSHeapSize/1024/1024,n=e.jsHeapSizeLimit/1024/1024,r=t/n;return r>xge.GC_TRIGGER&&Sge(),{usedMB:t,ratio:r}}return null}function Sge(){try{"gc"in window&&window.gc()}catch(e){}}const c3=["https://api.allorigins.win/raw?url=","https://corsproxy.io/?"],bge={CORS_TEST:5e3};function vge(n){return H(this,arguments,function*(e,t=bge.CORS_TEST){try{return(yield fetch(e,{method:"HEAD",mode:"cors",signal:AbortSignal.timeout(t)})).ok}catch(r){return!1}})}function Age(e,t){return H(this,null,function*(){var p;const n=yield fetch(e,{method:"HEAD",mode:"cors"}).catch(()=>null),r=n==null?void 0:n.headers.get("content-length"),a=r?parseInt(r,10):0;if(a>0){const g=l3();g&&a>g.usedMB*1024*1024*2}const s=yield fetch(e,{mode:"cors"});if(!s.ok)switch(s.status){case 403:throw new Error("Access denied. This dataset may require authentication or may be private.");case 404:throw new Error("File not found.");default:throw new Error("HTTP ".concat(s.status,": ").concat(s.statusText))}const i=(p=s.body)==null?void 0:p.getReader();if(!i){const g=yield s.blob();return{blob:g,fileSize:g.size}}const l=[];let c=0;for(;;){const{done:g,value:T}=yield i.read();if(g)break;l.push(T),c+=T.length;const y=l3();y&&y.ratio>.9&&(yield new Promise(b=>setTimeout(b,10)))}const u=new Uint8Array(c);let h=0;for(const g of l)u.set(g,h),h+=g.length;return{blob:new Blob([u]),fileSize:c}})}function o7(e,t,n){return H(this,null,function*(){if(yield vge(e)){const a=yield Age(e);return he(q({},a),{method:"direct"})}for(let a=0;a<c3.length;a++){const s=c3[a]+encodeURIComponent(e);try{const i=yield fetch(s,{mode:"cors"});if(i.ok){const l=yield i.blob(),c=l.size;return{blob:l,method:"proxy",fileSize:c}}}catch(i){}}throw new Error("Cannot access file due to CORS restrictions. File may require authentication or may not be publicly accessible.")})}function Rge(e){switch(e){case"csv":return tr.CSV;case"json":return tr.JSON;case"parquet":default:return tr.PARQUET}}function qL(e){const t=e.toLowerCase();return t.includes("int")||t.includes("float")||t.includes("double")?Nt.Number:t.includes("bool")?Nt.Boolean:t.includes("date")||t.includes("time")?Nt.Date:t.includes("json")||t.includes("object")?Nt.Object:t.includes("array")||t.includes("list")?Nt.Array:Nt.Text}function Nge(e,t,n,r){return H(this,null,function*(){const[,a]=t.split("/"),s=r.split||"train",i=r.config||"default";let c=a.replace(/[^a-zA-Z0-9_-]/g,"_");i!=="default"&&(c+="_".concat(i)),s!=="train"&&(c+="_".concat(s));const u='"'.concat(c,'"'),h="SELECT COUNT(*) as count FROM '".concat(n,"' LIMIT 1");try{if(!(yield e.executeQuery(h)))throw new Error("Failed to test parquet file access")}catch(A){throw new Error("Direct streaming not supported for this dataset")}yield e.executeQuery("DROP VIEW IF EXISTS ".concat(u)),yield e.executeQuery("DROP TABLE IF EXISTS ".concat(u));const m="CREATE VIEW ".concat(u," AS SELECT * FROM '").concat(n,"'");yield e.executeQuery(m);const p=yield e.executeQuery("PRAGMA table_info(".concat(u,")"));if(!p)throw new Error("Failed to get table schema");const g=yield e.executeQuery("SELECT * FROM ".concat(u," LIMIT 100"));if(!g)throw new Error("Failed to get data sample");const T=p.toArray().map(A=>A.name),y=[T,...g.toArray().map(A=>T.map(w=>{const _=A[w];return _!=null?String(_):""}))],b=p.toArray().map(A=>qL(A.type));let x=0;try{const A="SELECT COUNT(*) as count FROM ".concat(u),w=e.executeQuery(A),_=new Promise((I,D)=>setTimeout(()=>D(new Error("Count timeout")),3e4)),N=yield Promise.race([w,_]);N&&(x=N.toArray()[0].count)}catch(A){}return yield e.registerTableManually(c,u,{isLoading:!1,processingProgress:1}),yield e.refreshSchemaCache(),{data:y,columnTypes:b,fileName:"".concat(c,".parquet"),rowCount:x,columnCount:T.length,sourceType:tr.PARQUET,loadedToDuckDB:!0,tableName:c,huggingface:{datasetId:t,config:i,split:s,parquetUrl:n,method:"streaming",metadata:r.datasetInfo,availableFormats:r.formats}}})}function u3(a,s,i){return H(this,arguments,function*(e,t,n,r={}){const{blob:l,method:c,fileSize:u}=yield o7(t.url,"dataset.".concat(t.type)),h=new File([l],"".concat(n.replace("/","_"),".").concat(t.type),{type:t.type==="csv"?"text/csv":t.type==="json"?"application/json":"application/octet-stream"}),m=yield e.importFileDirectly(h),p=yield e.executeQuery('PRAGMA table_info("'.concat(m.tableName,'")'));if(!p)throw new Error("Failed to get table schema");const g=yield e.executeQuery('SELECT * FROM "'.concat(m.tableName,'" LIMIT 1000'));if(!g)throw new Error("Failed to get data sample");const T=p.toArray().map(R=>R.name),y=[T,...g.toArray().map(R=>T.map(A=>{const w=R[A];return w!=null?String(w):""}))],b=p.toArray().map(R=>qL(R.type)),x=Rge(t.type);return{data:y,columnTypes:b,fileName:"".concat(n.replace("/","_"),".").concat(t.type),rowCount:m.rowCount,columnCount:T.length,sourceType:x,loadedToDuckDB:!0,tableName:m.tableName,huggingface:{datasetId:n,config:t.config,split:t.split,parquetUrl:t.url,fileSize:u,method:c}}})}function _ge(r,a){return H(this,arguments,function*(e,t,n={}){const s=yield VL(t,n.authToken),i=n.config||"default",l=yield sge(t,i,n.authToken);if(!l.parquet_files||l.parquet_files.length===0)throw new Error("No parquet files available for this dataset configuration.");let c=l.parquet_files;if(n.split&&(c=l.parquet_files.filter(M=>M.split===n.split),c.length===0))throw new Error("No parquet files found for split: ".concat(n.split));const u=c[0],h=u.url,m=u.split||"train",[,p]=t.split("/"),{blob:g,method:T,fileSize:y}=yield o7(h);let x=p.replace(/[^a-zA-Z0-9_-]/g,"_");i&&i!=="default"&&(x+="_".concat(i)),m!=="train"&&(x+="_".concat(m)),x+=".parquet";const R=new File([g],x,{type:"application/octet-stream"}),A=yield e.importFileDirectly(R),w=yield e.executeQuery('PRAGMA table_info("'.concat(A.tableName,'")'));if(!w)throw new Error("Failed to get table schema");const _=yield e.executeQuery('SELECT * FROM "'.concat(A.tableName,'" LIMIT 1000'));if(!_)throw new Error("Failed to get data sample");const N=w.toArray().map(M=>M.name),I=[N,..._.toArray().map(M=>N.map(O=>{const L=M[O];return L!=null?String(L):""}))],D=w.toArray().map(M=>qL(M.type));return{data:I,columnTypes:D,fileName:x,rowCount:A.rowCount,columnCount:N.length,sourceType:tr.PARQUET,loadedToDuckDB:!0,tableName:A.tableName,huggingface:{datasetId:t,config:i,split:m,parquetUrl:h,fileSize:y,method:T,metadata:s}}})}function wge(r,a){return H(this,arguments,function*(e,t,n={}){const{formats:s}=yield HL(t,n.authToken),i=yield VL(t,n.authToken),l=[];let c=s;(n.config||n.split)&&(c=s.filter(p=>{const g=!n.config||p.config===n.config,T=!n.split||p.split===n.split;return g&&T}));const u=c.find(p=>p.type==="parquet");u&&l.push({name:"Direct Streaming",description:"Direct streaming from parquet",execute:()=>Nge(e,t,u.url,he(q({},n),{config:u.config,split:u.split,datasetInfo:i,formats:s})),requiresAuth:!1,supportedFormats:["parquet"]}),u&&l.push({name:"Parquet Download",description:"Download and import parquet",execute:()=>_ge(e,t,n),requiresAuth:!1,supportedFormats:["parquet"]});const h=c.find(p=>p.type==="csv");h&&l.push({name:"CSV Alternative Format",description:"Download and import CSV",execute:()=>u3(e,h,t,n),requiresAuth:!1,supportedFormats:["csv"]});const m=c.find(p=>p.type==="json");if(m&&l.push({name:"JSON Alternative Format",description:"Download and import JSON",execute:()=>u3(e,m,t,n),requiresAuth:!1,supportedFormats:["json"]}),l.length===0){const p=n.config?" (config: ".concat(n.config,")"):"",g=n.split?" (split: ".concat(n.split,")"):"";throw new Error("No suitable import strategies available for ".concat(t).concat(p).concat(g))}return l})}function Cge(e,t,n){return H(this,null,function*(){let r=null;for(let a=0;a<e.length;a++){const s=e[a];try{return t==null||t(s.name),yield s.execute()}catch(i){if(r=i,n==null||n(s.name,r),i instanceof Error&&(i.message.includes("Authentication")||i.message.includes("Access denied")))throw i;a<e.length-1&&(yield new Promise(l=>setTimeout(l,500)))}}throw r||new Error("All import strategies failed")})}function Ige(e,t){return H(this,null,function*(){try{yield VL(e,t);const{formats:n,recommendedFormat:r}=yield HL(e,t);if(n.length===0)return{isCompatible:!1,supportedFormats:[],recommendedStrategy:"none",reason:"No supported file formats found in dataset"};let a="Alternative Format";n.find(i=>i.type==="parquet")&&(a="Direct Streaming");const s=n.reduce((i,l)=>i+(l.size||0),0);return{isCompatible:!0,supportedFormats:n.map(i=>i.type),recommendedStrategy:a,estimatedSize:s}}catch(n){return{isCompatible:!1,supportedFormats:[],recommendedStrategy:"none",reason:n instanceof Error?n.message:"Unknown error"}}})}function l7(){const[e,t]=v.useState(!1),[n,r]=v.useState(0),[a,s]=v.useState(""),[i,l]=v.useState(null),c=Dt(),u=v.useCallback((x,R)=>{r(x),s(R)},[]),h=v.useCallback(()=>l(null),[]),m=v.useCallback(x=>wh(x),[]),p=v.useCallback((x,R)=>H(null,null,function*(){return ige(x,R)}),[]),g=v.useCallback((A,...w)=>H(null,[A,...w],function*(x,R={}){return i7(x,R)}),[]),T=v.useCallback((x,R)=>H(null,null,function*(){return BL(x,R)}),[]),y=v.useCallback((x,R)=>H(null,null,function*(){return HL(x,R)}),[]),b=v.useCallback((A,...w)=>H(null,[A,...w],function*(x,R={}){try{t(!0),l(null),u(0,"Validating dataset ID...");const _=wh(x);if(!_.isValid)throw new Error(_.error||"Invalid dataset ID");const N=_.organization?"".concat(_.organization,"/").concat(_.dataset):_.dataset,I=R.config||_.config,D=R.split||_.split;u(.1,"Analyzing dataset compatibility...");const M=yield Ige(N,R.authToken);if(!M.isCompatible)throw new Error(M.reason||"Dataset not compatible");u(.2,"Creating import strategies...");const O=he(q({},R),{config:I,split:D}),L=yield wge(c,N,O);u(.3,"Executing import strategies...");const k=yield Cge(L,U=>{u(.4,"Trying ".concat(U,"..."))},(U,B)=>{u(.5,"".concat(U," failed, trying next method..."))}),F=he(q({},k),{huggingface:he(q({},k.huggingface),{config:I||k.huggingface.config||"default",split:D||k.huggingface.split||"train"})});return u(1,"Successfully imported via ".concat(k.huggingface.method," method")),F}catch(_){const N=_ instanceof Error?_.message:"Unknown error";throw l(N),_}finally{t(!1),setTimeout(()=>{r(0),s("")},2e3)}}),[c,u]);return{isImporting:e,importProgress:n,importStatus:a,error:i,importWithProgressiveFallback:b,validateDatasetId:m,testDatasetAccess:p,searchDatasets:g,getDatasetSplits:T,detectAvailableFormats:y,resetError:h}}const Oge=({configs:e,splits:t,selectedConfig:n,selectedSplit:r,onConfigChange:a,onSplitChange:s,disabled:i=!1,loading:l=!1})=>{var h,m,p,g,T;const{t:c}=Ze(),u=n?t.filter(y=>y.config===n):t;return l?o.jsx("div",{className:"flex items-center space-x-2 p-3 bg-white/5 rounded-lg border border-white/10",children:o.jsx("span",{className:"text-sm text-white/60",children:c("importModal.huggingface.loading.configurations")})}):e.length===0&&t.length===0?null:o.jsxs(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"space-y-3 p-4 bg-white/5 rounded-lg border border-white/10",children:[o.jsxs("div",{className:"flex items-center text-sm text-white/80 mb-2",children:[o.jsx(qs,{className:"h-4 w-4 mr-2"}),o.jsx("span",{className:"font-medium",children:c("importModal.huggingface.config.title")})]}),e.length>1&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-white/60 mb-1",children:c("importModal.huggingface.config.configuration")}),o.jsx("select",{value:n||((h=e[0])==null?void 0:h.config_name)||"",onChange:y=>a(y.target.value),disabled:i,className:"w-full px-3 py-2 bg-black/30 border border-white/20 rounded text-white/90 text-sm focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50",children:e.map(y=>o.jsxs("option",{value:y.config_name,children:[y.config_name,y.description&&" - ".concat(y.description)]},y.config_name))}),n&&o.jsx("div",{className:"mt-2 p-2 bg-black/20 rounded text-xs text-white/70",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{children:[c("importModal.huggingface.config.availableSplits"),":"]}),o.jsx("span",{className:"text-primary",children:(m=e.find(y=>y.config_name===n))==null?void 0:m.splits.join(", ")})]})})]}),u.length>1&&o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-white/60 mb-1",children:c("importModal.huggingface.config.split")}),o.jsx("select",{value:r||((p=u[0])==null?void 0:p.split)||"",onChange:y=>s(y.target.value),disabled:i,className:"w-full px-3 py-2 bg-black/30 border border-white/20 rounded text-white/90 text-sm focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50",children:u.map(y=>o.jsxs("option",{value:y.split,children:[y.split,y.num_examples&&" (".concat(y.num_examples.toLocaleString()," examples)")]},"".concat(y.config,"-").concat(y.split)))})]}),o.jsxs("div",{className:"flex items-center text-xs text-white/60 pt-1",children:[o.jsx(jo,{className:"h-3 w-3 mr-1"}),o.jsxs("span",{children:[c("importModal.huggingface.config.willImport"),": ",o.jsxs("span",{className:"text-white/80 font-medium",children:[n||((g=e[0])==null?void 0:g.config_name)||"default","/",r||((T=u[0])==null?void 0:T.split)||"train"]})]})]})]})},Lge=({value:e,onChange:t,onConfigDetected:n,onSplitDetected:r,disabled:a,isValid:s,error:i})=>{const{t:l}=Ze();return v.useEffect(()=>{if(e.trim()){let c=e.trim(),u,h;const m=c.lastIndexOf("/");if(m>-1){const g=c.substring(m+1),T=c.substring(0,m);(["train","test","validation","val","dev","eval"].includes(g.toLowerCase())||g.match(/^(train|test|val|validation|dev|eval)[\d_-]*$/i))&&(h=g,c=T)}const p=c.indexOf(":");p>-1&&(u=c.substring(p+1)),n(u),r(h)}else n(void 0),r(void 0)},[e,n,r]),o.jsxs("div",{children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("label",{htmlFor:"dataset-id",className:"block text-sm font-medium text-white/80",children:l("importModal.huggingface.datasetId.label")})}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{id:"dataset-id",type:"text",placeholder:l("importModal.huggingface.datasetId.placeholder"),className:Qe("w-full px-3 py-3 h-12 bg-black/30 border border-white/20 rounded-lg text-white/90 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/50 placeholder:text-white/40 transition-all",i&&"border-destructive focus:ring-destructive/50 focus:border-destructive",s&&"border-green-500/50 focus:ring-green-500/50 focus:border-green-500"),value:e,onChange:c=>t(c.target.value),disabled:a}),o.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:a?o.jsx(Hn,{className:"h-4 w-4 text-white/40 animate-spin"}):s?o.jsx("div",{className:"bg-green-500/20 text-green-500 p-1.5 rounded-full",children:o.jsx(Zr,{className:"h-4 w-4"})}):e?o.jsx("div",{className:"bg-red-500/20 text-red-500 p-1.5 rounded-full",children:o.jsx(Cn,{className:"h-4 w-4"})}):null})]}),i&&o.jsxs(me.p,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"mt-2 text-xs text-destructive flex items-center",children:[o.jsx(Cn,{className:"h-3 w-3 mr-1 flex-shrink-0"}),i]})]})},d3=({dataset:e,onImport:t,isImporting:n})=>{var a;const{t:r}=Ze();return o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"bg-white/5 border border-white/10 rounded-lg p-4 hover:bg-white/8 hover:border-white/20 transition-all duration-200",children:[o.jsxs("div",{className:"mb-3",children:[o.jsxs("div",{className:"flex items-center mb-1",children:[o.jsx("h4",{className:"text-sm font-medium text-white truncate mr-2",children:e.name}),e.featured&&o.jsx("span",{className:"bg-primary/20 text-primary text-xs px-2 py-0.5 rounded",children:r("importModal.huggingface.dataset.featured")}),e.gated&&o.jsx(_h,{className:"h-3 w-3 text-yellow-500 ml-1"})]}),o.jsx("p",{className:"text-xs text-white/70 line-clamp-2 leading-relaxed",children:e.description})]}),o.jsx("div",{className:"flex items-center justify-between text-xs text-white/60 mb-3",children:o.jsx("div",{className:"flex items-center space-x-3",children:o.jsxs("span",{className:"flex items-center",children:[o.jsx(kL,{className:"h-3 w-3 mr-1"}),((a=e.downloads)==null?void 0:a.toLocaleString())||"N/A"]})})}),o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{className:"flex items-center text-xs text-white/60",children:[o.jsx(Fl,{className:"h-3 w-3 mr-1"}),o.jsxs("span",{children:[r("importModal.huggingface.dataset.updated")," ",e.lastModified||r("importModal.huggingface.dataset.recently")]})]}),e.likes&&o.jsx("div",{className:"flex items-center text-xs text-white/60",children:o.jsxs("span",{children:["❤️ ",e.likes]})})]}),o.jsx(je,{size:"sm",variant:"outline",onClick:()=>t(e),disabled:n,className:"w-full text-xs h-8",children:n?o.jsxs(o.Fragment,{children:[o.jsx(Hn,{className:"h-3 w-3 mr-1 animate-spin"}),r("importModal.huggingface.dataset.importing")]}):o.jsxs(o.Fragment,{children:[o.jsx(Hr,{className:"h-3 w-3 mr-1"}),r("importModal.huggingface.dataset.import")]})})]})},Mge=({strategy:e,status:t})=>{const{t:n}=Ze(),a={"Direct Streaming":{icon:o.jsx(mO,{className:"h-3 w-3"}),color:"text-blue-400",description:n("importModal.huggingface.strategy.directStreaming")},"Parquet Download":{icon:o.jsx(Hr,{className:"h-3 w-3"}),color:"text-green-400",description:n("importModal.huggingface.strategy.parquetDownload")},"Alternative Format":{icon:o.jsx(ma,{className:"h-3 w-3"}),color:"text-yellow-400",description:n("importModal.huggingface.strategy.alternativeFormat")}}[e];return a?o.jsxs("div",{className:"flex items-center text-xs text-white/70 mb-1",children:[o.jsx("div",{className:Qe("mr-2",a.color),children:a.icon}),o.jsx("span",{className:"font-medium",children:e}),o.jsx("span",{className:"mx-2",children:"•"}),o.jsx("span",{className:"text-white/50",children:a.description})]}):null},Dge=({onImport:e})=>{const{t}=Ze(),[n,r]=v.useState(""),[a,s]=v.useState(""),[i,l]=v.useState(""),[c,u]=v.useState(!1),[h,m]=v.useState(null),[p,g]=v.useState(""),[T,y]=v.useState([]),[b,x]=v.useState([]),[R,A]=v.useState(""),[w,_]=v.useState(""),[N,I]=v.useState(!1),[D,M]=v.useState(),[O,L]=v.useState(),{datasets:k,loading:F,fetchDatasets:U,searchDatasets:B,isSearching:j,searchResults:G}=GL("huggingface"),{importWithProgressiveFallback:K,getDatasetSplits:J,isImporting:$,importStatus:X,importProgress:Z,validateDatasetId:V,error:te,resetError:ae}=l7();v.useEffect(()=>{U()},[U]),v.useEffect(()=>{te&&ae()},[n,ae,te]),v.useEffect(()=>{X&&(X.includes("Direct Streaming")?g("Direct Streaming"):X.includes("Parquet Download")?g("Parquet Download"):X.includes("Alternative Format")&&g("Alternative Format"))},[X]),v.useEffect(()=>{const xe=setTimeout(()=>H(null,null,function*(){const le=V(n);if(!le.isValid||!n.trim()){y([]),x([]),A(""),_("");return}try{I(!0);const pe=le.organization?"".concat(le.organization,"/").concat(le.dataset):le.dataset,{splits:_e,configs:re}=yield J(pe,i||void 0);if(y(re),x(_e),re.length>0){const Se=D||le.config||re[0].config_name;A(Se);const $e=_e.filter(qe=>qe.config===Se);if($e.length>0){const qe=O||le.split||$e[0].split;_(qe)}}else if(_e.length>0){const Se=O||le.split||_e[0].split;_(Se)}}catch(pe){y([]),x([])}finally{I(!1)}}),500);return()=>clearTimeout(xe)},[n,i,J,V,D,O]);const ne=z=>{if(m(null),!z.trim())return m(t("importModal.huggingface.validation.datasetIdRequired")),!1;const xe=V(z);return xe.isValid?!0:(m(xe.error||t("importModal.huggingface.validation.invalidDatasetId")),!1)},ce=z=>H(null,null,function*(){if(z.preventDefault(),ne(n))try{const le=yield K(n,{authToken:i||void 0,config:R||void 0,split:w||void 0}),pe=he(q({},le),{isRemote:!0,remoteProvider:"huggingface",remoteURL:"https://huggingface.co/datasets/".concat(n)});e(pe)}catch(xe){}}),ie=z=>H(null,null,function*(){try{const xe={authToken:i||void 0,config:R||void 0,split:w||void 0},le=yield K(z.id,xe),pe=he(q({},le),{isRemote:!0,remoteProvider:"huggingface",remoteURL:"https://huggingface.co/datasets/".concat(z.id),dataset:{id:z.id,name:z.name,description:z.description,task:z.task,downloads:z.downloads,likes:z.likes}});e(pe)}catch(xe){}}),W=z=>H(null,null,function*(){z.preventDefault(),a.trim()&&(yield B(a.trim(),{limit:20}))}),Q=n.trim()?V(n):null,se=Q==null?void 0:Q.isValid;return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o.jsxs("form",{onSubmit:ce,className:"space-y-4 mb-8",children:[o.jsx(Lge,{value:n,onChange:r,onConfigDetected:M,onSplitDetected:L,disabled:$,isValid:se,error:h}),te&&o.jsx(me.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"mt-2 p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:o.jsxs("div",{className:"flex items-start",children:[o.jsx(Ma,{className:"h-4 w-4 text-red-400 mr-2 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"text-sm text-red-400",children:[o.jsx("p",{className:"font-medium",children:t("importModal.huggingface.error.importFailed")}),o.jsx("p",{className:"text-xs text-red-400/80 mt-1",children:te})]})]})}),se&&(Q==null?void 0:Q.organization)&&o.jsxs(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},className:"mt-3 overflow-hidden space-y-4",children:[o.jsxs("div",{className:"bg-green-500/10 rounded-lg border border-green-500/20 p-4",children:[o.jsxs("div",{className:"flex items-center text-sm text-white/90 mb-2",children:[o.jsx(Xs,{className:"h-4 w-4 mr-2 text-green-500"}),o.jsxs("span",{className:"font-medium font-mono",children:[Q.organization,"/",Q.dataset]}),o.jsxs("a",{href:"https://huggingface.co/datasets/".concat(n),target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-xs bg-green-500/20 text-green-500 px-2 py-0.5 rounded flex items-center hover:bg-green-500/30",children:[o.jsx(Jr,{className:"h-3 w-3 mr-1"}),t("importModal.huggingface.actions.view")]})]}),o.jsxs("div",{className:"flex items-center text-xs text-white/70",children:[o.jsx(Zr,{className:"h-3.5 w-3.5 mr-1.5 text-white/50"}),o.jsx("span",{children:t("importModal.huggingface.status.validDatasetId")})]})]}),o.jsx(Oge,{configs:T,splits:b,selectedConfig:R,selectedSplit:w,onConfigChange:A,onSplitChange:_,disabled:$,loading:N})]}),o.jsxs("div",{className:"border border-white/10 rounded-lg p-4 bg-white/5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx(Mfe,{className:"h-4 w-4 mr-2 text-yellow-500"}),o.jsx("span",{className:"text-sm font-medium text-white",children:t("importModal.huggingface.auth.title")})]}),o.jsx("button",{type:"button",onClick:()=>u(!c),className:"text-xs text-primary hover:text-primary-foreground",children:t(c?"importModal.huggingface.auth.hide":"importModal.huggingface.auth.show")})]}),o.jsx(At,{children:c&&o.jsxs(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:[o.jsxs("p",{className:"text-xs text-white/60 mb-3",children:[t("importModal.huggingface.auth.description")," ",o.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t("importModal.huggingface.auth.settingsLink")})]}),o.jsx("input",{type:"password",placeholder:t("importModal.huggingface.auth.tokenPlaceholder"),className:"w-full px-3 py-2 bg-black/30 border border-white/20 rounded text-white/90 text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 placeholder:text-white/40",value:i,onChange:z=>l(z.target.value)})]})})]}),o.jsx("div",{className:"flex justify-end",children:o.jsx(je,{variant:"outline",type:"submit",className:Qe("px-6 py-2.5",se?"border-green-700 hover:border-green-700":void 0),disabled:$||!n.trim()||!se,children:$?o.jsxs(o.Fragment,{children:[o.jsx(Hn,{className:"h-4 w-4 mr-2 animate-spin"}),t("importModal.huggingface.actions.importing")]}):o.jsxs(o.Fragment,{children:[t("importModal.huggingface.actions.importDataset"),o.jsx(nr,{className:"h-4 w-4 ml-1"})]})})}),o.jsx(At,{children:$&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mt-4 overflow-hidden",children:o.jsxs("div",{className:"bg-primary/10 border border-primary/20 rounded-lg p-4",children:[p&&o.jsx(Mge,{strategy:p,status:"active"}),o.jsx("div",{className:"flex items-center text-sm mb-2",children:o.jsx("p",{className:"text-primary font-medium",children:X})}),Z>0&&o.jsx("div",{className:"w-full bg-white/10 rounded-full h-2 mb-2",children:o.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:"".concat(Z*100,"%")}})}),o.jsx("p",{className:"text-xs text-primary/80",children:Z>0?"".concat(Math.round(Z*100),"% ").concat(t("importModal.huggingface.progress.complete")):t("importModal.huggingface.progress.initializing")})]})})})]}),o.jsxs("div",{className:"border-t border-white/10 pt-6 mb-6",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("h4",{className:"text-base font-medium text-white mb-2 flex items-center",children:t("importModal.huggingface.search.title")}),o.jsxs("form",{onSubmit:W,className:"flex gap-2",children:[o.jsx("input",{type:"text",placeholder:t("importModal.huggingface.search.placeholder"),className:"flex-1 px-3 py-2 bg-black/30 border border-white/20 rounded text-white/90 text-sm focus:outline-none focus:ring-1 focus:ring-primary/50 placeholder:text-white/40",value:a,onChange:z=>s(z.target.value),disabled:j}),o.jsx(je,{type:"submit",variant:"outline",size:"sm",disabled:j||!a.trim(),children:j?o.jsx(Hn,{className:"h-4 w-4 animate-spin"}):o.jsx(Qi,{className:"h-4 w-4"})})]})]}),G.length>0&&o.jsxs("div",{className:"mb-6",children:[o.jsxs("h5",{className:"text-sm font-medium text-white/80 mb-3",children:[t("importModal.huggingface.search.results")," (",G.length,")"]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:G.slice(0,9).map(z=>o.jsx(d3,{dataset:z,onImport:ie,isImporting:$},z.id))})]})]}),o.jsxs("div",{className:"border-t border-white/10 pt-6",children:[o.jsxs("div",{className:"mb-4",children:[o.jsx("h4",{className:"text-base font-medium text-white mb-2 flex items-center",children:t("importModal.huggingface.featured.title")}),o.jsx("p",{className:"text-sm text-white/60",children:t("importModal.huggingface.featured.description")})]}),F?o.jsxs("div",{className:"flex items-center justify-center py-8",children:[o.jsx(Hn,{className:"h-5 w-5 animate-spin text-primary mr-2"}),o.jsx("span",{className:"text-white/60",children:t("importModal.huggingface.loading.datasets")})]}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:k.slice(0,6).map(z=>o.jsx(d3,{dataset:z,onImport:ie,isImporting:$},z.id))})]})]}),o.jsx("div",{className:"border-t border-white/10 p-4 bg-white/5",children:o.jsxs("div",{className:"text-xs text-white/60",children:[o.jsx("div",{className:"flex items-center mb-2",children:o.jsxs("span",{className:"font-medium text-white/80",children:[t("importModal.huggingface.footer.title"),":"]})}),o.jsxs("ul",{className:"space-y-1 ml-4",children:[o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("importModal.huggingface.footer.memoryEfficient")]}),o.jsxs("li",{className:"flex items-center",children:[o.jsx("span",{className:"h-1 w-1 bg-white/40 rounded-full mr-2"}),t("importModal.huggingface.footer.multiFormat")]})]})]})})]})},Pge=({isConnected:e,isConnecting:t,error:n,databaseCount:r,connectionInfo:a,onDisconnect:s,className:i})=>{const l=()=>n?"bg-red-500":t?"bg-yellow-500":e?"bg-green-500":"bg-gray-500",c=()=>n?"Connection Error":t?"Connecting...":e?"Connected":"Not Connected",u=()=>{if(!(a!=null&&a.connectedAt))return"";const h=new Date,m=new Date(a.connectedAt),p=h.getTime()-m.getTime(),g=Math.floor(p/6e4);if(g<1)return"just now";if(g<60)return"".concat(g,"m ago");const T=Math.floor(g/60);return T<24?"".concat(T,"h ago"):"".concat(Math.floor(T/24),"d ago")};return o.jsxs("div",{className:Qe("flex items-center justify-between",i),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:Qe("w-3 h-3 rounded-full transition-colors duration-300",l(),t&&"animate-pulse")}),e&&o.jsx("div",{className:Qe("absolute inset-0 w-3 h-3 rounded-full animate-ping",l(),"opacity-75")})]}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"text-sm font-medium text-white",children:c()})}),e&&a&&o.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[o.jsxs("span",{children:[r," databases"]}),o.jsx("span",{children:"•"}),o.jsxs("span",{children:["Connected ",u()]})]}),n&&o.jsxs(me.div,{initial:{opacity:0,y:-2},animate:{opacity:1,y:0},className:"flex items-center gap-1 text-xs text-red-400 mt-1",children:[o.jsx(Cn,{size:12}),o.jsx("span",{children:n})]})]})]}),o.jsx(At,{children:e&&o.jsx(me.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:10},className:"flex items-center gap-2",children:o.jsx(Ut,{placement:"left",content:"Disconnect",children:o.jsx("button",{onClick:s,className:"p-1.5 text-white/50 hover:text-white/70 hover:bg-white/10 rounded transition-all",children:o.jsx(ume,{size:14})})})})})]})},kge=({onConnect:e,isConnecting:t,error:n,storedToken:r})=>{const[a,s]=v.useState(r),[i,l]=v.useState(!1),c=()=>H(null,null,function*(){if(a.trim())try{yield e(a.trim())}catch(h){}}),u=a.trim().length>0;return o.jsxs("div",{className:"space-y-4 w-100",children:[o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("h3",{className:"text-lg font-semibold text-white mb-1",children:"Connect to MotherDuck"}),o.jsx("p",{className:"text-sm text-white/60",children:"Import your tables for analysis"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("label",{htmlFor:"token",className:"text-sm font-medium text-white/80",children:"API Token"}),o.jsxs("button",{onClick:()=>l(!i),className:"text-xs text-orange-300 hover:text-orange-200 flex items-center gap-1",children:[o.jsx(jo,{className:"w-3 h-3"}),i?"Hide":"Help"]})]}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{id:"token",type:"password",placeholder:"md_... or token_...",value:a,onChange:h=>s(h.target.value),onKeyDown:h=>h.key==="Enter"&&c(),className:Qe("w-full px-3 py-3 h-12 bg-black/30 border border-white/20 rounded-lg text-white/90 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/50 placeholder:text-white/40 transition-all",n&&"border-destructive focus:ring-destructive/50 focus:border-destructive",u&&"border-green-500/50 focus:ring-green-500/50 focus:border-green-500")}),o.jsx("div",{className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:t?o.jsx(Hn,{className:"w-4 h-4 text-white/40 animate-spin"}):u?o.jsx("div",{className:"w-6 h-6 bg-green-500/20 rounded-full flex items-center justify-center",children:o.jsx(Zr,{className:"w-4 h-4 text-green-500"})}):a?o.jsx("div",{className:"w-6 h-6 bg-red-500/20 rounded-full flex items-center justify-center",children:o.jsx(Cn,{className:"w-4 h-4 text-red-500"})}):null})]}),o.jsx(At,{children:i&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"bg-blue-500/10 border border-blue-500/20 rounded-lg p-3 text-xs",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(jo,{className:"w-4 h-4 text-blue-400 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"text-blue-300 space-y-1",children:[o.jsxs("p",{children:[o.jsx("strong",{children:"What we collect:"})," Your API token to read databases"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"What we do:"})," Import data locally for fast analysis"]}),o.jsxs("p",{children:[o.jsx("strong",{children:"Get token:"})," ",o.jsx("a",{href:"https://app.motherduck.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-blue-200",children:"MotherDuck Settings"})]})]})]})})}),o.jsx("div",{className:"flex justify-end",children:o.jsx(je,{variant:"outline",onClick:c,disabled:t||!u,className:Qe("px-6 py-2.5",u?"hover:border-green-700":void 0),children:t?o.jsxs(o.Fragment,{children:[o.jsx(Hn,{className:"w-4 h-4 mr-2 animate-spin"}),"Connecting..."]}):o.jsxs(o.Fragment,{children:["Connect",o.jsx(nr,{className:"h-4 w-4 ml-1"})]})})})]}),n&&o.jsx(me.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"bg-red-500/10 border border-red-500/20 rounded-lg p-3",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(Ma,{className:"w-4 h-4 text-red-400 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"text-sm text-red-400",children:[o.jsx("p",{className:"font-medium",children:"Connection Error"}),o.jsx("p",{className:"text-xs text-red-400/80 mt-1",children:n})]})]})})]})},wA="datakit-motherduck-token",jge=()=>{const{motherDuckConnected:e,motherDuckConnecting:t,motherDuckError:n,motherDuckDatabases:r,connectToMotherDuck:a,disconnectFromMotherDuck:s,refreshMotherDuckSchemas:i}=Dt(),[l,c]=v.useState(null),u=v.useCallback(()=>{try{return localStorage.getItem(wA)}catch(b){return null}},[]),h=v.useCallback(b=>{try{localStorage.setItem(wA,b)}catch(x){}},[]),m=v.useCallback(()=>{try{localStorage.removeItem(wA)}catch(b){}},[]),p=v.useCallback(b=>H(null,null,function*(){try{yield a(b),h(b);try{c({user:"Connected User",version:"1.0.0"})}catch(x){}}catch(x){throw x}}),[a,h]),g=v.useCallback(()=>H(null,null,function*(){yield s(),m(),c(null)}),[s,m]),T=v.useCallback(()=>H(null,null,function*(){if(!e)throw new Error("Not connected to MotherDuck");try{yield Promise.all(r.map(b=>i(b.name).catch(x=>{})))}catch(b){throw b}}),[e,r,i]),y=v.useCallback(()=>{Dt.setState({motherDuckError:null})},[]);return{isConnected:e,isConnecting:t,error:n,databases:r,connectionInfo:l,connect:p,disconnect:g,refreshDatabases:T,clearError:y,getStoredToken:u,clearStoredToken:m}},Uge=({onImport:e})=>{const{t}=Ze(),{isConnected:n,isConnecting:r,error:a,databases:s,connectionInfo:i,connect:l,disconnect:c,getStoredToken:u,clearError:h}=jge(),{setActiveTab:m}=ut(),[p,g]=v.useState(!1),T=()=>H(null,null,function*(){yield c(),g(!1)});v.useEffect(()=>{n&&!p&&g(!0)},[n,p]);const y=b=>H(null,null,function*(){yield l(b)});return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"px-6 py-4 border-b border-white/10",children:o.jsx(Pge,{isConnected:n,isConnecting:r,error:a,databaseCount:s.length,connectionInfo:i,onDisconnect:T})}),o.jsx("div",{className:"flex-1 overflow-hidden",children:n?p?o.jsx("div",{className:"h-full flex flex-col items-center justify-center px-6",children:o.jsxs(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"text-center space-y-4",children:[o.jsx("h2",{className:"text-xl text-white font-medium",children:t("import.motherduck.success.title",{defaultValue:"You're all set!"})}),o.jsx("p",{className:"text-white/70",children:t("import.motherduck.success.description",{defaultValue:"Connection successful. You can query your MotherDuck in the query tab."})}),o.jsx(je,{className:"mt-4",variant:"outline",onClick:()=>{m("query"),e()},children:t("import.motherduck.success.goToQuery",{defaultValue:"Go to Query Tab"})})]})}):null:o.jsx("div",{className:"h-full flex items-center justify-center px-6",children:o.jsx(kge,{onConnect:y,isConnecting:r,error:a,storedToken:u()||"",onClearError:h})})})]})},Fge=({title:e,description:t,benefits:n=[],iconColor:r="text-blue-400",iconBgColor:a="bg-gradient-to-br from-blue-500/20 to-purple-500/20",buttonClassName:s=""})=>{const{t:i}=Ze(),[l,c]=v.useState(!1),[u,h]=v.useState("signup");return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center",children:[o.jsxs("div",{className:"mb-6",children:[o.jsx("div",{className:"w-16 h-16 ".concat(a," rounded-full flex items-center justify-center mb-4 mx-auto"),children:o.jsx(V0,{className:"h-8 w-8 ".concat(r)})}),o.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:e||i("auth.authGate.title",{defaultValue:"Sign In Required"})}),o.jsx("p",{className:"text-sm text-white/60 mb-6 max-w-sm",children:t||i("auth.authGate.description",{defaultValue:"This feature requires authentication to ensure security and enable advanced functionality."})}),n.length>0&&o.jsx("div",{className:"space-y-2 text-xs text-white/50 mb-6",children:n.map((m,p)=>{const g=m.icon;return o.jsxs("div",{className:"flex items-center justify-center",children:[o.jsx(g,{className:"h-3 w-3 mr-2"}),o.jsx("span",{children:m.text})]},p)})})]}),o.jsxs("div",{className:"space-y-4 w-full max-w-xs",children:[o.jsx(me.button,{whileHover:{scale:1.02,boxShadow:"0 0 25px rgba(139, 92, 246, 0.3)"},whileTap:{scale:.98},onClick:()=>{c(!0),h("signup")},className:"w-full py-3 px-4 bg-gradient-to-r from-purple-500/10 to-pink-500/10 hover:from-purple-500/20 hover:to-pink-500/20 border border-purple-500/30 hover:border-purple-400/50 rounded-lg transition-all duration-300 group cursor-pointer",children:o.jsx("div",{className:"flex items-center justify-center",children:o.jsx("span",{className:"text-sm font-medium text-white group-hover:text-purple-100 transition-colors",children:i("auth.authGate.getStartedFree",{defaultValue:"Get Started Free"})})})}),o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"text-xs text-white/40 mb-2",children:i("auth.authGate.alreadyHaveAccount",{defaultValue:"Already have an account?"})}),o.jsx(je,{variant:"outline",onClick:()=>{c(!0),h("login")},className:"w-full border-white/20 hover:border-white/30 text-white/80 hover:text-white ".concat(s),children:i("auth.authGate.signIn",{defaultValue:"Sign In"})})]})]})]}),o.jsx(Vl,{isOpen:l,onClose:()=>c(!1),onLoginSuccess:()=>c(!1),defaultMode:u})]})};class $ge{constructor(){Kt(this,"baseUrl","/postgres-proxy")}testConnection(t){return H(this,null,function*(){return(yield xt.post("".concat(this.baseUrl,"/connections/test"),t)).data})}createConnection(t){return H(this,null,function*(){return(yield xt.post("".concat(this.baseUrl,"/connections"),t)).data})}getConnections(){return H(this,null,function*(){return(yield xt.get("".concat(this.baseUrl,"/connections"))).data})}getConnection(t){return H(this,null,function*(){return(yield xt.get("".concat(this.baseUrl,"/connections/").concat(t))).data})}updateConnection(t){return H(this,null,function*(){return(yield xt.put("".concat(this.baseUrl,"/connections/").concat(t.id),t)).data})}deleteConnection(t){return H(this,null,function*(){return{message:(yield xt.delete("".concat(this.baseUrl,"/connections/").concat(t))).message}})}getSchemas(t){return H(this,null,function*(){return(yield xt.get("".concat(this.baseUrl,"/connections/").concat(t,"/schemas"))).data.map(r=>({schemaName:r.name,tableCount:r.tableCount||0,viewCount:r.viewCount||0,isSystemSchema:r.isSystem||!1}))})}getTables(t,n){return H(this,null,function*(){const r=yield xt.get("".concat(this.baseUrl,"/connections/").concat(t,"/schemas/").concat(encodeURIComponent(n),"/tables"));return this.transformTablesResponse(r.data)})}getTablesForDefaultSchema(t){return H(this,null,function*(){const r=(yield this.getConnection(t)).schema||"public";return this.getTables(t,r)})}transformTablesResponse(t){return t.map(n=>{var r;return{tableName:n.name,schemaName:n.schema,tableType:n.type,rowCount:n.rowCount,size:n.sizeBytes?this.formatBytes(n.sizeBytes):void 0,comment:n.comment,lastModified:void 0,columns:((r=n.columns)==null?void 0:r.map(a=>({columnName:a.name,dataType:a.type,isNullable:a.nullable,defaultValue:a.defaultValue,isPrimaryKey:a.isPrimaryKey||!1,isForeignKey:a.isForeignKey||!1,characterMaximumLength:a.characterMaximumLength,numericPrecision:a.numericPrecision,numericScale:a.numericScale,comment:a.comment})))||[]}})}getTableInfo(t,n,r){return H(this,null,function*(){return(yield xt.get("".concat(this.baseUrl,"/connections/").concat(t,"/schemas/").concat(encodeURIComponent(n),"/tables/").concat(encodeURIComponent(r)))).data})}previewTableData(s,i,l){return H(this,arguments,function*(t,n,r,a={}){const c=new URLSearchParams;a.limit&&c.append("limit",a.limit.toString()),a.offset&&c.append("offset",a.offset.toString()),a.orderBy&&(c.append("orderBy",a.orderBy.column),c.append("orderDirection",a.orderBy.direction)),a.filters&&a.filters.length>0&&c.append("filters",JSON.stringify(a.filters));const u=c.toString(),h="".concat(this.baseUrl,"/connections/").concat(t,"/schemas/").concat(encodeURIComponent(n),"/tables/").concat(encodeURIComponent(r),"/preview").concat(u?"?".concat(u):"");return(yield xt.post(h,a)).data})}executeQuery(t,n){return H(this,null,function*(){return(yield xt.post("".concat(this.baseUrl,"/connections/").concat(t,"/query"),n)).data})}healthCheck(){return H(this,null,function*(){return{status:"healthy",timestamp:(yield xt.get("".concat(this.baseUrl,"/health"))).data.timestamp||new Date().toISOString()}})}getAllTables(t){return H(this,null,function*(){const n=yield this.getSchemas(t),r=[],a=n.map(i=>this.getTables(t,i.schemaName).catch(l=>[]));return(yield Promise.allSettled(a)).forEach(i=>{i.status==="fulfilled"&&r.push(...i.value)}),r})}searchTables(t,n){return H(this,null,function*(){const r=yield this.getAllTables(t),a=n.toLowerCase();return r.filter(s=>s.tableName.toLowerCase().includes(a)||s.schemaName.toLowerCase().includes(a))})}getConnectionStats(t){return H(this,null,function*(){const n=yield this.getSchemas(t),r=yield this.getAllTables(t),a=r.filter(l=>l.tableType==="table").length,s=r.filter(l=>l.tableType==="view"||l.tableType==="materialized_view").length;let i;for(const l of r)l.size&&(!i||this.compareSize(l.size,i.size)>0)&&(i={name:"".concat(l.schemaName,".").concat(l.tableName),size:l.size});return{totalTables:a,totalViews:s,schemaCount:n.length,largestTable:i}})}formatBytes(t){if(t===0)return"0 bytes";const n=1024,r=["bytes","KB","MB","GB","TB"],a=Math.floor(Math.log(t)/Math.log(n));return"".concat(parseFloat((t/Math.pow(n,a)).toFixed(2))," ").concat(r[a])}compareSize(t,n){const r=a=>{const s=a.match(/^([\d.]+)\s*(bytes?|KB|MB|GB|TB)?$/i);if(!s)return 0;const i=parseFloat(s[1]),l=(s[2]||"bytes").toLowerCase(),c={bytes:1,byte:1,kb:1024,mb:1024*1024,gb:1024*1024*1024,tb:1024*1024*1024*1024};return i*(c[l]||1)};return r(t)-r(n)}selectFromTable(i,l,c){return H(this,arguments,function*(t,n,r,a=100,s=["*"]){const u=s.join(", "),h="SELECT ".concat(u,' FROM "').concat(n,'"."').concat(r,'" LIMIT ').concat(a);return this.executeQuery(t,{sql:h,limit:a,timeout:3e4})})}testConnectionHealth(t){return H(this,null,function*(){try{return(yield this.executeQuery(t,{sql:"SELECT 1 as health_check",timeout:5e3})).rowCount===1}catch(n){return!1}})}}const ua=new $ge,Am=Object.freeze(Object.defineProperty({__proto__:null,postgreSQLService:ua},Symbol.toStringTag,{value:"Module"})),h3={connections:[],selectedConnection:null,isConnecting:!1,connectionError:null,schemas:[],selectedSchema:null,tables:[],selectedTables:[],isLoadingSchemas:!1,isLoadingTables:!1,schemaError:null,queryResults:[],isExecutingQuery:!1,queryError:null,queryHistory:[],schemaTreeExpanded:{},tableDetailsCache:{}},YL=Ki()(H1((e,t)=>he(q({},h3),{testConnection:n=>H(null,null,function*(){e({isConnecting:!0,connectionError:null});try{const r=yield ua.testConnection(n);return e({isConnecting:!1}),r}catch(r){const a=r instanceof Error?r.message:"Connection test failed";throw e({isConnecting:!1,connectionError:a}),r}}),createConnection:n=>H(null,null,function*(){e({isConnecting:!0,connectionError:null});try{const r=yield ua.createConnection(n);return e(a=>he(q({},a),{connections:[...a.connections,r],selectedConnection:r,isConnecting:!1})),r}catch(r){const a=r instanceof Error?r.message:"Failed to create connection";throw e({isConnecting:!1,connectionError:a}),r}}),updateConnection:n=>H(null,null,function*(){e({isConnecting:!0,connectionError:null});try{const r=yield ua.updateConnection(n);return e(a=>{var l;const s=a.connections.findIndex(c=>c.id===n.id),i=[...a.connections];return s!==-1&&(i[s]=r),he(q({},a),{connections:i,selectedConnection:((l=a.selectedConnection)==null?void 0:l.id)===n.id?r:a.selectedConnection,isConnecting:!1})}),r}catch(r){const a=r instanceof Error?r.message:"Failed to update connection";throw e({isConnecting:!1,connectionError:a}),r}}),deleteConnection:n=>H(null,null,function*(){e({isConnecting:!0,connectionError:null});try{yield ua.deleteConnection(n),e(r=>{var a,s,i,l,c,u;return he(q({},r),{connections:r.connections.filter(h=>h.id!==n),selectedConnection:((a=r.selectedConnection)==null?void 0:a.id)===n?null:r.selectedConnection,schemas:((s=r.selectedConnection)==null?void 0:s.id)===n?[]:r.schemas,tables:((i=r.selectedConnection)==null?void 0:i.id)===n?[]:r.tables,selectedTables:((l=r.selectedConnection)==null?void 0:l.id)===n?[]:r.selectedTables,selectedSchema:((c=r.selectedConnection)==null?void 0:c.id)===n?null:r.selectedSchema,schemaTreeExpanded:((u=r.selectedConnection)==null?void 0:u.id)===n?{}:r.schemaTreeExpanded,isConnecting:!1})})}catch(r){const a=r instanceof Error?r.message:"Failed to delete connection";throw e({isConnecting:!1,connectionError:a}),r}}),loadConnections:()=>H(null,null,function*(){e({isConnecting:!0,connectionError:null});try{const n=yield ua.getConnections();e({connections:n,isConnecting:!1})}catch(n){const r=n instanceof Error?n.message:"Failed to load connections";e({connections:[],isConnecting:!1,connectionError:r})}}),selectConnection:n=>{e(r=>he(q({},r),{selectedConnection:n,schemas:[],tables:[],selectedTables:[],selectedSchema:null,schemaTreeExpanded:{},queryResults:[]}))},loadSchemas:n=>H(null,null,function*(){e({isLoadingSchemas:!0,schemaError:null});try{const r=yield ua.getSchemas(n);e({schemas:r,isLoadingSchemas:!1})}catch(r){const a=r instanceof Error?r.message:"Failed to load schemas";throw e({isLoadingSchemas:!1,schemaError:a}),r}}),loadTables:(n,r)=>H(null,null,function*(){e({isLoadingTables:!0,schemaError:null});try{const a=yield ua.getTables(n,r);e(s=>he(q({},s),{tables:[...s.tables.filter(i=>i.schemaName!==r),...a],isLoadingTables:!1}))}catch(a){const s=a instanceof Error?a.message:"Failed to load tables";throw e({isLoadingTables:!1,schemaError:s}),a}}),loadAllTables:n=>H(null,null,function*(){e({isLoadingTables:!0,schemaError:null});try{const r=yield ua.getAllTables(n);e({tables:r,isLoadingTables:!1})}catch(r){const a=r instanceof Error?r.message:"Failed to load all tables";throw e({isLoadingTables:!1,schemaError:a}),r}}),selectSchema:n=>{e({selectedSchema:n})},toggleTableSelection:n=>{e(r=>{const a=r.selectedTables.findIndex(i=>i.schemaName===n.schemaName&&i.tableName===n.tableName),s=[...r.selectedTables];return a===-1?s.push(n):s.splice(a,1),he(q({},r),{selectedTables:s})})},clearTableSelection:()=>{e({selectedTables:[]})},loadTableInfo:(n,r,a)=>H(null,null,function*(){const s="".concat(n,":").concat(r,":").concat(a),i=t().tableDetailsCache[s];if(i)return i;try{const l=yield ua.getTableInfo(n,r,a);return e(c=>he(q({},c),{tableDetailsCache:he(q({},c.tableDetailsCache),{[s]:l})})),l}catch(l){const c=l instanceof Error?l.message:"Failed to load table info";throw e({schemaError:c}),l}}),previewTableData:(n,r,a,s)=>H(null,null,function*(){try{return yield ua.previewTableData(n,r,a,s)}catch(i){const l=i instanceof Error?i.message:"Failed to preview table data";throw e({schemaError:l}),i}}),executeQuery:(n,r)=>H(null,null,function*(){var a,s;e({isExecutingQuery:!0,queryError:null});try{const i=yield ua.executeQuery(n,r),l={id:Date.now().toString(),sql:r.sql,connectionId:n,connectionName:((a=t().selectedConnection)==null?void 0:a.name)||"Unknown",executedAt:new Date().toISOString(),executionTime:i.executionTime,rowCount:i.rowCount,success:!0};return e(c=>{const u=[i,...c.queryResults].slice(0,10),h=[l,...c.queryHistory].slice(0,50);return he(q({},c),{queryResults:u,queryHistory:h,isExecutingQuery:!1})}),i}catch(i){const l=i instanceof Error?i.message:"Query execution failed",c={id:Date.now().toString(),sql:r.sql,connectionId:n,connectionName:((s=t().selectedConnection)==null?void 0:s.name)||"Unknown",executedAt:new Date().toISOString(),executionTime:0,rowCount:0,success:!1,error:l};throw e(u=>{const h=[c,...u.queryHistory].slice(0,50);return he(q({},u),{queryError:l,isExecutingQuery:!1,queryHistory:h})}),i}}),clearQueryResults:()=>{e({queryResults:[]})},clearQueryError:()=>{e({queryError:null})},toggleSchemaExpanded:n=>{e(r=>he(q({},r),{schemaTreeExpanded:he(q({},r.schemaTreeExpanded),{[n]:!r.schemaTreeExpanded[n]})}))},setAllSchemasExpanded:n=>{const{schemas:r}=t(),a={};r.forEach(s=>{a[s.schemaName]=n}),e(s=>he(q({},s),{schemaTreeExpanded:q(q({},s.schemaTreeExpanded),a)}))},clearErrors:()=>{e({connectionError:null,schemaError:null,queryError:null})},clearConnectionError:()=>{e({connectionError:null})},clearSchemaError:()=>{e({schemaError:null})},searchTables:(n,r)=>H(null,null,function*(){return yield ua.searchTables(n,r)}),getConnectionStats:n=>H(null,null,function*(){return yield ua.getConnectionStats(n)}),reset:()=>{e(h3)}}),{name:"PostgreSQLStore"})),Bge=Object.freeze(Object.defineProperty({__proto__:null,usePostgreSQLStore:YL},Symbol.toStringTag,{value:"Module"})),Hge=({onImport:e})=>{const{t}=Ze(),{isAuthenticated:n}=ea(),[r,a]=v.useState("connections"),[s,i]=v.useState(""),[l,c]=v.useState([]),[u,h]=v.useState(null),[m,p]=v.useState({name:"",host:"",port:5432,database:"",username:"",password:"",schema:"public",sslEnabled:!1,connectionTimeout:30,queryTimeout:6e4}),{connections:g,selectedConnection:T,isConnecting:y,connectionError:b,tables:x,isLoadingSchemas:R,isLoadingTables:A,schemaError:w,loadConnections:_,selectConnection:N,createConnection:I,deleteConnection:D,loadSchemas:M,loadTables:O,testConnection:L,clearErrors:k}=YL(),{connectToPostgreSQL:F,addVirtualPostgreSQLTable:U}=Dt();v.useEffect(()=>{n&&_()},[n,_]),v.useEffect(()=>{T&&M(T.id).then(()=>{const te=T.schema||"public";O(T.id,te)})},[T,M,O]);const B=()=>H(null,null,function*(){try{k();const te=yield L({host:m.host,port:m.port,database:m.database,username:m.username,password:m.password,sslEnabled:m.sslEnabled,connectionTimeout:m.connectionTimeout});if(!te.success)throw new Error(te.message);const ae={name:m.name,host:m.host,port:m.port,database:m.database,username:m.username,password:m.password,schema:m.schema,sslEnabled:m.sslEnabled,connectionTimeout:m.connectionTimeout,queryTimeout:m.queryTimeout};yield I(ae),a("tables")}catch(te){}}),j=te=>H(null,null,function*(){if(confirm(t("importModal.postgresql.confirmDelete",{name:te.name})))try{yield D(te.id)}catch(ae){}}),G=te=>{N(te),a("tables")},K=te=>{c(ae=>{const ne=ae||[];return ne.find(ie=>ie.schemaName===te.schemaName&&ie.tableName===te.tableName)?ne.filter(ie=>!(ie.schemaName===te.schemaName&&ie.tableName===te.tableName)):[...ne,te]})},J=()=>H(null,null,function*(){var te,ae,ne;if(!(!T||l.length===0))try{yield F(T.id);for(const ce of l){const ie=((te=ce.columns)==null?void 0:te.map(Q=>({name:Q.columnName,type:Q.dataType})))||[];U(T.id,ce,ie);const W="".concat(ce.schemaName,".").concat(ce.tableName);e({data:[],columnTypes:((ae=ce.columns)==null?void 0:ae.map(Q=>({name:Q.columnName,type:Q.dataType})))||[],fileName:W,rowCount:ce.rowCount||0,columnCount:((ne=ce.columns)==null?void 0:ne.length)||0,sourceType:"postgres",loadedToDuckDB:!1,tableName:W,isRemote:!0,remoteProvider:"postgresql",remoteURL:"postgres://".concat(T.host,":").concat(T.port,"/").concat(T.database),postgresql:{connectionId:T.id,connectionName:T.name,schema:ce.schemaName,table:ce.tableName,originalRowCount:ce.rowCount||0,queryUsed:'SELECT * FROM "'.concat(ce.schemaName,'"."').concat(ce.tableName,'"')}})}}catch(ce){}}),$=(x||[]).filter(te=>te.tableName.toLowerCase().includes(s.toLowerCase())||te.schemaName.toLowerCase().includes(s.toLowerCase())),X=()=>o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"p-6 border-b border-white/10",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-white",children:t("importModal.postgresql.connections.title")}),o.jsx("p",{className:"text-sm text-white/60 mt-1",children:t("importModal.postgresql.connections.description")})]}),o.jsxs(je,{onClick:()=>a("form"),className:"bg-blue-500/20 hover:bg-blue-500/30 text-blue-400 border border-blue-500/30",size:"sm",children:[o.jsx(ru,{className:"h-4 w-4 mr-2"}),t("importModal.postgresql.connections.addConnection")]})]})}),b&&o.jsx("div",{className:"mx-6 mt-4 p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:o.jsxs("div",{className:"flex items-center text-red-400",children:[o.jsx(Cn,{className:"h-4 w-4 mr-2"}),o.jsx("span",{className:"text-sm",children:b})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:y?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(vA,{className:"h-6 w-6 animate-spin text-blue-400"}),o.jsx("span",{className:"ml-2 text-white/60",children:t("importModal.postgresql.loading.connections")})]}):g.length===0?o.jsxs("div",{className:"text-center py-12",children:[o.jsx("h4",{className:"text-lg font-medium text-white mb-2",children:t("importModal.postgresql.noConnections.title")}),o.jsx("p",{className:"text-white/60 mb-6 max-w-sm mx-auto",children:t("importModal.postgresql.noConnections.description")}),o.jsxs(je,{onClick:()=>a("form"),className:"bg-blue-500/20 hover:bg-blue-500/30 text-blue-400 border border-blue-500/30",children:[o.jsx(ru,{className:"h-4 w-4 mr-2"}),t("importModal.postgresql.noConnections.createConnection")]})]}):o.jsx("div",{className:"space-y-3",children:(g||[]).map(te=>o.jsx(me.div,{className:Qe("group relative p-4 rounded-lg border transition-all duration-200 cursor-pointer",(T==null?void 0:T.id)===te.id?"bg-blue-500/10 border-blue-500/30 text-white":"bg-white/5 border-white/10 hover:border-white/20 text-white/80 hover:text-white"),onClick:()=>G(te),children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsx("div",{className:"flex items-start space-x-3",children:o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h4",{className:"font-medium truncate",children:te.name}),o.jsxs("p",{className:"text-sm opacity-60 truncate",children:[te.host,":",te.port,"/",te.database]}),o.jsxs("div",{className:"flex items-center mt-1",children:[o.jsx("div",{className:Qe("w-2 h-2 rounded-full mr-2",te.isActive?"bg-green-400":"bg-red-400")}),o.jsx("span",{className:"text-xs opacity-60",children:te.isActive?t("importModal.postgresql.status.active"):t("importModal.postgresql.status.inactive")})]})]})}),o.jsxs("div",{className:"flex items-center space-x-2 opacity-0 group-hover:opacity-100 transition-opacity",children:[o.jsx(je,{size:"sm",variant:"ghost",onClick:ae=>{ae.stopPropagation(),h(te),a("form")},className:"h-8 w-8 p-0 hover:bg-white/10",children:o.jsx(PL,{className:"h-4 w-4"})}),o.jsx(je,{size:"sm",variant:"ghost",onClick:ae=>{ae.stopPropagation(),j(te)},className:"h-8 w-8 p-0 hover:bg-red-500/20 hover:text-red-400",children:o.jsx(Hl,{className:"h-4 w-4"})})]})]})},te.id))})})]}),Z=()=>o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"p-6 border-b border-white/10",children:o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-white",children:t(u?"importModal.postgresql.form.editConnection":"importModal.postgresql.form.newConnection")}),o.jsx("p",{className:"text-sm text-white/60 mt-1",children:t("importModal.postgresql.form.description")})]})})}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[o.jsxs("div",{className:"max-w-md space-y-6",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("importModal.postgresql.form.connectionName")}),o.jsx("input",{type:"text",value:m.name,onChange:te=>p(he(q({},m),{name:te.target.value})),placeholder:t("importModal.postgresql.form.connectionNamePlaceholder"),className:"w-full p-2 bg-white/5 border border-white/20 rounded text-white placeholder:text-white/50 focus:outline-none focus:border-blue-500/50"})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsxs("div",{className:"col-span-2",children:[o.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("importModal.postgresql.form.host")}),o.jsx("input",{type:"text",value:m.host,onChange:te=>p(he(q({},m),{host:te.target.value})),placeholder:t("importModal.postgresql.form.hostPlaceholder"),className:"w-full p-2 bg-white/5 border border-white/20 rounded text-white placeholder:text-white/50 focus:outline-none focus:border-blue-500/50"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("importModal.postgresql.form.port")}),o.jsx("input",{type:"number",value:m.port,onChange:te=>p(he(q({},m),{port:parseInt(te.target.value)||5432})),placeholder:t("importModal.postgresql.form.portPlaceholder"),className:"w-full p-2 bg-white/5 border border-white/20 rounded text-white placeholder:text-white/50 focus:outline-none focus:border-blue-500/50"})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("importModal.postgresql.form.database")}),o.jsx("input",{type:"text",value:m.database,onChange:te=>p(he(q({},m),{database:te.target.value})),placeholder:t("importModal.postgresql.form.databasePlaceholder"),className:"w-full p-2 bg-white/5 border border-white/20 rounded text-white placeholder:text-white/50 focus:outline-none focus:border-blue-500/50"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("importModal.postgresql.form.username")}),o.jsx("input",{type:"text",value:m.username,onChange:te=>p(he(q({},m),{username:te.target.value})),placeholder:t("importModal.postgresql.form.usernamePlaceholder"),className:"w-full p-2 bg-white/5 border border-white/20 rounded text-white placeholder:text-white/50 focus:outline-none focus:border-blue-500/50"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("importModal.postgresql.form.password")}),o.jsx("input",{type:"password",value:m.password,onChange:te=>p(he(q({},m),{password:te.target.value})),placeholder:t("importModal.postgresql.form.passwordPlaceholder"),className:"w-full p-2 bg-white/5 border border-white/20 rounded text-white placeholder:text-white/50 focus:outline-none focus:border-blue-500/50"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white mb-2",children:t("importModal.postgresql.form.defaultSchema")}),o.jsx("input",{type:"text",value:m.schema,onChange:te=>p(he(q({},m),{schema:te.target.value})),placeholder:t("importModal.postgresql.form.schemaPlaceholder"),className:"w-full p-2 bg-white/5 border border-white/20 rounded text-white placeholder:text-white/50 focus:outline-none focus:border-blue-500/50"})]}),o.jsxs("div",{className:"flex items-center space-x-3",children:[o.jsx("input",{id:"ssl-enabled",type:"checkbox",checked:m.sslEnabled,onChange:te=>p(he(q({},m),{sslEnabled:te.target.checked})),className:"w-4 h-4 rounded border-white/20 bg-white/5 text-blue-500"}),o.jsx("label",{htmlFor:"ssl-enabled",className:"text-sm text-white",children:t("importModal.postgresql.form.enableSSL")})]})]}),b&&o.jsx("div",{className:"mt-6 p-3 bg-red-500/10 border border-red-500/20 rounded-lg max-w-md",children:o.jsxs("div",{className:"flex items-center text-red-400",children:[o.jsx(Cn,{className:"h-4 w-4 mr-2"}),o.jsx("span",{className:"text-sm",children:b})]})})]}),o.jsx("div",{className:"p-6 border-t border-white/10",children:o.jsxs("div",{className:"flex justify-end space-x-3",children:[o.jsx(je,{variant:"ghost",onClick:()=>{a("connections"),h(null)},disabled:y,children:t("importModal.postgresql.form.cancel")}),o.jsx(je,{onClick:B,disabled:y||!m.name||!m.host||!m.database||!m.username||!m.password,className:"bg-blue-500/20 hover:bg-blue-500/30 text-blue-400 border border-blue-500/30 disabled:opacity-50",children:y?o.jsxs(o.Fragment,{children:[o.jsx(vA,{className:"h-4 w-4 mr-2 animate-spin"}),t("importModal.postgresql.form.testing")]}):o.jsxs(o.Fragment,{children:[o.jsx(Zr,{className:"h-4 w-4 mr-2"}),t(u?"importModal.postgresql.form.update":"importModal.postgresql.form.testCreate")]})})]})})]}),V=()=>o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"p-6 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-white",children:t("importModal.postgresql.tables.title")}),o.jsx("p",{className:"text-sm text-white/60 mt-1",children:t("importModal.postgresql.tables.description",{name:T==null?void 0:T.name})})]}),o.jsx(je,{variant:"ghost",onClick:()=>a("connections"),size:"sm",children:t("importModal.postgresql.tables.backToConnections")})]}),o.jsxs("div",{className:"mt-4 relative",children:[o.jsx(Qi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-white/40"}),o.jsx("input",{type:"text",value:s,onChange:te=>i(te.target.value),placeholder:t("importModal.postgresql.tables.searchPlaceholder"),className:"w-full pl-10 pr-4 py-2 bg-white/5 border border-white/20 rounded text-white placeholder:text-white/50 focus:outline-none focus:border-blue-500/50"})]})]}),w&&o.jsx("div",{className:"mx-6 mt-4 p-3 bg-red-500/10 border border-red-500/20 rounded-lg",children:o.jsxs("div",{className:"flex items-center text-red-400",children:[o.jsx(Cn,{className:"h-4 w-4 mr-2"}),o.jsx("span",{className:"text-sm",children:w})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:R||A?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(vA,{className:"h-6 w-6 animate-spin text-blue-400"}),o.jsx("span",{className:"ml-2 text-white/60",children:t("importModal.postgresql.loading.tables")})]}):$.length===0?o.jsxs("div",{className:"text-center py-12",children:[o.jsx(Bl,{className:"h-12 w-12 text-white/30 mx-auto mb-4"}),o.jsx("h4",{className:"text-lg font-medium text-white mb-2",children:t("importModal.postgresql.noTables.title")}),o.jsx("p",{className:"text-white/60",children:t(s?"importModal.postgresql.noTables.noMatches":"importModal.postgresql.noTables.noTablesFound")})]}):o.jsx("div",{className:"space-y-2",children:$.map(te=>{const ae=(l||[]).some(ne=>ne.schemaName===te.schemaName&&ne.tableName===te.tableName);return o.jsx(me.div,{className:Qe("group p-4 rounded-lg border transition-all duration-200 cursor-pointer",ae?"bg-blue-500/10 border-blue-500/30":"bg-white/5 border-white/10 hover:border-white/20"),onClick:()=>K(te),children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center space-x-3",children:[o.jsx("div",{className:Qe("w-8 h-8 rounded-md flex items-center justify-center border",te.tableType==="table"?"bg-green-500/20 border-green-500/30 text-green-400":"bg-blue-500/20 border-blue-500/30 text-blue-400"),children:o.jsx(Bl,{className:"h-4 w-4"})}),o.jsxs("div",{children:[o.jsxs("h4",{className:"font-medium text-white",children:[te.schemaName,".",te.tableName]}),o.jsx("p",{className:"text-sm text-white/60",children:te.tableType})]})]}),ae&&o.jsx(Zr,{className:"h-5 w-5 text-blue-400"})]})},"".concat(te.schemaName,".").concat(te.tableName))})})}),(l||[]).length>0&&o.jsx("div",{className:"p-6 border-t border-white/10",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-sm text-white/60",children:t("importModal.postgresql.tables.selectedCount",{count:(l||[]).length})}),o.jsx(je,{variant:"outline",onClick:J,className:" hover:border-blue-500",children:t("importModal.postgresql.tables.connectSelected")})]})})]});return n?o.jsx(At,{mode:"wait",children:o.jsxs(me.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},className:"h-full",children:[r==="connections"&&X(),r==="form"&&Z(),r==="tables"&&V()]},r)}):o.jsx(Fge,{title:t("importModal.postgresql.auth.title"),description:t("importModal.postgresql.auth.description")})},c7="/assets/s3-CksYoBFL.png",Vge="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20height='800'%20width='1200'%20viewBox='-19.20015%20-28.483%20166.4013%20170.898'%3e%3cg%20transform='translate(0%20-7.034)'%3e%3clinearGradient%20y2='120.789'%20x2='64'%20y1='7.034'%20x1='64'%20gradientUnits='userSpaceOnUse'%20id='a'%3e%3cstop%20offset='0'%20stop-color='%234387fd'/%3e%3cstop%20offset='1'%20stop-color='%234683ea'/%3e%3c/linearGradient%3e%3cpath%20d='M27.79%20115.217L1.54%2069.749a11.499%2011.499%200%20010-11.499l26.25-45.467a11.5%2011.5%200%20019.96-5.75h52.5a11.5%2011.5%200%20019.959%205.75l26.25%2045.467a11.499%2011.499%200%20010%2011.5l-26.25%2045.466a11.5%2011.5%200%2001-9.959%205.75h-52.5a11.499%2011.499%200%2001-9.96-5.75z'%20fill='url(%23a)'/%3e%3c/g%3e%3cg%20transform='translate(0%20-7.034)'%3e%3cdefs%3e%3cpath%20d='M27.791%20115.217L1.541%2069.749a11.499%2011.499%200%20010-11.499l26.25-45.467a11.499%2011.499%200%20019.959-5.75h52.5a11.5%2011.5%200%20019.96%205.75l26.25%2045.467a11.499%2011.499%200%20010%2011.5l-26.25%2045.466a11.499%2011.499%200%2001-9.96%205.75h-52.5a11.499%2011.499%200%2001-9.959-5.75z'%20id='b'/%3e%3c/defs%3e%3cclipPath%20id='c'%3e%3cuse%20height='100%25'%20width='100%25'%20xlink:href='%23b'%20overflow='visible'/%3e%3c/clipPath%3e%3cpath%20clip-path='url(%23c)'%20opacity='.07'%20d='M49.313%2053.875l-7.01%206.99%205.957%205.958-5.898%2010.476%2044.635%2044.636%2010.816.002L118.936%2084%2085.489%2050.55z'/%3e%3c/g%3e%3cpath%20d='M84.7%2043.236H43.264c-.667%200-1.212.546-1.212%201.214v8.566c0%20.666.546%201.212%201.212%201.212H84.7c.667%200%201.213-.546%201.213-1.212v-8.568c0-.666-.545-1.213-1.212-1.213m-6.416%207.976a2.484%202.484%200%2001-2.477-2.48%202.475%202.475%200%20012.477-2.477c1.37%200%202.48%201.103%202.48%202.477a2.48%202.48%200%2001-2.48%202.48m6.415%208.491l-41.436.002c-.667%200-1.212.546-1.212%201.214v8.565c0%20.666.546%201.213%201.212%201.213H84.7c.667%200%201.213-.547%201.213-1.213v-8.567c0-.666-.545-1.214-1.212-1.214m-6.416%207.976a2.483%202.483%200%2001-2.477-2.48%202.475%202.475%200%20012.477-2.477%202.48%202.48%200%20110%204.956'%20fill='%23fff'/%3e%3c/svg%3e",Gge="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1200'%20height='800'%20viewBox='-13.095%20-19.5%20113.49%20117'%3e%3cpath%20d='M6.6%2066.85l3.85%206.65c.8%201.4%201.95%202.5%203.3%203.3L27.5%2053H0c0%201.55.4%203.1%201.2%204.5z'%20fill='%230066da'/%3e%3cpath%20d='M43.65%2025L29.9%201.2c-1.35.8-2.5%201.9-3.3%203.3l-25.4%2044A9.06%209.06%200%20000%2053h27.5z'%20fill='%2300ac47'/%3e%3cpath%20d='M73.55%2076.8c1.35-.8%202.5-1.9%203.3-3.3l1.6-2.75L86.1%2057.5c.8-1.4%201.2-2.95%201.2-4.5H59.798l5.852%2011.5z'%20fill='%23ea4335'/%3e%3cpath%20d='M43.65%2025L57.4%201.2C56.05.4%2054.5%200%2052.9%200H34.4c-1.6%200-3.15.45-4.5%201.2z'%20fill='%2300832d'/%3e%3cpath%20d='M59.8%2053H27.5L13.75%2076.8c1.35.8%202.9%201.2%204.5%201.2h50.8c1.6%200%203.15-.45%204.5-1.2z'%20fill='%232684fc'/%3e%3cpath%20d='M73.4%2026.5l-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3L43.65%2025%2059.8%2053h27.45c0-1.55-.4-3.1-1.2-4.5z'%20fill='%23ffba00'/%3e%3c/svg%3e",WL="/assets/huggingface-Bi_jBgqO.png",zge="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJwAAACcCAMAAAC9ZjJ/AAAASFBMVEVMaXH/kjb/kjf/lTf/kzj/kTb/kzb/jTH/lTf/lTj/lTf/lDf/lDf/lTf/kzb/lDf/lDf/kzf/kzb/kzb/lTj/nDr/mDn/oTy1oCKRAAAAFHRSTlMAGAzZBSc6Afv+5qaR8k63yXxfa27Jz/QAAAAJcEhZcwAACxMAAAsTAQCanBgAAAcNSURBVHja7VyLkqowDA1QSMKjPJP+/5/eKa4uKroWAZ07ZGZ3dkbXHpPmddICcMghhxxyyCGHHHLIIYccAmi8IH5iaS/PXz//8YV6g6ysm6bMzAeWTrs+i5+9XlekIlw1GeDOWmmqiqqqjOeNhmArVSYiVsktmB13mylZR5Ekm1sYISPl4SS8JzpEaIVOC5NL0vuFEaLm/I7xTXW0l2URsvyiFpI6BoM3b4De/WIbmLXbSXVecZOlSYr4Klr4v3udYPOqK3cKKAhxMbGZR5ci/gRbRIMQtcMVNq/eneyKENVTcANpYvGcDwAxq4X5BlyTfgjcQFLVfTrGPJPaohK6xrYrOFPKjdnYaVIXZVnUTSXX+230CM33CsQGOnezPtMgzon/0Vu1jS/LXpHuKpT8hgui088wI+RagN3c1dEQIvttOrgOdK+hc91um85WAweBY032CyaNhKpOSrMPOgNlqF0Hkv6mKP6jkn4jmFTKgeiY+0kS/gG2AT6ENNiuvq4r0nOWMwYAI59VDK6vusKFgyNJ2ktHkXZF3dSlXX8nGuhpCLWr33cuKdrO2q4tG3Ii4vJy9XoFIU0kHNxApE64ykmc+AaDiFwRr2/XOnzTnWw7dh98znNM0q0PruUFdv1x22kC5iGPV/fXmeS/EKtkq9MgsGjTzWa2doMkMQwrgSs3KOqqdezKYjfoEPN17EqcbpBfC10FmyvXT/8IllZAR5Kvrzhf1FXvgyPfl21Sctb6vk03I+/su3460hRmG3ARfS82wOYdu/Iw8lOb9RLtG2GYldpNxwDp8jDMQv2qnB0aNFcdSdwsVR1rZdc06czMA8uFFefYY4cOZPAptijNsjSaossWgWP21EkQtOejIIS4a9S5qrEXF0OI8gXlMAeysIhgojSNHqJDiApR35CoK38DQLzArkRURAFsHULUFU2S1KWdn8icWC8avzZJef5oBBtOSxC1Mb6OzUBWV05Uxen8l0LoLkQv62Ugg5CG2pWoag2G6C1LHP3ImFHm2tRfppekuIC7Zv1fqkI6E5Cxxgb5ohaSe90hxLVOxyLNeT+PGg0KvUkWEnoRcMpTntDd/LsppqlgwqH6TiLArix+UhYQexGiZPr5THqbj+P6EcF7P5N4KqHY/Je/9jhmznszyVldolfaIWkmoa5/2V91dj//Ifcfr9r0aRwbE8dRn6velq/FZY3X7crMS/rTdsYwKpLUZVEkKnpXhw3tBNyLdvUV0pJE/8AwqiKiswXF7/QU8TV6mJX6RUVIP//V+ZoNugkHE9r/b7qJSfIOYUXNPZnGTCrYV+hhz7dmy5oFbAODvKsnPof4Jz38Brbr6P9SSCinAcFAPzy1K5PW6UK9QVQxBxXY1E/BnbLfU2xlvHieacOsejvY9XZ9Ck4eHYx5xapJWNHDklznXgOtPv4Ilf6NBrALbKBYmmsjmWf0sJJ9Y4IU5aFl9rU/jPRw/cBfWats6YQaxyIyuFHvb5Z7RPsHNoBjT4yTgWKaSHg3fEtaPaD9fQgJaLIu7R+OB2cgtkn4YFLyO+cz0NzzErNV69MDIVGapefOKbKFhLMJLMld0Job07FI+TqHhIhZ2+R5UvY2y2zXNiK0oF/X4n7J+0kYaRXEIWGXO/GBx2lVkXNKy3iO9h7cKfvzVRVigzKWrdSfSfGTxLE3pkUE0b0/nNE5pvMgMDjTR/klvz8o1F4EN7vLDURt/jNCZdEiMNO368xbtIEHJ0gxK3Nxzkle2FA6tVlnjDbnD79cUGatzdI4mLKkdcAN7SOlTEnF0IylK4HL/uIflxQhyUqj29WPC3hZSN/eSr4JOZ+uMbtlrbcZGnTV+8Fkg3n8JX0p8bvg7DbY/El8R2/O0jTdSHMGovL+DG/YLC2PYSt0GNvkHXSs9VbgRuWlhQyL0ZG0sJ0gQtwvjykkFjZFh5jlsjCXkdv4yKpXXqm6zB+SPW4OZPnASw4Objr3/k1mBYVH5PGs7/aCYNrwkOfPcO8haCBLJDDZkux1hDs8X/CQ73U0H4wBm0iAX+x3zeecL3igIH/Y79aggbirXq2Qeb87DWevhax2r5mWadj9uiXE/Wu6Y93PH36zGdrkFXi7+sOUfC3o70plPFy5/w1kROj/7i/29ocprdvoc+XxQHte8L2BV1ZPa2TWJIMP3StH9PniifI+4g+TiJwWTyLyfhdoH6DD7nFz5q9GGficIGJaPOi7eajsR8H5UiBu81nl7XiV8YnTYtbMoZscTPuo8qLyvrMdR8AfB+c3nrF3s0Tvq5/HdoIX1dedLftHCXzLkz0QulxPt5D9L9XCfNVTR6KmGs8xqcqQt/BlD0Qxtk5yoipPyhS+TLwZ46zrrB/Qft+DZM4HP435wofc/FyUxa+EdsghhxxyyCGHHHLIIf+B/ANuWf5f3jhTkwAAAABJRU5ErkJggg==",XL="/assets/postgres-CePlsVic.png",qge=({isOpen:e,onClose:t,onImport:n})=>{var m,p,g;const{t:r}=Ze(),a=[{id:"custom-url",label:r("remoteImport.providers.customUrl.label",{defaultValue:"Custom URL"}),icon:o.jsx(IL,{color:"white",className:"h-4 w-4"}),description:r("remoteImport.providers.customUrl.description",{defaultValue:"Import from any public URL"})},{id:"s3",label:r("remoteImport.providers.s3.label",{defaultValue:"Amazon S3"}),icon:o.jsx("img",{src:c7,className:"h-4 w-4"}),description:r("remoteImport.providers.s3.description",{defaultValue:"Public S3 buckets"})},{id:"huggingface",label:r("remoteImport.providers.huggingface.label",{defaultValue:"HuggingFace"}),icon:o.jsx("img",{src:WL,className:"h-5 w-5"}),description:r("remoteImport.providers.huggingface.description",{defaultValue:"ML datasets"})},{id:"motherduck",label:r("remoteImport.providers.motherduck.label",{defaultValue:"MotherDuck"}),icon:o.jsx("img",{src:zge,className:"h-5 w-5",alt:"MotherDuck"}),description:r("remoteImport.providers.motherduck.description",{defaultValue:"Cloud DuckDB"}),featured:!0,requiresAuth:!1},{id:"postgresql",label:r("remoteImport.providers.postgresql.label",{defaultValue:"PostgreSQL"}),icon:o.jsx("img",{src:XL,className:"h-5 w-5",alt:"PostgreSQL"}),description:r("remoteImport.providers.postgresql.description",{defaultValue:"PG databases"}),featured:!0,requiresAuth:!0},{id:"google-sheets",label:r("remoteImport.providers.googleSheets.label",{defaultValue:"Google Sheets"}),icon:o.jsx(fu,{className:"h-5 w-5"}),description:r("remoteImport.providers.googleSheets.description",{defaultValue:"Published Google Sheets"})},{id:"gcs",label:r("remoteImport.providers.gcs.label",{defaultValue:"Google Cloud"}),icon:o.jsx("img",{src:Vge,className:"h-6 w-6"}),description:r("remoteImport.providers.gcs.description",{defaultValue:"Public GCS buckets"}),comingSoon:!0},{id:"google-drive",label:r("remoteImport.providers.googleDrive.label",{defaultValue:"Google Drive"}),icon:o.jsx("img",{src:Gge,className:"h-6 w-6"}),description:r("remoteImport.providers.googleDrive.description",{defaultValue:"Files from Google Drive"}),comingSoon:!0}],{activeProviderRemoteModal:s,setActiveProviderRemoteModal:i}=ut(),{isAuthenticated:l}=ea();Ht.useEffect(()=>{const T=localStorage.getItem("datakit-last-import-provider");T&&a.find(y=>y.id===T)&&i(T)},[]);const c=T=>{const y=a.find(b=>b.id===T);y!=null&&y.comingSoon||(i(T),localStorage.setItem("datakit-last-import-provider",T))},u=T=>{n(T),t()},h=()=>{switch(s){case"huggingface":return o.jsx(Dge,{onImport:u});case"s3":return o.jsx(lge,{onImport:u});case"custom-url":return o.jsx(dge,{onImport:u});case"google-sheets":return o.jsx(yge,{onImport:u});case"motherduck":return o.jsx(Uge,{onImport:t});case"postgresql":return o.jsx(Hge,{onImport:u});default:return o.jsx("div",{className:"p-8 text-center text-white/60",children:r("remoteImport.selectProvider",{defaultValue:"Select a provider to continue"})})}};return o.jsx(At,{children:e&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 z-50 flex items-center justify-center px-4 backdrop-blur-sm bg-black/60",onClick:t,children:o.jsxs(me.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{delay:.1,duration:.2},className:"w-full max-w-6xl h-[85vh] bg-black border border-white/20 rounded-lg shadow-xl shadow-black/30 overflow-hidden flex",onClick:T=>T.stopPropagation(),children:[o.jsxs("div",{className:"w-64 bg-gradient-to-b from-darkNav to-black border-r border-white/10 flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsx("div",{className:"flex items-center justify-between",children:o.jsx("h2",{className:"text-lg font-heading font-medium text-white",children:r("remoteImport.title",{defaultValue:"Import Remote Sources"})})}),o.jsx("p",{className:"text-xs text-white/60 mt-1",children:r("remoteImport.subtitle",{defaultValue:"Connect to various data sources"})})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx("div",{className:"p-2",children:a.map(T=>o.jsxs("button",{onClick:()=>c(T.id),disabled:T.comingSoon,className:Qe("w-full text-left p-3 rounded-lg mb-1 transition-all duration-200 group relative",s===T.id&&!T.comingSoon?T.id==="huggingface"?"bg-yellow-400/10 border border-yellow-400/20 text-white":T.id==="s3"?"bg-orange-500/10 border border-orange-500/20 text-white":T.id==="google-sheets"?"bg-green-500/15 border border-green-500/20 text-white":T.id==="custom-url"?"bg-blue-500/15 border border-blue-500/20 text-white":T.id==="gcs"?"bg-sky-500/15 border border-sky-500/20 text-white":T.id==="google-drive"?"bg-blue-600/20 border border-blue-600/30 text-white":T.id==="motherduck"?"bg-orange-300/10 border border-orange-300/20 text-white":T.id==="postgresql"?"bg-blue-600/10 border border-blue-600/20 text-white":"bg-primary/20 border border-primary/30 text-white":T.comingSoon?"text-white/40 cursor-not-allowed":"text-white/70 hover:text-white hover:bg-white/5 border border-transparent"),children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("div",{className:Qe("h-8 w-8 rounded-md flex items-center justify-center mr-3 border",s===T.id&&!T.comingSoon?T.id==="huggingface"?"border-yellow-400/50 text-yellow-400":T.id==="s3"?"border-orange-500/50 text-orange-500":T.id==="google-sheets"?"bg-green-500/30 border-green-500/50 text-green-500":T.id==="custom-url"?"bg-blue-500/30 border-blue-500/50 text-blue-500":T.id==="gcs"?"bg-sky-500/30 border-sky-500/50 text-sky-500":T.id==="google-drive"?"bg-blue-600/30 border-blue-600/50 text-blue-600":T.id==="motherduck"?"border-orange-300/50 text-orange-300":T.id==="postgresql"?"border-blue-600/50 text-blue-600":"bg-primary/30 border-primary/50 text-primary":T.comingSoon?"bg-white/5 border-white/10 text-white/40":"bg-white/5 border-white/10 text-white/60 group-hover:border-white/20"),children:T.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:T.label}),T.comingSoon&&o.jsx("span",{className:"ml-2 text-xs bg-white/10 text-white/50 px-1.5 py-0.5 rounded",children:r("remoteImport.comingSoon",{defaultValue:"Soon"})})]}),o.jsxs("p",{className:"text-xs mt-0.5 truncate opacity-80",children:[T.description,T.requiresAuth&&!l&&o.jsxs("span",{className:"text-[10px] text-amber-400/60",children:[" ","• ",r("remoteImport.signInRequired",{defaultValue:"Sign in required"})]})]})]})]}),s===T.id&&!T.comingSoon&&o.jsx(me.div,{layoutId:"activeProvider",className:Qe("absolute left-0 top-1/2 transform -translate-y-1/2 w-1 h-8 rounded-r",T.id==="huggingface"?"bg-yellow-400":T.id==="s3"?"bg-orange-500":T.id==="google-sheets"?"bg-green-500":T.id==="custom-url"?"bg-blue-500":T.id==="gcs"?"bg-sky-500":T.id==="google-drive"?"bg-blue-600":T.id==="motherduck"?"bg-orange-300":T.id==="postgresql"?"bg-blue-600":"bg-primary"),transition:{type:"spring",stiffness:300,damping:30}})]},T.id))})})]}),o.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[o.jsx("div",{className:"p-4 border-b border-white/10 bg-gradient-to-r from-background/50 to-background/30",children:o.jsxs("div",{className:"flex items-center",children:[o.jsx("div",{className:Qe("h-8 w-8 rounded-md flex items-center justify-center mr-3 border",s==="huggingface"?"border-yellow-400/30":s==="s3"?"border-orange-500/30":s==="google-sheets"?"bg-green-500/20 border-green-500/30":s==="custom-url"?"bg-blue-500/20 border-blue-500/30":s==="gcs"?"bg-sky-500/20 border-sky-500/30":s==="google-drive"?"bg-blue-600/20 border-blue-600/30":s==="motherduck"?"border-orange-300/50":s==="postgresql"?"bg-blue-600/20 border-blue-600/30":"bg-primary/20 border-primary/30"),children:(m=a.find(T=>T.id===s))==null?void 0:m.icon}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h3",{className:"text-lg font-medium text-white",children:(p=a.find(T=>T.id===s))==null?void 0:p.label}),o.jsx("p",{className:"text-sm text-white/70",children:(g=a.find(T=>T.id===s))==null?void 0:g.description})]}),o.jsx(je,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0 rounded-full text-white/70 hover:text-white hover:bg-white/10",children:o.jsx(ur,{className:"h-4 w-4"})})]})}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(At,{mode:"wait",children:o.jsx(me.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.2},className:"h-full",children:h()},s)})})]})]})})})},Yge=({className:e=""})=>{const[t,n]=v.useState(!1),[r,a]=v.useState({top:0,left:0}),s=v.useRef(null),i=v.useRef(null),l=v.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]),c=v.useCallback(()=>{if(l(),s.current){const h=s.current.getBoundingClientRect();a({top:h.top,left:h.right+8})}n(!0)},[l]),u=v.useCallback(()=>{l(),i.current=setTimeout(()=>{n(!1)},150)},[l]);return Ht.useEffect(()=>()=>{l()},[l]),o.jsxs("div",{className:"relative ".concat(e),onMouseEnter:c,onMouseLeave:u,children:[o.jsxs("button",{ref:s,className:"flex items-center gap-2.5 px-2 py-1.5 text-xs text-white/70 hover:text-white/90 hover:bg-white/5 rounded transition-all duration-200 group w-full text-left",children:[o.jsx("svg",{className:"h-3.5 w-3.5 text-white/50 group-hover:text-white/70 transition-colors",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{className:"font-medium",children:"Help & Support"}),o.jsx("svg",{className:"h-3 w-3 text-white/40 ml-auto group-hover:text-white/60 transition-colors",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]}),o.jsx(At,{children:t&&o.jsx(me.div,{className:"absolute left-full top-0 ml-2 w-48 bg-background border border-white/10 rounded-lg shadow-xl backdrop-blur-sm",style:{zIndex:99999},onMouseEnter:c,onMouseLeave:u,initial:{opacity:0,scale:.95,x:-10},animate:{opacity:1,scale:1,x:0},exit:{opacity:0,scale:.95,x:-10},transition:{duration:.15},children:o.jsxs("div",{className:"p-1",children:[o.jsxs("a",{href:"https://docs.datakit.page/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 px-3 py-2 text-xs text-white/70 hover:text-white/90 hover:bg-white/10 rounded transition-all duration-200",children:[o.jsx("svg",{className:"h-3.5 w-3.5 text-white/50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.746 0 3.332.477 4.5 1.253v13C19.832 18.477 18.246 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),o.jsx("span",{className:"font-medium",children:"Documentation"})]}),o.jsxs("a",{href:"https://discord.gg/gZmXmhbBdP",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 px-3 py-2 text-xs text-white/70 hover:text-white/90 hover:bg-white/10 rounded transition-all duration-200",children:[o.jsx("svg",{className:"h-3.5 w-3.5 text-white/50",viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.211.375-.445.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03z"})}),o.jsx("span",{className:"font-medium",children:"Discord Community"})]}),o.jsxs("a",{href:"https://datakit.canny.io/changelog",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 px-3 py-2 text-xs text-white/70 hover:text-white/90 hover:bg-white/10 rounded transition-all duration-200",children:[o.jsx("svg",{className:"h-3.5 w-3.5 text-white/50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),o.jsx("span",{className:"font-medium",children:"What's New"})]})]})})})]})},Wge=({className:e=""})=>{const{t}=Ze(),[n,r]=v.useState(!1),[a,s]=v.useState(""),[i,l]=v.useState(""),[c,u]=v.useState(!1),[h,m]=v.useState(!1),p=()=>H(null,null,function*(){if(i.trim()){u(!0);try{const T=yield fetch("https://feedback.datakit.page/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:i,email:a||"Anonymous user",context:"sidebar"})});if(!T.ok)throw new Error("Failed to send feedback: ".concat(T.status));m(!0),setTimeout(()=>{r(!1),m(!1),l(""),s("")},2e3)}catch(g){}finally{u(!1)}}});return o.jsxs(o.Fragment,{children:[o.jsxs("button",{onClick:()=>r(!0),className:"flex items-center gap-2.5 px-2 py-1.5 text-xs text-white/70 hover:text-white/90 hover:bg-white/5 rounded transition-all duration-200 group w-full text-left ".concat(e),children:[o.jsx("svg",{className:"h-3.5 w-3.5 text-white/50 group-hover:text-white/70 transition-colors",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),o.jsx("span",{className:"font-medium",children:"Send Feedback"})]}),n&&Gh.createPortal(o.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm flex items-center justify-center z-50 p-4",onClick:()=>r(!1),children:o.jsxs("div",{className:"bg-black backdrop-blur-xl border border-white/20 rounded-lg shadow-2xl w-full max-w-md relative max-h-[90vh] overflow-y-auto",onClick:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/10",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("h2",{className:"text-lg font-medium text-white",children:t("feedback.modal.title",{defaultValue:"Share Your Feedback"})})}),o.jsx("button",{onClick:()=>r(!1),className:"text-white/70 hover:text-white transition-colors",children:o.jsx(ur,{size:20})})]}),o.jsxs("div",{className:"p-6",children:[h?o.jsxs("div",{className:"text-center py-8",children:[o.jsx("div",{className:"flex items-center justify-center mb-4",children:o.jsx("div",{className:"bg-green-500 rounded-full p-3",children:o.jsx(Pr,{size:24,className:"text-white"})})}),o.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:t("feedback.modal.success",{defaultValue:"Thank you for your feedback!"})}),o.jsx("p",{className:"text-white/70 text-sm",children:"We appreciate you taking the time to help us improve DataKit."})]}):o.jsxs("form",{onSubmit:g=>{g.preventDefault(),p()},className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/90 mb-2",children:t("feedback.modal.emailLabel",{defaultValue:"Email (optional)"})}),o.jsxs("div",{className:"relative",children:[o.jsx(OL,{size:16,className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-white/50"}),o.jsx("input",{type:"email",value:a,onChange:g=>s(g.target.value),className:"w-full pl-10 pr-4 py-3 bg-background/20 border border-white/20 rounded-md text-white placeholder-white/50 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-colors",placeholder:t("feedback.modal.emailPlaceholder",{defaultValue:"your.email@example.com"})})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/90 mb-2",children:t("feedback.modal.messageLabel",{defaultValue:"Message *"})}),o.jsxs("div",{className:"relative",children:[o.jsx(LL,{size:16,className:"absolute left-3 top-3 text-white/50"}),o.jsx("textarea",{value:i,onChange:g=>l(g.target.value),rows:4,className:"w-full pl-10 pr-4 py-3 bg-background/20 border border-white/20 rounded-md text-white placeholder-white/50 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary transition-colors resize-none",placeholder:t("feedback.modal.messagePlaceholder",{defaultValue:"Share your thoughts, suggestions, or report issues..."}),required:!0})]})]}),o.jsx(je,{variant:"outline",type:"submit",className:"w-full py-3",disabled:c||!i.trim(),children:c?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o.jsx("span",{children:"Sending..."})]}):t("common.buttons.submit",{defaultValue:"Submit"})})]}),!h&&o.jsx("div",{className:"mt-6 p-4 bg-gradient-to-r from-primary/10 to-secondary/10 rounded-md border border-primary/20",children:o.jsx("p",{className:"text-xs text-white/70 text-center",children:"Your feedback helps us improve DataKit for everyone. We read every message and appreciate your input."})})]})]})}),document.body)]})},f3=window.CUSTOM_LOGO_URL,Xge=({onDataLoad:e})=>{const{t}=Ze(),{sidebarCollapsed:n,toggleSidebar:r,isRemoteModalOpen:a,setIsRemoteModalOpen:s}=ut(),i=()=>{window.location.href="/settings"},[l,c]=v.useState(200),[u,h]=v.useState(!1),m=v.useRef(null);v.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width","".concat(l,"px"))},[]);const{showSuccess:p,showError:g}=ec(),{initializeStore:T,draftFolderId:y,remoteFolderId:b,addFile:x,getNodeById:R,expandFolder:A}=xs(),{importFileWithHandle:w,importFiles:_,reopenWorkspaceFile:N,isProcessing:I}=UL(),{isLoading:D,processingProgress:M,error:O}=Dt();v.useEffect(()=>{T()},[T]);const L=X=>{X.preventDefault(),h(!0),m.current&&m.current.classList.add("sidebar-resizing")};v.useEffect(()=>{const X=V=>{if(!u||!m.current)return;V.preventDefault();const te=Math.min(Math.max(200,V.clientX),500);document.documentElement.style.setProperty("--sidebar-width","".concat(te,"px"))},Z=V=>{if(!u||!m.current)return;const te=Math.min(Math.max(200,V.clientX),500);m.current.classList.remove("sidebar-resizing"),c(te),h(!1),document.body.style.userSelect="",document.body.style.cursor=""};if(u)return document.body.style.userSelect="none",document.body.style.cursor="col-resize",document.addEventListener("mousemove",X,{passive:!1}),document.addEventListener("mouseup",Z,{passive:!1}),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",Z),document.body.style.userSelect="",document.body.style.cursor=""}},[u]);const k=X=>{if(e&&(e(X),X.isRemote)){const Z=new File([],X.fileName,{lastModified:Date.now()});x(Z,{isRemote:!0,remoteUrl:X.remoteURL,fileType:"remote",isLoaded:!0,tableName:X.tableName},b||void 0),p(t("sidebar.remote.importedTitle"),t("sidebar.remote.importedMessage",{fileName:X.fileName,provider:X.remoteProvider||t("sidebar.remote.defaultProvider")}),{icon:"check",duration:5e3})}},F=X=>H(null,null,function*(){var ne,ce,ie,W,Q,se;if(X.type!=="file")return;if((ne=X.fileData)!=null&&ne.isTemporary&&((ce=X.fileData)!=null&&ce.tableName)){const{files:z,setActiveFile:xe,addFile:le}=ut.getState(),pe=z.find(re=>{var Se;return re.tableName===((Se=X.fileData)==null?void 0:Se.tableName)});if(pe){xe(pe.id);return}const _e={data:[],columnTypes:[],fileName:X.name.replace(/\.sql$/,""),rowCount:X.fileData.rowCount||0,columnCount:X.fileData.columnCount||0,sourceType:"TABLE",loadedToDuckDB:!0,tableName:X.fileData.tableName,isTemporary:!0,metadata:{isTemporary:!0,sourceFileName:X.fileData.sourceFileName}};le(_e);return}if((ie=X.fileData)!=null&&ie.tableName&&((W=X.fileData)!=null&&W.isLoaded)&&!((Q=X.fileData)!=null&&Q.isTemporary)&&((se=X.fileData)==null?void 0:se.fileType)==="query"){const{files:z,setActiveFile:xe,addFile:le}=ut.getState(),pe=z.find(re=>{var Se;return re.tableName===((Se=X.fileData)==null?void 0:Se.tableName)});if(pe){xe(pe.id);return}const _e={data:[],columnTypes:[],fileName:X.name,rowCount:X.fileData.rowCount||0,columnCount:X.fileData.columnCount||0,sourceType:"TABLE",loadedToDuckDB:!0,tableName:X.fileData.tableName,metadata:{isSavedTable:!0,originalName:X.name}};le(_e);return}const{workspaceFiles:Z,files:V,setActiveFile:te}=ut.getState();let ae=Z.find(z=>{var xe;return((xe=X.fileData)==null?void 0:xe.handle)&&z.handle&&z.handle===X.fileData.handle});if(ae||(ae=Z.find(z=>z.name===X.name||z.originalName===X.name)),ae){const z=V.find(xe=>xe.fileName===ae.name);if(z){te(z.id);return}try{const xe=yield N(ae,e)}catch(xe){}}else{const z=V.find(xe=>xe.fileName===X.name);if(z){te(z.id);return}g(t("sidebar.fileLoadError","Failed to Load File"),"Please re-import the file using the import button.")}}),U=X=>{},B=(X,Z,V)=>H(null,null,function*(){const te=Z||y||void 0;try{const ae=[];for(let ne=0;ne<X.length;ne++){const ce=X[ne],ie=V==null?void 0:V[ne];if(ie){const W=yield w(ie,ce,e,te);W&&ae.push(W)}else{const W=yield _([ce],e,te);W&&ae.push(...W)}}return ae}catch(ae){throw ae}}),j=I||D,G=O,K={expanded:{width:"var(--sidebar-width)"},collapsed:{width:"4rem"}},J=()=>o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"p-4"}),o.jsx("div",{className:"mb-12",children:o.jsx(e3,{collapsed:!0,onOpenFolder:()=>{},onRemoteClick:()=>s(!0)})}),o.jsx("div",{className:"mt-auto pt-4 p-4 flex flex-col items-center gap-4 border-t border-gray-500/20",children:o.jsxs("div",{className:"flex flex-col gap-2 items-center",children:[o.jsx(Ut,{content:t("sidebar.footer.settings","Settings"),placement:"right",children:o.jsx("button",{onClick:i,className:"text-white/60 hover:text-white transition-colors p-2 hover:bg-white/5 rounded","aria-label":t("sidebar.footer.settings","Settings"),children:o.jsx(qs,{size:16})})}),o.jsx("a",{href:"https://amin.contact",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary-foreground transition-custom p-2 hover:bg-background hover:bg-opacity-30 rounded","aria-label":t("sidebar.footer.visitAmin"),children:o.jsx(qi,{size:16})})]})})]}),$=()=>o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"px-5 py-4 border-b border-gray-500/20 bg-black/20 flex items-center justify-between",children:f3?o.jsx("img",{src:f3,className:"h-12 w-24 object-contain",crossOrigin:"anonymous"}):o.jsx("h1",{className:"text-white font-heading font-medium text-lg",children:t("sidebar.header.title")})}),o.jsx(e3,{collapsed:!1,onOpenFolder:()=>{},onRemoteClick:()=>s(!0)}),o.jsx("div",{className:"flex-1 overflow-y-auto overflow-x-visible border-t border-gray-500/20",children:o.jsx(Hpe,{onFileSelect:F,onFolderSelect:U})}),j&&o.jsxs("div",{className:"mx-5 mb-3 bg-background/30 p-3 border border-white/5 rounded-md",children:[o.jsxs("div",{className:"text-xs font-medium text-white text-opacity-80 mb-2 flex items-center",children:[o.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-primary mr-2 animate-pulse"}),t("sidebar.processing","Processing files...")]}),j&&o.jsx("div",{className:"w-full bg-background rounded-full h-1.5 overflow-hidden",children:o.jsx("div",{className:"bg-primary h-1.5 rounded-full transition-all duration-300",style:{width:"".concat(Math.max(5,M*100),"%")}})}),G&&o.jsx("div",{className:"text-destructive text-xs mt-2 p-2 rounded bg-background/50 border border-destructive/20",children:G})]}),o.jsxs("div",{className:"border-t border-gray-500/20 bg-black/30",children:[o.jsx("div",{className:"px-3 py-2.5 border-b border-gray-400/15",children:o.jsx(nge,{variant:"sidebar"})}),o.jsx("div",{className:"px-3 py-2.5 border-b border-gray-400/15 bg-black/20",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("a",{href:"https://datakit.studio",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 px-2 py-1.5 text-xs hover:bg-white/5 rounded transition-all duration-200 group",children:[o.jsx("svg",{className:"h-3.5 w-3.5 text-white/50 group-hover:text-white/70 transition-colors",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),o.jsx("span",{className:"font-medium bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent",children:"DataKit Studio"})]}),o.jsx(Yge,{}),o.jsx(Wge,{context:"sidebar"})]})}),o.jsx("div",{className:"px-2 py-2 border-t border-gray-400/15 bg-black/40",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"hidden xl:block",children:o.jsxs("p",{className:"text-[10px] text-white text-opacity-30 flex items-center flex-wrap",children:[t("sidebar.footer.poweredBy")," ",o.jsx("a",{href:"https://duckdb.org/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center mx-1",children:o.jsx("img",{src:yO,className:"h-3 w-3 transition-colors hover:opacity-80",alt:"DuckDB"})}),o.jsx("a",{href:"https://amin.contact",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t("sidebar.footer.built")})," @ ",o.jsx("a",{href:"https://www.linkedin.com/company/datakitpage",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t("sidebar.footer.company")})]})}),o.jsx("div",{className:"block xl:hidden",children:o.jsxs("div",{className:"text-[9px] text-white text-opacity-30 space-y-1",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("span",{children:t("sidebar.footer.poweredBy")}),o.jsx("a",{href:"https://duckdb.org/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center ml-1",children:o.jsx("img",{src:yO,className:"h-2.5 w-2.5 transition-colors hover:opacity-80",alt:"DuckDB"})})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("a",{href:"https://amin.contact",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:t("sidebar.footer.built")}),o.jsx("span",{children:"@"}),o.jsx("a",{href:"https://www.linkedin.com/company/datakitpage",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline truncate",children:t("sidebar.footer.company")})]})]})})]}),o.jsx("div",{className:"flex-shrink-0 ml-2",children:o.jsx(Vpe,{variant:"sidebar"})})]})})]})]});return o.jsxs(o.Fragment,{children:[o.jsxs(me.div,{ref:m,className:"relative bg-darkNav flex flex-col h-full border-r border-gray-500/20 overflow-visible sidebar-container ".concat(n?"sidebar-collapsed":""),initial:n?"collapsed":"expanded",animate:n?"collapsed":"expanded",variants:K,transition:{duration:.3,ease:"easeInOut"},children:[n?J():$(),!n&&o.jsxs("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize group",onMouseDown:L,children:[o.jsx("div",{className:"absolute top-0 right-0 w-1 h-full transition-all duration-150 ease-out ".concat(u?"opacity-100":"opacity-0 group-hover:opacity-80"),style:{background:u?"linear-gradient(to bottom, transparent 0%, hsl(175 100% 36% / 0.6) 10%, hsl(175 100% 45% / 0.7) 30%, hsl(175 100% 55% / 0.5) 50%, hsl(175 100% 45% / 0.7) 70%, hsl(175 100% 36% / 0.6) 90%, transparent 100%)":"linear-gradient(to bottom, transparent 0%, hsl(175 100% 36% / 0.7) 15%, hsl(175 100% 45% / 0.5) 35%, hsl(175 100% 55% / 0.4) 50%, hsl(175 100% 45% / 0.5) 65%, hsl(175 100% 36% / 0.7) 85%, transparent 100%)"}}),u&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"absolute top-0 right-0 w-3 h-full opacity-25 blur-sm transition-all duration-150",style:{background:"linear-gradient(to bottom, transparent 0%, hsl(175 100% 36% / 0.3) 15%, hsl(175 100% 45% / 0.25) 40%, hsl(175 100% 55% / 0.15) 50%, hsl(175 100% 45% / 0.25) 60%, hsl(175 100% 36% / 0.3) 85%, transparent 100%)"}}),o.jsx("div",{className:"absolute top-0 right-0 w-6 h-full opacity-15 blur-md transition-all duration-150",style:{background:"linear-gradient(to bottom, transparent 0%, hsl(175 100% 36% / 0.15) 20%, hsl(175 100% 45% / 0.1) 50%, hsl(175 100% 36% / 0.15) 80%, transparent 100%)"}})]})]}),o.jsx("button",{onClick:r,className:"absolute top-3 w-8 h-8 flex items-center justify-center text-white/70 hover:text-white hover:border-white/10 transition-colors shadow-lg cursor-pointer rounded-md hover:bg-white/10 ".concat(n?"left-1/2 transform -translate-x-1/2":"right-3"),"aria-label":t(n?"sidebar.expand":"sidebar.collapse"),children:n?o.jsx(nr,{size:16}):o.jsx(Dg,{size:16})})]}),o.jsx(qge,{isOpen:a,onClose:()=>s(!1),onImport:k}),o.jsx(hpe,{onFileDrop:B,isProcessing:j})]})},Kge=({children:e,onDataLoad:t})=>{const{sidebarCollapsed:n}=ut();v.useEffect(()=>{const a=s=>{(s.ctrlKey||s.metaKey)&&s.key==="b"&&(s.preventDefault(),ut.getState().toggleSidebar())};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[]);const r={sidebarExpanded:{marginLeft:"0",width:"calc(100% - var(--sidebar-width, 16rem))"},sidebarCollapsed:{marginLeft:"0",width:"calc(100% - 4rem)"}};return o.jsxs("div",{className:"flex h-full bg-background overflow-visible",children:[o.jsx("div",{className:"relative",children:o.jsx(Xge,{onDataLoad:t})}),o.jsx(me.main,{className:"flex-1 h-full overflow-hidden relative z-10 flex flex-col",initial:n?"sidebarCollapsed":"sidebarExpanded",animate:n?"sidebarCollapsed":"sidebarExpanded",variants:r,transition:{duration:.3,ease:"easeInOut"},children:o.jsx("div",{className:"flex-1 overflow-hidden",children:e})})]})};let m3=[],p3=-1,g3=null;const kr=e=>e.files.find(t=>t.id===e.activeFileId)||null,Qge=e=>{const t=e.files.length!==p3,n=e.activeFileId!==g3;return(t||n)&&(m3=e.files.map(r=>({id:r==null?void 0:r.id,fileName:r==null?void 0:r.fileName,sourceType:r==null?void 0:r.sourceType,isActive:(r==null?void 0:r.id)===(e==null?void 0:e.activeFileId),remoteProvider:r==null?void 0:r.remoteProvider,hasGoogleSheetsMetadata:!!r.googleSheets,splitView:r!=null&&r.splitView?{isActive:r.splitView.isActive,partnerId:r.splitView.partnerId}:void 0})),p3=e.files.length,g3=e.activeFileId),m3},u7=e=>e.files.length>0,Jge=e=>{var t;return((t=kr(e))==null?void 0:t.fileName)||""},Zge=e=>{var t;return((t=kr(e))==null?void 0:t.sourceType)||tr.CSV},eEe=e=>{var t;return((t=kr(e))==null?void 0:t.jsonSchema)||null},X0=e=>{var t;return(t=kr(e))==null?void 0:t.tableName},tEe=e=>{var t;return(t=kr(e))==null?void 0:t.remoteURL},nEe=e=>{var t;return(t=kr(e))==null?void 0:t.remoteProvider},rEe=e=>{var t;return(t=kr(e))==null?void 0:t.googleSheets},d7=e=>{const t=kr(e);return t||null},aEe=e=>{var t;return((t=e.splitView)==null?void 0:t.splitRatio)||.5},E3=()=>({currentPage:1,rowsPerPage:1e3,totalRows:null,totalPages:0,data:null,columns:null,isLoading:!1,isCountLoading:!1,error:null,lastFetchTime:0}),h7=Ki((e,t)=>({fileStates:new Map,initializeFileState:n=>{e(r=>{const a=new Map(r.fileStates);return a.has(n)||a.set(n,E3()),{fileStates:a}})},updateFileState:(n,r)=>{e(a=>{const s=new Map(a.fileStates),i=s.get(n)||E3();return s.set(n,q(q({},i),r)),{fileStates:s}})},getFileState:n=>t().fileStates.get(n),clearFileState:n=>{e(r=>{const a=new Map(r.fileStates);return a.delete(n),{fileStates:a}})},clearAllStates:()=>{e({fileStates:new Map})}}));ut.subscribe(e=>e.files,e=>{const t=h7.getState(),n=new Set(e.map(r=>r.id));t.fileStates.forEach((r,a)=>{n.has(a)||t.clearFileState(a)})});const sEe=e=>{const t=ut(kr),{executePaginatedQuery:n,getObjectType:r}=Dt(),{getFileState:a,updateFileState:s,initializeFileState:i}=h7(),[l,c]=v.useState(!1),u=e||(t==null?void 0:t.id)||"",h=a(u)||{currentPage:1,rowsPerPage:1e3,totalRows:0,totalPages:0,data:null,columns:null,isLoading:!1,isCountLoading:!1,error:null,lastFetchTime:0},m=e?ut.getState().files.find(x=>x.id===e):t;v.useEffect(()=>{u&&i(u)},[u,i]);const p=v.useCallback(()=>H(null,null,function*(){var R,A,w,_;if(!(m!=null&&m.tableName)||!u)return;const x=a(u);if(!(x!=null&&x.data&&x.lastFetchTime>Date.now()-5*60*1e3))try{s(u,{isLoading:!0,error:null});const N=m.tableName;if(m.isRemote&&m.remoteProvider==="postgresql"){const M=m.postgresql;if(!M)throw new Error("PostgreSQL connection information not found");const{connectionId:O,schema:L,table:k}=M;if(!L||!k)throw new Error('Invalid PostgreSQL table metadata: schema="'.concat(L,'", table="').concat(k,'"'));const F=h.rowsPerPage||1e3,U={sql:'SELECT * FROM "'.concat(L,'"."').concat(k,'" LIMIT ').concat(F),timeout:3e4},B=yield ua.executeQuery(O,U);if(B.success&&B.data){const j=((R=B.columns)==null?void 0:R.map($=>$.name))||[],G=B.data||[],K=G.map(($,X)=>{const Z=j.map(V=>String($[V]||""));return[(X+1).toString(),...Z]}),J=[[" ",...j],...K];s(u,{data:J,columns:j,totalRows:((A=B.metadata)==null?void 0:A.rowCount)||G.length,totalPages:Math.ceil((((w=B.metadata)==null?void 0:w.rowCount)||G.length)/F),currentPage:1,isLoading:!1,lastFetchTime:Date.now()})}else throw new Error(((_=B.error)==null?void 0:_.message)||"Failed to execute PostgreSQL query");return}if(!N||N.trim()==="")throw new Error("Invalid table name for DuckDB query");const I='SELECT * FROM "'.concat(N,'"'),D=yield n(I,1,h.rowsPerPage||1e3,!0,!1);if(D){const M=D.columns,L=D.data.map((F,U)=>{const B=M.map(j=>String(F[j]||""));return[(U+1).toString(),...B]}),k=[[" ",...M],...L];s(u,{data:k,columns:M,totalRows:0,totalPages:0,currentPage:1,isLoading:!1,lastFetchTime:Date.now()}),g(u,N)}}catch(N){s(u,{error:N instanceof Error?N.message:"Failed to load data",isLoading:!1})}}),[m,u,n,h.rowsPerPage,a,s]),g=v.useCallback((x,R)=>H(null,null,function*(){try{if((yield r(R))==="view"){s(x,{totalRows:-1,totalPages:-1,isCountLoading:!1});return}s(x,{isCountLoading:!0});const w='SELECT COUNT(*) as total_rows FROM "'.concat(R,'"'),_=yield n(w,1,1,!1,!1);if(_&&_.data.length>0){const N=Number(_.data[0].total_rows)||0,I=a(x),D=(I==null?void 0:I.rowsPerPage)||1e3;s(x,{totalRows:N,totalPages:Math.ceil(N/D),isCountLoading:!1})}}catch(A){s(x,{isCountLoading:!1})}}),[n,a,s,r]),T=v.useCallback(x=>H(null,null,function*(){var A,w;if(!(t!=null&&t.tableName)||!(t!=null&&t.id))return;const R=a(t.id);if(R&&!(x<1||x===R.currentPage)&&!(R.totalPages>0&&x>R.totalPages))try{c(!0),s(t.id,{error:null});const _=t.tableName;if(t.isRemote&&t.remoteProvider==="postgresql"){const N=t.postgresql;if(!N)throw new Error("PostgreSQL connection information not found");const{connectionId:I,schema:D,table:M}=N,O=(x-1)*R.rowsPerPage,L={sql:'SELECT * FROM "'.concat(D,'"."').concat(M,'" LIMIT ').concat(R.rowsPerPage," OFFSET ").concat(O),timeout:3e4},k=yield ua.executeQuery(I,L);if(k.success&&k.data){const F=((A=k.columns)==null?void 0:A.map(G=>G.name))||[],B=(k.data||[]).map((G,K)=>{const J=F.map($=>String(G[$]||""));return[(O+K+1).toString(),...J]}),j=[[" ",...F],...B];s(t.id,{data:j,currentPage:x,lastFetchTime:Date.now()})}else throw new Error(((w=k.error)==null?void 0:w.message)||"Failed to execute PostgreSQL query")}else{if(!_||_.trim()==="")throw new Error("Invalid table name for DuckDB query");const N='SELECT * FROM "'.concat(_,'"'),I=yield n(N,x,R.rowsPerPage,!0,!1);if(I){const D=(x-1)*R.rowsPerPage,M=I.data.map((L,k)=>{const F=I.columns.map(U=>String(L[U]||""));return[(D+k+1).toString(),...F]}),O=[[" ",...I.columns],...M];s(t.id,{data:O,currentPage:x,lastFetchTime:Date.now()})}}}catch(_){s(t.id,{error:_ instanceof Error?_.message:"Error fetching page data"})}finally{c(!1)}}),[t,n,a,s]),y=v.useCallback(x=>H(null,null,function*(){var R,A;if(!(!(t!=null&&t.tableName)||!(t!=null&&t.id)))try{c(!0),s(t.id,{error:null,rowsPerPage:x});const w=t.tableName;if(t.isRemote&&t.remoteProvider==="postgresql"){const _=t.postgresql;if(!_)throw new Error("PostgreSQL connection information not found");const{connectionId:N,schema:I,table:D}=_,M={sql:'SELECT * FROM "'.concat(I,'"."').concat(D,'" LIMIT ').concat(x),timeout:3e4},O=yield ua.executeQuery(N,M);if(O.success&&O.data){const L=((R=O.columns)==null?void 0:R.map(G=>G.name))||[],F=(O.data||[]).map((G,K)=>{const J=L.map($=>String(G[$]||""));return[(K+1).toString(),...J]}),U=[[" ",...L],...F],B=a(t.id),j=(B==null?void 0:B.totalRows)||0;s(t.id,{data:U,columns:L,totalPages:j>0?Math.ceil(j/x):0,currentPage:1,lastFetchTime:Date.now()})}else throw new Error(((A=O.error)==null?void 0:A.message)||"Failed to execute PostgreSQL query")}else{if(!w||w.trim()==="")throw new Error("Invalid table name for DuckDB query");const _='SELECT * FROM "'.concat(w,'"'),N=yield n(_,1,x,!0,!1);if(N){const I=N.data.map((L,k)=>{const F=N.columns.map(U=>String(L[U]||""));return[(k+1).toString(),...F]}),D=[[" ",...N.columns],...I],M=a(t.id),O=(M==null?void 0:M.totalRows)||0;s(t.id,{data:D,columns:N.columns,totalPages:O>0?Math.ceil(O/x):0,currentPage:1,lastFetchTime:Date.now()})}}}catch(w){s(t.id,{error:w instanceof Error?w.message:"Error changing results per page"})}finally{c(!1)}}),[t,n,s,a]),b=v.useCallback(()=>H(null,null,function*(){if(!(t!=null&&t.id))return;const x=a(t.id);x&&(s(t.id,{lastFetchTime:0}),x.currentPage===1?yield p():yield T(x.currentPage))}),[t,a,s,p,T]);return{results:h.data,columns:h.columns,error:h.error,totalRows:h.totalRows||0,currentPage:h.currentPage,totalPages:h.totalPages,rowsPerPage:h.rowsPerPage,isLoading:h.isLoading,isChangingPage:l,isCountLoading:h.isCountLoading,loadInitialData:p,changePage:T,changeRowsPerPage:y,refreshData:b}};function By(){return By=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},By.apply(null,arguments)}function Hy(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bO(e,t){return bO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},bO(e,t)}function f7(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,bO(e,t)}var T3=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function iEe(e,t){return!!(e===t||T3(e)&&T3(t))}function oEe(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!iEe(e[n],t[n]))return!1;return!0}function fh(e,t){t===void 0&&(t=oEe);var n,r=[],a,s=!1;function i(){for(var l=[],c=0;c<arguments.length;c++)l[c]=arguments[c];return s&&n===this&&t(l,r)||(a=e.apply(this,l),s=!0,n=this,r=l),a}return i}var lEe=typeof performance=="object"&&typeof performance.now=="function",y3=lEe?function(){return performance.now()}:function(){return Date.now()};function Vy(e){cancelAnimationFrame(e.id)}function m7(e,t){var n=y3();function r(){y3()-n>=t?e.call(null):a.id=requestAnimationFrame(r)}var a={id:requestAnimationFrame(r)};return a}var CA=-1;function vO(e){if(e===void 0&&(e=!1),CA===-1||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",document.body.appendChild(t),CA=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return CA}var Ad=null;function Gy(e){if(e===void 0&&(e=!1),Ad===null||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),a=r.style;return a.width="100px",a.height="100px",t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?Ad="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Ad="negative":Ad="positive-ascending"),document.body.removeChild(t),Ad}return Ad}var cEe=150,uEe=function(t){var n=t.columnIndex;t.data;var r=t.rowIndex;return r+":"+n};function dEe(e){var t,n=e.getColumnOffset,r=e.getColumnStartIndexForOffset,a=e.getColumnStopIndexForStartIndex,s=e.getColumnWidth,i=e.getEstimatedTotalHeight,l=e.getEstimatedTotalWidth,c=e.getOffsetForColumnAndAlignment,u=e.getOffsetForRowAndAlignment,h=e.getRowHeight,m=e.getRowOffset,p=e.getRowStartIndexForOffset,g=e.getRowStopIndexForStartIndex,T=e.initInstanceProps,y=e.shouldResetStyleCacheOnItemSizeChange,b=e.validateProps;return t=function(x){f7(R,x);function R(w){var _;return _=x.call(this,w)||this,_._instanceProps=T(_.props,Hy(_)),_._resetIsScrollingTimeoutId=null,_._outerRef=void 0,_.state={instance:Hy(_),isScrolling:!1,horizontalScrollDirection:"forward",scrollLeft:typeof _.props.initialScrollLeft=="number"?_.props.initialScrollLeft:0,scrollTop:typeof _.props.initialScrollTop=="number"?_.props.initialScrollTop:0,scrollUpdateWasRequested:!1,verticalScrollDirection:"forward"},_._callOnItemsRendered=void 0,_._callOnItemsRendered=fh(function(N,I,D,M,O,L,k,F){return _.props.onItemsRendered({overscanColumnStartIndex:N,overscanColumnStopIndex:I,overscanRowStartIndex:D,overscanRowStopIndex:M,visibleColumnStartIndex:O,visibleColumnStopIndex:L,visibleRowStartIndex:k,visibleRowStopIndex:F})}),_._callOnScroll=void 0,_._callOnScroll=fh(function(N,I,D,M,O){return _.props.onScroll({horizontalScrollDirection:D,scrollLeft:N,scrollTop:I,verticalScrollDirection:M,scrollUpdateWasRequested:O})}),_._getItemStyle=void 0,_._getItemStyle=function(N,I){var D=_.props,M=D.columnWidth,O=D.direction,L=D.rowHeight,k=_._getItemStyleCache(y&&M,y&&O,y&&L),F=N+":"+I,U;if(k.hasOwnProperty(F))U=k[F];else{var B=n(_.props,I,_._instanceProps),j=O==="rtl";k[F]=U={position:"absolute",left:j?void 0:B,right:j?B:void 0,top:m(_.props,N,_._instanceProps),height:h(_.props,N,_._instanceProps),width:s(_.props,I,_._instanceProps)}}return U},_._getItemStyleCache=void 0,_._getItemStyleCache=fh(function(N,I,D){return{}}),_._onScroll=function(N){var I=N.currentTarget,D=I.clientHeight,M=I.clientWidth,O=I.scrollLeft,L=I.scrollTop,k=I.scrollHeight,F=I.scrollWidth;_.setState(function(U){if(U.scrollLeft===O&&U.scrollTop===L)return null;var B=_.props.direction,j=O;if(B==="rtl")switch(Gy()){case"negative":j=-O;break;case"positive-descending":j=F-M-O;break}j=Math.max(0,Math.min(j,F-M));var G=Math.max(0,Math.min(L,k-D));return{isScrolling:!0,horizontalScrollDirection:U.scrollLeft<O?"forward":"backward",scrollLeft:j,scrollTop:G,verticalScrollDirection:U.scrollTop<L?"forward":"backward",scrollUpdateWasRequested:!1}},_._resetIsScrollingDebounced)},_._outerRefSetter=function(N){var I=_.props.outerRef;_._outerRef=N,typeof I=="function"?I(N):I!=null&&typeof I=="object"&&I.hasOwnProperty("current")&&(I.current=N)},_._resetIsScrollingDebounced=function(){_._resetIsScrollingTimeoutId!==null&&Vy(_._resetIsScrollingTimeoutId),_._resetIsScrollingTimeoutId=m7(_._resetIsScrolling,cEe)},_._resetIsScrolling=function(){_._resetIsScrollingTimeoutId=null,_.setState({isScrolling:!1},function(){_._getItemStyleCache(-1)})},_}R.getDerivedStateFromProps=function(_,N){return hEe(_,N),b(_),null};var A=R.prototype;return A.scrollTo=function(_){var N=_.scrollLeft,I=_.scrollTop;N!==void 0&&(N=Math.max(0,N)),I!==void 0&&(I=Math.max(0,I)),this.setState(function(D){return N===void 0&&(N=D.scrollLeft),I===void 0&&(I=D.scrollTop),D.scrollLeft===N&&D.scrollTop===I?null:{horizontalScrollDirection:D.scrollLeft<N?"forward":"backward",scrollLeft:N,scrollTop:I,scrollUpdateWasRequested:!0,verticalScrollDirection:D.scrollTop<I?"forward":"backward"}},this._resetIsScrollingDebounced)},A.scrollToItem=function(_){var N=_.align,I=N===void 0?"auto":N,D=_.columnIndex,M=_.rowIndex,O=this.props,L=O.columnCount,k=O.height,F=O.rowCount,U=O.width,B=this.state,j=B.scrollLeft,G=B.scrollTop,K=vO();D!==void 0&&(D=Math.max(0,Math.min(D,L-1))),M!==void 0&&(M=Math.max(0,Math.min(M,F-1)));var J=i(this.props,this._instanceProps),$=l(this.props,this._instanceProps),X=$>U?K:0,Z=J>k?K:0;this.scrollTo({scrollLeft:D!==void 0?c(this.props,D,I,j,this._instanceProps,Z):j,scrollTop:M!==void 0?u(this.props,M,I,G,this._instanceProps,X):G})},A.componentDidMount=function(){var _=this.props,N=_.initialScrollLeft,I=_.initialScrollTop;if(this._outerRef!=null){var D=this._outerRef;typeof N=="number"&&(D.scrollLeft=N),typeof I=="number"&&(D.scrollTop=I)}this._callPropsCallbacks()},A.componentDidUpdate=function(){var _=this.props.direction,N=this.state,I=N.scrollLeft,D=N.scrollTop,M=N.scrollUpdateWasRequested;if(M&&this._outerRef!=null){var O=this._outerRef;if(_==="rtl")switch(Gy()){case"negative":O.scrollLeft=-I;break;case"positive-ascending":O.scrollLeft=I;break;default:var L=O.clientWidth,k=O.scrollWidth;O.scrollLeft=k-L-I;break}else O.scrollLeft=Math.max(0,I);O.scrollTop=Math.max(0,D)}this._callPropsCallbacks()},A.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Vy(this._resetIsScrollingTimeoutId)},A.render=function(){var _=this.props,N=_.children,I=_.className,D=_.columnCount,M=_.direction,O=_.height,L=_.innerRef,k=_.innerElementType,F=_.innerTagName,U=_.itemData,B=_.itemKey,j=B===void 0?uEe:B,G=_.outerElementType,K=_.outerTagName,J=_.rowCount,$=_.style,X=_.useIsScrolling,Z=_.width,V=this.state.isScrolling,te=this._getHorizontalRangeToRender(),ae=te[0],ne=te[1],ce=this._getVerticalRangeToRender(),ie=ce[0],W=ce[1],Q=[];if(D>0&&J)for(var se=ie;se<=W;se++)for(var z=ae;z<=ne;z++)Q.push(v.createElement(N,{columnIndex:z,data:U,isScrolling:X?V:void 0,key:j({columnIndex:z,data:U,rowIndex:se}),rowIndex:se,style:this._getItemStyle(se,z)}));var xe=i(this.props,this._instanceProps),le=l(this.props,this._instanceProps);return v.createElement(G||K||"div",{className:I,onScroll:this._onScroll,ref:this._outerRefSetter,style:By({position:"relative",height:O,width:Z,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:M},$)},v.createElement(k||F||"div",{children:Q,ref:L,style:{height:xe,pointerEvents:V?"none":void 0,width:le}}))},A._callPropsCallbacks=function(){var _=this.props,N=_.columnCount,I=_.onItemsRendered,D=_.onScroll,M=_.rowCount;if(typeof I=="function"&&N>0&&M>0){var O=this._getHorizontalRangeToRender(),L=O[0],k=O[1],F=O[2],U=O[3],B=this._getVerticalRangeToRender(),j=B[0],G=B[1],K=B[2],J=B[3];this._callOnItemsRendered(L,k,j,G,F,U,K,J)}if(typeof D=="function"){var $=this.state,X=$.horizontalScrollDirection,Z=$.scrollLeft,V=$.scrollTop,te=$.scrollUpdateWasRequested,ae=$.verticalScrollDirection;this._callOnScroll(Z,V,X,ae,te)}},A._getHorizontalRangeToRender=function(){var _=this.props,N=_.columnCount,I=_.overscanColumnCount,D=_.overscanColumnsCount,M=_.overscanCount,O=_.rowCount,L=this.state,k=L.horizontalScrollDirection,F=L.isScrolling,U=L.scrollLeft,B=I||D||M||1;if(N===0||O===0)return[0,0,0,0];var j=r(this.props,U,this._instanceProps),G=a(this.props,j,U,this._instanceProps),K=!F||k==="backward"?Math.max(1,B):1,J=!F||k==="forward"?Math.max(1,B):1;return[Math.max(0,j-K),Math.max(0,Math.min(N-1,G+J)),j,G]},A._getVerticalRangeToRender=function(){var _=this.props,N=_.columnCount,I=_.overscanCount,D=_.overscanRowCount,M=_.overscanRowsCount,O=_.rowCount,L=this.state,k=L.isScrolling,F=L.verticalScrollDirection,U=L.scrollTop,B=D||M||I||1;if(N===0||O===0)return[0,0,0,0];var j=p(this.props,U,this._instanceProps),G=g(this.props,j,U,this._instanceProps),K=!k||F==="backward"?Math.max(1,B):1,J=!k||F==="forward"?Math.max(1,B):1;return[Math.max(0,j-K),Math.max(0,Math.min(O-1,G+J)),j,G]},R}(v.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,useIsScrolling:!1},t}var hEe=function(t,n){t.children,t.direction,t.height,t.innerTagName,t.outerTagName,t.overscanColumnsCount,t.overscanCount,t.overscanRowsCount,t.width,n.instance},x3=50,p7=function(t,n){var r=t.rowCount,a=n.rowMetadataMap,s=n.estimatedRowHeight,i=n.lastMeasuredRowIndex,l=0;if(i>=r&&(i=r-1),i>=0){var c=a[i];l=c.offset+c.size}var u=r-i-1,h=u*s;return l+h},g7=function(t,n){var r=t.columnCount,a=n.columnMetadataMap,s=n.estimatedColumnWidth,i=n.lastMeasuredColumnIndex,l=0;if(i>=r&&(i=r-1),i>=0){var c=a[i];l=c.offset+c.size}var u=r-i-1,h=u*s;return l+h},wo=function(t,n,r,a){var s,i,l;if(t==="column"?(s=a.columnMetadataMap,i=n.columnWidth,l=a.lastMeasuredColumnIndex):(s=a.rowMetadataMap,i=n.rowHeight,l=a.lastMeasuredRowIndex),r>l){var c=0;if(l>=0){var u=s[l];c=u.offset+u.size}for(var h=l+1;h<=r;h++){var m=i(h);s[h]={offset:c,size:m},c+=m}t==="column"?a.lastMeasuredColumnIndex=r:a.lastMeasuredRowIndex=r}return s[r]},S3=function(t,n,r,a){var s,i;t==="column"?(s=r.columnMetadataMap,i=r.lastMeasuredColumnIndex):(s=r.rowMetadataMap,i=r.lastMeasuredRowIndex);var l=i>0?s[i].offset:0;return l>=a?E7(t,n,r,i,0,a):fEe(t,n,r,Math.max(0,i),a)},E7=function(t,n,r,a,s,i){for(;s<=a;){var l=s+Math.floor((a-s)/2),c=wo(t,n,l,r).offset;if(c===i)return l;c<i?s=l+1:c>i&&(a=l-1)}return s>0?s-1:0},fEe=function(t,n,r,a,s){for(var i=t==="column"?n.columnCount:n.rowCount,l=1;a<i&&wo(t,n,a,r).offset<s;)a+=l,l*=2;return E7(t,n,r,Math.min(a,i-1),Math.floor(a/2),s)},b3=function(t,n,r,a,s,i,l){var c=t==="column"?n.width:n.height,u=wo(t,n,r,i),h=t==="column"?g7(n,i):p7(n,i),m=Math.max(0,Math.min(h-c,u.offset)),p=Math.max(0,u.offset-c+l+u.size);switch(a==="smart"&&(s>=p-c&&s<=m+c?a="auto":a="center"),a){case"start":return m;case"end":return p;case"center":return Math.round(p+(m-p)/2);case"auto":default:return s>=p&&s<=m?s:p>m||s<p?p:m}},mEe=dEe({getColumnOffset:function(t,n,r){return wo("column",t,n,r).offset},getColumnStartIndexForOffset:function(t,n,r){return S3("column",t,r,n)},getColumnStopIndexForStartIndex:function(t,n,r,a){for(var s=t.columnCount,i=t.width,l=wo("column",t,n,a),c=r+i,u=l.offset+l.size,h=n;h<s-1&&u<c;)h++,u+=wo("column",t,h,a).size;return h},getColumnWidth:function(t,n,r){return r.columnMetadataMap[n].size},getEstimatedTotalHeight:p7,getEstimatedTotalWidth:g7,getOffsetForColumnAndAlignment:function(t,n,r,a,s,i){return b3("column",t,n,r,a,s,i)},getOffsetForRowAndAlignment:function(t,n,r,a,s,i){return b3("row",t,n,r,a,s,i)},getRowOffset:function(t,n,r){return wo("row",t,n,r).offset},getRowHeight:function(t,n,r){return r.rowMetadataMap[n].size},getRowStartIndexForOffset:function(t,n,r){return S3("row",t,r,n)},getRowStopIndexForStartIndex:function(t,n,r,a){for(var s=t.rowCount,i=t.height,l=wo("row",t,n,a),c=r+i,u=l.offset+l.size,h=n;h<s-1&&u<c;)h++,u+=wo("row",t,h,a).size;return h},initInstanceProps:function(t,n){var r=t,a=r.estimatedColumnWidth,s=r.estimatedRowHeight,i={columnMetadataMap:{},estimatedColumnWidth:a||x3,estimatedRowHeight:s||x3,lastMeasuredColumnIndex:-1,lastMeasuredRowIndex:-1,rowMetadataMap:{}};return n.resetAfterColumnIndex=function(l,c){c===void 0&&(c=!0),n.resetAfterIndices({columnIndex:l,shouldForceUpdate:c})},n.resetAfterRowIndex=function(l,c){c===void 0&&(c=!0),n.resetAfterIndices({rowIndex:l,shouldForceUpdate:c})},n.resetAfterIndices=function(l){var c=l.columnIndex,u=l.rowIndex,h=l.shouldForceUpdate,m=h===void 0?!0:h;typeof c=="number"&&(i.lastMeasuredColumnIndex=Math.min(i.lastMeasuredColumnIndex,c-1)),typeof u=="number"&&(i.lastMeasuredRowIndex=Math.min(i.lastMeasuredRowIndex,u-1)),n._getItemStyleCache(-1),m&&n.forceUpdate()},i},shouldResetStyleCacheOnItemSizeChange:!1,validateProps:function(t){t.columnWidth,t.rowHeight}}),pEe=150,gEe=function(t,n){return t};function EEe(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,a=e.getItemSize,s=e.getOffsetForIndexAndAlignment,i=e.getStartIndexForOffset,l=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,h=e.validateProps;return t=function(m){f7(p,m);function p(T){var y;return y=m.call(this,T)||this,y._instanceProps=c(y.props,Hy(y)),y._outerRef=void 0,y._resetIsScrollingTimeoutId=null,y.state={instance:Hy(y),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof y.props.initialScrollOffset=="number"?y.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},y._callOnItemsRendered=void 0,y._callOnItemsRendered=fh(function(b,x,R,A){return y.props.onItemsRendered({overscanStartIndex:b,overscanStopIndex:x,visibleStartIndex:R,visibleStopIndex:A})}),y._callOnScroll=void 0,y._callOnScroll=fh(function(b,x,R){return y.props.onScroll({scrollDirection:b,scrollOffset:x,scrollUpdateWasRequested:R})}),y._getItemStyle=void 0,y._getItemStyle=function(b){var x=y.props,R=x.direction,A=x.itemSize,w=x.layout,_=y._getItemStyleCache(u&&A,u&&w,u&&R),N;if(_.hasOwnProperty(b))N=_[b];else{var I=n(y.props,b,y._instanceProps),D=a(y.props,b,y._instanceProps),M=R==="horizontal"||w==="horizontal",O=R==="rtl",L=M?I:0;_[b]=N={position:"absolute",left:O?void 0:L,right:O?L:void 0,top:M?0:I,height:M?"100%":D,width:M?D:"100%"}}return N},y._getItemStyleCache=void 0,y._getItemStyleCache=fh(function(b,x,R){return{}}),y._onScrollHorizontal=function(b){var x=b.currentTarget,R=x.clientWidth,A=x.scrollLeft,w=x.scrollWidth;y.setState(function(_){if(_.scrollOffset===A)return null;var N=y.props.direction,I=A;if(N==="rtl")switch(Gy()){case"negative":I=-A;break;case"positive-descending":I=w-R-A;break}return I=Math.max(0,Math.min(I,w-R)),{isScrolling:!0,scrollDirection:_.scrollOffset<I?"forward":"backward",scrollOffset:I,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._onScrollVertical=function(b){var x=b.currentTarget,R=x.clientHeight,A=x.scrollHeight,w=x.scrollTop;y.setState(function(_){if(_.scrollOffset===w)return null;var N=Math.max(0,Math.min(w,A-R));return{isScrolling:!0,scrollDirection:_.scrollOffset<N?"forward":"backward",scrollOffset:N,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._outerRefSetter=function(b){var x=y.props.outerRef;y._outerRef=b,typeof x=="function"?x(b):x!=null&&typeof x=="object"&&x.hasOwnProperty("current")&&(x.current=b)},y._resetIsScrollingDebounced=function(){y._resetIsScrollingTimeoutId!==null&&Vy(y._resetIsScrollingTimeoutId),y._resetIsScrollingTimeoutId=m7(y._resetIsScrolling,pEe)},y._resetIsScrolling=function(){y._resetIsScrollingTimeoutId=null,y.setState({isScrolling:!1},function(){y._getItemStyleCache(-1,null)})},y}p.getDerivedStateFromProps=function(y,b){return TEe(y,b),h(y),null};var g=p.prototype;return g.scrollTo=function(y){y=Math.max(0,y),this.setState(function(b){return b.scrollOffset===y?null:{scrollDirection:b.scrollOffset<y?"forward":"backward",scrollOffset:y,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},g.scrollToItem=function(y,b){b===void 0&&(b="auto");var x=this.props,R=x.itemCount,A=x.layout,w=this.state.scrollOffset;y=Math.max(0,Math.min(y,R-1));var _=0;if(this._outerRef){var N=this._outerRef;A==="vertical"?_=N.scrollWidth>N.clientWidth?vO():0:_=N.scrollHeight>N.clientHeight?vO():0}this.scrollTo(s(this.props,y,b,w,this._instanceProps,_))},g.componentDidMount=function(){var y=this.props,b=y.direction,x=y.initialScrollOffset,R=y.layout;if(typeof x=="number"&&this._outerRef!=null){var A=this._outerRef;b==="horizontal"||R==="horizontal"?A.scrollLeft=x:A.scrollTop=x}this._callPropsCallbacks()},g.componentDidUpdate=function(){var y=this.props,b=y.direction,x=y.layout,R=this.state,A=R.scrollOffset,w=R.scrollUpdateWasRequested;if(w&&this._outerRef!=null){var _=this._outerRef;if(b==="horizontal"||x==="horizontal")if(b==="rtl")switch(Gy()){case"negative":_.scrollLeft=-A;break;case"positive-ascending":_.scrollLeft=A;break;default:var N=_.clientWidth,I=_.scrollWidth;_.scrollLeft=I-N-A;break}else _.scrollLeft=A;else _.scrollTop=A}this._callPropsCallbacks()},g.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Vy(this._resetIsScrollingTimeoutId)},g.render=function(){var y=this.props,b=y.children,x=y.className,R=y.direction,A=y.height,w=y.innerRef,_=y.innerElementType,N=y.innerTagName,I=y.itemCount,D=y.itemData,M=y.itemKey,O=M===void 0?gEe:M,L=y.layout,k=y.outerElementType,F=y.outerTagName,U=y.style,B=y.useIsScrolling,j=y.width,G=this.state.isScrolling,K=R==="horizontal"||L==="horizontal",J=K?this._onScrollHorizontal:this._onScrollVertical,$=this._getRangeToRender(),X=$[0],Z=$[1],V=[];if(I>0)for(var te=X;te<=Z;te++)V.push(v.createElement(b,{data:D,key:O(te,D),index:te,isScrolling:B?G:void 0,style:this._getItemStyle(te)}));var ae=r(this.props,this._instanceProps);return v.createElement(k||F||"div",{className:x,onScroll:J,ref:this._outerRefSetter,style:By({position:"relative",height:A,width:j,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:R},U)},v.createElement(_||N||"div",{children:V,ref:w,style:{height:K?"100%":ae,pointerEvents:G?"none":void 0,width:K?ae:"100%"}}))},g._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var y=this.props.itemCount;if(y>0){var b=this._getRangeToRender(),x=b[0],R=b[1],A=b[2],w=b[3];this._callOnItemsRendered(x,R,A,w)}}if(typeof this.props.onScroll=="function"){var _=this.state,N=_.scrollDirection,I=_.scrollOffset,D=_.scrollUpdateWasRequested;this._callOnScroll(N,I,D)}},g._getRangeToRender=function(){var y=this.props,b=y.itemCount,x=y.overscanCount,R=this.state,A=R.isScrolling,w=R.scrollDirection,_=R.scrollOffset;if(b===0)return[0,0,0,0];var N=i(this.props,_,this._instanceProps),I=l(this.props,N,_,this._instanceProps),D=!A||w==="backward"?Math.max(1,x):1,M=!A||w==="forward"?Math.max(1,x):1;return[Math.max(0,N-D),Math.max(0,Math.min(b-1,I+M)),N,I]},p}(v.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var TEe=function(t,n){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,n.instance},yEe=EEe({getItemOffset:function(t,n){var r=t.itemSize;return n*r},getItemSize:function(t,n){var r=t.itemSize;return r},getEstimatedTotalSize:function(t){var n=t.itemCount,r=t.itemSize;return r*n},getOffsetForIndexAndAlignment:function(t,n,r,a,s,i){var l=t.direction,c=t.height,u=t.itemCount,h=t.itemSize,m=t.layout,p=t.width,g=l==="horizontal"||m==="horizontal",T=g?p:c,y=Math.max(0,u*h-T),b=Math.min(y,n*h),x=Math.max(0,n*h-T+h+i);switch(r==="smart"&&(a>=x-T&&a<=b+T?r="auto":r="center"),r){case"start":return b;case"end":return x;case"center":{var R=Math.round(x+(b-x)/2);return R<Math.ceil(T/2)?0:R>y+Math.floor(T/2)?y:R}case"auto":default:return a>=x&&a<=b?a:a<x?x:b}},getStartIndexForOffset:function(t,n){var r=t.itemCount,a=t.itemSize;return Math.max(0,Math.min(r-1,Math.floor(n/a)))},getStopIndexForStartIndex:function(t,n,r){var a=t.direction,s=t.height,i=t.itemCount,l=t.itemSize,c=t.layout,u=t.width,h=a==="horizontal"||c==="horizontal",m=n*l,p=h?u:s,g=Math.ceil((p+r-m)/l);return Math.max(0,Math.min(i-1,n+g-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});let Ys;typeof window!="undefined"?Ys=window:typeof self!="undefined"?Ys=self:Ys=global;let AO=null,RO=null;const v3=20,IA=Ys.clearTimeout,A3=Ys.setTimeout,OA=Ys.cancelAnimationFrame||Ys.mozCancelAnimationFrame||Ys.webkitCancelAnimationFrame,R3=Ys.requestAnimationFrame||Ys.mozRequestAnimationFrame||Ys.webkitRequestAnimationFrame;OA==null||R3==null?(AO=IA,RO=function(t){return A3(t,v3)}):(AO=function([t,n]){OA(t),IA(n)},RO=function(t){const n=R3(function(){IA(r),t()}),r=A3(function(){OA(n),t()},v3);return[n,r]});function xEe(e){let t,n,r,a,s,i,l;const c=typeof document!="undefined"&&document.attachEvent;if(!c){i=function(x){const R=x.__resizeTriggers__,A=R.firstElementChild,w=R.lastElementChild,_=A.firstElementChild;w.scrollLeft=w.scrollWidth,w.scrollTop=w.scrollHeight,_.style.width=A.offsetWidth+1+"px",_.style.height=A.offsetHeight+1+"px",A.scrollLeft=A.scrollWidth,A.scrollTop=A.scrollHeight},s=function(x){return x.offsetWidth!==x.__resizeLast__.width||x.offsetHeight!==x.__resizeLast__.height},l=function(x){if(x.target.className&&typeof x.target.className.indexOf=="function"&&x.target.className.indexOf("contract-trigger")<0&&x.target.className.indexOf("expand-trigger")<0)return;const R=this;i(this),this.__resizeRAF__&&AO(this.__resizeRAF__),this.__resizeRAF__=RO(function(){s(R)&&(R.__resizeLast__.width=R.offsetWidth,R.__resizeLast__.height=R.offsetHeight,R.__resizeListeners__.forEach(function(_){_.call(R,x)}))})};let p=!1,g="";r="animationstart";const T="Webkit Moz O ms".split(" ");let y="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),b="";{const x=document.createElement("fakeelement");if(x.style.animationName!==void 0&&(p=!0),p===!1){for(let R=0;R<T.length;R++)if(x.style[T[R]+"AnimationName"]!==void 0){b=T[R],g="-"+b.toLowerCase()+"-",r=y[R],p=!0;break}}}n="resizeanim",t="@"+g+"keyframes "+n+" { from { opacity: 0; } to { opacity: 0; } } ",a=g+"animation: 1ms "+n+"; "}const u=function(p){if(!p.getElementById("detectElementResize")){const g=(t||"")+".resize-triggers { "+(a||"")+'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',T=p.head||p.getElementsByTagName("head")[0],y=p.createElement("style");y.id="detectElementResize",y.type="text/css",e!=null&&y.setAttribute("nonce",e),y.styleSheet?y.styleSheet.cssText=g:y.appendChild(p.createTextNode(g)),T.appendChild(y)}};return{addResizeListener:function(p,g){if(c)p.attachEvent("onresize",g);else{if(!p.__resizeTriggers__){const T=p.ownerDocument,y=Ys.getComputedStyle(p);y&&y.position==="static"&&(p.style.position="relative"),u(T),p.__resizeLast__={},p.__resizeListeners__=[],(p.__resizeTriggers__=T.createElement("div")).className="resize-triggers";const b=T.createElement("div");b.className="expand-trigger",b.appendChild(T.createElement("div"));const x=T.createElement("div");x.className="contract-trigger",p.__resizeTriggers__.appendChild(b),p.__resizeTriggers__.appendChild(x),p.appendChild(p.__resizeTriggers__),i(p),p.addEventListener("scroll",l,!0),r&&(p.__resizeTriggers__.__animationListener__=function(A){A.animationName===n&&i(p)},p.__resizeTriggers__.addEventListener(r,p.__resizeTriggers__.__animationListener__))}p.__resizeListeners__.push(g)}},removeResizeListener:function(p,g){if(c)p.detachEvent("onresize",g);else if(p.__resizeListeners__.splice(p.__resizeListeners__.indexOf(g),1),!p.__resizeListeners__.length){p.removeEventListener("scroll",l,!0),p.__resizeTriggers__.__animationListener__&&(p.__resizeTriggers__.removeEventListener(r,p.__resizeTriggers__.__animationListener__),p.__resizeTriggers__.__animationListener__=null);try{p.__resizeTriggers__=!p.removeChild(p.__resizeTriggers__)}catch(T){}}}}}class T7 extends v.Component{constructor(...t){super(...t),this.state={height:this.props.defaultHeight||0,width:this.props.defaultWidth||0},this._autoSizer=null,this._detectElementResize=null,this._didLogDeprecationWarning=!1,this._parentNode=null,this._resizeObserver=null,this._timeoutId=null,this._onResize=()=>{this._timeoutId=null;const{disableHeight:n,disableWidth:r,onResize:a}=this.props;if(this._parentNode){const s=window.getComputedStyle(this._parentNode)||{},i=parseFloat(s.paddingLeft||"0"),l=parseFloat(s.paddingRight||"0"),c=parseFloat(s.paddingTop||"0"),u=parseFloat(s.paddingBottom||"0"),h=this._parentNode.getBoundingClientRect(),m=h.height-c-u,p=h.width-i-l;if(!n&&this.state.height!==m||!r&&this.state.width!==p){this.setState({height:m,width:p});const g=()=>{this._didLogDeprecationWarning||(this._didLogDeprecationWarning=!0)};typeof a=="function"&&a({height:m,width:p,get scaledHeight(){return g(),m},get scaledWidth(){return g(),p}})}}},this._setRef=n=>{this._autoSizer=n}}componentDidMount(){const{nonce:t}=this.props,n=this._autoSizer?this._autoSizer.parentNode:null;if(n!=null&&n.ownerDocument&&n.ownerDocument.defaultView&&n instanceof n.ownerDocument.defaultView.HTMLElement){this._parentNode=n;const r=n.ownerDocument.defaultView.ResizeObserver;r!=null?(this._resizeObserver=new r(()=>{this._timeoutId=setTimeout(this._onResize,0)}),this._resizeObserver.observe(n)):(this._detectElementResize=xEe(t),this._detectElementResize.addResizeListener(n,this._onResize)),this._onResize()}}componentWillUnmount(){this._parentNode&&(this._detectElementResize&&this._detectElementResize.removeResizeListener(this._parentNode,this._onResize),this._timeoutId!==null&&clearTimeout(this._timeoutId),this._resizeObserver&&this._resizeObserver.disconnect())}render(){const x=this.props,{children:t,defaultHeight:n,defaultWidth:r,disableHeight:a=!1,disableWidth:s=!1,doNotBailOutOnEmptyChildren:i=!1,nonce:l,onResize:c,style:u={},tagName:h="div"}=x,m=Tn(x,["children","defaultHeight","defaultWidth","disableHeight","disableWidth","doNotBailOutOnEmptyChildren","nonce","onResize","style","tagName"]),{height:p,width:g}=this.state,T={overflow:"visible"},y={};let b=!1;return a||(p===0&&(b=!0),T.height=0,y.height=p,y.scaledHeight=p),s||(g===0&&(b=!0),T.width=0,y.width=g,y.scaledWidth=g),i&&(b=!1),v.createElement(h,q({ref:this._setRef,style:q(q({},T),u)},m),!b&&t(y))}}function SEe(e){if(typeof e=="bigint"){const t=Number(e);return t===1/0||t===-1/0?e.toString():t}return e}function pa(e){return e.map(t=>{const n={};for(const[r,a]of Object.entries(t))n[r]=SEe(a);return n})}function er(e,t=0){if(e==null)return t;if(typeof e=="bigint"){const r=Number(e);return r===1/0||r===-1/0||isNaN(r)?t:r}if(typeof e=="number")return isNaN(e)||!isFinite(e)?t:e;const n=Number(e);return isNaN(n)||!isFinite(n)?t:n}const bEe="^-?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$";function mh(e,t={useRegexFilter:!0,includeInfinite:!1}){const{useRegexFilter:n,includeInfinite:r,customPattern:a}=t,s=a||bEe;if(n){let i='"'.concat(e,'" IS NOT NULL AND REGEXP_MATCHES("').concat(e,"\"::VARCHAR, '").concat(s,"')");return r||(i+=' AND "'.concat(e,"\"::VARCHAR NOT IN ('Infinity', '-Infinity', 'inf', '-inf')")),i}else return Ch(e)}function Ch(e){return'"'.concat(e,'" IS NOT NULL AND TRY_CAST("').concat(e,'" AS DOUBLE) IS NOT NULL')}function Rt(e){const t=e.replace(/"/g,'""');return'"'.concat(t,'"')}function vEe(e,t=!1){let n="".concat(Rt(e)," IS NOT NULL");return t&&(n+=" AND ".concat(Rt(e)," != ''")),n}function AEe(e,t,n,r){return H(this,null,function*(){const a="\n    SELECT \n      COUNT(*) as total_count,\n      COUNT(".concat(Rt(n),") as non_null_count,\n      COUNT(DISTINCT ").concat(Rt(n),") as unique_count\n    FROM ").concat(t,"\n  "),s=yield e.query(a),i=pa(s.toArray())[0],l=Number(i.total_count),c=Number(i.non_null_count),u=Number(i.unique_count),h=l-c,m=l>0?h/l*100:0,p=l>0?u/l:0;return{name:n,type:r,totalRows:l,nullCount:h,nullPercentage:m,uniqueCount:u,cardinality:p}})}function REe(e,t){return H(this,null,function*(){const n="\n    WITH row_counts AS (\n      SELECT COUNT(*) as total_count FROM ".concat(t,"\n    ),\n    unique_counts AS (\n      SELECT COUNT(*) as unique_count \n      FROM (SELECT DISTINCT * FROM ").concat(t,") t\n    )\n    SELECT rc.total_count, uc.unique_count\n    FROM row_counts rc, unique_counts uc\n  "),r=yield e.query(n),a=pa(r.toArray())[0],s=Number(a.total_count),i=Number(a.unique_count),l=s-i,c=s>0?l/s*100:0;return{totalRows:s,duplicateRows:l,duplicatePercentage:c}})}function NEe(e,t){return H(this,null,function*(){const n="SELECT COUNT(*) as row_count FROM ".concat(t),r=yield e.query(n),a=pa(r.toArray())[0];return Number(a.row_count)})}function _Ee(e,t){return H(this,null,function*(){try{const n=yield NEe(e,t);return{exists:!0,hasData:n>0,rowCount:n}}catch(n){return{exists:!1,hasData:!1,rowCount:0,error:n instanceof Error?n.message:String(n)}}})}function wEe(e,t,n){return H(this,null,function*(){let r,a,s;try{r="\n      SELECT \n        MIN(CAST(".concat(Rt(n)," AS DOUBLE)) as min_val,\n        MAX(CAST(").concat(Rt(n)," AS DOUBLE)) as max_val,\n        COUNT(*) as total_count\n      FROM ").concat(t,"\n      WHERE ").concat(mh(n),"\n    "),a=yield e.query(r),s=pa(a.toArray())[0]}catch(u){r="\n      SELECT \n        MIN(".concat(Rt(n),") as min_val,\n        MAX(").concat(Rt(n),") as max_val,\n        COUNT(").concat(Rt(n),") as total_count\n      FROM ").concat(t,"\n      WHERE ").concat(Ch(n),"\n    "),a=yield e.query(r),s=pa(a.toArray())[0]}if(!s||s.min_val===null||s.max_val===null||s.total_count===0)return null;const i=er(s.min_val),l=er(s.max_val),c=er(s.total_count);return{min:i,max:l,totalCount:c,isConstant:i===l}})}function CEe(e,t,n){return H(this,null,function*(){let r,a,s;try{r="\n      SELECT \n        MIN(CAST(".concat(Rt(n)," AS DOUBLE)) as min_val,\n        MAX(CAST(").concat(Rt(n)," AS DOUBLE)) as max_val,\n        AVG(CAST(").concat(Rt(n)," AS DOUBLE)) as mean_val,\n        MEDIAN(CAST(").concat(Rt(n)," AS DOUBLE)) as median_val,\n        STDDEV(CAST(").concat(Rt(n)," AS DOUBLE)) as std_val,\n        PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY CAST(").concat(Rt(n)," AS DOUBLE)) as q1,\n        PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY CAST(").concat(Rt(n)," AS DOUBLE)) as q3,\n        COUNT(*) as count_val\n      FROM ").concat(t,"\n      WHERE ").concat(mh(n),"\n    "),a=yield e.query(r),s=pa(a.toArray())[0]}catch(m){r="\n      SELECT \n        MIN(".concat(Rt(n),") as min_val,\n        MAX(").concat(Rt(n),") as max_val,\n        AVG(").concat(Rt(n),") as mean_val,\n        MEDIAN(").concat(Rt(n),") as median_val,\n        STDDEV(").concat(Rt(n),") as std_val,\n        PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY ").concat(Rt(n),") as q1,\n        PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY ").concat(Rt(n),") as q3,\n        COUNT(").concat(Rt(n),") as count_val\n      FROM ").concat(t,"\n      WHERE ").concat(Ch(n),"\n    "),a=yield e.query(r),s=pa(a.toArray())[0]}if(!s||s.min_val===null)return null;const i=er(s.q1),l=er(s.q3),c=l-i;let u=0;if(c>0){const m=i-1.5*c,p=l+1.5*c;let g;r.includes("REGEXP_MATCHES")?g="\n        SELECT COUNT(*) as outlier_count\n        FROM ".concat(t,"\n        WHERE ").concat(mh(n),"\n          AND (CAST(").concat(Rt(n)," AS DOUBLE) < ").concat(m," OR CAST(").concat(Rt(n)," AS DOUBLE) > ").concat(p,")\n      "):g="\n        SELECT COUNT(*) as outlier_count\n        FROM ".concat(t,"\n        WHERE ").concat(Ch(n),"\n          AND (").concat(Rt(n)," < ").concat(m," OR ").concat(Rt(n)," > ").concat(p,")\n      ");try{const T=yield e.query(g),y=pa(T.toArray())[0];u=er(y.outlier_count)}catch(T){}}return{min:er(s.min_val),max:er(s.max_val),mean:er(s.mean_val),median:er(s.median_val),std:er(s.std_val),q1:i,q3:l,outliers:u}})}function IEe(e,t,n,r){return H(this,null,function*(){if(t===n)return[n];try{const a="SELECT unnest(equi_width_bins(".concat(t,", ").concat(n,", ").concat(r,", false)) as boundary"),s=yield e.query(a);return pa(s.toArray()).map(c=>er(c.boundary))}catch(a){const s=[],i=(n-t)/r;for(let l=1;l<=r;l++)s.push(t+l*i);return s}})}function OEe(a,s,i){return H(this,arguments,function*(e,t,n,r={binCount:10,useNiceBoundaries:!1}){const l=yield wEe(e,t,n);if(!l)return[];const{min:c,max:u,totalCount:h}=l;if(l.isConstant)return[{bin:"B1",count:h,range:"".concat(c),binStart:c,binEnd:u}];const m=r.customBoundaries||(yield IEe(e,c,u,r.binCount)),p="SELECT 1 FROM ".concat(t," WHERE ").concat(mh(n)," LIMIT 1");let g=!0;try{yield e.query(p)}catch(y){g=!1}const T=[];for(let y=0;y<m.length;y++){const b=y===0?c:m[y-1],x=m[y];let R;g?R=y===m.length-1?"SELECT COUNT(*) as count FROM ".concat(t," \n           WHERE ").concat(mh(n),"\n           AND CAST(").concat(Rt(n)," AS DOUBLE) >= ").concat(b," \n           AND CAST(").concat(Rt(n)," AS DOUBLE) <= ").concat(x):"SELECT COUNT(*) as count FROM ".concat(t," \n           WHERE ").concat(mh(n),"\n           AND CAST(").concat(Rt(n)," AS DOUBLE) >= ").concat(b," \n           AND CAST(").concat(Rt(n)," AS DOUBLE) < ").concat(x):R=y===m.length-1?"SELECT COUNT(*) as count FROM ".concat(t," \n           WHERE ").concat(Ch(n),"\n           AND ").concat(Rt(n)," >= ").concat(b," AND ").concat(Rt(n)," <= ").concat(x):"SELECT COUNT(*) as count FROM ".concat(t," \n           WHERE ").concat(Ch(n),"\n           AND ").concat(Rt(n)," >= ").concat(b," AND ").concat(Rt(n)," < ").concat(x);const A=yield e.query(R),w=pa(A.toArray())[0],_=er(w.count);T.push({bin:"B".concat(y+1),count:_,range:"".concat(b.toFixed(2),"-").concat(x.toFixed(2)),binStart:Number(b.toFixed(2)),binEnd:Number(x.toFixed(2))})}return T.filter(y=>y.count>0||T.length<=3)})}function LEe(e,t,n){return H(this,null,function*(){const r="\n    SELECT \n      AVG(LENGTH(".concat(Rt(n),")) as avg_length,\n      MIN(LENGTH(").concat(Rt(n),")) as min_length,\n      MAX(LENGTH(").concat(Rt(n),")) as max_length,\n      COUNT(CASE WHEN ").concat(Rt(n)," = '' THEN 1 END) as empty_strings,\n      SUM(LENGTH(").concat(Rt(n),")) as total_chars,\n      COUNT(").concat(Rt(n),") as non_null_count\n    FROM ").concat(t,"\n    WHERE ").concat(vEe(n),"\n  ");try{const a=yield e.query(r),s=pa(a.toArray())[0];return!s||s.non_null_count===0?null:{avgLength:er(s.avg_length),minLength:er(s.min_length),maxLength:er(s.max_length),emptyStrings:er(s.empty_strings),totalChars:er(s.total_chars)}}catch(a){return null}})}function MEe(e,t,n,r=10,a){return H(this,null,function*(){if(a===0)return[];try{const s="\n      SELECT \n        ".concat(Rt(n)," as value, \n        COUNT(*) as count,\n        (COUNT(*) * 100.0 / ").concat(a,") as percentage\n      FROM ").concat(t,"\n      WHERE ").concat(Rt(n)," IS NOT NULL\n      GROUP BY ").concat(Rt(n),"\n      ORDER BY count DESC\n      LIMIT ").concat(r,"\n    "),i=yield e.query(s);return pa(i.toArray()).map(c=>({value:String(c.value),count:er(c.count),percentage:er(c.percentage)}))}catch(s){return[]}})}function y7(e){const t=e.toLowerCase();return t.includes("int")||t.includes("double")||t.includes("numeric")||t.includes("decimal")||t.includes("float")||t.includes("real")||t.includes("money")}function DEe(e){const t=e.toLowerCase();return t.includes("varchar")||t.includes("text")||t.includes("string")||t.includes("char")||t.includes("clob")}function PEe(e){const t=e.toLowerCase();return t.includes("date")||t.includes("time")||t.includes("timestamp")||t.includes("interval")}const LA={completeness:.4,uniqueness:.3,consistency:.3};function kEe(e,t,n,r){const a=n.length>0?n.reduce((m,p)=>m+(100-p.nullPercentage),0)/n.length:100,s=e>0?t/e*100:0,i=Math.max(0,100-s);let l=0;r.forEach(m=>{const g=(m.severity==="high"?3:m.severity==="medium"?2:1)*Math.min(m.count/e*100,20);l+=g});const c=Math.max(0,100-l),u=Math.round(a*LA.completeness+i*LA.uniqueness+c*LA.consistency);return{healthScore:Math.max(0,Math.min(100,u)),healthBreakdown:{completeness:Math.round(a),uniqueness:Math.round(i),consistency:Math.round(c)}}}function x7(e,t,n,r){return H(this,null,function*(){const a=[];r.toLowerCase();try{if(y7(r)){const s="\n        SELECT \n          ".concat(Rt(n)," as value,\n          COUNT(*) as count\n        FROM ").concat(t,"\n        WHERE ").concat(Rt(n)," IS NOT NULL \n          AND TRY_CAST(").concat(Rt(n)," AS DOUBLE) IS NULL\n        GROUP BY ").concat(Rt(n),"\n        ORDER BY count DESC\n        LIMIT 5\n      ");try{const i=yield e.query(s),l=pa(i.toArray());if(l.length>0){const c=l.reduce((u,h)=>u+er(h.count),0);a.push({column:n,issue:"Non-numeric values in numeric column",count:c,examples:l.map(u=>String(u.value)).slice(0,3),severity:c>100?"high":c>10?"medium":"low"})}}catch(i){}}if(PEe(r)){const s="\n        SELECT \n          ".concat(Rt(n)," as value,\n          COUNT(*) as count\n        FROM ").concat(t,"\n        WHERE ").concat(Rt(n)," IS NOT NULL \n          AND TRY_CAST(").concat(Rt(n)," AS DATE) IS NULL\n        GROUP BY ").concat(Rt(n),"\n        ORDER BY count DESC\n        LIMIT 5\n      ");try{const i=yield e.query(s),l=pa(i.toArray());if(l.length>0){const c=l.reduce((u,h)=>u+er(h.count),0);a.push({column:n,issue:"Invalid date format",count:c,examples:l.map(u=>String(u.value)).slice(0,3),severity:c>50?"high":c>5?"medium":"low"})}}catch(i){}}}catch(s){}return a})}function jEe(e,t,n){return H(this,null,function*(){try{const r="SELECT COUNT(*) as row_count FROM ".concat(t),a=yield e.query(r),i=er(pa(a.toArray())[0].row_count)===0;if(i)return{emptyTable:!0,allNullColumns:[],suspiciouslyUniformColumns:[],potentialDuplicateColumns:[],highNullPercentageColumns:[]};const l=[],c=[];for(const m of n)try{const p="\n          SELECT \n            COUNT(*) as total_count,\n            COUNT(".concat(Rt(m),") as non_null_count\n          FROM ").concat(t,"\n        "),g=yield e.query(p),T=pa(g.toArray())[0],y=er(T.total_count),b=er(T.non_null_count),x=y>0?(y-b)/y*100:0;b===0?l.push(m):x>80&&c.push({column:m,nullPercentage:x})}catch(p){}const u=[];for(const m of n)if(!l.includes(m))try{const p="\n          SELECT COUNT(DISTINCT ".concat(Rt(m),") as unique_count\n          FROM ").concat(t,"\n          WHERE ").concat(Rt(m)," IS NOT NULL\n        "),g=yield e.query(p);er(pa(g.toArray())[0].unique_count)===1&&u.push(m)}catch(p){}return{emptyTable:i,allNullColumns:l,suspiciouslyUniformColumns:u,potentialDuplicateColumns:[],highNullPercentageColumns:c}}catch(r){return{emptyTable:!1,allNullColumns:[],suspiciouslyUniformColumns:[],potentialDuplicateColumns:[],highNullPercentageColumns:[]}}})}function UEe(e,t,n,r){const a=[];if(e.healthScore<50?a.push("🔴 Critical: Data quality is very poor and needs immediate attention"):e.healthScore<70?a.push("🟡 Warning: Data quality issues detected that should be addressed"):e.healthScore<90?a.push("🟢 Good: Minor data quality improvements possible"):a.push("✅ Excellent: Data quality is very good"),e.healthBreakdown.completeness<80){const c=r.filter(u=>u.nullPercentage>20);c.length>0&&a.push("📊 Consider handling missing data in: ".concat(c.map(u=>u.name).join(", ")))}e.healthBreakdown.uniqueness<90&&a.push("🔄 Consider removing or investigating duplicate rows");const s=t.filter(c=>c.severity==="high");s.length>0&&a.push("⚠️ Fix critical data type issues in: ".concat(s.map(c=>c.column).join(", ")));const i=t.filter(c=>c.severity==="medium");if(i.length>0&&a.push("🔧 Review data type issues in: ".concat(i.map(c=>c.column).join(", "))),n.allNullColumns.length>0&&a.push("❌ Consider removing empty columns: ".concat(n.allNullColumns.join(", "))),n.suspiciouslyUniformColumns.length>0&&a.push("📍 Review columns with only one value: ".concat(n.suspiciouslyUniformColumns.join(", "))),n.highNullPercentageColumns.length>0){const c=n.highNullPercentageColumns.map(u=>"".concat(u.column," (").concat(u.nullPercentage.toFixed(1),"% null)")).join(", ");a.push("🕳️ High missing data in: ".concat(c))}const l=r.filter(c=>c.cardinality>.9&&c.uniqueCount>1e3);return l.length>0&&a.push("🔑 Potential identifier columns: ".concat(l.map(c=>c.name).join(", "))),a.length===1&&a[0].includes("Excellent")&&(a.push("🎯 Data appears to be well-structured and clean"),a.push("📈 Consider advanced analytics or machine learning applications")),a}function FEe(e,t,n,r){return H(this,null,function*(){try{const a=n.length>0?n[0].totalRows:0,s=n.map(b=>b.name),[i,l]=yield Promise.all([Promise.all(n.map(b=>x7(e,t,b.name,b.type))),jEe(e,t,s)]),c=i.flat(),u=kEe(a,r,n,c),h=UEe(u,c,l,n),m=c.filter(b=>b.severity==="high").length+(l.emptyTable?1:0)+l.allNullColumns.length,p=c.filter(b=>b.severity==="medium").length+l.suspiciouslyUniformColumns.length+l.highNullPercentageColumns.length,g=c.filter(b=>b.severity==="low").length,T=m+p+g;return{healthScore:u,typeIssues:c,generalIssues:l,recommendations:h,summary:{totalIssues:T,criticalIssues:m,warningIssues:p,infoIssues:g}}}catch(a){return{healthScore:{healthScore:0,healthBreakdown:{completeness:0,uniqueness:0,consistency:0}},typeIssues:[],generalIssues:{emptyTable:!1,allNullColumns:[],suspiciouslyUniformColumns:[],potentialDuplicateColumns:[],highNullPercentageColumns:[]},recommendations:["❌ Quality assessment failed - unable to analyze data"],summary:{totalIssues:1,criticalIssues:1,warningIssues:0,infoIssues:0}}}})}function $Ee(e,t,n,r,a){return H(this,null,function*(){try{const s=yield AEe(e,t,n,r),i={basic:s,typeIssues:[]};if(y7(r))try{i.numeric=yield CEe(e,t,n),i.numeric&&s.uniqueCount>1&&s.uniqueCount<a*.9&&(i.histogram=yield OEe(e,t,n,{binCount:8,useNiceBoundaries:!1}))}catch(l){}else if(DEe(r))try{i.text=yield LEe(e,t,n)}catch(l){}if(s.uniqueCount>0&&s.uniqueCount<=100&&s.uniqueCount<a)try{i.frequent=yield MEe(e,t,n,10,a)}catch(l){}try{i.typeIssues=yield x7(e,t,n,r)}catch(l){}return i}catch(s){return{basic:{name:n,type:r,totalRows:a,nullCount:0,nullPercentage:0,uniqueCount:0,cardinality:0},typeIssues:[{column:n,issue:"Analysis failed",count:1,examples:[s instanceof Error?s.message:String(s)],severity:"high"}]}}})}const N3=800,S7=600,b7=1200;let Ka=null;function BEe(){try{const e=localStorage.getItem("inspector-panel-state");if(e){const t=JSON.parse(e);return{isOpen:!1,width:Math.max(S7,Math.min(b7,t.width||N3))}}}catch(e){}return{isOpen:!1,width:N3}}function HEe(e){try{const t=JSON.parse(localStorage.getItem("inspector-panel-state")||"{}");localStorage.setItem("inspector-panel-state",JSON.stringify(he(q({},t),{width:e})))}catch(t){}}const Yc=Ki((e,t)=>{const n=BEe();return{isOpen:n.isOpen,width:n.width,isAnalyzing:!1,analysisProgress:0,analysisStatus:"",activeFileId:null,activeTableName:null,results:new Map,error:null,openPanel:()=>e({isOpen:!0}),closePanel:()=>{e({isOpen:!1}),Ka&&Ka.abort()},togglePanel:()=>{const{isOpen:r}=t();e({isOpen:!r}),r&&Ka&&Ka.abort()},setWidth:r=>{const a=Math.max(S7,Math.min(b7,r));e({width:a}),HEe(a)},analyzeFile:(r,a)=>H(null,null,function*(){const s=t();if(s.results.has(r)){e({activeFileId:r,activeTableName:a});return}Ka=new AbortController;const i=Date.now();e({isAnalyzing:!0,analysisProgress:0,analysisStatus:"Initializing analysis...",activeFileId:r,activeTableName:a,error:null});try{const l=Dt.getState();if(!l.connection||!l.isInitialized)throw new Error("DuckDB is not initialized");const c=l.registeredTables.get(a);if(!c){const I=Array.from(l.registeredTables.keys());throw new Error('Table "'.concat(a,'" not found. Available: ').concat(I.join(", ")))}e({analysisProgress:5,analysisStatus:"Validating table..."});const u=yield _Ee(l.connection,c);if(!u.exists||!u.hasData)throw new Error(u.error||"Table is empty or doesn't exist");const h=u.rowCount;e({analysisProgress:10,analysisStatus:"Getting table schema..."});const m=yield l.getTableSchema(a);if(!m||m.length===0)throw new Error("Could not retrieve table schema");const p=m.length;e({analysisProgress:20,analysisStatus:"Checking for duplicates..."});const g=yield REe(l.connection,c),T=[],y=[];for(let I=0;I<m.length;I++){const D=m[I],M=20+I/m.length*60;if(e({analysisProgress:M,analysisStatus:"Analyzing column: ".concat(D.name," (").concat(I+1,"/").concat(m.length,")...")}),Ka!=null&&Ka.signal.aborted)throw new Error("Analysis was cancelled");try{const O=yield $Ee(l.connection,c,D.name,D.type,h);T.push(O),O.frequent&&O.frequent.length>0&&y.push({column:D.name,values:O.frequent})}catch(O){T.push({basic:{name:D.name,type:D.type,totalRows:h,nullCount:0,nullPercentage:0,uniqueCount:0,cardinality:0},typeIssues:[{column:D.name,issue:"Column analysis failed",count:1,examples:[O instanceof Error?O.message:String(O)],severity:"high"}]})}}if(Ka!=null&&Ka.signal.aborted)throw new Error("Analysis was cancelled");e({analysisProgress:85,analysisStatus:"Calculating quality scores..."});const b=T.map(I=>I.basic),x=T.flatMap(I=>I.typeIssues),R=yield FEe(l.connection,c,b,g.duplicateRows);e({analysisProgress:95,analysisStatus:"Finalizing results..."});const A=T.map(I=>({name:I.basic.name,type:I.basic.type,nullCount:I.basic.nullCount,nullPercentage:I.basic.nullPercentage,uniqueCount:I.basic.uniqueCount,cardinality:I.basic.cardinality,numericStats:I.numeric,textStats:I.text,histogramData:I.histogram})),w=Date.now()-i,_={healthScore:R.healthScore.healthScore,healthBreakdown:R.healthScore.healthBreakdown,totalRows:h,totalColumns:p,duplicateRows:g.duplicateRows,duplicatePercentage:g.duplicatePercentage,columnMetrics:A,typeIssues:R.typeIssues,frequentValues:y,recommendations:R.recommendations,analysisTimestamp:Date.now(),analysisTimeMs:w},N=new Map(s.results);N.set(r,_),e({results:N,isAnalyzing:!1,analysisProgress:100,analysisStatus:"Analysis complete in ".concat((w/1e3).toFixed(1),"s")}),setTimeout(()=>{t().isAnalyzing||e({analysisStatus:"",analysisProgress:0})},3e3)}catch(l){const c=l instanceof Error?l.message:String(l),u=c.includes("cancelled")||c.includes("aborted");e({error:u?null:"Analysis failed: ".concat(c),isAnalyzing:!1,analysisProgress:0,analysisStatus:u?"":"Analysis failed"}),u||setTimeout(()=>{t().isAnalyzing||e({error:null,analysisStatus:""})},5e3)}finally{Ka=null}}),switchAnalysisTarget:(r,a)=>{e({activeFileId:r,activeTableName:a}),t().results.has(r)||t().analyzeFile(r,a)},cancelAnalysis:()=>{Ka&&Ka.abort(),e({isAnalyzing:!1,analysisProgress:0,analysisStatus:"Analysis cancelled",error:null}),setTimeout(()=>e({analysisStatus:""}),2e3)},clearResults:r=>{if(r){const a=new Map(t().results);a.delete(r),e({results:a})}else e({results:new Map})},exportResults:r=>H(null,null,function*(){const a=t().results.get(r);if(!a)throw new Error("No analysis results found");const s=[["Category","Metric","Value","Details"]];s.push(["Health","Overall Score",a.healthScore.toString(),"0-100 scale"]),s.push(["Health","Completeness",a.healthBreakdown.completeness.toString(),""]),s.push(["Health","Uniqueness",a.healthBreakdown.uniqueness.toString(),""]),s.push(["Health","Consistency",a.healthBreakdown.consistency.toString(),""]),s.push(["Basic","Total Rows",a.totalRows.toString(),""]),s.push(["Basic","Total Columns",a.totalColumns.toString(),""]),s.push(["Basic","Duplicate Rows",a.duplicateRows.toString(),""]),a.columnMetrics.forEach(p=>{s.push(["Column",p.name,"Null %",p.nullPercentage.toFixed(2)]),s.push(["Column",p.name,"Unique Count",p.uniqueCount.toString()]),s.push(["Column",p.name,"Cardinality",p.cardinality.toFixed(4)])}),a.recommendations.forEach((p,g)=>{s.push(["Recommendation","".concat(g+1),p,""])});const i=s.map(p=>p.map(g=>'"'.concat(String(g).replace(/"/g,'""'),'"')).join(",")).join("\n"),l=new Blob([i],{type:"text/csv"}),c=document.createElement("a"),u=URL.createObjectURL(l),h=new Date().toISOString().split("T")[0],m="data-inspector-".concat(r,"-").concat(h,".csv");c.setAttribute("href",u),c.setAttribute("download",m),c.style.visibility="hidden",document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(u)}),resetError:()=>e({error:null}),getResultsForFile:r=>t().results.get(r)||null,fetchDuplicateRows:(r,a=100)=>H(null,null,function*(){var h;const s=t();if(!s.activeTableName)throw new Error("No active table");const i=Dt.getState(),l=i.registeredTables.get(s.activeTableName);if(!l)throw new Error('Table "'.concat(s.activeTableName,'" not found'));const c="\n        WITH duplicate_finder AS (\n          SELECT *, ROW_NUMBER() OVER (PARTITION BY ".concat(((h=yield i.getTableSchema(s.activeTableName))==null?void 0:h.map(m=>'"'.concat(m.name,'"')).join(", "))||"*",") as rn\n          FROM ").concat(l,"\n        )\n        SELECT *\n        FROM duplicate_finder\n        WHERE rn > 1\n        ORDER BY rn\n        LIMIT ").concat(a,"\n      "),u=yield i.executePaginatedQuery(c,1,a,!1,!1);return(u==null?void 0:u.data)||[]}),fetchNullRows:(r,a,s=100)=>H(null,null,function*(){const i=t();if(!i.activeTableName)throw new Error("No active table");const l=Dt.getState(),c=l.registeredTables.get(i.activeTableName);if(!c)throw new Error('Table "'.concat(i.activeTableName,'" not found'));const u="\n        SELECT *\n        FROM ".concat(c,'\n        WHERE "').concat(a,'" IS NULL\n        LIMIT ').concat(s,"\n      "),h=yield l.executePaginatedQuery(u,1,s,!1,!1);return(h==null?void 0:h.data)||[]}),fetchOutlierRows:(r,a,s=100)=>H(null,null,function*(){const i=t();if(!i.activeTableName)throw new Error("No active table");const l=Dt.getState(),c=l.registeredTables.get(i.activeTableName);if(!c)throw new Error('Table "'.concat(i.activeTableName,'" not found'));const u=i.results.get(r),h=u==null?void 0:u.columnMetrics.find(b=>b.name===a);if(!(h!=null&&h.numericStats))throw new Error('Column "'.concat(a,'" is not numeric or has no statistics'));const{mean:m,std:p}=h.numericStats,g=m+2*p,T="\n        SELECT *\n        FROM ".concat(c,'\n        WHERE "').concat(a,'" > ').concat(g,' OR "').concat(a,'" < ').concat(m-2*p,'\n        ORDER BY ABS("').concat(a,'" - ').concat(m,") DESC\n        LIMIT ").concat(s,"\n      "),y=yield l.executePaginatedQuery(T,1,s,!1,!1);return(y==null?void 0:y.data)||[]}),fetchTypeIssueRows:(r,a,s=100)=>H(null,null,function*(){const i=t();if(!i.activeTableName)throw new Error("No active table");const l=Dt.getState(),c=l.registeredTables.get(i.activeTableName);if(!c)throw new Error('Table "'.concat(i.activeTableName,'" not found'));const u=i.results.get(r);if(((u==null?void 0:u.typeIssues.filter(g=>g.column===a))||[]).length===0)return[];const m="\n        SELECT *\n        FROM ".concat(c,'\n        WHERE "').concat(a,'" IS NOT NULL\n        AND TRY_CAST("').concat(a,'" AS DOUBLE) IS NULL\n        AND "').concat(a,"\" != ''\n        LIMIT ").concat(s,"\n      "),p=yield l.executePaginatedQuery(m,1,s,!1,!1);return(p==null?void 0:p.data)||[]})}}),v7=({fileId:e,enabled:t=!0,fileSizeThresholdMB:n=300,manualTrigger:r=!1}={})=>{const[a,s]=v.useState(!1),[i,l]=v.useState(null),[c,u]=v.useState(!1),h=v.useRef(!1),{analyzeFile:m,results:p,activeFileId:g,isAnalyzing:T,error:y}=Yc(),b=e?ut.getState().files.find(_=>_.id===e):ut.getState().files.find(_=>_.id===g),x=e||g,R=x?p.get(x):null,A=(R==null?void 0:R.columnMetrics)||[],w=()=>H(null,null,function*(){if(!(!b||!x||h.current||T)){h.current=!0,s(!0),l(null);try{const _=b.tableName;if(!_)throw new Error("Table name not found for file");yield m(x,_)}catch(_){l(_ instanceof Error?_.message:"Failed to load column statistics")}finally{h.current=!1,s(!1)}}});return v.useEffect(()=>{if(l(null),u(!1),!t||!b||!x)return;if(b.isRemote){u(!1);return}if((b.fileSize?b.fileSize/(1024*1024):0)>n){u(!1);return}if(u(!0),r||R||h.current||T)return;const N=()=>H(null,null,function*(){h.current=!0,s(!0),l(null);try{const D=b.tableName;if(!D)throw new Error("Table name not found for file");yield m(x,D)}catch(D){l(D instanceof Error?D.message:"Failed to load column statistics")}finally{h.current=!1,s(!1)}}),I=setTimeout(()=>{N()},500);return()=>{clearTimeout(I)}},[x,b,t,n,r,m,R,T]),v.useEffect(()=>{s(!!(T&&x===g))},[T,x,g]),v.useEffect(()=>{y&&l(y)},[y]),{columnStats:A,isLoading:a||T,error:i,shouldLoadStats:c,triggerAnalysis:w}},VEe=({data:e,width:t=100,height:n=24,color:r="#00BFA5",showOutliers:a=!0})=>{if(!e||e.length===0)return o.jsx("div",{className:"flex items-center justify-center text-[10px] text-white/40",children:"No chart data"});const s=e.filter(p=>{var T,y,b;const g=(b=(y=(T=p.frequency)!=null?T:p.count)!=null?y:p.value)!=null?b:0;return typeof g=="number"&&g>=0}).map(p=>{var g,T,y;return he(q({},p),{frequency:(y=(T=(g=p.frequency)!=null?g:p.count)!=null?T:p.value)!=null?y:0})});if(s.length===0)return null;const i=Math.max(...s.map(p=>p.frequency));if(i===0)return null;const l=Math.max(2,Math.floor(t/s.length)-1),c=1,u=[...s.map(p=>p.frequency)].sort((p,g)=>p-g),m=u[Math.floor(u.length/2)]*.1;return o.jsx("svg",{width:t,height:n,className:"inline-block mini-histogram",children:s.map((p,g)=>{const T=i>0?p.frequency/i*(n-2):0,y=g*(l+c),b=n-T-1,x=a&&p.frequency<m&&p.frequency>0;return o.jsx("rect",{x:y,y:b,width:l,height:T,fill:x?"".concat(r,"66"):r,opacity:x?.4:.8,rx:.5},g)})})},GEe=({type:e,size:t=12,className:n=""})=>{const r=(typeof e=="string"?e:String(e||"")).toLowerCase(),a=()=>r.includes("int")||r.includes("double")||r.includes("float")||r.includes("decimal")||r.includes("numeric")||r==="number"?o.jsx(hu,{size:t,className:"text-tertiary"}):r.includes("date")||r.includes("time")||r==="date"?o.jsx(Fl,{size:t,className:"text-secondary opacity-85"}):r.includes("bool")||r==="boolean"?o.jsx(zW,{size:t,className:"text-primary"}):r.includes("array")||r.includes("list")||r==="array"?o.jsx(hh,{size:t,className:"text-white/60"}):r.includes("blob")||r.includes("binary")||r==="object"?o.jsx(che,{size:t,className:"text-white/60"}):o.jsx(Kh,{size:t,className:"text-white/60"});return o.jsx("div",{className:"inline-flex items-center justify-center ".concat(n),title:e,children:a()})},zEe=({columnName:e,columnType:t="VARCHAR",columnIndex:n,stats:r,isLoading:a,width:s,shouldLoadStats:i=!1,sortState:l,onSort:c,onColumnAction:u,tableName:h,isView:m=!1})=>{const{t:p}=Ze(),[g,T]=Ht.useState(!1),y=()=>{if(!c||n===0)return;const N=(l==null?void 0:l.columnIndex)===n&&(l==null?void 0:l.direction)==="asc"?"desc":"asc";c(n,N)},b=N=>N===0?"0%":N<1?"<1%":"".concat(Math.round(N),"%"),x=N=>N>=1e6?"".concat((N/1e6).toFixed(1),"M"):N>=1e3?"".concat((N/1e3).toFixed(1),"K"):N.toString(),R=n===0,A=r&&!a&&!R,w=A&&r.histogramData&&r.histogramData.length>0,_=(l==null?void 0:l.columnIndex)===n;return o.jsxs("div",{className:"h-full w-full flex flex-col border-b-2 border-white/10 border-r border-white/15 overflow-hidden group cursor-pointer transition-all duration-300 ease-in-out column-header-cell ".concat(_?"sorted":"bg-dark-nav hover:bg-primary/5"),onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),onClick:y,children:[o.jsxs("div",{className:"flex items-center justify-between px-2 py-1 min-h-[32px]",children:[o.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[!R&&o.jsx(GEe,{type:t,size:12}),o.jsx("span",{className:"text-sm font-semibold text-white truncate",children:e})]}),!R&&o.jsx("div",{className:"flex items-center gap-1",children:o.jsx("div",{className:"transition-all duration-200 ".concat(g||_?"opacity-90":"opacity-30"),children:_?l.direction==="asc"?o.jsx(DW,{size:14,className:"".concat(_?"text-white drop-shadow-sm":"text-primary")}):o.jsx(MW,{size:14,className:"".concat(_?"text-white drop-shadow-sm":"text-primary")}):o.jsx(she,{size:12,className:"text-white/60"})})})]}),i&&!R&&o.jsxs("div",{className:"px-2 pb-1 space-y-1 transition-all duration-300 ease-in-out",children:[o.jsx("div",{className:"flex justify-center transition-all duration-300 ease-in-out",children:w?o.jsx(VEe,{data:r.histogramData,width:Math.max(40,Math.min(s-16,100)),height:20,color:"#00BFA5",showOutliers:!0}):o.jsx("div",{className:"flex items-center justify-center text-white/20 text-[8px] font-mono transition-all duration-300 ease-in-out",style:{height:20,width:Math.max(40,Math.min(s-16,100))}})}),o.jsx("div",{className:"flex flex-wrap gap-x-2 text-[10px] text-white/60 min-h-[12px] justify-center transition-all duration-300 ease-in-out",children:A&&(r.nullPercentage>0||r.uniqueCount>0||r.numericStats)?o.jsxs(o.Fragment,{children:[r.nullPercentage>0&&o.jsx("span",{className:"whitespace-nowrap",children:p("dataGrid.columnHeader.stats.null",{percentage:b(r.nullPercentage),defaultValue:"null: {{percentage}}"})}),r.uniqueCount>0&&o.jsx("span",{className:"whitespace-nowrap",children:p("dataGrid.columnHeader.stats.unique",{count:x(r.uniqueCount),defaultValue:"uniq: {{count}}"})}),r.numericStats&&o.jsx(o.Fragment,{children:r.numericStats.mean!==void 0&&o.jsxs("span",{className:"whitespace-nowrap",children:["μ: ",r.numericStats.mean.toFixed(1)]})})]}):o.jsx("span",{className:"text-white/20 text-[8px]",children:p("dataGrid.columnHeader.stats.noStats",{defaultValue:"no stats"})})})]}),a&&!R&&o.jsxs("div",{className:"px-2 pb-1",children:[o.jsx("div",{className:"h-4 bg-white/10 rounded animate-pulse mb-1"}),o.jsx("div",{className:"h-3 bg-white/10 rounded animate-pulse w-3/4"})]})]})},qEe=({isOpen:e,onClose:t,columnName:n,columnType:r,tableName:a,position:s,onExecute:i})=>{const[l,c]=v.useState(""),[u,h]=v.useState(!1),[m,p]=v.useState(!1),g=v.useRef(null),T=v.useRef(null),{isAuthenticated:y}=ea(),x=(()=>{const I=[];return["INTEGER","DOUBLE","DECIMAL","BIGINT","FLOAT"].some(D=>r.toUpperCase().includes(D))?I.push("Show statistics for ".concat(n),"Find outliers in ".concat(n),"Create buckets from ".concat(n)):["VARCHAR","TEXT","STRING"].some(D=>r.toUpperCase().includes(D))?I.push("Convert ".concat(n," to uppercase"),"Remove empty values from ".concat(n),"Count unique values in ".concat(n)):["DATE","TIMESTAMP","DATETIME"].some(D=>r.toUpperCase().includes(D))?I.push("Extract year from ".concat(n),"Filter by recent ".concat(n),"Group by month from ".concat(n)):I.push("Analyze ".concat(n),"Clean ".concat(n," data"),"Transform ".concat(n)),I.push("Remove rows where ".concat(n," is null"),"Rename ".concat(n," column")),I.slice(0,4)})();v.useEffect(()=>{e&&g.current&&setTimeout(()=>{var I;return(I=g.current)==null?void 0:I.focus()},100)},[e]),v.useEffect(()=>{const I=D=>{T.current&&!T.current.contains(D.target)&&t()};return e&&document.addEventListener("mousedown",I),()=>{document.removeEventListener("mousedown",I)}},[e,t]);const R=()=>H(null,null,function*(){if(!(!l.trim()||u)){if(!y){p(!0);return}h(!0);try{yield i(l.trim()),c(""),t()}catch(I){}finally{h(!1)}}}),A=I=>{if(!y){c(I),p(!0);return}c(I),g.current&&g.current.focus()},w=()=>{p(!1),l.trim()&&g.current&&g.current.focus()},_=I=>{I.key==="Enter"&&(I.metaKey||I.ctrlKey)&&(I.preventDefault(),R()),I.key==="Escape"&&t()},N={left:Math.min(s.x,window.innerWidth-360),top:Math.min(s.y,window.innerHeight-320)};return e?o.jsxs(At,{children:[o.jsxs(me.div,{ref:T,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},className:"fixed z-50 bg-black border border-white/10 rounded-lg shadow-xl w-80",style:N,children:[o.jsxs("div",{className:"px-4 py-3 border-b border-white/10",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsxs("h3",{className:"font-medium text-white text-sm",children:["AI Actions for ",o.jsx("span",{className:"text-primary",children:n})]})}),o.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r,!y&&o.jsx("span",{className:"ml-2 text-yellow-400",children:"• Sign in required"})]})]}),o.jsxs("div",{className:"p-4",children:[o.jsxs("div",{className:"relative",children:[o.jsx("textarea",{ref:g,value:l,onChange:I=>c(I.target.value),onKeyDown:_,placeholder:"What would you like to do with ".concat(n,"?"),className:"w-full h-20 px-3 py-2 text-sm bg-black/30 border border-white/10 rounded-md resize-none focus:ring-2 focus:ring-primary/30 focus:border-primary/50 outline-none text-white placeholder-white/40"}),o.jsx("button",{onClick:R,disabled:!l.trim()||u,className:"absolute bottom-2 right-2 p-1.5 bg-primary text-white rounded-md hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:u?o.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14 5l7 7m0 0l-7 7m7-7H3"})})})]}),o.jsx("p",{className:"text-xs text-white/40 mt-2",children:"Press ⌘+Enter to execute"})]}),x.length>0&&o.jsxs("div",{className:"px-4 pb-4",children:[o.jsx("p",{className:"text-xs font-medium text-white/60 mb-2",children:"Suggestions:"}),o.jsx("div",{className:"space-y-1",children:x.map((I,D)=>o.jsx("button",{onClick:()=>A(I),className:"w-full text-left px-3 py-2 text-sm rounded-md bg-white/5 hover:bg-white/10 transition-colors text-white/80 hover:text-white",children:I},"suggestion-".concat(D,"-").concat(I.substring(0,20))))})]})]}),o.jsx(Vl,{isOpen:m,onClose:()=>p(!1),defaultMode:"signup",onLoginSuccess:w})]}):null},YEe=e=>{var r;const{tables:t}=e;if(t.length===0)return"You are a SQL expert helping users query their data using DuckDB syntax.";const n=t.map((a,s)=>{const i=a.schema.map(l=>"  ".concat(l.name,": ").concat(l.type)).join("\n");return"".concat(s>0?"\n":"","Table: ").concat(a.tableName,"\n").concat(a.description?"Description: ".concat(a.description,"\n"):"").concat(a.rowCount?"Row count: ".concat(a.rowCount.toLocaleString(),"\n"):"","Schema:\n").concat(i)}).join("\n");return"You are a helpful data assistant. Your primary job is to help users understand and query their data.\n\nDATABASE CONTEXT:\n".concat(n,'\n\nINSTRUCTIONS:\n1. **Before generating any SQL query, determine if the user\'s request is actually about their data**\n2. **For general questions ("who are you", "hello", "what can you do") - respond conversationally, don\'t generate SQL**\n3. **For vague data requests - ask clarifying questions to better understand what they want to analyze**\n4. **Only generate SQL when the user has a clear, specific data analysis need**\n5. When generating SQL: Use DuckDB syntax, include LIMIT clauses, use proper column names\n6. Be conversational and helpful - you\'re an assistant, not just a query generator\n7. If unsure whether they want data analysis, ask: "Are you looking to analyze your data, or do you have a general question?"\n\nEXAMPLES OF WHEN TO ASK CLARIFYING QUESTIONS:\n- "Show me the data" → "What specific aspects of your data would you like to explore? For example, are you looking for trends, patterns, top values, or something else?"\n- "Analyze this" → "What kind of analysis are you interested in? Would you like to see summary statistics, find patterns, identify outliers, or explore relationships between columns?"\n- "What\'s interesting here?" → "I\'d be happy to help you explore! What type of insights are you looking for? For example, are you interested in trends over time, distribution of values, or comparing different groups?"\n\nEXAMPLES OF WHEN TO RESPOND CONVERSATIONALLY (NO SQL):\n- "Who are you?" → Introduce yourself as a data assistant\n- "Hello" → Greet them and offer to help with their data\n- "What can you do?" → Explain your data analysis capabilities\n- "Help" → Offer guidance on how to ask data questions\n\nRESPONSE FORMAT FOR DATA QUERIES:\n**INSIGHT:** [2-5 words describing the discovery]\n**QUERY_DESCRIPTION:** [Brief 1-2 sentence explanation of what this query will show the user]\n**EXPECTED_RESULTS:** [Describe what type of data/insights the user will see when they run this query]\n**CHART_SUGGESTION:** [Recommend the best chart type for visualizing this data: "bar", "line", "pie", "scatter", "area", or "none" if not suitable for charting. Include suggested X and Y axes, e.g., "bar chart: x=category, y=count"]\n\n**STATUS:** Analyzing your data structure\n\n[Brief analysis of the schema and data patterns]\n\n**STATUS:** Building optimized query\n\n[Quick explanation of the SQL approach]\n\n**STATUS:** Ready to execute\n\n```sql\nSELECT column1, column2, COUNT(*) as count\nFROM ').concat(((r=t[0])==null?void 0:r.tableName)||"table_name","\nWHERE conditions\nGROUP BY column1, column2\nORDER BY count DESC\nLIMIT 100;\n```\n\nRESPONSE FORMAT FOR GENERAL QUESTIONS:\nProvide a conversational response without any SQL code blocks. Be helpful and friendly, and guide them toward asking data-specific questions if appropriate.\n\nCRITICAL REQUIREMENTS:\n- **ONLY generate SQL when the user has a specific data analysis request**\n- **For general questions, respond conversationally without SQL code**\n- **For vague requests, ask clarifying questions to understand their goal**\n- When generating SQL: Include exactly ONE query in ```sql code block\n- Use proper DuckDB syntax (SELECT, FROM, WHERE, GROUP BY, ORDER BY, LIMIT)\n- End queries with semicolon (;) for clarity\n- Use exact column names from the schema\n- Include LIMIT 100 unless user requests more\n- Keep explanations brief and focused\n- Generate syntactically correct, executable queries\n\nREMEMBER: You are a conversational assistant first, SQL generator second. Not every question needs a SQL query!\n\nDUCKDB SYNTAX CONSTRAINTS (only when generating SQL):\n- COUNT(DISTINCT col1, col2, col3) is NOT supported - use COUNT(DISTINCT col1) for single columns only\n- For multiple column uniqueness, use: COUNT(*) FROM (SELECT DISTINCT col1, col2, col3 FROM table)\n- CAST data types explicitly when needed: CAST(column AS INTEGER)\n- Use proper aggregation functions: COUNT(*), SUM(column), AVG(column), MAX(column), MIN(column)\n- Window functions: ROW_NUMBER() OVER (PARTITION BY col ORDER BY col)\n- Use COALESCE() for handling NULL values\n- String functions: LENGTH(), LOWER(), UPPER(), SUBSTRING()\n- Date functions: EXTRACT(YEAR FROM date_col), DATE_TRUNC('month', date_col)")},WEe=e=>{var r;const{tables:t}=e;if(t.length===0)return"You are a SQL expert helping users query their data using DuckDB syntax.";const n=t.map((a,s)=>{const i=a.schema.map(l=>"  ".concat(l.name,": ").concat(l.type)).join("\n");return"".concat(s>0?"\n":"","Table: ").concat(a.tableName,"\n").concat(a.description?"Description: ".concat(a.description,"\n"):"").concat(a.rowCount?"Row count: ".concat(a.rowCount.toLocaleString(),"\n"):"","Schema:\n").concat(i)}).join("\n");return t.map(a=>'"'.concat(a.tableName,'"')).join(", "),"You are a data analysis expert helping users analyze their data using both SQL and Python. You have access to DuckDB for data querying and a Python environment with pandas, numpy, matplotlib, and other data science libraries.\n\nDATABASE CONTEXT:\n".concat(n,'\n\nAVAILABLE TOOLS:\n1. **SQL Queries**: Use DuckDB syntax for data extraction and aggregation\n2. **Python Analysis**: Use Python for advanced analytics, visualizations, and machine learning\n3. **Data Bridge**: Use the sql() function in Python to query DuckDB data directly\n\nPYTHON DATA ACCESS:\n- Use `df = await sql("YOUR_SQL_QUERY")` to get data as a pandas DataFrame\n- The sql() function connects directly to your DuckDB tables\n- All standard data science libraries are available (pandas, numpy, matplotlib, seaborn, scipy, scikit-learn)\n- Advanced visualization libraries: plotly (px, go), altair (alt), seaborn (sns)\n\nINSTRUCTIONS:\n1. **For Data Queries**: Generate DuckDB-compatible SQL queries with appropriate LIMIT clauses\n2. **For Analysis Tasks**: Provide Python code that uses sql() to fetch data and then analyzes it\n3. **For Visualizations**: Generate Python code with matplotlib/plotly for charts and graphs\n4. **For Complex Analysis**: Combine SQL for data preparation with Python for advanced analytics\n5. **Use Simple Language**: Avoid complex words like "comprehensive", "facilitate", "utilize" - use simpler alternatives like "complete", "help", "use"\n\nRESPONSE FORMAT:\nCRITICAL: Start with your insight identification, then work through the analysis to build the query. Structure your response as follows:\n\n**INSIGHT_TITLE:** [A concise, descriptive title (2-6 words) that captures the main insight you\'ll discover]\n**QUERY_DESCRIPTION:** [Brief 1-2 sentence explanation of what this query will show the user]\n**CHART_SUGGESTION:** [Recommend the best chart type: "bar", "line", "pie", "scatter", "area", or "none". Include axes, e.g., "line chart: x=date, y=sales, color=region"]\n\n**QUERY_NAME:** [A brief name for this analysis (2-4 words)]\n\n**STATUS_TITLE:** [Your custom title for data exploration phase]\n**STATUS_SUBTITLE:** [Your custom subtitle describing what you\'re analyzing]\n\n[Spend time here: Examine the table schema, understand column types, assess data quality, note any constraints or relationships. Write your detailed thoughts about the data structure. Use simple, direct language. Avoid complex words like "comprehensive" - use "complete" or "detailed" instead. Create engaging, specific titles that reflect what you\'re actually doing.]\n\n**STATUS_TITLE:** [Your custom title for pattern discovery phase]\n**STATUS_SUBTITLE:** [Your custom subtitle describing the patterns you\'re seeking]\n\n[Spend time here: Look for patterns, correlations, trends. Consider what insights might be hidden in the data. Think about interesting aggregations or groupings. Make your titles specific to the data and analysis type.]\n\n**STATUS_TITLE:** [Your custom title for analysis approach phase]\n**STATUS_SUBTITLE:** [Your custom subtitle describing your analytical approach]\n\n[Spend time here: Explain your analytical approach and what you discovered through your exploration. Describe the patterns, insights, and conclusions you\'ve drawn from examining the data.]\n\n**STATUS_TITLE:** [Your custom title for query generation phase]\n**STATUS_SUBTITLE:** [Your custom subtitle describing the SQL/Python you\'re building]\n\n[Final step: Now generate the SQL query or Python code to demonstrate and validate your findings. The code should extract the data that supports your insight.]\n\n**INSIGHT_TITLE:** [A concise, descriptive title (2-6 words) that captures the main insight]\n**QUERY_DESCRIPTION:** [Brief 1-2 sentence explanation of what this query will show the user]\n**CHART_SUGGESTION:** [Recommend the best chart type: "bar", "line", "pie", "scatter", "area", or "none". Include axes, e.g., "line chart: x=date, y=sales, color=region"]\n\n**QUERY_NAME:** [A brief name for this analysis (2-4 words)]\n\nEXAMPLES of dynamic status titles:\n- "Revenue Trends" / "Scanning quarterly performance data"\n- "Customer Segmentation" / "Identifying high-value user groups" \n- "Performance Bottlenecks" / "Analyzing slow query patterns"\n- "Data Quality Check" / "Validating completeness and accuracy"\n\n**DETAILED_ANALYSIS:** [Optional - Full detailed explanation, methodology, code breakdown, and next steps. This will be hidden by default but available for users who want deeper insights.]\n\nPYTHON CODE PATTERNS:\n```python\n# Get data from DuckDB\ndf = await sql("SELECT * FROM ').concat(((r=t[0])==null?void 0:r.tableName)||"your_table"," LIMIT 100\")\n\n# Perform analysis\nresult = df.describe()\nprint(result)\n\n# Matplotlib visualization\nimport matplotlib.pyplot as plt\ndf.plot(kind='bar')\nplt.title('Your Analysis')\nplt.show()\n\n# Interactive Plotly visualization\nimport plotly.express as px\nfig = px.scatter(df, x='column1', y='column2', title='Interactive Scatter Plot')\nfig.show()\n\n# Seaborn statistical plot\nimport seaborn as sns\nsns.heatmap(df.corr(), annot=True)\nplt.title('Correlation Heatmap')\nplt.show()\n\n# Altair grammar of graphics\nimport altair as alt\nchart = alt.Chart(df).mark_circle(size=60).encode(\n    x='column1:Q',\n    y='column2:Q',\n    color='category:N'\n).interactive()\nchart.show()\n```\n\nVISUALIZATION CAPABILITIES:\n- **Matplotlib**: Static plots (plt.plot, plt.bar, plt.scatter, plt.hist)\n- **Plotly**: Interactive charts (px.scatter, px.line, px.bar, go.Figure)\n- **Altair**: Grammar of graphics (alt.Chart().mark_*())\n- **Seaborn**: Statistical visualizations (sns.scatterplot, sns.heatmap, sns.boxplot)\n- **Pandas**: Quick plots (df.plot(), df.hist(), df.boxplot())\n\nChoose the best tool (SQL vs Python) based on the task complexity and user needs.")},mu=e=>{const t=e.schema.map(n=>"  ".concat(n.name,": ").concat(n.type)).join("\n");return"You are a data analysis expert helping users analyze their data using both SQL and Python. You have access to DuckDB for data querying and a Python environment with pandas, numpy, matplotlib, and other data science libraries.\n\nDATABASE CONTEXT:\nTable: ".concat(e.tableName,"\nSchema:\n").concat(t,"\n").concat(e.rowCount?"Row count: ".concat(e.rowCount.toLocaleString()):"","\n").concat(e.description?"Description: ".concat(e.description):"",'\n\nAVAILABLE TOOLS:\n1. **SQL Queries**: Use DuckDB syntax for data extraction and aggregation\n2. **Python Analysis**: Use Python for advanced analytics, visualizations, and machine learning\n3. **Data Bridge**: Use the sql() function in Python to query DuckDB data directly\n\nPYTHON DATA ACCESS:\n- Use `df = await sql("YOUR_SQL_QUERY")` to get data as a pandas DataFrame\n- The sql() function connects directly to your DuckDB tables\n- All standard data science libraries are available (pandas, numpy, matplotlib, seaborn, scipy, scikit-learn)\n- Advanced visualization libraries: plotly (px, go), altair (alt), seaborn (sns)\n\nINSTRUCTIONS:\n1. **For Data Queries**: Generate DuckDB-compatible SQL queries with appropriate LIMIT clauses\n2. **For Analysis Tasks**: Provide Python code that uses sql() to fetch data and then analyzes it\n3. **For Visualizations**: Generate Python code with matplotlib/plotly for charts and graphs\n4. **For Complex Analysis**: Combine SQL for data preparation with Python for advanced analytics\n5. **Use Simple Language**: Avoid complex words like "comprehensive", "facilitate", "utilize" - use simpler alternatives like "complete", "help", "use"\n\nRESPONSE FORMAT:\nCRITICAL: Structure your thinking process around these dynamic status updates. Create your own relevant titles and subtitles for each phase based on the specific analysis:\n\n**INSIGHT_TITLE:** [A concise, descriptive title (2-6 words) that captures the main insight]\n**QUERY_DESCRIPTION:** [Brief 1-2 sentence explanation of what this query will show the user]\n\n**STATUS_TITLE:** [Your custom title for data exploration phase]\n**STATUS_SUBTITLE:** [Your custom subtitle describing what you\'re analyzing]\n\n[Spend time here: Examine the table schema, understand column types, assess data quality, note any constraints or relationships. Write your detailed thoughts about the data structure. Use simple, direct language. Avoid complex words like "comprehensive" - use "complete" or "detailed" instead. Create engaging, specific titles that reflect what you\'re actually doing.]\n\n**STATUS_TITLE:** [Your custom title for pattern discovery phase]\n**STATUS_SUBTITLE:** [Your custom subtitle describing the patterns you\'re seeking]\n\n[Spend time here: Look for patterns, correlations, trends. Consider what insights might be hidden in the data. Think about interesting aggregations or groupings. Make your titles specific to the data and analysis type.]\n\n**STATUS_TITLE:** [Your custom title for analysis approach phase]\n**STATUS_SUBTITLE:** [Your custom subtitle describing your analytical approach]\n\n[Spend time here: Explain your analytical approach and what you discovered through your exploration. Describe the patterns, insights, and conclusions you\'ve drawn from examining the data.]\n\n**STATUS_TITLE:** [Your custom title for query generation phase]\n**STATUS_SUBTITLE:** [Your custom subtitle describing the SQL/Python you\'re building]\n\n[Final step: Now generate the SQL query or Python code to demonstrate and validate your findings. The code should extract the data that supports your insight.]\n\n**INSIGHT_TITLE:** [A concise, descriptive title (2-6 words) that captures the main insight]\n**QUERY_DESCRIPTION:** [Brief 1-2 sentence explanation of what this query will show the user]\n**CHART_SUGGESTION:** [Recommend the best chart type: "bar", "line", "pie", "scatter", "area", or "none". Include axes, e.g., "line chart: x=date, y=sales, color=region"]\n\n**QUERY_NAME:** [A brief name for this analysis (2-4 words)]\n\nEXAMPLES of dynamic status titles:\n- "Revenue Trends" / "Scanning quarterly performance data"\n- "Customer Segmentation" / "Identifying high-value user groups" \n- "Performance Bottlenecks" / "Analyzing slow query patterns"\n- "Data Quality Check" / "Validating completeness and accuracy"\n\n**DETAILED_ANALYSIS:** [Optional - Full detailed explanation, methodology, code breakdown, and next steps. This will be hidden by default but available for users who want deeper insights.]\n\nPYTHON CODE PATTERNS:\n```python\n# Get data from DuckDB\ndf = await sql("SELECT * FROM ').concat(e.tableName," LIMIT 100\")\n\n# Perform analysis\nresult = df.describe()\nprint(result)\n\n# Multiple visualization options\nimport matplotlib.pyplot as plt\nimport plotly.express as px\nimport seaborn as sns\n\n# Option 1: Matplotlib (static)\ndf.plot(kind='bar')\nplt.title('Your Analysis')\nplt.show()\n\n# Option 2: Plotly (interactive)\nfig = px.histogram(df, x='column_name', title='Interactive Histogram')\nfig.show()\n\n# Option 3: Seaborn (statistical)\nsns.boxplot(data=df, y='numeric_column')\nplt.title('Distribution Analysis')\nplt.show()\n```\n\nVISUALIZATION CAPABILITIES:\n- **Matplotlib**: Static plots (plt.plot, plt.bar, plt.scatter, plt.hist)\n- **Plotly**: Interactive charts (px.scatter, px.line, px.bar, go.Figure)\n- **Altair**: Grammar of graphics (alt.Chart().mark_*())\n- **Seaborn**: Statistical visualizations (sns.scatterplot, sns.heatmap, sns.boxplot)\n- **Pandas**: Quick plots (df.plot(), df.hist(), df.boxplot())\n\nChoose the best tool (SQL vs Python) based on the task complexity and user needs.")},Jh=(e,t,n)=>{const r=(n==null?void 0:n.maxRows)||100;let a='Generate a SQL query for: "'.concat(e,'"\n\nTable: ').concat(t.tableName,"\nAvailable columns: ").concat(t.schema.map(s=>"".concat(s.name," (").concat(s.type,")")).join(", "),"\n\nRequirements:\n- Use DuckDB syntax\n- Include LIMIT ").concat(r," unless the user specifically requests more\n- Ensure column names match exactly\n- Handle data types properly");if(n!=null&&n.includeExplanation&&(a+="\n- Include a brief explanation of the query"),n!=null&&n.includeOptimization&&(a+="\n- Suggest any performance optimizations"),t.sampleData&&t.sampleData.length>0){const s=t.sampleData.slice(0,3).map(i=>JSON.stringify(i)).join("\n");a+="\n\nSample data for reference:\n".concat(s)}return a},Zh=(e,t,n)=>{let r='Analyze the data based on: "'.concat(e,'"\n\nTable: ').concat(t.tableName,"\nSchema: ").concat(t.schema.map(a=>"".concat(a.name," (").concat(a.type,")")).join(", "),"\n").concat(t.rowCount?"Total rows: ".concat(t.rowCount.toLocaleString()):"","\n\nPlease provide:\n1. Key insights and patterns\n2. Statistical summary if relevant\n3. Recommendations for further analysis\n4. Potential data quality issues\n5. Suggested visualizations\n\nFormat your response with clear sections and actionable insights.");if(n&&n.length>0){const a=n.slice(0,5).map((s,i)=>"Row ".concat(i+1,": ").concat(JSON.stringify(s))).join("\n");r+="\n\nData preview:\n".concat(a)}return r};class XEe{constructor(t={strategy:"local-proxy"}){Kt(this,"config");this.config=t}makeRequest(t,n){return H(this,null,function*(){switch(this.config.strategy){case"local-proxy":return this.makeLocalProxyRequest(t,n);case"cors-anywhere":return this.makeCORSAnywhereRequest(t,n);case"browser-extension":return this.makeBrowserExtensionRequest(t,n);case"electron":return this.makeElectronRequest(t,n);default:throw new Error("Unsupported proxy strategy: ".concat(this.config.strategy))}})}makeLocalProxyRequest(t,n){return H(this,null,function*(){const r=this.config.proxyUrl||"http://localhost:3001/api/proxy",a=he(q({},n),{headers:he(q({},n.headers),{"X-Target-URL":t,"Content-Type":"application/json"})});try{return yield fetch(r,a)}catch(s){throw new Error("Proxy request failed: ".concat(s instanceof Error?s.message:"Unknown error"))}})}makeCORSAnywhereRequest(t,n){return H(this,null,function*(){return fetch("https://cors-anywhere.herokuapp.com/"+t,n)})}makeBrowserExtensionRequest(t,n){return H(this,null,function*(){var r;if("chrome"in window&&((r=window.chrome)!=null&&r.runtime))return new Promise((a,s)=>{window.chrome.runtime.sendMessage({action:"fetch",url:t,options:n},i=>{i.error?s(new Error(i.error)):a(new Response(i.body,{status:i.status,headers:i.headers}))})});throw new Error("Browser extension not available")})}makeElectronRequest(t,n){return H(this,null,function*(){if("electronAPI"in window){const r=yield window.electronAPI.fetch(t,n);return new Response(r.body,{status:r.status,headers:r.headers})}throw new Error("Electron API not available")})}isAvailable(){return H(this,null,function*(){switch(this.config.strategy){case"local-proxy":return this.checkLocalProxy();case"cors-anywhere":return this.checkCORSAnywhere();case"browser-extension":return this.checkBrowserExtension();case"electron":return this.checkElectron();default:return!1}})}checkLocalProxy(){return H(this,null,function*(){try{const t=this.config.proxyUrl||"http://localhost:3001/health";return(yield fetch(t,{method:"GET"})).ok}catch(t){return!1}})}checkCORSAnywhere(){return H(this,null,function*(){try{return(yield fetch("https://cors-anywhere.herokuapp.com/",{method:"HEAD"})).ok}catch(t){return!1}})}checkBrowserExtension(){var t;return"chrome"in window&&!!((t=window.chrome)!=null&&t.runtime)}checkElectron(){return"electronAPI"in window}getSetupInstructions(){switch(this.config.strategy){case"local-proxy":return'\n**Local Proxy Setup Required**\n\nTo use cloud AI providers, you need to run the DataKit proxy server:\n\n1. In a new terminal, run:\n   ```bash\n   npm run proxy-server\n   ```\n\n2. Or start the development server with proxy:\n   ```bash\n   npm run dev:with-proxy\n   ```\n\n**Alternative: Use Local Models**\n- Switch to "Local Models" in the AI settings\n- Download a model to run AI entirely in your browser\n- No proxy required, complete privacy!\n';case"browser-extension":return'\n**Browser Extension Required**\n\nInstall the DataKit browser extension to enable cloud AI APIs:\n\n1. Go to Chrome Web Store\n2. Search for "DataKit AI Extension"\n3. Click "Add to Chrome"\n4. Restart DataKit\n\n**Alternative: Use Local Models**\n- No extension required for local models\n- Complete privacy and offline capability\n';case"electron":return"\n**Desktop App Recommended**\n\nFor the best experience with cloud AI APIs, use the DataKit desktop app:\n\n1. Download DataKit Desktop from our website\n2. No CORS limitations\n3. Better performance and integration\n\n**Alternative: Use Local Models**\n- Works perfectly in web version\n- No installation required\n";default:return'\n**CORS Issue Detected**\n\nCloud AI APIs can\'t be called directly from the browser due to security restrictions.\n\n**Recommended Solutions:**\n1. **Use Local Models** (easiest)\n   - Switch to "Local Models" in AI settings\n   - Download a model for complete privacy\n   \n2. **Run DataKit Desktop**\n   - No CORS limitations\n   - Better performance\n\n3. **Development Mode**\n   - Start Chrome with: --disable-web-security --user-data-dir=/tmp/chrome\n   - Only for testing, not recommended for regular use\n'}}}const Cp=new XEe({strategy:"local-proxy"});class KL{constructor(t,n={}){Kt(this,"baseUrl");Kt(this,"headers");this.baseUrl=t,this.headers=n}makeRequest(r){return H(this,arguments,function*(t,n={}){const a="".concat(this.baseUrl).concat(t),h=n,{timeout:s=3e4,retries:i=2,fallbackToLocal:l=!0}=h,c=Tn(h,["timeout","retries","fallbackToLocal"]),u=he(q({},c),{headers:q(q({},this.headers),c.headers)});try{return yield this.fetchWithTimeout(a,u,s)}catch(m){if(m instanceof TypeError&&m.message.includes("Failed to fetch"))return this.tryProxyRequest(a,u,i);throw m}})}tryProxyRequest(t,n,r){return H(this,null,function*(){for(let a=0;a<=r;a++)try{if(!(yield Cp.isAvailable()))throw new Error("CORS_PROXY_UNAVAILABLE");return yield Cp.makeRequest(t,n)}catch(s){if(a===r)throw new Error("CORS_BLOCKED");yield new Promise(i=>setTimeout(i,1e3*(a+1)))}throw new Error("Max retries exceeded")})}fetchWithTimeout(t,n,r){return H(this,null,function*(){const a=new AbortController,s=setTimeout(()=>a.abort(),r);try{const i=yield fetch(t,he(q({},n),{signal:a.signal}));return clearTimeout(s),i}catch(i){throw clearTimeout(s),i}})}}class MA extends Error{constructor(n,r,a=!0){super(n);Kt(this,"instructions");Kt(this,"canFallbackToLocal");this.name="CORSError",this.instructions=r,this.canFallbackToLocal=a}}function Ih(e){if(e.message==="CORS_BLOCKED"||e.message.includes("CORS"))return new MA("API access blocked by browser security policy",Cp.getSetupInstructions(),!0);if(e.message==="CORS_PROXY_UNAVAILABLE")return new MA("Proxy server not available",Cp.getSetupInstructions(),!0);if(e instanceof TypeError&&e.message.includes("Failed to fetch"))return new MA("Network request failed - likely CORS issue",Cp.getSetupInstructions(),!0);throw e}class KEe{constructor(t,n="gpt-4o-2024-11-20"){Kt(this,"apiKey");Kt(this,"model");Kt(this,"apiProvider");this.apiKey=t,this.model=n,this.apiProvider=new KL("https://api.openai.com/v1",{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"})}validateApiKey(){return H(this,null,function*(){try{return(yield this.apiProvider.makeRequest("/models",{method:"GET"})).ok}catch(t){return!1}})}generateCompletion(t,n){return H(this,null,function*(){var r,a,s,i;try{const l=yield this.apiProvider.makeRequest("/chat/completions",{method:"POST",body:JSON.stringify({model:this.model,messages:t.map(u=>({role:u.role,content:u.content})),temperature:(n==null?void 0:n.temperature)||.1,max_tokens:(n==null?void 0:n.maxTokens)||2e3,stream:(n==null?void 0:n.stream)||!1})});if(!l.ok){const u=yield l.json();throw new Error("OpenAI API error: ".concat(((r=u.error)==null?void 0:r.message)||"Unknown error"))}const c=yield l.json();return{content:((s=(a=c.choices[0])==null?void 0:a.message)==null?void 0:s.content)||"",usage:c.usage?{promptTokens:c.usage.prompt_tokens||0,completionTokens:c.usage.completion_tokens||0,totalTokens:c.usage.total_tokens||(c.usage.prompt_tokens||0)+(c.usage.completion_tokens||0)}:void 0,model:c.model,finishReason:(i=c.choices[0])==null?void 0:i.finish_reason}}catch(l){throw Ih(l)}})}generateStreamCompletion(t,n,r){return H(this,null,function*(){var a,s,i,l,c;try{const u=yield this.apiProvider.makeRequest("/chat/completions",{method:"POST",body:JSON.stringify({model:this.model,messages:t.map(T=>({role:T.role,content:T.content})),temperature:(r==null?void 0:r.temperature)||.1,max_tokens:(r==null?void 0:r.maxTokens)||2e3,stream:!0,stream_options:{include_usage:!0}})});if(!u.ok){const T=yield u.json();throw new Error("OpenAI API error: ".concat(((a=T.error)==null?void 0:a.message)||"Unknown error"))}const h=(s=u.body)==null?void 0:s.getReader();if(!h)throw new Error("No reader available");const m=new TextDecoder;let p="",g;try{for(;;){const{done:T,value:y}=yield h.read();if(T){n({content:p,done:!0,usage:g});break}const x=m.decode(y).split("\n").filter(R=>R.trim().startsWith("data: "));for(const R of x){const A=R.replace("data: ","");if(A==="[DONE]"){n({content:p,done:!0,usage:g});return}try{const w=JSON.parse(A),_=(c=(l=(i=w.choices)==null?void 0:i[0])==null?void 0:l.delta)==null?void 0:c.content;_&&(p+=_,n({content:p,done:!1})),w.usage&&(g={promptTokens:w.usage.prompt_tokens||0,completionTokens:w.usage.completion_tokens||0})}catch(w){continue}}}}finally{h.releaseLock()}}catch(u){throw Ih(u)}})}generateSQL(t){return H(this,null,function*(){const n=mu(t.context),r=Jh(t.prompt,t.context,{includeExplanation:t.includeExplanation,maxRows:t.maxRows}),a=[{role:"system",content:n},{role:"user",content:r}],s=yield this.generateCompletion(a,{temperature:.1}),i=this.extractSQL(s.content),l=this.extractExplanation(s.content);return{sql:i,explanation:l,confidence:.9,warnings:this.extractWarnings(s.content)}})}analyzeData(t){return H(this,null,function*(){const n=Zh(t.prompt,t.context,t.data),r=[{role:"system",content:"You are a data analyst expert. Provide clear, actionable insights with specific recommendations."},{role:"user",content:n}],a=yield this.generateCompletion(r,{temperature:.3});return{analysis:a.content,insights:this.extractInsights(a.content),suggestions:this.extractSuggestions(a.content)}})}extractSQL(t){const n=t.match(/```sql\n([\s\S]*?)\n```/i);if(n)return n[1].trim();const a=t.split("\n").filter(s=>/^\s*(SELECT|WITH|INSERT|UPDATE|DELETE|CREATE)/i.test(s.trim()));return a.length>0?a.join("\n").trim():t.trim()}extractExplanation(t){const n=t.match(new RegExp("explanation:?\\s*(.*?)(?=\\n\\n|\\n```|$)","is"));if(n)return n[1].trim();const r=t.replace(/```sql[\s\S]*?```/gi,"").trim();if(r&&r!==t.trim())return r}extractWarnings(t){const n=[];return[/warning:?\s*(.*?)(?=\n|$)/gi,/note:?\s*(.*?)(?=\n|$)/gi,/performance:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}extractInsights(t){const n=[],r=t.split("\n").filter(a=>a.trim());for(const a of r)(a.includes("trend")||a.includes("pattern"))&&n.push({type:"trend",title:"Data Trend",description:a.trim(),confidence:.8});return n}extractSuggestions(t){const n=[];return[/recommendation:?\s*(.*?)(?=\n|$)/gi,/suggest:?\s*(.*?)(?=\n|$)/gi,/consider:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}calculateCost(t){const a=t.promptTokens/1e3*.03,s=t.completionTokens/1e3*.06;return a+s}}class QEe{constructor(t,n="claude-sonnet-4-5-20250929"){Kt(this,"apiKey");Kt(this,"model");Kt(this,"apiProvider");this.apiKey=t,this.model=n,this.apiProvider=new KL("https://api.anthropic.com/v1",{"x-api-key":t,"Content-Type":"application/json","anthropic-version":"2023-06-01","anthropic-dangerous-direct-browser-access":"true"})}validateApiKey(){return H(this,null,function*(){try{const t=yield this.generateCompletion([{role:"user",content:"Hello"}],{maxTokens:10});return!0}catch(t){return!1}})}generateCompletion(t,n){return H(this,null,function*(){var r,a,s;try{const i=this.convertMessages(t),l=yield this.apiProvider.makeRequest("/messages",{method:"POST",body:JSON.stringify({model:this.model,messages:i.messages,system:i.system,max_tokens:(n==null?void 0:n.maxTokens)||2e3,temperature:(n==null?void 0:n.temperature)||.1,stream:(n==null?void 0:n.stream)||!1})});if(!l.ok){const h=yield l.json();throw new Error("Anthropic API error: ".concat(((r=h.error)==null?void 0:r.message)||"Unknown error"))}const c=yield l.json(),u=c.usage?(c.usage.input_tokens||0)+(c.usage.cache_creation_input_tokens||0)+(c.usage.cache_read_input_tokens||0):0;return{content:((s=(a=c.content)==null?void 0:a[0])==null?void 0:s.text)||"",usage:c.usage?{promptTokens:u,completionTokens:c.usage.output_tokens||0,totalTokens:u+(c.usage.output_tokens||0)}:void 0,model:c.model,finishReason:c.stop_reason}}catch(i){throw Ih(i)}})}generateStreamCompletion(t,n,r){return H(this,null,function*(){var a,s,i,l;try{const c=this.convertMessages(t),u=yield this.apiProvider.makeRequest("/messages",{method:"POST",body:JSON.stringify({model:this.model,messages:c.messages,system:c.system,max_tokens:(r==null?void 0:r.maxTokens)||2e3,temperature:(r==null?void 0:r.temperature)||.1,stream:!0})});if(!u.ok){const T=yield u.json();throw new Error("Anthropic API error: ".concat(((a=T.error)==null?void 0:a.message)||"Unknown error"))}const h=(s=u.body)==null?void 0:s.getReader();if(!h)throw new Error("No reader available");const m=new TextDecoder;let p="",g;try{for(;;){const{done:T,value:y}=yield h.read();if(T){n({content:p,done:!0,usage:g});break}const x=m.decode(y).split("\n").filter(R=>R.trim().startsWith("data: "));for(const R of x){const A=R.replace("data: ","");try{const w=JSON.parse(A);if(w.type==="content_block_delta"&&((i=w.delta)!=null&&i.text))p+=w.delta.text,n({content:p,done:!1});else if(w.type==="message_delta"&&w.usage)g={promptTokens:(w.usage.input_tokens||0)+(w.usage.cache_creation_input_tokens||0)+(w.usage.cache_read_input_tokens||0)||(g==null?void 0:g.promptTokens)||0,completionTokens:w.usage.output_tokens||0};else if(w.type==="message_start"&&((l=w.message)!=null&&l.usage))g={promptTokens:(w.message.usage.input_tokens||0)+(w.message.usage.cache_creation_input_tokens||0)+(w.message.usage.cache_read_input_tokens||0),completionTokens:w.message.usage.output_tokens||0};else if(w.type==="message_stop"){n({content:p,done:!0,usage:g});return}}catch(w){continue}}}}finally{h.releaseLock()}}catch(c){throw Ih(c)}})}generateSQL(t){return H(this,null,function*(){const n=mu(t.context),r=Jh(t.prompt,t.context,{includeExplanation:t.includeExplanation,maxRows:t.maxRows}),a=[{role:"system",content:n},{role:"user",content:r}],s=yield this.generateCompletion(a,{temperature:.1}),i=this.extractSQL(s.content),l=this.extractExplanation(s.content);return{sql:i,explanation:l,confidence:.9,warnings:this.extractWarnings(s.content)}})}analyzeData(t){return H(this,null,function*(){const n=Zh(t.prompt,t.context,t.data),r=[{role:"system",content:"You are a data analyst expert. Provide clear, actionable insights with specific recommendations."},{role:"user",content:n}],a=yield this.generateCompletion(r,{temperature:.3});return{analysis:a.content,insights:this.extractInsights(a.content),suggestions:this.extractSuggestions(a.content)}})}convertMessages(t){const n=t.find(a=>a.role==="system"),r=t.filter(a=>a.role!=="system").map(a=>({role:a.role,content:a.content}));return{system:n==null?void 0:n.content,messages:r}}extractSQL(t){const n=t.match(/```sql\n([\s\S]*?)\n```/i);if(n)return n[1].trim();const a=t.split("\n").filter(s=>/^\s*(SELECT|WITH|INSERT|UPDATE|DELETE|CREATE)/i.test(s.trim()));return a.length>0?a.join("\n").trim():t.trim()}extractExplanation(t){const n=t.match(new RegExp("explanation:?\\s*(.*?)(?=\\n\\n|\\n```|$)","is"));if(n)return n[1].trim();const r=t.replace(/```sql[\s\S]*?```/gi,"").trim();if(r&&r!==t.trim())return r}extractWarnings(t){const n=[];return[/warning:?\s*(.*?)(?=\n|$)/gi,/note:?\s*(.*?)(?=\n|$)/gi,/performance:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}extractInsights(t){const n=[],r=t.split("\n").filter(a=>a.trim());for(const a of r)(a.includes("trend")||a.includes("pattern"))&&n.push({type:"trend",title:"Data Trend",description:a.trim(),confidence:.8});return n}extractSuggestions(t){const n=[];return[/recommendation:?\s*(.*?)(?=\n|$)/gi,/suggest:?\s*(.*?)(?=\n|$)/gi,/consider:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}calculateCost(t){const a=t.promptTokens/1e3*.003,s=t.completionTokens/1e3*.015;return a+s}}class JEe{constructor(t,n="llama-3.3-70b-versatile"){Kt(this,"apiKey");Kt(this,"model");Kt(this,"apiProvider");this.apiKey=t,this.model=n,this.apiProvider=new KL("https://api.groq.com/openai/v1",{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"})}validateApiKey(){return H(this,null,function*(){try{return(yield this.apiProvider.makeRequest("/models",{method:"GET"})).ok}catch(t){return!1}})}generateCompletion(t){return H(this,null,function*(){var n,r,a;try{const s=yield this.apiProvider.makeRequest("/chat/completions",{method:"POST",body:JSON.stringify({model:this.model,messages:t.map(l=>({role:l.role,content:l.content})),temperature:.1,max_tokens:2e3})});if(!s.ok)throw new Error("Groq API error: ".concat(s.status," ").concat(s.statusText));const i=yield s.json();return{content:i.choices[0].message.content,usage:{promptTokens:((n=i.usage)==null?void 0:n.prompt_tokens)||0,completionTokens:((r=i.usage)==null?void 0:r.completion_tokens)||0,totalTokens:((a=i.usage)==null?void 0:a.total_tokens)||0},model:this.model}}catch(s){throw Ih(s)}})}generateStreamCompletion(a,s){return H(this,arguments,function*(t,n,r={}){var i,l,c;try{const u={model:this.model,messages:t.map(b=>({role:b.role,content:b.content})),temperature:r.temperature||.1,max_tokens:r.maxTokens||2e3,stream:!0},h=yield this.apiProvider.makeRequest("/chat/completions",{method:"POST",body:JSON.stringify(u)});if(!h.ok){const b=yield h.text();throw new Error("Groq API error: ".concat(h.status," ").concat(h.statusText,": ").concat(b))}const m=(i=h.body)==null?void 0:i.getReader();if(!m)throw new Error("No response body reader available");const p=new TextDecoder;let g="",T="",y={promptTokens:0,completionTokens:0,totalTokens:0};try{for(;;){const{done:b,value:x}=yield m.read();if(b){n({content:T,done:!0,usage:y});break}g+=p.decode(x,{stream:!0});const R=g.split("\n");g=R.pop()||"";for(const A of R){const w=A.trim();if(w.startsWith("data: ")){const _=w.slice(6);if(_==="[DONE]"){n({content:T,done:!0,usage:y});return}try{const N=JSON.parse(_),I=(l=N.choices)==null?void 0:l[0];(c=I==null?void 0:I.delta)!=null&&c.content&&(T+=I.delta.content,n({content:T,done:!1})),N.usage&&(y={promptTokens:N.usage.prompt_tokens||0,completionTokens:N.usage.completion_tokens||0,totalTokens:N.usage.total_tokens||0})}catch(N){}}}}}finally{m.releaseLock()}}catch(u){throw Ih(u)}})}generateSQL(t){return H(this,null,function*(){const n=mu(t.context),r=Jh(t.prompt,t.context),a=[{role:"system",content:n},{role:"user",content:r}];try{const s=yield this.generateCompletion(a),i=s.content.match(/```sql\n([\s\S]*?)\n```/);return{sql:i?i[1].trim():s.content.trim(),explanation:s.content,confidence:.8,warnings:[],usage:s.usage}}catch(s){throw s}})}analyzeData(t){return H(this,null,function*(){const n=mu(t.context),r=Zh(t.prompt,t.context,t.data),a=[{role:"system",content:n},{role:"user",content:r}];try{const s=yield this.generateCompletion(a);return{analysis:s.content,insights:[],suggestions:[],confidence:.8,usage:s.usage}}catch(s){throw s}})}calculateCost(t){return 0}}class ZEe{constructor(t=!0){Kt(this,"engine",null);Kt(this,"currentModel",null);Kt(this,"isInitializing",!1);Kt(this,"useWorker",!0);Kt(this,"SUPPORTED_MODELS",[{id:"Llama-3.2-3B-Instruct-q4f32_1-MLC",name:"Llama 3.2 3B Instruct",size:1800,description:"Fast and efficient for SQL generation",capabilities:["sql","analysis","reasoning"]},{id:"Phi-3.5-mini-instruct-q4f16_1-MLC",name:"Phi 3.5 Mini Instruct",size:2300,description:"Microsoft's efficient model for code and reasoning",capabilities:["sql","code","analysis"]},{id:"gemma-2-2b-it-q4f16_1-MLC",name:"Gemma 2 2B Instruct",size:1400,description:"Google's lightweight model for text tasks",capabilities:["sql","basic"]}]);this.useWorker=t}validateApiKey(){return H(this,null,function*(){return!0})}isWebGPUSupported(){return H(this,null,function*(){if(!navigator.gpu)return!1;try{return(yield navigator.gpu.requestAdapter())!==null}catch(t){return!1}})}initializeEngine(){return H(this,null,function*(){if(!(this.engine||this.isInitializing)){this.isInitializing=!0;try{if(!(yield this.isWebGPUSupported()))throw new Error("WebGPU is not supported in this browser. Please use Chrome/Edge 113+ or Firefox 110+");let n;try{n=yield fn(()=>import("./index-BLS-cIg5.js"),[])}catch(r){throw new Error("WebLLM package not found. Please install @mlc-ai/web-llm")}this.useWorker?this.engine=new n.EngineWorkerHandler:this.engine=new n.MLCEngine}catch(t){throw t}finally{this.isInitializing=!1}}})}loadModel(t,n){return H(this,null,function*(){if(this.engine||(yield this.initializeEngine()),!this.engine)throw new Error("Failed to initialize WebLLM engine");try{const r=n?{initProgressCallback:a=>{a.progress!==void 0&&n(a.progress*100)}}:void 0;yield this.engine.reload(t,r),this.currentModel=t}catch(r){throw r}})}unloadModel(){return H(this,null,function*(){this.engine&&(yield this.engine.unload(),this.currentModel=null)})}isModelLoaded(){var t;return((t=this.engine)==null?void 0:t.isLoaded())||!1}getCurrentModel(){var t;return((t=this.engine)==null?void 0:t.getLoadedModelId())||null}getAvailableModels(){return this.SUPPORTED_MODELS}generateCompletion(t,n){return H(this,null,function*(){var a,s,i;if(!this.engine||!this.isModelLoaded())throw new Error("No model is currently loaded");const r=t.map(l=>({role:l.role,content:l.content}));try{const l=yield this.engine.chat.completions.create({messages:r,temperature:(n==null?void 0:n.temperature)||.1,max_tokens:(n==null?void 0:n.maxTokens)||2e3,stream:!1});return{content:((s=(a=l.choices[0])==null?void 0:a.message)==null?void 0:s.content)||"",usage:l.usage?{promptTokens:l.usage.prompt_tokens||0,completionTokens:l.usage.completion_tokens||0,totalTokens:l.usage.total_tokens||0}:void 0,model:this.currentModel||"unknown",finishReason:(i=l.choices[0])==null?void 0:i.finish_reason}}catch(l){throw new Error("WebLLM completion failed: ".concat(l instanceof Error?l.message:"Unknown error"))}})}generateStreamCompletion(t,n,r){return H(this,null,function*(){var s,i,l;if(!this.engine||!this.isModelLoaded())throw new Error("No model is currently loaded");const a=t.map(p=>({role:p.role,content:p.content}));try{const p=yield this.engine.chat.completions.create({messages:a,temperature:(r==null?void 0:r.temperature)||.1,max_tokens:(r==null?void 0:r.maxTokens)||2e3,stream:!0});let g="";try{for(var c=iT(p),u,h,m;u=!(h=yield c.next()).done;u=!1){const T=h.value;const y=(i=(s=T.choices[0])==null?void 0:s.delta)==null?void 0:i.content;if(y&&(g+=y,n({content:g,done:!1})),(l=T.choices[0])!=null&&l.finish_reason){n({content:g,done:!0,usage:T.usage?{promptTokens:T.usage.prompt_tokens||0,completionTokens:T.usage.completion_tokens||0,totalTokens:T.usage.total_tokens||0}:void 0});break}}}catch(h){m=[h]}finally{try{u&&(h=c.return)&&(yield h.call(c))}finally{if(m)throw m[0]}}}catch(p){throw new Error("WebLLM streaming failed: ".concat(p instanceof Error?p.message:"Unknown error"))}})}generateSQL(t){return H(this,null,function*(){const n=mu(t.context),r=Jh(t.prompt,t.context,{includeExplanation:t.includeExplanation,maxRows:t.maxRows}),a=[{role:"system",content:n},{role:"user",content:r}],s=yield this.generateCompletion(a,{temperature:.1}),i=this.extractSQL(s.content),l=this.extractExplanation(s.content);return{sql:i,explanation:l,confidence:.85,warnings:this.extractWarnings(s.content)}})}analyzeData(t){return H(this,null,function*(){const n=Zh(t.prompt,t.context,t.data),r=[{role:"system",content:"You are a data analyst expert. Provide clear, actionable insights with specific recommendations."},{role:"user",content:n}],a=yield this.generateCompletion(r,{temperature:.3});return{analysis:a.content,insights:this.extractInsights(a.content),suggestions:this.extractSuggestions(a.content)}})}extractSQL(t){const n=t.match(/```sql\n([\s\S]*?)\n```/i);if(n)return n[1].trim();const a=t.split("\n").filter(s=>/^\s*(SELECT|WITH|INSERT|UPDATE|DELETE|CREATE)/i.test(s.trim()));return a.length>0?a.join("\n").trim():t.trim()}extractExplanation(t){const n=t.match(new RegExp("explanation:?\\s*(.*?)(?=\\n\\n|\\n```|$)","is"));if(n)return n[1].trim();const r=t.replace(/```sql[\s\S]*?```/gi,"").trim();if(r&&r!==t.trim())return r}extractWarnings(t){const n=[];return[/warning:?\s*(.*?)(?=\n|$)/gi,/note:?\s*(.*?)(?=\n|$)/gi,/performance:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}extractInsights(t){const n=[],r=t.split("\n").filter(a=>a.trim());for(const a of r)(a.includes("trend")||a.includes("pattern"))&&n.push({type:"trend",title:"Data Trend",description:a.trim(),confidence:.8});return n}extractSuggestions(t){const n=[];return[/recommendation:?\s*(.*?)(?=\n|$)/gi,/suggest:?\s*(.*?)(?=\n|$)/gi,/consider:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}calculateCost(){return 0}getModelInfo(t){return this.SUPPORTED_MODELS.find(n=>n.id===t)}estimateDownloadSize(t){const n=this.getModelInfo(t);return(n==null?void 0:n.size)||0}}class eTe{constructor(t="http://localhost:11434",n){Kt(this,"baseUrl");Kt(this,"model");Kt(this,"timeout");this.baseUrl=t.replace(/\/$/,""),this.model=n||"llama3.2",this.timeout=3e4}validateConnection(){return H(this,null,function*(){try{const t=new AbortController,n=setTimeout(()=>t.abort(),5e3),r=yield fetch(this.baseUrl,{method:"GET",signal:t.signal});return clearTimeout(n),r.ok}catch(t){return!1}})}listModels(){return H(this,null,function*(){try{const t=yield fetch("".concat(this.baseUrl,"/api/tags"),{method:"GET"});if(!t.ok)throw new Error("Failed to list models: ".concat(t.statusText));return(yield t.json()).models||[]}catch(t){return[]}})}generateCompletion(t,n){return H(this,null,function*(){try{const r=new AbortController,a=setTimeout(()=>r.abort(),this.timeout),s=yield fetch("".concat(this.baseUrl,"/api/chat"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:this.model,messages:t.map(u=>({role:u.role,content:u.content})),options:{temperature:(n==null?void 0:n.temperature)||.7,num_predict:(n==null?void 0:n.maxTokens)||2048},stream:!1}),signal:r.signal});if(clearTimeout(a),!s.ok){const u=yield s.text();throw new Error("Ollama API error: ".concat(u||s.statusText))}const i=yield s.json(),l=i.prompt_eval_count||0,c=i.eval_count||0;return{content:i.message.content,usage:{promptTokens:l,completionTokens:c,totalTokens:l+c},model:i.model,finishReason:i.done?"stop":"length"}}catch(r){throw r instanceof Error&&r.name==="AbortError"?new Error("Request timeout: Ollama is taking too long to respond"):r}})}generateStreamCompletion(t,n,r){return H(this,null,function*(){var a,s;try{const i=new AbortController,l=setTimeout(()=>i.abort(),this.timeout),c=yield fetch("".concat(this.baseUrl,"/api/chat"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:this.model,messages:t.map(T=>({role:T.role,content:T.content})),options:{temperature:(r==null?void 0:r.temperature)||.7,num_predict:(r==null?void 0:r.maxTokens)||2048},stream:!0}),signal:i.signal});if(clearTimeout(l),!c.ok){const T=yield c.text();throw new Error("Ollama API error: ".concat(T||c.statusText))}const u=(a=c.body)==null?void 0:a.getReader();if(!u)throw new Error("No reader available");const h=new TextDecoder;let m="",p=0,g=0;try{for(;;){const{done:T,value:y}=yield u.read();if(T){n({content:m,done:!0,usage:{promptTokens:p,completionTokens:g,totalTokens:p+g}});break}const x=h.decode(y).split("\n").filter(R=>R.trim());for(const R of x)try{const A=JSON.parse(R);if((s=A.message)!=null&&s.content&&(m+=A.message.content,n({content:m,done:!1})),A.prompt_eval_count&&(p=A.prompt_eval_count),A.eval_count&&(g=A.eval_count),A.done){n({content:m,done:!0,usage:{promptTokens:p,completionTokens:g,totalTokens:p+g}});return}}catch(A){continue}}}finally{u.releaseLock()}}catch(i){throw i instanceof Error&&i.name==="AbortError"?new Error("Request timeout: Ollama is taking too long to respond"):i}})}generateSQL(t){return H(this,null,function*(){const n=mu(t.context),r=Jh(t.prompt,t.context,{includeExplanation:t.includeExplanation,maxRows:t.maxRows}),a=[{role:"system",content:n},{role:"user",content:r}],s=yield this.generateCompletion(a,{temperature:.1}),i=this.extractSQL(s.content),l=this.extractExplanation(s.content);return{sql:i,explanation:l,confidence:.85,warnings:this.extractWarnings(s.content)}})}analyzeData(t){return H(this,null,function*(){const n=Zh(t.prompt,t.context,t.data),r=[{role:"system",content:"You are a data analyst expert. Provide clear, actionable insights with specific recommendations."},{role:"user",content:n}],a=yield this.generateCompletion(r,{temperature:.3});return{analysis:a.content,insights:this.extractInsights(a.content),suggestions:this.extractSuggestions(a.content)}})}extractSQL(t){const n=t.match(/```sql\n([\s\S]*?)\n```/i);if(n)return n[1].trim();const a=t.split("\n").filter(s=>/^\s*(SELECT|WITH|INSERT|UPDATE|DELETE|CREATE)/i.test(s.trim()));return a.length>0?a.join("\n").trim():t.trim()}extractExplanation(t){const n=t.match(new RegExp("explanation:?\\s*(.*?)(?=\\n\\n|\\n```|$)","is"));if(n)return n[1].trim();const r=t.replace(/```sql[\s\S]*?```/gi,"").trim();if(r&&r!==t.trim())return r}extractWarnings(t){const n=[];return[/warning:?\s*(.*?)(?=\n|$)/gi,/note:?\s*(.*?)(?=\n|$)/gi,/performance:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}extractInsights(t){const n=[],r=t.split("\n").filter(a=>a.trim());for(const a of r)(a.includes("trend")||a.includes("pattern"))&&n.push({type:"trend",title:"Data Trend",description:a.trim(),confidence:.8});return n}extractSuggestions(t){const n=[];return[/recommendation:?\s*(.*?)(?=\n|$)/gi,/suggest:?\s*(.*?)(?=\n|$)/gi,/consider:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}calculateCost(t){return 0}pullModel(t,n){return H(this,null,function*(){var r;try{const a=yield fetch("".concat(this.baseUrl,"/api/pull"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,stream:!0})});if(!a.ok)throw new Error("Failed to pull model: ".concat(a.statusText));const s=(r=a.body)==null?void 0:r.getReader();if(!s)throw new Error("No reader available");const i=new TextDecoder;try{for(;;){const{done:l,value:c}=yield s.read();if(l)break;const h=i.decode(c).split("\n").filter(m=>m.trim());for(const m of h)try{const p=JSON.parse(m);if(p.total&&p.completed&&n){const g=p.completed/p.total*100;n(g)}}catch(p){continue}}}finally{s.releaseLock()}}catch(a){throw a}})}setModel(t){this.model=t}getModel(){return this.model}setBaseUrl(t){this.baseUrl=t.replace(/\/$/,"")}getBaseUrl(){return this.baseUrl}}class A7{constructor(){Kt(this,"providers",new Map);Kt(this,"webllmProvider",null);this.webllmProvider=new ZEe,this.providers.set("local",this.webllmProvider)}setApiKey(t,n,r){switch(t){case"openai":this.providers.set(t,new KEe(n,r));break;case"anthropic":this.providers.set(t,new QEe(n,r));break;case"groq":this.providers.set(t,new JEe(n,r));break;case"local":break;case"datakit":break;case"ollama":const a=n||"http://localhost:11434";this.providers.set(t,new eTe(a,r));break;default:throw new Error("Unsupported provider: ".concat(t))}}setProvider(t,n){this.providers.set(t,n)}validateApiKey(t){return H(this,null,function*(){const n=this.providers.get(t);if(!n)throw new Error("Provider ".concat(t," not initialized"));return t==="local"?!0:t==="ollama"?yield n.validateConnection():yield n.validateApiKey()})}generateSQL(t,n,r){return H(this,null,function*(){const a=this.providers.get(t);if(!a)throw new Error("Provider ".concat(t," not initialized"));const s={prompt:n,context:this.convertContext(r),includeExplanation:!0,maxRows:100},i=yield a.generateSQL(s);return this.convertSQLResponse(i)})}analyzeData(t,n,r,a){return H(this,null,function*(){const s=this.providers.get(t);if(!s)throw new Error("Provider ".concat(t," not initialized"));const i={prompt:n,context:this.convertContext(r),data:a||[]},l=yield s.analyzeData(i);return this.convertAnalysisResponse(l)})}generateCompletionStream(t,n,r,a){return H(this,null,function*(){const s=this.providers.get(t);if(!s)throw new Error("Provider ".concat(t," not initialized"));const i=n.map(l=>({role:l.role,content:l.content}));yield s.generateStreamCompletion(i,r,a)})}generateCompletion(t,n,r){return H(this,null,function*(){const a=this.providers.get(t);if(!a)throw new Error("Provider ".concat(t," not initialized"));const s=n.map(i=>({role:i.role,content:i.content}));return yield a.generateCompletion(s,r)})}calculateCost(t,n){const r=this.providers.get(t);return!r||t==="local"?0:r.calculateCost(n)}getAvailableProviders(){return Array.from(this.providers.keys())}isProviderReady(t){var n;return t==="local"?((n=this.webllmProvider)==null?void 0:n.isModelLoaded())||!1:t==="datakit"?this.providers.has(t):t==="ollama"?this.providers.has(t):this.providers.has(t)}loadLocalModel(t,n){return H(this,null,function*(){if(!this.webllmProvider)throw new Error("WebLLM provider not initialized");yield this.webllmProvider.loadModel(t,n)})}unloadLocalModel(){return H(this,null,function*(){this.webllmProvider&&(yield this.webllmProvider.unloadModel())})}getLoadedLocalModel(){var t;return((t=this.webllmProvider)==null?void 0:t.getCurrentModel())||null}getAvailableLocalModels(){var t;return((t=this.webllmProvider)==null?void 0:t.getAvailableModels())||[]}isWebGPUSupported(){return H(this,null,function*(){var t;return((t=this.webllmProvider)==null?void 0:t.isWebGPUSupported())||!1})}getLocalModelInfo(t){var n;return(n=this.webllmProvider)==null?void 0:n.getModelInfo(t)}estimateModelDownloadSize(t){var n;return((n=this.webllmProvider)==null?void 0:n.estimateDownloadSize(t))||0}isLocalModelLoaded(){var t;return((t=this.webllmProvider)==null?void 0:t.isModelLoaded())||!1}getOllamaModels(){return H(this,null,function*(){const t=this.providers.get("ollama");if(!t)throw new Error("Ollama provider not initialized");return yield t.listModels()})}pullOllamaModel(t,n){return H(this,null,function*(){const r=this.providers.get("ollama");if(!r)throw new Error("Ollama provider not initialized");yield r.pullModel(t,n)})}setOllamaModel(t){const n=this.providers.get("ollama");n&&n.setModel(t)}getOllamaModel(){const t=this.providers.get("ollama");return t?t.getModel():null}setOllamaBaseUrl(t){const n=this.providers.get("ollama");n&&n.setBaseUrl(t)}convertContext(t){return{tableName:t.tableName,schema:t.schema,sampleData:t.sampleData,rowCount:t.rowCount,description:t.description}}convertSQLResponse(t){return{sql:t.sql,explanation:t.explanation,confidence:t.confidence,warnings:t.warnings}}convertAnalysisResponse(t){return{analysis:t.analysis,insights:t.insights,suggestions:t.suggestions,visualization:t.visualization}}}const Dn=new A7,tTe=Object.freeze(Object.defineProperty({__proto__:null,AIService:A7,aiService:Dn},Symbol.toStringTag,{value:"Module"})),nTe=()=>"".concat(Date.now(),"_").concat(Math.random().toString(36).substring(2,9));class Rm{static initializeMetadataTable(t){return H(this,null,function*(){yield t("\n      CREATE TABLE IF NOT EXISTS datakit_transformations (\n        id TEXT PRIMARY KEY,\n        parent_table TEXT NOT NULL,\n        child_table TEXT NOT NULL,\n        version INTEGER NOT NULL,\n        prompt TEXT NOT NULL,\n        sql TEXT NOT NULL,\n        transformation_type TEXT NOT NULL,\n        rows_affected INTEGER,\n        column_name TEXT,\n        column_type TEXT,\n        created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n      );\n    "),yield t("\n      CREATE INDEX IF NOT EXISTS idx_transformations_parent \n      ON datakit_transformations(parent_table);\n    ")})}static generateTableName(t,n,r,a){const s=t.replace(/_v\d+.*$/,""),i=this.extractActionFromPrompt(r),l=a||new Date,c=l.toISOString().slice(0,10).replace(/-/g,""),u=l.toISOString().slice(11,16).replace(/:/g,"");return"".concat(s,"_v").concat(n,"_").concat(i,"_").concat(c,"_").concat(u)}static extractActionFromPrompt(t){const n=t.toLowerCase(),r=[{keywords:["remove null","delete null","drop null"],action:"no_nulls"},{keywords:["remove duplicate","deduplicate","unique"],action:"deduped"},{keywords:["uppercase","upper"],action:"uppercase"},{keywords:["lowercase","lower"],action:"lowercase"},{keywords:["clean","cleaned"],action:"cleaned"},{keywords:["normalize","normalized"],action:"normalized"},{keywords:["filter","filtered","where"],action:"filtered"},{keywords:["aggregate","group","sum","count"],action:"aggregated"},{keywords:["join","merge"],action:"joined"},{keywords:["pivot","unpivot"],action:"pivoted"},{keywords:["rename","renamed"],action:"renamed"},{keywords:["convert","cast","change type"],action:"converted"},{keywords:["extract","parse"],action:"extracted"},{keywords:["calculate","compute","derived"],action:"calculated"},{keywords:["bucket","bin","group"],action:"bucketed"},{keywords:["outlier","anomaly"],action:"outliers"},{keywords:["statistic","stats","analyze"],action:"analyzed"}];for(const{keywords:a,action:s}of r)if(a.some(i=>n.includes(i)))return s;return"transformed"}static getCurrentVersion(t,n){return H(this,null,function*(){var r,a;try{const s=t.replace(/_v\d+.*$/,""),i=yield n("\n        SELECT COALESCE(MAX(version), 0) as max_version\n        FROM datakit_transformations\n        WHERE parent_table LIKE '".concat(s,"%'\n           OR child_table LIKE '").concat(s,"%'\n      "));return((a=(((r=i==null?void 0:i.toArray)==null?void 0:r.call(i))||[])[0])==null?void 0:a.max_version)||0}catch(s){return 0}})}static recordTransformation(t,n){return H(this,null,function*(){const r=nTe(),a=new Date,s="\n      INSERT INTO datakit_transformations (\n        id, parent_table, child_table, version, prompt, sql,\n        transformation_type, rows_affected, column_name, column_type, created_at\n      ) VALUES (\n        '".concat(r,"',\n        '").concat(t.parentTable,"',\n        '").concat(t.childTable,"',\n        ").concat(t.version,",\n        '").concat(t.prompt.replace(/'/g,"''"),"',\n        '").concat(t.sql.replace(/'/g,"''"),"',\n        '").concat(t.transformationType,"',\n        ").concat(t.rowsAffected||"NULL",",\n        ").concat(t.columnName?"'".concat(t.columnName,"'"):"NULL",",\n        ").concat(t.columnType?"'".concat(t.columnType,"'"):"NULL",",\n        '").concat(a.toISOString(),"'\n      );\n    ");return yield n(s),he(q({id:r},t),{createdAt:a})})}static getTableHistory(t,n){return H(this,null,function*(){var i;const r=t.replace(/_v\d+.*$/,""),a=yield n("\n      SELECT * FROM datakit_transformations\n      WHERE parent_table LIKE '".concat(r,"%'\n         OR child_table LIKE '").concat(r,"%'\n      ORDER BY created_at DESC\n    "));return(((i=a==null?void 0:a.toArray)==null?void 0:i.call(a))||[]).map(l=>({id:l.id,parentTable:l.parent_table,childTable:l.child_table,version:l.version,prompt:l.prompt,sql:l.sql,transformationType:l.transformation_type,rowsAffected:l.rows_affected,columnName:l.column_name,columnType:l.column_type,createdAt:new Date(l.created_at)}))})}static buildLineageTree(t,n){return H(this,null,function*(){const r=yield this.getTableHistory(t,n);if(r.length===0)return{tableId:t,tableName:t,version:0,children:[]};const a=new Map;return r.forEach(i=>{a.has(i.parentTable)||a.set(i.parentTable,{tableId:i.parentTable,tableName:i.parentTable,version:i.version-1,children:[]}),a.has(i.childTable)||a.set(i.childTable,{tableId:i.childTable,tableName:i.childTable,version:i.version,children:[],transformation:i})}),r.forEach(i=>{const l=a.get(i.parentTable),c=a.get(i.childTable);l&&c&&(c.parent=l,l.children.push(c))}),Array.from(a.values()).find(i=>!i.parent)||null})}static getLatestVersion(t,n){return H(this,null,function*(){var i,l;const r=t.replace(/_v\d+.*$/,""),a=yield n("\n      SELECT child_table, version\n      FROM datakit_transformations\n      WHERE parent_table LIKE '".concat(r,"%'\n         OR child_table LIKE '").concat(r,"%'\n      ORDER BY version DESC, created_at DESC\n      LIMIT 1\n    "));return((l=(((i=a==null?void 0:a.toArray)==null?void 0:i.call(a))||[])[0])==null?void 0:l.child_table)||t})}static inferTransformationType(t,n){const r=t.toLowerCase(),a=n.toLowerCase();return r.includes("where")&&!r.includes("group by")?"filter":r.includes("group by")||a.includes("aggregate")?"aggregate":a.includes("clean")||a.includes("remove")||a.includes("delete")?"clean":a.includes("calculate")||a.includes("derive")?"derive":r.includes("upper")||r.includes("lower")||r.includes("trim")?"transform":"custom"}}class rTe{generateSQL(t,n){return H(this,null,function*(){const{action:r,columnName:a,columnType:s,tableName:i,customPrompt:l,parameters:c}=t;let u,h="new-table",m,p=1;if(n)try{yield Rm.initializeMetadataTable(n),p=(yield Rm.getCurrentVersion(i,n))+1}catch(y){}const g=l||r.label;if(m=Rm.generateTableName(i,p,g),r.sqlTemplate&&!l)u=this.interpolateTemplate(r.sqlTemplate,q({columnName:a,tableName:i,columnType:s},c)),u=this.convertToCreateTable(u,i,m);else if(r.aiPromptTemplate||l){const y=r.aiPromptTemplate||"Generate SQL for DuckDB to work with column {columnName} of type {columnType} in table {tableName}. User request: {customPrompt}",b=c.schema?"\nEXACT TABLE SCHEMA WITH TYPES:\n".concat(c.schema):"",x=c.allColumns?"\nColumn names only: ".concat(c.allColumns):"",R="".concat(y,"\n        ").concat(b,"\n        ").concat(x,'\n        \n        CRITICAL REQUIREMENTS FOR DUCKDB:\n        1. Generate a CREATE TABLE statement that creates a new table named "').concat(m,'" based on the original table "').concat(i,"\".\n        \n        2. The new table MUST include ALL columns from the original table with their EXACT TYPES as shown in the schema above.\n        \n        3. IMPORTANT: Explicitly list ALL columns in the SELECT statement. Do NOT use SELECT * as it may not preserve the transformation.\n        \n        4. For NON-TRANSFORMED columns: Select them AS-IS without any functions to preserve their original types.\n           Example: If 'date_column' is type DATE, select it as just 'date_column', not CAST(date_column AS VARCHAR)\n        \n        5. For the TRANSFORMED column \"").concat(a,'" only: Apply the requested transformation.\n           - String to Number: TRY_CAST(').concat(a," AS INTEGER/DECIMAL/DOUBLE)\n           - Number to String: CAST(").concat(a," AS VARCHAR)\n           - Date operations: Use proper date functions\n           - Text operations: UPPER(), LOWER(), TRIM(), etc.\n        \n        6. The SQL format MUST be: \n           CREATE TABLE ").concat(m," AS \n           SELECT \n             column1,  -- Keep original type\n             column2,  -- Keep original type  \n             TRANSFORMATION(").concat(a,") as ").concat(a,",  -- Only transform this one\n             column4,  -- Keep original type\n             ...\n           FROM ").concat(i,"\n        \n        7. Use TRY_CAST instead of CAST for type conversions that might fail (returns NULL instead of error)\n        \n        8. CRITICAL: Look at the schema above. Each column has a type like:\n           ").concat(b?"The columns and their types are listed above.":"column_name (TYPE)","\n           You MUST preserve these exact types for all columns except the one being transformed.\n        \n        EXAMPLES with proper type preservation:\n        - If schema is: id (INTEGER), name (VARCHAR), price (VARCHAR), created_at (DATE)\n          And transforming price to number:\n          CREATE TABLE new_table AS \n          SELECT \n            id,  -- stays INTEGER\n            name,  -- stays VARCHAR\n            TRY_CAST(price AS DECIMAL) as price,  -- transform VARCHAR to DECIMAL\n            created_at  -- stays DATE\n          FROM original_table\n        \n        - If schema is: id (INTEGER), email (VARCHAR), amount (DECIMAL), updated_at (TIMESTAMP)\n          And making email uppercase:\n          CREATE TABLE new_table AS \n          SELECT \n            id,  -- stays INTEGER\n            UPPER(email) as email,  -- transform but stays VARCHAR\n            amount,  -- stays DECIMAL\n            updated_at  -- stays TIMESTAMP\n          FROM original_table\n        \n        NEVER: Use functions on columns that aren't being transformed\n        NEVER: Change the type of columns that aren't being transformed\n        NEVER: Omit any columns from the original table"),A=this.interpolateTemplate(R,q({columnName:a,tableName:i,columnType:s,customPrompt:l||""},c));try{const w="datakit",{DataKitProvider:_}=yield fn(()=>H(this,null,function*(){const{DataKitProvider:M}=yield Promise.resolve().then(()=>vBe);return{DataKitProvider:M}}),void 0),N=new _("datakit-smart");Dn.setProvider("datakit",N);const I=(yield fn(()=>H(this,null,function*(){const{useAIStore:M}=yield Promise.resolve().then(()=>EO);return{useAIStore:M}}),void 0)).useAIStore.getState();I.activeProvider!=="datakit"&&(I.setActiveProvider("datakit"),I.setActiveModel("datakit-smart")),u=(yield Dn.generateSQL(w,A,{tableName:i,schema:[],sampleData:[],rowCount:0,description:"Table containing column ".concat(a," of type ").concat(s),tables:[{name:i,schema:[],description:"Table containing column ".concat(a," of type ").concat(s)}]})).sql,u.toLowerCase().includes(m.toLowerCase())||(u=this.ensureCorrectTableName(u,m)),u=this.ensureTypeSafety(u)}catch(w){throw new Error("Failed to generate SQL: ".concat(w instanceof Error?w.message:"Unknown error"))}}else throw new Error("No SQL template or AI prompt available for this action");h="new-table";let T;return r.showPreview&&r.previewQuery&&(T={query:this.interpolateTemplate(r.previewQuery,{columnName:a,tableName:i,columnType:s}),description:this.generatePreviewDescription(r,a)}),{sql:u,strategy:h,preview:T,newTableName:m}})}generatePreview(t,n){return H(this,null,function*(){try{const r=yield n(t),a=(r==null?void 0:r.toArray())||[];let s=0;if(a.length>0){const i=a[0];s=i.rows_to_delete||i.affected_rows||i.count||a.length}return{affectedRows:s,sampleChanges:[],isReversible:!1,warningMessage:s>1e3?"This will affect ".concat(s.toLocaleString()," rows. This operation cannot be undone."):void 0}}catch(r){return{affectedRows:0,sampleChanges:[],isReversible:!1,warningMessage:"Could not generate preview. Proceed with caution."}}})}executeAction(t,n,r,a){return H(this,null,function*(){var s,i,l,c;try{if(r==null||r("Creating new table with transformation..."),yield n(t.sql),t.newTableName&&a)try{const u=yield n("SELECT COUNT(*) as cnt FROM ".concat(t.newTableName)),h=((l=(i=(s=u==null?void 0:u.toArray)==null?void 0:s.call(u))==null?void 0:i[0])==null?void 0:l.cnt)||0;yield Rm.recordTransformation({parentTable:a.parentTable,childTable:t.newTableName,version:parseInt(((c=t.newTableName.match(/_v(\d+)_/))==null?void 0:c[1])||"1"),prompt:a.prompt,sql:t.sql,transformationType:Rm.inferTransformationType(t.sql,a.prompt),rowsAffected:h,columnName:a.columnName,columnType:a.columnType},n),r==null||r("Transformation recorded in history")}catch(u){}return{success:!0,message:t.newTableName?'Created new table "'.concat(t.newTableName,'" with transformation'):"Transformation completed successfully",newTableName:t.newTableName}}catch(u){return{success:!1,message:"Failed to execute action: ".concat(u instanceof Error?u.message:"Unknown error")}}})}interpolateTemplate(t,n){return t.replace(/\{(\w+)\}/g,(r,a)=>n[a]||r)}inferStrategyFromSQL(t){const n=t.trim().toUpperCase();return n.startsWith("SELECT")?"direct":n.startsWith("CREATE VIEW")?"view":n.startsWith("CREATE TABLE")?"new-table":n.match(/^(UPDATE|DELETE|ALTER)/)?"in-place-confirm":"direct"}generateNewTableName(t,n,r){const a=Date.now().toString(36),s=n.replace(/[^a-zA-Z0-9]/g,"_"),i=r.replace(/[^a-zA-Z0-9]/g,"_");return"".concat(t,"_").concat(s,"_").concat(i,"_").concat(a)}generatePreviewDescription(t,n){switch(t.id){case"remove-nulls":return"Rows that will be included where ".concat(n," is not null");case"remove-duplicates":return"Unique rows that will be kept based on ".concat(n);case"fill-nulls":return"Rows with ".concat(n," filled");case"uppercase":return"Values in ".concat(n," converted to uppercase");case"trim-spaces":return"Values in ".concat(n," with whitespace trimmed");default:return"Preview of transformation on ".concat(n)}}convertToCreateTable(t,n,r){var s;const a=t.toLowerCase();if(a.startsWith("delete from")){const i=((s=t.match(/WHERE\s+(.+)$/i))==null?void 0:s[1])||"";return"CREATE TABLE ".concat(r," AS SELECT * FROM ").concat(n," WHERE NOT (").concat(i,")")}if(a.startsWith("update")){const i=t.match(/SET\s+(.+?)(?:WHERE|$)/i);if(i){const l=i[1],c=t.match(/WHERE\s+(.+)$/i),u=c?"WHERE ".concat(c[1]):"",h=l.split(",").map(m=>{const[p,g]=m.split("=").map(T=>T.trim());return"CASE WHEN ".concat(u||"TRUE"," THEN ").concat(g," ELSE ").concat(p," END as ").concat(p)});return"CREATE TABLE ".concat(r," AS SELECT *, ").concat(h.join(", ")," FROM ").concat(n)}}return a.startsWith("alter table")?"CREATE TABLE ".concat(r," AS SELECT * FROM ").concat(n):a.startsWith("select")?"CREATE TABLE ".concat(r," AS ").concat(t):a.startsWith("create view")?t.replace(/CREATE\s+VIEW\s+\S+/i,"CREATE TABLE ".concat(r)):a.startsWith("create table")?t.replace(/CREATE\s+TABLE\s+\S+/i,"CREATE TABLE ".concat(r)):"CREATE TABLE ".concat(r," AS ").concat(t)}ensureCorrectTableName(t,n){return t.replace(/CREATE\s+TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(["`]?)(\w+)\1/gi,"CREATE TABLE ".concat(n))}ensureTypeSafety(t){let n=t;return n=n.replace(/\bCAST\s*\(\s*(\w+)\s+AS\s+(INTEGER|INT|BIGINT|DECIMAL|DOUBLE|FLOAT|NUMERIC)\s*\)/gi,"TRY_CAST($1 AS $2)"),n}}const _3=new rTe,QL=Ht.forwardRef(({data:e,fileId:t,gridId:n="default",isRemoteSource:r=!1,showStats:a,onStatsToggle:s,currentPage:i=1,rowsPerPage:l=1e3,columnTypes:c=[],isDataMode:u=!1,onCellEdit:h,onContextMenu:m,className:p="",rowHeight:g=32,estimatedColumnWidth:T=120,editingCell:y=null,editValue:b="",onCellClick:x=()=>{},onCellEditChange:R=()=>{},onCellBlur:A=()=>{},onKeyDown:w=()=>{},formatCellValue:_=j=>j,getCellClass:N=()=>"",onCellContextMenu:I,onSort:D,sortState:M,tableName:O,isView:L=!1,onExecuteSQL:k,onTableCreate:F,onDataRefresh:U},B)=>{var oe;const{t:j}=Ze(),{columnStats:G,isLoading:K,triggerAnalysis:J}=v7({fileId:t,enabled:!0,fileSizeThresholdMB:300,manualTrigger:!0}),$=e.length>0&&((oe=e[0])==null?void 0:oe.length)>0,X=$?e[0]:[],Z=X.length||0,[V,te]=v.useState(!1),ae=a!==void 0?a:V;v.useEffect(()=>{a===void 0&&G.length>0&&!V&&(sessionStorage.getItem("grid-stats-hidden-".concat(t))||te(!0))},[G.length,V,t,a]),v.useEffect(()=>{if(Z>0){const ue=document.documentElement;if(!getComputedStyle(ue).getPropertyValue("--grid-".concat(n,"-col-0")).trim())for(let Le=0;Le<Z;Le++){const ke=Le===0?"60px":"".concat(T,"px");ue.style.setProperty("--grid-".concat(n,"-col-").concat(Le),ke)}}},[Z,T,n]);const ne=v.useCallback(ue=>{const Ee=document.documentElement,Le=getComputedStyle(Ee).getPropertyValue("--grid-".concat(n,"-col-").concat(ue)).trim();return Le?parseInt(Le.replace("px","")):ue===0?60:T},[T,n]),ce=v.useCallback((ue,Ee)=>{document.documentElement.style.setProperty("--grid-".concat(n,"-col-").concat(ue),"".concat(Ee,"px"))},[n]),[ie,W]=v.useState(0),[Q,se]=v.useState(null),z=v.useMemo(()=>{let ue=0;for(let Ee=0;Ee<Z;Ee++)ue+=ne(Ee);return ue},[Z,ne]),xe=v.useRef(null),le=v.useRef({isResizing:!1,columnIndex:-1,startX:0,startWidth:0}),_e=ae&&G.some(ue=>{var Ee;return((Ee=ue.histogramData)==null?void 0:Ee.length)>0||ue.nullPercentage>0||ue.uniqueCount>0||ue.numericStats})?80:40,re=e.length,Se=v.useCallback((ue,Ee)=>{Ee.preventDefault(),Ee.stopPropagation(),le.current={isResizing:!0,columnIndex:ue,startX:Ee.clientX,startWidth:ne(ue)},document.addEventListener("mousemove",$e),document.addEventListener("mouseup",qe),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[ne]),$e=v.useCallback(ue=>{if(!le.current.isResizing)return;const{columnIndex:Ee,startX:Le,startWidth:ke}=le.current,Ge=ue.clientX-Le,tt=Math.max(50,Math.min(ke+Ge,800));ce(Ee,tt),xe.current&&xe.current.resetAfterColumnIndex(Ee)},[ce]),qe=v.useCallback(()=>{le.current.isResizing=!1,document.removeEventListener("mousemove",$e),document.removeEventListener("mouseup",qe),document.body.style.cursor="",document.body.style.userSelect=""},[$e]);v.useEffect(()=>()=>{document.removeEventListener("mousemove",$e),document.removeEventListener("mouseup",qe)},[$e,qe]),Ht.useImperativeHandle(B,()=>({columnStats:G,isLoadingStats:K,triggerAnalysis:J}),[G,K,J]);const Je=v.useCallback(()=>g,[g]),lt=v.useCallback(ue=>G.find(Ee=>Ee.name===ue),[G]),at=v.useCallback((ue,Ee,Le)=>{se({isOpen:!0,columnName:ue,columnType:Ee,position:Le})},[]),ot=v.useCallback(ue=>H(null,null,function*(){var Ee,Le;if(!(!Q||!O||!k))try{const ke={id:"custom-ai",label:"Custom AI Request",description:"AI-powered custom operation",icon:"Sparkles",category:"generate",strategy:"new-table",requiresInput:!0,aiPromptTemplate:"Generate SQL for DuckDB to work with column {columnName} of type {columnType} in table {tableName}. User request: {customPrompt}. Return only valid DuckDB SQL."},Ge=X.slice(1).map((Oe,de)=>{const Ae=c[de],we=typeof Ae=="object"&&(Ae!=null&&Ae.type)?Ae.type:typeof Ae=="string"?Ae:"VARCHAR";return{name:Oe,type:we}}),tt=Ge.map(Oe=>"".concat(Oe.name," (").concat(Oe.type,")")).join(", "),ct=yield _3.generateSQL({action:ke,columnName:Q.columnName,columnType:Q.columnType,tableName:O,customPrompt:ue,parameters:{allColumns:X.slice(1).join(", "),schema:tt,fullSchema:JSON.stringify(Ge)}},k),Te=yield _3.executeAction(ct,k,Oe=>{},{prompt:ue,columnName:Q.columnName,columnType:Q.columnType,parentTable:O});if(Te.success)Te.newTableName&&(F==null||F(Te.newTableName),alert(j("dataGrid.success.tableCreated",{tableName:Te.newTableName,defaultValue:"Success! Created new table: {{tableName}}"}))),U==null||U(),se(null);else throw new Error(Te.message)}catch(ke){((Ee=ke==null?void 0:ke.response)==null?void 0:Ee.status)===401||(Le=ke==null?void 0:ke.message)!=null&&Le.includes("authenticate")?alert(j("dataGrid.errors.signInRequired",{defaultValue:"Please sign in to use AI-powered column actions with Datakit Smart."})):alert(j("dataGrid.errors.actionFailed",{error:ke instanceof Error?ke.message:j("dataGrid.errors.unknownError",{defaultValue:"Unknown error"}),defaultValue:"AI action failed: {{error}}"}))}}),[Q,O,k,F,U]),st=v.useCallback(({columnIndex:ue,rowIndex:Ee,style:Le})=>{var Ae;const ke=ue===0,Ge=he(q({},Le),{display:"flex",alignItems:"center"});if(ke){const we=(i-1)*l+Ee+1;return o.jsx("div",{style:Ge,className:"grid-cell csv-grid-row-number",children:we})}const tt=((Ae=e[Ee+1])==null?void 0:Ae[ue])||"",ct=_(tt,Ee+1,ue),Te=N(Ee+1,ue),Oe=(y==null?void 0:y.row)===Ee+1&&(y==null?void 0:y.col)===ue,de=we=>{we.stopPropagation(),x(Ee+1,ue),I&&I(we,Ee+1,ue,tt)};return o.jsx("div",{style:Ge,className:"grid-cell csv-grid-cell ".concat(Te),onClick:de,children:Oe?o.jsx("input",{className:"csv-grid-cell-input",value:b,onChange:R,onBlur:A,onKeyDown:w,autoFocus:!0}):o.jsx("span",{className:"cell-content",children:ct})})},[X,c,G,K,e,_,N,y,b,x,R,A,w,I,M,D,Se,lt,Z,i,l]);return!$||!Z||re===0?o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsx("div",{className:"text-center text-white/70",children:o.jsx("p",{children:j("dataGrid.noData",{defaultValue:"No data to display"})})})}):o.jsxs("div",{className:"h-full flex flex-col ".concat(p),onContextMenu:m,tabIndex:0,children:[o.jsx("div",{className:"flex-shrink-0 z-30 table-header-stats overflow-hidden transition-all duration-300 ease-in-out",style:{height:_e},children:o.jsxs("div",{className:"flex transition-all duration-300 ease-in-out",style:{minWidth:"100%",height:"100%",width:Math.max(z,800),transform:"translateX(-".concat(ie,"px)")},children:[o.jsx("div",{style:{width:"var(--grid-".concat(n,"-col-0, 60px)"),flexShrink:0,background:"var(--dark-nav)"},className:"grid-cell"}),X.map((ue,Ee)=>{if(Ee===0)return null;const Le=c[Ee-1]||"VARCHAR";return o.jsxs("div",{style:{width:"var(--grid-".concat(n,"-col-").concat(Ee,", ").concat(T,"px)"),flexShrink:0},className:"relative",children:[o.jsx(zEe,{columnName:ue,columnType:Le,columnIndex:Ee,stats:lt(ue),isLoading:K,width:ne(Ee),shouldLoadStats:ae,sortState:M,onSort:D,onColumnAction:O&&!L?at:void 0,tableName:O,isView:L}),Ee<Z-1&&o.jsx("div",{className:"absolute right-0 top-0 w-2 h-full cursor-col-resize group flex items-center justify-center hover:bg-primary/50 transition-colors",style:{zIndex:40,transform:"translateX(50%)"},onMouseDown:ke=>Se(Ee,ke)})]},Ee)})]})}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(T7,{children:({height:ue,width:Ee})=>o.jsx(mEe,{ref:xe,height:ue,width:Ee,rowCount:e.length-1,columnCount:Z,rowHeight:Je,columnWidth:ne,overscanRowCount:5,overscanColumnCount:10,onScroll:({scrollLeft:Le})=>{W(Le)},style:{overflowX:"auto",overflowY:"auto"},className:"virtual-grid-scroll",itemKey:({columnIndex:Le,rowIndex:ke})=>Le===0?"row-".concat(ke):"".concat(ke,"-").concat(Le),children:st})})}),Q&&o.jsx(qEe,{isOpen:Q.isOpen,onClose:()=>se(null),columnName:Q.columnName,columnType:Q.columnType,tableName:O||"unknown",position:Q.position,onExecute:ot})]})});QL.displayName="UnifiedGrid";const aTe=(e,t)=>'<!DOCTYPE html>\n<html lang="en">\n<head>\n    <meta charset="UTF-8">\n    <meta name="viewport" content="width=device-width, initial-scale=1.0">\n    <title>Data Analysis Report - '.concat((t==null?void 0:t.fileName)||"Unknown File",'</title>\n    <style>\n        body { font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif; line-height: 1.6; margin: 0; padding: 0; background: #f8fafc; color: #1a202c; }\n        .container { max-width: 1200px; margin: 0 auto; padding: 40px 20px; }\n        .header { text-align: center; margin-bottom: 40px; padding: 30px; background: white; border-radius: 12px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); }\n        .header h1 { margin: 0 0 10px 0; color: #2d3748; font-size: 32px; font-weight: 700; }\n        .header p { margin: 5px 0; color: #64748b; font-size: 16px; }\n        .health-score { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 12px; margin-bottom: 30px; text-align: center; }\n        .health-score h2 { margin: 0 0 20px 0; font-size: 24px; opacity: 0.95; }\n        .metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }\n        .metric-card { background: #f8fafc; padding: 20px; border-radius: 8px; border-left: 4px solid #2dd4bf; }\n        .column-list { margin-bottom: 30px; }\n        .column-item { background: #f8fafc; padding: 15px; margin-bottom: 10px; border-radius: 6px; border-left: 3px solid #94a3b8; }\n        .recommendations { background: #fef3c7; padding: 20px; border-radius: 8px; border-left: 4px solid #f59e0b; }\n        .footer { text-align: center; color: #64748b; font-size: 14px; margin-top: 40px; padding-top: 20px; border-top: 1px solid #e2e8f0; }\n    </style>\n</head>\n<body>\n    <div class="container">\n        <div class="header">\n            <h1>Data Analysis Report</h1>\n            <p><strong>File:</strong> ').concat((t==null?void 0:t.fileName)||"Unknown","</p>\n            <p><strong>Analysis Date:</strong> ").concat(new Date(e.analysisTimestamp).toLocaleString(),'</p>\n        </div>\n\n        <div class="health-score">\n            <h2>Overall Health Score</h2>\n            <div style="font-size: 48px; font-weight: bold; margin: 10px 0;">').concat(e.healthScore,'%</div>\n            <div style="display: flex; justify-content: space-around; margin-top: 20px;">\n                <div>\n                    <div style="font-size: 14px; opacity: 0.9;">Completeness</div>\n                    <div style="font-size: 18px; font-weight: bold;">').concat(e.healthBreakdown.completeness,'%</div>\n                </div>\n                <div>\n                    <div style="font-size: 14px; opacity: 0.9;">Uniqueness</div>\n                    <div style="font-size: 18px; font-weight: bold;">').concat(e.healthBreakdown.uniqueness,'%</div>\n                </div>\n                <div>\n                    <div style="font-size: 14px; opacity: 0.9;">Consistency</div>\n                    <div style="font-size: 18px; font-weight: bold;">').concat(e.healthBreakdown.consistency,'%</div>\n                </div>\n            </div>\n        </div>\n\n        <div class="metrics-grid">\n            <div class="metric-card">\n                <h3>Total Rows</h3>\n                <div style="font-size: 24px; font-weight: bold; color: #2dd4bf;">').concat(e.totalRows.toLocaleString(),'</div>\n            </div>\n            <div class="metric-card">\n                <h3>Total Columns</h3>\n                <div style="font-size: 24px; font-weight: bold; color: #2dd4bf;">').concat(e.totalColumns,'</div>\n            </div>\n            <div class="metric-card">\n                <h3>Duplicate Rows</h3>\n                <div style="font-size: 24px; font-weight: bold; color: ').concat(e.duplicateRows>0?"#ef4444":"#10b981",';">').concat(e.duplicateRows,'</div>\n            </div>\n            <div class="metric-card">\n                <h3>Type Issues</h3>\n                <div style="font-size: 24px; font-weight: bold; color: ').concat(e.typeIssues.length>0?"#ef4444":"#10b981",';">').concat(e.typeIssues.length,'</div>\n            </div>\n        </div>\n\n        <div class="column-list">\n            <h2>Column Analysis</h2>\n            ').concat(e.columnMetrics.map(n=>'\n                <div class="column-item">\n                    <h4>'.concat(n.name," (").concat(n.type,')</h4>\n                    <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-top: 10px;">\n                        <div><strong>Null Count:</strong> ').concat(n.nullCount,"</div>\n                        <div><strong>Null %:</strong> ").concat(n.nullPercentage.toFixed(2),"%</div>\n                        <div><strong>Unique Count:</strong> ").concat(n.uniqueCount,"</div>\n                        <div><strong>Cardinality:</strong> ").concat(n.cardinality.toFixed(4),"</div>\n                    </div>\n                    ").concat(n.numericStats?'\n                        <div style="margin-top: 10px; padding-top: 10px; border-top: 1px solid #e2e8f0;">\n                            <strong>Numeric Stats:</strong> Min: '.concat(n.numericStats.min,", Max: ").concat(n.numericStats.max,", Mean: ").concat(n.numericStats.mean.toFixed(2),"\n                        </div>\n                    "):"","\n                </div>\n            ")).join(""),"\n        </div>\n\n        ").concat(e.recommendations.length>0?'\n            <div class="recommendations">\n                <h2>Recommendations</h2>\n                <ul>\n                    '.concat(e.recommendations.map(n=>"<li>".concat(n,"</li>")).join(""),"\n                </ul>\n            </div>\n        "):"",'\n\n        <div class="footer">\n            Generated by DataKit Inspector on ').concat(new Date().toLocaleDateString()," <br />\n            For interactive charts and real-time analysis, visit your DataKit.\n        </div>\n    </div>\n</body>\n</html>"),sTe=(e,t,n)=>{const r=aTe(e,t),a="".concat((t==null?void 0:t.fileName)||"data","_analysis_report_").concat(new Date().toISOString().split("T")[0],".html"),s=new Blob([r],{type:"text/html"}),i=URL.createObjectURL(s),l=document.createElement("a");l.href=i,l.download=a,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(i)},Bi=(e,t,n)=>{const r=new Blob([e],{type:n}),a=URL.createObjectURL(r),s=document.createElement("a");s.href=a,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(a)},R7=(e,t)=>{if(e.length===0)return"";if(t&&Array.isArray(e[0]))return[t.join(","),...e.map(s=>s.map(i=>{const l=i==null?"":String(i);return l.includes(",")||l.includes('"')||l.includes("\n")?'"'.concat(l.replace(/"/g,'""'),'"'):l}).join(","))].join("\n");const n=Object.keys(e[0]);return[n.join(","),...e.map(a=>n.map(s=>{const i=a[s],l=i==null?"":String(i);return l.includes(",")||l.includes('"')||l.includes("\n")?'"'.concat(l.replace(/"/g,'""'),'"'):l}).join(","))].join("\n")},DA=(e,t,n)=>{const r=new Date().toISOString().split("T")[0],a=[e,n,r].filter(Boolean);return"".concat(a.join("_"),".").concat(t)},iTe=(i,l,c,u,h,...m)=>H(null,[i,l,c,u,h,...m],function*(e,t,n,r,a,s={}){const{limit:p=1e6}=s;try{let g=[],T="";switch(e){case"duplicates":g=yield a.fetchDuplicateRows(t,p),T=DA(n||"data","csv","duplicates");break;case"nulls":if(!r)throw new Error("Column name required for null export");g=yield a.fetchNullRows(t,r,p),T=DA(n||"data","csv","".concat(r,"_nulls"));break;case"type_issues":if(!r)throw new Error("Column name required for type issues export");g=yield a.fetchTypeIssueRows(t,r,p),T=DA(n||"data","csv","".concat(r,"_type_issues"));break;default:throw new Error("Unsupported problem type: ".concat(e))}if(g.length===0)throw new Error("No data found for export");const y=R7(g);Bi(y,T,"text/csv")}catch(g){throw g}}),oTe=(e,t)=>e?'<!DOCTYPE html>\n<html lang="en">\n<head>\n    <meta charset="UTF-8">\n    <meta name="viewport" content="width=device-width, initial-scale=1.0">\n    <title>Data Analysis Report - '.concat(t||"Unknown",'</title>\n    <style>\n        body { font-family: Arial, sans-serif; margin: 40px; background: #f5f5f5; }\n        .container { max-width: 800px; margin: 0 auto; background: white; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }\n        .header { border-bottom: 2px solid #2dd4bf; padding-bottom: 20px; margin-bottom: 30px; }\n        .health-score { background: linear-gradient(135deg, #2dd4bf, #06b6d4); color: white; padding: 20px; border-radius: 8px; text-align: center; margin-bottom: 30px; }\n        .metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }\n        .metric-card { background: #f8fafc; padding: 20px; border-radius: 8px; border-left: 4px solid #2dd4bf; }\n        .column-list { margin-bottom: 30px; }\n        .column-item { background: #f8fafc; padding: 15px; margin-bottom: 10px; border-radius: 6px; border-left: 3px solid #94a3b8; }\n        .recommendations { background: #fef3c7; padding: 20px; border-radius: 8px; border-left: 4px solid #f59e0b; }\n        .footer { text-align: center; color: #64748b; font-size: 14px; margin-top: 40px; padding-top: 20px; border-top: 1px solid #e2e8f0; }\n    </style>\n</head>\n<body>\n    <div class="container">\n        <div class="header">\n            <h1>Data Analysis Report</h1>\n            <p><strong>File:</strong> ').concat(t||"Unknown","</p>\n            <p><strong>Analysis Date:</strong> ").concat(new Date(e.analysisTimestamp).toLocaleString(),'</p>\n        </div>\n\n        <div class="health-score">\n            <h2>Overall Health Score</h2>\n            <div style="font-size: 48px; font-weight: bold; margin: 10px 0;">').concat(e.healthScore,'%</div>\n            <div style="display: flex; justify-content: space-around; margin-top: 20px;">\n                <div>\n                    <div style="font-size: 14px; opacity: 0.9;">Completeness</div>\n                    <div style="font-size: 18px; font-weight: bold;">').concat(e.healthBreakdown.completeness,'%</div>\n                </div>\n                <div>\n                    <div style="font-size: 14px; opacity: 0.9;">Uniqueness</div>\n                    <div style="font-size: 18px; font-weight: bold;">').concat(e.healthBreakdown.uniqueness,'%</div>\n                </div>\n                <div>\n                    <div style="font-size: 14px; opacity: 0.9;">Consistency</div>\n                    <div style="font-size: 18px; font-weight: bold;">').concat(e.healthBreakdown.consistency,'%</div>\n                </div>\n            </div>\n        </div>\n\n        <div class="metrics-grid">\n            <div class="metric-card">\n                <h3>Total Rows</h3>\n                <div style="font-size: 24px; font-weight: bold; color: #2dd4bf;">').concat(e.totalRows.toLocaleString(),'</div>\n            </div>\n            <div class="metric-card">\n                <h3>Total Columns</h3>\n                <div style="font-size: 24px; font-weight: bold; color: #2dd4bf;">').concat(e.totalColumns,'</div>\n            </div>\n            <div class="metric-card">\n                <h3>Duplicate Rows</h3>\n                <div style="font-size: 24px; font-weight: bold; color: ').concat(e.duplicateRows>0?"#ef4444":"#10b981",';">').concat(e.duplicateRows,'</div>\n            </div>\n            <div class="metric-card">\n                <h3>Type Issues</h3>\n                <div style="font-size: 24px; font-weight: bold; color: ').concat(e.typeIssues.length>0?"#ef4444":"#10b981",';">').concat(e.typeIssues.length,'</div>\n            </div>\n        </div>\n\n        <div class="column-list">\n            <h2>Column Analysis</h2>\n            ').concat(e.columnMetrics.map(n=>'\n                <div class="column-item">\n                    <h4>'.concat(n.name," (").concat(n.type,')</h4>\n                    <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-top: 10px;">\n                        <div><strong>Null Count:</strong> ').concat(n.nullCount,"</div>\n                        <div><strong>Null %:</strong> ").concat(n.nullPercentage.toFixed(2),"%</div>\n                        <div><strong>Unique Count:</strong> ").concat(n.uniqueCount,"</div>\n                        <div><strong>Cardinality:</strong> ").concat(n.cardinality.toFixed(4),"</div>\n                    </div>\n                    ").concat(n.numericStats?'\n                        <div style="margin-top: 10px; padding-top: 10px; border-top: 1px solid #e2e8f0;">\n                            <strong>Numeric Stats:</strong> Min: '.concat(n.numericStats.min,", Max: ").concat(n.numericStats.max,", Mean: ").concat(n.numericStats.mean.toFixed(2),"\n                        </div>\n                    "):"","\n                </div>\n            ")).join(""),"\n        </div>\n\n        ").concat(e.recommendations.length>0?'\n            <div class="recommendations">\n                <h2>Recommendations</h2>\n                <ul>\n                    '.concat(e.recommendations.map(n=>"<li>".concat(n,"</li>")).join(""),"\n                </ul>\n            </div>\n        "):"",'\n\n        <div class="footer">\n            Generated by DataKit Inspector on ').concat(new Date().toLocaleDateString(),"\n        </div>\n    </div>\n</body>\n</html>"):"<html><body>No analysis data available</body></html>",lTe=(e,t)=>e?'<!DOCTYPE html>\n<html lang="en">\n<head>\n    <meta charset="UTF-8">\n    <meta name="viewport" content="width=device-width, initial-scale=1.0">\n    <title>Data Analysis Report - '.concat(t||"Unknown",'</title>\n    <style>\n        @media print {\n            body { margin: 0; background: white !important; }\n            .container { max-width: none; margin: 0; padding: 20px; box-shadow: none; border-radius: 0; }\n            .page-break { page-break-before: always; }\n            .no-print { display: none; }\n        }\n        body { font-family: Arial, sans-serif; margin: 20px; background: white; color: #000; }\n        .container { max-width: 800px; margin: 0 auto; background: white; padding: 30px; }\n        .header { border-bottom: 2px solid #2dd4bf; padding-bottom: 20px; margin-bottom: 30px; }\n        .health-score { background: #f0fdf4; border: 2px solid #2dd4bf; padding: 20px; border-radius: 8px; text-align: center; margin-bottom: 30px; }\n        .metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 30px; }\n        .metric-card { background: #f8fafc; padding: 15px; border-radius: 6px; border-left: 4px solid #2dd4bf; }\n        .column-list { margin-bottom: 30px; }\n        .column-item { background: #f8fafc; padding: 15px; margin-bottom: 10px; border-radius: 6px; border-left: 3px solid #94a3b8; break-inside: avoid; }\n        .chart-placeholder { background: #f1f5f9; border: 1px dashed #cbd5e1; padding: 20px; text-align: center; color: #64748b; margin: 10px 0; }\n        .recommendations { background: #fef3c7; padding: 20px; border-radius: 8px; border-left: 4px solid #f59e0b; break-inside: avoid; }\n        .footer { text-align: center; color: #64748b; font-size: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid #e2e8f0; }\n        h1 { color: #1a202c; }\n        h2 { color: #2d3748; margin-top: 30px; }\n        h3 { color: #4a5568; margin-bottom: 10px; }\n        h4 { color: #4a5568; margin-bottom: 8px; }\n        table { border-collapse: collapse; width: 100%; margin: 15px 0; }\n        th, td { border: 1px solid #e2e8f0; padding: 8px; text-align: left; }\n        th { background-color: #f7fafc; font-weight: bold; }\n        .problem-section { margin: 20px 0; padding: 15px; border-left: 4px solid #ef4444; background: #fef2f2; break-inside: avoid; }\n    </style>\n</head>\n<body>\n    <div class="container">\n        <div class="header">\n            <h1>Data Analysis Report</h1>\n            <p><strong>File:</strong> ').concat(t||"Unknown","</p>\n            <p><strong>Analysis Date:</strong> ").concat(new Date(e.analysisTimestamp).toLocaleString(),"</p>\n            <p><strong>Total Rows:</strong> ").concat(e.totalRows.toLocaleString()," | <strong>Columns:</strong> ").concat(e.totalColumns,'</p>\n        </div>\n\n        <div class="health-score">\n            <h2>Overall Health Score</h2>\n            <div style="font-size: 42px; font-weight: bold; margin: 10px 0; color: #2dd4bf;">').concat(e.healthScore,'%</div>\n            <div style="display: flex; justify-content: space-around; margin-top: 20px;">\n                <div>\n                    <div style="font-size: 12px; color: #64748b;">Completeness</div>\n                    <div style="font-size: 16px; font-weight: bold;">').concat(e.healthBreakdown.completeness,'%</div>\n                </div>\n                <div>\n                    <div style="font-size: 12px; color: #64748b;">Uniqueness</div>\n                    <div style="font-size: 16px; font-weight: bold;">').concat(e.healthBreakdown.uniqueness,'%</div>\n                </div>\n                <div>\n                    <div style="font-size: 12px; color: #64748b;">Consistency</div>\n                    <div style="font-size: 16px; font-weight: bold;">').concat(e.healthBreakdown.consistency,'%</div>\n                </div>\n            </div>\n        </div>\n\n        <div class="metrics-grid">\n            <div class="metric-card">\n                <h3>Total Rows</h3>\n                <div style="font-size: 20px; font-weight: bold; color: #2dd4bf;">').concat(e.totalRows.toLocaleString(),'</div>\n            </div>\n            <div class="metric-card">\n                <h3>Total Columns</h3>\n                <div style="font-size: 20px; font-weight: bold; color: #2dd4bf;">').concat(e.totalColumns,'</div>\n            </div>\n            <div class="metric-card">\n                <h3>Duplicate Rows</h3>\n                <div style="font-size: 20px; font-weight: bold; color: ').concat(e.duplicateRows>0?"#ef4444":"#10b981",';">').concat(e.duplicateRows,'</div>\n                <div style="font-size: 12px; color: #64748b;">').concat(e.duplicatePercentage.toFixed(2),'% of total</div>\n            </div>\n            <div class="metric-card">\n                <h3>Type Issues</h3>\n                <div style="font-size: 20px; font-weight: bold; color: ').concat(e.typeIssues.length>0?"#ef4444":"#10b981",';">').concat(e.typeIssues.length,"</div>\n            </div>\n        </div>\n\n        ").concat(e.typeIssues.length>0?'\n            <div class="problem-section">\n                <h3>⚠️ Data Quality Issues</h3>\n                '.concat(e.typeIssues.map(n=>'\n                    <div style="margin: 10px 0; padding: 10px; background: white; border-radius: 4px;">\n                        <strong>'.concat(n.column,":</strong> ").concat(n.issue," (").concat(n.count," occurrences)\n                        ").concat(n.examples?"<br><em>Examples: ".concat(n.examples.slice(0,3).join(", "),"</em>"):"","\n                    </div>\n                ")).join(""),"\n            </div>\n        "):"",'\n\n        <div class="page-break"></div>\n        \n        <div class="column-list">\n            <h2>Column Analysis</h2>\n            ').concat(e.columnMetrics.map(n=>{var r;return'\n                <div class="column-item">\n                    <h4>'.concat(n.name,' <span style="color: #64748b; font-weight: normal;">(').concat(n.type,')</span></h4>\n                    <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 8px;">\n                        <div><strong>Null Count:</strong> ').concat(n.nullCount,"</div>\n                        <div><strong>Null %:</strong> ").concat(n.nullPercentage.toFixed(1),"%</div>\n                        <div><strong>Unique:</strong> ").concat(n.uniqueCount,"</div>\n                        <div><strong>Cardinality:</strong> ").concat(n.cardinality.toFixed(3),"</div>\n                    </div>\n                    ").concat(n.numericStats?'\n                        <div style="margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0; font-size: 14px;">\n                            <strong>📊 Statistics:</strong> \n                            Min: '.concat(n.numericStats.min," | \n                            Max: ").concat(n.numericStats.max," | \n                            Mean: ").concat(n.numericStats.mean.toFixed(2)," | \n                            Std Dev: ").concat(((r=n.numericStats.stdDev)==null?void 0:r.toFixed(2))||"N/A","\n                        </div>\n                    "):"","\n                    ").concat(n.topValues&&n.topValues.length>0?'\n                        <div style="margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0; font-size: 14px;">\n                            <strong>🔝 Top Values:</strong> \n                            '.concat(n.topValues.slice(0,5).map(a=>"".concat(a.value," (").concat(a.count,")")).join(", "),"\n                        </div>\n                    "):"","\n                </div>\n            ")}).join(""),"\n        </div>\n\n        ").concat(e.recommendations.length>0?'\n            <div class="recommendations">\n                <h2>💡 Recommendations</h2>\n                <ul style="margin: 0; padding-left: 20px;">\n                    '.concat(e.recommendations.map(n=>'<li style="margin: 8px 0;">'.concat(n,"</li>")).join(""),"\n                </ul>\n            </div>\n        "):"",'\n\n        <div class="footer">\n            Generated by DataKit Inspector on ').concat(new Date().toLocaleDateString()," at ").concat(new Date().toLocaleTimeString(),"\n            <br>\n            For interactive charts and real-time analysis, visit your DataKit.\n        </div>\n    </div>\n</body>\n</html>"):"<html><body>No analysis data available</body></html>",cTe=(r,a,...s)=>H(null,[r,a,...s],function*(e,t,n={}){try{const i=lTe(e,t==null?void 0:t.fileName),l="".concat((t==null?void 0:t.fileName)||"data","_report_").concat(new Date().toISOString().split("T")[0],".html");Bi(i,l,"text/html");const c=window.open("","_blank");c&&(c.document.write(i),c.document.close(),c.onload=()=>{setTimeout(()=>{c.print()},500)})}catch(i){const l=oTe(e,t==null?void 0:t.fileName),c="".concat((t==null?void 0:t.fileName)||"data","_report_").concat(new Date().toISOString().split("T")[0],".html");throw Bi(l,c,"text/html"),new Error("PDF export completed as HTML. Use browser print to convert to PDF.")}}),uTe=(a,s,i,...l)=>H(null,[a,s,i,...l],function*(e,t,n,r={}){const{limit:c=1e5}=r,u="SELECT * FROM ".concat(t),h=yield e.executePaginatedQuery(u,1,c,!1,!1);if(!(h!=null&&h.data))throw new Error("No data found");const m=h.columns,p=[m.join(","),...h.data.map(y=>m.map(b=>{const x=y[b],R=x==null?"":String(x);return R.includes(",")||R.includes('"')||R.includes("\n")?'"'.concat(R.replace(/"/g,'""'),'"'):R}).join(","))].join("\n"),g=new Date().toISOString().split("T")[0],T="".concat(n,"_export_").concat(g,".csv");Bi(p,T,"text/csv")}),dTe=(e,t,n={})=>{const r={metadata:{fileName:t==null?void 0:t.fileName,exportDate:new Date().toISOString(),analysisTimestamp:e==null?void 0:e.analysisTimestamp},analysis:{totalRows:e==null?void 0:e.totalRows,totalColumns:e==null?void 0:e.totalColumns,healthScore:e==null?void 0:e.healthScore,healthBreakdown:e==null?void 0:e.healthBreakdown,columnMetrics:e==null?void 0:e.columnMetrics,typeIssues:e==null?void 0:e.typeIssues,recommendations:e==null?void 0:e.recommendations,duplicateInfo:{duplicateRows:e==null?void 0:e.duplicateRows,duplicatePercentage:e==null?void 0:e.duplicatePercentage}}},a="".concat((t==null?void 0:t.fileName)||"data","_analysis_").concat(new Date().toISOString().split("T")[0],".json");Bi(JSON.stringify(r,null,2),a,"application/json")},hTe=(a,s,i,...l)=>H(null,[a,s,i,...l],function*(e,t,n,r={}){var u,h,m;const{limit:c=1e5}=r;try{const p="".concat(((u=n==null?void 0:n.fileName)==null?void 0:u.replace(/\.[^/.]+$/,""))||"data","_export_").concat(new Date().toISOString().split("T")[0],".parquet");try{const g="COPY (SELECT * FROM ".concat(t,") TO '").concat(p,"' (FORMAT PARQUET)");throw yield e.executePaginatedQuery(g,1,1,!1,!1),new Error("Parquet export completed via DuckDB COPY command")}catch(g){const T="SELECT * FROM ".concat(t," LIMIT ").concat(c),y=yield e.executePaginatedQuery(T,1,c,!1,!1);if(!y.data||y.data.length===0)throw new Error("No data to export");const b=y.data.map(_=>{const N={};return y.columns.forEach((I,D)=>{N[I]=_[D]}),N}),x=JSON.stringify({metadata:{originalFile:n==null?void 0:n.fileName,exportDate:new Date().toISOString(),rowCount:y.data.length,columns:y.columns,note:"This JSON file can be converted to Parquet using tools like Python pandas: pd.read_json('file.json').to_parquet('file.parquet')"},data:b},null,2),R="".concat(((h=n==null?void 0:n.fileName)==null?void 0:h.replace(/\.[^/.]+$/,""))||"data","_for_parquet_").concat(new Date().toISOString().split("T")[0],".json");Bi(x,R,"application/json");const A=R7(y.data,y.columns),w="".concat(((m=n==null?void 0:n.fileName)==null?void 0:m.replace(/\.[^/.]+$/,""))||"data","_export_").concat(new Date().toISOString().split("T")[0],".csv");throw Bi(A,w,"text/csv"),new Error("Parquet export completed as JSON + CSV. Use tools like Python pandas to convert JSON to Parquet format.")}}catch(p){throw p}}),fTe=(i,l,c,u,h,...m)=>H(null,[i,l,c,u,h,...m],function*(e,t,n,r,a,s={}){const{limit:p=1e6}=s;try{const g='SELECT DISTINCT "'.concat(n,'" FROM ').concat(t,' WHERE "').concat(n,'" IS NOT NULL ORDER BY "').concat(n,'"'),T=yield e.executePaginatedQuery(g,1,p,!1,!1);if(!(T!=null&&T.data))throw new Error("No data found");const y=T.data.map(R=>R[n]),b=new Date().toISOString().split("T")[0],x="".concat((a==null?void 0:a.fileName)||"data","_").concat(n,"_").concat(b);switch(r){case"csv":const R=[n,...y.map(_=>'"'.concat(String(_).replace(/"/g,'""'),'"'))].join("\n");Bi(R,"".concat(x,".csv"),"text/csv");break;case"json":const A={column:n,values:y,metadata:{exportDate:new Date().toISOString(),totalValues:y.length}};Bi(JSON.stringify(A,null,2),"".concat(x,".json"),"application/json");break;case"txt":const w=y.join("\n");Bi(w,"".concat(x,".txt"),"text/plain");break;default:throw new Error("Unsupported format: ".concat(r))}}catch(g){throw g}}),N7=(e,t={})=>{const{width:n=400,height:r=300,backgroundColor:a="#1a1a1a"}=t,s={top:20,right:20,bottom:40,left:60},i=n-s.left-s.right,l=r-s.top-s.bottom;let c="";if(e.histogramData&&e.histogramData.length>0){const u=Math.max(...e.histogramData.map(m=>m.count)),h=i/e.histogramData.length;c=e.histogramData.map((m,p)=>{const g=m.count/u*l,T=p*h,y=l-g;return'<rect x="'.concat(T,'" y="').concat(y,'" width="').concat(h-1,'" height="').concat(g,'" fill="#2dd4bf" opacity="0.8"/>')}).join("")}else{const u=[{label:"Total",value:e.uniqueCount},{label:"Nulls",value:e.nullCount},{label:"Unique",value:e.uniqueCount}],h=Math.max(...u.map(p=>p.value)),m=l/u.length;c=u.map((p,g)=>{const T=p.value/h*i,y=g*m;return'\n        <rect x="0" y="'.concat(y,'" width="').concat(T,'" height="').concat(m-5,'" fill="#2dd4bf" opacity="0.8"/>\n        <text x="5" y="').concat(y+m/2+5,'" fill="white" font-size="12">').concat(p.label,": ").concat(p.value,"</text>\n      ")}).join("")}return'\n    <svg width="'.concat(n,'" height="').concat(r,'" xmlns="http://www.w3.org/2000/svg" style="background: ').concat(a,';">\n      <defs>\n        <style>\n          text { font-family: Arial, sans-serif; }\n        </style>\n      </defs>\n      \n      <g transform="translate(').concat(s.left,", ").concat(s.top,')">\n        ').concat(c,'\n        \n        <!-- Axes -->\n        <line x1="0" y1="').concat(l,'" x2="').concat(i,'" y2="').concat(l,'" stroke="rgba(255,255,255,0.2)" stroke-width="1"/>\n        <line x1="0" y1="0" x2="0" y2="').concat(l,'" stroke="rgba(255,255,255,0.2)" stroke-width="1"/>\n        \n        <!-- Title -->\n        <text x="').concat(i/2,'" y="-5" text-anchor="middle" fill="white" font-size="14" font-weight="bold">\n          ').concat(e.name,' Distribution\n        </text>\n        \n        <!-- Axis labels -->\n        <text x="').concat(i/2,'" y="').concat(l+30,'" text-anchor="middle" fill="rgba(255,255,255,0.8)" font-size="12">\n          Values\n        </text>\n        <text x="-40" y="').concat(l/2,'" text-anchor="middle" fill="rgba(255,255,255,0.8)" font-size="12" transform="rotate(-90, -40, ').concat(l/2,')">\n          Count\n        </text>\n      </g>\n    </svg>\n  ')},mTe=(e,t,n={})=>{try{const r=N7(e,n),a=new Blob([r],{type:"image/svg+xml"}),s=t||"".concat(e.name,"_chart_").concat(Date.now(),".svg"),i=document.createElement("a"),l=URL.createObjectURL(a);i.setAttribute("href",l),i.setAttribute("download",s),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(l)}catch(r){throw r}},pTe=(e,t,n={})=>{try{const{width:r=400,height:a=300}=n,s=N7(e,n),i=t||"".concat(e.name,"_chart_").concat(Date.now(),".png"),l=new Image,c=document.createElement("canvas"),u=c.getContext("2d");c.width=r,c.height=a,l.onload=()=>{u&&(u.drawImage(l,0,0),c.toBlob(p=>{if(p){const g=URL.createObjectURL(p),T=document.createElement("a");T.href=g,T.download=i,T.click(),URL.revokeObjectURL(g)}},"image/png"))};const h=new Blob([s],{type:"image/svg+xml;charset=utf-8"}),m=URL.createObjectURL(h);l.src=m}catch(r){throw r}},gTe=(e,t="svg",n,r={})=>t==="png"?pTe(e,n,r):mTe(e,n,r),ETe=(e={})=>{const{autoAnalysisDelay:t=1e3,autoOpenPanel:n=!1,showQuickPreview:r=!0}=e,{analyzeFile:a,isAnalyzing:s,results:i,openPanel:l,activeFileId:c}=Yc(),{activeFile:u}=ut(),{isInitialized:h,connection:m}=Dt(),[p,g]=v.useState(null),[T,y]=v.useState(!1),[b,x]=v.useState(null),R=v.useCallback((N,I)=>H(null,null,function*(){if(!m||!h)return null;const D=Date.now();y(!0),x(null);try{const M=Dt.getState(),O=M.registeredTables.get(I);if(!O)throw new Error('Table "'.concat(I,'" not found'));const[L,k]=yield Promise.all([m.query("SELECT COUNT(*) as row_count FROM ".concat(O)),M.getTableSchema(I)]),F=Number(L.toArray()[0].row_count),U=(k==null?void 0:k.length)||0,B=Date.now()-D;return{rowCount:F,columnCount:U,tableName:I,loadTime:B}}catch(M){return x(M instanceof Error?M.message:String(M)),null}finally{y(!1)}}),[m,h]),A=v.useCallback((N,I)=>H(null,null,function*(){if(!(s||i.has(N)))try{if(r){const D=yield R(N,I);g(D)}yield new Promise(D=>setTimeout(D,200)),yield a(N,I),n&&!Yc.getState().isOpen&&l()}catch(D){x(D instanceof Error?D.message:String(D))}}),[a,s,i,r,R,n,l]);v.useEffect(()=>{if(!u||!u.tableName||!h){g(null),x(null);return}const N=u.id,I=u.tableName;if(c!==N&&(g(null),x(null)),i.has(N)||s&&c===N)return;const D=setTimeout(()=>{A(N,I)},t);return()=>{clearTimeout(D)}},[u,h,i,s,c,t,A]);const w=v.useCallback(()=>{u&&u.tableName&&A(u.id,u.tableName)},[u,A]),_=v.useCallback(()=>{g(null),x(null)},[]);return{quickPreview:p,isGettingPreview:T,previewError:b,manualTrigger:w,clearPreview:_,hasPreview:!!p,hasResults:u?i.has(u.id):!1,shouldShowPreview:r&&(T||!!p),isAnalyzing:s,analysisProgress:Yc(N=>N.analysisProgress),analysisStatus:Yc(N=>N.analysisStatus)}},TTe=({preview:e,isAnalyzing:t=!1,className:n})=>o.jsxs("div",{className:"p-4 bg-card/20 rounded-lg border border-white/10 ".concat(n||""),children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-medium text-white",children:"Quick Preview"}),t&&o.jsxs("div",{className:"flex items-center gap-2 text-xs text-primary",children:[o.jsx("div",{className:"w-1.5 h-1.5 bg-primary rounded-full animate-pulse"}),"Analyzing..."]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-bold text-white",children:e.rowCount.toLocaleString()}),o.jsx("div",{className:"text-xs text-white/60",children:"Rows"})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-lg font-bold text-white",children:e.columnCount}),o.jsx("div",{className:"text-xs text-white/60",children:"Columns"})]})]}),o.jsx("div",{className:"mt-3 pt-3 border-t border-white/10",children:o.jsxs("div",{className:"text-xs text-white/50",children:["Loaded in ",e.loadTime,"ms",t&&" • Full analysis in progress..."]})})]}),yTe=e=>[{id:"validation",label:e("inspector.loading.steps.validation.label",{defaultValue:"Validating Data"}),description:e("inspector.loading.steps.validation.description",{defaultValue:"Checking table structure and accessibility"}),icon:o.jsx(Xs,{className:"h-4 w-4"}),estimatedDuration:1,progressRange:[0,10]},{id:"schema",label:e("inspector.loading.steps.schema.label",{defaultValue:"Reading Schema"}),description:e("inspector.loading.steps.schema.description",{defaultValue:"Identifying column types and structure"}),icon:o.jsx(Qi,{className:"h-4 w-4"}),estimatedDuration:2,progressRange:[10,25]},{id:"duplicates",label:e("inspector.loading.steps.duplicates.label",{defaultValue:"Detecting Duplicates"}),description:e("inspector.loading.steps.duplicates.description",{defaultValue:"Scanning for duplicate rows"}),icon:o.jsx(ma,{className:"h-4 w-4"}),estimatedDuration:3,progressRange:[25,35]},{id:"columns",label:e("inspector.loading.steps.columns.label",{defaultValue:"Analyzing Columns"}),description:e("inspector.loading.steps.columns.description",{defaultValue:"Computing statistics and patterns"}),icon:o.jsx(ko,{className:"h-4 w-4"}),estimatedDuration:8,progressRange:[35,85]},{id:"quality",label:e("inspector.loading.steps.quality.label",{defaultValue:"Quality Assessment"}),description:e("inspector.loading.steps.quality.description",{defaultValue:"Calculating health scores and recommendations"}),icon:o.jsx(qW,{className:"h-4 w-4"}),estimatedDuration:2,progressRange:[85,100]}],xTe=(e,t)=>{const n=t.find(s=>e>=s.progressRange[0]&&e<s.progressRange[1])||t[t.length-1],r=t.indexOf(n),a=t[r+1];return{current:n,next:a}},STe=({progress:e,currentColumn:t,totalColumns:n,className:r})=>{const{t:a}=Ze(),s=yTe(a),{current:i}=xTe(e,s);return o.jsx("div",{className:"space-y-6 ".concat(r||""),children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsxs("div",{className:"relative mb-6",children:[o.jsxs("svg",{className:"w-20 h-20 transform -rotate-90",viewBox:"0 0 80 80",children:[o.jsx("circle",{cx:"40",cy:"40",r:"35",stroke:"rgba(255,255,255,0.1)",strokeWidth:"6",fill:"none"}),o.jsx(me.circle,{cx:"40",cy:"40",r:"35",stroke:"hsl(175, 100%, 36%)",strokeWidth:"6",fill:"none",strokeLinecap:"round",strokeDasharray:"".concat(2*Math.PI*35),strokeDashoffset:"".concat(2*Math.PI*35*(1-e/100)),initial:{strokeDashoffset:2*Math.PI*35},animate:{strokeDashoffset:2*Math.PI*35*(1-e/100)},transition:{duration:.5,ease:"easeInOut"}})]}),o.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:o.jsxs("span",{className:"text-xs font-mono text-white",children:[Math.round(e),"%"]})})]}),o.jsxs(me.div,{initial:{y:10,opacity:0},animate:{y:0,opacity:1},className:"text-center space-y-2 max-w-sm",children:[o.jsx("h3",{className:"text-sm font-semibold text-white",children:i.label}),o.jsx("p",{className:"text-xs text-white/70",children:i.description}),i.id==="columns"&&t&&n&&o.jsx("div",{className:"text-xs text-white/60",children:a("inspector.loading.analyzingColumn",{defaultValue:"Analyzing: {{currentColumn}} • Column {{currentColumnNumber}} of {{totalColumns}}",currentColumn:t,currentColumnNumber:Math.round((e-35)/50*n),totalColumns:n})})]},i.id)]})})},bTe=({searchTerm:e,filterType:t,onClearFilters:n,totalColumns:r,className:a})=>{const{t:s}=Ze(),i=e||t&&t!=="all";return o.jsxs(me.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"flex flex-col items-center justify-center py-8 space-y-4 text-center ".concat(a||""),children:[o.jsx("div",{className:"relative"}),o.jsxs("div",{className:"space-y-2 max-w-sm",children:[o.jsx("h3",{className:"text-sm font-medium text-white/90",children:s("inspector.emptyStates.noColumns.title",{defaultValue:"No Columns Found"})}),i?o.jsxs("p",{className:"text-xs text-white/60",children:[e?s("inspector.emptyStates.noColumns.noMatchingColumns",{defaultValue:'No columns matching "{{searchTerm}}"',searchTerm:e}):s("inspector.emptyStates.noColumns.noFilteredColumns",{defaultValue:"No {{filterType}} columns found",filterType:t}),r&&" ".concat(s("inspector.emptyStates.noColumns.totalColumns",{defaultValue:"in {{totalColumns}} total columns",totalColumns:r}))]}):o.jsx("p",{className:"text-xs text-white/60",children:s("inspector.emptyStates.noColumns.noAnalyzableColumns",{defaultValue:"This dataset doesn't have any analyzable columns"})})]}),i&&n&&o.jsxs(me.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:n,className:"flex items-center gap-2 px-4 py-2 bg-primary/20 hover:bg-primary/30 text-primary rounded-lg text-sm font-medium transition-colors",children:[o.jsx(ur,{className:"h-3 w-3"}),s("inspector.emptyStates.noColumns.clearFiltersButton",{defaultValue:"Clear Filters"})]}),o.jsx("div",{className:"text-xs text-white/50",children:s("inspector.emptyStates.noColumns.suggestion",{defaultValue:"Try adjusting your search or filter criteria"})})]})},vTe=({error:e,onRetry:t,onReset:n,className:r})=>{const{t:a}=Ze();return o.jsxs(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col items-center justify-center py-12 space-y-6 text-center ".concat(r||""),children:[o.jsx(me.div,{animate:{rotate:[0,-5,5,0]},transition:{duration:.5},className:"w-16 h-16 bg-red-500/10 rounded-lg flex items-center justify-center",children:o.jsx(ur,{className:"h-8 w-8 text-red-400"})}),o.jsxs("div",{className:"space-y-2 max-w-md",children:[o.jsx("h3",{className:"text-lg font-semibold text-white",children:a("inspector.emptyStates.error.title",{defaultValue:"Analysis Failed"})}),o.jsx("p",{className:"text-sm text-white/70",children:e})]}),o.jsxs("div",{className:"flex gap-3",children:[t&&o.jsx(me.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:t,className:"px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg text-sm font-medium transition-colors",children:a("inspector.emptyStates.error.tryAgainButton",{defaultValue:"Try Again"})}),n&&o.jsx(me.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:n,className:"px-4 py-2 bg-card/30 hover:bg-card/50 text-white rounded-lg text-sm font-medium transition-colors",children:a("inspector.emptyStates.error.resetButton",{defaultValue:"Reset"})})]}),o.jsx("div",{className:"text-xs text-white/50 max-w-md",children:a("inspector.emptyStates.error.suggestion",{defaultValue:"If the problem persists, try with a different file or contact support"})})]})},PA=[{value:"all",label:"Default",icon:o.jsx(Xn,{className:"h-3 w-3"}),description:"Show all columns"},{value:"numeric",label:"Numeric",icon:o.jsx(hu,{className:"h-3 w-3"}),description:"INTEGER, DOUBLE, NUMERIC types"},{value:"text",label:"Text",icon:o.jsx(Kh,{className:"h-3 w-3"}),description:"VARCHAR, TEXT types"},{value:"date",label:"Date/Time",icon:o.jsx(Fl,{className:"h-3 w-3"}),description:"DATE, TIMESTAMP types"}],ATe=({searchTerm:e,onSearchChange:t,filterType:n,onFilterChange:r,totalColumns:a,filteredCount:s})=>{const[i,l]=v.useState(!1),[c,u]=v.useState(!1),h=PA.find(p=>p.value===n)||PA[0],m=n==="name"||e.length>0;return o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"text-sm font-medium text-white/90",children:"Columns"}),o.jsxs("span",{className:"text-xs text-white/50",children:[s!==a?"".concat(s," of "):"",a]})]}),o.jsxs("div",{className:"relative",children:[o.jsxs("button",{onClick:()=>l(!i),className:"flex items-center gap-2 px-3 py-1.5 bg-card/30 hover:bg-card/50 border border-white/10 rounded-lg text-xs text-white/80 hover:text-white transition-colors",children:[h.icon,o.jsx("span",{children:h.label}),o.jsx(br,{className:Qe("h-3 w-3 transition-transform",i&&"rotate-180")})]}),o.jsx(At,{children:i&&o.jsx(me.div,{initial:{opacity:0,y:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:5,scale:.95},transition:{duration:.15},className:"absolute right-0 top-full mt-2 bg-card/95 backdrop-blur-sm border border-white/20 rounded-lg shadow-xl z-50 min-w-48",children:PA.map(p=>o.jsxs("button",{onClick:()=>{r(p.value),l(!1),p.value!=="name"&&e&&t("")},className:Qe("w-full flex items-start gap-3 p-3 text-left hover:bg-white/10 transition-colors first:rounded-t-lg last:rounded-b-lg",n===p.value&&"bg-primary/20 text-primary"),children:[o.jsx("div",{className:"mt-0.5",children:p.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"text-sm font-medium",children:p.label}),o.jsx("div",{className:"text-xs text-white/60 mt-0.5",children:p.description})]})]},p.value))})})]})]}),o.jsx(At,{children:m&&o.jsx(me.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:o.jsxs("div",{className:"relative",children:[o.jsx(Qi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-3 w-3 text-white/50"}),o.jsx("input",{type:"text",placeholder:"Search column names...",value:e,onChange:p=>t(p.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),className:Qe("w-full pl-9 pr-3 py-2 bg-card/20 border border-white/10 rounded-lg text-sm text-white placeholder-white/50 transition-all duration-200","focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary/50",c&&"bg-card/30"),autoFocus:n==="name"})]})})}),n==="name"&&e.length>0&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},className:"mt-2 text-xs text-white/60",children:s===0?o.jsxs("span",{className:"text-yellow-400",children:['No columns match "',e,'"']}):s===1?o.jsxs("span",{children:['Found 1 column matching "',e,'"']}):o.jsxs("span",{children:["Found ",s,' columns matching "',e,'"']})}),o.jsx("p",{className:"text-xs text-white/60 mt-1",children:"Click columns to explore patterns"})]})},RTe=(e,t,n)=>v.useMemo(()=>{let r=e;if(n!=="all"&&n!=="name"&&(r=e.filter(a=>{const s=a.type.toLowerCase();switch(n){case"numeric":return s.includes("int")||s.includes("double")||s.includes("numeric")||s.includes("decimal")||s.includes("float");case"text":return s.includes("varchar")||s.includes("text")||s.includes("string")||s.includes("char");case"date":return s.includes("date")||s.includes("time")||s.includes("timestamp");default:return!0}})),t.trim().length>0){const a=t.toLowerCase().trim();r=r.filter(s=>s.name.toLowerCase().includes(a))}return r},[e,t,n]),NTe=({fileName:e,lastAnalyzed:t})=>{const{t:n}=Ze(),[r]=v.useState(null);return o.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/10 bg-background/50 backdrop-blur-sm",children:[o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-white",children:e}),t&&o.jsx("div",{className:"text-xs text-white/60",children:n("inspector.quickActions.lastAnalyzed",{defaultValue:"Last analyzed: {{time}}",time:t.toLocaleTimeString()})})]})}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(At,{children:r&&o.jsxs(me.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:Qe("flex items-center gap-2 px-3 py-1.5 rounded-lg border text-sm",r.status==="success"?"bg-emerald-500/20 border-emerald-500/30 text-emerald-300":"bg-red-500/20 border-red-500/30 text-red-300"),children:[r.status==="success"?o.jsx(Zr,{className:"h-4 w-4"}):o.jsx(Cn,{className:"h-4 w-4"}),r.message]})})})]})},_Te=({currentView:e,onViewChange:t,problemCount:n=0,columnCount:r=0})=>{const a=[{id:"overview",label:"Overview",icon:o.jsx(ko,{className:"h-4 w-4"}),description:"Data summary and health"},{id:"columns",label:"Columns",icon:o.jsx(hh,{className:"h-4 w-4"}),description:"Column-by-column analysis",badge:r},{id:"problems",label:"Problems",icon:o.jsx(Ma,{className:"h-4 w-4"}),description:"Quality issues and fixes",badge:n},{id:"export",label:"Export",icon:o.jsx(Hr,{className:"h-4 w-4"}),description:"Export options"}],s=i=>i<1e3?i.toString():i<1e6?"".concat((i/1e3).toFixed(1),"K"):"".concat((i/1e6).toFixed(1),"M");return o.jsx("div",{className:"flex items-center gap-1 p-2 bg-card/10 rounded-lg border border-white/10",children:a.map(i=>o.jsxs("button",{onClick:()=>t(i.id),disabled:i.disabled,className:Qe("relative flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200",e===i.id?"text-primary shadow-sm":"text-white/70 hover:text-white hover:bg-white/10",i.disabled&&"opacity-50 cursor-not-allowed"),children:[e===i.id&&o.jsx(me.div,{layoutId:"viewSwitcher",className:"absolute inset-0 bg-primary/10 rounded-lg border border-primary/20",initial:!1,transition:{type:"spring",stiffness:300,damping:30}}),o.jsxs("div",{className:"relative flex items-center gap-2",children:[i.icon,o.jsx("span",{className:"hidden sm:inline",children:i.label})]}),i.badge!==void 0&&i.badge>0&&o.jsx("div",{className:Qe("relative flex items-center justify-center min-w-5 h-5 px-1.5 rounded-full text-xs font-medium",e===i.id?"text-white":i.id==="problems"&&i.badge>0?"bg-red-500 text-white":"bg-white/20 text-white/80"),children:s(i.badge)})]},i.id))})},wTe=({metrics:e})=>{const{t}=Ze(),n=e.typeIssues.filter(a=>a.severity==="high").length,r=e.typeIssues.length;return o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"p-6 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"text-lg font-semibold text-white",children:t("inspector.overview.dataOverview",{defaultValue:"Data Overview"})}),o.jsx("div",{className:"text-xs text-white/50",children:t("inspector.overview.analyzedAt",{defaultValue:"Analyzed at {{time}}",time:new Date(e.analysisTimestamp).toLocaleTimeString()})})]}),o.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6",children:[o.jsxs(me.div,{whileHover:{scale:1.05},className:"text-center p-4 bg-card/20 rounded-lg border border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[o.jsx(Xs,{className:"h-4 w-4 text-white/60"}),o.jsx("div",{className:"text-lg font-bold text-white",children:e.totalRows.toLocaleString()})]}),o.jsx("div",{className:"text-xs text-white/60",children:t("inspector.overview.rows",{defaultValue:"Rows"})})]}),o.jsxs(me.div,{whileHover:{scale:1.05},className:"text-center p-4 bg-card/20 rounded-lg border border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[o.jsx(zhe,{className:"h-4 w-4 text-white/60"}),o.jsx("div",{className:"text-lg font-bold text-white",children:e.totalColumns})]}),o.jsx("div",{className:"text-xs text-white/60",children:t("inspector.overview.columns",{defaultValue:"Columns"})})]}),o.jsxs(me.div,{whileHover:{scale:1.05},className:"text-center p-4 bg-card/20 rounded-lg border border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[o.jsx(gi,{className:"h-4 w-4 text-red-400"}),o.jsx("div",{className:"text-lg font-bold text-red-400",children:e.duplicateRows})]}),o.jsx("div",{className:"text-xs text-white/60",children:t("inspector.overview.duplicates",{defaultValue:"Duplicates"})}),e.duplicateRows>0&&o.jsxs("div",{className:"text-xs text-red-400/80",children:[e.duplicatePercentage.toFixed(1),"%"]})]}),o.jsxs(me.div,{whileHover:{scale:1.05},className:"text-center p-4 bg-card/20 rounded-lg border border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-center gap-2 mb-1",children:[o.jsx(Ma,{className:"h-4 w-4 text-yellow-400"}),o.jsx("div",{className:"text-lg font-bold text-yellow-400",children:r})]}),o.jsx("div",{className:"text-xs text-white/60",children:t("inspector.overview.issues",{defaultValue:"Issues"})}),n>0&&o.jsx("div",{className:"text-xs text-red-400/80",children:t("inspector.overview.critical",{defaultValue:"{{count}} critical",count:n})})]})]}),o.jsxs("div",{className:"mb-4",children:[o.jsx("div",{className:"text-sm font-medium text-white mb-2",children:t("inspector.overview.qualityBreakdown",{defaultValue:"Quality Breakdown"})}),o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"text-center p-2 bg-card/10 rounded border border-white/5",children:[o.jsxs("div",{className:"text-sm font-medium text-white",children:[e.healthBreakdown.completeness,"%"]}),o.jsx("div",{className:"text-xs text-white/60",children:t("inspector.overview.completeness",{defaultValue:"Completeness"})})]}),o.jsxs("div",{className:"text-center p-2 bg-card/10 rounded border border-white/5",children:[o.jsxs("div",{className:"text-sm font-medium text-white",children:[e.healthBreakdown.uniqueness,"%"]}),o.jsx("div",{className:"text-xs text-white/60",children:t("inspector.overview.uniqueness",{defaultValue:"Uniqueness"})})]}),o.jsxs("div",{className:"text-center p-2 bg-card/10 rounded border border-white/5",children:[o.jsxs("div",{className:"text-sm font-medium text-white",children:[e.healthBreakdown.consistency,"%"]}),o.jsx("div",{className:"text-xs text-white/60",children:t("inspector.overview.consistency",{defaultValue:"Consistency"})})]})]})]}),o.jsx("div",{className:"mt-3 pt-3 border-t border-white/5",children:o.jsx("div",{className:"flex items-center justify-between text-xs text-white/50",children:o.jsx("div",{children:t("inspector.overview.analysisCompleted",{defaultValue:"Analysis completed in {{time}}s",time:(e.analysisTimeMs/1e3).toFixed(1)})})})})]})},w3=({title:e,children:t,height:n=170})=>o.jsxs("div",{className:"mt-3 p-3 bg-card/20 rounded-lg",children:[o.jsx("div",{className:"text-xs text-white/60 mb-3",children:e}),o.jsx("div",{style:{height:"".concat(n,"px")},children:t})]});var JL=kg(),Xt=e=>Pg(e,JL),ZL=kg();Xt.write=e=>Pg(e,ZL);var K0=kg();Xt.onStart=e=>Pg(e,K0);var eM=kg();Xt.onFrame=e=>Pg(e,eM);var tM=kg();Xt.onFinish=e=>Pg(e,tM);var ph=[];Xt.setTimeout=(e,t)=>{const n=Xt.now()+t,r=()=>{const s=ph.findIndex(i=>i.cancel==r);~s&&ph.splice(s,1),Cl-=~s?1:0},a={time:n,handler:e,cancel:r};return ph.splice(_7(n),0,a),Cl+=1,w7(),a};var _7=e=>~(~ph.findIndex(t=>t.time>e)||~ph.length);Xt.cancel=e=>{K0.delete(e),eM.delete(e),tM.delete(e),JL.delete(e),ZL.delete(e)};Xt.sync=e=>{NO=!0,Xt.batchedUpdates(e),NO=!1};Xt.throttle=e=>{let t;function n(){try{e(...t)}finally{t=null}}function r(...a){t=a,Xt.onStart(n)}return r.handler=e,r.cancel=()=>{K0.delete(n),t=null},r};var nM=typeof window!="undefined"?window.requestAnimationFrame:()=>{};Xt.use=e=>nM=e;Xt.now=typeof performance!="undefined"?()=>performance.now():Date.now;Xt.batchedUpdates=e=>e();Xt.catch=console.error;Xt.frameLoop="always";Xt.advance=()=>{Xt.frameLoop!=="demand"||I7()};var wl=-1,Cl=0,NO=!1;function Pg(e,t){NO?(t.delete(e),e(0)):(t.add(e),w7())}function w7(){wl<0&&(wl=0,Xt.frameLoop!=="demand"&&nM(C7))}function CTe(){wl=-1}function C7(){~wl&&(nM(C7),Xt.batchedUpdates(I7))}function I7(){const e=wl;wl=Xt.now();const t=_7(wl);if(t&&(O7(ph.splice(0,t),n=>n.handler()),Cl-=t),!Cl){CTe();return}K0.flush(),JL.flush(e?Math.min(64,wl-e):16.667),eM.flush(),ZL.flush(),tM.flush()}function kg(){let e=new Set,t=e;return{add(n){Cl+=t==e&&!e.has(n)?1:0,e.add(n)},delete(n){return Cl-=t==e&&e.has(n)?1:0,e.delete(n)},flush(n){t.size&&(e=new Set,Cl-=t.size,O7(t,r=>r(n)&&e.add(r)),Cl+=e.size,t=e)}}}function O7(e,t){e.forEach(n=>{try{t(n)}catch(r){Xt.catch(r)}})}var ITe=Object.defineProperty,OTe=(e,t)=>{for(var n in t)ITe(e,n,{get:t[n],enumerable:!0})},Ei={};OTe(Ei,{assign:()=>MTe,colors:()=>Pl,createStringInterpolator:()=>aM,skipAnimation:()=>M7,to:()=>L7,willAdvance:()=>sM});function _O(){}var LTe=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),ze={arr:Array.isArray,obj:e=>!!e&&e.constructor.name==="Object",fun:e=>typeof e=="function",str:e=>typeof e=="string",num:e=>typeof e=="number",und:e=>e===void 0};function Ro(e,t){if(ze.arr(e)){if(!ze.arr(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return e===t}var qt=(e,t)=>e.forEach(t);function Yi(e,t,n){if(ze.arr(e)){for(let r=0;r<e.length;r++)t.call(n,e[r],"".concat(r));return}for(const r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r)}var Ga=e=>ze.und(e)?[]:ze.arr(e)?e:[e];function Ip(e,t){if(e.size){const n=Array.from(e);e.clear(),qt(n,t)}}var hp=(e,...t)=>Ip(e,n=>n(...t)),rM=()=>typeof window=="undefined"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),aM,L7,Pl=null,M7=!1,sM=_O,MTe=e=>{e.to&&(L7=e.to),e.now&&(Xt.now=e.now),e.colors!==void 0&&(Pl=e.colors),e.skipAnimation!=null&&(M7=e.skipAnimation),e.createStringInterpolator&&(aM=e.createStringInterpolator),e.requestAnimationFrame&&Xt.use(e.requestAnimationFrame),e.batchedUpdates&&(Xt.batchedUpdates=e.batchedUpdates),e.willAdvance&&(sM=e.willAdvance),e.frameLoop&&(Xt.frameLoop=e.frameLoop)},Op=new Set,Fs=[],kA=[],zy=0,Q0={get idle(){return!Op.size&&!Fs.length},start(e){zy>e.priority?(Op.add(e),Xt.onStart(DTe)):(D7(e),Xt(wO))},advance:wO,sort(e){if(zy)Xt.onFrame(()=>Q0.sort(e));else{const t=Fs.indexOf(e);~t&&(Fs.splice(t,1),P7(e))}},clear(){Fs=[],Op.clear()}};function DTe(){Op.forEach(D7),Op.clear(),Xt(wO)}function D7(e){Fs.includes(e)||P7(e)}function P7(e){Fs.splice(PTe(Fs,t=>t.priority>e.priority),0,e)}function wO(e){const t=kA;for(let n=0;n<Fs.length;n++){const r=Fs[n];zy=r.priority,r.idle||(sM(r),r.advance(e),r.idle||t.push(r))}return zy=0,kA=Fs,kA.length=0,Fs=t,Fs.length>0}function PTe(e,t){const n=e.findIndex(t);return n<0?e.length:n}var kTe={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},fi="[-+]?\\d*\\.?\\d+",qy=fi+"%";function J0(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var jTe=new RegExp("rgb"+J0(fi,fi,fi)),UTe=new RegExp("rgba"+J0(fi,fi,fi,fi)),FTe=new RegExp("hsl"+J0(fi,qy,qy)),$Te=new RegExp("hsla"+J0(fi,qy,qy,fi)),BTe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,HTe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,VTe=/^#([0-9a-fA-F]{6})$/,GTe=/^#([0-9a-fA-F]{8})$/;function zTe(e){let t;return typeof e=="number"?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=VTe.exec(e))?parseInt(t[1]+"ff",16)>>>0:Pl&&Pl[e]!==void 0?Pl[e]:(t=jTe.exec(e))?(Rd(t[1])<<24|Rd(t[2])<<16|Rd(t[3])<<8|255)>>>0:(t=UTe.exec(e))?(Rd(t[1])<<24|Rd(t[2])<<16|Rd(t[3])<<8|O3(t[4]))>>>0:(t=BTe.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+"ff",16)>>>0:(t=GTe.exec(e))?parseInt(t[1],16)>>>0:(t=HTe.exec(e))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=FTe.exec(e))?(C3(I3(t[1]),OT(t[2]),OT(t[3]))|255)>>>0:(t=$Te.exec(e))?(C3(I3(t[1]),OT(t[2]),OT(t[3]))|O3(t[4]))>>>0:null}function jA(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function C3(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,a=2*n-r,s=jA(a,r,e+1/3),i=jA(a,r,e),l=jA(a,r,e-1/3);return Math.round(s*255)<<24|Math.round(i*255)<<16|Math.round(l*255)<<8}function Rd(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function I3(e){return(parseFloat(e)%360+360)%360/360}function O3(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function OT(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function L3(e){let t=zTe(e);if(t===null)return e;t=t||0;const n=(t&4278190080)>>>24,r=(t&16711680)>>>16,a=(t&65280)>>>8,s=(t&255)/255;return"rgba(".concat(n,", ").concat(r,", ").concat(a,", ").concat(s,")")}var rg=(e,t,n)=>{if(ze.fun(e))return e;if(ze.arr(e))return rg({range:e,output:t,extrapolate:n});if(ze.str(e.output[0]))return aM(e);const r=e,a=r.output,s=r.range||[0,1],i=r.extrapolateLeft||r.extrapolate||"extend",l=r.extrapolateRight||r.extrapolate||"extend",c=r.easing||(u=>u);return u=>{const h=YTe(u,s);return qTe(u,s[h],s[h+1],a[h],a[h+1],c,i,l,r.map)}};function qTe(e,t,n,r,a,s,i,l,c){let u=c?c(e):e;if(u<t){if(i==="identity")return u;i==="clamp"&&(u=t)}if(u>n){if(l==="identity")return u;l==="clamp"&&(u=n)}return r===a?r:t===n?e<=t?r:a:(t===-1/0?u=-u:n===1/0?u=u-t:u=(u-t)/(n-t),u=s(u),r===-1/0?u=-u:a===1/0?u=u+r:u=u*(a-r)+r,u)}function YTe(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var WTe={linear:e=>e},ag=Symbol.for("FluidValue.get"),Oh=Symbol.for("FluidValue.observers"),js=e=>!!(e&&e[ag]),Za=e=>e&&e[ag]?e[ag]():e,M3=e=>e[Oh]||null;function XTe(e,t){e.eventObserved?e.eventObserved(t):e(t)}function sg(e,t){const n=e[Oh];n&&n.forEach(r=>{XTe(r,t)})}var k7=class{constructor(e){if(!e&&!(e=this.get))throw Error("Unknown getter");KTe(this,e)}},KTe=(e,t)=>j7(e,ag,t);function ef(e,t){if(e[ag]){let n=e[Oh];n||j7(e,Oh,n=new Set),n.has(t)||(n.add(t),e.observerAdded&&e.observerAdded(n.size,t))}return t}function ig(e,t){const n=e[Oh];if(n&&n.has(t)){const r=n.size-1;r?n.delete(t):e[Oh]=null,e.observerRemoved&&e.observerRemoved(r,t)}}var j7=(e,t,n)=>Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0}),oy=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,QTe=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,D3=new RegExp("(".concat(oy.source,")(%|[a-z]+)"),"i"),JTe=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,Z0=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,U7=e=>{const[t,n]=ZTe(e);if(!t||rM())return e;const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);if(r)return r.trim();if(n&&n.startsWith("--")){const a=window.getComputedStyle(document.documentElement).getPropertyValue(n);return a||e}else{if(n&&Z0.test(n))return U7(n);if(n)return n}return e},ZTe=e=>{const t=Z0.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]},UA,eye=(e,t,n,r,a)=>"rgba(".concat(Math.round(t),", ").concat(Math.round(n),", ").concat(Math.round(r),", ").concat(a,")"),F7=e=>{UA||(UA=Pl?new RegExp("(".concat(Object.keys(Pl).join("|"),")(?!\\w)"),"g"):/^\b$/);const t=e.output.map(s=>Za(s).replace(Z0,U7).replace(QTe,L3).replace(UA,L3)),n=t.map(s=>s.match(oy).map(Number)),a=n[0].map((s,i)=>n.map(l=>{if(!(i in l))throw Error('The arity of each "output" value must be equal');return l[i]})).map(s=>rg(he(q({},e),{output:s})));return s=>{var c;const i=!D3.test(t[0])&&((c=t.find(u=>D3.test(u)))==null?void 0:c.replace(oy,""));let l=0;return t[0].replace(oy,()=>"".concat(a[l++](s)).concat(i||"")).replace(JTe,eye)}},iM="react-spring: ",$7=e=>{const t=e;let n=!1;if(typeof t!="function")throw new TypeError("".concat(iM,"once requires a function parameter"));return(...r)=>{n||(t(...r),n=!0)}},tye=$7(console.warn);function nye(){tye("".concat(iM,'The "interpolate" function is deprecated in v9 (use "to" instead)'))}var rye=$7(console.warn);function aye(){rye("".concat(iM,'Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions'))}function ex(e){return ze.str(e)&&(e[0]=="#"||/\d/.test(e)||!rM()&&Z0.test(e)||e in(Pl||{}))}var Wc=rM()?v.useEffect:v.useLayoutEffect,sye=()=>{const e=v.useRef(!1);return Wc(()=>(e.current=!0,()=>{e.current=!1}),[]),e};function oM(){const e=v.useState()[1],t=sye();return()=>{t.current&&e(Math.random())}}var lM=e=>v.useEffect(e,iye),iye=[];function CO(e){const t=v.useRef(void 0);return v.useEffect(()=>{t.current=e}),t.current}var og=Symbol.for("Animated:node"),oye=e=>!!e&&e[og]===e,Li=e=>e&&e[og],cM=(e,t)=>LTe(e,og,t),tx=e=>e&&e[og]&&e[og].getPayload(),B7=class{constructor(){cM(this,this)}getPayload(){return this.payload||[]}},nx=class H7 extends B7{constructor(t){super(),this._value=t,this.done=!0,this.durationProgress=0,ze.num(this._value)&&(this.lastPosition=this._value)}static create(t){return new H7(t)}getPayload(){return[this]}getValue(){return this._value}setValue(t,n){return ze.num(t)&&(this.lastPosition=t,n&&(t=Math.round(t/n)*n,this.done&&(this.lastPosition=t))),this._value===t?!1:(this._value=t,!0)}reset(){const{done:t}=this;this.done=!1,ze.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,t&&(this.lastVelocity=null),this.v0=null)}},Yy=class V7 extends nx{constructor(t){super(0),this._string=null,this._toString=rg({output:[t,t]})}static create(t){return new V7(t)}getValue(){const t=this._string;return t==null?this._string=this._toString(this._value):t}setValue(t){if(ze.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=rg({output:[this.getValue(),t]})),this._value=0,super.reset()}},Wy={dependencies:null},rx=class extends B7{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return Yi(this.source,(n,r)=>{oye(n)?t[r]=n.getValue(e):js(n)?t[r]=Za(n):e||(t[r]=n)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&qt(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return Yi(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Wy.dependencies&&js(e)&&Wy.dependencies.add(e);const t=tx(e);t&&qt(t,n=>this.add(n))}},lye=class G7 extends rx{constructor(t){super(t)}static create(t){return new G7(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){const n=this.getPayload();return t.length==n.length?n.map((r,a)=>r.setValue(t[a])).some(Boolean):(super.setValue(t.map(cye)),!0)}};function cye(e){return(ex(e)?Yy:nx).create(e)}function IO(e){const t=Li(e);return t?t.constructor:ze.arr(e)?lye:ex(e)?Yy:nx}var P3=(e,t)=>{const n=!ze.fun(e)||e.prototype&&e.prototype.isReactComponent;return v.forwardRef((r,a)=>{const s=v.useRef(null),i=n&&v.useCallback(T=>{s.current=hye(a,T)},[a]),[l,c]=dye(r,t),u=oM(),h=()=>{const T=s.current;if(n&&!T)return;(T?t.applyAnimatedValues(T,l.getValue(!0)):!1)===!1&&u()},m=new uye(h,c),p=v.useRef(void 0);Wc(()=>(p.current=m,qt(c,T=>ef(T,m)),()=>{p.current&&(qt(p.current.deps,T=>ig(T,p.current)),Xt.cancel(p.current.update))})),v.useEffect(h,[]),lM(()=>()=>{const T=p.current;qt(T.deps,y=>ig(y,T))});const g=t.getComponentProps(l.getValue());return v.createElement(e,he(q({},g),{ref:i}))})},uye=class{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&Xt.write(this.update)}};function dye(e,t){const n=new Set;return Wy.dependencies=n,e.style&&(e=he(q({},e),{style:t.createAnimatedStyle(e.style)})),e=new rx(e),Wy.dependencies=null,[e,n]}function hye(e,t){return e&&(ze.fun(e)?e(t):e.current=t),t}var k3=Symbol.for("AnimatedComponent"),fye=(e,{applyAnimatedValues:t=()=>!1,createAnimatedStyle:n=a=>new rx(a),getComponentProps:r=a=>a}={})=>{const a={applyAnimatedValues:t,createAnimatedStyle:n,getComponentProps:r},s=i=>{const l=j3(i)||"Anonymous";return ze.str(i)?i=s[i]||(s[i]=P3(i,a)):i=i[k3]||(i[k3]=P3(i,a)),i.displayName="Animated(".concat(l,")"),i};return Yi(e,(i,l)=>{ze.arr(e)&&(l=j3(i)),s[l]=s(i)}),{animated:s}},j3=e=>ze.str(e)?e:e&&ze.str(e.displayName)?e.displayName:ze.fun(e)&&e.name||null;function es(e,...t){return ze.fun(e)?e(...t):e}var Lp=(e,t)=>e===!0||!!(t&&e&&(ze.fun(e)?e(t):Ga(e).includes(t))),z7=(e,t)=>ze.obj(e)?t&&e[t]:e,q7=(e,t)=>e.default===!0?e[t]:e.default?e.default[t]:void 0,mye=e=>e,ax=(e,t=mye)=>{let n=pye;e.default&&e.default!==!0&&(e=e.default,n=Object.keys(e));const r={};for(const a of n){const s=t(e[a],a);ze.und(s)||(r[a]=s)}return r},pye=["config","onProps","onStart","onChange","onPause","onResume","onRest"],gye={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Eye(e){const t={};let n=0;if(Yi(e,(r,a)=>{gye[a]||(t[a]=r,n++)}),n)return t}function uM(e){const t=Eye(e);if(t){const n={to:t};return Yi(e,(r,a)=>a in t||(n[a]=r)),n}return q({},e)}function lg(e){return e=Za(e),ze.arr(e)?e.map(lg):ex(e)?Ei.createStringInterpolator({range:[0,1],output:[e,e]})(1):e}function Y7(e){for(const t in e)return!0;return!1}function OO(e){return ze.fun(e)||ze.arr(e)&&ze.obj(e[0])}function LO(e,t){var n;(n=e.ref)==null||n.delete(e),t==null||t.delete(e)}function W7(e,t){var n;t&&e.ref!==t&&((n=e.ref)==null||n.delete(e),t.add(e),e.ref=t)}var X7={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},MO=he(q({},X7.default),{mass:1,damping:1,easing:WTe.linear,clamp:!1}),Tye=class{constructor(){this.velocity=0,Object.assign(this,MO)}};function yye(e,t,n){n&&(n=q({},n),U3(n,t),t=q(q({},n),t)),U3(e,t),Object.assign(e,t);for(const i in MO)e[i]==null&&(e[i]=MO[i]);let{frequency:r,damping:a}=e;const{mass:s}=e;return ze.und(r)||(r<.01&&(r=.01),a<0&&(a=0),e.tension=Math.pow(2*Math.PI/r,2)*s,e.friction=4*Math.PI*a*s/r),e}function U3(e,t){if(!ze.und(t.decay))e.duration=void 0;else{const n=!ze.und(t.tension)||!ze.und(t.friction);(n||!ze.und(t.frequency)||!ze.und(t.damping)||!ze.und(t.mass))&&(e.duration=void 0,e.decay=void 0),n&&(e.frequency=void 0)}}var F3=[],xye=class{constructor(){this.changed=!1,this.values=F3,this.toValues=null,this.fromValues=F3,this.config=new Tye,this.immediate=!1}};function K7(e,{key:t,props:n,defaultProps:r,state:a,actions:s}){return new Promise((i,l)=>{var T;let c,u,h=Lp((T=n.cancel)!=null?T:r==null?void 0:r.cancel,t);if(h)g();else{ze.und(n.pause)||(a.paused=Lp(n.pause,t));let y=r==null?void 0:r.pause;y!==!0&&(y=a.paused||Lp(y,t)),c=es(n.delay||0,t),y?(a.resumeQueue.add(p),s.pause()):(s.resume(),p())}function m(){a.resumeQueue.add(p),a.timeouts.delete(u),u.cancel(),c=u.time-Xt.now()}function p(){c>0&&!Ei.skipAnimation?(a.delayed=!0,u=Xt.setTimeout(g,c),a.pauseQueue.add(m),a.timeouts.add(u)):g()}function g(){a.delayed&&(a.delayed=!1),a.pauseQueue.delete(m),a.timeouts.delete(u),e<=(a.cancelId||0)&&(h=!0);try{s.start(he(q({},n),{callId:e,cancel:h}),i)}catch(y){l(y)}}})}var dM=(e,t)=>t.length==1?t[0]:t.some(n=>n.cancelled)?gh(e.get()):t.every(n=>n.noop)?Q7(e.get()):ui(e.get(),t.every(n=>n.finished)),Q7=e=>({value:e,noop:!0,finished:!0,cancelled:!1}),ui=(e,t,n=!1)=>({value:e,finished:t,cancelled:n}),gh=e=>({value:e,cancelled:!0,finished:!1});function J7(e,t,n,r){const{callId:a,parentId:s,onRest:i}=t,{asyncTo:l,promise:c}=n;return!s&&e===l&&!t.reset?c:n.promise=H(null,null,function*(){n.asyncId=a,n.asyncTo=e;const u=ax(t,(b,x)=>x==="onRest"?void 0:b);let h,m;const p=new Promise((b,x)=>(h=b,m=x)),g=b=>{const x=a<=(n.cancelId||0)&&gh(r)||a!==n.asyncId&&ui(r,!1);if(x)throw b.result=x,m(b),b},T=(b,x)=>{const R=new $3,A=new B3;return H(null,null,function*(){if(Ei.skipAnimation)throw cg(n),A.result=ui(r,!1),m(A),A;g(R);const w=ze.obj(b)?q({},b):he(q({},x),{to:b});w.parentId=a,Yi(u,(N,I)=>{ze.und(w[I])&&(w[I]=N)});const _=yield r.start(w);return g(R),n.paused&&(yield new Promise(N=>{n.resumeQueue.add(N)})),_})};let y;if(Ei.skipAnimation)return cg(n),ui(r,!1);try{let b;ze.arr(e)?b=(x=>H(null,null,function*(){for(const R of x)yield T(R)}))(e):b=Promise.resolve(e(T,r.stop.bind(r))),yield Promise.all([b.then(h),p]),y=ui(r.get(),!0,!1)}catch(b){if(b instanceof $3)y=b.result;else if(b instanceof B3)y=b.result;else throw b}finally{a==n.asyncId&&(n.asyncId=s,n.asyncTo=s?l:void 0,n.promise=s?c:void 0)}return ze.fun(i)&&Xt.batchedUpdates(()=>{i(y,r,r.item)}),y})}function cg(e,t){Ip(e.timeouts,n=>n.cancel()),e.pauseQueue.clear(),e.resumeQueue.clear(),e.asyncId=e.asyncTo=e.promise=void 0,t&&(e.cancelId=t)}var $3=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},B3=class extends Error{constructor(){super("SkipAnimationSignal")}},DO=e=>e instanceof hM,Sye=1,hM=class extends k7{constructor(){super(...arguments),this.id=Sye++,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=Li(this);return e&&e.getValue()}to(...e){return Ei.to(this,e)}interpolate(...e){return nye(),Ei.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){sg(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||Q0.sort(this),sg(this,{type:"priority",parent:this,priority:e})}},pu=Symbol.for("SpringPhase"),Z7=1,e9=2,t9=4,FA=e=>(e[pu]&Z7)>0,Sl=e=>(e[pu]&e9)>0,Nm=e=>(e[pu]&t9)>0,H3=(e,t)=>t?e[pu]|=e9|Z7:e[pu]&=-3,V3=(e,t)=>t?e[pu]|=t9:e[pu]&=-5,bye=class extends hM{constructor(e,t){if(super(),this.animation=new xye,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!ze.und(e)||!ze.und(t)){const n=ze.obj(e)?q({},e):he(q({},t),{from:e});ze.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(Sl(this)||this._state.asyncTo)||Nm(this)}get goal(){return Za(this.animation.to)}get velocity(){const e=Li(this);return e instanceof nx?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return FA(this)}get isAnimating(){return Sl(this)}get isPaused(){return Nm(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1;const r=this.animation;let{toValues:a}=r;const{config:s}=r,i=tx(r.to);!i&&js(r.to)&&(a=Ga(Za(r.to))),r.values.forEach((u,h)=>{if(u.done)return;const m=u.constructor==Yy?1:i?i[h].lastPosition:a[h];let p=r.immediate,g=m;if(!p){if(g=u.lastPosition,s.tension<=0){u.done=!0;return}let T=u.elapsedTime+=e;const y=r.fromValues[h],b=u.v0!=null?u.v0:u.v0=ze.arr(s.velocity)?s.velocity[h]:s.velocity;let x;const R=s.precision||(y==m?.005:Math.min(1,Math.abs(m-y)*.001));if(ze.und(s.duration))if(s.decay){const A=s.decay===!0?.998:s.decay,w=Math.exp(-(1-A)*T);g=y+b/(1-A)*(1-w),p=Math.abs(u.lastPosition-g)<=R,x=b*w}else{x=u.lastVelocity==null?b:u.lastVelocity;const A=s.restVelocity||R/10,w=s.clamp?0:s.bounce,_=!ze.und(w),N=y==m?u.v0>0:y<m;let I,D=!1;const M=1,O=Math.ceil(e/M);for(let L=0;L<O&&(I=Math.abs(x)>A,!(!I&&(p=Math.abs(m-g)<=R,p)));++L){_&&(D=g==m||g>m==N,D&&(x=-x*w,g=m));const k=-s.tension*1e-6*(g-m),F=-s.friction*.001*x,U=(k+F)/s.mass;x=x+U*M,g=g+x*M}}else{let A=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,u.durationProgress>0&&(u.elapsedTime=s.duration*u.durationProgress,T=u.elapsedTime+=e)),A=(s.progress||0)+T/this._memoizedDuration,A=A>1?1:A<0?0:A,u.durationProgress=A),g=y+s.easing(A)*(m-y),x=(g-u.lastPosition)/e,p=A==1}u.lastVelocity=x,Number.isNaN(g)&&(p=!0)}i&&!i[h].done&&(p=!1),p?u.done=!0:t=!1,u.setValue(g,s.round)&&(n=!0)});const l=Li(this),c=l.getValue();if(t){const u=Za(r.to);(c!==u||n)&&!s.decay?(l.setValue(u),this._onChange(u)):n&&s.decay&&this._onChange(c),this._stop()}else n&&this._onChange(c)}set(e){return Xt.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(Sl(this)){const{to:e,config:t}=this.animation;Xt.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return ze.und(e)?(n=this.queue||[],this.queue=[]):n=[ze.obj(e)?e:he(q({},t),{to:e})],Promise.all(n.map(r=>this._update(r))).then(r=>dM(this,r))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),cg(this._state,e&&this._lastCallId),Xt.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:n,from:r}=e;n=ze.obj(n)?n[t]:n,(n==null||OO(n))&&(n=void 0),r=ze.obj(r)?r[t]:r,r==null&&(r=void 0);const a={to:n,from:r};return FA(this)||(e.reverse&&([n,r]=[r,n]),r=Za(r),ze.und(r)?Li(this)||this._set(n):this._set(r)),a}_update(n,t){var e=Tn(n,[]);const{key:r,defaultProps:a}=this;e.default&&Object.assign(a,ax(e,(l,c)=>/^on/.test(c)?z7(l,r):l)),z3(this,e,"onProps"),wm(this,"onProps",e,this);const s=this._prepareNode(e);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const i=this._state;return K7(++this._lastCallId,{key:r,props:e,defaultProps:a,state:i,actions:{pause:()=>{Nm(this)||(V3(this,!0),hp(i.pauseQueue),wm(this,"onPause",ui(this,_m(this,this.animation.to)),this))},resume:()=>{Nm(this)&&(V3(this,!1),Sl(this)&&this._resume(),hp(i.resumeQueue),wm(this,"onResume",ui(this,_m(this,this.animation.to)),this))},start:this._merge.bind(this,s)}}).then(l=>{if(e.loop&&l.finished&&!(t&&l.noop)){const c=n9(e);if(c)return this._update(c,!0)}return l})}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(gh(this));const r=!ze.und(e.to),a=!ze.und(e.from);if(r||a)if(t.callId>this._lastToId)this._lastToId=t.callId;else return n(gh(this));const{key:s,defaultProps:i,animation:l}=this,{to:c,from:u}=l;let{to:h=c,from:m=u}=e;a&&!r&&(!t.default||ze.und(h))&&(h=m),t.reverse&&([h,m]=[m,h]);const p=!Ro(m,u);p&&(l.from=m),m=Za(m);const g=!Ro(h,c);g&&this._focus(h);const T=OO(t.to),{config:y}=l,{decay:b,velocity:x}=y;(r||a)&&(y.velocity=0),t.config&&!T&&yye(y,es(t.config,s),t.config!==i.config?es(i.config,s):void 0);let R=Li(this);if(!R||ze.und(h))return n(ui(this,!0));const A=ze.und(t.reset)?a&&!t.default:!ze.und(m)&&Lp(t.reset,s),w=A?m:this.get(),_=lg(h),N=ze.num(_)||ze.arr(_)||ex(_),I=!T&&(!N||Lp(i.immediate||t.immediate,s));if(g){const L=IO(h);if(L!==R.constructor)if(I)R=this._set(_);else throw Error("Cannot animate between ".concat(R.constructor.name," and ").concat(L.name,', as the "to" prop suggests'))}const D=R.constructor;let M=js(h),O=!1;if(!M){const L=A||!FA(this)&&p;(g||L)&&(O=Ro(lg(w),_),M=!O),(!Ro(l.immediate,I)&&!I||!Ro(y.decay,b)||!Ro(y.velocity,x))&&(M=!0)}if(O&&Sl(this)&&(l.changed&&!A?M=!0:M||this._stop(c)),!T&&((M||js(c))&&(l.values=R.getPayload(),l.toValues=js(h)?null:D==Yy?[1]:Ga(_)),l.immediate!=I&&(l.immediate=I,!I&&!A&&this._set(c)),M)){const{onRest:L}=l;qt(Aye,F=>z3(this,t,F));const k=ui(this,_m(this,c));hp(this._pendingCalls,k),this._pendingCalls.add(n),l.changed&&Xt.batchedUpdates(()=>{var F;l.changed=!A,L==null||L(k,this),A?es(i.onRest,k):(F=l.onStart)==null||F.call(l,k,this)})}A&&this._set(w),T?n(J7(t.to,t,this._state,this)):M?this._start():Sl(this)&&!g?this._pendingCalls.add(n):n(Q7(w))}_focus(e){const t=this.animation;e!==t.to&&(M3(this)&&this._detach(),t.to=e,M3(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;js(t)&&(ef(t,this),DO(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;js(e)&&ig(e,this)}_set(e,t=!0){const n=Za(e);if(!ze.und(n)){const r=Li(this);if(!r||!Ro(n,r.getValue())){const a=IO(n);!r||r.constructor!=a?cM(this,a.create(n)):r.setValue(n),r&&Xt.batchedUpdates(()=>{this._onChange(n,t)})}}return Li(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,wm(this,"onStart",ui(this,_m(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),es(this.animation.onChange,e,this)),es(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;Li(this).reset(Za(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),Sl(this)||(H3(this,!0),Nm(this)||this._resume())}_resume(){Ei.skipAnimation?this.finish():Q0.start(this)}_stop(e,t){if(Sl(this)){H3(this,!1);const n=this.animation;qt(n.values,a=>{a.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),sg(this,{type:"idle",parent:this});const r=t?gh(this.get()):ui(this.get(),_m(this,e!=null?e:n.to));hp(this._pendingCalls,r),n.changed&&(n.changed=!1,wm(this,"onRest",r,this))}}};function _m(e,t){const n=lg(t),r=lg(e.get());return Ro(r,n)}function n9(e,t=e.loop,n=e.to){const r=es(t);if(r){const a=r!==!0&&uM(r),s=(a||e).reverse,i=!a||a.reset;return ug(q(he(q({},e),{loop:t,default:!1,pause:void 0,to:!s||OO(n)?n:void 0,from:i?e.from:void 0,reset:i}),a))}}function ug(e){const{to:t,from:n}=e=uM(e),r=new Set;return ze.obj(t)&&G3(t,r),ze.obj(n)&&G3(n,r),e.keys=r.size?Array.from(r):null,e}function vye(e){const t=ug(e);return ze.und(t.default)&&(t.default=ax(t)),t}function G3(e,t){Yi(e,(n,r)=>n!=null&&t.add(r))}var Aye=["onStart","onRest","onChange","onPause","onResume"];function z3(e,t,n){e.animation[n]=t[n]!==q7(t,n)?z7(t[n],e.key):void 0}function wm(e,t,...n){var r,a,s,i;(a=(r=e.animation)[t])==null||a.call(r,...n),(i=(s=e.defaultProps)[t])==null||i.call(s,...n)}var Rye=["onStart","onChange","onRest"],Nye=1,r9=class{constructor(e,t){this.id=Nye++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(q({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(const t in e){const n=e[t];ze.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(ug(e)),this}start(e){let{queue:t}=this;return e?t=Ga(e).map(ug):this.queue=[],this._flush?this._flush(this,t):(l9(this,t),PO(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;qt(Ga(t),r=>n[r].stop(!!e))}else cg(this._state,this._lastAsyncId),this.each(n=>n.stop(!!e));return this}pause(e){if(ze.und(e))this.start({pause:!0});else{const t=this.springs;qt(Ga(e),n=>t[n].pause())}return this}resume(e){if(ze.und(e))this.start({pause:!1});else{const t=this.springs;qt(Ga(e),n=>t[n].resume())}return this}each(e){Yi(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,r=this._active.size>0,a=this._changed.size>0;(r&&!this._started||a&&!this._started)&&(this._started=!0,Ip(e,([l,c])=>{c.value=this.get(),l(c,this,this._item)}));const s=!r&&this._started,i=a||s&&n.size?this.get():null;a&&t.size&&Ip(t,([l,c])=>{c.value=i,l(c,this,this._item)}),s&&(this._started=!1,Ip(n,([l,c])=>{c.value=i,l(c,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;Xt.onFrame(this._onFrame)}};function PO(e,t){return Promise.all(t.map(n=>a9(e,n))).then(n=>dM(e,n))}function a9(e,t,n){return H(this,null,function*(){const{keys:r,to:a,from:s,loop:i,onRest:l,onResolve:c}=t,u=ze.obj(t.default)&&t.default;i&&(t.loop=!1),a===!1&&(t.to=null),s===!1&&(t.from=null);const h=ze.arr(a)||ze.fun(a)?a:void 0;h?(t.to=void 0,t.onRest=void 0,u&&(u.onRest=void 0)):qt(Rye,y=>{const b=t[y];if(ze.fun(b)){const x=e._events[y];t[y]=({finished:R,cancelled:A})=>{const w=x.get(b);w?(R||(w.finished=!1),A&&(w.cancelled=!0)):x.set(b,{value:null,finished:R||!1,cancelled:A||!1})},u&&(u[y]=t[y])}});const m=e._state;t.pause===!m.paused?(m.paused=t.pause,hp(t.pause?m.pauseQueue:m.resumeQueue)):m.paused&&(t.pause=!0);const p=(r||Object.keys(e.springs)).map(y=>e.springs[y].start(t)),g=t.cancel===!0||q7(t,"cancel")===!0;(h||g&&m.asyncId)&&p.push(K7(++e._lastAsyncId,{props:t,state:m,actions:{pause:_O,resume:_O,start(y,b){g?(cg(m,e._lastAsyncId),b(gh(e))):(y.onRest=l,b(J7(h,y,m,e)))}}})),m.paused&&(yield new Promise(y=>{m.resumeQueue.add(y)}));const T=dM(e,yield Promise.all(p));if(i&&T.finished&&!(n&&T.noop)){const y=n9(t,i,a);if(y)return l9(e,[y]),a9(e,y,!0)}return c&&Xt.batchedUpdates(()=>c(T,e,e.item)),T})}function kO(e,t){const n=q({},e.springs);return t&&qt(Ga(t),r=>{ze.und(r.keys)&&(r=ug(r)),ze.obj(r.to)||(r=he(q({},r),{to:void 0})),o9(n,r,a=>i9(a))}),s9(e,n),n}function s9(e,t){Yi(t,(n,r)=>{e.springs[r]||(e.springs[r]=n,ef(n,e))})}function i9(e,t){const n=new bye;return n.key=e,t&&ef(n,t),n}function o9(e,t,n){t.keys&&qt(t.keys,r=>{(e[r]||(e[r]=n(r)))._prepareNode(t)})}function l9(e,t){qt(t,n=>{o9(e.springs,n,r=>i9(r,e))})}var c9=v.createContext({pause:!1,immediate:!1}),u9=()=>{const e=[],t=function(r){aye();const a=[];return qt(e,(s,i)=>{if(ze.und(r))a.push(s.start());else{const l=n(r,s,i);l&&a.push(s.start(l))}}),a};t.current=e,t.add=function(r){e.includes(r)||e.push(r)},t.delete=function(r){const a=e.indexOf(r);~a&&e.splice(a,1)},t.pause=function(){return qt(e,r=>r.pause(...arguments)),this},t.resume=function(){return qt(e,r=>r.resume(...arguments)),this},t.set=function(r){qt(e,(a,s)=>{const i=ze.fun(r)?r(s,a):r;i&&a.set(i)})},t.start=function(r){const a=[];return qt(e,(s,i)=>{if(ze.und(r))a.push(s.start());else{const l=this._getProps(r,s,i);l&&a.push(s.start(l))}}),a},t.stop=function(){return qt(e,r=>r.stop(...arguments)),this},t.update=function(r){return qt(e,(a,s)=>a.update(this._getProps(r,a,s))),this};const n=function(r,a,s){return ze.fun(r)?r(s,a):r};return t._getProps=n,t};function _ye(e,t,n){const r=ze.fun(t)&&t;r&&!n&&(n=[]);const a=v.useMemo(()=>r||arguments.length==3?u9():void 0,[]),s=v.useRef(0),i=oM(),l=v.useMemo(()=>({ctrls:[],queue:[],flush(x,R){const A=kO(x,R);return s.current>0&&!l.queue.length&&!Object.keys(A).some(_=>!x.springs[_])?PO(x,R):new Promise(_=>{s9(x,A),l.queue.push(()=>{_(PO(x,R))}),i()})}}),[]),c=v.useRef([...l.ctrls]),u=v.useRef([]),h=CO(e)||0;v.useMemo(()=>{qt(c.current.slice(e,h),x=>{LO(x,a),x.stop(!0)}),c.current.length=e,m(h,e)},[e]),v.useMemo(()=>{m(0,Math.min(h,e))},n);function m(x,R){for(let A=x;A<R;A++){const w=c.current[A]||(c.current[A]=new r9(null,l.flush)),_=r?r(A,w):t[A];_&&(u.current[A]=vye(_))}}const p=c.current.map((x,R)=>kO(x,u.current[R])),g=v.useContext(c9),T=CO(g),y=g!==T&&Y7(g);Wc(()=>{s.current++,l.ctrls=c.current;const{queue:x}=l;x.length&&(l.queue=[],qt(x,R=>R())),qt(c.current,(R,A)=>{a==null||a.add(R),y&&R.start({default:g});const w=u.current[A];w&&(W7(R,w.ref),R.ref?R.queue.push(w):R.start(w))})}),lM(()=>()=>{qt(l.ctrls,x=>x.stop(!0))});const b=p.map(x=>q({},x));return a?[b,a]:b}function Ji(e,t){const n=ze.fun(e),[[r],a]=_ye(1,n?e:[e],n?[]:t);return n||arguments.length==2?[r,a]:r}function tc(e,t,n){const r=ze.fun(t)&&t,{reset:a,sort:s,trail:i=0,expires:l=!0,exitBeforeEnter:c=!1,onDestroyed:u,ref:h,config:m}=r?r():t,p=v.useMemo(()=>r||arguments.length==3?u9():void 0,[]),g=Ga(e),T=[],y=v.useRef(null),b=a?null:y.current;Wc(()=>{y.current=T}),lM(()=>(qt(T,U=>{p==null||p.add(U.ctrl),U.ctrl.ref=p}),()=>{qt(y.current,U=>{U.expired&&clearTimeout(U.expirationId),LO(U.ctrl,p),U.ctrl.stop(!0)})}));const x=Cye(g,r?r():t,b),R=a&&y.current||[];Wc(()=>qt(R,({ctrl:U,item:B,key:j})=>{LO(U,p),es(u,B,j)}));const A=[];if(b&&qt(b,(U,B)=>{U.expired?(clearTimeout(U.expirationId),R.push(U)):(B=A[B]=x.indexOf(U.key),~B&&(T[B]=U))}),qt(g,(U,B)=>{T[B]||(T[B]={key:x[B],item:U,phase:"mount",ctrl:new r9},T[B].ctrl.item=U)}),A.length){let U=-1;const{leave:B}=r?r():t;qt(A,(j,G)=>{const K=b[G];~j?(U=T.indexOf(K),T[U]=he(q({},K),{item:g[j]})):B&&T.splice(++U,0,K)})}ze.fun(s)&&T.sort((U,B)=>s(U.item,B.item));let w=-i;const _=oM(),N=ax(t),I=new Map,D=v.useRef(new Map),M=v.useRef(!1);qt(T,(U,B)=>{const j=U.key,G=U.phase,K=r?r():t;let J,$;const X=es(K.delay||0,j);if(G=="mount")J=K.enter,$="enter";else{const ae=x.indexOf(j)<0;if(G!="leave")if(ae)J=K.leave,$="leave";else if(J=K.update)$="update";else return;else if(!ae)J=K.enter,$="enter";else return}if(J=es(J,U.item,B),J=ze.obj(J)?uM(J):{to:J},!J.config){const ae=m||N.config;J.config=es(ae,U.item,B,$)}w+=i;const Z=q(he(q({},N),{delay:X+w,ref:h,immediate:K.immediate,reset:!1}),J);if($=="enter"&&ze.und(Z.from)){const ae=r?r():t,ne=ze.und(ae.initial)||b?ae.from:ae.initial;Z.from=es(ne,U.item,B)}const{onResolve:V}=Z;Z.onResolve=ae=>{es(V,ae);const ne=y.current,ce=ne.find(ie=>ie.key===j);if(ce&&!(ae.cancelled&&ce.phase!="update")&&ce.ctrl.idle){const ie=ne.every(W=>W.ctrl.idle);if(ce.phase=="leave"){const W=es(l,ce.item);if(W!==!1){const Q=W===!0?0:W;if(ce.expired=!0,!ie&&Q>0){Q<=2147483647&&(ce.expirationId=setTimeout(_,Q));return}}}ie&&ne.some(W=>W.expired)&&(D.current.delete(ce),c&&(M.current=!0),_())}};const te=kO(U.ctrl,Z);$==="leave"&&c?D.current.set(U,{phase:$,springs:te,payload:Z}):I.set(U,{phase:$,springs:te,payload:Z})});const O=v.useContext(c9),L=CO(O),k=O!==L&&Y7(O);Wc(()=>{k&&qt(T,U=>{U.ctrl.start({default:O})})},[O]),qt(I,(U,B)=>{if(D.current.size){const j=T.findIndex(G=>G.key===B.key);T.splice(j,1)}}),Wc(()=>{qt(D.current.size?D.current:I,({phase:U,payload:B},j)=>{const{ctrl:G}=j;j.phase=U,p==null||p.add(G),k&&U=="enter"&&G.start({default:O}),B&&(W7(G,B.ref),(G.ref||p)&&!M.current?G.update(B):(G.start(B),M.current&&(M.current=!1)))})},a?void 0:n);const F=U=>v.createElement(v.Fragment,null,T.map((B,j)=>{const{springs:G}=I.get(B)||B.ctrl,K=U(q({},G),B.item,B,j);return K&&K.type?v.createElement(K.type,he(q({},K.props),{key:ze.str(B.key)||ze.num(B.key)?B.key:B.ctrl.id,ref:K.ref})):K}));return p?[F,p]:F}var wye=1;function Cye(e,{key:t,keys:n=t},r){if(n===null){const a=new Set;return e.map(s=>{const i=r&&r.find(l=>l.item===s&&l.phase!=="leave"&&!a.has(l));return i?(a.add(i),i.key):wye++})}return ze.und(n)?e:ze.fun(n)?e.map(n):Ga(n)}var d9=class extends hM{constructor(e,t){super(),this.source=e,this.idle=!0,this._active=new Set,this.calc=rg(...t);const n=this._get(),r=IO(n);cM(this,r.create(n))}advance(e){const t=this._get(),n=this.get();Ro(t,n)||(Li(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&q3(this._active)&&$A(this)}_get(){const e=ze.arr(this.source)?this.source.map(Za):Ga(Za(this.source));return this.calc(...e)}_start(){this.idle&&!q3(this._active)&&(this.idle=!1,qt(tx(this),e=>{e.done=!1}),Ei.skipAnimation?(Xt.batchedUpdates(()=>this.advance()),$A(this)):Q0.start(this))}_attach(){let e=1;qt(Ga(this.source),t=>{js(t)&&ef(t,this),DO(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){qt(Ga(this.source),e=>{js(e)&&ig(e,this)}),this._active.clear(),$A(this)}eventObserved(e){e.type=="change"?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type=="idle"?this._active.delete(e.parent):e.type=="priority"&&(this.priority=Ga(this.source).reduce((t,n)=>Math.max(t,(DO(n)?n.priority:0)+1),0))}};function Iye(e){return e.idle!==!1}function q3(e){return!e.size||Array.from(e).every(Iye)}function $A(e){e.idle||(e.idle=!0,qt(tx(e),t=>{t.done=!0}),sg(e,{type:"idle",parent:e}))}var Gl=(e,...t)=>new d9(e,t);Ei.assign({createStringInterpolator:F7,to:(e,t)=>new d9(e,t)});var h9=/^--/;function Oye(e,t){return t==null||typeof t=="boolean"||t===""?"":typeof t=="number"&&t!==0&&!h9.test(e)&&!(Mp.hasOwnProperty(e)&&Mp[e])?t+"px":(""+t).trim()}var Y3={};function Lye(e,t){if(!e.nodeType||!e.setAttribute)return!1;const n=e.nodeName==="filter"||e.parentNode&&e.parentNode.nodeName==="filter",p=t,{className:r,style:a,children:s,scrollTop:i,scrollLeft:l,viewBox:c}=p,u=Tn(p,["className","style","children","scrollTop","scrollLeft","viewBox"]),h=Object.values(u),m=Object.keys(u).map(g=>n||e.hasAttribute(g)?g:Y3[g]||(Y3[g]=g.replace(/([A-Z])/g,T=>"-"+T.toLowerCase())));s!==void 0&&(e.textContent=s);for(const g in a)if(a.hasOwnProperty(g)){const T=Oye(g,a[g]);h9.test(g)?e.style.setProperty(g,T):e.style[g]=T}m.forEach((g,T)=>{e.setAttribute(g,h[T])}),r!==void 0&&(e.className=r),i!==void 0&&(e.scrollTop=i),l!==void 0&&(e.scrollLeft=l),c!==void 0&&e.setAttribute("viewBox",c)}var Mp={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Mye=(e,t)=>e+t.charAt(0).toUpperCase()+t.substring(1),Dye=["Webkit","Ms","Moz","O"];Mp=Object.keys(Mp).reduce((e,t)=>(Dye.forEach(n=>e[Mye(n,t)]=e[t]),e),Mp);var Pye=/^(matrix|translate|scale|rotate|skew)/,kye=/^(translate)/,jye=/^(rotate|skew)/,BA=(e,t)=>ze.num(e)&&e!==0?e+t:e,ly=(e,t)=>ze.arr(e)?e.every(n=>ly(n,t)):ze.num(e)?e===t:parseFloat(e)===t,Uye=class extends rx{constructor(a){var s=a,{x:e,y:t,z:n}=s,r=Tn(s,["x","y","z"]);const i=[],l=[];(e||t||n)&&(i.push([e||0,t||0,n||0]),l.push(c=>["translate3d(".concat(c.map(u=>BA(u,"px")).join(","),")"),ly(c,0)])),Yi(r,(c,u)=>{if(u==="transform")i.push([c||""]),l.push(h=>[h,h===""]);else if(Pye.test(u)){if(delete r[u],ze.und(c))return;const h=kye.test(u)?"px":jye.test(u)?"deg":"";i.push(Ga(c)),l.push(u==="rotate3d"?([m,p,g,T])=>["rotate3d(".concat(m,",").concat(p,",").concat(g,",").concat(BA(T,h),")"),ly(T,0)]:m=>["".concat(u,"(").concat(m.map(p=>BA(p,h)).join(","),")"),ly(m,u.startsWith("scale")?1:0)])}}),i.length&&(r.transform=new Fye(i,l)),super(r)}},Fye=class extends k7{constructor(e,t){super(),this.inputs=e,this.transforms=t,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let e="",t=!0;return qt(this.inputs,(n,r)=>{const a=Za(n[0]),[s,i]=this.transforms[r](ze.arr(a)?a:n.map(Za));e+=" "+s,t=t&&i}),t?"none":e}observerAdded(e){e==1&&qt(this.inputs,t=>qt(t,n=>js(n)&&ef(n,this)))}observerRemoved(e){e==0&&qt(this.inputs,t=>qt(t,n=>js(n)&&ig(n,this)))}eventObserved(e){e.type=="change"&&(this._value=null),sg(this,e)}},$ye=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];Ei.assign({batchedUpdates:Gh.unstable_batchedUpdates,createStringInterpolator:F7,colors:kTe});var Bye=fye($ye,{applyAnimatedValues:Lye,createAnimatedStyle:e=>new Uye(e),getComponentProps:r=>{var a=r,{scrollTop:e,scrollLeft:t}=a,n=Tn(a,["scrollTop","scrollLeft"]);return n}}),Vn=Bye.animated,HA,W3;function Hye(){if(W3)return HA;W3=1;function e(){this.__data__=[],this.size=0}return HA=e,HA}var VA,X3;function jg(){if(X3)return VA;X3=1;function e(t,n){return t===n||t!==t&&n!==n}return VA=e,VA}var GA,K3;function sx(){if(K3)return GA;K3=1;var e=jg();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return GA=t,GA}var zA,Q3;function Vye(){if(Q3)return zA;Q3=1;var e=sx(),t=Array.prototype,n=t.splice;function r(a){var s=this.__data__,i=e(s,a);if(i<0)return!1;var l=s.length-1;return i==l?s.pop():n.call(s,i,1),--this.size,!0}return zA=r,zA}var qA,J3;function Gye(){if(J3)return qA;J3=1;var e=sx();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return qA=t,qA}var YA,Z3;function zye(){if(Z3)return YA;Z3=1;var e=sx();function t(n){return e(this.__data__,n)>-1}return YA=t,YA}var WA,e4;function qye(){if(e4)return WA;e4=1;var e=sx();function t(n,r){var a=this.__data__,s=e(a,n);return s<0?(++this.size,a.push([n,r])):a[s][1]=r,this}return WA=t,WA}var XA,t4;function ix(){if(t4)return XA;t4=1;var e=Hye(),t=Vye(),n=Gye(),r=zye(),a=qye();function s(i){var l=-1,c=i==null?0:i.length;for(this.clear();++l<c;){var u=i[l];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=n,s.prototype.has=r,s.prototype.set=a,XA=s,XA}var KA,n4;function Yye(){if(n4)return KA;n4=1;var e=ix();function t(){this.__data__=new e,this.size=0}return KA=t,KA}var QA,r4;function Wye(){if(r4)return QA;r4=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return QA=e,QA}var JA,a4;function Xye(){if(a4)return JA;a4=1;function e(t){return this.__data__.get(t)}return JA=e,JA}var ZA,s4;function Kye(){if(s4)return ZA;s4=1;function e(t){return this.__data__.has(t)}return ZA=e,ZA}var eR,i4;function f9(){if(i4)return eR;i4=1;var e=typeof oT=="object"&&oT&&oT.Object===Object&&oT;return eR=e,eR}var tR,o4;function Zi(){if(o4)return tR;o4=1;var e=f9(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return tR=n,tR}var nR,l4;function tf(){if(l4)return nR;l4=1;var e=Zi(),t=e.Symbol;return nR=t,nR}var rR,c4;function Qye(){if(c4)return rR;c4=1;var e=tf(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function s(i){var l=n.call(i,a),c=i[a];try{i[a]=void 0;var u=!0}catch(m){}var h=r.call(i);return u&&(l?i[a]=c:delete i[a]),h}return rR=s,rR}var aR,u4;function Jye(){if(u4)return aR;u4=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return aR=n,aR}var sR,d4;function Bo(){if(d4)return sR;d4=1;var e=tf(),t=Qye(),n=Jye(),r="[object Null]",a="[object Undefined]",s=e?e.toStringTag:void 0;function i(l){return l==null?l===void 0?a:r:s&&s in Object(l)?t(l):n(l)}return sR=i,sR}var iR,h4;function eo(){if(h4)return iR;h4=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return iR=e,iR}var oR,f4;function ox(){if(f4)return oR;f4=1;var e=Bo(),t=eo(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",s="[object Proxy]";function i(l){if(!t(l))return!1;var c=e(l);return c==r||c==a||c==n||c==s}return oR=i,oR}var lR,m4;function Zye(){if(m4)return lR;m4=1;var e=Zi(),t=e["__core-js_shared__"];return lR=t,lR}var cR,p4;function e0e(){if(p4)return cR;p4=1;var e=Zye(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return cR=n,cR}var uR,g4;function m9(){if(g4)return uR;g4=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch(a){}try{return r+""}catch(a){}}return""}return uR=n,uR}var dR,E4;function t0e(){if(E4)return dR;E4=1;var e=ox(),t=e0e(),n=eo(),r=m9(),a=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,i=Function.prototype,l=Object.prototype,c=i.toString,u=l.hasOwnProperty,h=RegExp("^"+c.call(u).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function m(p){if(!n(p)||t(p))return!1;var g=e(p)?h:s;return g.test(r(p))}return dR=m,dR}var hR,T4;function n0e(){if(T4)return hR;T4=1;function e(t,n){return t==null?void 0:t[n]}return hR=e,hR}var fR,y4;function Lu(){if(y4)return fR;y4=1;var e=t0e(),t=n0e();function n(r,a){var s=t(r,a);return e(s)?s:void 0}return fR=n,fR}var mR,x4;function fM(){if(x4)return mR;x4=1;var e=Lu(),t=Zi(),n=e(t,"Map");return mR=n,mR}var pR,S4;function lx(){if(S4)return pR;S4=1;var e=Lu(),t=e(Object,"create");return pR=t,pR}var gR,b4;function r0e(){if(b4)return gR;b4=1;var e=lx();function t(){this.__data__=e?e(null):{},this.size=0}return gR=t,gR}var ER,v4;function a0e(){if(v4)return ER;v4=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return ER=e,ER}var TR,A4;function s0e(){if(A4)return TR;A4=1;var e=lx(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(s){var i=this.__data__;if(e){var l=i[s];return l===t?void 0:l}return r.call(i,s)?i[s]:void 0}return TR=a,TR}var yR,R4;function i0e(){if(R4)return yR;R4=1;var e=lx(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var s=this.__data__;return e?s[a]!==void 0:n.call(s,a)}return yR=r,yR}var xR,N4;function o0e(){if(N4)return xR;N4=1;var e=lx(),t="__lodash_hash_undefined__";function n(r,a){var s=this.__data__;return this.size+=this.has(r)?0:1,s[r]=e&&a===void 0?t:a,this}return xR=n,xR}var SR,_4;function l0e(){if(_4)return SR;_4=1;var e=r0e(),t=a0e(),n=s0e(),r=i0e(),a=o0e();function s(i){var l=-1,c=i==null?0:i.length;for(this.clear();++l<c;){var u=i[l];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=n,s.prototype.has=r,s.prototype.set=a,SR=s,SR}var bR,w4;function c0e(){if(w4)return bR;w4=1;var e=l0e(),t=ix(),n=fM();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return bR=r,bR}var vR,C4;function u0e(){if(C4)return vR;C4=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return vR=e,vR}var AR,I4;function cx(){if(I4)return AR;I4=1;var e=u0e();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return AR=t,AR}var RR,O4;function d0e(){if(O4)return RR;O4=1;var e=cx();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return RR=t,RR}var NR,L4;function h0e(){if(L4)return NR;L4=1;var e=cx();function t(n){return e(this,n).get(n)}return NR=t,NR}var _R,M4;function f0e(){if(M4)return _R;M4=1;var e=cx();function t(n){return e(this,n).has(n)}return _R=t,_R}var wR,D4;function m0e(){if(D4)return wR;D4=1;var e=cx();function t(n,r){var a=e(this,n),s=a.size;return a.set(n,r),this.size+=a.size==s?0:1,this}return wR=t,wR}var CR,P4;function mM(){if(P4)return CR;P4=1;var e=c0e(),t=d0e(),n=h0e(),r=f0e(),a=m0e();function s(i){var l=-1,c=i==null?0:i.length;for(this.clear();++l<c;){var u=i[l];this.set(u[0],u[1])}}return s.prototype.clear=e,s.prototype.delete=t,s.prototype.get=n,s.prototype.has=r,s.prototype.set=a,CR=s,CR}var IR,k4;function p0e(){if(k4)return IR;k4=1;var e=ix(),t=fM(),n=mM(),r=200;function a(s,i){var l=this.__data__;if(l instanceof e){var c=l.__data__;if(!t||c.length<r-1)return c.push([s,i]),this.size=++l.size,this;l=this.__data__=new n(c)}return l.set(s,i),this.size=l.size,this}return IR=a,IR}var LR,j4;function ux(){if(j4)return LR;j4=1;var e=ix(),t=Yye(),n=Wye(),r=Xye(),a=Kye(),s=p0e();function i(l){var c=this.__data__=new e(l);this.size=c.size}return i.prototype.clear=t,i.prototype.delete=n,i.prototype.get=r,i.prototype.has=a,i.prototype.set=s,LR=i,LR}var MR,U4;function p9(){if(U4)return MR;U4=1;var e=Lu(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(r){}}();return MR=t,MR}var DR,F4;function pM(){if(F4)return DR;F4=1;var e=p9();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return DR=t,DR}var PR,$4;function g9(){if($4)return PR;$4=1;var e=pM(),t=jg();function n(r,a,s){(s!==void 0&&!t(r[a],s)||s===void 0&&!(a in r))&&e(r,a,s)}return PR=n,PR}var kR,B4;function g0e(){if(B4)return kR;B4=1;function e(t){return function(n,r,a){for(var s=-1,i=Object(n),l=a(n),c=l.length;c--;){var u=l[t?c:++s];if(r(i[u],u,i)===!1)break}return n}}return kR=e,kR}var jR,H4;function E9(){if(H4)return jR;H4=1;var e=g0e(),t=e();return jR=t,jR}var fp={exports:{}};fp.exports;var V4;function T9(){return V4||(V4=1,function(e,t){var n=Zi(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===r,i=s?n.Buffer:void 0,l=i?i.allocUnsafe:void 0;function c(u,h){if(h)return u.slice();var m=u.length,p=l?l(m):new u.constructor(m);return u.copy(p),p}e.exports=c}(fp,fp.exports)),fp.exports}var UR,G4;function y9(){if(G4)return UR;G4=1;var e=Zi(),t=e.Uint8Array;return UR=t,UR}var FR,z4;function gM(){if(z4)return FR;z4=1;var e=y9();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return FR=t,FR}var $R,q4;function x9(){if(q4)return $R;q4=1;var e=gM();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return $R=t,$R}var BR,Y4;function S9(){if(Y4)return BR;Y4=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return BR=e,BR}var HR,W4;function E0e(){if(W4)return HR;W4=1;var e=eo(),t=Object.create,n=function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var s=new r;return r.prototype=void 0,s}}();return HR=n,HR}var VR,X4;function b9(){if(X4)return VR;X4=1;function e(t,n){return function(r){return t(n(r))}}return VR=e,VR}var GR,K4;function EM(){if(K4)return GR;K4=1;var e=b9(),t=e(Object.getPrototypeOf,Object);return GR=t,GR}var zR,Q4;function TM(){if(Q4)return zR;Q4=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return zR=t,zR}var qR,J4;function v9(){if(J4)return qR;J4=1;var e=E0e(),t=EM(),n=TM();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return qR=r,qR}var YR,Z4;function Js(){if(Z4)return YR;Z4=1;function e(t){return t!=null&&typeof t=="object"}return YR=e,YR}var WR,e$;function T0e(){if(e$)return WR;e$=1;var e=Bo(),t=Js(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return WR=r,WR}var XR,t$;function dx(){if(t$)return XR;t$=1;var e=T0e(),t=Js(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,s=e(function(){return arguments}())?e:function(i){return t(i)&&r.call(i,"callee")&&!a.call(i,"callee")};return XR=s,XR}var KR,n$;function za(){if(n$)return KR;n$=1;var e=Array.isArray;return KR=e,KR}var QR,r$;function yM(){if(r$)return QR;r$=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return QR=t,QR}var JR,a$;function nf(){if(a$)return JR;a$=1;var e=ox(),t=yM();function n(r){return r!=null&&t(r.length)&&!e(r)}return JR=n,JR}var ZR,s$;function A9(){if(s$)return ZR;s$=1;var e=nf(),t=Js();function n(r){return t(r)&&e(r)}return ZR=n,ZR}var mp={exports:{}},eN,i$;function y0e(){if(i$)return eN;i$=1;function e(){return!1}return eN=e,eN}mp.exports;var o$;function hx(){return o$||(o$=1,function(e,t){var n=Zi(),r=y0e(),a=t&&!t.nodeType&&t,s=a&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===a,l=i?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;e.exports=u}(mp,mp.exports)),mp.exports}var tN,l$;function xM(){if(l$)return tN;l$=1;var e=Bo(),t=EM(),n=Js(),r="[object Object]",a=Function.prototype,s=Object.prototype,i=a.toString,l=s.hasOwnProperty,c=i.call(Object);function u(h){if(!n(h)||e(h)!=r)return!1;var m=t(h);if(m===null)return!0;var p=l.call(m,"constructor")&&m.constructor;return typeof p=="function"&&p instanceof p&&i.call(p)==c}return tN=u,tN}var nN,c$;function x0e(){if(c$)return nN;c$=1;var e=Bo(),t=yM(),n=Js(),r="[object Arguments]",a="[object Array]",s="[object Boolean]",i="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",h="[object Number]",m="[object Object]",p="[object RegExp]",g="[object Set]",T="[object String]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",R="[object Float32Array]",A="[object Float64Array]",w="[object Int8Array]",_="[object Int16Array]",N="[object Int32Array]",I="[object Uint8Array]",D="[object Uint8ClampedArray]",M="[object Uint16Array]",O="[object Uint32Array]",L={};L[R]=L[A]=L[w]=L[_]=L[N]=L[I]=L[D]=L[M]=L[O]=!0,L[r]=L[a]=L[b]=L[s]=L[x]=L[i]=L[l]=L[c]=L[u]=L[h]=L[m]=L[p]=L[g]=L[T]=L[y]=!1;function k(F){return n(F)&&t(F.length)&&!!L[e(F)]}return nN=k,nN}var rN,u$;function rf(){if(u$)return rN;u$=1;function e(t){return function(n){return t(n)}}return rN=e,rN}var pp={exports:{}};pp.exports;var d$;function fx(){return d$||(d$=1,function(e,t){var n=f9(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===r,i=s&&n.process,l=function(){try{var c=a&&a.require&&a.require("util").types;return c||i&&i.binding&&i.binding("util")}catch(u){}}();e.exports=l}(pp,pp.exports)),pp.exports}var aN,h$;function SM(){if(h$)return aN;h$=1;var e=x0e(),t=rf(),n=fx(),r=n&&n.isTypedArray,a=r?t(r):e;return aN=a,aN}var sN,f$;function R9(){if(f$)return sN;f$=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return sN=e,sN}var iN,m$;function bM(){if(m$)return iN;m$=1;var e=pM(),t=jg(),n=Object.prototype,r=n.hasOwnProperty;function a(s,i,l){var c=s[i];(!(r.call(s,i)&&t(c,l))||l===void 0&&!(i in s))&&e(s,i,l)}return iN=a,iN}var oN,p$;function af(){if(p$)return oN;p$=1;var e=bM(),t=pM();function n(r,a,s,i){var l=!s;s||(s={});for(var c=-1,u=a.length;++c<u;){var h=a[c],m=i?i(s[h],r[h],h,s,r):void 0;m===void 0&&(m=r[h]),l?t(s,h,m):e(s,h,m)}return s}return oN=n,oN}var lN,g$;function S0e(){if(g$)return lN;g$=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return lN=e,lN}var cN,E$;function mx(){if(E$)return cN;E$=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var s=typeof r;return a=a==null?e:a,!!a&&(s=="number"||s!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return cN=n,cN}var uN,T$;function N9(){if(T$)return uN;T$=1;var e=S0e(),t=dx(),n=za(),r=hx(),a=mx(),s=SM(),i=Object.prototype,l=i.hasOwnProperty;function c(u,h){var m=n(u),p=!m&&t(u),g=!m&&!p&&r(u),T=!m&&!p&&!g&&s(u),y=m||p||g||T,b=y?e(u.length,String):[],x=b.length;for(var R in u)(h||l.call(u,R))&&!(y&&(R=="length"||g&&(R=="offset"||R=="parent")||T&&(R=="buffer"||R=="byteLength"||R=="byteOffset")||a(R,x)))&&b.push(R);return b}return uN=c,uN}var dN,y$;function b0e(){if(y$)return dN;y$=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return dN=e,dN}var hN,x$;function v0e(){if(x$)return hN;x$=1;var e=eo(),t=TM(),n=b0e(),r=Object.prototype,a=r.hasOwnProperty;function s(i){if(!e(i))return n(i);var l=t(i),c=[];for(var u in i)u=="constructor"&&(l||!a.call(i,u))||c.push(u);return c}return hN=s,hN}var fN,S$;function Ug(){if(S$)return fN;S$=1;var e=N9(),t=v0e(),n=nf();function r(a){return n(a)?e(a,!0):t(a)}return fN=r,fN}var mN,b$;function A0e(){if(b$)return mN;b$=1;var e=af(),t=Ug();function n(r){return e(r,t(r))}return mN=n,mN}var pN,v$;function R0e(){if(v$)return pN;v$=1;var e=g9(),t=T9(),n=x9(),r=S9(),a=v9(),s=dx(),i=za(),l=A9(),c=hx(),u=ox(),h=eo(),m=xM(),p=SM(),g=R9(),T=A0e();function y(b,x,R,A,w,_,N){var I=g(b,R),D=g(x,R),M=N.get(D);if(M){e(b,R,M);return}var O=_?_(I,D,R+"",b,x,N):void 0,L=O===void 0;if(L){var k=i(D),F=!k&&c(D),U=!k&&!F&&p(D);O=D,k||F||U?i(I)?O=I:l(I)?O=r(I):F?(L=!1,O=t(D,!0)):U?(L=!1,O=n(D,!0)):O=[]:m(D)||s(D)?(O=I,s(I)?O=T(I):(!h(I)||u(I))&&(O=a(D))):L=!1}L&&(N.set(D,O),w(O,D,A,_,N),N.delete(D)),e(b,R,O)}return pN=y,pN}var gN,A$;function N0e(){if(A$)return gN;A$=1;var e=ux(),t=g9(),n=E9(),r=R0e(),a=eo(),s=Ug(),i=R9();function l(c,u,h,m,p){c!==u&&n(u,function(g,T){if(p||(p=new e),a(g))r(c,u,T,h,l,m,p);else{var y=m?m(i(c,T),g,T+"",c,u,p):void 0;y===void 0&&(y=g),t(c,T,y)}},s)}return gN=l,gN}var EN,R$;function px(){if(R$)return EN;R$=1;function e(t){return t}return EN=e,EN}var TN,N$;function _0e(){if(N$)return TN;N$=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return TN=e,TN}var yN,_$;function _9(){if(_$)return yN;_$=1;var e=_0e(),t=Math.max;function n(r,a,s){return a=t(a===void 0?r.length-1:a,0),function(){for(var i=arguments,l=-1,c=t(i.length-a,0),u=Array(c);++l<c;)u[l]=i[a+l];l=-1;for(var h=Array(a+1);++l<a;)h[l]=i[l];return h[a]=s(u),e(r,this,h)}}return yN=n,yN}var xN,w$;function w0e(){if(w$)return xN;w$=1;function e(t){return function(){return t}}return xN=e,xN}var SN,C$;function C0e(){if(C$)return SN;C$=1;var e=w0e(),t=p9(),n=px(),r=t?function(a,s){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(s),writable:!0})}:n;return SN=r,SN}var bN,I$;function I0e(){if(I$)return bN;I$=1;var e=800,t=16,n=Date.now;function r(a){var s=0,i=0;return function(){var l=n(),c=t-(l-i);if(i=l,c>0){if(++s>=e)return arguments[0]}else s=0;return a.apply(void 0,arguments)}}return bN=r,bN}var vN,O$;function w9(){if(O$)return vN;O$=1;var e=C0e(),t=I0e(),n=t(e);return vN=n,vN}var AN,L$;function vM(){if(L$)return AN;L$=1;var e=px(),t=_9(),n=w9();function r(a,s){return n(t(a,s,e),a+"")}return AN=r,AN}var RN,M$;function C9(){if(M$)return RN;M$=1;var e=jg(),t=nf(),n=mx(),r=eo();function a(s,i,l){if(!r(l))return!1;var c=typeof i;return(c=="number"?t(l)&&n(i,l.length):c=="string"&&i in l)?e(l[i],s):!1}return RN=a,RN}var NN,D$;function O0e(){if(D$)return NN;D$=1;var e=vM(),t=C9();function n(r){return e(function(a,s){var i=-1,l=s.length,c=l>1?s[l-1]:void 0,u=l>2?s[2]:void 0;for(c=r.length>3&&typeof c=="function"?(l--,c):void 0,u&&t(s[0],s[1],u)&&(c=l<3?void 0:c,l=1),a=Object(a);++i<l;){var h=s[i];h&&r(a,h,i,c)}return a})}return NN=n,NN}var _N,P$;function L0e(){if(P$)return _N;P$=1;var e=N0e(),t=O0e(),n=t(function(r,a,s){e(r,a,s)});return _N=n,_N}var M0e=L0e();const I9=ir(M0e);var wN,k$;function gx(){if(k$)return wN;k$=1;var e=Bo(),t=Js(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return wN=r,wN}var CN,j$;function AM(){if(j$)return CN;j$=1;var e=za(),t=gx(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(s,i){if(e(s))return!1;var l=typeof s;return l=="number"||l=="symbol"||l=="boolean"||s==null||t(s)?!0:r.test(s)||!n.test(s)||i!=null&&s in Object(i)}return CN=a,CN}var IN,U$;function D0e(){if(U$)return IN;U$=1;var e=mM(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var s=function(){var i=arguments,l=a?a.apply(this,i):i[0],c=s.cache;if(c.has(l))return c.get(l);var u=r.apply(this,i);return s.cache=c.set(l,u)||c,u};return s.cache=new(n.Cache||e),s}return n.Cache=e,IN=n,IN}var ON,F$;function P0e(){if(F$)return ON;F$=1;var e=D0e(),t=500;function n(r){var a=e(r,function(i){return s.size===t&&s.clear(),i}),s=a.cache;return a}return ON=n,ON}var LN,$$;function k0e(){if($$)return LN;$$=1;var e=P0e(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var s=[];return a.charCodeAt(0)===46&&s.push(""),a.replace(t,function(i,l,c,u){s.push(c?u.replace(n,"$1"):l||i)}),s});return LN=r,LN}var MN,B$;function Ex(){if(B$)return MN;B$=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,s=Array(a);++r<a;)s[r]=n(t[r],r,t);return s}return MN=e,MN}var DN,H$;function j0e(){if(H$)return DN;H$=1;var e=tf(),t=Ex(),n=za(),r=gx(),a=e?e.prototype:void 0,s=a?a.toString:void 0;function i(l){if(typeof l=="string")return l;if(n(l))return t(l,i)+"";if(r(l))return s?s.call(l):"";var c=l+"";return c=="0"&&1/l==-1/0?"-0":c}return DN=i,DN}var PN,V$;function O9(){if(V$)return PN;V$=1;var e=j0e();function t(n){return n==null?"":e(n)}return PN=t,PN}var kN,G$;function sf(){if(G$)return kN;G$=1;var e=za(),t=AM(),n=k0e(),r=O9();function a(s,i){return e(s)?s:t(s,i)?[s]:n(r(s))}return kN=a,kN}var jN,z$;function of(){if(z$)return jN;z$=1;var e=gx();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return jN=t,jN}var UN,q$;function Fg(){if(q$)return UN;q$=1;var e=sf(),t=of();function n(r,a){a=e(a,r);for(var s=0,i=a.length;r!=null&&s<i;)r=r[t(a[s++])];return s&&s==i?r:void 0}return UN=n,UN}var FN,Y$;function L9(){if(Y$)return FN;Y$=1;var e=Fg();function t(n,r,a){var s=n==null?void 0:e(n,r);return s===void 0?a:s}return FN=t,FN}var U0e=L9();const Ti=ir(U0e);var $N,W$;function M9(){if(W$)return $N;W$=1;var e=bM(),t=sf(),n=mx(),r=eo(),a=of();function s(i,l,c,u){if(!r(i))return i;l=t(l,i);for(var h=-1,m=l.length,p=m-1,g=i;g!=null&&++h<m;){var T=a(l[h]),y=c;if(T==="__proto__"||T==="constructor"||T==="prototype")return i;if(h!=p){var b=g[T];y=u?u(b,T,g):void 0,y===void 0&&(y=r(b)?b:n(l[h+1])?[]:{})}e(g,T,y),g=g[T]}return i}return $N=s,$N}var BN,X$;function F0e(){if(X$)return BN;X$=1;var e=M9();function t(n,r,a){return n==null?n:e(n,r,a)}return BN=t,BN}var $0e=F0e();const gp=ir($0e);function jO(){return jO=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jO.apply(null,arguments)}function B0e(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var H0e=["outlineWidth","outlineColor","outlineOpacity"],V0e=function(e){return e.outlineWidth,e.outlineColor,e.outlineOpacity,B0e(e,H0e)},G0e=["axis.ticks.text","axis.legend.text","legends.title.text","legends.text","legends.ticks.text","legends.title.text","labels.text","dots.text","markers.text","annotations.text"],z0e=function(e,t){return jO({},t,e)},q0e=function(e,t){var n=I9({},e,t);return G0e.forEach(function(r){gp(n,r,z0e(Ti(n,r),n.text))}),n},D9=function(e,t){return t?I9({},e,t):e},Y0e={background:"transparent",text:{fontFamily:"sans-serif",fontSize:11,fill:"#333333",outlineWidth:0,outlineColor:"#ffffff",outlineOpacity:1},axis:{domain:{line:{stroke:"transparent",strokeWidth:1}},ticks:{line:{stroke:"#777777",strokeWidth:1},text:{}},legend:{text:{fontSize:12}}},grid:{line:{stroke:"#dddddd",strokeWidth:1}},legends:{hidden:{symbol:{fill:"#333333",opacity:.6},text:{fill:"#333333",opacity:.6}},text:{},ticks:{line:{stroke:"#777777",strokeWidth:1},text:{fontSize:10}},title:{text:{}}},labels:{text:{}},markers:{lineColor:"#000000",lineStrokeWidth:1,text:{}},dots:{text:{}},tooltip:{container:{background:"white",color:"inherit",fontSize:"inherit",borderRadius:"2px",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.25)",padding:"5px 9px"},basic:{whiteSpace:"pre",display:"flex",alignItems:"center"},chip:{marginRight:7},table:{},tableCell:{padding:"3px 5px"},tableCellValue:{fontWeight:"bold"}},crosshair:{line:{stroke:"#000000",strokeWidth:1,strokeOpacity:.75,strokeDasharray:"6 6"}},annotations:{text:{fontSize:13,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},link:{stroke:"#000000",strokeWidth:1,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},outline:{fill:"none",stroke:"#000000",strokeWidth:2,outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1},symbol:{fill:"#000000",outlineWidth:2,outlineColor:"#ffffff",outlineOpacity:1}}},W0e=function(e){return v.useMemo(function(){return q0e(Y0e,e)},[e])},X0e=function(e,t){return v.useMemo(function(){return D9(e,t)},[e,t])},P9=v.createContext(null),K0e={},Q0e=function(e){var t=e.theme,n=t===void 0?K0e:t,r=e.children,a=W0e(n);return o.jsx(P9.Provider,{value:a,children:r})},_n=function(){var e=v.useContext(P9);if(e===null)throw new Error("Unable to find the theme, did you forget to wrap your component with ThemeProvider?");return e};function gu(){return gu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gu.apply(null,arguments)}var J0e=["basic","chip","container","table","tableCell","tableCellValue"],Z0e={pointerEvents:"none",position:"absolute",zIndex:10,top:0,left:0},K$=function(e,t){return"translate("+e+"px, "+t+"px)"},k9=v.memo(function(e){var t,n=e.position,r=e.anchor,a=e.children,s=_n(),i=Pa(),l=i.animate,c=i.config,u=PNe(),h=u[0],m=u[1],p=v.useRef(!1),g=void 0,T=!1,y=m.width>0&&m.height>0,b=Math.round(n[0]),x=Math.round(n[1]);y&&(r==="top"?(b-=m.width/2,x-=m.height+14):r==="right"?(b+=14,x-=m.height/2):r==="bottom"?(b-=m.width/2,x+=14):r==="left"?(b-=m.width+14,x-=m.height/2):r==="center"&&(b-=m.width/2,x-=m.height/2),g={transform:K$(b,x)},p.current||(T=!0),p.current=[b,x]);var R=Ji({to:g,config:c,immediate:!l||T}),A=s.tooltip;A.basic,A.chip,A.container,A.table,A.tableCell,A.tableCellValue;var w=function(N,I){if(N==null)return{};var D={};for(var M in N)if({}.hasOwnProperty.call(N,M)){if(I.indexOf(M)!==-1)continue;D[M]=N[M]}return D}(A,J0e),_=gu({},Z0e,w,{transform:(t=R.transform)!=null?t:K$(b,x),opacity:R.transform?1:0});return o.jsx(Vn.div,{ref:h,style:_,children:a})});k9.displayName="TooltipWrapper";var j9=v.memo(function(e){var t=e.size,n=t===void 0?12:t,r=e.color,a=e.style;return o.jsx("span",{style:gu({display:"block",width:n,height:n,background:r},a===void 0?{}:a)})}),Tx=v.memo(function(e){var t,n=e.id,r=e.value,a=e.format,s=e.enableChip,i=s!==void 0&&s,l=e.color,c=e.renderContent,u=_n(),h=ql(a);if(typeof c=="function")t=c();else{var m=r;h!==void 0&&m!==void 0&&(m=h(m)),t=o.jsxs("div",{style:u.tooltip.basic,children:[i&&o.jsx(j9,{color:l,style:u.tooltip.chip}),m!==void 0?o.jsxs("span",{children:[n,": ",o.jsx("strong",{children:""+m})]}):n]})}return o.jsx("div",{style:u.tooltip.container,role:"tooltip",children:t})}),exe={width:"100%",borderCollapse:"collapse"},U9=v.memo(function(e){var t,n=e.title,r=e.rows,a=r===void 0?[]:r,s=e.renderContent,i=_n();return a.length?(t=typeof s=="function"?s():o.jsxs("div",{children:[n&&n,o.jsx("table",{style:gu({},exe,i.tooltip.table),children:o.jsx("tbody",{children:a.map(function(l,c){return o.jsx("tr",{children:l.map(function(u,h){return o.jsx("td",{style:i.tooltip.tableCell,children:u},h)})},c)})})})]}),o.jsx("div",{style:i.tooltip.container,children:t})):null});U9.displayName="TableTooltip";var UO=v.memo(function(e){var t=e.x0,n=e.x1,r=e.y0,a=e.y1,s=_n(),i=Pa(),l=i.animate,c=i.config,u=v.useMemo(function(){return gu({},s.crosshair.line,{pointerEvents:"none"})},[s.crosshair.line]),h=Ji({x1:t,x2:n,y1:r,y2:a,config:c,immediate:!l});return o.jsx(Vn.line,gu({},h,{fill:"none",style:u}))});UO.displayName="CrosshairLine";var FO=v.memo(function(e){var t,n,r=e.width,a=e.height,s=e.type,i=e.x,l=e.y;return s==="cross"?(t={x0:i,x1:i,y0:0,y1:a},n={x0:0,x1:r,y0:l,y1:l}):s==="top-left"?(t={x0:i,x1:i,y0:0,y1:l},n={x0:0,x1:i,y0:l,y1:l}):s==="top"?t={x0:i,x1:i,y0:0,y1:l}:s==="top-right"?(t={x0:i,x1:i,y0:0,y1:l},n={x0:i,x1:r,y0:l,y1:l}):s==="right"?n={x0:i,x1:r,y0:l,y1:l}:s==="bottom-right"?(t={x0:i,x1:i,y0:l,y1:a},n={x0:i,x1:r,y0:l,y1:l}):s==="bottom"?t={x0:i,x1:i,y0:l,y1:a}:s==="bottom-left"?(t={x0:i,x1:i,y0:l,y1:a},n={x0:0,x1:i,y0:l,y1:l}):s==="left"?n={x0:0,x1:i,y0:l,y1:l}:s==="x"?t={x0:i,x1:i,y0:0,y1:a}:s==="y"&&(n={x0:0,x1:r,y0:l,y1:l}),o.jsxs(o.Fragment,{children:[t&&o.jsx(UO,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1}),n&&o.jsx(UO,{x0:n.x0,x1:n.x1,y0:n.y0,y1:n.y1})]})});FO.displayName="Crosshair";var F9=v.createContext({showTooltipAt:function(){},showTooltipFromEvent:function(){},hideTooltip:function(){}}),$O={isVisible:!1,position:[null,null],content:null,anchor:null},$9=v.createContext($O),txe=function(e){var t=v.useState($O),n=t[0],r=t[1],a=v.useCallback(function(l,c,u){var h=c[0],m=c[1];u===void 0&&(u="top"),r({isVisible:!0,position:[h,m],anchor:u,content:l})},[r]),s=v.useCallback(function(l,c,u){u===void 0&&(u="top");var h=e.current.getBoundingClientRect(),m=e.current.offsetWidth,p=m===h.width?1:m/h.width,g="touches"in c?c.touches[0]:c,T=g.clientX,y=g.clientY,b=(T-h.left)*p,x=(y-h.top)*p;u!=="left"&&u!=="right"||(u=b<h.width/2?"right":"left"),r({isVisible:!0,position:[b,x],anchor:u,content:l})},[e,r]),i=v.useCallback(function(){r($O)},[r]);return{actions:v.useMemo(function(){return{showTooltipAt:a,showTooltipFromEvent:s,hideTooltip:i}},[a,s,i]),state:n}},Zs=function(){var e=v.useContext(F9);if(e===void 0)throw new Error("useTooltip must be used within a TooltipProvider");return e},nxe=function(){var e=v.useContext($9);if(e===void 0)throw new Error("useTooltipState must be used within a TooltipProvider");return e},rxe=function(e){return e.isVisible},axe=function(){var e=nxe();return rxe(e)?o.jsx(k9,{position:e.position,anchor:e.anchor,children:e.content}):null},sxe=function(e){var t=e.container,n=e.children,r=txe(t),a=r.actions,s=r.state;return o.jsx(F9.Provider,{value:a,children:o.jsx($9.Provider,{value:s,children:n})})},HN,Q$;function ixe(){if(Q$)return HN;Q$=1;var e=Bo(),t=za(),n=Js(),r="[object String]";function a(s){return typeof s=="string"||!t(s)&&n(s)&&e(s)==r}return HN=a,HN}var oxe=ixe();const B9=ir(oxe);function lxe(e,t,n,r){var a=this,s=v.useRef(null),i=v.useRef(0),l=v.useRef(0),c=v.useRef(null),u=v.useRef([]),h=v.useRef(),m=v.useRef(),p=v.useRef(e),g=v.useRef(!0);p.current=e;var T=typeof window!="undefined",y=!t&&t!==0&&T;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,x=!("trailing"in n)||!!n.trailing,R="maxWait"in n,A="debounceOnServer"in n&&!!n.debounceOnServer,w=R?Math.max(+n.maxWait||0,t):null;v.useEffect(function(){return g.current=!0,function(){g.current=!1}},[]);var _=v.useMemo(function(){var N=function(F){var U=u.current,B=h.current;return u.current=h.current=null,i.current=F,l.current=l.current||F,m.current=p.current.apply(B,U)},I=function(F,U){y&&cancelAnimationFrame(c.current),c.current=y?requestAnimationFrame(F):setTimeout(F,U)},D=function(F){if(!g.current)return!1;var U=F-s.current;return!s.current||U>=t||U<0||R&&F-i.current>=w},M=function(F){return c.current=null,x&&u.current?N(F):(u.current=h.current=null,m.current)},O=function F(){var U=Date.now();if(b&&l.current===i.current&&L(),D(U))return M(U);if(g.current){var B=t-(U-s.current),j=R?Math.min(B,w-(U-i.current)):B;I(F,j)}},L=function(){r&&r({})},k=function(){if(T||A){var F=Date.now(),U=D(F);if(u.current=[].slice.call(arguments),h.current=a,s.current=F,U){if(!c.current&&g.current)return i.current=s.current,I(O,t),b?N(s.current):m.current;if(R)return I(O,t),N(s.current)}return c.current||I(O,t),m.current}};return k.cancel=function(){c.current&&(y?cancelAnimationFrame(c.current):clearTimeout(c.current)),i.current=0,u.current=s.current=h.current=c.current=null},k.isPending=function(){return!!c.current},k.flush=function(){return c.current?M(Date.now()):m.current},k},[b,R,t,w,x,y,T,A,r]);return _}function cxe(e,t){return e===t}function uxe(e,t,n){var r=n&&n.equalityFn||cxe,a=v.useRef(e),s=v.useState({})[1],i=lxe(v.useCallback(function(c){a.current=c,s({})},[s]),t,n,s),l=v.useRef(e);return r(l.current,e)||(i(e),l.current=e),[a.current,i]}function yx(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function RM(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function lf(){}var Eu=.7,Lh=1/Eu,Eh="\\s*([+-]?\\d+)\\s*",dg="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Hi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",dxe=/^#([0-9a-f]{3,8})$/,hxe=new RegExp("^rgb\\(".concat(Eh,",").concat(Eh,",").concat(Eh,"\\)$")),fxe=new RegExp("^rgb\\(".concat(Hi,",").concat(Hi,",").concat(Hi,"\\)$")),mxe=new RegExp("^rgba\\(".concat(Eh,",").concat(Eh,",").concat(Eh,",").concat(dg,"\\)$")),pxe=new RegExp("^rgba\\(".concat(Hi,",").concat(Hi,",").concat(Hi,",").concat(dg,"\\)$")),gxe=new RegExp("^hsl\\(".concat(dg,",").concat(Hi,",").concat(Hi,"\\)$")),Exe=new RegExp("^hsla\\(".concat(dg,",").concat(Hi,",").concat(Hi,",").concat(dg,"\\)$")),J$={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};yx(lf,hg,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Z$,formatHex:Z$,formatHex8:Txe,formatHsl:yxe,formatRgb:eB,toString:eB});function Z$(){return this.rgb().formatHex()}function Txe(){return this.rgb().formatHex8()}function yxe(){return V9(this).formatHsl()}function eB(){return this.rgb().formatRgb()}function hg(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=dxe.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?tB(t):n===3?new Ca(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?LT(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?LT(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=hxe.exec(e))?new Ca(t[1],t[2],t[3],1):(t=fxe.exec(e))?new Ca(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=mxe.exec(e))?LT(t[1],t[2],t[3],t[4]):(t=pxe.exec(e))?LT(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=gxe.exec(e))?aB(t[1],t[2]/100,t[3]/100,1):(t=Exe.exec(e))?aB(t[1],t[2]/100,t[3]/100,t[4]):J$.hasOwnProperty(e)?tB(J$[e]):e==="transparent"?new Ca(NaN,NaN,NaN,0):null}function tB(e){return new Ca(e>>16&255,e>>8&255,e&255,1)}function LT(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ca(e,t,n,r)}function H9(e){return e instanceof lf||(e=hg(e)),e?(e=e.rgb(),new Ca(e.r,e.g,e.b,e.opacity)):new Ca}function Mh(e,t,n,r){return arguments.length===1?H9(e):new Ca(e,t,n,r==null?1:r)}function Ca(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}yx(Ca,Mh,RM(lf,{brighter(e){return e=e==null?Lh:Math.pow(Lh,e),new Ca(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Eu:Math.pow(Eu,e),new Ca(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ca(au(this.r),au(this.g),au(this.b),Xy(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:nB,formatHex:nB,formatHex8:xxe,formatRgb:rB,toString:rB}));function nB(){return"#".concat(Xc(this.r)).concat(Xc(this.g)).concat(Xc(this.b))}function xxe(){return"#".concat(Xc(this.r)).concat(Xc(this.g)).concat(Xc(this.b)).concat(Xc((isNaN(this.opacity)?1:this.opacity)*255))}function rB(){const e=Xy(this.opacity);return"".concat(e===1?"rgb(":"rgba(").concat(au(this.r),", ").concat(au(this.g),", ").concat(au(this.b)).concat(e===1?")":", ".concat(e,")"))}function Xy(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function au(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xc(e){return e=au(e),(e<16?"0":"")+e.toString(16)}function aB(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new di(e,t,n,r)}function V9(e){if(e instanceof di)return new di(e.h,e.s,e.l,e.opacity);if(e instanceof lf||(e=hg(e)),!e)return new di;if(e instanceof di)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),s=Math.max(t,n,r),i=NaN,l=s-a,c=(s+a)/2;return l?(t===s?i=(n-r)/l+(n<r)*6:n===s?i=(r-t)/l+2:i=(t-n)/l+4,l/=c<.5?s+a:2-s-a,i*=60):l=c>0&&c<1?0:i,new di(i,l,c,e.opacity)}function Sxe(e,t,n,r){return arguments.length===1?V9(e):new di(e,t,n,r==null?1:r)}function di(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}yx(di,Sxe,RM(lf,{brighter(e){return e=e==null?Lh:Math.pow(Lh,e),new di(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Eu:Math.pow(Eu,e),new di(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new Ca(VN(e>=240?e-240:e+120,a,r),VN(e,a,r),VN(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new di(sB(this.h),MT(this.s),MT(this.l),Xy(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=Xy(this.opacity);return"".concat(e===1?"hsl(":"hsla(").concat(sB(this.h),", ").concat(MT(this.s)*100,"%, ").concat(MT(this.l)*100,"%").concat(e===1?")":", ".concat(e,")"))}}));function sB(e){return e=(e||0)%360,e<0?e+360:e}function MT(e){return Math.max(0,Math.min(1,e||0))}function VN(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const bxe=Math.PI/180,vxe=180/Math.PI;var G9=-.14861,NM=1.78277,_M=-.29227,xx=-.90649,fg=1.97294,iB=fg*xx,oB=fg*NM,lB=NM*_M-xx*G9;function Axe(e){if(e instanceof su)return new su(e.h,e.s,e.l,e.opacity);e instanceof Ca||(e=H9(e));var t=e.r/255,n=e.g/255,r=e.b/255,a=(lB*r+iB*t-oB*n)/(lB+iB-oB),s=r-a,i=(fg*(n-a)-_M*s)/xx,l=Math.sqrt(i*i+s*s)/(fg*a*(1-a)),c=l?Math.atan2(i,s)*vxe-120:NaN;return new su(c<0?c+360:c,l,a,e.opacity)}function Wi(e,t,n,r){return arguments.length===1?Axe(e):new su(e,t,n,r==null?1:r)}function su(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}yx(su,Wi,RM(lf,{brighter(e){return e=e==null?Lh:Math.pow(Lh,e),new su(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Eu:Math.pow(Eu,e),new su(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*bxe,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),a=Math.sin(e);return new Ca(255*(t+n*(G9*r+NM*a)),255*(t+n*(_M*r+xx*a)),255*(t+n*(fg*r)),this.opacity)}}));function Rxe(e,t,n,r,a){var s=e*e,i=s*e;return((1-3*e+3*s-i)*t+(4-6*s+3*i)*n+(1+3*e+3*s-3*i)*r+i*a)/6}function Nxe(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),a=e[r],s=e[r+1],i=r>0?e[r-1]:2*a-s,l=r<t-1?e[r+2]:2*s-a;return Rxe((n-r/t)*t,i,a,s,l)}}const Sx=e=>()=>e;function z9(e,t){return function(n){return e+n*t}}function _xe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function wxe(e,t){var n=t-e;return n?z9(e,n>180||n<-180?n-360*Math.round(n/360):n):Sx(isNaN(e)?t:e)}function Cxe(e){return(e=+e)==1?Th:function(t,n){return n-t?_xe(t,n,e):Sx(isNaN(t)?n:t)}}function Th(e,t){var n=t-e;return n?z9(e,n):Sx(isNaN(e)?t:e)}const cB=function e(t){var n=Cxe(t);function r(a,s){var i=n((a=Mh(a)).r,(s=Mh(s)).r),l=n(a.g,s.g),c=n(a.b,s.b),u=Th(a.opacity,s.opacity);return function(h){return a.r=i(h),a.g=l(h),a.b=c(h),a.opacity=u(h),a+""}}return r.gamma=e,r}(1);function Ixe(e){return function(t){var n=t.length,r=new Array(n),a=new Array(n),s=new Array(n),i,l;for(i=0;i<n;++i)l=Mh(t[i]),r[i]=l.r||0,a[i]=l.g||0,s[i]=l.b||0;return r=e(r),a=e(a),s=e(s),l.opacity=1,function(c){return l.r=r(c),l.g=a(c),l.b=s(c),l+""}}}var Oxe=Ixe(Nxe);function Lxe(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(s){for(a=0;a<n;++a)r[a]=e[a]*(1-s)+t[a]*s;return r}}function Mxe(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Dxe(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=new Array(r),s=new Array(n),i;for(i=0;i<r;++i)a[i]=wM(e[i],t[i]);for(;i<n;++i)s[i]=t[i];return function(l){for(i=0;i<r;++i)s[i]=a[i](l);return s}}function Pxe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function mg(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function kxe(e,t){var n={},r={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=wM(e[a],t[a]):r[a]=t[a];return function(s){for(a in n)r[a]=n[a](s);return r}}var BO=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,GN=new RegExp(BO.source,"g");function jxe(e){return function(){return e}}function Uxe(e){return function(t){return e(t)+""}}function q9(e,t){var n=BO.lastIndex=GN.lastIndex=0,r,a,s,i=-1,l=[],c=[];for(e=e+"",t=t+"";(r=BO.exec(e))&&(a=GN.exec(t));)(s=a.index)>n&&(s=t.slice(n,s),l[i]?l[i]+=s:l[++i]=s),(r=r[0])===(a=a[0])?l[i]?l[i]+=a:l[++i]=a:(l[++i]=null,c.push({i,x:mg(r,a)})),n=GN.lastIndex;return n<t.length&&(s=t.slice(n),l[i]?l[i]+=s:l[++i]=s),l.length<2?c[0]?Uxe(c[0].x):jxe(t):(t=c.length,function(u){for(var h=0,m;h<t;++h)l[(m=c[h]).i]=m.x(u);return l.join("")})}function wM(e,t){var n=typeof t,r;return t==null||n==="boolean"?Sx(t):(n==="number"?mg:n==="string"?(r=hg(t))?(t=r,cB):q9:t instanceof hg?cB:t instanceof Date?Pxe:Mxe(t)?Lxe:Array.isArray(t)?Dxe:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?kxe:mg)(e,t)}function Y9(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function W9(e){return function t(n){n=+n;function r(a,s){var i=e((a=Wi(a)).h,(s=Wi(s)).h),l=Th(a.s,s.s),c=Th(a.l,s.l),u=Th(a.opacity,s.opacity);return function(h){return a.h=i(h),a.s=l(h),a.l=c(Math.pow(h,n)),a.opacity=u(h),a+""}}return r.gamma=t,r}(1)}W9(wxe);var CM=W9(Th),zN,uB;function Fxe(){if(uB)return zN;uB=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return zN=t,zN}var qN,dB;function $xe(){if(dB)return qN;dB=1;function e(t){return this.__data__.has(t)}return qN=e,qN}var YN,hB;function IM(){if(hB)return YN;hB=1;var e=mM(),t=Fxe(),n=$xe();function r(a){var s=-1,i=a==null?0:a.length;for(this.__data__=new e;++s<i;)this.add(a[s])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,YN=r,YN}var WN,fB;function Bxe(){if(fB)return WN;fB=1;function e(t,n,r,a){for(var s=t.length,i=r+(a?1:-1);a?i--:++i<s;)if(n(t[i],i,t))return i;return-1}return WN=e,WN}var XN,mB;function Hxe(){if(mB)return XN;mB=1;function e(t){return t!==t}return XN=e,XN}var KN,pB;function Vxe(){if(pB)return KN;pB=1;function e(t,n,r){for(var a=r-1,s=t.length;++a<s;)if(t[a]===n)return a;return-1}return KN=e,KN}var QN,gB;function Gxe(){if(gB)return QN;gB=1;var e=Bxe(),t=Hxe(),n=Vxe();function r(a,s,i){return s===s?n(a,s,i):e(a,t,i)}return QN=r,QN}var JN,EB;function X9(){if(EB)return JN;EB=1;var e=Gxe();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return JN=t,JN}var ZN,TB;function K9(){if(TB)return ZN;TB=1;function e(t,n,r){for(var a=-1,s=t==null?0:t.length;++a<s;)if(r(n,t[a]))return!0;return!1}return ZN=e,ZN}var e_,yB;function OM(){if(yB)return e_;yB=1;function e(t,n){return t.has(n)}return e_=e,e_}var t_,xB;function zxe(){if(xB)return t_;xB=1;var e=IM(),t=X9(),n=K9(),r=Ex(),a=rf(),s=OM(),i=200;function l(c,u,h,m){var p=-1,g=t,T=!0,y=c.length,b=[],x=u.length;if(!y)return b;h&&(u=r(u,a(h))),m?(g=n,T=!1):u.length>=i&&(g=s,T=!1,u=new e(u));e:for(;++p<y;){var R=c[p],A=h==null?R:h(R);if(R=m||R!==0?R:0,T&&A===A){for(var w=x;w--;)if(u[w]===A)continue e;b.push(R)}else g(u,A,m)||b.push(R)}return b}return t_=l,t_}var n_,SB;function qxe(){if(SB)return n_;SB=1;var e=zxe(),t=vM(),n=A9(),r=t(function(a,s){return n(a)?e(a,s):[]});return n_=r,n_}var Yxe=qxe();const Q9=ir(Yxe);function ln(e){return function(){return e}}const bB=Math.abs,xa=Math.atan2,Cc=Math.cos,Wxe=Math.max,r_=Math.min,Ci=Math.sin,rh=Math.sqrt,Aa=1e-12,pg=Math.PI,Ky=pg/2,cy=2*pg;function Xxe(e){return e>1?0:e<-1?pg:Math.acos(e)}function vB(e){return e>=1?Ky:e<=-1?-Ky:Math.asin(e)}const HO=Math.PI,VO=2*HO,Fc=1e-6,Kxe=VO-Fc;function J9(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Qxe(e){let t=Math.floor(e);if(!(t>=0))throw new Error("invalid digits: ".concat(e));if(t>15)return J9;const n=cm(10,t);return function(r){this._+=r[0];for(let a=1,s=r.length;a<s;++a)this._+=Math.round(arguments[a]*n)/n+r[a]}}var zz,qz,Yz,Wz,Xz,Kz,Qz,Jz,Zz,e8,t8,n8,r8,a8;let Jxe=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?J9:Qxe(t)}moveTo(t,n){this._append(zz||(zz=wn(["M",",",""])),this._x0=this._x1=+t,this._y0=this._y1=+n)}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append(qz||(qz=wn(["Z"]))))}lineTo(t,n){this._append(Yz||(Yz=wn(["L",",",""])),this._x1=+t,this._y1=+n)}quadraticCurveTo(t,n,r,a){this._append(Wz||(Wz=wn(["Q",",",",",",",""])),+t,+n,this._x1=+r,this._y1=+a)}bezierCurveTo(t,n,r,a,s,i){this._append(Xz||(Xz=wn(["C",",",",",",",",",",",""])),+t,+n,+r,+a,this._x1=+s,this._y1=+i)}arcTo(t,n,r,a,s){if(t=+t,n=+n,r=+r,a=+a,s=+s,s<0)throw new Error("negative radius: ".concat(s));let i=this._x1,l=this._y1,c=r-t,u=a-n,h=i-t,m=l-n,p=h*h+m*m;if(this._x1===null)this._append(Kz||(Kz=wn(["M",",",""])),this._x1=t,this._y1=n);else if(p>Fc)if(!(Math.abs(m*c-u*h)>Fc)||!s)this._append(Qz||(Qz=wn(["L",",",""])),this._x1=t,this._y1=n);else{let g=r-i,T=a-l,y=c*c+u*u,b=g*g+T*T,x=Math.sqrt(y),R=Math.sqrt(p),A=s*Math.tan((HO-Math.acos((y+p-b)/(2*x*R)))/2),w=A/R,_=A/x;Math.abs(w-1)>Fc&&this._append(Jz||(Jz=wn(["L",",",""])),t+w*h,n+w*m),this._append(Zz||(Zz=wn(["A",",",",0,0,",",",",",""])),s,s,+(m*g>h*T),this._x1=t+_*c,this._y1=n+_*u)}}arc(t,n,r,a,s,i){if(t=+t,n=+n,r=+r,i=!!i,r<0)throw new Error("negative radius: ".concat(r));let l=r*Math.cos(a),c=r*Math.sin(a),u=t+l,h=n+c,m=1^i,p=i?a-s:s-a;this._x1===null?this._append(e8||(e8=wn(["M",",",""])),u,h):(Math.abs(this._x1-u)>Fc||Math.abs(this._y1-h)>Fc)&&this._append(t8||(t8=wn(["L",",",""])),u,h),r&&(p<0&&(p=p%VO+VO),p>Kxe?this._append(n8||(n8=wn(["A",",",",0,1,",",",",","A",",",",0,1,",",",",",""])),r,r,m,t-l,n-c,r,r,m,this._x1=u,this._y1=h):p>Fc&&this._append(r8||(r8=wn(["A",",",",0,",",",",",",",""])),r,r,+(p>=HO),m,this._x1=t+r*Math.cos(s),this._y1=n+r*Math.sin(s)))}rect(t,n,r,a){this._append(a8||(a8=wn(["M",",","h","v","h","Z"])),this._x0=this._x1=+t,this._y0=this._y1=+n,r=+r,+a,-r)}toString(){return this._}};function LM(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError("invalid digits: ".concat(n));t=r}return e},()=>new Jxe(t)}function Zxe(e){return e.innerRadius}function eSe(e){return e.outerRadius}function tSe(e){return e.startAngle}function nSe(e){return e.endAngle}function rSe(e){return e&&e.padAngle}function aSe(e,t,n,r,a,s,i,l){var c=n-e,u=r-t,h=i-a,m=l-s,p=m*c-h*u;if(!(p*p<Aa))return p=(h*(t-s)-m*(e-a))/p,[e+p*c,t+p*u]}function DT(e,t,n,r,a,s,i){var l=e-n,c=t-r,u=(i?s:-s)/rh(l*l+c*c),h=u*c,m=-u*l,p=e+h,g=t+m,T=n+h,y=r+m,b=(p+T)/2,x=(g+y)/2,R=T-p,A=y-g,w=R*R+A*A,_=a-s,N=p*y-T*g,I=(A<0?-1:1)*rh(Wxe(0,_*_*w-N*N)),D=(N*A-R*I)/w,M=(-N*R-A*I)/w,O=(N*A+R*I)/w,L=(-N*R+A*I)/w,k=D-b,F=M-x,U=O-b,B=L-x;return k*k+F*F>U*U+B*B&&(D=O,M=L),{cx:D,cy:M,x01:-h,y01:-m,x11:D*(a/_-1),y11:M*(a/_-1)}}function sSe(){var e=Zxe,t=eSe,n=ln(0),r=null,a=tSe,s=nSe,i=rSe,l=null,c=LM(u);function u(){var h,m,p=+e.apply(this,arguments),g=+t.apply(this,arguments),T=a.apply(this,arguments)-Ky,y=s.apply(this,arguments)-Ky,b=bB(y-T),x=y>T;if(l||(l=h=c()),g<p&&(m=g,g=p,p=m),!(g>Aa))l.moveTo(0,0);else if(b>cy-Aa)l.moveTo(g*Cc(T),g*Ci(T)),l.arc(0,0,g,T,y,!x),p>Aa&&(l.moveTo(p*Cc(y),p*Ci(y)),l.arc(0,0,p,y,T,x));else{var R=T,A=y,w=T,_=y,N=b,I=b,D=i.apply(this,arguments)/2,M=D>Aa&&(r?+r.apply(this,arguments):rh(p*p+g*g)),O=r_(bB(g-p)/2,+n.apply(this,arguments)),L=O,k=O,F,U;if(M>Aa){var B=vB(M/p*Ci(D)),j=vB(M/g*Ci(D));(N-=B*2)>Aa?(B*=x?1:-1,w+=B,_-=B):(N=0,w=_=(T+y)/2),(I-=j*2)>Aa?(j*=x?1:-1,R+=j,A-=j):(I=0,R=A=(T+y)/2)}var G=g*Cc(R),K=g*Ci(R),J=p*Cc(_),$=p*Ci(_);if(O>Aa){var X=g*Cc(A),Z=g*Ci(A),V=p*Cc(w),te=p*Ci(w),ae;if(b<pg)if(ae=aSe(G,K,V,te,X,Z,J,$)){var ne=G-ae[0],ce=K-ae[1],ie=X-ae[0],W=Z-ae[1],Q=1/Ci(Xxe((ne*ie+ce*W)/(rh(ne*ne+ce*ce)*rh(ie*ie+W*W)))/2),se=rh(ae[0]*ae[0]+ae[1]*ae[1]);L=r_(O,(p-se)/(Q-1)),k=r_(O,(g-se)/(Q+1))}else L=k=0}I>Aa?k>Aa?(F=DT(V,te,G,K,g,k,x),U=DT(X,Z,J,$,g,k,x),l.moveTo(F.cx+F.x01,F.cy+F.y01),k<O?l.arc(F.cx,F.cy,k,xa(F.y01,F.x01),xa(U.y01,U.x01),!x):(l.arc(F.cx,F.cy,k,xa(F.y01,F.x01),xa(F.y11,F.x11),!x),l.arc(0,0,g,xa(F.cy+F.y11,F.cx+F.x11),xa(U.cy+U.y11,U.cx+U.x11),!x),l.arc(U.cx,U.cy,k,xa(U.y11,U.x11),xa(U.y01,U.x01),!x))):(l.moveTo(G,K),l.arc(0,0,g,R,A,!x)):l.moveTo(G,K),!(p>Aa)||!(N>Aa)?l.lineTo(J,$):L>Aa?(F=DT(J,$,X,Z,p,-L,x),U=DT(G,K,V,te,p,-L,x),l.lineTo(F.cx+F.x01,F.cy+F.y01),L<O?l.arc(F.cx,F.cy,L,xa(F.y01,F.x01),xa(U.y01,U.x01),!x):(l.arc(F.cx,F.cy,L,xa(F.y01,F.x01),xa(F.y11,F.x11),!x),l.arc(0,0,p,xa(F.cy+F.y11,F.cx+F.x11),xa(U.cy+U.y11,U.cx+U.x11),x),l.arc(U.cx,U.cy,L,xa(U.y11,U.x11),xa(U.y01,U.x01),!x))):l.arc(0,0,p,_,w,x)}if(l.closePath(),h)return l=null,h+""||null}return u.centroid=function(){var h=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,m=(+a.apply(this,arguments)+ +s.apply(this,arguments))/2-pg/2;return[Cc(m)*h,Ci(m)*h]},u.innerRadius=function(h){return arguments.length?(e=typeof h=="function"?h:ln(+h),u):e},u.outerRadius=function(h){return arguments.length?(t=typeof h=="function"?h:ln(+h),u):t},u.cornerRadius=function(h){return arguments.length?(n=typeof h=="function"?h:ln(+h),u):n},u.padRadius=function(h){return arguments.length?(r=h==null?null:typeof h=="function"?h:ln(+h),u):r},u.startAngle=function(h){return arguments.length?(a=typeof h=="function"?h:ln(+h),u):a},u.endAngle=function(h){return arguments.length?(s=typeof h=="function"?h:ln(+h),u):s},u.padAngle=function(h){return arguments.length?(i=typeof h=="function"?h:ln(+h),u):i},u.context=function(h){return arguments.length?(l=h==null?null:h,u):l},u}function bx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Z9(e){this._context=e}Z9.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 MM(e){return new Z9(e)}function eX(e){return e[0]}function tX(e){return e[1]}function DM(e,t){var n=ln(!0),r=null,a=MM,s=null,i=LM(l);e=typeof e=="function"?e:e===void 0?eX:ln(e),t=typeof t=="function"?t:t===void 0?tX:ln(t);function l(c){var u,h=(c=bx(c)).length,m,p=!1,g;for(r==null&&(s=a(g=i())),u=0;u<=h;++u)!(u<h&&n(m=c[u],u,c))===p&&((p=!p)?s.lineStart():s.lineEnd()),p&&s.point(+e(m,u,c),+t(m,u,c));if(g)return s=null,g+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:ln(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:ln(+c),l):t},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:ln(!!c),l):n},l.curve=function(c){return arguments.length?(a=c,r!=null&&(s=a(r)),l):a},l.context=function(c){return arguments.length?(c==null?r=s=null:s=a(r=c),l):r},l}function iSe(e,t,n){var r=null,a=ln(!0),s=null,i=MM,l=null,c=LM(u);e=typeof e=="function"?e:e===void 0?eX:ln(+e),t=typeof t=="function"?t:ln(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?tX:ln(+n);function u(m){var p,g,T,y=(m=bx(m)).length,b,x=!1,R,A=new Array(y),w=new Array(y);for(s==null&&(l=i(R=c())),p=0;p<=y;++p){if(!(p<y&&a(b=m[p],p,m))===x)if(x=!x)g=p,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),T=p-1;T>=g;--T)l.point(A[T],w[T]);l.lineEnd(),l.areaEnd()}x&&(A[p]=+e(b,p,m),w[p]=+t(b,p,m),l.point(r?+r(b,p,m):A[p],n?+n(b,p,m):w[p]))}if(R)return l=null,R+""||null}function h(){return DM().defined(a).curve(i).context(s)}return u.x=function(m){return arguments.length?(e=typeof m=="function"?m:ln(+m),r=null,u):e},u.x0=function(m){return arguments.length?(e=typeof m=="function"?m:ln(+m),u):e},u.x1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:ln(+m),u):r},u.y=function(m){return arguments.length?(t=typeof m=="function"?m:ln(+m),n=null,u):t},u.y0=function(m){return arguments.length?(t=typeof m=="function"?m:ln(+m),u):t},u.y1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:ln(+m),u):n},u.lineX0=u.lineY0=function(){return h().x(e).y(t)},u.lineY1=function(){return h().x(e).y(n)},u.lineX1=function(){return h().x(r).y(t)},u.defined=function(m){return arguments.length?(a=typeof m=="function"?m:ln(!!m),u):a},u.curve=function(m){return arguments.length?(i=m,s!=null&&(l=i(s)),u):i},u.context=function(m){return arguments.length?(m==null?s=l=null:l=i(s=m),u):s},u}function oSe(e,t){return t<e?-1:t>e?1:t>=e?0:NaN}function lSe(e){return e}function cSe(){var e=lSe,t=oSe,n=null,r=ln(0),a=ln(cy),s=ln(0);function i(l){var c,u=(l=bx(l)).length,h,m,p=0,g=new Array(u),T=new Array(u),y=+r.apply(this,arguments),b=Math.min(cy,Math.max(-cy,a.apply(this,arguments)-y)),x,R=Math.min(Math.abs(b)/u,s.apply(this,arguments)),A=R*(b<0?-1:1),w;for(c=0;c<u;++c)(w=T[g[c]=c]=+e(l[c],c,l))>0&&(p+=w);for(t!=null?g.sort(function(_,N){return t(T[_],T[N])}):n!=null&&g.sort(function(_,N){return n(l[_],l[N])}),c=0,m=p?(b-u*A)/p:0;c<u;++c,y=x)h=g[c],w=T[h],x=y+(w>0?w*m:0)+A,T[h]={data:l[h],index:c,value:w,startAngle:y,endAngle:x,padAngle:R};return T}return i.value=function(l){return arguments.length?(e=typeof l=="function"?l:ln(+l),i):e},i.sortValues=function(l){return arguments.length?(t=l,n=null,i):t},i.sort=function(l){return arguments.length?(n=l,t=null,i):n},i.startAngle=function(l){return arguments.length?(r=typeof l=="function"?l:ln(+l),i):r},i.endAngle=function(l){return arguments.length?(a=typeof l=="function"?l:ln(+l),i):a},i.padAngle=function(l){return arguments.length?(s=typeof l=="function"?l:ln(+l),i):s},i}function zl(){}function Qy(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function vx(e){this._context=e}vx.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:Qy(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:Qy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function uSe(e){return new vx(e)}function nX(e){this._context=e}nX.prototype={areaStart:zl,areaEnd:zl,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:Qy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function dSe(e){return new nX(e)}function rX(e){this._context=e}rX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Qy(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function hSe(e){return new rX(e)}function aX(e,t){this._basis=new vx(e),this._beta=t}aX.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],a=t[0],s=e[n]-r,i=t[n]-a,l=-1,c;++l<=n;)c=l/n,this._basis.point(this._beta*e[l]+(1-this._beta)*(r+c*s),this._beta*t[l]+(1-this._beta)*(a+c*i));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const fSe=function e(t){function n(r){return t===1?new vx(r):new aX(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function Jy(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function PM(e,t){this._context=e,this._k=(1-t)/6}PM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Jy(this,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,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Jy(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const mSe=function e(t){function n(r){return new PM(r,t)}return n.tension=function(r){return e(+r)},n}(0);function kM(e,t){this._context=e,this._k=(1-t)/6}kM.prototype={areaStart:zl,areaEnd:zl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Jy(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const pSe=function e(t){function n(r){return new kM(r,t)}return n.tension=function(r){return e(+r)},n}(0);function jM(e,t){this._context=e,this._k=(1-t)/6}jM.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=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,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Jy(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const gSe=function e(t){function n(r){return new jM(r,t)}return n.tension=function(r){return e(+r)},n}(0);function UM(e,t,n){var r=e._x1,a=e._y1,s=e._x2,i=e._y2;if(e._l01_a>Aa){var l=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*l-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,a=(a*l-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>Aa){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,h=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*u+e._x1*e._l23_2a-t*e._l12_2a)/h,i=(i*u+e._y1*e._l23_2a-n*e._l12_2a)/h}e._context.bezierCurveTo(r,a,s,i,e._x2,e._y2)}function sX(e,t){this._context=e,this._alpha=t}sX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}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;default:UM(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const ESe=function e(t){function n(r){return t?new sX(r,t):new PM(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function iX(e,t){this._context=e,this._alpha=t}iX.prototype={areaStart:zl,areaEnd:zl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:UM(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const TSe=function e(t){function n(r){return t?new iX(r,t):new kM(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function oX(e,t){this._context=e,this._alpha=t}oX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=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){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:UM(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const ySe=function e(t){function n(r){return t?new oX(r,t):new jM(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function lX(e){this._context=e}lX.prototype={areaStart:zl,areaEnd:zl,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 xSe(e){return new lX(e)}function AB(e){return e<0?-1:1}function RB(e,t,n){var r=e._x1-e._x0,a=t-e._x1,s=(e._y1-e._y0)/(r||a<0&&-0),i=(n-e._y1)/(a||r<0&&-0),l=(s*a+i*r)/(r+a);return(AB(s)+AB(i))*Math.min(Math.abs(s),Math.abs(i),.5*Math.abs(l))||0}function NB(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function a_(e,t,n){var r=e._x0,a=e._y0,s=e._x1,i=e._y1,l=(s-r)/3;e._context.bezierCurveTo(r+l,a+l*t,s-l,i-l*n,s,i)}function Zy(e){this._context=e}Zy.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:a_(this,this._t0,NB(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,a_(this,NB(this,n=RB(this,e,t)),n);break;default:a_(this,this._t0,n=RB(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function cX(e){this._context=new uX(e)}(cX.prototype=Object.create(Zy.prototype)).point=function(e,t){Zy.prototype.point.call(this,t,e)};function uX(e){this._context=e}uX.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,a,s){this._context.bezierCurveTo(t,e,r,n,s,a)}};function SSe(e){return new Zy(e)}function bSe(e){return new cX(e)}function dX(e){this._context=e}dX.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=_B(e),a=_B(t),s=0,i=1;i<n;++s,++i)this._context.bezierCurveTo(r[0][s],a[0][s],r[1][s],a[1][s],e[i],t[i]);(this._line||this._line!==0&&n===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 _B(e){var t,n=e.length-1,r,a=new Array(n),s=new Array(n),i=new Array(n);for(a[0]=0,s[0]=2,i[0]=e[0]+2*e[1],t=1;t<n-1;++t)a[t]=1,s[t]=4,i[t]=4*e[t]+2*e[t+1];for(a[n-1]=2,s[n-1]=7,i[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=a[t]/s[t-1],s[t]-=r,i[t]-=r*i[t-1];for(a[n-1]=i[n-1]/s[n-1],t=n-2;t>=0;--t)a[t]=(i[t]-a[t+1])/s[t];for(s[n-1]=(e[n]+a[n-1])/2,t=0;t<n-1;++t)s[t]=2*e[t+1]-a[t+1];return[a,s]}function vSe(e){return new dX(e)}function Ax(e,t){this._context=e,this._t=t}Ax.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 n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function ASe(e){return new Ax(e,.5)}function RSe(e){return new Ax(e,0)}function NSe(e){return new Ax(e,1)}function wB(e,t){if((i=e.length)>1)for(var n=1,r,a,s=e[t[0]],i,l=s.length;n<i;++n)for(a=s,s=e[t[n]],r=0;r<l;++r)s[r][1]+=s[r][0]=isNaN(a[r][1])?a[r][0]:a[r][1]}function CB(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function _Se(e,t){return e[t]}function wSe(e){const t=[];return t.key=e,t}function CSe(){var e=ln([]),t=CB,n=wB,r=_Se;function a(s){var i=Array.from(e.apply(this,arguments),wSe),l,c=i.length,u=-1,h;for(const m of s)for(l=0,++u;l<c;++l)(i[l][u]=[0,+r(m,i[l].key,u,s)]).data=m;for(l=0,h=bx(t(i));l<c;++l)i[h[l]].index=l;return n(i,h),i}return a.keys=function(s){return arguments.length?(e=typeof s=="function"?s:ln(Array.from(s)),a):e},a.value=function(s){return arguments.length?(r=typeof s=="function"?s:ln(+s),a):r},a.order=function(s){return arguments.length?(t=s==null?CB:typeof s=="function"?s:ln(Array.from(s)),a):t},a.offset=function(s){return arguments.length?(n=s==null?wB:s,a):n},a}function ISe(e,t){if((c=e.length)>0)for(var n,r=0,a,s,i,l,c,u=e[t[0]].length;r<u;++r)for(i=l=0,n=0;n<c;++n)(s=(a=e[t[n]][r])[1]-a[0])>0?(a[0]=i,a[1]=i+=s):s<0?(a[1]=l,a[0]=l+=s):(a[0]=0,a[1]=s)}function uy(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function OSe(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function FM(e){let t,n,r;e.length!==2?(t=uy,n=(l,c)=>uy(e(l),c),r=(l,c)=>e(l)-c):(t=e===uy||e===OSe?e:LSe,n=e,r=e);function a(l,c,u=0,h=l.length){if(u<h){if(t(c,c)!==0)return h;do{const m=u+h>>>1;n(l[m],c)<0?u=m+1:h=m}while(u<h)}return u}function s(l,c,u=0,h=l.length){if(u<h){if(t(c,c)!==0)return h;do{const m=u+h>>>1;n(l[m],c)<=0?u=m+1:h=m}while(u<h)}return u}function i(l,c,u=0,h=l.length){const m=a(l,c,u,h-1);return m>u&&r(l[m-1],c)>-r(l[m],c)?m-1:m}return{left:a,center:i,right:s}}function LSe(){return 0}function MSe(e){return e===null?NaN:+e}const DSe=FM(uy),PSe=DSe.right;FM(MSe).center;class IB extends Map{constructor(t,n=USe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,a]of t)this.set(r,a)}get(t){return super.get(OB(this,t))}has(t){return super.has(OB(this,t))}set(t,n){return super.set(kSe(this,t),n)}delete(t){return super.delete(jSe(this,t))}}function OB({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function kSe({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function jSe({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function USe(e){return e!==null&&typeof e=="object"?e.valueOf():e}const FSe=Math.sqrt(50),$Se=Math.sqrt(10),BSe=Math.sqrt(2);function e0(e,t,n){const r=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(r)),s=r/Math.pow(10,a),i=s>=FSe?10:s>=$Se?5:s>=BSe?2:1;let l,c,u;return a<0?(u=Math.pow(10,-a)/i,l=Math.round(e*u),c=Math.round(t*u),l/u<e&&++l,c/u>t&&--c,u=-u):(u=Math.pow(10,a)*i,l=Math.round(e/u),c=Math.round(t/u),l*u<e&&++l,c*u>t&&--c),c<l&&.5<=n&&n<2?e0(e,t,n*2):[l,c,u]}function GO(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[a,s,i]=r?e0(t,e,n):e0(e,t,n);if(!(s>=a))return[];const l=s-a+1,c=new Array(l);if(r)if(i<0)for(let u=0;u<l;++u)c[u]=(s-u)/-i;else for(let u=0;u<l;++u)c[u]=(s-u)*i;else if(i<0)for(let u=0;u<l;++u)c[u]=(a+u)/-i;else for(let u=0;u<l;++u)c[u]=(a+u)*i;return c}function zO(e,t,n){return t=+t,e=+e,n=+n,e0(e,t,n)[2]}function qO(e,t,n){t=+t,e=+e,n=+n;const r=t<e,a=r?zO(t,e,n):zO(e,t,n);return(r?-1:1)*(a<0?1/-a:a)}function HSe(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(a);++r<a;)s[r]=e+r*n;return s}function Mu(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const LB=Symbol("implicit");function Kc(){var e=new IB,t=[],n=[],r=LB;function a(s){let i=e.get(s);if(i===void 0){if(r!==LB)return r;e.set(s,i=t.push(s)-1)}return n[i%n.length]}return a.domain=function(s){if(!arguments.length)return t.slice();t=[],e=new IB;for(const i of s)e.has(i)||e.set(i,t.push(i)-1);return a},a.range=function(s){return arguments.length?(n=Array.from(s),a):n.slice()},a.unknown=function(s){return arguments.length?(r=s,a):r},a.copy=function(){return Kc(t,n).unknown(r)},Mu.apply(a,arguments),a}function $M(){var e=Kc().unknown(void 0),t=e.domain,n=e.range,r=0,a=1,s,i,l=!1,c=0,u=0,h=.5;delete e.unknown;function m(){var p=t().length,g=a<r,T=g?a:r,y=g?r:a;s=(y-T)/Math.max(1,p-c+u*2),l&&(s=Math.floor(s)),T+=(y-T-s*(p-c))*h,i=s*(1-c),l&&(T=Math.round(T),i=Math.round(i));var b=HSe(p).map(function(x){return T+s*x});return n(g?b.reverse():b)}return e.domain=function(p){return arguments.length?(t(p),m()):t()},e.range=function(p){return arguments.length?([r,a]=p,r=+r,a=+a,m()):[r,a]},e.rangeRound=function(p){return[r,a]=p,r=+r,a=+a,l=!0,m()},e.bandwidth=function(){return i},e.step=function(){return s},e.round=function(p){return arguments.length?(l=!!p,m()):l},e.padding=function(p){return arguments.length?(c=Math.min(1,u=+p),m()):c},e.paddingInner=function(p){return arguments.length?(c=Math.min(1,p),m()):c},e.paddingOuter=function(p){return arguments.length?(u=+p,m()):u},e.align=function(p){return arguments.length?(h=Math.max(0,Math.min(1,p)),m()):h},e.copy=function(){return $M(t(),[r,a]).round(l).paddingInner(c).paddingOuter(u).align(h)},Mu.apply(m(),arguments)}function hX(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return hX(t())},e}function VSe(){return hX($M.apply(null,arguments).paddingInner(1))}function GSe(e){return function(){return e}}function zSe(e){return+e}var MB=[0,1];function ah(e){return e}function YO(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:GSe(isNaN(t)?NaN:.5)}function qSe(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function YSe(e,t,n){var r=e[0],a=e[1],s=t[0],i=t[1];return a<r?(r=YO(a,r),s=n(i,s)):(r=YO(r,a),s=n(s,i)),function(l){return s(r(l))}}function WSe(e,t,n){var r=Math.min(e.length,t.length)-1,a=new Array(r),s=new Array(r),i=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++i<r;)a[i]=YO(e[i],e[i+1]),s[i]=n(t[i],t[i+1]);return function(l){var c=PSe(e,l,1,r)-1;return s[c](a[c](l))}}function Rx(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function BM(){var e=MB,t=MB,n=wM,r,a,s,i=ah,l,c,u;function h(){var p=Math.min(e.length,t.length);return i!==ah&&(i=qSe(e[0],e[p-1])),l=p>2?WSe:YSe,c=u=null,m}function m(p){return p==null||isNaN(p=+p)?s:(c||(c=l(e.map(r),t,n)))(r(i(p)))}return m.invert=function(p){return i(a((u||(u=l(t,e.map(r),mg)))(p)))},m.domain=function(p){return arguments.length?(e=Array.from(p,zSe),h()):e.slice()},m.range=function(p){return arguments.length?(t=Array.from(p),h()):t.slice()},m.rangeRound=function(p){return t=Array.from(p),n=Y9,h()},m.clamp=function(p){return arguments.length?(i=p?!0:ah,h()):i!==ah},m.interpolate=function(p){return arguments.length?(n=p,h()):n},m.unknown=function(p){return arguments.length?(s=p,m):s},function(p,g){return r=p,a=g,h()}}function fX(){return BM()(ah,ah)}function XSe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function t0(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Dh(e){return e=t0(Math.abs(e)),e?e[1]:NaN}function KSe(e,t){return function(n,r){for(var a=n.length,s=[],i=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(a-=l,a+l)),!((c+=l+1)>r));)l=e[i=(i+1)%e.length];return s.reverse().join(t)}}function QSe(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var JSe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function gg(e){if(!(t=JSe.exec(e)))throw new Error("invalid format: "+e);var t;return new HM({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]})}gg.prototype=HM.prototype;function HM(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+""}HM.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 ZSe(e){e:for(var t=e.length,n=1,r=-1,a;n<t;++n)switch(e[n]){case".":r=a=n;break;case"0":r===0&&(r=n),a=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(a+1):e}var mX;function ebe(e,t){var n=t0(e,t);if(!n)return e+"";var r=n[0],a=n[1],s=a-(mX=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,i=r.length;return s===i?r:s>i?r+new Array(s-i+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+t0(e,Math.max(0,t+s-1))[0]}function DB(e,t){var n=t0(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const PB={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:XSe,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)=>DB(e*100,t),r:DB,s:ebe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function kB(e){return e}var jB=Array.prototype.map,UB=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tbe(e){var t=e.grouping===void 0||e.thousands===void 0?kB:KSe(jB.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?kB:QSe(jB.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(m){m=gg(m);var p=m.fill,g=m.align,T=m.sign,y=m.symbol,b=m.zero,x=m.width,R=m.comma,A=m.precision,w=m.trim,_=m.type;_==="n"?(R=!0,_="g"):PB[_]||(A===void 0&&(A=12),w=!0,_="g"),(b||p==="0"&&g==="=")&&(b=!0,p="0",g="=");var N=y==="$"?n:y==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",I=y==="$"?r:/[%p]/.test(_)?i:"",D=PB[_],M=/[defgprs%]/.test(_);A=A===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function O(L){var k=N,F=I,U,B,j;if(_==="c")F=D(L)+F,L="";else{L=+L;var G=L<0||1/L<0;if(L=isNaN(L)?c:D(Math.abs(L),A),w&&(L=ZSe(L)),G&&+L==0&&T!=="+"&&(G=!1),k=(G?T==="("?T:l:T==="-"||T==="("?"":T)+k,F=(_==="s"?UB[8+mX/3]:"")+F+(G&&T==="("?")":""),M){for(U=-1,B=L.length;++U<B;)if(j=L.charCodeAt(U),48>j||j>57){F=(j===46?a+L.slice(U+1):L.slice(U))+F,L=L.slice(0,U);break}}}R&&!b&&(L=t(L,1/0));var K=k.length+L.length+F.length,J=K<x?new Array(x-K+1).join(p):"";switch(R&&b&&(L=t(J+L,J.length?x-F.length:1/0),J=""),g){case"<":L=k+L+F+J;break;case"=":L=k+J+L+F;break;case"^":L=J.slice(0,K=J.length>>1)+k+L+F+J.slice(K);break;default:L=J+k+L+F;break}return s(L)}return O.toString=function(){return m+""},O}function h(m,p){var g=u((m=gg(m),m.type="f",m)),T=Math.max(-8,Math.min(8,Math.floor(Dh(p)/3)))*3,y=Math.pow(10,-T),b=UB[8+T/3];return function(x){return g(y*x)+b}}return{format:u,formatPrefix:h}}var PT,VM,pX;nbe({thousands:",",grouping:[3],currency:["$",""]});function nbe(e){return PT=tbe(e),VM=PT.format,pX=PT.formatPrefix,PT}function rbe(e){return Math.max(0,-Dh(Math.abs(e)))}function abe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Dh(t)/3)))*3-Dh(Math.abs(e)))}function sbe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Dh(t)-Dh(e))+1}function ibe(e,t,n,r){var a=qO(e,t,n),s;switch(r=gg(r==null?",f":r),r.type){case"s":{var i=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=abe(a,i))&&(r.precision=s),pX(r,i)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=sbe(a,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=rbe(a))&&(r.precision=s-(r.type==="%")*2);break}}return VM(r)}function gX(e){var t=e.domain;return e.ticks=function(n){var r=t();return GO(r[0],r[r.length-1],n==null?10:n)},e.tickFormat=function(n,r){var a=t();return ibe(a[0],a[a.length-1],n==null?10:n,r)},e.nice=function(n){n==null&&(n=10);var r=t(),a=0,s=r.length-1,i=r[a],l=r[s],c,u,h=10;for(l<i&&(u=i,i=l,l=u,u=a,a=s,s=u);h-- >0;){if(u=zO(i,l,n),u===c)return r[a]=i,r[s]=l,t(r);if(u>0)i=Math.floor(i/u)*u,l=Math.ceil(l/u)*u;else if(u<0)i=Math.ceil(i*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function Eg(){var e=fX();return e.copy=function(){return Rx(e,Eg())},Mu.apply(e,arguments),gX(e)}function EX(e,t){e=e.slice();var n=0,r=e.length-1,a=e[n],s=e[r],i;return s<a&&(i=n,n=r,r=i,i=a,a=s,s=i),e[n]=t.floor(a),e[r]=t.ceil(s),e}function FB(e){return Math.log(e)}function $B(e){return Math.exp(e)}function obe(e){return-Math.log(-e)}function lbe(e){return-Math.exp(-e)}function cbe(e){return isFinite(e)?+("1e"+e):e<0?0:e}function ube(e){return e===10?cbe:e===Math.E?Math.exp:t=>Math.pow(e,t)}function dbe(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 BB(e){return(t,n)=>-e(-t,n)}function hbe(e){const t=e(FB,$B),n=t.domain;let r=10,a,s;function i(){return a=dbe(r),s=ube(r),n()[0]<0?(a=BB(a),s=BB(s),e(obe,lbe)):e(FB,$B),t}return t.base=function(l){return arguments.length?(r=+l,i()):r},t.domain=function(l){return arguments.length?(n(l),i()):n()},t.ticks=l=>{const c=n();let u=c[0],h=c[c.length-1];const m=h<u;m&&([u,h]=[h,u]);let p=a(u),g=a(h),T,y;const b=l==null?10:+l;let x=[];if(!(r%1)&&g-p<b){if(p=Math.floor(p),g=Math.ceil(g),u>0){for(;p<=g;++p)for(T=1;T<r;++T)if(y=p<0?T/s(-p):T*s(p),!(y<u)){if(y>h)break;x.push(y)}}else for(;p<=g;++p)for(T=r-1;T>=1;--T)if(y=p>0?T/s(-p):T*s(p),!(y<u)){if(y>h)break;x.push(y)}x.length*2<b&&(x=GO(u,h,b))}else x=GO(p,g,Math.min(g-p,b)).map(s);return m?x.reverse():x},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=gg(c)).precision==null&&(c.trim=!0),c=VM(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return h=>{let m=h/s(Math.round(a(h)));return m*r<r-.5&&(m*=r),m<=u?c(h):""}},t.nice=()=>n(EX(n(),{floor:l=>s(Math.floor(a(l))),ceil:l=>s(Math.ceil(a(l)))})),t}function TX(){const e=hbe(BM()).domain([1,10]);return e.copy=()=>Rx(e,TX()).base(e.base()),Mu.apply(e,arguments),e}function HB(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function VB(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function fbe(e){var t=1,n=e(HB(t),VB(t));return n.constant=function(r){return arguments.length?e(HB(t=+r),VB(t)):t},gX(n)}function yX(){var e=fbe(BM());return e.copy=function(){return Rx(e,yX()).constant(e.constant())},Mu.apply(e,arguments)}const s_=new Date,i_=new Date;function Gr(e,t,n,r){function a(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return a.floor=s=>(e(s=new Date(+s)),s),a.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),a.round=s=>{const i=a(s),l=a.ceil(s);return s-i<l-s?i:l},a.offset=(s,i)=>(t(s=new Date(+s),i==null?1:Math.floor(i)),s),a.range=(s,i,l)=>{const c=[];if(s=a.ceil(s),l=l==null?1:Math.floor(l),!(s<i)||!(l>0))return c;let u;do c.push(u=new Date(+s)),t(s,l),e(s);while(u<s&&s<i);return c},a.filter=s=>Gr(i=>{if(i>=i)for(;e(i),!s(i);)i.setTime(i-1)},(i,l)=>{if(i>=i)if(l<0)for(;++l<=0;)for(;t(i,-1),!s(i););else for(;--l>=0;)for(;t(i,1),!s(i););}),n&&(a.count=(s,i)=>(s_.setTime(+s),i_.setTime(+i),e(s_),e(i_),Math.floor(n(s_,i_))),a.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?a.filter(r?i=>r(i)%s===0:i=>a.count(0,i)%s===0):a)),a}const n0=Gr(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);n0.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Gr(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):n0);n0.range;const Io=1e3,Bs=Io*60,Oo=Bs*60,Uo=Oo*24,GM=Uo*7,GB=Uo*30,o_=Uo*365,Qc=Gr(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Io)},(e,t)=>(t-e)/Io,e=>e.getUTCSeconds());Qc.range;const zM=Gr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Io)},(e,t)=>{e.setTime(+e+t*Bs)},(e,t)=>(t-e)/Bs,e=>e.getMinutes());zM.range;const qM=Gr(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Bs)},(e,t)=>(t-e)/Bs,e=>e.getUTCMinutes());qM.range;const YM=Gr(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Io-e.getMinutes()*Bs)},(e,t)=>{e.setTime(+e+t*Oo)},(e,t)=>(t-e)/Oo,e=>e.getHours());YM.range;const WM=Gr(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Oo)},(e,t)=>(t-e)/Oo,e=>e.getUTCHours());WM.range;const $g=Gr(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Bs)/Uo,e=>e.getDate()-1);$g.range;const Nx=Gr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Uo,e=>e.getUTCDate()-1);Nx.range;const xX=Gr(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Uo,e=>Math.floor(e/Uo));xX.range;function Du(e){return Gr(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Bs)/GM)}const _x=Du(0),r0=Du(1),mbe=Du(2),pbe=Du(3),Ph=Du(4),gbe=Du(5),Ebe=Du(6);_x.range;r0.range;mbe.range;pbe.range;Ph.range;gbe.range;Ebe.range;function Pu(e){return Gr(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/GM)}const wx=Pu(0),a0=Pu(1),Tbe=Pu(2),ybe=Pu(3),kh=Pu(4),xbe=Pu(5),Sbe=Pu(6);wx.range;a0.range;Tbe.range;ybe.range;kh.range;xbe.range;Sbe.range;const XM=Gr(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());XM.range;const KM=Gr(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());KM.range;const Fo=Gr(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());Fo.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gr(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Fo.range;const $o=Gr(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());$o.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gr(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});$o.range;function SX(e,t,n,r,a,s){const i=[[Qc,1,Io],[Qc,5,5*Io],[Qc,15,15*Io],[Qc,30,30*Io],[s,1,Bs],[s,5,5*Bs],[s,15,15*Bs],[s,30,30*Bs],[a,1,Oo],[a,3,3*Oo],[a,6,6*Oo],[a,12,12*Oo],[r,1,Uo],[r,2,2*Uo],[n,1,GM],[t,1,GB],[t,3,3*GB],[e,1,o_]];function l(u,h,m){const p=h<u;p&&([u,h]=[h,u]);const g=m&&typeof m.range=="function"?m:c(u,h,m),T=g?g.range(u,+h+1):[];return p?T.reverse():T}function c(u,h,m){const p=Math.abs(h-u)/m,g=FM(([,,b])=>b).right(i,p);if(g===i.length)return e.every(qO(u/o_,h/o_,m));if(g===0)return n0.every(Math.max(qO(u,h,m),1));const[T,y]=i[p/i[g-1][2]<i[g][2]/p?g-1:g];return T.every(y)}return[l,c]}const[bbe,vbe]=SX($o,KM,wx,xX,WM,qM),[Abe,Rbe]=SX(Fo,XM,_x,$g,YM,zM);function l_(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 c_(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 Cm(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function Nbe(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,s=e.days,i=e.shortDays,l=e.months,c=e.shortMonths,u=Im(a),h=Om(a),m=Im(s),p=Om(s),g=Im(i),T=Om(i),y=Im(l),b=Om(l),x=Im(c),R=Om(c),A={a:G,A:K,b:J,B:$,c:null,d:KB,e:KB,f:Xbe,g:sve,G:ove,H:qbe,I:Ybe,j:Wbe,L:bX,m:Kbe,M:Qbe,p:X,q:Z,Q:ZB,s:eH,S:Jbe,u:Zbe,U:eve,V:tve,w:nve,W:rve,x:null,X:null,y:ave,Y:ive,Z:lve,"%":JB},w={a:V,A:te,b:ae,B:ne,c:null,d:QB,e:QB,f:hve,g:bve,G:Ave,H:cve,I:uve,j:dve,L:AX,m:fve,M:mve,p:ce,q:ie,Q:ZB,s:eH,S:pve,u:gve,U:Eve,V:Tve,w:yve,W:xve,x:null,X:null,y:Sve,Y:vve,Z:Rve,"%":JB},_={a:O,A:L,b:k,B:F,c:U,d:WB,e:WB,f:Hbe,g:YB,G:qB,H:XB,I:XB,j:Ube,L:Bbe,m:jbe,M:Fbe,p:M,q:kbe,Q:Gbe,s:zbe,S:$be,u:Obe,U:Lbe,V:Mbe,w:Ibe,W:Dbe,x:B,X:j,y:YB,Y:qB,Z:Pbe,"%":Vbe};A.x=N(n,A),A.X=N(r,A),A.c=N(t,A),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w);function N(W,Q){return function(se){var z=[],xe=-1,le=0,pe=W.length,_e,re,Se;for(se instanceof Date||(se=new Date(+se));++xe<pe;)W.charCodeAt(xe)===37&&(z.push(W.slice(le,xe)),(re=zB[_e=W.charAt(++xe)])!=null?_e=W.charAt(++xe):re=_e==="e"?" ":"0",(Se=Q[_e])&&(_e=Se(se,re)),z.push(_e),le=xe+1);return z.push(W.slice(le,xe)),z.join("")}}function I(W,Q){return function(se){var z=Cm(1900,void 0,1),xe=D(z,W,se+="",0),le,pe;if(xe!=se.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(Q&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(le=c_(Cm(z.y,0,1)),pe=le.getUTCDay(),le=pe>4||pe===0?a0.ceil(le):a0(le),le=Nx.offset(le,(z.V-1)*7),z.y=le.getUTCFullYear(),z.m=le.getUTCMonth(),z.d=le.getUTCDate()+(z.w+6)%7):(le=l_(Cm(z.y,0,1)),pe=le.getDay(),le=pe>4||pe===0?r0.ceil(le):r0(le),le=$g.offset(le,(z.V-1)*7),z.y=le.getFullYear(),z.m=le.getMonth(),z.d=le.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),pe="Z"in z?c_(Cm(z.y,0,1)).getUTCDay():l_(Cm(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(pe+5)%7:z.w+z.U*7-(pe+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,c_(z)):l_(z)}}function D(W,Q,se,z){for(var xe=0,le=Q.length,pe=se.length,_e,re;xe<le;){if(z>=pe)return-1;if(_e=Q.charCodeAt(xe++),_e===37){if(_e=Q.charAt(xe++),re=_[_e in zB?Q.charAt(xe++):_e],!re||(z=re(W,se,z))<0)return-1}else if(_e!=se.charCodeAt(z++))return-1}return z}function M(W,Q,se){var z=u.exec(Q.slice(se));return z?(W.p=h.get(z[0].toLowerCase()),se+z[0].length):-1}function O(W,Q,se){var z=g.exec(Q.slice(se));return z?(W.w=T.get(z[0].toLowerCase()),se+z[0].length):-1}function L(W,Q,se){var z=m.exec(Q.slice(se));return z?(W.w=p.get(z[0].toLowerCase()),se+z[0].length):-1}function k(W,Q,se){var z=x.exec(Q.slice(se));return z?(W.m=R.get(z[0].toLowerCase()),se+z[0].length):-1}function F(W,Q,se){var z=y.exec(Q.slice(se));return z?(W.m=b.get(z[0].toLowerCase()),se+z[0].length):-1}function U(W,Q,se){return D(W,t,Q,se)}function B(W,Q,se){return D(W,n,Q,se)}function j(W,Q,se){return D(W,r,Q,se)}function G(W){return i[W.getDay()]}function K(W){return s[W.getDay()]}function J(W){return c[W.getMonth()]}function $(W){return l[W.getMonth()]}function X(W){return a[+(W.getHours()>=12)]}function Z(W){return 1+~~(W.getMonth()/3)}function V(W){return i[W.getUTCDay()]}function te(W){return s[W.getUTCDay()]}function ae(W){return c[W.getUTCMonth()]}function ne(W){return l[W.getUTCMonth()]}function ce(W){return a[+(W.getUTCHours()>=12)]}function ie(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var Q=N(W+="",A);return Q.toString=function(){return W},Q},parse:function(W){var Q=I(W+="",!1);return Q.toString=function(){return W},Q},utcFormat:function(W){var Q=N(W+="",w);return Q.toString=function(){return W},Q},utcParse:function(W){var Q=I(W+="",!0);return Q.toString=function(){return W},Q}}}var zB={"-":"",_:" ",0:"0"},ta=/^\s*\d+/,_be=/^%/,wbe=/[\\^$*+?|[\]().{}]/g;function xn(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",s=a.length;return r+(s<n?new Array(n-s+1).join(t)+a:a)}function Cbe(e){return e.replace(wbe,"\\$&")}function Im(e){return new RegExp("^(?:"+e.map(Cbe).join("|")+")","i")}function Om(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function Ibe(e,t,n){var r=ta.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Obe(e,t,n){var r=ta.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Lbe(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Mbe(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Dbe(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function qB(e,t,n){var r=ta.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function YB(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Pbe(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function kbe(e,t,n){var r=ta.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function jbe(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function WB(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Ube(e,t,n){var r=ta.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function XB(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Fbe(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function $be(e,t,n){var r=ta.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Bbe(e,t,n){var r=ta.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Hbe(e,t,n){var r=ta.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Vbe(e,t,n){var r=_be.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Gbe(e,t,n){var r=ta.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function zbe(e,t,n){var r=ta.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function KB(e,t){return xn(e.getDate(),t,2)}function qbe(e,t){return xn(e.getHours(),t,2)}function Ybe(e,t){return xn(e.getHours()%12||12,t,2)}function Wbe(e,t){return xn(1+$g.count(Fo(e),e),t,3)}function bX(e,t){return xn(e.getMilliseconds(),t,3)}function Xbe(e,t){return bX(e,t)+"000"}function Kbe(e,t){return xn(e.getMonth()+1,t,2)}function Qbe(e,t){return xn(e.getMinutes(),t,2)}function Jbe(e,t){return xn(e.getSeconds(),t,2)}function Zbe(e){var t=e.getDay();return t===0?7:t}function eve(e,t){return xn(_x.count(Fo(e)-1,e),t,2)}function vX(e){var t=e.getDay();return t>=4||t===0?Ph(e):Ph.ceil(e)}function tve(e,t){return e=vX(e),xn(Ph.count(Fo(e),e)+(Fo(e).getDay()===4),t,2)}function nve(e){return e.getDay()}function rve(e,t){return xn(r0.count(Fo(e)-1,e),t,2)}function ave(e,t){return xn(e.getFullYear()%100,t,2)}function sve(e,t){return e=vX(e),xn(e.getFullYear()%100,t,2)}function ive(e,t){return xn(e.getFullYear()%1e4,t,4)}function ove(e,t){var n=e.getDay();return e=n>=4||n===0?Ph(e):Ph.ceil(e),xn(e.getFullYear()%1e4,t,4)}function lve(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+xn(t/60|0,"0",2)+xn(t%60,"0",2)}function QB(e,t){return xn(e.getUTCDate(),t,2)}function cve(e,t){return xn(e.getUTCHours(),t,2)}function uve(e,t){return xn(e.getUTCHours()%12||12,t,2)}function dve(e,t){return xn(1+Nx.count($o(e),e),t,3)}function AX(e,t){return xn(e.getUTCMilliseconds(),t,3)}function hve(e,t){return AX(e,t)+"000"}function fve(e,t){return xn(e.getUTCMonth()+1,t,2)}function mve(e,t){return xn(e.getUTCMinutes(),t,2)}function pve(e,t){return xn(e.getUTCSeconds(),t,2)}function gve(e){var t=e.getUTCDay();return t===0?7:t}function Eve(e,t){return xn(wx.count($o(e)-1,e),t,2)}function RX(e){var t=e.getUTCDay();return t>=4||t===0?kh(e):kh.ceil(e)}function Tve(e,t){return e=RX(e),xn(kh.count($o(e),e)+($o(e).getUTCDay()===4),t,2)}function yve(e){return e.getUTCDay()}function xve(e,t){return xn(a0.count($o(e)-1,e),t,2)}function Sve(e,t){return xn(e.getUTCFullYear()%100,t,2)}function bve(e,t){return e=RX(e),xn(e.getUTCFullYear()%100,t,2)}function vve(e,t){return xn(e.getUTCFullYear()%1e4,t,4)}function Ave(e,t){var n=e.getUTCDay();return e=n>=4||n===0?kh(e):kh.ceil(e),xn(e.getUTCFullYear()%1e4,t,4)}function Rve(){return"+0000"}function JB(){return"%"}function ZB(e){return+e}function eH(e){return Math.floor(+e/1e3)}var Nd,NX,_X;Nve({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 Nve(e){return Nd=Nbe(e),NX=Nd.format,Nd.parse,_X=Nd.utcFormat,Nd.utcParse,Nd}function _ve(e){return new Date(e)}function wve(e){return e instanceof Date?+e:+new Date(+e)}function QM(e,t,n,r,a,s,i,l,c,u){var h=fX(),m=h.invert,p=h.domain,g=u(".%L"),T=u(":%S"),y=u("%I:%M"),b=u("%I %p"),x=u("%a %d"),R=u("%b %d"),A=u("%B"),w=u("%Y");function _(N){return(c(N)<N?g:l(N)<N?T:i(N)<N?y:s(N)<N?b:r(N)<N?a(N)<N?x:R:n(N)<N?A:w)(N)}return h.invert=function(N){return new Date(m(N))},h.domain=function(N){return arguments.length?p(Array.from(N,wve)):p().map(_ve)},h.ticks=function(N){var I=p();return e(I[0],I[I.length-1],N==null?10:N)},h.tickFormat=function(N,I){return I==null?_:u(I)},h.nice=function(N){var I=p();return(!N||typeof N.range!="function")&&(N=t(I[0],I[I.length-1],N==null?10:N)),N?p(EX(I,N)):h},h.copy=function(){return Rx(h,QM(e,t,n,r,a,s,i,l,c,u))},h}function Cve(){return Mu.apply(QM(Abe,Rbe,Fo,XM,_x,$g,YM,zM,Qc,NX).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Ive(){return Mu.apply(QM(bbe,vbe,$o,KM,wx,Nx,WM,qM,Qc,_X).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function en(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}const Ove=en("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Lve=en("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Mve=en("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Dve=en("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Pve=en("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),kve=en("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),jve=en("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Uve=en("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),wX=en("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),Fve=en("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),Qn=e=>Oxe(e[e.length-1]);var Cx=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(en);const $ve=Qn(Cx);var Ix=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(en);const Bve=Qn(Ix);var Ox=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(en);const Hve=Qn(Ox);var Lx=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(en);const Vve=Qn(Lx);var Mx=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(en);const Gve=Qn(Mx);var Dx=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(en);const zve=Qn(Dx);var Px=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(en);const qve=Qn(Px);var kx=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(en);const Yve=Qn(kx);var jx=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(en);const Wve=Qn(jx);var Ux=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(en);const Xve=Qn(Ux);var Fx=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(en);const Kve=Qn(Fx);var $x=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(en);const Qve=Qn($x);var Bx=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(en);const Jve=Qn(Bx);var Hx=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(en);const Zve=Qn(Hx);var Vx=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(en);const eAe=Qn(Vx);var Gx=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(en);const tAe=Qn(Gx);var zx=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(en);const nAe=Qn(zx);var qx=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(en);const rAe=Qn(qx);var Yx=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(en);const aAe=Qn(Yx);var Wx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(en);const sAe=Qn(Wx);var Xx=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(en);const iAe=Qn(Xx);var Kx=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(en);const oAe=Qn(Kx);var Qx=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(en);const lAe=Qn(Qx);var Jx=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(en);const cAe=Qn(Jx);var Zx=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(en);const uAe=Qn(Zx);var eS=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(en);const dAe=Qn(eS);var tS=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(en);const hAe=Qn(tS);function fAe(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}const mAe=CM(Wi(300,.5,0),Wi(-240,.5,1));var pAe=CM(Wi(-100,.75,.35),Wi(80,1.5,.8)),gAe=CM(Wi(260,.75,.35),Wi(80,1.5,.8)),kT=Wi();function EAe(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return kT.h=360*e-100,kT.s=1.5-1.5*t,kT.l=.8-.9*t,kT+""}var jT=Mh(),TAe=Math.PI/3,yAe=Math.PI*2/3;function xAe(e){var t;return e=(.5-e)*Math.PI,jT.r=255*(t=Math.sin(e))*t,jT.g=255*(t=Math.sin(e+TAe))*t,jT.b=255*(t=Math.sin(e+yAe))*t,jT+""}function SAe(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function nS(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}const bAe=nS(en("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var vAe=nS(en("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),AAe=nS(en("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),RAe=nS(en("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),u_,tH;function CX(){if(tH)return u_;tH=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return u_=e,u_}var NAe=CX();const bt=ir(NAe);za();var _Ae=ox();const JM=ir(_Ae);function wAe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function s0(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function CAe(e){return e=s0(Math.abs(e)),e?e[1]:NaN}function IAe(e,t){return function(n,r){for(var a=n.length,s=[],i=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(a-=l,a+l)),!((c+=l+1)>r));)l=e[i=(i+1)%e.length];return s.reverse().join(t)}}function OAe(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var LAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function WO(e){if(!(t=LAe.exec(e)))throw new Error("invalid format: "+e);var t;return new ZM({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]})}WO.prototype=ZM.prototype;function ZM(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+""}ZM.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 MAe(e){e:for(var t=e.length,n=1,r=-1,a;n<t;++n)switch(e[n]){case".":r=a=n;break;case"0":r===0&&(r=n),a=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(a+1):e}var IX;function DAe(e,t){var n=s0(e,t);if(!n)return e+"";var r=n[0],a=n[1],s=a-(IX=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,i=r.length;return s===i?r:s>i?r+new Array(s-i+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+s0(e,Math.max(0,t+s-1))[0]}function nH(e,t){var n=s0(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const rH={"%":function(e,t){return(e*100).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:wAe,e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return nH(e*100,t)},r:nH,s:DAe,X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function aH(e){return e}var sH=Array.prototype.map,iH=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function PAe(e){var t=e.grouping===void 0||e.thousands===void 0?aH:IAe(sH.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",a=e.decimal+"",s=e.numerals===void 0?aH:OAe(sH.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",l=e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(m){m=WO(m);var p=m.fill,g=m.align,T=m.sign,y=m.symbol,b=m.zero,x=m.width,R=m.comma,A=m.precision,w=m.trim,_=m.type;_==="n"?(R=!0,_="g"):rH[_]||(A===void 0&&(A=12),w=!0,_="g"),(b||p==="0"&&g==="=")&&(b=!0,p="0",g="=");var N=y==="$"?n:y==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",I=y==="$"?r:/[%p]/.test(_)?i:"",D=rH[_],M=/[defgprs%]/.test(_);A=A===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function O(L){var k=N,F=I,U,B,j;if(_==="c")F=D(L)+F,L="";else{L=+L;var G=L<0||1/L<0;if(L=isNaN(L)?c:D(Math.abs(L),A),w&&(L=MAe(L)),G&&+L==0&&T!=="+"&&(G=!1),k=(G?T==="("?T:l:T==="-"||T==="("?"":T)+k,F=(_==="s"?iH[8+IX/3]:"")+F+(G&&T==="("?")":""),M){for(U=-1,B=L.length;++U<B;)if(j=L.charCodeAt(U),48>j||j>57){F=(j===46?a+L.slice(U+1):L.slice(U))+F,L=L.slice(0,U);break}}}R&&!b&&(L=t(L,1/0));var K=k.length+L.length+F.length,J=K<x?new Array(x-K+1).join(p):"";switch(R&&b&&(L=t(J+L,J.length?x-F.length:1/0),J=""),g){case"<":L=k+L+F+J;break;case"=":L=k+J+L+F;break;case"^":L=J.slice(0,K=J.length>>1)+k+L+F+J.slice(K);break;default:L=J+k+L+F;break}return s(L)}return O.toString=function(){return m+""},O}function h(m,p){var g=u((m=WO(m),m.type="f",m)),T=Math.max(-8,Math.min(8,Math.floor(CAe(p)/3)))*3,y=Math.pow(10,-T),b=iH[8+T/3];return function(x){return g(y*x)+b}}return{format:u,formatPrefix:h}}var UT,OX;kAe({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function kAe(e){return UT=PAe(e),OX=UT.format,UT.formatPrefix,UT}var d_=new Date,h_=new Date;function Ho(e,t,n,r){function a(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return a.floor=function(s){return e(s=new Date(+s)),s},a.ceil=function(s){return e(s=new Date(s-1)),t(s,1),e(s),s},a.round=function(s){var i=a(s),l=a.ceil(s);return s-i<l-s?i:l},a.offset=function(s,i){return t(s=new Date(+s),i==null?1:Math.floor(i)),s},a.range=function(s,i,l){var c=[],u;if(s=a.ceil(s),l=l==null?1:Math.floor(l),!(s<i)||!(l>0))return c;do c.push(u=new Date(+s)),t(s,l),e(s);while(u<s&&s<i);return c},a.filter=function(s){return Ho(function(i){if(i>=i)for(;e(i),!s(i);)i.setTime(i-1)},function(i,l){if(i>=i)if(l<0)for(;++l<=0;)for(;t(i,-1),!s(i););else for(;--l>=0;)for(;t(i,1),!s(i););})},n&&(a.count=function(s,i){return d_.setTime(+s),h_.setTime(+i),e(d_),e(h_),Math.floor(n(d_,h_))},a.every=function(s){return s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?a.filter(r?function(i){return r(i)%s===0}:function(i){return a.count(0,i)%s===0}):a}),a}const jAe=1e3,eD=jAe*60,UAe=eD*60,tD=UAe*24,LX=tD*7;var nD=Ho(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*eD)/tD,e=>e.getDate()-1);nD.range;function ku(e){return Ho(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n*7)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*eD)/LX})}var MX=ku(0),i0=ku(1),FAe=ku(2),$Ae=ku(3),jh=ku(4),BAe=ku(5),HAe=ku(6);MX.range;i0.range;FAe.range;$Ae.range;jh.range;BAe.range;HAe.range;var Tu=Ho(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});Tu.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:Ho(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)})};Tu.range;var rD=Ho(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/tD},function(e){return e.getUTCDate()-1});rD.range;function ju(e){return Ho(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n*7)},function(t,n){return(n-t)/LX})}var DX=ju(0),o0=ju(1),VAe=ju(2),GAe=ju(3),Uh=ju(4),zAe=ju(5),qAe=ju(6);DX.range;o0.range;VAe.range;GAe.range;Uh.range;zAe.range;qAe.range;var yu=Ho(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});yu.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:Ho(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})};yu.range;function f_(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 m_(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 Lm(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function YAe(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,s=e.days,i=e.shortDays,l=e.months,c=e.shortMonths,u=Mm(a),h=Dm(a),m=Mm(s),p=Dm(s),g=Mm(i),T=Dm(i),y=Mm(l),b=Dm(l),x=Mm(c),R=Dm(c),A={a:G,A:K,b:J,B:$,c:null,d:hH,e:hH,f:gRe,g:NRe,G:wRe,H:fRe,I:mRe,j:pRe,L:PX,m:ERe,M:TRe,p:X,q:Z,Q:pH,s:gH,S:yRe,u:xRe,U:SRe,V:bRe,w:vRe,W:ARe,x:null,X:null,y:RRe,Y:_Re,Z:CRe,"%":mH},w={a:V,A:te,b:ae,B:ne,c:null,d:fH,e:fH,f:MRe,g:VRe,G:zRe,H:IRe,I:ORe,j:LRe,L:jX,m:DRe,M:PRe,p:ce,q:ie,Q:pH,s:gH,S:kRe,u:jRe,U:URe,V:FRe,w:$Re,W:BRe,x:null,X:null,y:HRe,Y:GRe,Z:qRe,"%":mH},_={a:O,A:L,b:k,B:F,c:U,d:uH,e:uH,f:cRe,g:cH,G:lH,H:dH,I:dH,j:sRe,L:lRe,m:aRe,M:iRe,p:M,q:rRe,Q:dRe,s:hRe,S:oRe,u:JAe,U:ZAe,V:eRe,w:QAe,W:tRe,x:B,X:j,y:cH,Y:lH,Z:nRe,"%":uRe};A.x=N(n,A),A.X=N(r,A),A.c=N(t,A),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w);function N(W,Q){return function(se){var z=[],xe=-1,le=0,pe=W.length,_e,re,Se;for(se instanceof Date||(se=new Date(+se));++xe<pe;)W.charCodeAt(xe)===37&&(z.push(W.slice(le,xe)),(re=oH[_e=W.charAt(++xe)])!=null?_e=W.charAt(++xe):re=_e==="e"?" ":"0",(Se=Q[_e])&&(_e=Se(se,re)),z.push(_e),le=xe+1);return z.push(W.slice(le,xe)),z.join("")}}function I(W,Q){return function(se){var z=Lm(1900,void 0,1),xe=D(z,W,se+="",0),le,pe;if(xe!=se.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(Q&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(le=m_(Lm(z.y,0,1)),pe=le.getUTCDay(),le=pe>4||pe===0?o0.ceil(le):o0(le),le=rD.offset(le,(z.V-1)*7),z.y=le.getUTCFullYear(),z.m=le.getUTCMonth(),z.d=le.getUTCDate()+(z.w+6)%7):(le=f_(Lm(z.y,0,1)),pe=le.getDay(),le=pe>4||pe===0?i0.ceil(le):i0(le),le=nD.offset(le,(z.V-1)*7),z.y=le.getFullYear(),z.m=le.getMonth(),z.d=le.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),pe="Z"in z?m_(Lm(z.y,0,1)).getUTCDay():f_(Lm(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(pe+5)%7:z.w+z.U*7-(pe+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,m_(z)):f_(z)}}function D(W,Q,se,z){for(var xe=0,le=Q.length,pe=se.length,_e,re;xe<le;){if(z>=pe)return-1;if(_e=Q.charCodeAt(xe++),_e===37){if(_e=Q.charAt(xe++),re=_[_e in oH?Q.charAt(xe++):_e],!re||(z=re(W,se,z))<0)return-1}else if(_e!=se.charCodeAt(z++))return-1}return z}function M(W,Q,se){var z=u.exec(Q.slice(se));return z?(W.p=h.get(z[0].toLowerCase()),se+z[0].length):-1}function O(W,Q,se){var z=g.exec(Q.slice(se));return z?(W.w=T.get(z[0].toLowerCase()),se+z[0].length):-1}function L(W,Q,se){var z=m.exec(Q.slice(se));return z?(W.w=p.get(z[0].toLowerCase()),se+z[0].length):-1}function k(W,Q,se){var z=x.exec(Q.slice(se));return z?(W.m=R.get(z[0].toLowerCase()),se+z[0].length):-1}function F(W,Q,se){var z=y.exec(Q.slice(se));return z?(W.m=b.get(z[0].toLowerCase()),se+z[0].length):-1}function U(W,Q,se){return D(W,t,Q,se)}function B(W,Q,se){return D(W,n,Q,se)}function j(W,Q,se){return D(W,r,Q,se)}function G(W){return i[W.getDay()]}function K(W){return s[W.getDay()]}function J(W){return c[W.getMonth()]}function $(W){return l[W.getMonth()]}function X(W){return a[+(W.getHours()>=12)]}function Z(W){return 1+~~(W.getMonth()/3)}function V(W){return i[W.getUTCDay()]}function te(W){return s[W.getUTCDay()]}function ae(W){return c[W.getUTCMonth()]}function ne(W){return l[W.getUTCMonth()]}function ce(W){return a[+(W.getUTCHours()>=12)]}function ie(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var Q=N(W+="",A);return Q.toString=function(){return W},Q},parse:function(W){var Q=I(W+="",!1);return Q.toString=function(){return W},Q},utcFormat:function(W){var Q=N(W+="",w);return Q.toString=function(){return W},Q},utcParse:function(W){var Q=I(W+="",!0);return Q.toString=function(){return W},Q}}}var oH={"-":"",_:" ",0:"0"},na=/^\s*\d+/,WAe=/^%/,XAe=/[\\^$*+?|[\]().{}]/g;function Sn(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",s=a.length;return r+(s<n?new Array(n-s+1).join(t)+a:a)}function KAe(e){return e.replace(XAe,"\\$&")}function Mm(e){return new RegExp("^(?:"+e.map(KAe).join("|")+")","i")}function Dm(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function QAe(e,t,n){var r=na.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function JAe(e,t,n){var r=na.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function ZAe(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function eRe(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function tRe(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function lH(e,t,n){var r=na.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function cH(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function nRe(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function rRe(e,t,n){var r=na.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function aRe(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function uH(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function sRe(e,t,n){var r=na.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function dH(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function iRe(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function oRe(e,t,n){var r=na.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function lRe(e,t,n){var r=na.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function cRe(e,t,n){var r=na.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function uRe(e,t,n){var r=WAe.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function dRe(e,t,n){var r=na.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function hRe(e,t,n){var r=na.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function hH(e,t){return Sn(e.getDate(),t,2)}function fRe(e,t){return Sn(e.getHours(),t,2)}function mRe(e,t){return Sn(e.getHours()%12||12,t,2)}function pRe(e,t){return Sn(1+nD.count(Tu(e),e),t,3)}function PX(e,t){return Sn(e.getMilliseconds(),t,3)}function gRe(e,t){return PX(e,t)+"000"}function ERe(e,t){return Sn(e.getMonth()+1,t,2)}function TRe(e,t){return Sn(e.getMinutes(),t,2)}function yRe(e,t){return Sn(e.getSeconds(),t,2)}function xRe(e){var t=e.getDay();return t===0?7:t}function SRe(e,t){return Sn(MX.count(Tu(e)-1,e),t,2)}function kX(e){var t=e.getDay();return t>=4||t===0?jh(e):jh.ceil(e)}function bRe(e,t){return e=kX(e),Sn(jh.count(Tu(e),e)+(Tu(e).getDay()===4),t,2)}function vRe(e){return e.getDay()}function ARe(e,t){return Sn(i0.count(Tu(e)-1,e),t,2)}function RRe(e,t){return Sn(e.getFullYear()%100,t,2)}function NRe(e,t){return e=kX(e),Sn(e.getFullYear()%100,t,2)}function _Re(e,t){return Sn(e.getFullYear()%1e4,t,4)}function wRe(e,t){var n=e.getDay();return e=n>=4||n===0?jh(e):jh.ceil(e),Sn(e.getFullYear()%1e4,t,4)}function CRe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Sn(t/60|0,"0",2)+Sn(t%60,"0",2)}function fH(e,t){return Sn(e.getUTCDate(),t,2)}function IRe(e,t){return Sn(e.getUTCHours(),t,2)}function ORe(e,t){return Sn(e.getUTCHours()%12||12,t,2)}function LRe(e,t){return Sn(1+rD.count(yu(e),e),t,3)}function jX(e,t){return Sn(e.getUTCMilliseconds(),t,3)}function MRe(e,t){return jX(e,t)+"000"}function DRe(e,t){return Sn(e.getUTCMonth()+1,t,2)}function PRe(e,t){return Sn(e.getUTCMinutes(),t,2)}function kRe(e,t){return Sn(e.getUTCSeconds(),t,2)}function jRe(e){var t=e.getUTCDay();return t===0?7:t}function URe(e,t){return Sn(DX.count(yu(e)-1,e),t,2)}function UX(e){var t=e.getUTCDay();return t>=4||t===0?Uh(e):Uh.ceil(e)}function FRe(e,t){return e=UX(e),Sn(Uh.count(yu(e),e)+(yu(e).getUTCDay()===4),t,2)}function $Re(e){return e.getUTCDay()}function BRe(e,t){return Sn(o0.count(yu(e)-1,e),t,2)}function HRe(e,t){return Sn(e.getUTCFullYear()%100,t,2)}function VRe(e,t){return e=UX(e),Sn(e.getUTCFullYear()%100,t,2)}function GRe(e,t){return Sn(e.getUTCFullYear()%1e4,t,4)}function zRe(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Uh(e):Uh.ceil(e),Sn(e.getUTCFullYear()%1e4,t,4)}function qRe(){return"+0000"}function mH(){return"%"}function pH(e){return+e}function gH(e){return Math.floor(+e/1e3)}var _d,FX;YRe({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 YRe(e){return _d=YAe(e),FX=_d.format,_d.parse,_d.utcFormat,_d.utcParse,_d}var WRe=xM();const rS=ir(WRe);var p_,EH;function XRe(){if(EH)return p_;EH=1;var e=Fg(),t=M9(),n=sf();function r(a,s,i){for(var l=-1,c=s.length,u={};++l<c;){var h=s[l],m=e(a,h);i(m,h)&&t(u,n(h,a),m)}return u}return p_=r,p_}var g_,TH;function KRe(){if(TH)return g_;TH=1;function e(t,n){return t!=null&&n in Object(t)}return g_=e,g_}var E_,yH;function QRe(){if(yH)return E_;yH=1;var e=sf(),t=dx(),n=za(),r=mx(),a=yM(),s=of();function i(l,c,u){c=e(c,l);for(var h=-1,m=c.length,p=!1;++h<m;){var g=s(c[h]);if(!(p=l!=null&&u(l,g)))break;l=l[g]}return p||++h!=m?p:(m=l==null?0:l.length,!!m&&a(m)&&r(g,m)&&(n(l)||t(l)))}return E_=i,E_}var T_,xH;function $X(){if(xH)return T_;xH=1;var e=KRe(),t=QRe();function n(r,a){return r!=null&&t(r,a,e)}return T_=n,T_}var y_,SH;function JRe(){if(SH)return y_;SH=1;var e=XRe(),t=$X();function n(r,a){return e(r,a,function(s,i){return t(r,i)})}return y_=n,y_}var x_,bH;function aD(){if(bH)return x_;bH=1;function e(t,n){for(var r=-1,a=n.length,s=t.length;++r<a;)t[s+r]=n[r];return t}return x_=e,x_}var S_,vH;function ZRe(){if(vH)return S_;vH=1;var e=tf(),t=dx(),n=za(),r=e?e.isConcatSpreadable:void 0;function a(s){return n(s)||t(s)||!!(r&&s&&s[r])}return S_=a,S_}var b_,AH;function BX(){if(AH)return b_;AH=1;var e=aD(),t=ZRe();function n(r,a,s,i,l){var c=-1,u=r.length;for(s||(s=t),l||(l=[]);++c<u;){var h=r[c];a>0&&s(h)?a>1?n(h,a-1,s,i,l):e(l,h):i||(l[l.length]=h)}return l}return b_=n,b_}var v_,RH;function eNe(){if(RH)return v_;RH=1;var e=BX();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return v_=t,v_}var A_,NH;function HX(){if(NH)return A_;NH=1;var e=eNe(),t=_9(),n=w9();function r(a){return n(t(a,void 0,e),a+"")}return A_=r,A_}var R_,_H;function tNe(){if(_H)return R_;_H=1;var e=JRe(),t=HX(),n=t(function(r,a){return r==null?{}:e(r,a)});return R_=n,R_}var nNe=tNe();const rNe=ir(nNe);var N_,wH;function aNe(){if(wH)return N_;wH=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return N_=e,N_}var __,CH;function VX(){if(CH)return __;CH=1;var e=IM(),t=aNe(),n=OM(),r=1,a=2;function s(i,l,c,u,h,m){var p=c&r,g=i.length,T=l.length;if(g!=T&&!(p&&T>g))return!1;var y=m.get(i),b=m.get(l);if(y&&b)return y==l&&b==i;var x=-1,R=!0,A=c&a?new e:void 0;for(m.set(i,l),m.set(l,i);++x<g;){var w=i[x],_=l[x];if(u)var N=p?u(_,w,x,l,i,m):u(w,_,x,i,l,m);if(N!==void 0){if(N)continue;R=!1;break}if(A){if(!t(l,function(I,D){if(!n(A,D)&&(w===I||h(w,I,c,u,m)))return A.push(D)})){R=!1;break}}else if(!(w===_||h(w,_,c,u,m))){R=!1;break}}return m.delete(i),m.delete(l),R}return __=s,__}var w_,IH;function sNe(){if(IH)return w_;IH=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,s){r[++n]=[s,a]}),r}return w_=e,w_}var C_,OH;function sD(){if(OH)return C_;OH=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return C_=e,C_}var I_,LH;function iNe(){if(LH)return I_;LH=1;var e=tf(),t=y9(),n=jg(),r=VX(),a=sNe(),s=sD(),i=1,l=2,c="[object Boolean]",u="[object Date]",h="[object Error]",m="[object Map]",p="[object Number]",g="[object RegExp]",T="[object Set]",y="[object String]",b="[object Symbol]",x="[object ArrayBuffer]",R="[object DataView]",A=e?e.prototype:void 0,w=A?A.valueOf:void 0;function _(N,I,D,M,O,L,k){switch(D){case R:if(N.byteLength!=I.byteLength||N.byteOffset!=I.byteOffset)return!1;N=N.buffer,I=I.buffer;case x:return!(N.byteLength!=I.byteLength||!L(new t(N),new t(I)));case c:case u:case p:return n(+N,+I);case h:return N.name==I.name&&N.message==I.message;case g:case y:return N==I+"";case m:var F=a;case T:var U=M&i;if(F||(F=s),N.size!=I.size&&!U)return!1;var B=k.get(N);if(B)return B==I;M|=l,k.set(N,I);var j=r(F(N),F(I),M,O,L,k);return k.delete(N),j;case b:if(w)return w.call(N)==w.call(I)}return!1}return I_=_,I_}var O_,MH;function GX(){if(MH)return O_;MH=1;var e=aD(),t=za();function n(r,a,s){var i=a(r);return t(r)?i:e(i,s(r))}return O_=n,O_}var L_,DH;function zX(){if(DH)return L_;DH=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,s=0,i=[];++r<a;){var l=t[r];n(l,r,t)&&(i[s++]=l)}return i}return L_=e,L_}var M_,PH;function qX(){if(PH)return M_;PH=1;function e(){return[]}return M_=e,M_}var D_,kH;function iD(){if(kH)return D_;kH=1;var e=zX(),t=qX(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(i){return i==null?[]:(i=Object(i),e(a(i),function(l){return r.call(i,l)}))}:t;return D_=s,D_}var P_,jH;function oNe(){if(jH)return P_;jH=1;var e=b9(),t=e(Object.keys,Object);return P_=t,P_}var k_,UH;function lNe(){if(UH)return k_;UH=1;var e=TM(),t=oNe(),n=Object.prototype,r=n.hasOwnProperty;function a(s){if(!e(s))return t(s);var i=[];for(var l in Object(s))r.call(s,l)&&l!="constructor"&&i.push(l);return i}return k_=a,k_}var j_,FH;function Bg(){if(FH)return j_;FH=1;var e=N9(),t=lNe(),n=nf();function r(a){return n(a)?e(a):t(a)}return j_=r,j_}var U_,$H;function YX(){if($H)return U_;$H=1;var e=GX(),t=iD(),n=Bg();function r(a){return e(a,n,t)}return U_=r,U_}var F_,BH;function cNe(){if(BH)return F_;BH=1;var e=YX(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(s,i,l,c,u,h){var m=l&t,p=e(s),g=p.length,T=e(i),y=T.length;if(g!=y&&!m)return!1;for(var b=g;b--;){var x=p[b];if(!(m?x in i:r.call(i,x)))return!1}var R=h.get(s),A=h.get(i);if(R&&A)return R==i&&A==s;var w=!0;h.set(s,i),h.set(i,s);for(var _=m;++b<g;){x=p[b];var N=s[x],I=i[x];if(c)var D=m?c(I,N,x,i,s,h):c(N,I,x,s,i,h);if(!(D===void 0?N===I||u(N,I,l,c,h):D)){w=!1;break}_||(_=x=="constructor")}if(w&&!_){var M=s.constructor,O=i.constructor;M!=O&&"constructor"in s&&"constructor"in i&&!(typeof M=="function"&&M instanceof M&&typeof O=="function"&&O instanceof O)&&(w=!1)}return h.delete(s),h.delete(i),w}return F_=a,F_}var $_,HH;function uNe(){if(HH)return $_;HH=1;var e=Lu(),t=Zi(),n=e(t,"DataView");return $_=n,$_}var B_,VH;function dNe(){if(VH)return B_;VH=1;var e=Lu(),t=Zi(),n=e(t,"Promise");return B_=n,B_}var H_,GH;function WX(){if(GH)return H_;GH=1;var e=Lu(),t=Zi(),n=e(t,"Set");return H_=n,H_}var V_,zH;function hNe(){if(zH)return V_;zH=1;var e=Lu(),t=Zi(),n=e(t,"WeakMap");return V_=n,V_}var G_,qH;function aS(){if(qH)return G_;qH=1;var e=uNe(),t=fM(),n=dNe(),r=WX(),a=hNe(),s=Bo(),i=m9(),l="[object Map]",c="[object Object]",u="[object Promise]",h="[object Set]",m="[object WeakMap]",p="[object DataView]",g=i(e),T=i(t),y=i(n),b=i(r),x=i(a),R=s;return(e&&R(new e(new ArrayBuffer(1)))!=p||t&&R(new t)!=l||n&&R(n.resolve())!=u||r&&R(new r)!=h||a&&R(new a)!=m)&&(R=function(A){var w=s(A),_=w==c?A.constructor:void 0,N=_?i(_):"";if(N)switch(N){case g:return p;case T:return l;case y:return u;case b:return h;case x:return m}return w}),G_=R,G_}var z_,YH;function fNe(){if(YH)return z_;YH=1;var e=ux(),t=VX(),n=iNe(),r=cNe(),a=aS(),s=za(),i=hx(),l=SM(),c=1,u="[object Arguments]",h="[object Array]",m="[object Object]",p=Object.prototype,g=p.hasOwnProperty;function T(y,b,x,R,A,w){var _=s(y),N=s(b),I=_?h:a(y),D=N?h:a(b);I=I==u?m:I,D=D==u?m:D;var M=I==m,O=D==m,L=I==D;if(L&&i(y)){if(!i(b))return!1;_=!0,M=!1}if(L&&!M)return w||(w=new e),_||l(y)?t(y,b,x,R,A,w):n(y,b,I,x,R,A,w);if(!(x&c)){var k=M&&g.call(y,"__wrapped__"),F=O&&g.call(b,"__wrapped__");if(k||F){var U=k?y.value():y,B=F?b.value():b;return w||(w=new e),A(U,B,x,R,w)}}return L?(w||(w=new e),r(y,b,x,R,A,w)):!1}return z_=T,z_}var q_,WH;function oD(){if(WH)return q_;WH=1;var e=fNe(),t=Js();function n(r,a,s,i,l){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,s,i,n,l)}return q_=n,q_}var Y_,XH;function mNe(){if(XH)return Y_;XH=1;var e=oD();function t(n,r){return e(n,r)}return Y_=t,Y_}var pNe=mNe();const gNe=ir(pNe);var XX=v.createContext(),ENe=function(e){var t=e.children,n=e.animate,r=n===void 0||n,a=e.config,s=a===void 0?"default":a,i=v.useMemo(function(){var l=B9(s)?X7[s]:s;return{animate:r,config:l}},[r,s]);return o.jsx(XX.Provider,{value:i,children:t})},Pa=function(){return v.useContext(XX)},TNe=function(e){var t=e.children,n=e.condition,r=e.wrapper;return n?v.cloneElement(r,{},t):t},yNe={position:"relative"},Vo=function(e){var t=e.children,n=e.theme,r=e.renderWrapper,a=r===void 0||r,s=e.isInteractive,i=s===void 0||s,l=e.animate,c=e.motionConfig,u=v.useRef(null);return o.jsx(Q0e,{theme:n,children:o.jsx(ENe,{animate:l,config:c,children:o.jsx(sxe,{container:u,children:o.jsxs(TNe,{condition:a,wrapper:o.jsx("div",{style:yNe,ref:u}),children:[t,i&&o.jsx(axe,{})]})})})})},xNe=function(e,t){return e.width===t.width&&e.height===t.height},SNe=function(e){var t=e.children,n=e.width,r=e.height,a=e.onResize,s=e.debounceResize,i=uxe({width:n,height:r},s,{equalityFn:xNe})[0];return v.useEffect(function(){a==null||a(i)},[i,a]),o.jsx(o.Fragment,{children:t(i)})},Go=function(e){var t=e.children,n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=s===void 0?0:s;return o.jsx(T7,{defaultWidth:n,defaultHeight:r,children:function(l){var c=l.width,u=l.height;return o.jsx(SNe,{width:c,height:u,onResize:a,debounceResize:i,children:t})}})};function KH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bNe(e,t){var n=typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(a,s){if(a){if(typeof a=="string")return KH(a,s);var i={}.toString.call(a).slice(8,-1);return i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set"?Array.from(a):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?KH(a,s):void 0}}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Vi(){return Vi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Vi.apply(null,arguments)}function KX(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var vNe=["id","colors"],ANe=function(e){var t=e.id,n=e.colors,r=KX(e,vNe);return o.jsx("linearGradient",Vi({id:t,x1:0,x2:0,y1:0,y2:1},r,{children:n.map(function(a){var s=a.offset,i=a.color,l=a.opacity;return o.jsx("stop",{offset:s+"%",stopColor:i,stopOpacity:l!==void 0?l:1},s)})}))},QX={linearGradient:ANe},Pm={color:"#000000",background:"#ffffff",size:4,padding:4,stagger:!1},RNe=v.memo(function(e){var t=e.id,n=e.background,r=n===void 0?Pm.background:n,a=e.color,s=a===void 0?Pm.color:a,i=e.size,l=i===void 0?Pm.size:i,c=e.padding,u=c===void 0?Pm.padding:c,h=e.stagger,m=h===void 0?Pm.stagger:h,p=l+u,g=l/2,T=u/2;return m===!0&&(p=2*l+2*u),o.jsxs("pattern",{id:t,width:p,height:p,patternUnits:"userSpaceOnUse",children:[o.jsx("rect",{width:p,height:p,fill:r}),o.jsx("circle",{cx:T+g,cy:T+g,r:g,fill:s}),m&&o.jsx("circle",{cx:1.5*u+l+g,cy:1.5*u+l+g,r:g,fill:s})]})}),Ws=function(e){return e*Math.PI/180},Hg=function(e){return 180*e/Math.PI},NNe=function(e){return e.startAngle+(e.endAngle-e.startAngle)/2},iu=function(e,t){return{x:Math.cos(e)*t,y:Math.sin(e)*t}},_Ne=function(e){var t=e%360;return t<0&&(t+=360),t},JX={svg:{align:{left:"start",center:"middle",right:"end",start:"start",middle:"middle",end:"end"},baseline:{top:"text-before-edge",center:"central",bottom:"alphabetic"}},canvas:{align:{left:"left",center:"center",right:"right",start:"left",middle:"center",end:"right"},baseline:{top:"top",center:"middle",bottom:"bottom"}}},km={spacing:5,rotation:0,background:"#000000",color:"#ffffff",lineWidth:2},wNe=v.memo(function(e){var t=e.id,n=e.spacing,r=n===void 0?km.spacing:n,a=e.rotation,s=a===void 0?km.rotation:a,i=e.background,l=i===void 0?km.background:i,c=e.color,u=c===void 0?km.color:c,h=e.lineWidth,m=h===void 0?km.lineWidth:h,p=Math.round(s)%360,g=Math.abs(r);p>180?p-=360:p>90?p-=180:p<-180?p+=360:p<-90&&(p+=180);var T,y=g,b=g;return p===0?T="\n                M 0 0 L "+y+" 0\n                M 0 "+b+" L "+y+" "+b+"\n            ":p===90?T="\n                M 0 0 L 0 "+b+"\n                M "+y+" 0 L "+y+" "+b+"\n            ":(y=Math.abs(g/Math.sin(Ws(p))),b=g/Math.sin(Ws(90-p)),T=p>0?"\n                    M 0 "+-b+" L "+2*y+" "+b+"\n                    M "+-y+" "+-b+" L "+y+" "+b+"\n                    M "+-y+" 0 L "+y+" "+2*b+"\n                ":"\n                    M "+-y+" "+b+" L "+y+" "+-b+"\n                    M "+-y+" "+2*b+" L "+2*y+" "+-b+"\n                    M 0 "+2*b+" L "+2*y+" 0\n                "),o.jsxs("pattern",{id:t,width:y,height:b,patternUnits:"userSpaceOnUse",children:[o.jsx("rect",{width:y,height:b,fill:l,stroke:"rgba(255, 0, 0, 0.1)",strokeWidth:0}),o.jsx("path",{d:T,strokeWidth:m,stroke:u,strokeLinecap:"square"})]})}),jm={color:"#000000",background:"#ffffff",size:4,padding:4,stagger:!1},CNe=v.memo(function(e){var t=e.id,n=e.color,r=n===void 0?jm.color:n,a=e.background,s=a===void 0?jm.background:a,i=e.size,l=i===void 0?jm.size:i,c=e.padding,u=c===void 0?jm.padding:c,h=e.stagger,m=h===void 0?jm.stagger:h,p=l+u,g=u/2;return m===!0&&(p=2*l+2*u),o.jsxs("pattern",{id:t,width:p,height:p,patternUnits:"userSpaceOnUse",children:[o.jsx("rect",{width:p,height:p,fill:s}),o.jsx("rect",{x:g,y:g,width:l,height:l,fill:r}),m&&o.jsx("rect",{x:1.5*u+l,y:1.5*u+l,width:l,height:l,fill:r})]})}),ZX={patternDots:RNe,patternLines:wNe,patternSquares:CNe},INe=["type"],QH=Vi({},QX,ZX),ONe=v.memo(function(e){var t=e.defs;return!t||t.length<1?null:o.jsx("defs",{"aria-hidden":!0,children:t.map(function(n){var r=n.type,a=KX(n,INe);return QH[r]?v.createElement(QH[r],Vi({key:a.id},a)):null})})}),Vg=v.forwardRef(function(e,t){var n=e.width,r=e.height,a=e.margin,s=e.defs,i=e.children,l=e.role,c=e.ariaLabel,u=e.ariaLabelledBy,h=e.ariaDescribedBy,m=e.isFocusable,p=_n();return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:n,height:r,role:l,"aria-label":c,"aria-labelledby":u,"aria-describedby":h,focusable:m,tabIndex:m?0:void 0,ref:t,children:[o.jsx(ONe,{defs:s}),o.jsx("rect",{width:n,height:r,fill:p.background}),o.jsx("g",{transform:"translate("+a.left+","+a.top+")",children:i})]})}),LNe=v.memo(function(e){var t=e.size,n=e.color,r=e.borderWidth,a=e.borderColor;return o.jsx("circle",{r:t/2,fill:n,stroke:a,strokeWidth:r,style:{pointerEvents:"none"}})}),MNe=v.memo(function(e){var t=e.x,n=e.y,r=e.symbol,a=r===void 0?LNe:r,s=e.size,i=e.datum,l=e.color,c=e.borderWidth,u=e.borderColor,h=e.label,m=e.labelTextAnchor,p=m===void 0?"middle":m,g=e.labelYOffset,T=g===void 0?-12:g,y=e.ariaLabel,b=e.ariaLabelledBy,x=e.ariaDescribedBy,R=e.ariaHidden,A=e.ariaDisabled,w=e.isFocusable,_=w!==void 0&&w,N=e.tabIndex,I=N===void 0?0:N,D=e.onFocus,M=e.onBlur,O=e.testId,L=_n(),k=Pa(),F=k.animate,U=k.config,B=Ji({transform:"translate("+t+", "+n+")",config:U,immediate:!F}),j=v.useCallback(function(K){D==null||D(i,K)},[D,i]),G=v.useCallback(function(K){M==null||M(i,K)},[M,i]);return o.jsxs(Vn.g,{transform:B.transform,style:{pointerEvents:"none"},focusable:_,tabIndex:_?I:void 0,"aria-label":y,"aria-labelledby":b,"aria-describedby":x,"aria-disabled":A,"aria-hidden":R,onFocus:_&&D?j:void 0,onBlur:_&&M?G:void 0,"data-testid":O,children:[v.createElement(a,{size:s,color:l,datum:i,borderWidth:c,borderColor:u}),h&&o.jsx("text",{textAnchor:p,y:T,style:V0e(L.dots.text),children:h})]})}),DNe=v.memo(function(e){var t=e.width,n=e.height,r=e.axis,a=e.scale,s=e.value,i=e.lineStyle,l=e.textStyle,c=e.legend,u=e.legendNode,h=e.legendPosition,m=h===void 0?"top-right":h,p=e.legendOffsetX,g=p===void 0?14:p,T=e.legendOffsetY,y=T===void 0?14:T,b=e.legendOrientation,x=b===void 0?"horizontal":b,R=_n(),A=0,w=0,_=0,N=0;if(r==="y"?(_=a(s),w=t):(A=a(s),N=n),c&&!u){var I=function(D){var M=D.axis,O=D.width,L=D.height,k=D.position,F=D.offsetX,U=D.offsetY,B=D.orientation,j=0,G=0,K=B==="vertical"?-90:0,J="start";if(M==="x")switch(k){case"top-left":j=-F,G=U,J="end";break;case"top":G=-U,J=B==="horizontal"?"middle":"start";break;case"top-right":j=F,G=U,J=B==="horizontal"?"start":"end";break;case"right":j=F,G=L/2,J=B==="horizontal"?"start":"middle";break;case"bottom-right":j=F,G=L-U,J="start";break;case"bottom":G=L+U,J=B==="horizontal"?"middle":"end";break;case"bottom-left":G=L-U,j=-F,J=B==="horizontal"?"end":"start";break;case"left":j=-F,G=L/2,J=B==="horizontal"?"end":"middle"}else switch(k){case"top-left":j=F,G=-U,J="start";break;case"top":j=O/2,G=-U,J=B==="horizontal"?"middle":"start";break;case"top-right":j=O-F,G=-U,J=B==="horizontal"?"end":"start";break;case"right":j=O+F,J=B==="horizontal"?"start":"middle";break;case"bottom-right":j=O-F,G=U,J="end";break;case"bottom":j=O/2,G=U,J=B==="horizontal"?"middle":"end";break;case"bottom-left":j=F,G=U,J=B==="horizontal"?"start":"end";break;case"left":j=-F,J=B==="horizontal"?"end":"middle"}return{x:j,y:G,rotation:K,textAnchor:J}}({axis:r,width:t,height:n,position:m,offsetX:g,offsetY:y,orientation:x});u=o.jsx("text",{transform:"translate("+I.x+", "+I.y+") rotate("+I.rotation+")",textAnchor:I.textAnchor,dominantBaseline:"central",style:l,children:c})}return o.jsxs("g",{transform:"translate("+A+", "+_+")",children:[o.jsx("line",{x1:0,x2:w,y1:0,y2:N,stroke:R.markers.lineColor,strokeWidth:R.markers.lineStrokeWidth,style:i}),u]})}),lD=v.memo(function(e){var t=e.markers,n=e.width,r=e.height,a=e.xScale,s=e.yScale;return t&&t.length!==0?t.map(function(i,l){return o.jsx(DNe,Vi({},i,{width:n,height:r,scale:i.axis==="y"?s:a}),l)}):null}),cD=function(e){var t=Pa(),n=t.animate,r=t.config,a=function(l){var c=v.useRef();return v.useEffect(function(){c.current=l},[l]),c.current}(e),s=v.useMemo(function(){return q9(a,e)},[a,e]),i=Ji({from:{value:0},to:{value:1},reset:!0,config:r,immediate:!n}).value;return Gl(i,s)};v.createContext(void 0);var XO={basis:uSe,basisClosed:dSe,basisOpen:hSe,bundle:fSe,cardinal:mSe,cardinalClosed:pSe,cardinalOpen:gSe,catmullRom:ESe,catmullRomClosed:TSe,catmullRomOpen:ySe,linear:MM,linearClosed:xSe,monotoneX:SSe,monotoneY:bSe,natural:vSe,step:ASe,stepAfter:NSe,stepBefore:RSe},uD=Object.keys(XO);uD.filter(function(e){return e.endsWith("Closed")});Q9(uD,"bundle","basisClosed","basisOpen","cardinalClosed","cardinalOpen","catmullRomClosed","catmullRomOpen","linearClosed");Q9(uD,"bundle","basisClosed","basisOpen","cardinalClosed","cardinalOpen","catmullRomClosed","catmullRomOpen","linearClosed");var eK=function(e){if(!XO[e])throw new TypeError("'"+e+"', is not a valid curve interpolator identifier.");return XO[e]};bt(Cx),bt(Ix),bt(Ox),bt(Lx),bt(Mx),bt(Dx),bt(Px),bt(kx),bt(jx),bt(Kx),bt(Qx),bt(Jx),bt(tS),bt(Zx),bt(eS),bt(Ux),bt(Fx),bt($x),bt(Bx),bt(Hx),bt(Vx),bt(Gx),bt(zx),bt(qx),bt(Yx),bt(Wx),bt(Xx);bt(Cx),bt(Ix),bt(Ox),bt(Lx),bt(Mx),bt(Dx),bt(Px),bt(kx),bt(jx),bt(Kx),bt(Qx),bt(Jx),bt(tS),bt(Zx),bt(eS),bt(Ux),bt(Fx),bt($x),bt(Bx),bt(Hx),bt(Vx),bt(Gx),bt(zx),bt(qx),bt(Yx),bt(Wx),bt(Xx);Kc(wX);var tK={top:0,right:0,bottom:0,left:0},zo=function(e,t,n){return n===void 0&&(n={}),v.useMemo(function(){var r=Vi({},tK,n);return{margin:r,innerWidth:e-r.left-r.right,innerHeight:t-r.top-r.bottom,outerWidth:e,outerHeight:t}},[e,t,n])},PNe=function(){var e=v.useRef(null),t=v.useState({left:0,top:0,width:0,height:0}),n=t[0],r=t[1],a=v.useState(function(){return typeof ResizeObserver=="undefined"?null:new ResizeObserver(function(s){var i=s[0];return r(i.contentRect)})})[0];return v.useEffect(function(){return e.current&&a!==null&&a.observe(e.current),function(){a!==null&&a.disconnect()}},[a]),[e,n]},kNe=function(e){return typeof e=="function"?e:typeof e=="string"?e.indexOf("time:")===0?FX(e.slice("5")):OX(e):function(t){return""+t}},ql=function(e){return v.useMemo(function(){return kNe(e)},[e])},jNe=function(e,t){var n=JM(e)?e:function(r){return Ti(r,e)};return n},nK=function(e){return JM(e)?e:function(t){return Ti(t,e)}},Gi=function(e){return v.useMemo(function(){return nK(e)},[e])},rK=function(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))},UNe=function(e,t,n,r){var a=Math.atan2(r-t,n-e)-Math.PI/2;return a>0?a:2*Math.PI+a},dD=function(e,t,n,r,a,s){return e<=a&&a<=e+n&&t<=s&&s<=t+r},ou=function(e,t){var n,r="touches"in t?t.touches[0]:t,a=r.clientX,s=r.clientY,i=e.getBoundingClientRect(),l=(n=e.getBBox!==void 0?e.getBBox():{width:e.offsetWidth||0,height:e.offsetHeight||0}).width===i.width?1:n.width/i.width;return[(a-i.left)*l,(s-i.top)*l]},FNe=Object.keys(QX),$Ne=Object.keys(ZX),BNe=function(e,t,n){if(e==="*")return!0;if(JM(e))return e(t);if(rS(e)){var r=n?Ti(t,n):t;return gNe(rNe(r,Object.keys(e)),e)}return!1},hD=function(e,t,n,r){var a=r===void 0?{}:r,s=a.dataKey,i=a.colorKey,l=i===void 0?"color":i,c=a.targetKey,u=c===void 0?"fill":c,h=[],m={};return e.length&&t.length&&(h=[].concat(e),t.forEach(function(p){for(var g,T=function(){var b=g.value,x=b.id,R=b.match;if(BNe(R,p,s)){var A=e.find(function(L){return L.id===x});if(A){if($Ne.includes(A.type))if(A.background==="inherit"||A.color==="inherit"){var w=Ti(p,l),_=A.background,N=A.color,I=x;A.background==="inherit"&&(I=I+".bg."+w,_=w),A.color==="inherit"&&(I=I+".fg."+w,N=w),gp(p,u,"url(#"+I+")"),m[I]||(h.push(Vi({},A,{id:I,background:_,color:N})),m[I]=1)}else gp(p,u,"url(#"+x+")");else if(FNe.includes(A.type))if(A.colors.map(function(L){return L.color}).includes("inherit")){var D=Ti(p,l),M=x,O=Vi({},A,{colors:A.colors.map(function(L,k){return L.color!=="inherit"?L:(M=M+"."+k+"."+D,Vi({},L,{color:L.color==="inherit"?D:L.color}))})});O.id=M,gp(p,u,"url(#"+M+")"),m[M]||(h.push(O),m[M]=1)}else gp(p,u,"url(#"+x+")")}return 1}},y=bNe(n);!(g=y()).done&&!T(););})),h};function sS(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var a=0,s=t;a<s.length;a++){var i=s[a];typeof i=="function"?i(r):i!=null&&(i.current=r)}}}var xu=function(e,t){e.font=(t.fontWeight?t.fontWeight+" ":"")+t.fontSize+"px "+t.fontFamily},Su=function(e,t,n,r,a){r===void 0&&(r=0),a===void 0&&(a=0),t.outlineWidth>0&&(e.strokeStyle=t.outlineColor,e.lineWidth=2*t.outlineWidth,e.lineJoin="round",e.strokeText(n,r,a)),e.fillStyle=t.fill,e.fillText(n,r,a)};function Dp(){return Dp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dp.apply(null,arguments)}function JH(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var HNe=["style","children"],VNe=["outlineWidth","outlineColor","outlineOpacity"],cf=function(e){var t=e.style,n=e.children,r=JH(e,HNe),a=t.outlineWidth,s=t.outlineColor,i=t.outlineOpacity,l=JH(t,VNe);return o.jsxs(o.Fragment,{children:[a>0&&o.jsx(Vn.text,Dp({},r,{style:Dp({},l,{strokeWidth:2*a,stroke:s,strokeOpacity:i,strokeLinejoin:"round"}),children:n})),o.jsx(Vn.text,Dp({},r,{style:l,children:n}))]})},W_=new Date,X_=new Date;function qo(e,t,n,r){function a(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return a.floor=function(s){return e(s=new Date(+s)),s},a.ceil=function(s){return e(s=new Date(s-1)),t(s,1),e(s),s},a.round=function(s){var i=a(s),l=a.ceil(s);return s-i<l-s?i:l},a.offset=function(s,i){return t(s=new Date(+s),i==null?1:Math.floor(i)),s},a.range=function(s,i,l){var c=[],u;if(s=a.ceil(s),l=l==null?1:Math.floor(l),!(s<i)||!(l>0))return c;do c.push(u=new Date(+s)),t(s,l),e(s);while(u<s&&s<i);return c},a.filter=function(s){return qo(function(i){if(i>=i)for(;e(i),!s(i);)i.setTime(i-1)},function(i,l){if(i>=i)if(l<0)for(;++l<=0;)for(;t(i,-1),!s(i););else for(;--l>=0;)for(;t(i,1),!s(i););})},n&&(a.count=function(s,i){return W_.setTime(+s),X_.setTime(+i),e(W_),e(X_),Math.floor(n(W_,X_))},a.every=function(s){return s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?a.filter(r?function(i){return r(i)%s===0}:function(i){return a.count(0,i)%s===0}):a}),a}const GNe=1e3,fD=GNe*60,zNe=fD*60,mD=zNe*24,aK=mD*7;var pD=qo(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*fD)/mD,e=>e.getDate()-1);pD.range;function Uu(e){return qo(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n*7)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*fD)/aK})}var sK=Uu(0),l0=Uu(1),qNe=Uu(2),YNe=Uu(3),Fh=Uu(4),WNe=Uu(5),XNe=Uu(6);sK.range;l0.range;qNe.range;YNe.range;Fh.range;WNe.range;XNe.range;var bu=qo(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});bu.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:qo(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)})};bu.range;var gD=qo(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/mD},function(e){return e.getUTCDate()-1});gD.range;function Fu(e){return qo(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n*7)},function(t,n){return(n-t)/aK})}var iK=Fu(0),c0=Fu(1),KNe=Fu(2),QNe=Fu(3),$h=Fu(4),JNe=Fu(5),ZNe=Fu(6);iK.range;c0.range;KNe.range;QNe.range;$h.range;JNe.range;ZNe.range;var vu=qo(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});vu.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:qo(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})};vu.range;function K_(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 Q_(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 Um(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function e_e(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,s=e.days,i=e.shortDays,l=e.months,c=e.shortMonths,u=Fm(a),h=$m(a),m=Fm(s),p=$m(s),g=Fm(i),T=$m(i),y=Fm(l),b=$m(l),x=Fm(c),R=$m(c),A={a:G,A:K,b:J,B:$,c:null,d:aV,e:aV,f:v_e,g:M_e,G:P_e,H:x_e,I:S_e,j:b_e,L:oK,m:A_e,M:R_e,p:X,q:Z,Q:oV,s:lV,S:N_e,u:__e,U:w_e,V:C_e,w:I_e,W:O_e,x:null,X:null,y:L_e,Y:D_e,Z:k_e,"%":iV},w={a:V,A:te,b:ae,B:ne,c:null,d:sV,e:sV,f:$_e,g:K_e,G:J_e,H:j_e,I:U_e,j:F_e,L:cK,m:B_e,M:H_e,p:ce,q:ie,Q:oV,s:lV,S:V_e,u:G_e,U:z_e,V:q_e,w:Y_e,W:W_e,x:null,X:null,y:X_e,Y:Q_e,Z:Z_e,"%":iV},_={a:O,A:L,b:k,B:F,c:U,d:nV,e:nV,f:g_e,g:tV,G:eV,H:rV,I:rV,j:h_e,L:p_e,m:d_e,M:f_e,p:M,q:u_e,Q:T_e,s:y_e,S:m_e,u:s_e,U:i_e,V:o_e,w:a_e,W:l_e,x:B,X:j,y:tV,Y:eV,Z:c_e,"%":E_e};A.x=N(n,A),A.X=N(r,A),A.c=N(t,A),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w);function N(W,Q){return function(se){var z=[],xe=-1,le=0,pe=W.length,_e,re,Se;for(se instanceof Date||(se=new Date(+se));++xe<pe;)W.charCodeAt(xe)===37&&(z.push(W.slice(le,xe)),(re=ZH[_e=W.charAt(++xe)])!=null?_e=W.charAt(++xe):re=_e==="e"?" ":"0",(Se=Q[_e])&&(_e=Se(se,re)),z.push(_e),le=xe+1);return z.push(W.slice(le,xe)),z.join("")}}function I(W,Q){return function(se){var z=Um(1900,void 0,1),xe=D(z,W,se+="",0),le,pe;if(xe!=se.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(Q&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(le=Q_(Um(z.y,0,1)),pe=le.getUTCDay(),le=pe>4||pe===0?c0.ceil(le):c0(le),le=gD.offset(le,(z.V-1)*7),z.y=le.getUTCFullYear(),z.m=le.getUTCMonth(),z.d=le.getUTCDate()+(z.w+6)%7):(le=K_(Um(z.y,0,1)),pe=le.getDay(),le=pe>4||pe===0?l0.ceil(le):l0(le),le=pD.offset(le,(z.V-1)*7),z.y=le.getFullYear(),z.m=le.getMonth(),z.d=le.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),pe="Z"in z?Q_(Um(z.y,0,1)).getUTCDay():K_(Um(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(pe+5)%7:z.w+z.U*7-(pe+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,Q_(z)):K_(z)}}function D(W,Q,se,z){for(var xe=0,le=Q.length,pe=se.length,_e,re;xe<le;){if(z>=pe)return-1;if(_e=Q.charCodeAt(xe++),_e===37){if(_e=Q.charAt(xe++),re=_[_e in ZH?Q.charAt(xe++):_e],!re||(z=re(W,se,z))<0)return-1}else if(_e!=se.charCodeAt(z++))return-1}return z}function M(W,Q,se){var z=u.exec(Q.slice(se));return z?(W.p=h.get(z[0].toLowerCase()),se+z[0].length):-1}function O(W,Q,se){var z=g.exec(Q.slice(se));return z?(W.w=T.get(z[0].toLowerCase()),se+z[0].length):-1}function L(W,Q,se){var z=m.exec(Q.slice(se));return z?(W.w=p.get(z[0].toLowerCase()),se+z[0].length):-1}function k(W,Q,se){var z=x.exec(Q.slice(se));return z?(W.m=R.get(z[0].toLowerCase()),se+z[0].length):-1}function F(W,Q,se){var z=y.exec(Q.slice(se));return z?(W.m=b.get(z[0].toLowerCase()),se+z[0].length):-1}function U(W,Q,se){return D(W,t,Q,se)}function B(W,Q,se){return D(W,n,Q,se)}function j(W,Q,se){return D(W,r,Q,se)}function G(W){return i[W.getDay()]}function K(W){return s[W.getDay()]}function J(W){return c[W.getMonth()]}function $(W){return l[W.getMonth()]}function X(W){return a[+(W.getHours()>=12)]}function Z(W){return 1+~~(W.getMonth()/3)}function V(W){return i[W.getUTCDay()]}function te(W){return s[W.getUTCDay()]}function ae(W){return c[W.getUTCMonth()]}function ne(W){return l[W.getUTCMonth()]}function ce(W){return a[+(W.getUTCHours()>=12)]}function ie(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var Q=N(W+="",A);return Q.toString=function(){return W},Q},parse:function(W){var Q=I(W+="",!1);return Q.toString=function(){return W},Q},utcFormat:function(W){var Q=N(W+="",w);return Q.toString=function(){return W},Q},utcParse:function(W){var Q=I(W+="",!0);return Q.toString=function(){return W},Q}}}var ZH={"-":"",_:" ",0:"0"},ra=/^\s*\d+/,t_e=/^%/,n_e=/[\\^$*+?|[\]().{}]/g;function bn(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",s=a.length;return r+(s<n?new Array(n-s+1).join(t)+a:a)}function r_e(e){return e.replace(n_e,"\\$&")}function Fm(e){return new RegExp("^(?:"+e.map(r_e).join("|")+")","i")}function $m(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function a_e(e,t,n){var r=ra.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function s_e(e,t,n){var r=ra.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function i_e(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function o_e(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function l_e(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function eV(e,t,n){var r=ra.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function tV(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function c_e(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function u_e(e,t,n){var r=ra.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function d_e(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function nV(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function h_e(e,t,n){var r=ra.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function rV(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function f_e(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function m_e(e,t,n){var r=ra.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function p_e(e,t,n){var r=ra.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function g_e(e,t,n){var r=ra.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function E_e(e,t,n){var r=t_e.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function T_e(e,t,n){var r=ra.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function y_e(e,t,n){var r=ra.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function aV(e,t){return bn(e.getDate(),t,2)}function x_e(e,t){return bn(e.getHours(),t,2)}function S_e(e,t){return bn(e.getHours()%12||12,t,2)}function b_e(e,t){return bn(1+pD.count(bu(e),e),t,3)}function oK(e,t){return bn(e.getMilliseconds(),t,3)}function v_e(e,t){return oK(e,t)+"000"}function A_e(e,t){return bn(e.getMonth()+1,t,2)}function R_e(e,t){return bn(e.getMinutes(),t,2)}function N_e(e,t){return bn(e.getSeconds(),t,2)}function __e(e){var t=e.getDay();return t===0?7:t}function w_e(e,t){return bn(sK.count(bu(e)-1,e),t,2)}function lK(e){var t=e.getDay();return t>=4||t===0?Fh(e):Fh.ceil(e)}function C_e(e,t){return e=lK(e),bn(Fh.count(bu(e),e)+(bu(e).getDay()===4),t,2)}function I_e(e){return e.getDay()}function O_e(e,t){return bn(l0.count(bu(e)-1,e),t,2)}function L_e(e,t){return bn(e.getFullYear()%100,t,2)}function M_e(e,t){return e=lK(e),bn(e.getFullYear()%100,t,2)}function D_e(e,t){return bn(e.getFullYear()%1e4,t,4)}function P_e(e,t){var n=e.getDay();return e=n>=4||n===0?Fh(e):Fh.ceil(e),bn(e.getFullYear()%1e4,t,4)}function k_e(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+bn(t/60|0,"0",2)+bn(t%60,"0",2)}function sV(e,t){return bn(e.getUTCDate(),t,2)}function j_e(e,t){return bn(e.getUTCHours(),t,2)}function U_e(e,t){return bn(e.getUTCHours()%12||12,t,2)}function F_e(e,t){return bn(1+gD.count(vu(e),e),t,3)}function cK(e,t){return bn(e.getUTCMilliseconds(),t,3)}function $_e(e,t){return cK(e,t)+"000"}function B_e(e,t){return bn(e.getUTCMonth()+1,t,2)}function H_e(e,t){return bn(e.getUTCMinutes(),t,2)}function V_e(e,t){return bn(e.getUTCSeconds(),t,2)}function G_e(e){var t=e.getUTCDay();return t===0?7:t}function z_e(e,t){return bn(iK.count(vu(e)-1,e),t,2)}function uK(e){var t=e.getUTCDay();return t>=4||t===0?$h(e):$h.ceil(e)}function q_e(e,t){return e=uK(e),bn($h.count(vu(e),e)+(vu(e).getUTCDay()===4),t,2)}function Y_e(e){return e.getUTCDay()}function W_e(e,t){return bn(c0.count(vu(e)-1,e),t,2)}function X_e(e,t){return bn(e.getUTCFullYear()%100,t,2)}function K_e(e,t){return e=uK(e),bn(e.getUTCFullYear()%100,t,2)}function Q_e(e,t){return bn(e.getUTCFullYear()%1e4,t,4)}function J_e(e,t){var n=e.getUTCDay();return e=n>=4||n===0?$h(e):$h.ceil(e),bn(e.getUTCFullYear()%1e4,t,4)}function Z_e(){return"+0000"}function iV(){return"%"}function oV(e){return+e}function lV(e){return Math.floor(+e/1e3)}var wd,dK;ewe({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 ewe(e){return wd=e_e(e),dK=wd.format,wd.parse,wd.utcFormat,wd.utcParse,wd}function twe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function u0(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function nwe(e){return e=u0(Math.abs(e)),e?e[1]:NaN}function rwe(e,t){return function(n,r){for(var a=n.length,s=[],i=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(a-=l,a+l)),!((c+=l+1)>r));)l=e[i=(i+1)%e.length];return s.reverse().join(t)}}function awe(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var swe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function KO(e){if(!(t=swe.exec(e)))throw new Error("invalid format: "+e);var t;return new ED({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]})}KO.prototype=ED.prototype;function ED(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+""}ED.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 iwe(e){e:for(var t=e.length,n=1,r=-1,a;n<t;++n)switch(e[n]){case".":r=a=n;break;case"0":r===0&&(r=n),a=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(a+1):e}var hK;function owe(e,t){var n=u0(e,t);if(!n)return e+"";var r=n[0],a=n[1],s=a-(hK=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,i=r.length;return s===i?r:s>i?r+new Array(s-i+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+u0(e,Math.max(0,t+s-1))[0]}function cV(e,t){var n=u0(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}const uV={"%":function(e,t){return(e*100).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:twe,e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return cV(e*100,t)},r:cV,s:owe,X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function dV(e){return e}var hV=Array.prototype.map,fV=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function lwe(e){var t=e.grouping===void 0||e.thousands===void 0?dV:rwe(hV.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",a=e.decimal+"",s=e.numerals===void 0?dV:awe(hV.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",l=e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(m){m=KO(m);var p=m.fill,g=m.align,T=m.sign,y=m.symbol,b=m.zero,x=m.width,R=m.comma,A=m.precision,w=m.trim,_=m.type;_==="n"?(R=!0,_="g"):uV[_]||(A===void 0&&(A=12),w=!0,_="g"),(b||p==="0"&&g==="=")&&(b=!0,p="0",g="=");var N=y==="$"?n:y==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",I=y==="$"?r:/[%p]/.test(_)?i:"",D=uV[_],M=/[defgprs%]/.test(_);A=A===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function O(L){var k=N,F=I,U,B,j;if(_==="c")F=D(L)+F,L="";else{L=+L;var G=L<0||1/L<0;if(L=isNaN(L)?c:D(Math.abs(L),A),w&&(L=iwe(L)),G&&+L==0&&T!=="+"&&(G=!1),k=(G?T==="("?T:l:T==="-"||T==="("?"":T)+k,F=(_==="s"?fV[8+hK/3]:"")+F+(G&&T==="("?")":""),M){for(U=-1,B=L.length;++U<B;)if(j=L.charCodeAt(U),48>j||j>57){F=(j===46?a+L.slice(U+1):L.slice(U))+F,L=L.slice(0,U);break}}}R&&!b&&(L=t(L,1/0));var K=k.length+L.length+F.length,J=K<x?new Array(x-K+1).join(p):"";switch(R&&b&&(L=t(J+L,J.length?x-F.length:1/0),J=""),g){case"<":L=k+L+F+J;break;case"=":L=k+J+L+F;break;case"^":L=J.slice(0,K=J.length>>1)+k+L+F+J.slice(K);break;default:L=J+k+L+F;break}return s(L)}return O.toString=function(){return m+""},O}function h(m,p){var g=u((m=KO(m),m.type="f",m)),T=Math.max(-8,Math.min(8,Math.floor(nwe(p)/3)))*3,y=Math.pow(10,-T),b=fV[8+T/3];return function(x){return g(y*x)+b}}return{format:u,formatPrefix:h}}var FT,fK;cwe({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});function cwe(e){return FT=lwe(e),fK=FT.format,FT.formatPrefix,FT}var J_,mV;function uwe(){if(mV)return J_;mV=1;function e(){}return J_=e,J_}var Z_,pV;function dwe(){if(pV)return Z_;pV=1;var e=WX(),t=uwe(),n=sD(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(s){return new e(s)}:t;return Z_=a,Z_}var ew,gV;function mK(){if(gV)return ew;gV=1;var e=IM(),t=X9(),n=K9(),r=OM(),a=dwe(),s=sD(),i=200;function l(c,u,h){var m=-1,p=t,g=c.length,T=!0,y=[],b=y;if(h)T=!1,p=n;else if(g>=i){var x=u?null:a(c);if(x)return s(x);T=!1,p=r,b=new e}else b=u?[]:y;e:for(;++m<g;){var R=c[m],A=u?u(R):R;if(R=h||R!==0?R:0,T&&A===A){for(var w=b.length;w--;)if(b[w]===A)continue e;u&&b.push(A),y.push(R)}else p(b,A,h)||(b!==y&&b.push(A),y.push(R))}return y}return ew=l,ew}var tw,EV;function hwe(){if(EV)return tw;EV=1;var e=mK();function t(n){return n&&n.length?e(n):[]}return tw=t,tw}var fwe=hwe();const TV=ir(fwe);var nw,yV;function mwe(){if(yV)return nw;yV=1;var e=ux(),t=oD(),n=1,r=2;function a(s,i,l,c){var u=l.length,h=u,m=!c;if(s==null)return!h;for(s=Object(s);u--;){var p=l[u];if(m&&p[2]?p[1]!==s[p[0]]:!(p[0]in s))return!1}for(;++u<h;){p=l[u];var g=p[0],T=s[g],y=p[1];if(m&&p[2]){if(T===void 0&&!(g in s))return!1}else{var b=new e;if(c)var x=c(T,y,g,s,i,b);if(!(x===void 0?t(y,T,n|r,c,b):x))return!1}}return!0}return nw=a,nw}var rw,xV;function pK(){if(xV)return rw;xV=1;var e=eo();function t(n){return n===n&&!e(n)}return rw=t,rw}var aw,SV;function pwe(){if(SV)return aw;SV=1;var e=pK(),t=Bg();function n(r){for(var a=t(r),s=a.length;s--;){var i=a[s],l=r[i];a[s]=[i,l,e(l)]}return a}return aw=n,aw}var sw,bV;function gK(){if(bV)return sw;bV=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return sw=e,sw}var iw,vV;function gwe(){if(vV)return iw;vV=1;var e=mwe(),t=pwe(),n=gK();function r(a){var s=t(a);return s.length==1&&s[0][2]?n(s[0][0],s[0][1]):function(i){return i===a||e(i,a,s)}}return iw=r,iw}var ow,AV;function Ewe(){if(AV)return ow;AV=1;var e=oD(),t=L9(),n=$X(),r=AM(),a=pK(),s=gK(),i=of(),l=1,c=2;function u(h,m){return r(h)&&a(m)?s(i(h),m):function(p){var g=t(p,h);return g===void 0&&g===m?n(p,h):e(m,g,l|c)}}return ow=u,ow}var lw,RV;function Twe(){if(RV)return lw;RV=1;function e(t){return function(n){return n==null?void 0:n[t]}}return lw=e,lw}var cw,NV;function ywe(){if(NV)return cw;NV=1;var e=Fg();function t(n){return function(r){return e(r,n)}}return cw=t,cw}var uw,_V;function xwe(){if(_V)return uw;_V=1;var e=Twe(),t=ywe(),n=AM(),r=of();function a(s){return n(s)?e(r(s)):t(s)}return uw=a,uw}var dw,wV;function TD(){if(wV)return dw;wV=1;var e=gwe(),t=Ewe(),n=px(),r=za(),a=xwe();function s(i){return typeof i=="function"?i:i==null?n:typeof i=="object"?r(i)?t(i[0],i[1]):e(i):a(i)}return dw=s,dw}var hw,CV;function Swe(){if(CV)return hw;CV=1;var e=TD(),t=mK();function n(r,a){return r&&r.length?t(r,e(a,2)):[]}return hw=n,hw}var bwe=Swe();const QO=ir(bwe);var fw,IV;function vwe(){if(IV)return fw;IV=1;var e=E9(),t=Bg();function n(r,a){return r&&e(r,a,t)}return fw=n,fw}var mw,OV;function Awe(){if(OV)return mw;OV=1;var e=nf();function t(n,r){return function(a,s){if(a==null)return a;if(!e(a))return n(a,s);for(var i=a.length,l=r?i:-1,c=Object(a);(r?l--:++l<i)&&s(c[l],l,c)!==!1;);return a}}return mw=t,mw}var pw,LV;function EK(){if(LV)return pw;LV=1;var e=vwe(),t=Awe(),n=t(e);return pw=n,pw}var gw,MV;function Rwe(){if(MV)return gw;MV=1;var e=EK(),t=nf();function n(r,a){var s=-1,i=t(r)?Array(r.length):[];return e(r,function(l,c,u){i[++s]=a(l,c,u)}),i}return gw=n,gw}var Ew,DV;function Nwe(){if(DV)return Ew;DV=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return Ew=e,Ew}var Tw,PV;function _we(){if(PV)return Tw;PV=1;var e=gx();function t(n,r){if(n!==r){var a=n!==void 0,s=n===null,i=n===n,l=e(n),c=r!==void 0,u=r===null,h=r===r,m=e(r);if(!u&&!m&&!l&&n>r||l&&c&&h&&!u&&!m||s&&c&&h||!a&&h||!i)return 1;if(!s&&!l&&!m&&n<r||m&&a&&i&&!s&&!l||u&&a&&i||!c&&i||!h)return-1}return 0}return Tw=t,Tw}var yw,kV;function wwe(){if(kV)return yw;kV=1;var e=_we();function t(n,r,a){for(var s=-1,i=n.criteria,l=r.criteria,c=i.length,u=a.length;++s<c;){var h=e(i[s],l[s]);if(h){if(s>=u)return h;var m=a[s];return h*(m=="desc"?-1:1)}}return n.index-r.index}return yw=t,yw}var xw,jV;function Cwe(){if(jV)return xw;jV=1;var e=Ex(),t=Fg(),n=TD(),r=Rwe(),a=Nwe(),s=rf(),i=wwe(),l=px(),c=za();function u(h,m,p){m.length?m=e(m,function(y){return c(y)?function(b){return t(b,y.length===1?y[0]:y)}:y}):m=[l];var g=-1;m=e(m,s(n));var T=r(h,function(y,b,x){var R=e(m,function(A){return A(y)});return{criteria:R,index:++g,value:y}});return a(T,function(y,b){return i(y,b,p)})}return xw=u,xw}var Sw,UV;function Iwe(){if(UV)return Sw;UV=1;var e=BX(),t=Cwe(),n=vM(),r=C9(),a=n(function(s,i){if(s==null)return[];var l=i.length;return l>1&&r(s,i[0],i[1])?i=[]:l>2&&r(i[0],i[1],i[2])&&(i=[i[0]]),t(s,e(i,1),[])});return Sw=a,Sw}var Owe=Iwe();const Lwe=ir(Owe);var bw,FV;function Mwe(){if(FV)return bw;FV=1;var e=Bo(),t=Js(),n="[object Date]";function r(a){return t(a)&&e(a)==n}return bw=r,bw}var vw,$V;function Dwe(){if($V)return vw;$V=1;var e=Mwe(),t=rf(),n=fx(),r=n&&n.isDate,a=r?t(r):e;return vw=a,vw}var Pwe=Dwe();const kwe=ir(Pwe);var Aw=new Date,Rw=new Date;function jr(e,t,n,r){function a(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return a.floor=function(s){return e(s=new Date(+s)),s},a.ceil=function(s){return e(s=new Date(s-1)),t(s,1),e(s),s},a.round=function(s){var i=a(s),l=a.ceil(s);return s-i<l-s?i:l},a.offset=function(s,i){return t(s=new Date(+s),i==null?1:Math.floor(i)),s},a.range=function(s,i,l){var c=[],u;if(s=a.ceil(s),l=l==null?1:Math.floor(l),!(s<i)||!(l>0))return c;do c.push(u=new Date(+s)),t(s,l),e(s);while(u<s&&s<i);return c},a.filter=function(s){return jr(function(i){if(i>=i)for(;e(i),!s(i);)i.setTime(i-1)},function(i,l){if(i>=i)if(l<0)for(;++l<=0;)for(;t(i,-1),!s(i););else for(;--l>=0;)for(;t(i,1),!s(i););})},n&&(a.count=function(s,i){return Aw.setTime(+s),Rw.setTime(+i),e(Aw),e(Rw),Math.floor(n(Aw,Rw))},a.every=function(s){return s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?a.filter(r?function(i){return r(i)%s===0}:function(i){return a.count(0,i)%s===0}):a}),a}var Tg=jr(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});Tg.every=function(e){return e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?jr(function(t){t.setTime(Math.floor(t/e)*e)},function(t,n){t.setTime(+t+n*e)},function(t,n){return(n-t)/e}):Tg};Tg.range;var d0=1e3,Au=6e4,h0=36e5,TK=864e5,yK=6048e5,JO=jr(function(e){e.setTime(e-e.getMilliseconds())},function(e,t){e.setTime(+e+t*d0)},function(e,t){return(t-e)/d0},function(e){return e.getUTCSeconds()});JO.range;var xK=jr(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*d0)},function(e,t){e.setTime(+e+t*Au)},function(e,t){return(t-e)/Au},function(e){return e.getMinutes()});xK.range;var SK=jr(function(e){e.setTime(e-e.getMilliseconds()-e.getSeconds()*d0-e.getMinutes()*Au)},function(e,t){e.setTime(+e+t*h0)},function(e,t){return(t-e)/h0},function(e){return e.getHours()});SK.range;var yD=jr(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Au)/TK},function(e){return e.getDate()-1});yD.range;function $u(e){return jr(function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n*7)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Au)/yK})}var f0=$u(0),yg=$u(1),bK=$u(2),vK=$u(3),Ru=$u(4),AK=$u(5),RK=$u(6);f0.range;yg.range;bK.range;vK.range;Ru.range;AK.range;RK.range;var NK=jr(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12},function(e){return e.getMonth()});NK.range;var Yl=jr(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()});Yl.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:jr(function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n*e)})};Yl.range;var _K=jr(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*Au)},function(e,t){return(t-e)/Au},function(e){return e.getUTCMinutes()});_K.range;var wK=jr(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*h0)},function(e,t){return(t-e)/h0},function(e){return e.getUTCHours()});wK.range;var xD=jr(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/TK},function(e){return e.getUTCDate()-1});xD.range;function Bu(e){return jr(function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n*7)},function(t,n){return(n-t)/yK})}var m0=Bu(0),xg=Bu(1),CK=Bu(2),IK=Bu(3),Nu=Bu(4),OK=Bu(5),LK=Bu(6);m0.range;xg.range;CK.range;IK.range;Nu.range;OK.range;LK.range;var MK=jr(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12},function(e){return e.getUTCMonth()});MK.range;var Wl=jr(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()});Wl.every=function(e){return!isFinite(e=Math.floor(e))||!(e>0)?null:jr(function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})};Wl.range;function Nw(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 _w(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 Bm(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function jwe(e){var t=e.dateTime,n=e.date,r=e.time,a=e.periods,s=e.days,i=e.shortDays,l=e.months,c=e.shortMonths,u=Hm(a),h=Vm(a),m=Hm(s),p=Vm(s),g=Hm(i),T=Vm(i),y=Hm(l),b=Vm(l),x=Hm(c),R=Vm(c),A={a:G,A:K,b:J,B:$,c:null,d:qV,e:qV,f:iCe,g:gCe,G:TCe,H:rCe,I:aCe,j:sCe,L:DK,m:oCe,M:lCe,p:X,q:Z,Q:XV,s:KV,S:cCe,u:uCe,U:dCe,V:hCe,w:fCe,W:mCe,x:null,X:null,y:pCe,Y:ECe,Z:yCe,"%":WV},w={a:V,A:te,b:ae,B:ne,c:null,d:YV,e:YV,f:vCe,g:MCe,G:PCe,H:xCe,I:SCe,j:bCe,L:kK,m:ACe,M:RCe,p:ce,q:ie,Q:XV,s:KV,S:NCe,u:_Ce,U:wCe,V:CCe,w:ICe,W:OCe,x:null,X:null,y:LCe,Y:DCe,Z:kCe,"%":WV},_={a:O,A:L,b:k,B:F,c:U,d:GV,e:GV,f:Zwe,g:VV,G:HV,H:zV,I:zV,j:Xwe,L:Jwe,m:Wwe,M:Kwe,p:M,q:Ywe,Q:tCe,s:nCe,S:Qwe,u:Hwe,U:Vwe,V:Gwe,w:Bwe,W:zwe,x:B,X:j,y:VV,Y:HV,Z:qwe,"%":eCe};A.x=N(n,A),A.X=N(r,A),A.c=N(t,A),w.x=N(n,w),w.X=N(r,w),w.c=N(t,w);function N(W,Q){return function(se){var z=[],xe=-1,le=0,pe=W.length,_e,re,Se;for(se instanceof Date||(se=new Date(+se));++xe<pe;)W.charCodeAt(xe)===37&&(z.push(W.slice(le,xe)),(re=BV[_e=W.charAt(++xe)])!=null?_e=W.charAt(++xe):re=_e==="e"?" ":"0",(Se=Q[_e])&&(_e=Se(se,re)),z.push(_e),le=xe+1);return z.push(W.slice(le,xe)),z.join("")}}function I(W,Q){return function(se){var z=Bm(1900,void 0,1),xe=D(z,W,se+="",0),le,pe;if(xe!=se.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(Q&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(le=_w(Bm(z.y,0,1)),pe=le.getUTCDay(),le=pe>4||pe===0?xg.ceil(le):xg(le),le=xD.offset(le,(z.V-1)*7),z.y=le.getUTCFullYear(),z.m=le.getUTCMonth(),z.d=le.getUTCDate()+(z.w+6)%7):(le=Nw(Bm(z.y,0,1)),pe=le.getDay(),le=pe>4||pe===0?yg.ceil(le):yg(le),le=yD.offset(le,(z.V-1)*7),z.y=le.getFullYear(),z.m=le.getMonth(),z.d=le.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),pe="Z"in z?_w(Bm(z.y,0,1)).getUTCDay():Nw(Bm(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(pe+5)%7:z.w+z.U*7-(pe+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,_w(z)):Nw(z)}}function D(W,Q,se,z){for(var xe=0,le=Q.length,pe=se.length,_e,re;xe<le;){if(z>=pe)return-1;if(_e=Q.charCodeAt(xe++),_e===37){if(_e=Q.charAt(xe++),re=_[_e in BV?Q.charAt(xe++):_e],!re||(z=re(W,se,z))<0)return-1}else if(_e!=se.charCodeAt(z++))return-1}return z}function M(W,Q,se){var z=u.exec(Q.slice(se));return z?(W.p=h.get(z[0].toLowerCase()),se+z[0].length):-1}function O(W,Q,se){var z=g.exec(Q.slice(se));return z?(W.w=T.get(z[0].toLowerCase()),se+z[0].length):-1}function L(W,Q,se){var z=m.exec(Q.slice(se));return z?(W.w=p.get(z[0].toLowerCase()),se+z[0].length):-1}function k(W,Q,se){var z=x.exec(Q.slice(se));return z?(W.m=R.get(z[0].toLowerCase()),se+z[0].length):-1}function F(W,Q,se){var z=y.exec(Q.slice(se));return z?(W.m=b.get(z[0].toLowerCase()),se+z[0].length):-1}function U(W,Q,se){return D(W,t,Q,se)}function B(W,Q,se){return D(W,n,Q,se)}function j(W,Q,se){return D(W,r,Q,se)}function G(W){return i[W.getDay()]}function K(W){return s[W.getDay()]}function J(W){return c[W.getMonth()]}function $(W){return l[W.getMonth()]}function X(W){return a[+(W.getHours()>=12)]}function Z(W){return 1+~~(W.getMonth()/3)}function V(W){return i[W.getUTCDay()]}function te(W){return s[W.getUTCDay()]}function ae(W){return c[W.getUTCMonth()]}function ne(W){return l[W.getUTCMonth()]}function ce(W){return a[+(W.getUTCHours()>=12)]}function ie(W){return 1+~~(W.getUTCMonth()/3)}return{format:function(W){var Q=N(W+="",A);return Q.toString=function(){return W},Q},parse:function(W){var Q=I(W+="",!1);return Q.toString=function(){return W},Q},utcFormat:function(W){var Q=N(W+="",w);return Q.toString=function(){return W},Q},utcParse:function(W){var Q=I(W+="",!0);return Q.toString=function(){return W},Q}}}var BV={"-":"",_:" ",0:"0"},aa=/^\s*\d+/,Uwe=/^%/,Fwe=/[\\^$*+?|[\]().{}]/g;function vn(e,t,n){var r=e<0?"-":"",a=(r?-e:e)+"",s=a.length;return r+(s<n?new Array(n-s+1).join(t)+a:a)}function $we(e){return e.replace(Fwe,"\\$&")}function Hm(e){return new RegExp("^(?:"+e.map($we).join("|")+")","i")}function Vm(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function Bwe(e,t,n){var r=aa.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Hwe(e,t,n){var r=aa.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Vwe(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Gwe(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function zwe(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function HV(e,t,n){var r=aa.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function VV(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function qwe(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Ywe(e,t,n){var r=aa.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Wwe(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function GV(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Xwe(e,t,n){var r=aa.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function zV(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Kwe(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Qwe(e,t,n){var r=aa.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Jwe(e,t,n){var r=aa.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Zwe(e,t,n){var r=aa.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function eCe(e,t,n){var r=Uwe.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function tCe(e,t,n){var r=aa.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function nCe(e,t,n){var r=aa.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function qV(e,t){return vn(e.getDate(),t,2)}function rCe(e,t){return vn(e.getHours(),t,2)}function aCe(e,t){return vn(e.getHours()%12||12,t,2)}function sCe(e,t){return vn(1+yD.count(Yl(e),e),t,3)}function DK(e,t){return vn(e.getMilliseconds(),t,3)}function iCe(e,t){return DK(e,t)+"000"}function oCe(e,t){return vn(e.getMonth()+1,t,2)}function lCe(e,t){return vn(e.getMinutes(),t,2)}function cCe(e,t){return vn(e.getSeconds(),t,2)}function uCe(e){var t=e.getDay();return t===0?7:t}function dCe(e,t){return vn(f0.count(Yl(e)-1,e),t,2)}function PK(e){var t=e.getDay();return t>=4||t===0?Ru(e):Ru.ceil(e)}function hCe(e,t){return e=PK(e),vn(Ru.count(Yl(e),e)+(Yl(e).getDay()===4),t,2)}function fCe(e){return e.getDay()}function mCe(e,t){return vn(yg.count(Yl(e)-1,e),t,2)}function pCe(e,t){return vn(e.getFullYear()%100,t,2)}function gCe(e,t){return e=PK(e),vn(e.getFullYear()%100,t,2)}function ECe(e,t){return vn(e.getFullYear()%1e4,t,4)}function TCe(e,t){var n=e.getDay();return e=n>=4||n===0?Ru(e):Ru.ceil(e),vn(e.getFullYear()%1e4,t,4)}function yCe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+vn(t/60|0,"0",2)+vn(t%60,"0",2)}function YV(e,t){return vn(e.getUTCDate(),t,2)}function xCe(e,t){return vn(e.getUTCHours(),t,2)}function SCe(e,t){return vn(e.getUTCHours()%12||12,t,2)}function bCe(e,t){return vn(1+xD.count(Wl(e),e),t,3)}function kK(e,t){return vn(e.getUTCMilliseconds(),t,3)}function vCe(e,t){return kK(e,t)+"000"}function ACe(e,t){return vn(e.getUTCMonth()+1,t,2)}function RCe(e,t){return vn(e.getUTCMinutes(),t,2)}function NCe(e,t){return vn(e.getUTCSeconds(),t,2)}function _Ce(e){var t=e.getUTCDay();return t===0?7:t}function wCe(e,t){return vn(m0.count(Wl(e)-1,e),t,2)}function jK(e){var t=e.getUTCDay();return t>=4||t===0?Nu(e):Nu.ceil(e)}function CCe(e,t){return e=jK(e),vn(Nu.count(Wl(e),e)+(Wl(e).getUTCDay()===4),t,2)}function ICe(e){return e.getUTCDay()}function OCe(e,t){return vn(xg.count(Wl(e)-1,e),t,2)}function LCe(e,t){return vn(e.getUTCFullYear()%100,t,2)}function MCe(e,t){return e=jK(e),vn(e.getUTCFullYear()%100,t,2)}function DCe(e,t){return vn(e.getUTCFullYear()%1e4,t,4)}function PCe(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Nu(e):Nu.ceil(e),vn(e.getUTCFullYear()%1e4,t,4)}function kCe(){return"+0000"}function WV(){return"%"}function XV(e){return+e}function KV(e){return Math.floor(+e/1e3)}var Cd,UK,FK;jCe({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 jCe(e){return Cd=jwe(e),Cd.format,UK=Cd.parse,Cd.utcFormat,FK=Cd.utcParse,Cd}function Bc(){return Bc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bc.apply(null,arguments)}var Id=[function(e){return e.setMilliseconds(0)},function(e){return e.setSeconds(0)},function(e){return e.setMinutes(0)},function(e){return e.setHours(0)},function(e){return e.setDate(1)},function(e){return e.setMonth(0)}],UCe={millisecond:[],second:Id.slice(0,1),minute:Id.slice(0,2),hour:Id.slice(0,3),day:Id.slice(0,4),month:Id.slice(0,5),year:Id.slice(0,6)},FCe=function(e){return function(t){return UCe[e].forEach(function(n){n(t)}),t}},$K=function(e){var t=e.format,n=t===void 0?"native":t,r=e.precision,a=r===void 0?"millisecond":r,s=e.useUTC,i=s===void 0||s,l=FCe(a);return function(c){if(c===void 0)return c;if(n==="native"||c instanceof Date)return l(c);var u=i?FK(n):UK(n);return l(u(c))}},Ic={min:0,max:"auto",stacked:!1,reverse:!1,clamp:!1,nice:!0,round:!1},$Ce=function(e,t,n,r){var a,s,i,l,c=e.min,u=c===void 0?Ic.min:c,h=e.max,m=h===void 0?Ic.max:h,p=e.stacked,g=p===void 0?Ic.stacked:p,T=e.reverse,y=T===void 0?Ic.reverse:T,b=e.clamp,x=b===void 0?Ic.clamp:b,R=e.nice,A=R===void 0?Ic.nice:R,w=e.round,_=w===void 0?Ic.round:w;u==="auto"?a=g===!0?(s=t.minStacked)!=null?s:0:t.min:a=u,m==="auto"?i=g===!0?(l=t.maxStacked)!=null?l:0:t.max:i=m;var N=Eg().range(r==="x"?[0,n]:[n,0]).interpolate(_?Y9:mg).domain(y?[i,a]:[a,i]).clamp(x);return A===!0?N.nice():typeof A=="number"&&N.nice(A),BCe(N,g)},BCe=function(e,t){t===void 0&&(t=!1);var n=e;return n.type="linear",n.stacked=t,n},HCe=function(e,t,n){var r=VSe().range([0,n]).domain(t.all);return r.type="point",r},VCe={round:!1},GCe=function(e,t,n,r){var a=e.round,s=a===void 0?VCe.round:a,i=$M().range(r==="x"?[0,n]:[n,0]).domain(t.all).round(s);return zCe(i)},zCe=function(e){var t=e;return t.type="band",t},Od={format:"native",precision:"millisecond",min:"auto",max:"auto",useUTC:!0,nice:!1},qCe=function(e,t,n){var r,a,s=e.format,i=s===void 0?Od.format:s,l=e.precision,c=l===void 0?Od.precision:l,u=e.min,h=u===void 0?Od.min:u,m=e.max,p=m===void 0?Od.max:m,g=e.useUTC,T=g===void 0?Od.useUTC:g,y=e.nice,b=y===void 0?Od.nice:y,x=$K({format:i,precision:c,useUTC:T});r=h==="auto"?x(t.min):i!=="native"?x(h):h,a=p==="auto"?x(t.max):i!=="native"?x(p):p;var R=T?Ive():Cve();R.range([0,n]),r&&a&&R.domain([r,a]),b===!0?R.nice():typeof b!="object"&&typeof b!="number"||R.nice(b);var A=R;return A.type="time",A.useUTC=T,A},Ld={base:10,min:"auto",max:"auto",round:!1,reverse:!1,nice:!0},YCe=function(e,t,n,r){var a,s=e.base,i=s===void 0?Ld.base:s,l=e.min,c=l===void 0?Ld.min:l,u=e.max,h=u===void 0?Ld.max:u,m=e.round,p=m===void 0?Ld.round:m,g=e.reverse,T=g===void 0?Ld.reverse:g,y=e.nice,b=y===void 0?Ld.nice:y;if(t.all.some(function(I){return I===0}))throw new Error("a log scale domain must not include or cross zero");var x,R,A=!1;if(t.all.filter(function(I){return I!=null}).forEach(function(I){A||(a===void 0?a=Math.sign(I):Math.sign(I)!==a&&(A=!0))}),A)throw new Error("a log scale domain must be strictly-positive or strictly-negative");x=c==="auto"?t.min:c,R=h==="auto"?t.max:h;var w=TX().base(i),_=r==="x"?[0,n]:[n,0];p===!0?w.rangeRound(_):w.range(_),T===!0?w.domain([R,x]):w.domain([x,R]),b===!0?w.nice():typeof b=="number"&&w.nice(b);var N=w;return N.type="log",N},Md={constant:1,min:"auto",max:"auto",round:!1,reverse:!1,nice:!0},WCe=function(e,t,n,r){var a,s,i=e.constant,l=i===void 0?Md.constant:i,c=e.min,u=c===void 0?Md.min:c,h=e.max,m=h===void 0?Md.max:h,p=e.round,g=p===void 0?Md.round:p,T=e.reverse,y=T===void 0?Md.reverse:T,b=e.nice,x=b===void 0?Md.nice:b;a=u==="auto"?t.min:u,s=m==="auto"?t.max:m;var R=yX().constant(l),A=r==="x"?[0,n]:[n,0];g===!0?R.rangeRound(A):R.range(A),y===!0?R.domain([s,a]):R.domain([a,s]),x===!0?R.nice():typeof x=="number"&&R.nice(x);var w=R;return w.type="symlog",w},XCe=function(e){return e==="x"?"y":"x"},KCe=function(e,t){return e===t},QCe=function(e,t){return e.getTime()===t.getTime()};function Sg(e,t,n,r){switch(e.type){case"linear":return $Ce(e,t,n,r);case"point":return HCe(0,t,n);case"band":return GCe(e,t,n,r);case"time":return qCe(e,t,n);case"log":return YCe(e,t,n,r);case"symlog":return WCe(e,t,n,r);default:throw new Error("invalid scale spec")}}var QV=function(e,t,n){var r;if("stacked"in n&&n.stacked){var a=e.data[t==="x"?"xStacked":"yStacked"];return a==null?null:n(a)}return(r=n(e.data[t]))!=null?r:null},BK=function(e,t,n,r,a){var s=e.map(function(h){return function(m){return Bc({},m,{data:m.data.map(function(p){return{data:Bc({},p)}})})}(h)}),i=JCe(s,t,n);"stacked"in t&&t.stacked===!0&&ZCe(i,s),"stacked"in n&&n.stacked===!0&&eIe(i,s);var l=Sg(t,i.x,r,"x"),c=Sg(n,i.y,a,"y"),u=s.map(function(h){return Bc({},h,{data:h.data.map(function(m){return Bc({},m,{position:{x:QV(m,"x",l),y:QV(m,"y",c)}})})})});return Bc({},i,{series:u,xScale:l,yScale:c})},JCe=function(e,t,n){return{x:JV(e,"x",t),y:JV(e,"y",n)}},JV=function(e,t,n,r){var a={},s=a.getValue,i=s===void 0?function(T){return T.data[t]}:s,l=a.setValue,c=l===void 0?function(T,y){T.data[t]=y}:l;if(n.type==="linear")e.forEach(function(T){T.data.forEach(function(y){var b=i(y);b&&c(y,parseFloat(String(b)))})});else if(n.type==="time"&&n.format!=="native"){var u=$K(n);e.forEach(function(T){T.data.forEach(function(y){var b=i(y);b&&c(y,u(b))})})}var h=[];switch(e.forEach(function(T){T.data.forEach(function(y){h.push(i(y))})}),n.type){case"linear":var m=Lwe(TV(h).filter(function(T){return T!==null}),function(T){return T});return{all:m,min:Math.min.apply(Math,m),max:Math.max.apply(Math,m)};case"time":var p=QO(h,function(T){return T.getTime()}).slice(0).sort(function(T,y){return y.getTime()-T.getTime()}).reverse();return{all:p,min:p[0],max:bt(p)};default:var g=TV(h);return{all:g,min:g[0],max:bt(g)}}},HK=function(e,t,n){var r=XCe(e),a=[];t[r].all.forEach(function(s){var i=kwe(s)?QCe:KCe,l=[];n.forEach(function(c){var u=c.data.find(function(g){return i(g.data[r],s)}),h=null,m=null;if(u!==void 0){if((h=u.data[e])!==null){var p=bt(l);p===void 0?m=h:p!==null&&(m=p+h)}u.data[e==="x"?"xStacked":"yStacked"]=m}l.push(m),m!==null&&a.push(m)})}),t[e].minStacked=Math.min.apply(Math,a),t[e].maxStacked=Math.max.apply(Math,a)},ZCe=function(e,t){return HK("x",e,t)},eIe=function(e,t){return HK("y",e,t)},VK=function(e){var t=e.bandwidth();if(t===0)return e;var n=t/2;return e.round()&&(n=Math.round(n)),function(r){var a;return((a=e(r))!=null?a:0)+n}},GK={millisecond:[Tg,Tg],second:[JO,JO],minute:[xK,_K],hour:[SK,wK],day:[jr(function(e){return e.setHours(0,0,0,0)},function(e,t){return e.setDate(e.getDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)}),jr(function(e){return e.setUTCHours(0,0,0,0)},function(e,t){return e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t.getTime()-e.getTime())/864e5},function(e){return Math.floor(e.getTime()/864e5)})],week:[f0,m0],sunday:[f0,m0],monday:[yg,xg],tuesday:[bK,CK],wednesday:[vK,IK],thursday:[Ru,Nu],friday:[AK,OK],saturday:[RK,LK],month:[NK,MK],year:[Yl,Wl]},tIe=Object.keys(GK),nIe=new RegExp("^every\\s*(\\d+)?\\s*("+tIe.join("|")+")s?$","i"),zK=function(e,t){if(Array.isArray(t))return t;if(typeof t=="string"&&"useUTC"in e){var n=t.match(nIe);if(n){var r=n[1],a=n[2],s=GK[a][e.useUTC?1:0];if(a==="day"){var i,l,c=e.domain(),u=c[0],h=c[1],m=new Date(h);return m.setDate(m.getDate()+1),(i=(l=s.every(Number(r!=null?r:1)))==null?void 0:l.range(u,m))!=null?i:[]}if(r===void 0)return e.ticks(s);var p=s.every(Number(r));if(p)return e.ticks(p)}throw new Error("Invalid tickValues: "+t)}if("ticks"in e){if(t===void 0)return e.ticks();if(typeof(g=t)=="number"&&isFinite(g)&&Math.floor(g)===g)return e.ticks(t)}var g;return e.domain()};function yi(){return yi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yi.apply(null,arguments)}var qK=function(e){var t,n=e.axis,r=e.scale,a=e.ticksPosition,s=e.tickValues,i=e.tickSize,l=e.tickPadding,c=e.tickRotation,u=e.truncateTickAt,h=e.engine,m=h===void 0?"svg":h,p=zK(r,s),g=JX[m],T="bandwidth"in r?VK(r):r,y={lineX:0,lineY:0},b={textX:0,textY:0},x=typeof document=="object"&&document.dir==="rtl",R=g.align.center,A=g.baseline.center;return n==="x"?(t=function(w){var _;return{x:(_=T(w))!=null?_:0,y:0}},y.lineY=i*(a==="after"?1:-1),b.textY=(i+l)*(a==="after"?1:-1),A=a==="after"?g.baseline.top:g.baseline.bottom,c===0?R=g.align.center:a==="after"&&c<0||a==="before"&&c>0?(R=g.align[x?"left":"right"],A=g.baseline.center):(a==="after"&&c>0||a==="before"&&c<0)&&(R=g.align[x?"right":"left"],A=g.baseline.center)):(t=function(w){var _;return{x:0,y:(_=T(w))!=null?_:0}},y.lineX=i*(a==="after"?1:-1),b.textX=(i+l)*(a==="after"?1:-1),R=a==="after"?g.align.left:g.align.right),{ticks:p.map(function(w){var _=typeof w=="string"?function(N){var I=String(N).length;return u&&u>0&&I>u?""+String(N).slice(0,u).concat("..."):""+N}(w):w;return yi({key:w instanceof Date?""+w.valueOf():""+w,value:_},t(w),y,b)}),textAlign:R,textBaseline:A}},YK=function(e,t){if(e===void 0||typeof e=="function")return e;if(t.type==="time"){var n=dK(e);return function(r){return n(r instanceof Date?r:new Date(r))}}return fK(e)},ZO=function(e){var t,n=e.width,r=e.height,a=e.scale,s=e.axis,i=e.values,l=(t=i,(Array.isArray(t)?i:void 0)||zK(a,i)),c="bandwidth"in a?VK(a):a,u=s==="x"?l.map(function(h){var m,p;return{key:h instanceof Date?""+h.valueOf():""+h,x1:(m=c(h))!=null?m:0,x2:(p=c(h))!=null?p:0,y1:0,y2:r}}):l.map(function(h){var m,p;return{key:h instanceof Date?""+h.valueOf():""+h,x1:0,x2:n,y1:(m=c(h))!=null?m:0,y2:(p=c(h))!=null?p:0}});return u},rIe=v.memo(function(e){var t,n=e.value,r=e.format,a=e.lineX,s=e.lineY,i=e.onClick,l=e.textBaseline,c=e.textAnchor,u=e.theme,h=e.animatedProps,m=(t=r==null?void 0:r(n))!=null?t:n,p=v.useMemo(function(){var g={opacity:h.opacity};return i?{style:yi({},g,{cursor:"pointer"}),onClick:function(T){return i(T,m)}}:{style:g}},[h.opacity,i,m]);return o.jsxs(Vn.g,yi({transform:h.transform},p,{children:[o.jsx("line",{x1:0,x2:a,y1:0,y2:s,style:u.line}),o.jsx(cf,{dominantBaseline:l,textAnchor:c,transform:h.textTransform,style:u.text,children:""+m})]}))}),ns={tickSize:5,tickPadding:5,tickRotation:0,legendPosition:"middle",legendOffset:0},aIe=function(e){var t=e.axis,n=e.scale,r=e.x,a=r===void 0?0:r,s=e.y,i=s===void 0?0:s,l=e.length,c=e.ticksPosition,u=e.tickValues,h=e.tickSize,m=h===void 0?ns.tickSize:h,p=e.tickPadding,g=p===void 0?ns.tickPadding:p,T=e.tickRotation,y=T===void 0?ns.tickRotation:T,b=e.format,x=e.renderTick,R=x===void 0?rIe:x,A=e.truncateTickAt,w=e.legend,_=e.legendPosition,N=_===void 0?ns.legendPosition:_,I=e.legendOffset,D=I===void 0?ns.legendOffset:I,M=e.style,O=e.onClick,L=e.ariaHidden,k=_n(),F=X0e(k.axis,M),U=v.useMemo(function(){return YK(b,n)},[b,n]),B=qK({axis:t,scale:n,ticksPosition:c,tickValues:u,tickSize:m,tickPadding:g,tickRotation:y,truncateTickAt:A}),j=B.ticks,G=B.textAlign,K=B.textBaseline,J=null;if(w!==void 0){var $,X=0,Z=0,V=0;t==="y"?(V=-90,X=D,N==="start"?($="start",Z=l):N==="middle"?($="middle",Z=l/2):N==="end"&&($="end")):(Z=D,N==="start"?$="start":N==="middle"?($="middle",X=l/2):N==="end"&&($="end",X=l)),J=o.jsx(o.Fragment,{children:o.jsx(cf,{transform:"translate("+X+", "+Z+") rotate("+V+")",textAnchor:$,style:yi({},F.legend.text,{dominantBaseline:"central"}),children:w})})}var te=Pa(),ae=te.animate,ne=te.config,ce=Ji({transform:"translate("+a+","+i+")",lineX2:t==="x"?l:0,lineY2:t==="x"?0:l,config:ne,immediate:!ae}),ie=v.useCallback(function(se){return{opacity:1,transform:"translate("+se.x+","+se.y+")",textTransform:"translate("+se.textX+","+se.textY+") rotate("+y+")"}},[y]),W=v.useCallback(function(se){return{opacity:0,transform:"translate("+se.x+","+se.y+")",textTransform:"translate("+se.textX+","+se.textY+") rotate("+y+")"}},[y]),Q=tc(j,{keys:function(se){return se.key},initial:ie,from:W,enter:ie,update:ie,leave:{opacity:0},config:ne,immediate:!ae});return o.jsxs(Vn.g,{transform:ce.transform,"aria-hidden":L,children:[Q(function(se,z,xe,le){return v.createElement(R,yi({tickIndex:le,format:U,rotate:y,textBaseline:K,textAnchor:G,truncateTickAt:A,animatedProps:se,theme:F.ticks},z,O?{onClick:O}:{}))}),o.jsx(Vn.line,{style:F.domain.line,x1:0,x2:ce.lineX2,y1:0,y2:ce.lineY2}),J]})},sIe=v.memo(aIe),WK=["top","right","bottom","left"],SD=v.memo(function(e){var t=e.xScale,n=e.yScale,r=e.width,a=e.height,s={top:e.top,right:e.right,bottom:e.bottom,left:e.left};return o.jsx(o.Fragment,{children:WK.map(function(i){var l=s[i];if(!l)return null;var c=i==="top"||i==="bottom";return o.jsx(sIe,yi({},l,{axis:c?"x":"y",x:i==="right"?r:0,y:i==="bottom"?a:0,scale:c?t:n,length:c?r:a,ticksPosition:i==="top"||i==="left"?"before":"after",truncateTickAt:l.truncateTickAt}),i)})})}),iIe=v.memo(function(e){var t=e.animatedProps,n=_n();return o.jsx(Vn.line,yi({},t,n.grid.line))}),ZV=v.memo(function(e){var t=e.lines,n=Pa(),r=n.animate,a=n.config,s=tc(t,{keys:function(i){return i.key},initial:function(i){return{opacity:1,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2}},from:function(i){return{opacity:0,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2}},enter:function(i){return{opacity:1,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2}},update:function(i){return{opacity:1,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2}},leave:{opacity:0},config:a,immediate:!r});return o.jsx("g",{children:s(function(i,l){return v.createElement(iIe,yi({},l,{key:l.key,animatedProps:i}))})})}),bD=v.memo(function(e){var t=e.width,n=e.height,r=e.xScale,a=e.yScale,s=e.xValues,i=e.yValues,l=v.useMemo(function(){return!!r&&ZO({width:t,height:n,scale:r,axis:"x",values:s})},[r,s,t,n]),c=v.useMemo(function(){return!!a&&ZO({width:t,height:n,scale:a,axis:"y",values:i})},[n,t,a,i]);return o.jsxs(o.Fragment,{children:[l&&o.jsx(ZV,{lines:l}),c&&o.jsx(ZV,{lines:c})]})}),oIe=function(e,t){var n,r,a=t.axis,s=t.scale,i=t.x,l=i===void 0?0:i,c=t.y,u=c===void 0?0:c,h=t.length,m=t.ticksPosition,p=t.tickValues,g=t.tickSize,T=g===void 0?ns.tickSize:g,y=t.tickPadding,b=y===void 0?ns.tickPadding:y,x=t.tickRotation,R=x===void 0?ns.tickRotation:x,A=t.format,w=t.legend,_=t.legendPosition,N=_===void 0?ns.legendPosition:_,I=t.legendOffset,D=I===void 0?ns.legendOffset:I,M=t.theme,O=t.style,L=qK({axis:a,scale:s,ticksPosition:m,tickValues:p,tickSize:T,tickPadding:b,tickRotation:R,engine:"canvas"}),k=L.ticks,F=L.textAlign,U=L.textBaseline;e.save(),e.translate(l,u);var B=D9(M.axis,O);e.textAlign=F,e.textBaseline=U,xu(e,B.ticks.text);var j=(n=B.domain.line.strokeWidth)!=null?n:0;typeof j!="string"&&j>0&&(e.lineWidth=j,e.lineCap="square",B.domain.line.stroke&&(e.strokeStyle=B.domain.line.stroke),e.beginPath(),e.moveTo(0,0),e.lineTo(a==="x"?h:0,a==="x"?0:h),e.stroke());var G=typeof A=="function"?A:function(te){return""+te},K=(r=B.ticks.line.strokeWidth)!=null?r:0,J=typeof K!="string"&&K>0;if(k.forEach(function(te){J&&(e.lineWidth=K,e.lineCap="square",B.ticks.line.stroke&&(e.strokeStyle=B.ticks.line.stroke),e.beginPath(),e.moveTo(te.x,te.y),e.lineTo(te.x+te.lineX,te.y+te.lineY),e.stroke());var ae=G(te.value);e.save(),e.translate(te.x+te.textX,te.y+te.textY),e.rotate(Ws(R)),Su(e,B.ticks.text,""+ae),e.fillText(""+ae,0,0),e.restore()}),w!==void 0){var $=0,X=0,Z=0,V="center";a==="y"?(Z=-90,$=D,N==="start"?(V="start",X=h):N==="middle"?(V="center",X=h/2):N==="end"&&(V="end")):(X=D,N==="start"?V="start":N==="middle"?(V="center",$=h/2):N==="end"&&(V="end",$=h)),e.translate($,X),e.rotate(Ws(Z)),xu(e,B.legend.text),B.legend.text.fill&&(e.fillStyle=B.legend.text.fill),e.textAlign=V,e.textBaseline="middle",Su(e,B.legend.text,w)}e.restore()},vD=function(e,t){var n=t.xScale,r=t.yScale,a=t.width,s=t.height,i=t.top,l=t.right,c=t.bottom,u=t.left,h=t.theme,m={top:i,right:l,bottom:c,left:u};WK.forEach(function(p){var g=m[p];if(!g)return null;var T=p==="top"||p==="bottom",y=p==="top"||p==="left"?"before":"after",b=T?n:r,x=YK(g.format,b);oIe(e,yi({},g,{axis:T?"x":"y",x:p==="right"?a:0,y:p==="bottom"?s:0,scale:b,format:x,length:T?a:s,ticksPosition:y,theme:h}))})},Bh=function(e,t){var n=t.width,r=t.height,a=t.scale,s=t.axis,i=t.values;ZO({width:n,height:r,scale:a,axis:s,values:i}).forEach(function(l){e.beginPath(),e.moveTo(l.x1,l.y1),e.lineTo(l.x2,l.y2),e.stroke()})},ww,eG;function lIe(){if(eG)return ww;eG=1;var e=EK();function t(n,r){var a=[];return e(n,function(s,i,l){r(s,i,l)&&a.push(s)}),a}return ww=t,ww}var Cw,tG;function cIe(){if(tG)return Cw;tG=1;var e=zX(),t=lIe(),n=TD(),r=za();function a(s,i){var l=r(s)?e:t;return l(s,n(i,3))}return Cw=a,Cw}var uIe=cIe();const dIe=ir(uIe);var Iw,nG;function hIe(){if(nG)return Iw;nG=1;var e=Bo(),t=Js(),n="[object Number]";function r(a){return typeof a=="number"||t(a)&&e(a)==n}return Iw=r,Iw}var fIe=hIe();const e1=ir(fIe);var Ow,rG;function mIe(){if(rG)return Ow;rG=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return Ow=e,Ow}var Lw,aG;function pIe(){if(aG)return Lw;aG=1;var e=af(),t=Bg();function n(r,a){return r&&e(a,t(a),r)}return Lw=n,Lw}var Mw,sG;function gIe(){if(sG)return Mw;sG=1;var e=af(),t=Ug();function n(r,a){return r&&e(a,t(a),r)}return Mw=n,Mw}var Dw,iG;function EIe(){if(iG)return Dw;iG=1;var e=af(),t=iD();function n(r,a){return e(r,t(r),a)}return Dw=n,Dw}var Pw,oG;function XK(){if(oG)return Pw;oG=1;var e=aD(),t=EM(),n=iD(),r=qX(),a=Object.getOwnPropertySymbols,s=a?function(i){for(var l=[];i;)e(l,n(i)),i=t(i);return l}:r;return Pw=s,Pw}var kw,lG;function TIe(){if(lG)return kw;lG=1;var e=af(),t=XK();function n(r,a){return e(r,t(r),a)}return kw=n,kw}var jw,cG;function KK(){if(cG)return jw;cG=1;var e=GX(),t=XK(),n=Ug();function r(a){return e(a,n,t)}return jw=r,jw}var Uw,uG;function yIe(){if(uG)return Uw;uG=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,s=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(s.index=r.index,s.input=r.input),s}return Uw=n,Uw}var Fw,dG;function xIe(){if(dG)return Fw;dG=1;var e=gM();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Fw=t,Fw}var $w,hG;function SIe(){if(hG)return $w;hG=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return $w=t,$w}var Bw,fG;function bIe(){if(fG)return Bw;fG=1;var e=tf(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return Bw=r,Bw}var Hw,mG;function vIe(){if(mG)return Hw;mG=1;var e=gM(),t=xIe(),n=SIe(),r=bIe(),a=x9(),s="[object Boolean]",i="[object Date]",l="[object Map]",c="[object Number]",u="[object RegExp]",h="[object Set]",m="[object String]",p="[object Symbol]",g="[object ArrayBuffer]",T="[object DataView]",y="[object Float32Array]",b="[object Float64Array]",x="[object Int8Array]",R="[object Int16Array]",A="[object Int32Array]",w="[object Uint8Array]",_="[object Uint8ClampedArray]",N="[object Uint16Array]",I="[object Uint32Array]";function D(M,O,L){var k=M.constructor;switch(O){case g:return e(M);case s:case i:return new k(+M);case T:return t(M,L);case y:case b:case x:case R:case A:case w:case _:case N:case I:return a(M,L);case l:return new k;case c:case m:return new k(M);case u:return n(M);case h:return new k;case p:return r(M)}}return Hw=D,Hw}var Vw,pG;function AIe(){if(pG)return Vw;pG=1;var e=aS(),t=Js(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return Vw=r,Vw}var Gw,gG;function RIe(){if(gG)return Gw;gG=1;var e=AIe(),t=rf(),n=fx(),r=n&&n.isMap,a=r?t(r):e;return Gw=a,Gw}var zw,EG;function NIe(){if(EG)return zw;EG=1;var e=aS(),t=Js(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return zw=r,zw}var qw,TG;function _Ie(){if(TG)return qw;TG=1;var e=NIe(),t=rf(),n=fx(),r=n&&n.isSet,a=r?t(r):e;return qw=a,qw}var Yw,yG;function wIe(){if(yG)return Yw;yG=1;var e=ux(),t=mIe(),n=bM(),r=pIe(),a=gIe(),s=T9(),i=S9(),l=EIe(),c=TIe(),u=YX(),h=KK(),m=aS(),p=yIe(),g=vIe(),T=v9(),y=za(),b=hx(),x=RIe(),R=eo(),A=_Ie(),w=Bg(),_=Ug(),N=1,I=2,D=4,M="[object Arguments]",O="[object Array]",L="[object Boolean]",k="[object Date]",F="[object Error]",U="[object Function]",B="[object GeneratorFunction]",j="[object Map]",G="[object Number]",K="[object Object]",J="[object RegExp]",$="[object Set]",X="[object String]",Z="[object Symbol]",V="[object WeakMap]",te="[object ArrayBuffer]",ae="[object DataView]",ne="[object Float32Array]",ce="[object Float64Array]",ie="[object Int8Array]",W="[object Int16Array]",Q="[object Int32Array]",se="[object Uint8Array]",z="[object Uint8ClampedArray]",xe="[object Uint16Array]",le="[object Uint32Array]",pe={};pe[M]=pe[O]=pe[te]=pe[ae]=pe[L]=pe[k]=pe[ne]=pe[ce]=pe[ie]=pe[W]=pe[Q]=pe[j]=pe[G]=pe[K]=pe[J]=pe[$]=pe[X]=pe[Z]=pe[se]=pe[z]=pe[xe]=pe[le]=!0,pe[F]=pe[U]=pe[V]=!1;function _e(re,Se,$e,qe,Je,lt){var at,ot=Se&N,st=Se&I,oe=Se&D;if($e&&(at=Je?$e(re,qe,Je,lt):$e(re)),at!==void 0)return at;if(!R(re))return re;var ue=y(re);if(ue){if(at=p(re),!ot)return i(re,at)}else{var Ee=m(re),Le=Ee==U||Ee==B;if(b(re))return s(re,ot);if(Ee==K||Ee==M||Le&&!Je){if(at=st||Le?{}:T(re),!ot)return st?c(re,a(at,re)):l(re,r(at,re))}else{if(!pe[Ee])return Je?re:{};at=g(re,Ee,ot)}}lt||(lt=new e);var ke=lt.get(re);if(ke)return ke;lt.set(re,at),A(re)?re.forEach(function(ct){at.add(_e(ct,Se,$e,ct,re,lt))}):x(re)&&re.forEach(function(ct,Te){at.set(Te,_e(ct,Se,$e,Te,re,lt))});var Ge=oe?st?h:u:st?_:w,tt=ue?void 0:Ge(re);return t(tt||re,function(ct,Te){tt&&(Te=ct,ct=re[Te]),n(at,Te,_e(ct,Se,$e,Te,re,lt))}),at}return Yw=_e,Yw}var Ww,xG;function CIe(){if(xG)return Ww;xG=1;function e(t,n,r){var a=-1,s=t.length;n<0&&(n=-n>s?0:s+n),r=r>s?s:r,r<0&&(r+=s),s=n>r?0:r-n>>>0,n>>>=0;for(var i=Array(s);++a<s;)i[a]=t[a+n];return i}return Ww=e,Ww}var Xw,SG;function IIe(){if(SG)return Xw;SG=1;var e=Fg(),t=CIe();function n(r,a){return a.length<2?r:e(r,t(a,0,-1))}return Xw=n,Xw}var Kw,bG;function OIe(){if(bG)return Kw;bG=1;var e=sf(),t=CX(),n=IIe(),r=of();function a(s,i){return i=e(i,s),s=n(s,i),s==null||delete s[r(t(i))]}return Kw=a,Kw}var Qw,vG;function LIe(){if(vG)return Qw;vG=1;var e=xM();function t(n){return e(n)?void 0:n}return Qw=t,Qw}var Jw,AG;function MIe(){if(AG)return Jw;AG=1;var e=Ex(),t=wIe(),n=OIe(),r=sf(),a=af(),s=LIe(),i=HX(),l=KK(),c=1,u=2,h=4,m=i(function(p,g){var T={};if(p==null)return T;var y=!1;g=e(g,function(x){return x=r(x,p),y||(y=x.length>1),x}),a(p,l(p),T),y&&(T=t(T,c|u|h,s));for(var b=g.length;b--;)n(T,g[b]);return T});return Jw=m,Jw}var DIe=MIe();const QK=ir(DIe);function Xi(){return Xi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xi.apply(null,arguments)}var t1={dotSize:4,noteWidth:120,noteTextOffset:8},PIe=function(e){var t=typeof e;return v.isValidElement(e)||t==="string"||t==="function"||t==="object"},kIe=function(e){var t=typeof e;return t==="string"||t==="function"},bg=function(e){return e.type==="circle"},n1=function(e){return e.type==="dot"},vg=function(e){return e.type==="rect"},jIe=function(e){var t=e.data,n=e.annotations,r=e.getPosition,a=e.getDimensions;return n.reduce(function(s,i){var l=i.offset||0;return[].concat(s,dIe(t,i.match).map(function(c){var u=r(c),h=a(c);return(bg(i)||vg(i))&&(h.size=h.size+2*l,h.width=h.width+2*l,h.height=h.height+2*l),Xi({},QK(i,["match","offset"]),u,h,{size:i.size||h.size,datum:c})}))},[])},UIe=function(e,t,n,r){var a=Math.atan2(r-t,n-e);return _Ne(Hg(a))},JK=function(e){var t,n,r=e.x,a=e.y,s=e.noteX,i=e.noteY,l=e.noteWidth,c=l===void 0?t1.noteWidth:l,u=e.noteTextOffset,h=u===void 0?t1.noteTextOffset:u;if(e1(s))t=r+s;else{if(s.abs===void 0)throw new Error("noteX should be either a number or an object containing an 'abs' property");t=s.abs}if(e1(i))n=a+i;else{if(i.abs===void 0)throw new Error("noteY should be either a number or an object containing an 'abs' property");n=i.abs}var m=r,p=a,g=UIe(r,a,t,n);if(bg(e)){var T=iu(Ws(g),e.size/2);m+=T.x,p+=T.y}if(vg(e)){var y=Math.round((g+90)/45)%8;y===0&&(p-=e.height/2),y===1&&(m+=e.width/2,p-=e.height/2),y===2&&(m+=e.width/2),y===3&&(m+=e.width/2,p+=e.height/2),y===4&&(p+=e.height/2),y===5&&(m-=e.width/2,p+=e.height/2),y===6&&(m-=e.width/2),y===7&&(m-=e.width/2,p-=e.height/2)}var b=t,x=t;return(g+90)%360>180?(b-=c,x-=c):x+=c,{points:[[m,p],[t,n],[x,n]],text:[b,n-h],angle:g+90}},AD=function(e){var t=e.data,n=e.annotations,r=e.getPosition,a=e.getDimensions;return v.useMemo(function(){return jIe({data:t,annotations:n,getPosition:r,getDimensions:a})},[t,n,r,a])},FIe=function(e){var t=e.annotations;return v.useMemo(function(){return t.map(function(n){return Xi({},n,{computed:JK(Xi({},n))})})},[t])},$Ie=function(e){return v.useMemo(function(){return JK(e)},[e])},BIe=function(e){var t=e.datum,n=e.x,r=e.y,a=e.note,s=_n(),i=Pa(),l=i.animate,c=i.config,u=Ji({x:n,y:r,config:c,immediate:!l});return typeof a=="function"?v.createElement(a,{x:n,y:r,datum:t}):o.jsxs(o.Fragment,{children:[s.annotations.text.outlineWidth>0&&o.jsx(Vn.text,{x:u.x,y:u.y,style:Xi({},s.annotations.text,{strokeLinejoin:"round",strokeWidth:2*s.annotations.text.outlineWidth,stroke:s.annotations.text.outlineColor}),children:a}),o.jsx(Vn.text,{x:u.x,y:u.y,style:QK(s.annotations.text,["outlineWidth","outlineColor"]),children:a})]})},RG=function(e){var t=e.points,n=e.isOutline,r=n!==void 0&&n,a=_n(),s=v.useMemo(function(){var c=t[0];return t.slice(1).reduce(function(u,h){return u+" L"+h[0]+","+h[1]},"M"+c[0]+","+c[1])},[t]),i=cD(s);if(r&&a.annotations.link.outlineWidth<=0)return null;var l=Xi({},a.annotations.link);return r&&(l.strokeLinecap="square",l.strokeWidth=a.annotations.link.strokeWidth+2*a.annotations.link.outlineWidth,l.stroke=a.annotations.link.outlineColor,l.opacity=a.annotations.link.outlineOpacity),o.jsx(Vn.path,{fill:"none",d:i,style:l})},HIe=function(e){var t=e.x,n=e.y,r=e.size,a=_n(),s=Pa(),i=s.animate,l=s.config,c=Ji({x:t,y:n,radius:r/2,config:l,immediate:!i});return o.jsxs(o.Fragment,{children:[a.annotations.outline.outlineWidth>0&&o.jsx(Vn.circle,{cx:c.x,cy:c.y,r:c.radius,style:Xi({},a.annotations.outline,{fill:"none",strokeWidth:a.annotations.outline.strokeWidth+2*a.annotations.outline.outlineWidth,stroke:a.annotations.outline.outlineColor,opacity:a.annotations.outline.outlineOpacity})}),o.jsx(Vn.circle,{cx:c.x,cy:c.y,r:c.radius,style:a.annotations.outline})]})},VIe=function(e){var t=e.x,n=e.y,r=e.size,a=r===void 0?t1.dotSize:r,s=_n(),i=Pa(),l=i.animate,c=i.config,u=Ji({x:t,y:n,radius:a/2,config:c,immediate:!l});return o.jsxs(o.Fragment,{children:[s.annotations.outline.outlineWidth>0&&o.jsx(Vn.circle,{cx:u.x,cy:u.y,r:u.radius,style:Xi({},s.annotations.outline,{fill:"none",strokeWidth:2*s.annotations.outline.outlineWidth,stroke:s.annotations.outline.outlineColor,opacity:s.annotations.outline.outlineOpacity})}),o.jsx(Vn.circle,{cx:u.x,cy:u.y,r:u.radius,style:s.annotations.symbol})]})},GIe=function(e){var t=e.x,n=e.y,r=e.width,a=e.height,s=e.borderRadius,i=s===void 0?6:s,l=_n(),c=Pa(),u=c.animate,h=c.config,m=Ji({x:t-r/2,y:n-a/2,width:r,height:a,config:h,immediate:!u});return o.jsxs(o.Fragment,{children:[l.annotations.outline.outlineWidth>0&&o.jsx(Vn.rect,{x:m.x,y:m.y,rx:i,ry:i,width:m.width,height:m.height,style:Xi({},l.annotations.outline,{fill:"none",strokeWidth:l.annotations.outline.strokeWidth+2*l.annotations.outline.outlineWidth,stroke:l.annotations.outline.outlineColor,opacity:l.annotations.outline.outlineOpacity})}),o.jsx(Vn.rect,{x:m.x,y:m.y,rx:i,ry:i,width:m.width,height:m.height,style:l.annotations.outline})]})},ZK=function(e){var t=e.datum,n=e.x,r=e.y,a=e.note,s=$Ie(e);if(!PIe(a))throw new Error("note should be a valid react element");return o.jsxs(o.Fragment,{children:[o.jsx(RG,{points:s.points,isOutline:!0}),bg(e)&&o.jsx(HIe,{x:n,y:r,size:e.size}),n1(e)&&o.jsx(VIe,{x:n,y:r,size:e.size}),vg(e)&&o.jsx(GIe,{x:n,y:r,width:e.width,height:e.height,borderRadius:e.borderRadius}),o.jsx(RG,{points:s.points}),o.jsx(BIe,{datum:t,x:s.text[0],y:s.text[1],note:a})]})},NG=function(e,t){t.forEach(function(n,r){var a=n[0],s=n[1];r===0?e.moveTo(a,s):e.lineTo(a,s)})},eQ=function(e,t){var n=t.annotations,r=t.theme;n.length!==0&&(e.save(),n.forEach(function(a){if(!kIe(a.note))throw new Error("note is invalid for canvas implementation");r.annotations.link.outlineWidth>0&&(e.lineCap="square",e.strokeStyle=r.annotations.link.outlineColor,e.lineWidth=r.annotations.link.strokeWidth+2*r.annotations.link.outlineWidth,e.beginPath(),NG(e,a.computed.points),e.stroke(),e.lineCap="butt"),bg(a)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.arc(a.x,a.y,a.size/2,0,2*Math.PI),e.stroke()),n1(a)&&r.annotations.symbol.outlineWidth>0&&(e.strokeStyle=r.annotations.symbol.outlineColor,e.lineWidth=2*r.annotations.symbol.outlineWidth,e.beginPath(),e.arc(a.x,a.y,a.size/2,0,2*Math.PI),e.stroke()),vg(a)&&r.annotations.outline.outlineWidth>0&&(e.strokeStyle=r.annotations.outline.outlineColor,e.lineWidth=r.annotations.outline.strokeWidth+2*r.annotations.outline.outlineWidth,e.beginPath(),e.rect(a.x-a.width/2,a.y-a.height/2,a.width,a.height),e.stroke()),e.strokeStyle=r.annotations.link.stroke,e.lineWidth=r.annotations.link.strokeWidth,e.beginPath(),NG(e,a.computed.points),e.stroke(),bg(a)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.arc(a.x,a.y,a.size/2,0,2*Math.PI),e.stroke()),n1(a)&&(e.fillStyle=r.annotations.symbol.fill,e.beginPath(),e.arc(a.x,a.y,a.size/2,0,2*Math.PI),e.fill()),vg(a)&&(e.strokeStyle=r.annotations.outline.stroke,e.lineWidth=r.annotations.outline.strokeWidth,e.beginPath(),e.rect(a.x-a.width/2,a.y-a.height/2,a.width,a.height),e.stroke()),typeof a.note=="function"?a.note(e,{datum:a.datum,x:a.computed.text[0],y:a.computed.text[1],theme:r}):(e.font=r.annotations.text.fontSize+"px "+r.annotations.text.fontFamily,e.textAlign="left",e.textBaseline="alphabetic",e.fillStyle=r.annotations.text.fill,e.strokeStyle=r.annotations.text.outlineColor,e.lineWidth=2*r.annotations.text.outlineWidth,r.annotations.text.outlineWidth>0&&(e.lineJoin="round",e.strokeText(a.note,a.computed.text[0],a.computed.text[1]),e.lineJoin="miter"),e.fillText(a.note,a.computed.text[0],a.computed.text[1]))}),e.restore())};function _G(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zIe(e,t){var n=typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(a,s){if(a){if(typeof a=="string")return _G(a,s);var i={}.toString.call(a).slice(8,-1);return i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set"?Array.from(a):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_G(a,s):void 0}}(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p0(){return p0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p0.apply(null,arguments)}var tQ={nivo:["#e8c1a0","#f47560","#f1e15b","#e8a838","#61cdbb","#97e3d5"],category10:Ove,accent:Lve,dark2:Mve,paired:Dve,pastel1:Pve,pastel2:kve,set1:jve,set2:Uve,set3:wX,tableau10:Fve},qIe=Object.keys(tQ),nQ={brown_blueGreen:Cx,purpleRed_green:Ix,pink_yellowGreen:Ox,purple_orange:Lx,red_blue:Mx,red_grey:Dx,red_yellow_blue:Px,red_yellow_green:kx,spectral:jx},YIe=Object.keys(nQ),WIe={brown_blueGreen:$ve,purpleRed_green:Bve,pink_yellowGreen:Hve,purple_orange:Vve,red_blue:Gve,red_grey:zve,red_yellow_blue:qve,red_yellow_green:Yve,spectral:Wve},rQ={blues:Kx,greens:Qx,greys:Jx,oranges:tS,purples:Zx,reds:eS,blue_green:Ux,blue_purple:Fx,green_blue:$x,orange_red:Bx,purple_blue_green:Hx,purple_blue:Vx,purple_red:Gx,red_purple:zx,yellow_green_blue:qx,yellow_green:Yx,yellow_orange_brown:Wx,yellow_orange_red:Xx},XIe=Object.keys(rQ),KIe={blues:oAe,greens:lAe,greys:cAe,oranges:hAe,purples:uAe,reds:dAe,turbo:SAe,viridis:bAe,inferno:AAe,magma:vAe,plasma:RAe,cividis:fAe,warm:pAe,cool:gAe,cubehelixDefault:mAe,blue_green:Xve,blue_purple:Kve,green_blue:Qve,orange_red:Jve,purple_blue_green:Zve,purple_blue:eAe,purple_red:tAe,red_purple:nAe,yellow_green_blue:rAe,yellow_green:aAe,yellow_orange_brown:sAe,yellow_orange_red:iAe},Zw=p0({},tQ,nQ,rQ),QIe=function(e){return qIe.includes(e)},JIe=function(e){return YIe.includes(e)},ZIe=function(e){return XIe.includes(e)},eOe={rainbow:EAe,sinebow:xAe};p0({},WIe,KIe,eOe);var tOe=function(e){return e.theme!==void 0},nOe=function(e){return e.from!==void 0},rOe=function(e,t){if(typeof e=="function")return e;if(rS(e)){if(tOe(e)){if(t===void 0)throw new Error("Unable to use color from theme as no theme was provided");var n=Ti(t,e.theme);if(n===void 0)throw new Error("Color from theme is undefined at path: '"+e.theme+"'");return function(){return n}}if(nOe(e)){var r=function(c){return Ti(c,e.from)};if(Array.isArray(e.modifiers)){for(var a,s=[],i=function(){var c=a.value,u=c[0],h=c[1];if(u==="brighter")s.push(function(m){return m.brighter(h)});else if(u==="darker")s.push(function(m){return m.darker(h)});else{if(u!=="opacity")throw new Error("Invalid color modifier: '"+u+"', must be one of: 'brighter', 'darker', 'opacity'");s.push(function(m){return m.opacity=h,m})}},l=zIe(e.modifiers);!(a=l()).done;)i();return s.length===0?r:function(c){return s.reduce(function(u,h){return h(u)},Mh(r(c))).toString()}}return r}throw new Error("Invalid color spec, you should either specify 'theme' or 'from' when using a config object")}return function(){return e}},Ks=function(e,t){return v.useMemo(function(){return rOe(e,t)},[e,t])},aOe=function(e,t){if(typeof e=="function")return e;var n=typeof t=="function"?t:function(m){return Ti(m,t)};if(Array.isArray(e)){var r=Kc(e),a=function(m){return r(n(m))};return a.scale=r,a}if(rS(e)){if(function(m){return m.datum!==void 0}(e))return function(m){return Ti(m,e.datum)};if(function(m){return m.scheme!==void 0}(e)){if(QIe(e.scheme)){var s=Kc(Zw[e.scheme]),i=function(m){return s(n(m))};return i.scale=s,i}if(JIe(e.scheme)){if(e.size!==void 0&&(e.size<3||e.size>11))throw new Error("Invalid size '"+e.size+"' for diverging color scheme '"+e.scheme+"', must be between 3~11");var l=Kc(Zw[e.scheme][e.size||11]),c=function(m){return l(n(m))};return c.scale=l,c}if(ZIe(e.scheme)){if(e.size!==void 0&&(e.size<3||e.size>9))throw new Error("Invalid size '"+e.size+"' for sequential color scheme '"+e.scheme+"', must be between 3~9");var u=Kc(Zw[e.scheme][e.size||9]),h=function(m){return u(n(m))};return h.scale=u,h}}throw new Error("Invalid colors, when using an object, you should either pass a 'datum' or a 'scheme' property")}return function(){return e}},iS=function(e,t){return v.useMemo(function(){return aOe(e,t)},[e,t])},sOe=function(e){var t=e.x,n=e.y,r=e.size,a=e.fill,s=e.opacity,i=s===void 0?1:s,l=e.borderWidth,c=l===void 0?0:l,u=e.borderColor;return o.jsx("circle",{r:r/2,cx:t+r/2,cy:n+r/2,fill:a,opacity:i,strokeWidth:c,stroke:u===void 0?"transparent":u,style:{pointerEvents:"none"}})},iOe=function(e){var t=e.x,n=e.y,r=e.size,a=e.fill,s=e.opacity,i=s===void 0?1:s,l=e.borderWidth,c=l===void 0?0:l,u=e.borderColor;return o.jsx("g",{transform:"translate("+t+","+n+")",children:o.jsx("path",{d:"\n                    M"+r/2+" 0\n                    L"+.8*r+" "+r/2+"\n                    L"+r/2+" "+r+"\n                    L"+.2*r+" "+r/2+"\n                    L"+r/2+" 0\n                ",fill:a,opacity:i,strokeWidth:c,stroke:u===void 0?"transparent":u,style:{pointerEvents:"none"}})})},oOe=function(e){var t=e.x,n=e.y,r=e.size,a=e.fill,s=e.opacity,i=s===void 0?1:s,l=e.borderWidth,c=l===void 0?0:l,u=e.borderColor;return o.jsx("rect",{x:t,y:n,fill:a,opacity:i,strokeWidth:c,stroke:u===void 0?"transparent":u,width:r,height:r,style:{pointerEvents:"none"}})},lOe=function(e){var t=e.x,n=e.y,r=e.size,a=e.fill,s=e.opacity,i=s===void 0?1:s,l=e.borderWidth,c=l===void 0?0:l,u=e.borderColor;return o.jsx("g",{transform:"translate("+t+","+n+")",children:o.jsx("path",{d:"\n                M"+r/2+" 0\n                L"+r+" "+r+"\n                L0 "+r+"\n                L"+r/2+" 0\n            ",fill:a,opacity:i,strokeWidth:c,stroke:u===void 0?"transparent":u,style:{pointerEvents:"none"}})})};function Il(){return Il=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Il.apply(null,arguments)}var $s={translateX:0,translateY:0,padding:0,itemsSpacing:0,itemDirection:"left-to-right",justify:!1,symbolShape:"square",symbolSize:16,symbolSpacing:8},cOe={top:0,right:0,bottom:0,left:0},RD=function(e){var t,n=e.direction,r=e.itemsSpacing,a=e.padding,s=e.itemCount,i=e.itemWidth,l=e.itemHeight;if(typeof a!="number"&&(typeof(t=a)!="object"||Array.isArray(t)||t===null))throw new Error("Invalid property padding, must be one of: number, object");var c=typeof a=="number"?{top:a,right:a,bottom:a,left:a}:Il({},cOe,a),u=c.left+c.right,h=c.top+c.bottom,m=i+u,p=l+h,g=(s-1)*r;return n==="row"?m=i*s+g+u:n==="column"&&(p=l*s+g+h),{width:m,height:p,padding:c}},aQ=function(e){var t=e.anchor,n=e.translateX,r=e.translateY,a=e.containerWidth,s=e.containerHeight,i=e.width,l=e.height,c=n,u=r;switch(t){case"top":c+=(a-i)/2;break;case"top-right":c+=a-i;break;case"right":c+=a-i,u+=(s-l)/2;break;case"bottom-right":c+=a-i,u+=s-l;break;case"bottom":c+=(a-i)/2,u+=s-l;break;case"bottom-left":u+=s-l;break;case"left":u+=(s-l)/2;break;case"center":c+=(a-i)/2,u+=(s-l)/2}return{x:c,y:u}},sQ=function(e){var t,n,r,a,s,i,l=e.direction,c=e.justify,u=e.symbolSize,h=e.symbolSpacing,m=e.width,p=e.height;switch(l){case"left-to-right":t=0,n=(p-u)/2,a=p/2,i="central",c?(r=m,s="end"):(r=u+h,s="start");break;case"right-to-left":t=m-u,n=(p-u)/2,a=p/2,i="central",c?(r=0,s="start"):(r=m-u-h,s="end");break;case"top-to-bottom":t=(m-u)/2,n=0,r=m/2,s="middle",c?(a=p,i="alphabetic"):(a=u+h,i="text-before-edge");break;case"bottom-to-top":t=(m-u)/2,n=p-u,r=m/2,s="middle",c?(a=0,i="text-before-edge"):(a=p-u-h,i="alphabetic")}return{symbolX:t,symbolY:n,labelX:r,labelY:a,labelAnchor:s,labelAlignment:i}},uOe={circle:sOe,diamond:iOe,square:oOe,triangle:lOe},dOe=function(e){var t,n,r,a,s,i,l,c,u,h,m,p=e.x,g=e.y,T=e.width,y=e.height,b=e.data,x=e.direction,R=x===void 0?$s.itemDirection:x,A=e.justify,w=A===void 0?$s.justify:A,_=e.textColor,N=e.background,I=N===void 0?"transparent":N,D=e.opacity,M=D===void 0?1:D,O=e.symbolShape,L=O===void 0?$s.symbolShape:O,k=e.symbolSize,F=k===void 0?$s.symbolSize:k,U=e.symbolSpacing,B=U===void 0?$s.symbolSpacing:U,j=e.symbolBorderWidth,G=j===void 0?0:j,K=e.symbolBorderColor,J=K===void 0?"transparent":K,$=e.onClick,X=e.onMouseEnter,Z=e.onMouseLeave,V=e.toggleSerie,te=e.effects,ae=v.useState({}),ne=ae[0],ce=ae[1],ie=_n(),W=v.useCallback(function(qe){if(te){var Je=te.filter(function(lt){return lt.on==="hover"}).reduce(function(lt,at){return Il({},lt,at.style)},{});ce(Je)}X==null||X(b,qe)},[X,b,te]),Q=v.useCallback(function(qe){if(te){var Je=te.filter(function(lt){return lt.on!=="hover"}).reduce(function(lt,at){return Il({},lt,at.style)},{});ce(Je)}Z==null||Z(b,qe)},[Z,b,te]),se=sQ({direction:R,justify:w,symbolSize:(t=ne.symbolSize)!=null?t:F,symbolSpacing:B,width:T,height:y}),z=se.symbolX,xe=se.symbolY,le=se.labelX,pe=se.labelY,_e=se.labelAnchor,re=se.labelAlignment,Se=[$,X,Z,V].some(function(qe){return qe!==void 0}),$e=typeof L=="function"?L:uOe[L];return o.jsxs("g",{transform:"translate("+p+","+g+")",style:{opacity:(n=ne.itemOpacity)!=null?n:M},children:[o.jsx("rect",{width:T,height:y,fill:(r=ne.itemBackground)!=null?r:I,style:{cursor:Se?"pointer":"auto"},onClick:function(qe){$==null||$(b,qe),V==null||V(b.id)},onMouseEnter:W,onMouseLeave:Q}),v.createElement($e,Il({id:b.id,x:z,y:xe,size:(a=ne.symbolSize)!=null?a:F,fill:(s=(i=b.fill)!=null?i:b.color)!=null?s:"black",borderWidth:(l=ne.symbolBorderWidth)!=null?l:G,borderColor:(c=ne.symbolBorderColor)!=null?c:J},b.hidden?ie.legends.hidden.symbol:void 0)),o.jsx(cf,{textAnchor:_e,style:Il({},ie.legends.text,{fill:(u=(h=(m=ne.itemTextColor)!=null?m:_)!=null?h:ie.legends.text.fill)!=null?u:"black",dominantBaseline:re,pointerEvents:"none",userSelect:"none"},b.hidden?ie.legends.hidden.text:void 0),x:le,y:pe,children:b.label})]})},hOe=function(e){var t=e.data,n=e.x,r=e.y,a=e.direction,s=e.padding,i=s===void 0?$s.padding:s,l=e.justify,c=e.effects,u=e.itemWidth,h=e.itemHeight,m=e.itemDirection,p=m===void 0?$s.itemDirection:m,g=e.itemsSpacing,T=g===void 0?$s.itemsSpacing:g,y=e.itemTextColor,b=e.itemBackground,x=b===void 0?"transparent":b,R=e.itemOpacity,A=R===void 0?1:R,w=e.symbolShape,_=e.symbolSize,N=e.symbolSpacing,I=e.symbolBorderWidth,D=e.symbolBorderColor,M=e.onClick,O=e.onMouseEnter,L=e.onMouseLeave,k=e.toggleSerie,F=RD({itemCount:t.length,itemWidth:u,itemHeight:h,itemsSpacing:T,direction:a,padding:i}).padding,U=a==="row"?u+T:0,B=a==="column"?h+T:0;return o.jsx("g",{transform:"translate("+n+","+r+")",children:t.map(function(j,G){return o.jsx(dOe,{data:j,x:G*U+F.left,y:G*B+F.top,width:u,height:h,direction:p,justify:l,effects:c,textColor:y,background:x,opacity:A,symbolShape:w,symbolSize:_,symbolSpacing:N,symbolBorderWidth:I,symbolBorderColor:D,onClick:M,onMouseEnter:O,onMouseLeave:L,toggleSerie:k},G)})})},oS=function(e){var t=e.data,n=e.containerWidth,r=e.containerHeight,a=e.translateX,s=a===void 0?$s.translateX:a,i=e.translateY,l=i===void 0?$s.translateY:i,c=e.anchor,u=e.direction,h=e.padding,m=h===void 0?$s.padding:h,p=e.justify,g=e.itemsSpacing,T=g===void 0?$s.itemsSpacing:g,y=e.itemWidth,b=e.itemHeight,x=e.itemDirection,R=e.itemTextColor,A=e.itemBackground,w=e.itemOpacity,_=e.symbolShape,N=e.symbolSize,I=e.symbolSpacing,D=e.symbolBorderWidth,M=e.symbolBorderColor,O=e.onClick,L=e.onMouseEnter,k=e.onMouseLeave,F=e.toggleSerie,U=e.effects,B=RD({itemCount:t.length,itemsSpacing:T,itemWidth:y,itemHeight:b,direction:u,padding:m}),j=B.width,G=B.height,K=aQ({anchor:c,translateX:s,translateY:l,containerWidth:n,containerHeight:r,width:j,height:G}),J=K.x,$=K.y;return o.jsx(hOe,{data:t,x:J,y:$,direction:u,padding:m,justify:p,effects:U,itemsSpacing:T,itemWidth:y,itemHeight:b,itemDirection:x,itemTextColor:R,itemBackground:A,itemOpacity:w,symbolShape:_,symbolSize:N,symbolSpacing:I,symbolBorderWidth:D,symbolBorderColor:M,onClick:O,onMouseEnter:L,onMouseLeave:k,toggleSerie:typeof F=="boolean"?void 0:F})},fOe={start:"left",middle:"center",end:"right"},lS=function(e,t){var n=t.data,r=t.containerWidth,a=t.containerHeight,s=t.translateX,i=s===void 0?0:s,l=t.translateY,c=l===void 0?0:l,u=t.anchor,h=t.direction,m=t.padding,p=m===void 0?0:m,g=t.justify,T=g!==void 0&&g,y=t.itemsSpacing,b=y===void 0?0:y,x=t.itemWidth,R=t.itemHeight,A=t.itemDirection,w=A===void 0?"left-to-right":A,_=t.itemTextColor,N=t.symbolSize,I=N===void 0?16:N,D=t.symbolSpacing,M=D===void 0?8:D,O=t.theme,L=RD({itemCount:n.length,itemWidth:x,itemHeight:R,itemsSpacing:b,direction:h,padding:p}),k=L.width,F=L.height,U=L.padding,B=aQ({anchor:u,translateX:i,translateY:c,containerWidth:r,containerHeight:a,width:k,height:F}),j=B.x,G=B.y,K=h==="row"?x+b:0,J=h==="column"?R+b:0;e.save(),e.translate(j,G),xu(e,O.legends.text),n.forEach(function($,X){var Z,V=X*K+U.left,te=X*J+U.top,ae=sQ({direction:w,justify:T,symbolSize:I,symbolSpacing:M,width:x,height:R}),ne=ae.symbolX,ce=ae.symbolY,ie=ae.labelX,W=ae.labelY,Q=ae.labelAnchor,se=ae.labelAlignment;e.fillStyle=(Z=$.color)!=null?Z:"black",e.fillRect(V+ne,te+ce,I,I),e.textAlign=fOe[Q],se==="central"&&(e.textBaseline="middle"),Su(e,Il({},O.legends.text,{fill:_!=null?_:O.legends.text.fill}),String($.label),V+ie,te+W)}),e.restore()},mOe=function(e,t,n,r,a,s){s>0?(e.moveTo(t+s,n),e.lineTo(t+r-s,n),e.quadraticCurveTo(t+r,n,t+r,n+s),e.lineTo(t+r,n+a-s),e.quadraticCurveTo(t+r,n+a,t+r-s,n+a),e.lineTo(t+s,n+a),e.quadraticCurveTo(t,n+a,t,n+a-s),e.lineTo(t,n+s),e.quadraticCurveTo(t,n,t+s,n),e.closePath()):e.rect(t,n,r,a)};function yn(){return yn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},yn.apply(null,arguments)}function nc(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var wG,pOe=function(e){var t=e.bars,n=e.annotations,r=AD({data:t,annotations:n,getPosition:function(a){return{x:a.x+a.width/2,y:a.y+a.height/2}},getDimensions:function(a){var s=a.height,i=a.width;return{width:i,height:s,size:Math.max(i,s)}}});return o.jsx(o.Fragment,{children:r.map(function(a,s){return o.jsx(ZK,yn({},a),s)})})},gOe=function(e){var t=e.width,n=e.height,r=e.legends,a=e.toggleSerie;return o.jsx(o.Fragment,{children:r.map(function(s,i){var l,c=s[0],u=s[1];return o.jsx(oS,yn({},c,{containerWidth:t,containerHeight:n,data:(l=c.data)!=null?l:u,toggleSerie:c.toggleSerie&&c.dataFrom==="keys"?a:void 0}),i)})})},EOe=["data"],TOe=function(e){var t,n=e.bar,r=n.data,a=nc(n,EOe),s=e.style,i=s.borderColor,l=s.color,c=s.height,u=s.labelColor,h=s.labelOpacity,m=s.labelX,p=s.labelY,g=s.transform,T=s.width,y=s.textAnchor,b=e.borderRadius,x=e.borderWidth,R=e.label,A=e.shouldRenderLabel,w=e.isInteractive,_=e.onClick,N=e.onMouseEnter,I=e.onMouseLeave,D=e.tooltip,M=e.isFocusable,O=e.ariaLabel,L=e.ariaLabelledBy,k=e.ariaDescribedBy,F=e.ariaDisabled,U=e.ariaHidden,B=_n(),j=Zs(),G=j.showTooltipFromEvent,K=j.showTooltipAt,J=j.hideTooltip,$=v.useMemo(function(){return function(){return v.createElement(D,yn({},a,r))}},[D,a,r]),X=v.useCallback(function(ce){_==null||_(yn({color:a.color},r),ce)},[a,r,_]),Z=v.useCallback(function(ce){return G($(),ce)},[G,$]),V=v.useCallback(function(ce){N==null||N(r,ce),G($(),ce)},[r,N,G,$]),te=v.useCallback(function(ce){I==null||I(r,ce),J()},[r,J,I]),ae=v.useCallback(function(){K($(),[a.absX+a.width/2,a.absY])},[K,$,a]),ne=v.useCallback(function(){J()},[J]);return o.jsxs(Vn.g,{transform:g,children:[o.jsx(Vn.rect,{width:Gl(T,function(ce){return Math.max(ce,0)}),height:Gl(c,function(ce){return Math.max(ce,0)}),rx:b,ry:b,fill:(t=r.fill)!=null?t:l,strokeWidth:x,stroke:i,focusable:M,tabIndex:M?0:void 0,"aria-label":O?O(r):void 0,"aria-labelledby":L?L(r):void 0,"aria-describedby":k?k(r):void 0,"aria-disabled":F?F(r):void 0,"aria-hidden":U?U(r):void 0,onMouseEnter:w?V:void 0,onMouseMove:w?Z:void 0,onMouseLeave:w?te:void 0,onClick:w?X:void 0,onFocus:w&&M?ae:void 0,onBlur:w&&M?ne:void 0,"data-testid":"bar.item."+r.id+"."+r.index}),A&&o.jsx(cf,{x:m,y:p,textAnchor:y,dominantBaseline:"central",fillOpacity:h,style:yn({},B.labels.text,{pointerEvents:"none",fill:u}),children:R})]})},yOe=["color","label"],xOe=function(e){var t=e.color,n=e.label,r=nc(e,yOe);return o.jsx(Tx,{id:n,value:r.formattedValue,enableChip:!0,color:t})},Wn={indexBy:"id",keys:["value"],groupMode:"stacked",layout:"vertical",valueScale:{type:"linear",nice:!0,round:!1},indexScale:{type:"band",round:!1},padding:.1,innerPadding:0,enableGridX:!1,enableGridY:!0,enableLabel:!0,label:"formattedValue",labelPosition:"middle",labelOffset:0,labelSkipWidth:0,labelSkipHeight:0,labelTextColor:{theme:"labels.text.fill"},colorBy:"id",colors:{scheme:"nivo"},borderRadius:0,borderWidth:0,borderColor:{from:"color"},isInteractive:!0,tooltip:xOe,tooltipLabel:function(e){return e.id+" - "+e.indexValue},legends:[],initialHiddenIds:[],annotations:[],enableTotals:!1,totalsOffset:10},Yn=yn({},Wn,{layers:["grid","axes","bars","totals","markers","legends","annotations"],axisTop:null,axisRight:null,axisBottom:{},axisLeft:{},barComponent:TOe,defs:[],fill:[],markers:[],animate:!0,animateOnMount:!1,motionConfig:"default",role:"img",isFocusable:!1}),Or=yn({},Wn,{layers:["grid","axes","bars","totals","legends","annotations"],axisTop:null,axisRight:null,axisBottom:{},axisLeft:{},renderBar:function(e,t){var n=t.bar,r=n.color,a=n.height,s=n.width,i=n.x,l=n.y,c=t.borderColor,u=t.borderRadius,h=t.borderWidth,m=t.label,p=t.shouldRenderLabel,g=t.labelStyle,T=t.labelX,y=t.labelY,b=t.textAnchor;e.fillStyle=r,h>0&&(e.strokeStyle=c,e.lineWidth=h),e.beginPath(),mOe(e,i,l,s,a,Math.min(u,a)),e.fill(),h>0&&e.stroke(),p&&(e.textBaseline="middle",e.textAlign=b==="middle"?"center":b,Su(e,g,m,i+T,l+y))},pixelRatio:typeof window!="undefined"&&(wG=window.devicePixelRatio)!=null?wG:1}),iQ=function(e,t,n,r,a,s){return Sg(r,{all:e.map(t),min:0,max:0},a,s).padding(n)},oQ=function(e,t){return e.map(function(n){return yn({},t.reduce(function(r,a){return r[a]=null,r},{}),n)})},cS=function(e){return Object.keys(e).reduce(function(t,n){return e[n]&&(t[n]=e[n]),t},{})},uS=function(e){return[e,Number(e)]};function lQ(e,t,n,r){return e===void 0&&(e=Wn.layout),n===void 0&&(n=Wn.labelPosition),r===void 0&&(r=Wn.labelOffset),function(a,s){var i=r*(t?-1:1);if(e==="horizontal"){var l=a/2;return n==="start"?l=t?a:0:n==="end"&&(l=t?0:a),{labelX:l+i,labelY:s/2,textAnchor:n==="middle"?"middle":t?"end":"start"}}var c=s/2;return n==="start"?c=t?0:s:n==="end"&&(c=t?s:0),{labelX:a/2,labelY:c-i,textAnchor:"middle"}}}var SOe=["layout","width","height","padding","innerPadding","valueScale","indexScale","hiddenIds"],ND=function(e,t){return e>t},cQ=function(e,t){return e<t},uQ=function(e,t){return Array.from(" ".repeat(t-e),function(n,r){return e+r})},bOe=function(e){return ND(e,0)?0:e},vOe=function(e,t,n,r){var a=e.data,s=e.formatValue,i=e.getColor,l=e.getIndex,c=e.getTooltipLabel,u=e.innerPadding,h=u===void 0?0:u,m=e.keys,p=e.xScale,g=e.yScale,T=e.margin,y=n?cQ:ND,b=a.map(cS),x=[];return m.forEach(function(R,A){return uQ(0,p.domain().length).forEach(function(w){var _,N,I,D=uS(a[w][R]),M=D[0],O=D[1],L=l(a[w]),k=((_=p(L))!=null?_:0)+t*A+h*A,F=y(N=O,0)?(I=g(N))!=null?I:0:r,U=function(j,G){var K;return y(j,0)?r-G:((K=g(j))!=null?K:0)-r}(O,F),B={id:R,value:M===null?M:O,formattedValue:s(O),hidden:!1,index:w,indexValue:L,data:b[w]};x.push({key:R+"."+B.indexValue,index:x.length,data:B,x:k,y:F,absX:T.left+k,absY:T.top+F,width:t,height:U,color:i(B),label:c(B)})})}),x},AOe=function(e,t,n,r){var a=e.data,s=e.formatValue,i=e.getIndex,l=e.getColor,c=e.getTooltipLabel,u=e.keys,h=e.innerPadding,m=h===void 0?0:h,p=e.xScale,g=e.yScale,T=e.margin,y=n?cQ:ND,b=a.map(cS),x=[];return u.forEach(function(R,A){return uQ(0,g.domain().length).forEach(function(w){var _,N,I,D=uS(a[w][R]),M=D[0],O=D[1],L=i(a[w]),k=y(N=O,0)?r:(I=p(N))!=null?I:0,F=((_=g(L))!=null?_:0)+t*A+m*A,U=function(j,G){var K;return y(j,0)?((K=p(j))!=null?K:0)-r:r-G}(O,k),B={id:R,value:M===null?M:O,formattedValue:s(O),hidden:!1,index:w,indexValue:L,data:b[w]};x.push({key:R+"."+B.indexValue,index:x.length,data:B,x:k,y:F,absX:T.left+k,absY:T.top+F,width:U,height:t,color:l(B),label:c(B)})})}),x},ROe=function(e){var t,n,r,a=e.layout,s=e.width,i=e.height,l=e.padding,c=l===void 0?0:l,u=e.innerPadding,h=u===void 0?0:u,m=e.valueScale,p=e.indexScale,g=e.hiddenIds,T=g===void 0?[]:g,y=nc(e,SOe),b=y.keys.filter(function(G){return!T.includes(G)}),x=oQ(y.data,b),R=a==="vertical"?["y","x",s]:["x","y",i],A=R[0],w=R[1],_=R[2],N=iQ(x,y.getIndex,c,p,_,w),I=m.min==="auto"?bOe:function(G){return G},D=x.reduce(function(G,K){return[].concat(G,b.map(function(J){return K[J]}))},[]).filter(Boolean),M=I(Math.min.apply(Math,D)),O=(r=Math.max.apply(Math,D),isFinite(r)?r:0),L=Sg(m,{all:D,min:M,max:O},A==="x"?s:i,A),k=a==="vertical"?[N,L]:[L,N],F=k[0],U=k[1],B=(N.bandwidth()-h*(b.length-1))/b.length,j=[yn({},y,{data:x,keys:b,innerPadding:h,xScale:F,yScale:U}),B,(t=m.reverse)!=null&&t,(n=L(0))!=null?n:0];return{xScale:F,yScale:U,bars:B>0?a==="vertical"?vOe.apply(void 0,j):AOe.apply(void 0,j):[]}},NOe=["data","layout","width","height","padding","valueScale","indexScale","hiddenIds"],dQ=function(e){var t;return e.some(Array.isArray)?dQ((t=[]).concat.apply(t,e)):e},_Oe=function(e,t,n){var r=e.formatValue,a=e.getColor,s=e.getIndex,i=e.getTooltipLabel,l=e.innerPadding,c=e.stackedData,u=e.xScale,h=e.yScale,m=e.margin,p=[];return c.forEach(function(g){return u.domain().forEach(function(T,y){var b,x,R=g[y],A=(b=u(s(R.data)))!=null?b:0,w=((x=function(O){return h(O[n?0:1])}(R))!=null?x:0)+.5*l,_=function(O,L){var k;return((k=h(O[n?1:0]))!=null?k:0)-L}(R,w)-l,N=uS(R.data[g.key]),I=N[0],D=N[1],M={id:g.key,value:I===null?I:D,formattedValue:r(D),hidden:!1,index:y,indexValue:T,data:cS(R.data)};p.push({key:g.key+"."+T,index:p.length,data:M,x:A,y:w,absX:m.left+A,absY:m.top+w,width:t,height:_,color:a(M),label:i(M)})})}),p},wOe=function(e,t,n){var r=e.formatValue,a=e.getColor,s=e.getIndex,i=e.getTooltipLabel,l=e.innerPadding,c=e.stackedData,u=e.xScale,h=e.yScale,m=e.margin,p=[];return c.forEach(function(g){return h.domain().forEach(function(T,y){var b,x,R=g[y],A=(b=h(s(R.data)))!=null?b:0,w=((x=function(O){return u(O[n?1:0])}(R))!=null?x:0)+.5*l,_=function(O,L){var k;return((k=u(O[n?0:1]))!=null?k:0)-L}(R,w)-l,N=uS(R.data[g.key]),I=N[0],D=N[1],M={id:g.key,value:I===null?I:D,formattedValue:r(D),hidden:!1,index:y,indexValue:T,data:cS(R.data)};p.push({key:g.key+"."+T,index:p.length,data:M,x:w,y:A,absX:m.left+w,absY:m.top+A,width:_,height:t,color:a(M),label:i(M)})})}),p},COe=function(e){var t,n,r=e.data,a=e.layout,s=e.width,i=e.height,l=e.padding,c=l===void 0?0:l,u=e.valueScale,h=e.indexScale,m=e.hiddenIds,p=m===void 0?[]:m,g=nc(e,NOe),T=g.keys.filter(function(B){return!p.includes(B)}),y=CSe().keys(T).offset(ISe)(oQ(r,T)),b=a==="vertical"?["y","x",s]:["x","y",i],x=b[0],R=b[1],A=b[2],w=iQ(r,g.getIndex,c,h,A,R),_=(n=dQ(y),u.type==="log"?n.filter(function(B){return B!==0}):n),N=Math.min.apply(Math,_),I=Math.max.apply(Math,_),D=Sg(u,{all:_,min:N,max:I},x==="x"?s:i,x),M=a==="vertical"?[w,D]:[D,w],O=M[0],L=M[1],k=g.innerPadding>0?g.innerPadding:0,F=w.bandwidth(),U=[yn({},g,{innerPadding:k,stackedData:y,xScale:O,yScale:L}),F,(t=u.reverse)!=null&&t];return{xScale:O,yScale:L,bars:F>0?a==="vertical"?_Oe.apply(void 0,U):wOe.apply(void 0,U):[]}},IOe=function(e){var t=e.bars,n=e.direction,r=e.from,a=e.groupMode,s=e.layout,i=e.legendLabel,l=e.reverse,c=nK(i!=null?i:r==="indexes"?"indexValue":"id");return r==="indexes"?function(u,h,m){var p=QO(u.map(function(g){var T,y;return{id:(T=g.data.indexValue)!=null?T:"",label:m(g.data),hidden:g.data.hidden,color:(y=g.color)!=null?y:"#000"}}),function(g){return g.id});return h==="horizontal"&&p.reverse(),p}(t,s,c):function(u,h,m,p,g,T){var y=QO(u.map(function(b){var x;return{id:b.data.id,label:T(b.data),hidden:b.data.hidden,color:(x=b.color)!=null?x:"#000"}}),function(b){return b.id});return(h==="vertical"&&p==="stacked"&&m==="column"&&g!==!0||h==="horizontal"&&p==="stacked"&&g===!0)&&y.reverse(),y}(t,s,n,a,l,c)},CG=function(e,t,n){var r=e.get(t)||0;e.set(t,r+n)},OOe=function(e,t,n){var r=e.get(t)||0;e.set(t,r+(n>0?n:0))},LOe=function(e,t,n){var r=e.get(t)||0;e.set(t,Math.max(r,Number(n)))},MOe=function(e,t){var n=e.get(t)||0;e.set(t,n+1)},hQ=function(e){var t,n=e.indexBy,r=n===void 0?Wn.indexBy:n,a=e.keys,s=a===void 0?Wn.keys:a,i=e.label,l=i===void 0?Wn.label:i,c=e.tooltipLabel,u=c===void 0?Wn.tooltipLabel:c,h=e.valueFormat,m=e.colors,p=m===void 0?Wn.colors:m,g=e.colorBy,T=g===void 0?Wn.colorBy:g,y=e.borderColor,b=y===void 0?Wn.borderColor:y,x=e.labelTextColor,R=x===void 0?Wn.labelTextColor:x,A=e.groupMode,w=A===void 0?Wn.groupMode:A,_=e.layout,N=_===void 0?Wn.layout:_,I=e.data,D=e.margin,M=e.width,O=e.height,L=e.padding,k=L===void 0?Wn.padding:L,F=e.innerPadding,U=F===void 0?Wn.innerPadding:F,B=e.valueScale,j=B===void 0?Wn.valueScale:B,G=e.indexScale,K=G===void 0?Wn.indexScale:G,J=e.initialHiddenIds,$=J===void 0?Wn.initialHiddenIds:J,X=e.enableLabel,Z=X===void 0?Wn.enableLabel:X,V=e.labelSkipWidth,te=V===void 0?Wn.labelSkipWidth:V,ae=e.labelSkipHeight,ne=ae===void 0?Wn.labelSkipHeight:ae,ce=e.legends,ie=ce===void 0?Wn.legends:ce,W=e.legendLabel,Q=e.totalsOffset,se=Q===void 0?Wn.totalsOffset:Q,z=v.useState($!=null?$:[]),xe=z[0],le=z[1],pe=v.useCallback(function(Te){le(function(Oe){return Oe.indexOf(Te)>-1?Oe.filter(function(de){return de!==Te}):[].concat(Oe,[Te])})},[]),_e=Gi(r),re=Gi(l),Se=Gi(u),$e=ql(h),qe=_n(),Je=iS(p,T),lt=Ks(b,qe),at=Ks(R,qe),ot=(w==="grouped"?ROe:COe)({layout:N,data:I,getIndex:_e,keys:s,width:M,height:O,getColor:Je,padding:k,innerPadding:U,valueScale:j,indexScale:K,hiddenIds:xe,formatValue:$e,getTooltipLabel:Se,margin:D}),st=ot.bars,oe=ot.xScale,ue=ot.yScale,Ee=v.useMemo(function(){return st.filter(function(Te){return Te.data.value!==null}).map(function(Te,Oe){return yn({},Te,{index:Oe})})},[st]),Le=v.useCallback(function(Te){var Oe=Te.width,de=Te.height;return!!Z&&!(te>0&&Oe<te)&&!(ne>0&&de<ne)},[Z,te,ne]),ke=v.useMemo(function(){return s.map(function(Te){var Oe=st.find(function(de){return de.data.id===Te});return yn({},Oe,{data:yn({id:Te},Oe==null?void 0:Oe.data,{hidden:xe.includes(Te)})})})},[xe,s,st]),Ge=(t=j.reverse)!=null&&t,tt=v.useMemo(function(){return ie.map(function(Te){return[Te,IOe({bars:Te.dataFrom==="keys"?ke:st,direction:Te.direction,from:Te.dataFrom,groupMode:w,layout:N,legendLabel:W,reverse:Ge})]})},[ie,ke,st,w,N,W,Ge]),ct=v.useMemo(function(){return function(Te,Oe,de,Ae,we,Ie,Ke){Ae===void 0&&(Ae=Wn.layout),we===void 0&&(we=Wn.groupMode);var it=[];if(Te.length===0)return it;var De=new Map,nt=Te[0].width,Pt=Te[0].height;if(we==="stacked"){var pt=new Map;Te.forEach(function(_t){var et=_t.data,We=et.indexValue,yt=et.value;CG(De,We,Number(yt)),OOe(pt,We,Number(yt))}),pt.forEach(function(_t,et){var We,yt,Yt,tn=De.get(et)||0;Ae==="vertical"?(We=Oe(et),yt=de(_t),Yt=de(_t/2)):(We=Oe(_t),yt=de(et),Yt=Oe(_t/2)),We+=Ae==="vertical"?nt/2:Ie,yt+=Ae==="vertical"?-Ie:Pt/2,it.push({key:"total_"+et,x:We,y:yt,value:tn,formattedValue:Ke(tn),animationOffset:Yt})})}else if(we==="grouped"){var Bt=new Map,un=new Map;Te.forEach(function(_t){var et=_t.data,We=et.indexValue,yt=et.value;CG(De,We,Number(yt)),LOe(Bt,We,Number(yt)),MOe(un,We)}),Bt.forEach(function(_t,et){var We,yt,Yt,tn=De.get(et)||0,In=un.get(et);Ae==="vertical"?(We=Oe(et),yt=de(_t),Yt=de(_t/2)):(We=Oe(_t),yt=de(et),Yt=Oe(_t/2)),We+=Ae==="vertical"?In*nt/2:Ie,yt+=Ae==="vertical"?-Ie:In*Pt/2,it.push({key:"total_"+et,x:We,y:yt,value:tn,formattedValue:Ke(tn),animationOffset:Yt})})}return it}(st,oe,ue,N,w,se,$e)},[st,oe,ue,N,w,se,$e]);return{bars:st,barsWithValue:Ee,xScale:oe,yScale:ue,getIndex:_e,getLabel:re,getTooltipLabel:Se,formatValue:$e,getColor:Je,getBorderColor:lt,getLabelColor:at,shouldRenderBarLabel:Le,hiddenIds:xe,toggleSerie:pe,legendsWithData:tt,barTotals:ct}},DOe=function(e){var t=e.data,n=e.springConfig,r=e.animate,a=e.layout,s=a===void 0?Yn.layout:a,i=_n();return tc(t,{keys:function(l){return l.key},from:function(l){return{x:s==="vertical"?l.x:l.animationOffset,y:s==="vertical"?l.animationOffset:l.y,labelOpacity:0}},enter:function(l){return{x:l.x,y:l.y,labelOpacity:1}},update:function(l){return{x:l.x,y:l.y,labelOpacity:1}},leave:function(l){return{x:s==="vertical"?l.x:l.animationOffset,y:s==="vertical"?l.animationOffset:l.y,labelOpacity:0}},config:n,immediate:!r,initial:r?void 0:null})(function(l,c){return o.jsx(Vn.text,{x:l.x,y:l.y,fillOpacity:l.labelOpacity,style:yn({},i.labels.text,{pointerEvents:"none"}),fontWeight:"bold",fontSize:i.labels.text.fontSize,fontFamily:i.labels.text.fontFamily,textAnchor:s==="vertical"?"middle":"start",alignmentBaseline:s==="vertical"?"alphabetic":"middle",children:c.formattedValue},c.key)})},POe=["isInteractive","animate","motionConfig","theme","renderWrapper"],kOe=function(e){var t,n=e.data,r=e.indexBy,a=e.keys,s=e.margin,i=e.width,l=e.height,c=e.groupMode,u=e.layout,h=e.valueScale,m=e.indexScale,p=e.padding,g=e.innerPadding,T=e.axisTop,y=e.axisRight,b=e.axisBottom,x=b===void 0?Yn.axisBottom:b,R=e.axisLeft,A=R===void 0?Yn.axisLeft:R,w=e.enableGridX,_=w===void 0?Yn.enableGridX:w,N=e.enableGridY,I=N===void 0?Yn.enableGridY:N,D=e.gridXValues,M=e.gridYValues,O=e.layers,L=O===void 0?Yn.layers:O,k=e.barComponent,F=k===void 0?Yn.barComponent:k,U=e.enableLabel,B=U===void 0?Yn.enableLabel:U,j=e.label,G=e.labelSkipWidth,K=G===void 0?Yn.labelSkipWidth:G,J=e.labelSkipHeight,$=J===void 0?Yn.labelSkipHeight:J,X=e.labelTextColor,Z=e.labelPosition,V=Z===void 0?Yn.labelPosition:Z,te=e.labelOffset,ae=te===void 0?Yn.labelOffset:te,ne=e.markers,ce=ne===void 0?Yn.markers:ne,ie=e.colorBy,W=e.colors,Q=e.defs,se=Q===void 0?Yn.defs:Q,z=e.fill,xe=z===void 0?Yn.fill:z,le=e.borderRadius,pe=le===void 0?Yn.borderRadius:le,_e=e.borderWidth,re=_e===void 0?Yn.borderWidth:_e,Se=e.borderColor,$e=e.annotations,qe=$e===void 0?Yn.annotations:$e,Je=e.legendLabel,lt=e.tooltipLabel,at=e.valueFormat,ot=e.isInteractive,st=ot===void 0?Yn.isInteractive:ot,oe=e.tooltip,ue=oe===void 0?Yn.tooltip:oe,Ee=e.onClick,Le=e.onMouseEnter,ke=e.onMouseLeave,Ge=e.legends,tt=e.role,ct=tt===void 0?Yn.role:tt,Te=e.ariaLabel,Oe=e.ariaLabelledBy,de=e.ariaDescribedBy,Ae=e.isFocusable,we=Ae===void 0?Yn.isFocusable:Ae,Ie=e.barAriaLabel,Ke=e.barAriaLabelledBy,it=e.barAriaDescribedBy,De=e.barAriaHidden,nt=e.barAriaDisabled,Pt=e.initialHiddenIds,pt=e.enableTotals,Bt=pt===void 0?Yn.enableTotals:pt,un=e.totalsOffset,_t=un===void 0?Yn.totalsOffset:un,et=e.forwardedRef,We=Pa(),yt=We.animate,Yt=We.config,tn=zo(i,l,s),In=tn.outerWidth,ga=tn.outerHeight,Ur=tn.margin,Pn=tn.innerWidth,dr=tn.innerHeight,kn=hQ({indexBy:r,label:j,tooltipLabel:lt,valueFormat:at,colors:W,colorBy:ie,borderColor:Se,labelTextColor:X,groupMode:c,layout:u,data:n,keys:a,margin:Ur,width:Pn,height:dr,padding:p,innerPadding:g,valueScale:h,indexScale:m,enableLabel:B,labelSkipWidth:K,labelSkipHeight:$,legends:Ge,legendLabel:Je,initialHiddenIds:Pt,totalsOffset:_t}),dt=kn.bars,kt=kn.barsWithValue,jn=kn.xScale,Gn=kn.yScale,Wt=kn.getLabel,wt=kn.getTooltipLabel,Ct=kn.getBorderColor,Vt=kn.getLabelColor,On=kn.shouldRenderBarLabel,gn=kn.toggleSerie,zt=kn.legendsWithData,pn=kn.barTotals,ei=kn.getColor,or=lQ(u,(t=h==null?void 0:h.reverse)!=null&&t,V,ae),Ar=tc(kt,{keys:function(Tt){return Tt.key},from:function(Tt){return yn({borderColor:Ct(Tt),color:Tt.color,height:0,labelColor:Vt(Tt),labelOpacity:0},or(Tt.width,Tt.height),{transform:"translate("+Tt.x+", "+(Tt.y+Tt.height)+")",width:Tt.width},u==="vertical"?{}:{height:Tt.height,transform:"translate("+Tt.x+", "+Tt.y+")",width:0})},enter:function(Tt){return yn({borderColor:Ct(Tt),color:Tt.color,height:Tt.height,labelColor:Vt(Tt),labelOpacity:1},or(Tt.width,Tt.height),{transform:"translate("+Tt.x+", "+Tt.y+")",width:Tt.width})},update:function(Tt){return yn({borderColor:Ct(Tt),color:Tt.color,height:Tt.height,labelColor:Vt(Tt),labelOpacity:1},or(Tt.width,Tt.height),{transform:"translate("+Tt.x+", "+Tt.y+")",width:Tt.width})},leave:function(Tt){return yn({borderColor:Ct(Tt),color:Tt.color,height:0,labelColor:Vt(Tt),labelOpacity:0},or(Tt.width,Tt.height),{labelY:0,transform:"translate("+Tt.x+", "+(Tt.y+Tt.height)+")",width:Tt.width},u==="vertical"?{}:yn({},or(Tt.width,Tt.height),{labelX:0,height:Tt.height,transform:"translate("+Tt.x+", "+Tt.y+")",width:0}))},config:Yt,immediate:!yt,initial:yt?void 0:null}),hr=v.useMemo(function(){return{borderRadius:pe,borderWidth:re,enableLabel:B,isInteractive:st,labelSkipWidth:K,labelSkipHeight:$,onClick:Ee,onMouseEnter:Le,onMouseLeave:ke,getTooltipLabel:wt,tooltip:ue,isFocusable:we,ariaLabel:Ie,ariaLabelledBy:Ke,ariaDescribedBy:it,ariaHidden:De,ariaDisabled:nt}},[pe,re,B,wt,st,$,K,Ee,Le,ke,ue,we,Ie,Ke,it,De,nt]),ro=hD(se,dt,xe,{dataKey:"data",targetKey:"data.fill"}),zn={annotations:null,axes:null,bars:null,grid:null,legends:null,markers:null,totals:null};L.includes("annotations")&&(zn.annotations=o.jsx(pOe,{bars:dt,annotations:qe},"annotations")),L.includes("axes")&&(zn.axes=o.jsx(SD,{xScale:jn,yScale:Gn,width:Pn,height:dr,top:T,right:y,bottom:x,left:A},"axes")),L.includes("bars")&&(zn.bars=o.jsx(v.Fragment,{children:Ar(function(Tt,Rs){return v.createElement(F,yn({},hr,{bar:Rs,style:Tt,shouldRenderLabel:On(Rs),label:Wt(Rs.data)}))})},"bars")),L.includes("grid")&&(zn.grid=o.jsx(bD,{width:Pn,height:dr,xScale:_?jn:null,yScale:I?Gn:null,xValues:D,yValues:M},"grid")),L.includes("legends")&&(zn.legends=o.jsx(gOe,{width:Pn,height:dr,legends:zt,toggleSerie:gn},"legends")),L.includes("markers")&&(zn.markers=o.jsx(lD,{markers:ce,width:Pn,height:dr,xScale:jn,yScale:Gn},"markers")),L.includes("totals")&&Bt&&(zn.totals=o.jsx(DOe,{data:pn,springConfig:Yt,animate:yt,layout:u},"totals"));var As=yn({},hr,{margin:Ur,width:i,height:l,innerWidth:Pn,innerHeight:dr,bars:dt,legendData:zt,enableLabel:B,xScale:jn,yScale:Gn,tooltip:ue,getTooltipLabel:wt,onClick:Ee,onMouseEnter:Le,onMouseLeave:ke,getColor:ei});return o.jsx(Vg,{width:In,height:ga,margin:Ur,defs:ro,role:ct,ariaLabel:Te,ariaLabelledBy:Oe,ariaDescribedBy:de,isFocusable:we,ref:et,children:L.map(function(Tt,Rs){var sc;return typeof Tt=="function"?o.jsx(v.Fragment,{children:v.createElement(Tt,As)},Rs):(sc=zn==null?void 0:zn[Tt])!=null?sc:null})})},jOe=v.forwardRef(function(e,t){var n=e.isInteractive,r=n===void 0?Yn.isInteractive:n,a=e.animate,s=a===void 0?Yn.animate:a,i=e.motionConfig,l=i===void 0?Yn.motionConfig:i,c=e.theme,u=e.renderWrapper,h=nc(e,POe);return o.jsx(Vo,{animate:s,isInteractive:r,motionConfig:l,renderWrapper:u,theme:c,children:o.jsx(kOe,yn({},h,{isInteractive:r,forwardedRef:t}))})}),UOe=["isInteractive","renderWrapper","theme"],eC=function(e,t,n,r){return e.find(function(a){return dD(a.x+t.left,a.y+t.top,a.width,a.height,n,r)})},FOe=function(e){var t,n=e.data,r=e.indexBy,a=e.keys,s=e.margin,i=e.width,l=e.height,c=e.groupMode,u=e.layout,h=e.valueScale,m=e.indexScale,p=e.padding,g=e.innerPadding,T=e.axisTop,y=e.axisRight,b=e.axisBottom,x=b===void 0?Or.axisBottom:b,R=e.axisLeft,A=R===void 0?Or.axisLeft:R,w=e.enableGridX,_=w===void 0?Or.enableGridX:w,N=e.enableGridY,I=N===void 0?Or.enableGridY:N,D=e.gridXValues,M=e.gridYValues,O=e.labelPosition,L=O===void 0?Or.labelPosition:O,k=e.labelOffset,F=k===void 0?Or.labelOffset:k,U=e.layers,B=U===void 0?Or.layers:U,j=e.renderBar,G=j===void 0?Or.renderBar:j,K=e.enableLabel,J=K===void 0?Or.enableLabel:K,$=e.label,X=e.labelSkipWidth,Z=X===void 0?Or.labelSkipWidth:X,V=e.labelSkipHeight,te=V===void 0?Or.labelSkipHeight:V,ae=e.labelTextColor,ne=e.colorBy,ce=e.colors,ie=e.borderRadius,W=ie===void 0?Or.borderRadius:ie,Q=e.borderWidth,se=Q===void 0?Or.borderWidth:Q,z=e.borderColor,xe=e.annotations,le=xe===void 0?Or.annotations:xe,pe=e.legendLabel,_e=e.tooltipLabel,re=e.valueFormat,Se=e.isInteractive,$e=Se===void 0?Or.isInteractive:Se,qe=e.tooltip,Je=qe===void 0?Or.tooltip:qe,lt=e.onClick,at=e.onMouseEnter,ot=e.onMouseLeave,st=e.legends,oe=e.pixelRatio,ue=oe===void 0?Or.pixelRatio:oe,Ee=e.role,Le=e.forwardedRef,ke=e.enableTotals,Ge=ke===void 0?Or.enableTotals:ke,tt=e.totalsOffset,ct=tt===void 0?Or.totalsOffset:tt,Te=v.useRef(null),Oe=_n(),de=zo(i,l,s),Ae=de.margin,we=de.innerWidth,Ie=de.innerHeight,Ke=de.outerWidth,it=de.outerHeight,De=hQ({indexBy:r,label:$,tooltipLabel:_e,valueFormat:re,colors:ce,colorBy:ne,borderColor:z,labelTextColor:ae,groupMode:c,layout:u,data:n,keys:a,margin:Ae,width:we,height:Ie,padding:p,innerPadding:g,valueScale:h,indexScale:m,enableLabel:J,labelSkipWidth:Z,labelSkipHeight:te,legends:st,legendLabel:pe,totalsOffset:ct}),nt=De.bars,Pt=De.barsWithValue,pt=De.xScale,Bt=De.yScale,un=De.getLabel,_t=De.getTooltipLabel,et=De.getBorderColor,We=De.getLabelColor,yt=De.shouldRenderBarLabel,Yt=De.legendsWithData,tn=De.barTotals,In=De.getColor,ga=Zs(),Ur=ga.showTooltipFromEvent,Pn=ga.hideTooltip,dr=FIe({annotations:AD({data:nt,annotations:le,getPosition:function(wt){return{x:wt.x,y:wt.y}},getDimensions:function(wt){var Ct=wt.width,Vt=wt.height;return{width:Ct,height:Vt,size:Math.max(Ct,Vt)}}})}),kn=v.useMemo(function(){return{borderRadius:W,borderWidth:se,isInteractive:$e,isFocusable:!1,labelSkipWidth:Z,labelSkipHeight:te,margin:Ae,width:i,height:l,innerWidth:we,innerHeight:Ie,bars:nt,legendData:Yt,enableLabel:J,xScale:pt,yScale:Bt,tooltip:Je,getTooltipLabel:_t,onClick:lt,onMouseEnter:at,onMouseLeave:ot,getColor:In}},[W,se,$e,Z,te,Ae,i,l,we,Ie,nt,Yt,J,pt,Bt,Je,_t,lt,at,ot,In]),dt=ql(re),kt=lQ(u,(t=h==null?void 0:h.reverse)!=null&&t,L,F);v.useEffect(function(){if(Te.current){Te.current.width=Ke*ue,Te.current.height=it*ue;var wt=Te.current.getContext("2d");wt.scale(ue,ue),wt.fillStyle=Oe.background,wt.fillRect(0,0,Ke,it),wt.translate(Ae.left,Ae.top),B.forEach(function(Ct){Ct==="grid"?typeof Oe.grid.line.strokeWidth=="number"&&Oe.grid.line.strokeWidth>0&&(wt.lineWidth=Oe.grid.line.strokeWidth,wt.strokeStyle=Oe.grid.line.stroke,_&&Bh(wt,{width:we,height:Ie,scale:pt,axis:"x",values:D}),I&&Bh(wt,{width:we,height:Ie,scale:Bt,axis:"y",values:M})):Ct==="axes"?vD(wt,{xScale:pt,yScale:Bt,width:we,height:Ie,top:T,right:y,bottom:x,left:A,theme:Oe}):Ct==="bars"?(xu(wt,Oe.text),Pt.forEach(function(Vt){G(wt,yn({bar:Vt,borderColor:et(Vt),borderRadius:W,borderWidth:se,label:un(Vt.data),shouldRenderLabel:yt(Vt),labelStyle:yn({},Oe.labels.text,{fill:We(Vt)})},kt(Vt.width,Vt.height)))})):Ct==="legends"?Yt.forEach(function(Vt){var On=Vt[0],gn=Vt[1];lS(wt,yn({},On,{data:gn,containerWidth:we,containerHeight:Ie,theme:Oe}))}):Ct==="annotations"?eQ(wt,{annotations:dr,theme:Oe}):Ct==="totals"&&Ge?function(Vt,On,gn,zt){zt===void 0&&(zt=Or.layout),xu(Vt,gn.labels.text),Vt.textBaseline=zt==="vertical"?"alphabetic":"middle",Vt.textAlign=zt==="vertical"?"center":"start",On.forEach(function(pn){Su(Vt,gn.labels.text,pn.formattedValue,pn.x,pn.y)})}(wt,tn,Oe,u):typeof Ct=="function"&&Ct(wt,kn)}),wt.save()}},[x,A,y,T,Pt,W,se,dr,_,I,et,un,We,D,M,c,l,Ie,we,kn,B,u,Yt,Ae.left,Ae.top,it,Ke,ue,G,pt,Bt,yt,Oe,i,tn,Ge,dt,kt]);var jn=v.useCallback(function(wt){if(nt&&Te.current){var Ct=ou(Te.current,wt),Vt=Ct[0],On=Ct[1],gn=eC(nt,Ae,Vt,On);gn!==void 0?(Ur(v.createElement(Je,yn({},gn.data,{color:gn.color,label:gn.label,value:Number(gn.data.value)})),wt),wt.type==="mouseenter"&&(at==null||at(gn.data,wt))):Pn()}},[Pn,Ae,at,nt,Ur,Je]),Gn=v.useCallback(function(wt){if(nt&&Te.current){Pn();var Ct=ou(Te.current,wt),Vt=Ct[0],On=Ct[1],gn=eC(nt,Ae,Vt,On);gn&&(ot==null||ot(gn.data,wt))}},[Pn,Ae,ot,nt]),Wt=v.useCallback(function(wt){if(nt&&Te.current){var Ct=ou(Te.current,wt),Vt=Ct[0],On=Ct[1],gn=eC(nt,Ae,Vt,On);gn!==void 0&&(lt==null||lt(yn({},gn.data,{color:gn.color}),wt))}},[Ae,lt,nt]);return o.jsx("canvas",{ref:sS(Te,Le),width:Ke*ue,height:it*ue,style:{width:Ke,height:it,cursor:$e?"auto":"normal"},onMouseEnter:$e?jn:void 0,onMouseMove:$e?jn:void 0,onMouseLeave:$e?Gn:void 0,onClick:$e?Wt:void 0,role:Ee})},$Oe=v.forwardRef(function(e,t){var n=e.isInteractive,r=e.renderWrapper,a=e.theme,s=nc(e,UOe);return o.jsx(Vo,{isInteractive:n,renderWrapper:r,theme:a,animate:!1,children:o.jsx(FOe,yn({},s,{isInteractive:n,forwardedRef:t}))})}),BOe=["defaultWidth","defaultHeight","onResize","debounceResize"],_D=v.forwardRef(function(e,t){var n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=nc(e,BOe);return o.jsx(Go,{defaultWidth:n,defaultHeight:r,onResize:a,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(jOe,yn({},i,{width:c,height:u,ref:t}))}})}),HOe=["defaultWidth","defaultHeight","onResize","debounceResize"];v.forwardRef(function(e,t){var n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=nc(e,HOe);return o.jsx(Go,{defaultWidth:n,defaultHeight:r,onResize:a,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx($Oe,yn({},i,{width:c,height:u,ref:t}))}})});const VOe=({data:e,color:t="#2dd4bf",height:n=180,interactive:r=!0,exportable:a=!1,onExport:s})=>{const i={background:"transparent",text:{fontSize:12,fill:"rgba(255, 255, 255, 0.9)"},axis:{domain:{line:{stroke:"rgba(255, 255, 255, 0.1)",strokeWidth:1}},legend:{text:{fontSize:12,fill:"rgba(255, 255, 255, 0.8)"}},ticks:{line:{stroke:"rgba(255, 255, 255, 0.1)",strokeWidth:1},text:{fontSize:11,fill:"rgba(255, 255, 255, 0.8)"}}},grid:{line:{stroke:"rgba(255, 255, 255, 0.05)",strokeWidth:1}},tooltip:{container:{background:"rgba(0, 0, 0, 0.95)",color:"white",fontSize:12,borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",border:"1px solid rgba(255, 255, 255, 0.2)"}}},l=({id:p,value:g,data:T})=>o.jsxs("div",{className:"bg-black/95 border border-white/20 rounded-lg p-3 shadow-xl",children:[o.jsxs("div",{className:"text-sm font-medium text-white mb-1",children:["Range: ",T.range]}),o.jsxs("div",{className:"text-sm text-white/80",children:["Count: ",o.jsx("span",{className:"font-mono text-primary",children:g.toLocaleString()})]}),o.jsxs("div",{className:"text-xs text-white/60 mt-1",children:[T.binStart," → ",T.binEnd]})]}),c=()=>{m(e)},u=()=>{h(e)},h=(p,g)=>{const b={top:30,right:30,bottom:60,left:80},x=600-b.left-b.right,R=400-b.top-b.bottom,A=Math.max(...p.map(k=>k.count)),w=x/p.length,_=p.map((k,F)=>{const U=k.count/A*R,B=F*w,j=R-U;return'<rect x="'.concat(B,'" y="').concat(j,'" width="').concat(w-2,'" height="').concat(U,'" fill="#2dd4bf" opacity="0.8" stroke="#2dd4bf" stroke-width="1"/>')}).join(""),N='\n      <svg width="600" height="400" xmlns="http://www.w3.org/2000/svg" style="background: #1a1a1a;">\n        <defs>\n          <style>\n            text { font-family: Arial, sans-serif; }\n          </style>\n        </defs>\n        \n        <g transform="translate('.concat(b.left,", ").concat(b.top,')">\n          ').concat(_,'\n          \n          <!-- Axes -->\n          <line x1="0" y1="').concat(R,'" x2="').concat(x,'" y2="').concat(R,'" stroke="rgba(255,255,255,0.3)" stroke-width="2"/>\n          <line x1="0" y1="0" x2="0" y2="').concat(R,'" stroke="rgba(255,255,255,0.3)" stroke-width="2"/>\n          \n          <!-- Title -->\n          <text x="').concat(x/2,'" y="-10" text-anchor="middle" fill="white" font-size="16" font-weight="bold">\n            Data Distribution\n          </text>\n          \n          <!-- Axis labels -->\n          <text x="').concat(x/2,'" y="').concat(R+45,'" text-anchor="middle" fill="rgba(255,255,255,0.8)" font-size="14">\n            Value Range\n          </text>\n          <text x="-60" y="').concat(R/2,'" text-anchor="middle" fill="rgba(255,255,255,0.8)" font-size="14" transform="rotate(-90, -60, ').concat(R/2,')">\n            Count\n          </text>\n        </g>\n      </svg>\n    '),I=new Image,D=document.createElement("canvas"),M=D.getContext("2d");D.width=600,D.height=400,I.onload=()=>{M&&(M.drawImage(I,0,0),D.toBlob(k=>{if(k){const F=URL.createObjectURL(k),U=document.createElement("a");U.href=F,U.download="histogram_chart_".concat(Date.now(),".png"),U.click(),URL.revokeObjectURL(F)}},"image/png"))};const O=new Blob([N],{type:"image/svg+xml;charset=utf-8"}),L=URL.createObjectURL(O);I.src=L},m=(p,g)=>{const b={top:30,right:30,bottom:60,left:80},x=600-b.left-b.right,R=400-b.top-b.bottom,A=Math.max(...p.map(O=>O.count)),w=x/p.length,_=p.map((O,L)=>{const k=O.count/A*R,F=L*w,U=R-k;return'<rect x="'.concat(F,'" y="').concat(U,'" width="').concat(w-2,'" height="').concat(k,'" fill="#2dd4bf" opacity="0.8" stroke="#2dd4bf" stroke-width="1"/>')}).join(""),N='\n      <svg width="600" height="400" xmlns="http://www.w3.org/2000/svg" style="background: #1a1a1a;">\n        <defs>\n          <style>\n            text { font-family: Arial, sans-serif; }\n          </style>\n        </defs>\n        \n        <g transform="translate('.concat(b.left,", ").concat(b.top,')">\n          ').concat(_,'\n          \n          <!-- Axes -->\n          <line x1="0" y1="').concat(R,'" x2="').concat(x,'" y2="').concat(R,'" stroke="rgba(255,255,255,0.3)" stroke-width="2"/>\n          <line x1="0" y1="0" x2="0" y2="').concat(R,'" stroke="rgba(255,255,255,0.3)" stroke-width="2"/>\n          \n          <!-- Title -->\n          <text x="').concat(x/2,'" y="-10" text-anchor="middle" fill="white" font-size="16" font-weight="bold">\n            Data Distribution\n          </text>\n          \n          <!-- Axis labels -->\n          <text x="').concat(x/2,'" y="').concat(R+45,'" text-anchor="middle" fill="rgba(255,255,255,0.8)" font-size="14">\n            Value Range\n          </text>\n          <text x="-60" y="').concat(R/2,'" text-anchor="middle" fill="rgba(255,255,255,0.8)" font-size="14" transform="rotate(-90, -60, ').concat(R/2,')">\n            Count\n          </text>\n        </g>\n      </svg>\n    '),I=new Blob([N],{type:"image/svg+xml"}),D=URL.createObjectURL(I),M=document.createElement("a");M.href=D,M.download="histogram_".concat(Date.now(),".svg"),M.click(),URL.revokeObjectURL(D)};return o.jsxs("div",{className:"relative w-full",style:{height:n},children:[a&&o.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[o.jsx("button",{onClick:u,className:"px-2 py-1 bg-white/10 hover:bg-white/20 rounded text-xs text-white/70 hover:text-white transition-colors",children:"PNG"}),o.jsx("button",{onClick:c,className:"px-2 py-1 bg-white/10 hover:bg-white/20 rounded text-xs text-white/70 hover:text-white transition-colors",children:"SVG"})]}),o.jsx(_D,{data:e,keys:["count"],indexBy:"bin",margin:{top:20,right:25,bottom:60,left:65},padding:.1,valueScale:{type:"linear"},indexScale:{type:"band",round:!0},colors:[t],theme:i,borderRadius:2,borderColor:{from:"color",modifiers:[["darker",.3]]},axisTop:null,axisRight:null,axisBottom:{tickSize:5,tickPadding:12,tickRotation:0,legend:null,legendPosition:"middle",legendOffset:45},axisLeft:{tickSize:5,tickPadding:12,tickRotation:0,legend:null,legendPosition:"middle",legendOffset:-50},enableGridY:!0,enableGridX:!1,enableLabel:!1,isInteractive:r,tooltip:l,animate:!0,motionConfig:"gentle",role:"application",ariaLabel:"Data distribution histogram",barAriaLabel:function(p){return p.id+": "+p.formattedValue+" in range: "+p.indexValue}})]})},GOe=({data:e,colors:t=["#a855f7","#2dd4bf","#06b6d4","#8b5cf6","#10b981","#f59e0b","#ef4444"],height:n=180,interactive:r=!0,exportable:a=!1,onExport:s,maxItems:i=7})=>{const l=e.slice(0,i);if(!l||l.length===0)return o.jsx("div",{className:"flex items-center justify-center h-full text-white/60 text-sm",children:"No categorical data available"});const c={background:"transparent",text:{fontSize:12,fill:"rgba(255, 255, 255, 0.9)"},axis:{domain:{line:{stroke:"rgba(255, 255, 255, 0.1)",strokeWidth:1}},legend:{text:{fontSize:12,fill:"rgba(255, 255, 255, 0.8)"}},ticks:{line:{stroke:"rgba(255, 255, 255, 0.1)",strokeWidth:1},text:{fontSize:11,fill:"rgba(255, 255, 255, 0.8)"}}},grid:{line:{stroke:"rgba(255, 255, 255, 0.05)",strokeWidth:1}},tooltip:{container:{background:"rgba(0, 0, 0, 0.95)",color:"white",fontSize:12,borderRadius:6,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",border:"1px solid rgba(255, 255, 255, 0.2)"}}},u=({id:y,value:b,data:x})=>o.jsxs("div",{className:"bg-black/95 border border-white/20 rounded-lg p-3 shadow-xl",children:[o.jsx("div",{className:"text-sm font-medium text-white mb-1 max-w-48 truncate",children:x.value}),o.jsxs("div",{className:"text-sm text-white/80",children:["Count: ",o.jsx("span",{className:"font-mono text-secondary",children:b.toLocaleString()})]}),o.jsxs("div",{className:"text-sm text-white/80",children:[x.percentage.toFixed(1),"% of total"]})]}),h=y=>t[y%t.length],m=()=>{T(l)},p=()=>{g(l)},g=(y,b)=>{const A={top:30,right:30,bottom:60,left:120},w=600-A.left-A.right,_=400-A.top-A.bottom,N=Math.max(...y.map(B=>B.count)),I=_/y.length,D=y.map((B,j)=>{const G=B.count/N*w,K=j*I,J=h(j);return'\n        <rect x="0" y="'.concat(K,'" width="').concat(G,'" height="').concat(I-5,'" fill="').concat(J,'" opacity="0.8"/>\n        <text x="-10" y="').concat(K+I/2+5,'" text-anchor="end" fill="rgba(255,255,255,0.8)" font-size="12">\n          ').concat(B.value.length>15?B.value.substring(0,15)+"...":B.value,'\n        </text>\n        <text x="').concat(G+10,'" y="').concat(K+I/2+5,'" fill="rgba(255,255,255,0.8)" font-size="12">\n          ').concat(B.count," (").concat(B.percentage.toFixed(1),"%)\n        </text>\n      ")}).join(""),M='\n      <svg width="600" height="400" xmlns="http://www.w3.org/2000/svg" style="background: #1a1a1a;">\n        <defs>\n          <style>\n            text { font-family: Arial, sans-serif; }\n          </style>\n        </defs>\n        \n        <g transform="translate('.concat(A.left,", ").concat(A.top,')">\n          ').concat(D,'\n          \n          <!-- Axes -->\n          <line x1="0" y1="0" x2="0" y2="').concat(_,'" stroke="rgba(255,255,255,0.3)" stroke-width="2"/>\n          <line x1="0" y1="').concat(_,'" x2="').concat(w,'" y2="').concat(_,'" stroke="rgba(255,255,255,0.3)" stroke-width="2"/>\n          \n          <!-- Title -->\n          <text x="').concat(w/2,'" y="-10" text-anchor="middle" fill="white" font-size="16" font-weight="bold">\n            Value Distribution\n          </text>\n          \n          <!-- Axis labels -->\n          <text x="').concat(w/2,'" y="').concat(_+45,'" text-anchor="middle" fill="rgba(255,255,255,0.8)" font-size="14">\n            Count\n          </text>\n        </g>\n      </svg>\n    '),O=new Image,L=document.createElement("canvas"),k=L.getContext("2d");L.width=600,L.height=400,O.onload=()=>{k&&(k.drawImage(O,0,0),L.toBlob(B=>{if(B){const j=URL.createObjectURL(B),G=document.createElement("a");G.href=j,G.download="categorical_chart_".concat(Date.now(),".png"),G.click(),URL.revokeObjectURL(j)}},"image/png"))};const F=new Blob([M],{type:"image/svg+xml;charset=utf-8"}),U=URL.createObjectURL(F);O.src=U},T=(y,b)=>{const A={top:30,right:30,bottom:60,left:120},w=600-A.left-A.right,_=400-A.top-A.bottom,N=Math.max(...y.map(F=>F.count)),I=_/y.length,D=y.map((F,U)=>{const B=F.count/N*w,j=U*I,G=h(U);return'\n        <rect x="0" y="'.concat(j,'" width="').concat(B,'" height="').concat(I-5,'" fill="').concat(G,'" opacity="0.8"/>\n        <text x="-10" y="').concat(j+I/2+5,'" text-anchor="end" fill="rgba(255,255,255,0.8)" font-size="12">\n          ').concat(F.value.length>15?F.value.substring(0,15)+"...":F.value,'\n        </text>\n        <text x="').concat(B+10,'" y="').concat(j+I/2+5,'" fill="rgba(255,255,255,0.8)" font-size="12">\n          ').concat(F.count," (").concat(F.percentage.toFixed(1),"%)\n        </text>\n      ")}).join(""),M='\n      <svg width="600" height="400" xmlns="http://www.w3.org/2000/svg" style="background: #1a1a1a;">\n        <defs>\n          <style>\n            text { font-family: Arial, sans-serif; }\n          </style>\n        </defs>\n        \n        <g transform="translate('.concat(A.left,", ").concat(A.top,')">\n          ').concat(D,'\n          \n          <!-- Axes -->\n          <line x1="0" y1="0" x2="0" y2="').concat(_,'" stroke="rgba(255,255,255,0.3)" stroke-width="2"/>\n          <line x1="0" y1="').concat(_,'" x2="').concat(w,'" y2="').concat(_,'" stroke="rgba(255,255,255,0.3)" stroke-width="2"/>\n          \n          <!-- Title -->\n          <text x="').concat(w/2,'" y="-10" text-anchor="middle" fill="white" font-size="16" font-weight="bold">\n            Value Distribution\n          </text>\n          \n          <!-- Axis labels -->\n          <text x="').concat(w/2,'" y="').concat(_+45,'" text-anchor="middle" fill="rgba(255,255,255,0.8)" font-size="14">\n            Count\n          </text>\n        </g>\n      </svg>\n    '),O=new Blob([M],{type:"image/svg+xml"}),L=URL.createObjectURL(O),k=document.createElement("a");k.href=L,k.download="categorical_chart_".concat(Date.now(),".svg"),k.click(),URL.revokeObjectURL(L)};return o.jsxs("div",{className:"relative w-full",style:{height:n},children:[a&&o.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[o.jsx("button",{onClick:p,className:"px-2 py-1 bg-white/10 hover:bg-white/20 rounded text-xs text-white/70 hover:text-white transition-colors",children:"PNG"}),o.jsx("button",{onClick:m,className:"px-2 py-1 bg-white/10 hover:bg-white/20 rounded text-xs text-white/70 hover:text-white transition-colors",children:"SVG"})]}),o.jsx(_D,{data:l,keys:["count"],indexBy:"value",margin:{top:20,right:35,bottom:25,left:120},padding:.2,layout:"horizontal",valueScale:{type:"linear"},indexScale:{type:"band",round:!0},colors:({index:y})=>h(y),theme:c,borderRadius:3,borderColor:{from:"color",modifiers:[["darker",.2]]},axisTop:null,axisRight:null,axisBottom:{tickSize:5,tickPadding:8,tickRotation:0,legend:null,legendPosition:"middle",legendOffset:20,format:y=>y.toLocaleString()},axisLeft:{tickSize:5,tickPadding:12,tickRotation:0,legend:null,legendPosition:"middle",legendOffset:-90,format:y=>y.length>12?y.slice(0,12)+"...":y},enableGridY:!1,enableGridX:!0,enableLabel:!1,isInteractive:r,tooltip:u,animate:!0,motionConfig:"gentle",role:"application",ariaLabel:"Categorical data distribution",barAriaLabel:function(y){return y.id+": "+y.formattedValue+" for "+y.indexValue}})]})},zOe=({column:e,metrics:t,onExport:n})=>{const r=t.frequentValues.find(u=>u.column===e.name),a=()=>e.numericStats&&e.histogramData&&e.histogramData.length>0?o.jsx(ko,{className:"h-3 w-3 text-primary"}):r&&r.values.length>0?o.jsx(UW,{className:"h-3 w-3 text-secondary"}):o.jsx(qW,{className:"h-3 w-3 text-white/40"}),i=(()=>{const u=[];if(e.numericStats&&e.histogramData){const{mean:h,std:m,min:p,max:g}=e.numericStats,T=g-p,y=m/h;y<.1&&u.push("Low variation"),y>1&&u.push("High variation"),m>T*.3&&u.push("Wide spread");const b=e.histogramData.reduce((x,R)=>R.count>x.count?R:x);u.push("Peak: ".concat(b.range))}if(r){const h=r.values[0];h.percentage>50&&u.push("Dominant: ".concat(h.value," (").concat(h.percentage.toFixed(1),"%)")),r.values.length>=5&&u.push("".concat(r.values.length," categories"))}return u})();if(e.numericStats&&e.histogramData&&e.histogramData.length>0)return o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mt-3",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[a(),o.jsx("span",{className:"text-xs text-white/60",children:"Distribution"})]}),o.jsx("div",{className:"flex items-center gap-1"})]}),o.jsx(w3,{title:"",height:170,children:o.jsx(VOe,{data:e.histogramData,color:"hsl(175, 100%, 36%)",exportable:!!n,onExport:n})}),i.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:i.map((u,h)=>o.jsx("span",{className:"text-xs px-2 py-1 bg-primary/10 text-primary/80 rounded",children:u},h))})]});if(r&&r.values.length>0)return o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mt-3",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[a(),o.jsx("span",{className:"text-xs text-white/60",children:"Top Values"})]}),o.jsx("div",{className:"flex items-center gap-1"})]}),o.jsx(w3,{title:"",height:170,children:o.jsx(GOe,{data:r.values.slice(0,7),exportable:!!n,onExport:n})}),i.length>0&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:i.map((u,h)=>o.jsx("span",{className:"text-xs px-2 py-1 bg-secondary/10 text-secondary/80 rounded",children:u},h))})]});if(e.numericStats)return o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mt-3",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsxs("div",{className:"flex items-center gap-2",children:[a(),o.jsx("span",{className:"text-xs text-white/60",children:"Statistics"})]})}),o.jsx("div",{className:"p-3 bg-card/20 rounded-lg",children:o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-white/60",children:"Min:"}),o.jsx("span",{className:"text-white font-mono",children:e.numericStats.min.toLocaleString()})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-white/60",children:"Max:"}),o.jsx("span",{className:"text-white font-mono",children:e.numericStats.max.toLocaleString()})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-white/60",children:"Mean:"}),o.jsx("span",{className:"text-white font-mono",children:e.numericStats.mean.toFixed(2)})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-white/60",children:"Median:"}),o.jsx("span",{className:"text-white font-mono",children:e.numericStats.median.toFixed(2)})]})]})})]});if(e.textStats)return o.jsxs(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mt-3",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsxs("div",{className:"flex items-center gap-2",children:[a(),o.jsx("span",{className:"text-xs text-white/60",children:"Text Statistics"})]})}),o.jsx("div",{className:"p-3 bg-card/20 rounded-lg",children:o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-white/60",children:"Avg Length:"}),o.jsx("span",{className:"text-white font-mono",children:e.textStats.avgLength.toFixed(1)})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-white/60",children:"Max Length:"}),o.jsx("span",{className:"text-white font-mono",children:e.textStats.maxLength})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-white/60",children:"Empty:"}),o.jsx("span",{className:"text-white font-mono",children:e.textStats.emptyStrings})]}),o.jsxs("div",{className:"flex justify-between",children:[o.jsx("span",{className:"text-white/60",children:"Total Chars:"}),o.jsx("span",{className:"text-white font-mono",children:e.textStats.totalChars.toLocaleString()})]})]})})]});const c=e.nullCount>=e.uniqueCount*.9?{type:"no-data",message:"Column is mostly empty (90%+ null values)"}:e.uniqueCount<=1?{type:"inappropriate",message:"All values are the same - no distribution to show"}:e.uniqueCount===e.nullCount&&e.nullCount>0?{type:"no-data",message:"No valid data found for visualization"}:{type:"error",message:"Chart generation failed - data may be too complex"};return o.jsx(me.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"mt-3",children:o.jsxs("div",{className:"p-3 bg-card/10 rounded-lg border border-yellow-500/20",children:[o.jsx("div",{className:"flex items-center justify-between mb-2",children:o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"text-xs text-yellow-400",children:"⚠️ No Chart Available"})})}),o.jsx("div",{className:"text-xs text-white/70 mb-2",children:c.message}),o.jsxs("div",{className:"text-xs text-white/50",children:["Column: ",e.name," • Type: ",e.type," • Unique: ",e.uniqueCount," • Nulls: ",e.nullCount]})]})})},qOe=[{id:"csv",name:"CSV",description:"Unique values",icon:o.jsx(Bl,{className:"h-4 w-4"}),extension:".csv",requiresAuth:!0},{id:"json",name:"JSON",description:"Unique values",icon:o.jsx(RL,{className:"h-4 w-4"}),extension:".json",requiresAuth:!0},{id:"txt",name:"Text",description:"Unique values",icon:o.jsx(Xn,{className:"h-4 w-4"}),extension:".txt"}],YOe=({columnName:e,columnType:t,onExport:n,onAuthRequired:r,disabled:a=!1,className:s})=>{const[i,l]=v.useState(!1),[c,u]=v.useState(null),[h,m]=v.useState(null),{isAuthenticated:p}=ea(),g=b=>H(null,null,function*(){if(b.requiresAuth&&!p){r==null||r(),l(!1);return}u(b.id),m(null);try{yield n(b.id,e),m({format:b.name,status:"success",message:"".concat(b.name," exported successfully")})}catch(x){m({format:b.name,status:"error",message:"Export failed: ".concat(x instanceof Error?x.message:"Unknown error")})}finally{u(null),setTimeout(()=>m(null),3e3)}}),y=qOe.filter(b=>b.id==="chart"?t.includes("int")||t.includes("double")||t.includes("varchar")||t.includes("text"):!0);return o.jsxs("div",{className:Qe("relative",s),children:[o.jsxs("button",{onClick:()=>l(!i),disabled:a,className:Qe("flex items-center gap-2 px-3 py-1.5 bg-white/10 hover:bg-white/20 rounded-lg text-sm text-white/80 hover:text-white transition-all duration-200",a&&"opacity-50 cursor-not-allowed",i&&"bg-white/20"),children:[o.jsx(Hr,{className:"h-4 w-4"}),o.jsx("span",{children:"Export"}),o.jsx(me.div,{animate:{rotate:i?180:0},transition:{duration:.2},children:o.jsx(br,{className:"h-3 w-3"})})]}),o.jsx(At,{children:h&&o.jsx(me.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:Qe("absolute top-full right-0 mt-2 px-3 py-2 rounded-lg border text-sm z-50",h.status==="success"?"bg-emerald-500/20 border-emerald-500/30 text-emerald-300":"bg-red-500/20 border-red-500/30 text-red-300"),children:o.jsxs("div",{className:"flex items-center gap-2",children:[h.status==="success"?o.jsx(Zr,{className:"h-4 w-4"}):o.jsx(Cn,{className:"h-4 w-4"}),h.message]})})}),o.jsx(At,{children:i&&o.jsx(me.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full right-0 mt-2 w-64 bg-black/95 backdrop-blur-xl border border-white/20 rounded-lg shadow-xl z-50",children:o.jsxs("div",{className:"p-3",children:[o.jsxs("div",{className:"text-sm font-medium text-white mb-2",children:['Export "',e,'"']}),o.jsxs("div",{className:"text-xs text-white/60 mb-3",children:["Type: ",t]}),o.jsx("div",{className:"space-y-1",children:y.map(b=>o.jsxs("button",{onClick:()=>g(b),disabled:c===b.id,className:Qe("w-full flex items-center gap-3 p-2 rounded-lg text-left transition-colors",c===b.id?"bg-white/10 cursor-not-allowed":"hover:bg-white/10"),children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[c===b.id?o.jsx("div",{className:"h-4 w-4 border-2 border-white/20 border-t-white/60 rounded-full animate-spin"}):b.icon,o.jsxs("div",{children:[o.jsxs("div",{className:"text-sm font-medium text-white flex items-center gap-2",children:[b.name,b.requiresAuth&&!p&&o.jsx(_h,{className:"h-3 w-3 text-yellow-400"})]}),o.jsx("div",{className:"text-xs text-white/60",children:b.description})]})]}),o.jsx("div",{className:"text-xs text-white/50",children:b.extension})]},b.id))}),!p&&y.some(b=>b.requiresAuth)&&o.jsx("div",{className:"mt-3 pt-3 border-t border-white/10",children:o.jsxs("div",{className:"flex items-center gap-2 text-xs text-yellow-400",children:[o.jsx(_h,{className:"h-3 w-3"}),o.jsx("span",{children:"Downloading requires sign-in"})]})})]})})}),i&&o.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>l(!1)})]})},WOe=({column:e,metrics:t,isExpanded:n,onToggle:r,onViewDetails:a,onExportColumn:s,onAuthRequired:i})=>{const l=m=>{const p=m.toLowerCase();return p.includes("int")||p.includes("double")||p.includes("numeric")?o.jsx(hu,{className:"h-4 w-4 text-tertiary"}):p.includes("varchar")||p.includes("text")?o.jsx(Kh,{className:"h-4 w-4 text-blue-400"}):p.includes("date")||p.includes("time")?o.jsx(Fl,{className:"h-4 w-4 text-purple-400"}):o.jsx(Xn,{className:"h-4 w-4 text-white/50"})},c=()=>e.numericStats?"".concat(e.numericStats.min," - ").concat(e.numericStats.max):e.nullCount>0?"".concat(e.nullCount," nulls"):"".concat(e.uniqueCount," distinct"),h=(()=>{const m=e.nullPercentage,p=e.cardinality;return m>20?{icon:o.jsx(Ma,{className:"h-4 w-4 text-red-400"}),level:"critical"}:m>10||p>.9?{icon:o.jsx(Ma,{className:"h-4 w-4 text-yellow-400"}),level:"warning"}:{icon:o.jsx(Zr,{className:"h-4 w-4 text-emerald-400"}),level:"good"}})();return o.jsxs(me.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},className:"border-b border-white/5",children:[o.jsx(me.div,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.02)"},className:"p-4 transition-colors cursor-pointer",onClick:r,children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 p-1",children:[o.jsx(me.div,{animate:{rotate:n?90:0},transition:{duration:.2},children:o.jsx(nr,{className:"h-4 w-4 text-white/50"})}),l(e.type)]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("div",{className:"font-medium text-white truncate",children:e.name}),h.icon]}),o.jsx("div",{className:"text-xs text-white/60",children:e.type})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"text-sm text-white font-mono",children:c()}),o.jsxs("div",{className:"text-xs text-white/50",children:[e.uniqueCount," distinct"]})]})]}),o.jsxs("div",{className:"flex items-center gap-2 ml-4",onClick:m=>m.stopPropagation(),children:[o.jsx(YOe,{columnName:e.name,columnType:e.type,onExport:s,onAuthRequired:i}),o.jsx("button",{onClick:()=>a(e.name,"nulls"),className:"p-1 hover:bg-white/10 rounded text-white/60 hover:text-white transition-colors",title:"View details",children:o.jsx(Jr,{className:"h-4 w-4"})})]})]})}),o.jsx(At,{children:n&&o.jsx(me.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:o.jsxs("div",{className:"px-4 pb-4",children:[o.jsx(zOe,{column:e,metrics:t,onExport:m=>s(m,e.name),onViewDetails:()=>a(e.name,"nulls")}),o.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[o.jsxs("button",{onClick:()=>a(e.name,"nulls"),className:"px-3 py-1.5 bg-white/10 hover:bg-white/20 rounded text-xs text-white/80 hover:text-white transition-colors",children:["View Nulls (",e.nullCount,")"]}),e.numericStats&&e.numericStats.outliers>0&&o.jsxs("button",{onClick:()=>a(e.name,"outliers"),className:"px-3 py-1.5 bg-white/10 hover:bg-white/20 rounded text-xs text-white/80 hover:text-white transition-colors",children:["View Outliers (",e.numericStats.outliers,")"]})]})]})})})]})},XOe=({metrics:e,onViewDuplicates:t,onViewNulls:n,onViewIssues:r,onExportProblems:a,onAuthRequired:s})=>{const{t:i}=Ze(),{isAuthenticated:l}=ea(),[c,u]=v.useState(new Set),[h,m]=v.useState("all"),[p,g]=v.useState(new Set),[T,y]=v.useState(new Set),b=L=>{const k=new Set(c);k.has(L)?k.delete(L):k.add(L),u(k)},R=(()=>{const L=[];return e.duplicateRows>0&&L.push({id:"duplicates",type:"duplicates",severity:e.duplicatePercentage>10?"critical":e.duplicatePercentage>5?"warning":"info",title:i("inspector.problems.duplicateRows.title",{defaultValue:"Duplicate Rows"}),description:i("inspector.problems.duplicateRows.description",{count:e.duplicateRows,percentage:e.duplicatePercentage.toFixed(1),defaultValue:"{{count}} duplicate rows found ({{percentage}}% of total)"}),count:e.duplicateRows,percentage:e.duplicatePercentage}),e.columnMetrics.forEach(k=>{if(k.nullCount>0){const F=k.nullPercentage;L.push({id:"nulls-".concat(k.name),type:"nulls",severity:F>20?"critical":F>10?"warning":"info",title:i("inspector.problems.missingValues.title",{columnName:k.name,defaultValue:"Missing Values in {{columnName}}"}),description:i("inspector.problems.missingValues.description",{count:k.nullCount,percentage:F.toFixed(1),defaultValue:"{{count}} null values ({{percentage}}% of column)"}),count:k.nullCount,column:k.name,percentage:F})}}),e.typeIssues.forEach((k,F)=>{L.push({id:"type-".concat(k.column,"-").concat(F),type:"type_issue",severity:k.severity==="high"?"critical":k.severity==="medium"?"warning":"info",title:i("inspector.problems.typeIssue.title",{issue:k.issue,columnName:k.column,defaultValue:"{{issue}} in {{columnName}}"}),description:i("inspector.problems.typeIssue.description",{count:k.count,defaultValue:"{{count}} problematic values found"}),count:k.count,column:k.column,examples:k.examples})}),L.sort((k,F)=>{const U={critical:0,warning:1,info:2};return U[k.severity]-U[F.severity]})})(),A=R.filter(L=>h==="all"||L.severity===h),w=L=>{switch(L){case"critical":return o.jsx(Cn,{className:"h-4 w-4 text-red-400"});case"warning":return o.jsx(Ma,{className:"h-4 w-4 text-yellow-400"});case"info":return o.jsx(jo,{className:"h-4 w-4 text-blue-400"})}},_=L=>{switch(L){case"critical":return"text-red-400 bg-red-500/10 border-red-500/20";case"warning":return"text-yellow-400 bg-yellow-500/10 border-yellow-500/20";case"info":return"text-blue-400 bg-blue-500/10 border-blue-500/20"}},N=L=>{switch(L.type){case"duplicates":t==null||t();break;case"nulls":L.column&&(n==null||n(L.column));break;case"type_issue":L.column&&(r==null||r(L.column,L.title));break}},I=L=>H(null,null,function*(){if(!l){s==null||s();return}g(k=>new Set(k).add(L.id));try{switch(L.type){case"duplicates":yield a==null?void 0:a("duplicates");break;case"nulls":L.column&&(yield a==null?void 0:a("nulls",L.column));break;case"type_issue":L.column&&(yield a==null?void 0:a("type_issues",L.column));break}y(k=>new Set(k).add(L.id)),setTimeout(()=>{y(k=>{const F=new Set(k);return F.delete(L.id),F})},3e3)}catch(k){}finally{g(k=>{const F=new Set(k);return F.delete(L.id),F})}}),D=R.filter(L=>L.severity==="critical").length,M=R.filter(L=>L.severity==="warning").length,O=R.filter(L=>L.severity==="info").length;return R.length===0?o.jsxs(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex flex-col items-center justify-center p-8 text-center",children:[o.jsx("div",{className:"w-16 h-16 bg-emerald-500/20 rounded-full flex items-center justify-center mb-4",children:o.jsx(Ma,{className:"h-8 w-8 text-emerald-400"})}),o.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:i("inspector.problems.noProblems.title",{defaultValue:"No Problems Found!"})}),o.jsx("p",{className:"text-sm text-white/60 mb-4",children:i("inspector.problems.noProblems.description",{defaultValue:"Your data appears to be clean with no critical issues detected."})}),o.jsx("div",{className:"text-xs text-white/50",children:i("inspector.problems.noProblems.healthScore",{score:e.healthScore,defaultValue:"Health Score: {{score}}%"})})]}):o.jsxs(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"p-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"text-lg font-semibold text-white",children:i("inspector.problems.title",{defaultValue:"Data Quality Issues"})}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("div",{className:"text-xs text-white/60",children:i("inspector.problems.issueCount",{filtered:A.length,total:R.length,defaultValue:"{{filtered}} of {{total}} issues"})})})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[o.jsxs("button",{onClick:()=>m(h==="critical"?"all":"critical"),className:Qe("p-3 rounded-lg border transition-all duration-200 text-left",h==="critical"?"bg-red-500/20 border-red-500/30":"bg-red-500/10 border-red-500/20 hover:bg-red-500/15"),children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(Cn,{className:"h-4 w-4 text-red-400"}),o.jsx("span",{className:"text-sm font-medium text-red-400",children:i("inspector.problems.severity.critical",{defaultValue:"Critical"})})]}),o.jsx("div",{className:"text-lg font-bold text-white",children:D})]}),o.jsxs("button",{onClick:()=>m(h==="warning"?"all":"warning"),className:Qe("p-3 rounded-lg border transition-all duration-200 text-left",h==="warning"?"bg-yellow-500/20 border-yellow-500/30":"bg-yellow-500/10 border-yellow-500/20 hover:bg-yellow-500/15"),children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(Ma,{className:"h-4 w-4 text-yellow-400"}),o.jsx("span",{className:"text-sm font-medium text-yellow-400",children:i("inspector.problems.severity.warning",{defaultValue:"Warning"})})]}),o.jsx("div",{className:"text-lg font-bold text-white",children:M})]}),o.jsxs("button",{onClick:()=>m(h==="info"?"all":"info"),className:Qe("p-3 rounded-lg border transition-all duration-200 text-left",h==="info"?"bg-blue-500/20 border-blue-500/30":"bg-blue-500/10 border-blue-500/20 hover:bg-blue-500/15"),children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(jo,{className:"h-4 w-4 text-blue-400"}),o.jsx("span",{className:"text-sm font-medium text-blue-400",children:i("inspector.problems.severity.info",{defaultValue:"Info"})})]}),o.jsx("div",{className:"text-lg font-bold text-white",children:O})]})]}),h!=="all"&&o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsx("span",{className:"text-sm text-white/60",children:i("inspector.problems.filteredBy",{defaultValue:"Filtered by:"})}),o.jsxs("button",{onClick:()=>m("all"),className:"flex items-center gap-1 px-2 py-1 bg-white/10 hover:bg-white/20 rounded text-sm text-white/80 transition-colors",children:[h,o.jsx(ur,{className:"h-3 w-3"})]})]}),o.jsx("div",{className:"space-y-2",children:A.map(L=>o.jsxs(me.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},className:Qe("border rounded-lg transition-all duration-200",_(L.severity)),children:[o.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>b(L.id),children:[o.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 p-1",children:[o.jsx(me.div,{animate:{rotate:c.has(L.id)?90:0},transition:{duration:.2},children:o.jsx(nr,{className:"h-4 w-4 text-white/60"})}),w(L.severity)]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-white text-sm truncate",children:L.title}),o.jsx("div",{className:"text-xs text-white/60",children:L.description})]})]}),o.jsxs("div",{className:"flex items-center gap-2",onClick:k=>k.stopPropagation(),children:[o.jsx("button",{onClick:()=>N(L),className:"p-1 hover:bg-white/10 rounded text-white/60 hover:text-white transition-colors",title:i("inspector.problems.actions.viewDetails",{defaultValue:"View details"}),children:o.jsx(Jr,{className:"h-4 w-4"})}),o.jsx("button",{onClick:()=>I(L),disabled:p.has(L.id)||T.has(L.id),className:Qe("p-1 rounded transition-colors",p.has(L.id)?"cursor-not-allowed opacity-50":T.has(L.id)?"text-emerald-400":l?"hover:bg-white/10 text-white/60 hover:text-white":"hover:bg-yellow-500/10 text-yellow-400/70 hover:text-yellow-400"),title:p.has(L.id)?i("inspector.problems.actions.exporting",{defaultValue:"Exporting..."}):T.has(L.id)?i("inspector.problems.actions.exportCompleted",{defaultValue:"Export completed!"}):l?i("inspector.problems.actions.exportData",{defaultValue:"Export data"}):i("inspector.problems.actions.signInToExport",{defaultValue:"Sign in to export data"}),children:p.has(L.id)?o.jsx("div",{className:"h-4 w-4 border-2 border-white/20 border-t-white/60 rounded-full animate-spin"}):T.has(L.id)?o.jsx(Pr,{className:"h-4 w-4 text-emerald-400"}):l?o.jsx(Hr,{className:"text-white/60 h-4 w-4"}):o.jsx(Hr,{className:"text-white/60 h-4 w-4"})})]})]}),o.jsx(At,{children:c.has(L.id)&&o.jsx(me.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:o.jsx("div",{className:"px-3 pb-3 border-t border-white/10",children:o.jsxs("div",{className:"pt-3",children:[L.examples&&L.examples.length>0&&o.jsxs("div",{className:"mb-3",children:[o.jsx("div",{className:"text-xs text-white/60 mb-2",children:i("inspector.problems.details.examples",{defaultValue:"Examples:"})}),o.jsx("div",{className:"space-y-1",children:L.examples.map((k,F)=>o.jsx("div",{className:"text-xs font-mono bg-black/20 px-2 py-1 rounded text-white/80",children:k},F))})]}),o.jsxs("div",{className:"flex items-center gap-4 text-xs text-white/60",children:[o.jsx("div",{children:i("inspector.problems.details.count",{count:L.count.toLocaleString(),defaultValue:"Count: {{count}}"})}),L.percentage&&o.jsx("div",{children:i("inspector.problems.details.percentage",{percentage:L.percentage.toFixed(1),defaultValue:"Percentage: {{percentage}}%"})}),L.column&&o.jsx("div",{children:i("inspector.problems.details.column",{columnName:L.column,defaultValue:"Column: {{columnName}}"})})]})]})})})})]},L.id))}),A.length===0&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},className:"text-center py-8",children:o.jsx("div",{className:"text-sm text-white/60",children:i("inspector.problems.noIssuesFound",{filter:h,defaultValue:"No {{filter}} issues found"})})})]})},KOe=({fileName:e,onExport:t,onAuthRequired:n})=>{const[r,a]=v.useState(null),[s,i]=v.useState(null),{isAuthenticated:l}=ea(),c=[{id:"reports",name:"Analysis Reports",description:"Complete analysis with charts and insights",icon:o.jsx(Xn,{className:"h-6 w-6"}),formats:["PDF","HTML"],features:["Complete data analysis","Quality recommendations"],requiresAuth:!0},{id:"data",name:"Raw Data",description:"Export your data in various formats",icon:o.jsx(Bl,{className:"h-6 w-6"}),formats:["CSV","Excel","JSON","Parquet"],features:["Full dataset export"],requiresAuth:!0}],u=(m,p)=>H(null,null,function*(){const g=c.find(T=>T.id===p);if(g!=null&&g.requiresAuth&&!l){n==null||n();return}i({format:m,status:"loading",message:m==="PDF"?"Generating print-ready HTML report...":m==="Parquet"?"Preparing data files for Parquet conversion...":m==="Excel"?"Creating Excel-compatible CSV file...":"Preparing ".concat(m," export...")});try{yield t(m.toLowerCase(),{type:p}),i({format:m,status:"success",message:m==="PDF"?"HTML report ready - use browser print for PDF":m==="Parquet"?"JSON + CSV files downloaded for Parquet conversion":m==="Excel"?"CSV file downloaded (Excel compatible)":"".concat(m," export completed successfully")})}catch(T){const y=T instanceof Error?T.message:"Unknown error";y.includes("completed")||y.includes("ready")?i({format:m,status:"success",message:y}):i({format:m,status:"error",message:"Export failed: ".concat(y)})}setTimeout(()=>i(null),5e3)}),h=m=>{switch(m){case"success":return o.jsx(Zr,{className:"h-4 w-4 text-emerald-400"});case"error":return o.jsx(Cn,{className:"h-4 w-4 text-red-400"});case"loading":return o.jsx("div",{className:"h-4 w-4 border-2 border-white/20 border-t-white/60 rounded-full animate-spin"})}};return o.jsxs("div",{className:"p-6",children:[o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-lg font-semibold text-white mb-2",children:"Export Options"}),o.jsxs("p",{className:"text-sm text-white/60",children:["Export your analysis for ",e," in various formats"]})]}),o.jsx(At,{children:s&&o.jsxs(me.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:Qe("mb-6 p-4 rounded-lg border flex items-center gap-3",s.status==="success"?"bg-emerald-500/10 border-emerald-500/20":s.status==="error"?"bg-red-500/10 border-red-500/20":"bg-blue-500/10 border-blue-500/20"),children:[h(s.status),o.jsxs("div",{children:[o.jsxs("div",{className:"text-sm font-medium text-white",children:[s.format," Export"]}),o.jsx("div",{className:"text-xs text-white/70",children:s.message})]})]})}),o.jsx("div",{className:"space-y-4",children:c.map(m=>o.jsxs(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:Qe("border rounded-lg p-4 cursor-pointer transition-all duration-200",r===m.id?"border-primary/30 bg-primary/5":"border-white/10 hover:border-white/20 hover:bg-white/5"),onClick:()=>a(r===m.id?null:m.id),children:[o.jsxs("div",{className:"flex items-start gap-4",children:[o.jsx("div",{className:Qe("p-3 rounded-lg",r===m.id?"bg-primary/20":"bg-white/10"),children:m.icon}),o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h4",{className:"text-lg font-medium text-white",children:m.name}),m.requiresAuth&&!l&&o.jsx(_h,{className:"h-4 w-4 text-yellow-400"})]}),o.jsx("p",{className:"text-sm text-white/70 mb-3",children:m.description}),o.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:m.formats.map(p=>o.jsx("span",{className:"px-2 py-1 bg-white/10 text-white/80 rounded text-xs",children:p},p))}),o.jsx("div",{className:"space-y-1",children:m.features.map((p,g)=>o.jsxs("div",{className:"flex items-center gap-2 text-xs text-white/60",children:[o.jsx("div",{className:"w-1 h-1 bg-primary rounded-full"}),p]},g))})]})]}),o.jsx(At,{children:r===m.id&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"mt-4 pt-4 border-t border-white/10",children:o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:m.formats.map(p=>o.jsxs("button",{onClick:g=>{g.stopPropagation(),u(p,m.id)},disabled:(s==null?void 0:s.status)==="loading",className:Qe("p-3 rounded-lg border transition-colors text-left",(s==null?void 0:s.status)==="loading"?"bg-white/5 border-white/10 cursor-not-allowed":"bg-white/5 border-white/10 hover:bg-white/10 hover:border-white/20"),children:[o.jsx("div",{className:"text-sm font-medium text-white",children:p}),o.jsxs("div",{className:"text-xs text-white/60 mt-1",children:[p==="PDF"&&"Print-ready HTML report",p==="CSV"&&"Comma-separated values",p==="Excel"&&"CSV format (Excel compatible)",p==="JSON"&&"JavaScript Object Notation",p==="PNG"&&"High-resolution image",p==="SVG"&&"Vector graphics",p==="HTML"&&"Interactive web report",p==="Parquet"&&"JSON + CSV for conversion",p==="JSON API"&&"REST endpoint",p==="Webhook"&&"HTTP callbacks"]})]},p))})})})]},m.id))}),!l&&o.jsxs("div",{className:"mt-6 p-4 bg-blue-500/10 border border-blue-500/20 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(_h,{className:"h-4 w-4 text-blue-400"}),o.jsx("span",{className:"text-sm font-medium text-blue-400",children:"Export Features"})]}),o.jsx("p",{className:"text-xs text-white/70 mb-3",children:"Sign in to unlock downloading."}),o.jsx(je,{variant:"ghost",onClick:n,className:"px-4 py-2 text-white rounded-lg border border-blue-500/20 text-sm transition-colors",children:"Sign In"})]})]})},QOe=({isOpen:e,onClose:t,title:n,type:r,columnName:a,data:s,isLoading:i=!1,onRefresh:l})=>{const[c,u]=v.useState(""),[h,m]=v.useState(new Set),[p,g]=v.useState(1),[T]=v.useState(50);v.useEffect(()=>{if(s.length>0){const O=Object.keys(s[0]);m(new Set(O.slice(0,10)))}},[s]);const y=s.filter(O=>c?Object.values(O).some(L=>String(L).toLowerCase().includes(c.toLowerCase())):!0),b=(p-1)*T,x=y.slice(b,b+T),R=Math.ceil(y.length/T),A=s.length>0?Object.keys(s[0]):[],w=A.filter(O=>h.has(O)),_=O=>{const L=new Set(h);L.has(O)?L.delete(O):L.add(O),m(L)},N=O=>{navigator.clipboard.writeText(String(O))},I=()=>{switch(r){case"duplicates":return o.jsx(gi,{className:"h-5 w-5 text-orange-400"});case"nulls":return o.jsx(Ma,{className:"h-5 w-5 text-red-400"});case"outliers":return o.jsx(hu,{className:"h-5 w-5 text-purple-400"});case"type_issues":return o.jsx(Ma,{className:"h-5 w-5 text-yellow-400"});default:return o.jsx(Zr,{className:"h-5 w-5 text-white/60"})}},D=O=>O==null?o.jsx("span",{className:"text-red-400 italic",children:"null"}):O===""?o.jsx("span",{className:"text-yellow-400 italic",children:"empty"}):typeof O=="string"&&O.length>50?o.jsxs("span",{className:"font-mono text-sm",title:O,children:[O.slice(0,50),"..."]}):o.jsx("span",{className:"font-mono text-sm",children:String(O)}),M=O=>O===O?"text-primary":"text-white/80";return e?o.jsx(At,{children:o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[60] flex items-center justify-center p-4",onClick:t,children:o.jsxs(me.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},className:"bg-black/95 backdrop-blur-xl border border-white/20 rounded-lg shadow-2xl w-full max-w-6xl max-h-[90vh] flex flex-col",onClick:O=>O.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[I(),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white",children:n}),o.jsxs("div",{className:"text-sm text-white/60",children:[y.length," rows ",a&&"• Column: ".concat(a)]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[l&&o.jsx("button",{onClick:l,disabled:i,className:"p-2 hover:bg-white/10 rounded-lg text-white/70 hover:text-white transition-colors disabled:opacity-50",children:o.jsx(ma,{className:Qe("h-4 w-4",i&&"animate-spin")})}),o.jsx("button",{onClick:t,className:"p-2 hover:bg-white/10 rounded-lg text-white/70 hover:text-white transition-colors",children:o.jsx(ur,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(Qi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-white/50"}),o.jsx("input",{type:"text",placeholder:"Search rows...",value:c,onChange:O=>u(O.target.value),className:"w-full pl-10 pr-4 py-2 bg-white/10 border border-white/20 rounded-lg text-white placeholder-white/50 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary"})]}),o.jsx("div",{className:"relative",children:o.jsxs("details",{className:"group",children:[o.jsxs("summary",{className:"flex items-center gap-2 px-3 py-2 bg-white/10 hover:bg-white/20 rounded-lg text-sm text-white/80 cursor-pointer",children:[o.jsx(pfe,{className:"h-4 w-4"}),"Columns (",h.size,")"]}),o.jsx("div",{className:"absolute right-0 top-full mt-1 w-64 bg-black/95 border border-white/20 rounded-lg shadow-xl z-10 max-h-64 overflow-y-auto",children:o.jsx("div",{className:"p-3",children:A.map(O=>o.jsxs("label",{className:"flex items-center gap-2 p-1 hover:bg-white/10 rounded cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:h.has(O),onChange:()=>_(O),className:"rounded border-white/20 bg-white/10 text-primary focus:ring-primary"}),o.jsx("span",{className:"text-sm text-white/80 truncate",children:O})]},O))})})]})})]}),R>1&&o.jsxs("div",{className:"flex items-center justify-between text-sm text-white/60",children:[o.jsxs("div",{children:["Showing ",b+1,"-",Math.min(b+T,y.length)," of ",y.length]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>g(Math.max(1,p-1)),disabled:p===1,className:"px-3 py-1 bg-white/10 hover:bg-white/20 rounded text-white/80 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),o.jsxs("span",{className:"px-3 py-1",children:[p," of ",R]}),o.jsx("button",{onClick:()=>g(Math.min(R,p+1)),disabled:p===R,className:"px-3 py-1 bg-white/10 hover:bg-white/20 rounded text-white/80 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]}),o.jsx("div",{className:"flex-1 overflow-auto",children:i?o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsxs("div",{className:"flex items-center gap-2 text-white/60",children:[o.jsx(ma,{className:"h-4 w-4 animate-spin"}),"Loading rows..."]})}):x.length===0?o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-white/60 mb-2",children:"No rows found"}),c&&o.jsx("button",{onClick:()=>u(""),className:"text-sm text-primary hover:text-primary/80 transition-colors",children:"Clear search"})]})}):o.jsxs("table",{className:"w-full",children:[o.jsx("thead",{className:"sticky top-0 bg-black/90 backdrop-blur-sm border-b border-white/10",children:o.jsxs("tr",{children:[o.jsx("th",{className:"text-left p-3 text-xs font-medium text-white/70 w-12",children:"#"}),w.map(O=>o.jsx("th",{className:Qe("text-left p-3 text-xs font-medium min-w-32",M(O)),children:O},O))]})}),o.jsx("tbody",{children:x.map((O,L)=>o.jsxs(me.tr,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:L*.01},className:"border-b border-white/5 hover:bg-white/5 transition-colors",children:[o.jsx("td",{className:"p-3 text-xs text-white/60",children:b+L+1}),w.map(k=>o.jsxs("td",{className:"p-3 text-white/80 cursor-pointer group relative",onClick:()=>N(O[k]),title:"Click to copy",children:[D(O[k]),o.jsx(gi,{className:"absolute right-2 top-1/2 transform -translate-y-1/2 h-3 w-3 text-white/30 opacity-0 group-hover:opacity-100 transition-opacity"})]},k))]},L))})]})})]})})}):null},JOe=({className:e})=>{const{t}=Ze(),{isOpen:n,width:r,setWidth:a,closePanel:s,activeFileId:i,activeTableName:l,results:c,error:u,switchAnalysisTarget:h,exportResults:m,resetError:p,fetchDuplicateRows:g,fetchNullRows:T,fetchOutlierRows:y,fetchTypeIssueRows:b}=Yc(),x=ut(kr),R=ut(Qge),{isAuthenticated:A}=ea(),w=v.useRef(null),_=v.useRef(null),[N,I]=v.useState(!1),[D,M]=v.useState(new Set),[O,L]=v.useState(""),[k,F]=v.useState("all"),[U]=v.useState(Date.now()),[B,j]=v.useState("overview"),[G,K]=v.useState(!1),[J,$]=v.useState({isOpen:!1,title:"",type:"nulls",data:[]}),{quickPreview:X,isGettingPreview:Z,shouldShowPreview:V,isAnalyzing:te,analysisProgress:ae,analysisStatus:ne,manualTrigger:ce}=ETe({autoAnalysisDelay:1e3,autoOpenPanel:!1,showQuickPreview:!0}),ie=i?c.get(i):null,W=RTe((ie==null?void 0:ie.columnMetrics)||[],O,k),Q=ie?(ie.duplicateRows>0?1:0)+ie.columnMetrics.filter(oe=>oe.nullCount>0).length+ie.typeIssues.length:0,se=oe=>{const ue=new Set(D);ue.has(oe)?ue.delete(oe):ue.add(oe),M(ue)},z=oe=>{const ue=R.find(Ee=>Ee.id===oe);if(ue&&ue.fileName){const Ee=ut.getState().files.find(ke=>ke.id===oe),Le=Ee==null?void 0:Ee.tableName;Le&&h(oe,Le)}},xe=(oe,ue)=>H(null,null,function*(){if(!A&&["pdf","html","excel","parquet"].includes(oe)){K(!0);return}if(!(!i||!ie))try{if(["duplicates","nulls","type_issues"].includes(oe)){yield qe(oe,ue==null?void 0:ue.columnName);return}switch(oe.toLowerCase()){case"csv":yield le();break;case"json":yield pe();break;case"excel":yield re();break;case"pdf":yield Se();break;case"html":yield _e();break;case"parquet":yield $e();break;default:yield m(i)}}catch(Ee){throw Ee}}),le=()=>H(null,null,function*(){if(!l)throw new Error("No active table");const oe=Dt.getState(),ue=oe.registeredTables.get(l);if(!ue)throw new Error("Table not found");yield uTe(oe,ue,(x==null?void 0:x.fileName)||"data")}),pe=()=>H(null,null,function*(){if(!ie)throw new Error("No analysis results available");dTe(ie,x)}),_e=()=>H(null,null,function*(){ie&&sTe(ie,x)}),re=()=>H(null,null,function*(){yield le()}),Se=()=>H(null,null,function*(){if(!ie)throw new Error("No analysis results available");yield cTe(ie,x)}),$e=()=>H(null,null,function*(){if(!l)throw new Error("No active table");const oe=Dt.getState(),ue=oe.registeredTables.get(l);if(!ue)throw new Error("Table not found");yield hTe(oe,ue,x)}),qe=(oe,ue)=>H(null,null,function*(){if(!i||!l)throw new Error("No active file or table");try{yield iTe(oe,i,x==null?void 0:x.fileName,ue,{fetchDuplicateRows:g,fetchNullRows:T,fetchTypeIssueRows:b})}catch(Ee){throw Ee}}),Je=(oe,ue)=>H(null,null,function*(){if(!A&&["excel","chart"].includes(oe)){K(!0);return}if(!i||!ie)throw new Error("No active file or analysis results");try{const Ee=Dt.getState(),Le=Ee.registeredTables.get(l||"");if(!Le)throw new Error("Table not found");if(oe==="chart"){const ke=ie.columnMetrics.find(Ge=>Ge.name===ue);if(!ke)throw new Error("Column metrics not found");yield gTe(ke,"svg","".concat((x==null?void 0:x.fileName)||"data","_").concat(ue,"_chart_").concat(Date.now(),".svg"))}else yield fTe(Ee,Le,ue,oe,x)}catch(Ee){throw Ee}}),lt=(oe,ue)=>H(null,null,function*(){if(i)try{let Ee=[];switch(ue){case"duplicates":Ee=yield g(i,100);break;case"nulls":Ee=yield T(i,oe,100);break;case"outliers":Ee=yield y(i,oe,100);break}$({isOpen:!0,title:"".concat(oe," - ").concat(ue),type:ue==="duplicates"?"duplicates":ue==="outliers"?"outliers":"nulls",columnName:oe,data:Ee})}catch(Ee){$({isOpen:!0,title:"".concat(oe," - ").concat(ue),type:ue==="duplicates"?"duplicates":ue==="outliers"?"outliers":"nulls",columnName:oe,data:[]})}}),at=()=>{!x||!i||(p(),ce())},ot=()=>{L(""),F("all")};if(v.useEffect(()=>{L(""),F("all"),M(new Set),j("overview")},[i]),v.useEffect(()=>{let oe=0,ue=0;const Ee=tt=>{tt.preventDefault(),I(!0),oe=tt.clientX,ue=r,document.addEventListener("mousemove",Le),document.addEventListener("mouseup",ke),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},Le=tt=>{const ct=oe-tt.clientX,Te=ue+ct;a(Te)},ke=()=>{I(!1),document.removeEventListener("mousemove",Le),document.removeEventListener("mouseup",ke),document.body.style.cursor="",document.body.style.userSelect=""},Ge=_.current;if(Ge)return Ge.addEventListener("mousedown",Ee),()=>{Ge.removeEventListener("mousedown",Ee),document.removeEventListener("mousemove",Le),document.removeEventListener("mouseup",ke)}},[r,a]),v.useEffect(()=>{const oe=ue=>{ue.key==="Escape"&&n&&s()};return document.addEventListener("keydown",oe),()=>document.removeEventListener("keydown",oe)},[n,s]),!n)return null;if(x!=null&&x.isRemote&&(x==null?void 0:x.remoteProvider)==="postgresql")return o.jsxs("div",{className:Qe("fixed inset-y-0 right-0 z-50",e),children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/20 backdrop-blur-sm"}),o.jsx(me.div,{className:"relative h-full bg-background/95 backdrop-blur-md border-l border-white/10 shadow-2xl flex",style:{width:"".concat(Math.max(600,r),"px")},initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{duration:.3,ease:"easeInOut"},children:o.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",children:[o.jsxs(me.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"flex items-center justify-between p-4 border-b border-white/10",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("h2",{className:"text-lg font-semibold text-white",children:t("inspector.title",{defaultValue:"Data Inspector"})})}),o.jsx("button",{onClick:s,className:"p-2 hover:bg-white/10 rounded-lg text-white/70 hover:text-white transition-colors cursor-pointer",children:o.jsx(ur,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx("div",{className:"p-6 text-center",children:o.jsxs("div",{className:"flex flex-col items-center justify-center max-w-md mx-auto",children:[o.jsx("img",{src:XL,className:"h-10 w-10 mb-4",alt:"PostgreSQL"}),o.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:t("inspector.postgresql.title",{defaultValue:"PostgreSQL Inspector"})}),o.jsx("p",{className:"text-white/70 text-sm",children:t("inspector.postgresql.comingSoon",{defaultValue:"Coming soon! We're working on data inspection for PostgreSQL tables."})})]})})})]})})]});const st=({currentFileId:oe,onFileChange:ue})=>{const[Ee,Le]=v.useState(!1),ke=R.find(Ge=>Ge.id===oe);return R.length<=1?null:o.jsxs("div",{className:"relative p-4 border-b border-white/10",children:[o.jsxs(me.button,{whileHover:{scale:1.01},onClick:()=>Le(!Ee),className:"w-full flex items-center justify-between p-3 bg-card/30 hover:bg-card/50 rounded-lg border border-white/10 transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[o.jsx(Xn,{className:"h-4 w-4 text-white/60"}),o.jsx("span",{className:"text-sm text-white truncate",children:(ke==null?void 0:ke.fileName)||t("inspector.fileSelector.placeholder",{defaultValue:"Select file..."})})]}),o.jsx(me.div,{animate:{rotate:Ee?180:0},transition:{duration:.2},children:o.jsx(br,{className:"h-4 w-4 text-white/60"})})]}),o.jsx(At,{children:Ee&&o.jsx(me.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-4 right-4 mt-1 bg-card backdrop-blur-sm border border-white/20 rounded-lg shadow-xl z-51 max-h-48 overflow-y-auto",children:R.map(Ge=>o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},onClick:()=>{ue(Ge.id),Le(!1)},className:Qe("w-full flex items-center gap-2 p-3 text-left transition-colors cursor-pointer",Ge.id===oe&&"bg-primary/20 text-primary"),children:[o.jsx(Xn,{className:"h-3 w-3 flex-shrink-0"}),o.jsx("span",{className:"text-sm truncate",children:Ge.fileName})]},Ge.id))})})]})};return o.jsxs("div",{className:Qe("fixed inset-y-0 right-0 z-50",e),children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/20 backdrop-blur-sm"}),o.jsxs(me.div,{ref:w,className:"relative h-full bg-background/95 backdrop-blur-md border-l border-white/10 shadow-2xl flex",style:{width:"".concat(Math.max(600,r),"px")},initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{duration:.3,ease:"easeInOut"},children:[o.jsx("div",{ref:_,className:"absolute left-0 top-0 bottom-0 w-1 hover:bg-primary/50 cursor-col-resize transition-colors",style:{opacity:N?1:0,transition:N?"none":"opacity 0.2s ease"}}),o.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden",children:[o.jsxs(me.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"flex items-center justify-between p-4 border-b border-white/10",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("h2",{className:"text-lg font-semibold text-white",children:t("inspector.title",{defaultValue:"Data Inspector"})})}),o.jsx("button",{onClick:s,className:"p-2 hover:bg-white/10 rounded-lg text-white/70 hover:text-white transition-colors cursor-pointer",children:o.jsx(ur,{className:"h-4 w-4"})})]}),R.length>1&&o.jsx(st,{currentFileId:i,onFileChange:z}),ie&&!te&&!u&&o.jsx(NTe,{fileName:(x==null?void 0:x.fileName)||"Unknown",lastAnalyzed:new Date(ie.analysisTimestamp)}),ie&&!te&&!u&&o.jsx("div",{className:"p-4 border-b border-white/10",children:o.jsx(_Te,{currentView:B,onViewChange:j,problemCount:Q,columnCount:ie.columnMetrics.length,rowCount:ie.totalRows})}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[u&&!te&&o.jsx(vTe,{error:u,onRetry:at,onReset:p}),te&&o.jsx(STe,{progress:ae,status:ne,startTime:U,preview:X,estimatedTimeLeft:0}),V&&X&&!ie&&!u&&o.jsx("div",{className:"p-4",children:o.jsx(TTe,{preview:X,isAnalyzing:te||Z})}),ie&&!te&&!u&&o.jsxs(o.Fragment,{children:[B==="overview"&&o.jsx(wTe,{metrics:ie}),B==="columns"&&o.jsxs(o.Fragment,{children:[o.jsx(ATe,{searchTerm:O,onSearchChange:L,filterType:k,onFilterChange:F,totalColumns:ie.columnMetrics.length,filteredCount:W.length}),o.jsx("div",{className:"flex-1",children:W.length>0?o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},children:W.map((oe,ue)=>o.jsx(me.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:ue*.05},children:o.jsx(WOe,{column:oe,metrics:ie,isExpanded:D.has(oe.name),onToggle:()=>se(oe.name),onViewDetails:lt,onExportColumn:Je,onAuthRequired:()=>K(!0)})},oe.name))}):o.jsx(bTe,{searchTerm:O,filterType:k,onClearFilters:ot,totalColumns:ie.columnMetrics.length})})]}),B==="problems"&&o.jsx(XOe,{metrics:ie,onViewDuplicates:()=>lt("","duplicates"),onViewNulls:oe=>lt(oe,"nulls"),onViewIssues:oe=>lt(oe,"nulls"),onExportProblems:(oe,ue)=>xe(oe,ue?{columnName:ue}:void 0),onAuthRequired:()=>K(!0)}),B==="export"&&o.jsx(KOe,{fileName:(x==null?void 0:x.fileName)||"Unknown",onExport:xe,onAuthRequired:()=>K(!0)})]})]})]})]}),o.jsx(QOe,{isOpen:J.isOpen,onClose:()=>$(he(q({},J),{isOpen:!1})),title:J.title,type:J.type,columnName:J.columnName,data:J.data,onExport:xe}),o.jsx(Vl,{isOpen:G,onClose:()=>K(!1),defaultMode:"login",onLoginSuccess:()=>K(!1)})]})},ZOe=({currentPage:e,totalPages:t,totalRows:n,rowsPerPage:r,isCountLoading:a,onPageChange:s,columnCount:i,onRowsPerPageChange:l,disabled:c=!1,compact:u=!1})=>{const{t:h}=Ze(),m=y=>{const b=Number(y.target.value);l&&l(b)},p=(e-1)*r+1,g=n===-1,T=a?Math.min(e*r,p+r-1):g?p+r-1:Math.min(e*r,n);return o.jsxs("div",{className:"flex items-center bg-darkNav border-t border-white/10 ".concat(u?"px-1 sm:px-2 py-1 sm:py-2 justify-center lg:justify-between":"px-4 py-3 justify-center lg:justify-between"),children:[o.jsxs("div",{className:"items-center ".concat(u?"space-x-1 hidden xl:flex":"space-x-3 hidden lg:flex"),children:[o.jsxs("span",{className:"font-medium text-white/80 ".concat(u?"text-xs":"text-sm"),children:[h("pagination.show",{defaultValue:"Show"}),":"]}),o.jsxs("select",{value:r,onChange:m,disabled:c,className:"bg-background text-white font-medium rounded-md border border-white/20 hover:border-white/30 focus:border-primary focus:ring-1 focus:ring-primary/20 disabled:opacity-50 transition-all duration-200 ".concat(u?"text-xs px-1 sm:px-2 py-0.5 sm:py-1":"text-sm px-3 py-1.5"),children:[o.jsx("option",{value:100,children:"100"}),o.jsx("option",{value:500,children:"500"}),o.jsx("option",{value:1e3,children:u?"1K":"1,000"}),o.jsx("option",{value:5e3,children:u?"5K":"5,000"}),o.jsx("option",{value:1e4,children:u?"10K":"10,000"})]}),o.jsx("span",{className:"text-white/60 ".concat(u?"text-xs":"text-sm"),children:h("pagination.rows",{defaultValue:"rows"})})]}),o.jsx("div",{className:"items-center justify-center ".concat(u?"space-x-1 px-1 hidden sm:flex lg:flex-1":"space-x-2 hidden md:flex lg:flex-1"),children:a?o.jsxs("div",{className:"flex items-center ".concat(u?"space-x-1":"space-x-2"),children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("div",{className:"bg-primary rounded-full animate-pulse ".concat(u?"w-1 h-1":"w-1.5 h-1.5 mr-2")}),o.jsxs("span",{className:"font-medium text-white/90 ".concat(u?"text-xs":"text-sm"),children:[o.jsxs("span",{className:u?"hidden lg:inline":"hidden sm:inline",children:[h("pagination.showing",{defaultValue:"Showing"})," "]}),p.toLocaleString()," - ",T.toLocaleString()]})]}),!u&&o.jsx("div",{className:"text-white/40",children:"•"}),o.jsxs("div",{className:"flex items-center space-x-1",children:[o.jsxs("svg",{className:"text-primary animate-spin ".concat(u?"w-2 h-2 hidden sm:inline":"w-3 h-3"),fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),o.jsx("span",{className:"font-medium text-primary animate-pulse ".concat(u?"text-xs hidden sm:inline":"text-sm"),children:u?h("pagination.countingShort",{defaultValue:"Counting..."}):h("pagination.countingFull",{defaultValue:"Counting total rows..."})})]})]}):g?o.jsxs("span",{className:"font-medium text-white/90 ".concat(u?"text-xs":"text-sm"),children:[p.toLocaleString()," - ",T.toLocaleString(),o.jsxs("span",{className:"text-white/60 ml-1 ".concat(u?"hidden lg:inline":"hidden sm:inline"),children:["(",u?h("pagination.large",{defaultValue:"large"}):h("pagination.largeFile",{defaultValue:"large file"}),")"]})]}):o.jsxs("div",{className:"flex items-center ".concat(u?"space-x-2":"space-x-3"),children:[o.jsxs("span",{className:"font-medium text-white/90 ".concat(u?"text-xs":"text-sm"),children:[p.toLocaleString()," - ",T.toLocaleString(),o.jsxs("span",{className:u?"hidden lg:inline":"hidden sm:inline",children:[" ",h("pagination.of",{defaultValue:"of"})," ",o.jsx("span",{className:"text-white font-semibold",children:n.toLocaleString()})," ",h("pagination.rows",{defaultValue:"rows"})]})]}),i&&i>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-white/30",children:"•"}),o.jsxs("span",{className:"flex items-center gap-1 ".concat(u?"text-xs":"text-sm"),children:[o.jsx("span",{className:"font-semibold text-white",children:i}),o.jsx("span",{className:"text-white/60",children:h("pagination.columns",{defaultValue:"columns"})})]})]})]})}),o.jsxs("div",{className:"flex items-center ".concat(u?"space-x-0.5":"space-x-1"),children:[o.jsx(je,{variant:"ghost",size:"sm",className:"p-0 flex items-center justify-center rounded-md hover:bg-white/10 disabled:opacity-40 transition-all duration-200 ".concat(u?"h-5 w-5 sm:h-6 sm:w-6 hidden xl:flex":"h-8 w-8 hidden lg:flex"),disabled:c||e===1,onClick:()=>s(1),title:h("pagination.firstPage",{defaultValue:"First Page"}),children:o.jsx(FW,{size:u?12:16,className:u?"sm:size-3":""})}),o.jsx(je,{variant:"ghost",size:"sm",className:"p-0 flex items-center justify-center rounded-md hover:bg-white/10 disabled:opacity-40 transition-all duration-200 ".concat(u?"h-5 w-5 sm:h-6 sm:w-6":"h-8 w-8"),disabled:c||e===1,onClick:()=>s(e-1),title:h("pagination.previousPage",{defaultValue:"Previous Page"}),children:o.jsx(Dg,{size:u?12:16,className:u?"sm:size-3":""})}),o.jsx("div",{className:"text-center ".concat(u?"px-1 sm:px-2 min-w-[30px] sm:min-w-[40px] lg:min-w-[60px]":"px-3 min-w-[80px] lg:min-w-[140px]"),children:a&&t===0?o.jsxs("span",{className:"font-medium text-white/90 ".concat(u?"text-xs":"text-sm"),children:[o.jsx("span",{className:u?"hidden lg:inline":"hidden sm:inline",children:u?"":h("pagination.page",{defaultValue:"Page"})+" "}),o.jsx("span",{className:"font-semibold",children:e}),o.jsx("span",{className:"text-white/60 ".concat(u?"hidden lg:inline":"hidden sm:inline"),children:u?" / ?":" "+h("pagination.of",{defaultValue:"of"})+" ?"})]}):g?o.jsxs("span",{className:"font-medium text-white/90 ".concat(u?"text-xs":"text-sm"),children:[o.jsx("span",{className:u?"hidden lg:inline":"hidden sm:inline",children:u?"":h("pagination.page",{defaultValue:"Page"})+" "}),o.jsx("span",{className:"font-semibold",children:e})]}):t===0?o.jsxs("span",{className:"font-medium text-white/90 ".concat(u?"text-xs":"text-sm"),children:[o.jsx("span",{className:u?"hidden lg:inline":"hidden sm:inline",children:u?"":h("pagination.page",{defaultValue:"Page"})+" "}),o.jsx("span",{className:"font-semibold",children:e})]}):o.jsxs("span",{className:"font-medium text-white/90 ".concat(u?"text-xs":"text-sm"),children:[o.jsx("span",{className:u?"hidden lg:inline":"hidden sm:inline",children:u?"":h("pagination.page",{defaultValue:"Page"})+" "}),o.jsx("span",{className:"font-semibold",children:e.toLocaleString()}),o.jsx("span",{className:u?"hidden lg:inline":"hidden sm:inline",children:u?" / ".concat(t):" ".concat(h("pagination.of",{defaultValue:"of"})," ").concat(t.toLocaleString())})]})}),o.jsx(je,{variant:"ghost",size:"sm",className:"p-0 flex items-center justify-center rounded-md hover:bg-white/10 disabled:opacity-40 transition-all duration-200 ".concat(u?"h-5 w-5 sm:h-6 sm:w-6":"h-8 w-8"),disabled:c||!g&&(e===t||t===0),onClick:()=>s(e+1),title:h("pagination.nextPage",{defaultValue:"Next Page"}),children:o.jsx(nr,{size:u?12:16,className:u?"sm:size-3":""})}),o.jsx(je,{variant:"ghost",size:"sm",className:"p-0 flex items-center justify-center rounded-md hover:bg-white/10 disabled:opacity-40 transition-all duration-200 ".concat(u?"h-5 w-5 sm:h-6 sm:w-6 hidden xl:flex":"h-8 w-8 hidden lg:flex"),disabled:c||g||e===t||t===0,onClick:()=>s(t),title:g?h("pagination.notAvailableForViews",{defaultValue:"Not available for views"}):h("pagination.lastPage",{defaultValue:"Last Page"}),children:o.jsx($W,{size:u?12:16,className:u?"sm:size-3":""})})]})]})},e1e=({isOpen:e,position:t,onClose:n,onCopy:r,isHeader:a=!1,onSort:s,cellValue:i=""})=>{const{t:l}=Ze();if(!e)return null;const c=u=>{u(),n()};return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-40",onClick:n}),o.jsx(At,{children:o.jsx(me.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.1},className:"fixed z-50 bg-black/90 backdrop-blur-xl border border-white/20 rounded-lg shadow-2xl py-1 min-w-[160px]",style:{left:t.x,top:t.y},children:a?o.jsxs(o.Fragment,{children:[o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:()=>c(()=>s==null?void 0:s("asc")),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors",children:[o.jsx(DW,{size:14}),l("dataGrid.contextMenu.sortAscending",{defaultValue:"Sort Ascending"})]}),o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:()=>c(()=>s==null?void 0:s("desc")),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors",children:[o.jsx(MW,{size:14}),l("dataGrid.contextMenu.sortDescending",{defaultValue:"Sort Descending"})]})]}):o.jsxs(me.button,{whileHover:{backgroundColor:"rgba(255, 255, 255, 0.1)"},whileTap:{scale:.98},onClick:()=>c(r),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-white/80 hover:text-white transition-colors",children:[o.jsx(gi,{size:14}),l("dataGrid.contextMenu.copy",{value:i.length>15?i.substring(0,15)+"...":i,defaultValue:'Copy "{{value}}"'})]})})})]})},dS=(e=[],t=!1,n)=>{const r=v.useCallback((s,i,l)=>{if(i===0||l===0||!s||!t||!e||e.length===0||l-1>=e.length)return s;switch(e[l-1]){case Nt.Number:const u=parseFloat(s);if(!isNaN(u))return u.toString();break;case Nt.Boolean:if(s.toLowerCase()==="true"||s.toLowerCase()==="yes")return"✓";if(s.toLowerCase()==="false"||s.toLowerCase()==="no")return"✗";break;case Nt.Date:try{if(/\d{1,4}[-/]\d{1,2}[-/]\d{1,4}/.test(s)){const h=new Date(s);if(!isNaN(h.getTime()))return h.toLocaleDateString()}else{const h=Number(s);if(!isNaN(h)&&h>9466848e5&&h<41024448e5)return new Date(h).toISOString().split("T")[0]}}catch(h){}break}return s},[t,e]),a=v.useCallback((s,i)=>{var c;let l="";if(s===0)l="csv-grid-header",i>0&&(l+=" pr-8");else if(i===0)l="csv-grid-row-number";else{if(l="csv-grid-cell",t&&e.length>0&&i-1<e.length)switch(e[i-1]){case Nt.Number:l+=" csv-grid-cell-number";break;case Nt.Date:l+=" csv-grid-cell-date";break;case Nt.Boolean:l+=" csv-grid-cell-boolean";break}if(!t&&(n!=null&&n.animationActive)){const u=(c=n.gridData[s])==null?void 0:c[i];if(u){const h=n.animationMessage.indexOf(u);h!==-1&&(h===n.activeWordIndex?l+=" animate-word-entry text-primary font-medium":l+=" text-primary font-medium")}}}return l},[t,e,n]);return{formatCellValue:r,getCellClass:a}},t1e=e=>{const[t,n]=v.useState({columnIndex:null,direction:null}),r=v.useCallback((i,l)=>{n({columnIndex:i,direction:l})},[]),a=v.useCallback(()=>{n({columnIndex:null,direction:null})},[]);return{sortedData:v.useMemo(()=>{var m;if(!t.columnIndex||!t.direction||!e.length)return e;const{columnIndex:i,direction:l}=t;if(i>=((m=e[0])==null?void 0:m.length))return e;const c=e[0],h=[...e.slice(1)].sort((p,g)=>{const T=p[i]||"",y=g[i]||"",b=parseFloat(T),x=parseFloat(y);let R=0;return!isNaN(b)&&!isNaN(x)?R=b-x:R=T.toLowerCase().localeCompare(y.toLowerCase()),l==="asc"?R:-R});return[c,...h]},[e,t]),sortState:t,sortData:r,clearSort:a}},n1e=()=>{const{showSuccess:e}=ec(),[t,n]=v.useState({isOpen:!1,position:{x:0,y:0},rowIndex:-1,columnIndex:-1,cellValue:"",isHeader:!1}),r=v.useCallback((i,l,c,u)=>{i.preventDefault(),i.target.getBoundingClientRect();const h=l===0;n({isOpen:!0,position:{x:i.clientX,y:i.clientY},rowIndex:l,columnIndex:c,cellValue:u,isHeader:h})},[]),a=v.useCallback(()=>H(null,null,function*(){try{yield navigator.clipboard.writeText(t.cellValue),e("Copied to clipboard",'"'.concat(t.cellValue.length>20?t.cellValue.substring(0,20)+"...":t.cellValue,'" copied successfully'),{duration:2e3})}catch(i){const l=document.createElement("textarea");l.value=t.cellValue,document.body.appendChild(l),l.select(),document.execCommand("copy"),document.body.removeChild(l),e("Copied to clipboard","Cell value copied successfully",{duration:2e3})}}),[t.cellValue,e]),s=v.useCallback(()=>{n(i=>he(q({},i),{isOpen:!1}))},[]);return{contextMenu:t,handleCellClick:r,handleCopyCell:a,closeContextMenu:s}},r1=({fileId:e,hideHeader:t=!1})=>{const{t:n}=Ze(),r=ut(kr),{showColumnStats:a,setShowColumnStats:s,showAIAssistant:i}=ut(),{getObjectType:l,executeQuery:c}=Dt(),u=v.useRef(null),[h,m]=v.useState(!1),p=e||(r==null?void 0:r.id),g=p?ut.getState().files.find(ie=>ie.id===p):r,{results:T,columns:y,error:b,totalRows:x,currentPage:R,totalPages:A,rowsPerPage:w,isLoading:_,isChangingPage:N,isCountLoading:I,loadInitialData:D,changePage:M,changeRowsPerPage:O}=sEe(p);v.useEffect(()=>{p&&D()},[p,D]),v.useEffect(()=>{H(null,null,function*(){if(g!=null&&g.tableName)try{const W=yield l(g.tableName);m(W==="view")}catch(W){m(!1)}else m(!1)})},[g==null?void 0:g.tableName,l]);const{sortedData:L,sortState:k,sortData:F,clearSort:U}=t1e(T||[]);v.useEffect(()=>{U()},[p,U]);const{contextMenu:B,handleCellClick:j,handleCopyCell:G,closeContextMenu:K}=n1e(),{formatCellValue:J,getCellClass:$}=dS((g==null?void 0:g.columnTypes)||[],!0,{animationActive:!1,gridData:L,animationMessage:[],activeWordIndex:-1}),X=(ie,W,Q)=>{const se=J(ie,W,Q);if((_||N)&&W>0&&Q>0){const z=(W*31+Q*17)%100;let xe="w-3/4";return z<25?xe="w-1/2":z<50?xe="w-2/3":z<75?xe="w-3/4":xe="w-5/6",o.jsx("div",{className:"h-3 bg-white/10 rounded animate-pulse ".concat(xe)})}return se},Z=v.useCallback(ie=>{ie.preventDefault()},[]),V=v.useCallback(ie=>H(null,null,function*(){try{return yield c(ie)}catch(W){throw W}}),[c]),te=v.useCallback(ie=>H(null,null,function*(){var W,Q;try{const se=yield c("SELECT COUNT(*) as count FROM ".concat(ie," LIMIT 1"));if(se&&se.numRows>0){const xe=yield c("DESCRIBE ".concat(ie)),pe=((xe==null?void 0:xe.toArray())||[]).map(st=>({name:st.column_name,type:st.column_type})),_e=yield c("SELECT COUNT(*) as count FROM ".concat(ie)),re=((Q=(W=_e==null?void 0:_e.toArray())==null?void 0:W[0])==null?void 0:Q.count)||0,Se=Dt.getState(),$e=new Map(Se.registeredTables),qe='"'.concat(ie,'"');$e.set(ie,qe),Dt.setState({registeredTables:$e,lastTableRefresh:Date.now()});const{addFile:Je,setActiveFileId:lt}=ut.getState(),at={data:[],totalRows:re,columnTypes:pe,tableName:ie,fileName:"".concat(ie,".sql"),fileSize:0,loadTime:Date.now()},ot=Je(at);lt(ot)}}catch(se){}}),[c]),ae=v.useCallback(()=>{D()},[D]),ne=()=>{const ie=(y==null?void 0:y.length)||10,W=[" ",...Array.from({length:ie},(se,z)=>String.fromCharCode(65+z))],Q=[W];for(let se=1;se<=25;se++){const z=[se.toString()];for(let xe=1;xe<W.length;xe++)z.push("");Q.push(z)}return Q};if(b)return o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsxs("div",{className:"text-center text-white/70",children:[o.jsx("p",{className:"text-lg mb-2 text-red-400",children:n("dataGrid.error.loadingData")}),o.jsx("p",{className:"text-sm",children:b})]})});const ce=N||_?ne():L.length>0?L:ne();return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"csv-grid-container relative h-full flex flex-col",children:[o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx("div",{className:"h-full transition-opacity duration-300 ".concat(_||N?"opacity-90":"opacity-100"),children:o.jsx(QL,{ref:u,data:ce,fileId:p,gridId:"data-preview",isRemoteSource:(g==null?void 0:g.isRemote)||!1,showStats:a,onStatsToggle:()=>s(!a),currentPage:R,rowsPerPage:w,columnTypes:(g==null?void 0:g.columnTypes)||[],isDataMode:!_&&!N&&ce.length>0,onContextMenu:Z,rowHeight:32,estimatedColumnWidth:120,editingCell:null,editValue:"",onCellClick:()=>{},onCellEditChange:()=>{},onCellBlur:()=>{},onKeyDown:()=>{},formatCellValue:X,getCellClass:(ie,W)=>{const Q=$(ie,W);return(_||N)&&ie>0&&W>0?"".concat(Q," bg-white/5"):Q},onCellContextMenu:j,onSort:F,sortState:k,tableName:g==null?void 0:g.tableName,isView:h,onExecuteSQL:V,onTableCreate:te,onDataRefresh:ae})})}),r&&o.jsx(ZOe,{columnCount:y==null?void 0:y.length,currentPage:R,totalPages:A,totalRows:x,rowsPerPage:w,isCountLoading:I,onPageChange:M,onRowsPerPageChange:O,disabled:_||N,compact:t||i})]}),o.jsx(e1e,{isOpen:B.isOpen,position:B.position,onClose:K,onCopy:G,isHeader:B.isHeader,onSort:ie=>{B.columnIndex>0&&F(B.columnIndex,ie)},cellValue:B.cellValue}),o.jsx(JOe,{})]})},r1e=()=>{const e=v.useRef(null),{openFilePicker:t,importFiles:n,isProcessing:r}=UL();return{fileInputRef:e,handleButtonClick:()=>H(null,null,function*(){try{yield t(void 0,void 0,!1)}catch(i){}}),handleFileSelect:i=>H(null,null,function*(){const l=Array.from(i.target.files||[]);if(l.length!==0){try{yield n(l)}catch(c){}e.current&&(e.current.value="")}}),isProcessing:r}},a1e="/assets/demo-CavFH1BX.png",s1e="/assets/demo2-CE0DbMlg.png",i1e="/assets/demo3-Btu1hNaK.png",o1e="/assets/demo4-Dj2zJKJw.png",l1e="/assets/intro-C1mUy97Q.png",fQ=({isOpen:e,onClose:t,onGetStarted:n})=>{const{t:r}=Ze(),[a,s]=v.useState(0),i=[{id:"welcome",title:r("demoWizard.steps.welcome.title"),description:r("demoWizard.steps.welcome.description"),icon:G0,images:[l1e],highlights:[],ctaText:r("demoWizard.steps.welcome.ctaText")},{id:"preview",title:r("demoWizard.steps.preview.title"),description:r("demoWizard.steps.preview.description"),icon:ko,images:[a1e],highlights:[],ctaText:r("demoWizard.steps.preview.ctaText")},{id:"sql",title:r("demoWizard.steps.sql.title"),description:r("demoWizard.steps.sql.description"),icon:ko,images:[s1e],highlights:[],ctaText:r("demoWizard.steps.sql.ctaText")},{id:"notebooks",title:r("demoWizard.steps.notebooks.title"),description:r("demoWizard.steps.notebooks.description"),icon:Xs,images:[i1e],highlights:[],ctaText:r("demoWizard.steps.notebooks.ctaText")},{id:"remote-sources",title:r("demoWizard.steps.remoteSources.title"),description:r("demoWizard.steps.remoteSources.description"),icon:jW,images:[o1e],highlights:[],ctaText:r("demoWizard.steps.remoteSources.ctaText")}],l=i[a],c=a===i.length-1,u=a===0,h=v.useCallback(()=>{c?(localStorage.setItem("datakit-welcome-seen","true"),n==null||n(),t()):s(g=>g+1)},[a,c,n,t]),m=v.useCallback(()=>{u||s(g=>g-1)},[u]),p=v.useCallback(g=>{s(g)},[]);return o.jsx(At,{children:e&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.4,ease:"easeOut"},onClick:t,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:o.jsxs(me.div,{initial:{opacity:0,scale:.8,y:50},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:30},transition:{duration:.6,ease:[.16,1,.3,1],type:"spring",damping:20,stiffness:300},onClick:g=>g.stopPropagation(),className:"relative w-full max-w-5xl mx-4 overflow-hidden",children:[o.jsx("button",{onClick:t,className:"absolute top-4 right-4 z-10 p-2 bg-black/40 hover:bg-black/60 rounded-full transition-colors backdrop-blur-sm",children:o.jsx(ur,{className:"w-5 h-5 text-white"})}),o.jsx("div",{className:"relative",children:o.jsxs("div",{className:"relative",children:[o.jsx("img",{src:l.images[0],alt:"DataKit interface showing data analysis capabilities",className:"w-full h-auto rounded-2xl"}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/98 via-black/90 via-black/70 to-black/30 p-8 rounded-b-2xl",children:o.jsxs(me.div,{initial:{opacity:0,y:30},animate:{opacity:1,y:0},transition:{duration:.6,ease:"easeOut"},className:"max-w-2xl",children:[o.jsxs("div",{className:"mb-6",children:[o.jsx("h1",{className:"text-4xl font-bold text-white mb-3",children:l.title}),o.jsx("p",{className:"text-white/90 text-xl leading-relaxed",children:l.description})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("div",{className:"flex items-center gap-3",children:i.map((g,T)=>o.jsx("button",{onClick:()=>p(T),className:"w-4 h-4 rounded-full transition-all ".concat(T===a?"bg-primary scale-125":"bg-white/40 hover:bg-white/60")},T))}),o.jsxs("div",{className:"flex gap-4",children:[!u&&o.jsxs(je,{onClick:m,variant:"outline",className:"flex items-center gap-2 border-white/30 hover:border-white/50 text-white bg-black/20 backdrop-blur-sm px-6 py-3",children:[o.jsx(Dg,{className:"w-5 h-5"}),r("demoWizard.buttons.previous")]}),o.jsxs(je,{onClick:h,className:"bg-primary hover:bg-primary text-white flex items-center gap-2 px-8 py-3 text-lg font-semibold",children:[r(c?"demoWizard.buttons.getStarted":"demoWizard.buttons.next"),c?o.jsx($l,{className:"w-5 h-5"}):o.jsx(nr,{className:"w-5 h-5"})]})]})]})]},a)})]})})]})})})},a1=({onImportOptionClick:e})=>{const{fileInputRef:t,handleButtonClick:n,handleFileSelect:r,isProcessing:a}=r1e(),[s,i]=v.useState(!1),{t:l}=Ze(),{showAIAssistant:c}=ut(),{linkFolder:u}=xs(),h=()=>H(null,null,function*(){if(!("showDirectoryPicker"in window)){alert(l("workspace.toolbar.browserNotSupported","Your browser does not support folder access. Please use Chrome or Edge."));return}try{const g=yield window.showDirectoryPicker({mode:"read"});yield u(g,null)}catch(g){g.name}}),m=[{id:"postgresql",name:l("preview.providers.postgresql.name"),icon:o.jsx("img",{src:XL,className:"h-5 w-5"}),description:l("preview.providers.postgresql.description")},{id:"s3",name:l("preview.providers.s3.name"),icon:o.jsx("img",{src:c7,className:"h-4 w-4"}),description:l("preview.providers.s3.description")},{id:"huggingface",name:l("preview.providers.huggingface.name"),icon:o.jsx("img",{src:WL,className:"h-5 w-5"}),description:l("preview.providers.huggingface.description")},{id:"google-sheets",name:l("preview.providers.googleSheets.name"),icon:o.jsx(fu,{className:"h-5 w-5"}),description:l("preview.providers.googleSheets.description")}],p=[{name:l("preview.install.docker"),icon:Whe,emoji:"🐳",url:"https://docs.datakit.page/docs/installation/docker"},{name:l("preview.install.homebrew"),icon:Lme,emoji:"🍺",url:"https://docs.datakit.page/docs/installation/brew"},{name:l("preview.install.python"),icon:RL,emoji:"🐍",url:"https://docs.datakit.page/docs/installation/pip"},{name:l("preview.install.nodejs"),icon:Afe,emoji:"⬢",url:"https://docs.datakit.page/docs/installation/npm"}];return o.jsxs("div",{className:"h-full flex items-center justify-center p-8",children:[o.jsxs(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},className:"text-center max-w-4xl",children:[o.jsxs("div",{className:"flex items-center justify-center gap-3 mb-5 flex-wrap",children:[o.jsx("h1",{className:"text-2xl font-heading font-semibold text-white",children:l("preview.empty.title")}),o.jsx("span",{className:"text-white/40 text-sm",children:l("common.labels.or")}),o.jsxs(me.button,{onClick:()=>i(!0),initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1,boxShadow:"0 0 20px rgba(139, 92, 246, 0.35)"},transition:{delay:.2,duration:.3},whileHover:{scale:1.05,boxShadow:"0 0 25px rgba(139, 92, 246, 0.4)"},whileTap:{scale:.98},className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium text-white hover:text-white transition-all duration-300 group border border-white/20 hover:border-white/40",children:[o.jsx(me.div,{whileHover:{scale:1.1},transition:{duration:.2}}),o.jsx("span",{children:"Take a tour"})]})]}),o.jsxs("p",{className:"text-white/70 mb-4 leading-relaxed",children:[l("preview.empty.description"),o.jsx("br",{}),o.jsx(me.span,{className:"relative overflow-hidden",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.3,duration:.3},children:o.jsx(me.span,{className:"bg-gradient-to-r from-primary via-blue-500 to-primary bg-clip-text text-transparent bg-[length:200%_100%]",animate:{backgroundPosition:["0% 50%","100% 50%","0% 50%"]},transition:{duration:2,repeat:1/0,ease:"linear"},children:l("preview.empty.privacy")})})," ",l("preview.empty.privacyNote")]}),o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.6,delay:.2},className:"mb-8",children:o.jsx("div",{className:"grid gap-6 items-center grid-cols-1",children:o.jsxs(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3,duration:.4},children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-3 sm:gap-4",children:[o.jsxs(me.button,{onClick:n,disabled:a,whileHover:{scale:1.01},whileTap:{scale:.99},className:"group relative border-2 border-dashed border-white/20 hover:border-primary/40 rounded-xl p-3 sm:p-4 transition-all duration-300 hover:bg-white/[0.02] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:[o.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-primary/5 via-transparent to-blue-500/5 rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),o.jsxs("div",{className:"relative flex flex-col items-center gap-2 sm:gap-3",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx(wp,{className:"h-5 w-5 sm:h-6 sm:w-6 text-white/60 group-hover:text-primary/80 transition-colors"})}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"bg-gradient-to-r from-white to-white/80 bg-clip-text text-transparent group-hover:from-primary group-hover:to-white transition-all duration-300 font-medium text-xs sm:text-sm",children:"Import Files"}),o.jsx("div",{className:"flex gap-1 mt-1.5 sm:mt-2 justify-center flex-wrap",children:["CSV","JSON","XLS","Parquet"].map((g,T)=>o.jsx(me.span,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.5+T*.05},className:"text-[9px] sm:text-[10px] text-white/40 bg-white/5 px-1 sm:px-1.5 py-0.5 rounded border border-white/10 group-hover:text-white/60 group-hover:border-white/20 transition-colors",children:g},g))})]})]})]}),o.jsxs(me.button,{onClick:h,disabled:a,whileHover:{scale:1.01},whileTap:{scale:.99},className:"group relative border-2 border-dashed border-white/20 hover:border-blue-500/40 rounded-xl p-3 sm:p-4 transition-all duration-300 hover:bg-white/[0.02] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:[o.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-500/5 via-transparent to-cyan-500/5 rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),o.jsxs("div",{className:"relative flex flex-col items-center gap-2 sm:gap-3",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx(ng,{className:"h-5 w-5 sm:h-6 sm:w-6 text-white/60 group-hover:text-blue-500/80 transition-colors"})}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"bg-gradient-to-r from-white to-white/80 bg-clip-text text-transparent group-hover:from-blue-500 group-hover:to-white transition-all duration-300 font-medium text-xs sm:text-sm",children:"Open Folder"}),o.jsx("div",{className:"text-[9px] sm:text-[10px] text-white/40 mt-1 group-hover:text-white/60 transition-colors",children:"Import entire directories"})]})]})]}),o.jsxs(me.button,{onClick:()=>{e("postgresql")},disabled:a,whileHover:{scale:1.01},whileTap:{scale:.99},className:"group relative border-2 border-dashed border-white/20 hover:border-tertiary/40 rounded-xl p-3 sm:p-4 transition-all duration-300 hover:bg-white/[0.02] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",type:"button",children:[o.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-tertiary/5 via-transparent to-green-500/5 rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),o.jsxs("div",{className:"relative flex flex-col items-center gap-2 sm:gap-3",children:[o.jsx("div",{className:"flex-shrink-0",children:o.jsx("div",{className:"flex items-center gap-1.5",children:m.map((g,T)=>o.jsx("div",{className:"w-5 h-5 flex items-center justify-center",children:o.jsx("div",{className:"scale-90 group-hover:scale-100 transition-transform duration-300",children:g.icon})},g.id))})}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"bg-gradient-to-r from-white to-white/80 bg-clip-text text-transparent group-hover:from-tertiary group-hover:to-white transition-all duration-300 font-medium text-xs sm:text-sm",children:"Remote Sources"}),o.jsx("div",{className:"text-[9px] sm:text-[10px] text-white/40 mt-1 group-hover:text-white/60 transition-colors",children:"Databases & cloud storage"})]})]})]})]}),o.jsx("input",{ref:t,type:"file",className:"hidden",accept:".csv,.json,.xlsx,.xls,.parquet,.duckdb",onChange:r,disabled:a,multiple:!0})]})})}),o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.6,delay:.4},className:"border-t border-white/10 pt-6",children:o.jsxs("div",{className:"flex items-center justify-center gap-4",children:[o.jsx("p",{className:"text-white/50 text-sm",children:l("preview.empty.selfHost")}),o.jsx("div",{className:"flex items-center gap-3",children:p.map((g,T)=>{const y=g.icon;return o.jsxs(me.a,{href:g.url,target:"_blank",rel:"noopener noreferrer",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.5+T*.1,duration:.4},className:"group relative w-10 h-10 rounded-full bg-white/5 hover:bg-primary/10 border border-white/10 hover:border-primary/30 flex items-center justify-center transition-all duration-200 hover:scale-105",children:[o.jsx("span",{className:"text-lg sm:hidden",children:g.emoji}),o.jsx(y,{className:"h-4 w-4 text-primary hidden sm:block"}),o.jsx("div",{className:"absolute -top-8 left-1/2 transform -translate-x-1/2 bg-black/80 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap",children:g.name})]},g.name)})})]})})]}),o.jsx(fQ,{isOpen:s,onClose:()=>i(!1),onGetStarted:()=>{i(!1)}})]})},$T=43200,IG=1440,OG=Symbol.for("constructDateFrom");function wD(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&OG in e?e[OG](t):e instanceof Date?new e.constructor(t):new Date(t)}function Xl(e,t){return wD(e,e)}let c1e={};function u1e(){return c1e}function LG(e){const t=Xl(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function CD(e,...t){const n=wD.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function dy(e,t){const n=+Xl(e)-+Xl(t);return n<0?-1:n>0?1:n}function d1e(e){return wD(e,Date.now())}function h1e(e,t,n){const[r,a]=CD(n==null?void 0:n.in,e,t),s=r.getFullYear()-a.getFullYear(),i=r.getMonth()-a.getMonth();return s*12+i}function f1e(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function m1e(e,t){return+Xl(e)-+Xl(t)}function p1e(e,t){const n=Xl(e);return n.setHours(23,59,59,999),n}function g1e(e,t){const n=Xl(e),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function E1e(e,t){const n=Xl(e);return+p1e(n)==+g1e(n)}function T1e(e,t,n){const[r,a,s]=CD(n==null?void 0:n.in,e,e,t),i=dy(a,s),l=Math.abs(h1e(a,s));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-i*l);let c=dy(a,s)===-i;E1e(r)&&l===1&&dy(r,s)===1&&(c=!1);const u=i*(l-+c);return u===0?0:u}function y1e(e,t,n){const r=m1e(e,t)/1e3;return f1e(n==null?void 0:n.roundingMethod)(r)}const x1e={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"}},S1e=(e,t,n)=>{let r;const a=x1e[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function tC(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const b1e={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},v1e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},A1e={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},R1e={date:tC({formats:b1e,defaultWidth:"full"}),time:tC({formats:v1e,defaultWidth:"full"}),dateTime:tC({formats:A1e,defaultWidth:"full"})},N1e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},_1e=(e,t,n,r)=>N1e[e];function Gm(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):i;a=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[i]}const s=e.argumentCallback?e.argumentCallback(t):t;return a[s]}}const w1e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},C1e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},I1e={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"]},O1e={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"]},L1e={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"}},M1e={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"}},D1e=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},P1e={ordinalNumber:D1e,era:Gm({values:w1e,defaultWidth:"wide"}),quarter:Gm({values:C1e,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Gm({values:I1e,defaultWidth:"wide"}),day:Gm({values:O1e,defaultWidth:"wide"}),dayPeriod:Gm({values:L1e,defaultWidth:"wide",formattingValues:M1e,defaultFormattingWidth:"wide"})};function zm(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;const i=s[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?j1e(l,m=>m.test(i)):k1e(l,m=>m.test(i));let u;u=e.valueCallback?e.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const h=t.slice(i.length);return{value:u,rest:h}}}function k1e(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function j1e(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function U1e(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],s=t.match(e.parsePattern);if(!s)return null;let i=e.valueCallback?e.valueCallback(s[0]):s[0];i=n.valueCallback?n.valueCallback(i):i;const l=t.slice(a.length);return{value:i,rest:l}}}const F1e=/^(\d+)(th|st|nd|rd)?/i,$1e=/\d+/i,B1e={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},H1e={any:[/^b/i,/^(a|c)/i]},V1e={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},G1e={any:[/1/i,/2/i,/3/i,/4/i]},z1e={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},q1e={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]},Y1e={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},W1e={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]},X1e={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},K1e={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}},Q1e={ordinalNumber:U1e({matchPattern:F1e,parsePattern:$1e,valueCallback:e=>parseInt(e,10)}),era:zm({matchPatterns:B1e,defaultMatchWidth:"wide",parsePatterns:H1e,defaultParseWidth:"any"}),quarter:zm({matchPatterns:V1e,defaultMatchWidth:"wide",parsePatterns:G1e,defaultParseWidth:"any",valueCallback:e=>e+1}),month:zm({matchPatterns:z1e,defaultMatchWidth:"wide",parsePatterns:q1e,defaultParseWidth:"any"}),day:zm({matchPatterns:Y1e,defaultMatchWidth:"wide",parsePatterns:W1e,defaultParseWidth:"any"}),dayPeriod:zm({matchPatterns:X1e,defaultMatchWidth:"any",parsePatterns:K1e,defaultParseWidth:"any"})},J1e={code:"en-US",formatDistance:S1e,formatLong:R1e,formatRelative:_1e,localize:P1e,match:Q1e,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Z1e(e,t,n){var T,y;const r=u1e(),a=(y=(T=n==null?void 0:n.locale)!=null?T:r.locale)!=null?y:J1e,s=2520,i=dy(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:i}),[c,u]=CD(n==null?void 0:n.in,...i>0?[t,e]:[e,t]),h=y1e(u,c),m=(LG(u)-LG(c))/1e3,p=Math.round((h-m)/60);let g;if(p<2)return n!=null&&n.includeSeconds?h<5?a.formatDistance("lessThanXSeconds",5,l):h<10?a.formatDistance("lessThanXSeconds",10,l):h<20?a.formatDistance("lessThanXSeconds",20,l):h<40?a.formatDistance("halfAMinute",0,l):h<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):p===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",p,l);if(p<45)return a.formatDistance("xMinutes",p,l);if(p<90)return a.formatDistance("aboutXHours",1,l);if(p<IG){const b=Math.round(p/60);return a.formatDistance("aboutXHours",b,l)}else{if(p<s)return a.formatDistance("xDays",1,l);if(p<$T){const b=Math.round(p/IG);return a.formatDistance("xDays",b,l)}else if(p<$T*2)return g=Math.round(p/$T),a.formatDistance("aboutXMonths",g,l)}if(g=T1e(u,c),g<12){const b=Math.round(p/$T);return a.formatDistance("xMonths",b,l)}else{const b=g%12,x=Math.trunc(g/12);return b<3?a.formatDistance("aboutXYears",x,l):b<9?a.formatDistance("overXYears",x,l):a.formatDistance("almostXYears",x+1,l)}}function eLe(e,t){return Z1e(e,d1e(e),t)}const tLe=({metadata:e,url:t,className:n="",compact:r=!1})=>{const a=eLe(e.importedAt,{addSuffix:!0});return r?o.jsxs("div",{className:"flex items-center text-xs text-white/60 bg-green-500/10 rounded border border-green-500/20 px-3 py-2 ".concat(n),children:[o.jsx(fu,{className:"h-3.5 w-3.5 mr-2 text-green-500 flex-shrink-0"}),o.jsxs("div",{className:"flex items-center flex-1 min-w-0",children:[o.jsx("span",{className:"truncate",children:e.sheetName||"Google Sheet"}),o.jsx("span",{className:"mx-2 text-white/30",children:"•"}),o.jsx("span",{className:"flex-shrink-0 text-white/50",children:a})]}),o.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-green-500 hover:text-green-400 inline-flex items-center flex-shrink-0",title:"Open in Google Sheets",children:o.jsx(qi,{className:"h-3.5 w-3.5"})})]}):o.jsx("div",{className:"bg-green-500/10 rounded-md p-3 border border-green-500/20 ".concat(n),children:o.jsxs("div",{className:"flex items-center",children:[o.jsx(fu,{className:"h-4 w-4 mr-2 text-green-500 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h4",{className:"text-sm font-medium text-white/90 truncate",children:e.sheetName||"Google Sheet"}),o.jsxs("div",{className:"flex items-center mt-0.5 text-xs text-white/60",children:[o.jsx(du,{className:"h-3 w-3 mr-1 flex-shrink-0"}),o.jsxs("span",{children:["Imported ",a]}),e.format&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"mx-2",children:"•"}),o.jsx("span",{className:"uppercase",children:e.format})]})]})]}),o.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"ml-3 bg-black/30 hover:bg-green-500/20 text-green-500 hover:text-green-400 border border-green-500/20 hover:border-green-500/40 rounded px-2 py-1 text-xs flex items-center transition-colors flex-shrink-0",children:[o.jsx(qi,{className:"h-3 w-3 mr-1"}),"Open"]})]})})},nLe=({className:e=""})=>{var w,_;const{t}=Ze(),{updateSplitRatio:n,swapSplitFiles:r,setActiveFile:a,clearFileSplitView:s}=ut(),i=ut(kr),l=ut(aEe),c=((w=i==null?void 0:i.splitView)==null?void 0:w.position)==="left"?i:ut.getState().files.find(N=>{var I;return N.id===((I=i==null?void 0:i.splitView)==null?void 0:I.partnerId)})||null,u=((_=i==null?void 0:i.splitView)==null?void 0:_.position)==="right"?i:ut.getState().files.find(N=>{var I;return N.id===((I=i==null?void 0:i.splitView)==null?void 0:I.partnerId)})||null,[h,m]=v.useState(!1),[p,g]=v.useState(0),[T,y]=v.useState(0),b=v.useRef(null),x=v.useCallback(N=>{N.preventDefault(),m(!0),g(N.clientX),y(l)},[l]),R=v.useCallback(N=>{if(!h||!b.current)return;const I=b.current.getBoundingClientRect(),M=(N.clientX-p)/I.width,O=T+M;n(O)},[h,p,T,n]),A=v.useCallback(()=>{m(!1)},[]);return v.useEffect(()=>{if(h)return document.addEventListener("mousemove",R),document.addEventListener("mouseup",A),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",A),document.body.style.cursor="",document.body.style.userSelect=""}},[h,R,A]),!c||!u?null:o.jsxs(me.div,{ref:b,initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},transition:{duration:.3,ease:"easeInOut"},className:"h-full flex flex-col ".concat(e),children:[o.jsxs("div",{className:"flex items-center justify-between p-3 bg-darkNav border-b border-white/10",children:[o.jsx("div",{className:"flex items-center space-x-4",children:o.jsx("h2",{className:"text-sm font-medium text-white",children:t("layout.splitView.title",{defaultValue:"Split View"})})}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(je,{variant:"ghost",size:"sm",onClick:r,className:"h-8 w-8 p-0",title:t("layout.splitView.swapFiles",{defaultValue:"Swap files"}),children:o.jsx(ehe,{size:14})}),o.jsx(je,{variant:"ghost",size:"sm",onClick:()=>{i!=null&&i.id&&s(i.id)},className:"h-8 w-8 p-0 hover:bg-red-500/20 hover:text-red-400",title:t("layout.splitView.close",{defaultValue:"Close split view"}),children:o.jsx(ur,{size:14})})]})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsxs(me.div,{layout:!0,className:"flex flex-col overflow-hidden bg-background border-r border-white/10",style:{width:"".concat(l*100,"%")},onClick:()=>a(c.id),children:[o.jsxs("div",{className:"flex items-center justify-between p-2 bg-darkNav/50 border-b border-white/5",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full"}),o.jsx("span",{className:"text-sm font-medium text-white truncate",children:c.fileName})]}),o.jsx("div",{className:"text-xs text-white/50",children:t("layout.splitView.columnCount",{defaultValue:"{{count}} cols",count:c.columnCount})})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(r1,{fileId:c.id,hideHeader:!0})})]}),o.jsxs("div",{className:"relative w-1 bg-white/10 cursor-col-resize hover:bg-primary/50 transition-colors ".concat(h?"bg-primary/70":""),onMouseDown:x,children:[o.jsx("div",{className:"absolute inset-y-0 left-0 w-1 flex items-center justify-center",children:o.jsx("div",{className:"w-0.5 h-8 bg-white/20 rounded-full"})}),o.jsx("div",{className:"absolute inset-y-0 left-0 w-1 flex items-center justify-center opacity-0 hover:opacity-100 transition-opacity ".concat(h?"opacity-100":""),children:o.jsx(dO,{size:12,className:"text-white/60"})})]}),o.jsxs(me.div,{layout:!0,className:"flex flex-col overflow-hidden bg-background",style:{width:"".concat((1-l)*100,"%")},onClick:()=>a(u.id),children:[o.jsxs("div",{className:"flex items-center justify-between p-2 bg-darkNav/50 border-b border-white/5",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("div",{className:"w-2 h-2 bg-green-400 rounded-full"}),o.jsx("span",{className:"text-sm font-medium text-white truncate",children:u.fileName})]}),o.jsx("div",{className:"text-xs text-white/50",children:t("layout.splitView.columnCount",{defaultValue:"{{count}} cols",count:u.columnCount})})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(r1,{fileId:u.id,hideHeader:!0})})]})]}),o.jsx(At,{children:h&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/20 backdrop-blur-sm z-50 pointer-events-none",children:o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsx("div",{className:"bg-darkNav/90 px-4 py-2 rounded-lg border border-white/20 shadow-lg",children:o.jsxs("div",{className:"flex items-center space-x-2 text-white",children:[o.jsx(dO,{size:16}),o.jsxs("span",{className:"text-sm",children:[Math.round(l*100),"% / ",Math.round((1-l)*100),"%"]})]})})})})})]})},MG=()=>{const{t:e}=Ze(),{setIsRemoteModalOpen:t,setActiveProviderRemoteModal:n}=ut(),r=ut(u7),a=ut(kr),s=ut(tEe),i=ut(nEe),l=ut(rEe),c=a==null?void 0:a.splitView,u=h=>{t(!0),n(h)};return r?o.jsx("div",{className:"h-full flex flex-col",children:c!=null&&c.isActive?o.jsx(nLe,{className:"flex-1"}):o.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[a&&i==="google_sheets"&&l&&o.jsx("div",{className:"px-3 pt-3",children:o.jsx(tLe,{metadata:l,url:s||"",className:"mb-0",compact:!0})}),o.jsx("div",{className:"flex-1 overflow-hidden",children:a?o.jsx(r1,{}):o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsxs("div",{className:"text-center text-white/70",children:[o.jsx("p",{className:"text-lg mb-2",children:e("tabs.preview.noData")}),o.jsx("p",{className:"text-sm",children:e("tabs.preview.selectFile")})]})})})]})}):o.jsx(a1,{onImportOptionClick:u})},rLe=e=>e.isInitialized,aLe=e=>e.isInitializing,sLe=e=>e.error,iLe=e=>e.hasSampleTable,oLe=e=>e.sampleTableName,lLe=e=>{const t=e.registeredTables.size;return e.hasSampleTable?t>1:t>0},cLe=e=>e.isInitialized&&e.registeredTables.size>0,uLe=()=>{const[e,t]=v.useState(""),[n,r]=v.useState(""),[a,s]=v.useState(!1),i=Dt(cLe),l=Dt(lLe),c=Dt(iLe),u=Dt(oLe),h=ut(kr),m=ut(N=>N.updateFile),p=ut(X0),g=v.useCallback((N,I)=>({query:"-- Query data from ".concat(N||"your file",'\n-- Modify this query to explore your data\nSELECT * FROM "').concat(I,'" LIMIT 100;'),history:[],lastExecutedAt:void 0}),[]),T=v.useCallback(()=>c?'-- Sample employee data is available for testing\n-- Import your own files to query your data\nSELECT *\nFROM "'.concat(u,'"\nLIMIT 10;'):"-- Import your own CSV, JSON, or Parquet files to get started\n-- Your data will appear here once loaded",[c,u]),y=v.useCallback(()=>{if(!h||!e.trim())return;const N=h.sqlState||g(h.fileName,p||"unknown");e!==N.query&&(m(h.id,{sqlState:he(q({},N),{query:e})}),r(e))},[h,e,g,m,p]),b=v.useCallback(N=>{if(N.sqlState||!p)return;const I=g(N.fileName,p);m(N.id,{sqlState:I})},[g,m,p]),x=v.useCallback(N=>{var M;b(N);const I=ut.getState().files.find(O=>O.id===N.id),D=(M=I==null?void 0:I.sqlState)==null?void 0:M.query;D&&D.trim()&&(t(D),r(D),A())},[b]),R=v.useCallback((N,I)=>{if(!h||!N.trim())return;const D=h.sqlState||g(h.fileName,p||"unknown"),O=[{id:"query-".concat(Date.now()),query:N.trim(),timestamp:Date.now(),executionTime:I},...D.history].slice(0,50);m(h.id,{sqlState:he(q({},D),{history:O,lastExecutedAt:Date.now()})})},[h,g,m,p]),A=v.useCallback(()=>{s(!1)},[]),w=v.useCallback(N=>{t(N),s(!0)},[]),_=e.trim()!==n.trim();return{query:e,setQuery:t,hasUnsavedChanges:_,isDirty:a,saveCurrentQuery:y,loadQueryFromFile:x,initializeFileIfNeeded:b,canExecuteQueries:i,hasUserTables:l,addToHistory:R,markAsClean:A,setQueryAndMarkDirty:w,getDefaultQuery:T,activeFile:h}},dLe=()=>{const{query:e,setQuery:t,hasUnsavedChanges:n,isDirty:r,saveCurrentQuery:a,loadQueryFromFile:s,canExecuteQueries:i,hasUserTables:l,addToHistory:c,markAsClean:u,setQueryAndMarkDirty:h,getDefaultQuery:m,activeFile:p}=uLe(),[g,T]=v.useState(null),y=ut(X0);return v.useEffect(()=>{if(!p){if(g!==null){const x=m();x&&(t(x),u())}T(null);return}if(!y)return;const b=p.id;g!==b&&s(p),T(b)},[p==null?void 0:p.id,y,s,g,m,e,t,u]),{query:e,setQuery:t,hasUnsavedChanges:n,isDirty:r,saveCurrentQuery:a,canExecuteQueries:i,hasUserTables:l,addToHistory:c,markAsClean:u,setQueryAndMarkDirty:h,getDefaultQuery:m,activeFile:p}},hLe=()=>{const[e,t]=v.useState(!1),n=Dt(rLe),r=Dt(aLe),a=Dt(sLe),{initialize:s,resetError:i}=Dt();v.useEffect(()=>{!n&&!r&&!e&&(t(!0),s().catch(c=>{}))},[n,r,e,s]);const l=v.useCallback(()=>{i(),t(!1)},[i]);return{isInitialized:n,isInitializing:r,error:a,retry:l}},fLe=e=>{const{pendingQuery:t,setPendingQuery:n}=ut();v.useEffect(()=>{t&&(e(t),n(null))},[t,n,e])},mQ=({onInsertQuery:e})=>{const{t}=Ze(),{getAvailableTables:n,registeredTables:r,executeQuery:a,lastTableRefresh:s,getObjectType:i,motherDuckConnected:l,motherDuckDatabases:c,motherDuckSchemas:u,refreshMotherDuckSchemas:h,executeMotherDuckQuery:m,listAttachedDatabases:p,postgresConnections:g,postgresActiveConnections:T,postgresVirtualTables:y,postgresSchemas:b,postgresError:x,connectToPostgreSQL:R,disconnectFromPostgreSQL:A,addVirtualPostgreSQLTable:w,refreshPostgreSQLVirtualSchemas:_}=Dt(),{connections:N,loadConnections:I}=YL(),[D,M]=v.useState({}),[O,L]=v.useState({}),[k,F]=v.useState([]),[U,B]=v.useState({}),[j,G]=v.useState(new Set(["local"])),[K,J]=v.useState(new Set),[$,X]=v.useState(!0),[Z,V]=v.useState(!1),[te,ae]=v.useState(new Set),[ne,ce]=v.useState(new Set),[ie,W]=v.useState(new Set),[Q,se]=v.useState(new Set),[z,xe]=v.useState(new Set),le=v.useMemo(()=>{const de=n().sort().join(","),Ae=Array.from(r.keys()).sort().join(",");return"".concat(de,"-").concat(Ae,"-").concat(s)},[n,r,s]),pe=v.useCallback(()=>H(null,null,function*(){X(!0);try{const de=n(),Ae={};for(const we of de)if(!we.includes("."))try{const Ie=yield i(we),Ke=yield a('DESCRIBE "'.concat(we,'"'));if(Ke){const it=Ke.toArray().map(De=>({name:De.column_name||De.name||"",type:De.column_type||De.type||""}));Ae[we]={name:we,type:Ie||"table",source:"local",columns:it}}}catch(Ie){Ae[we]={name:we,type:"table",source:"local",columns:[]}}M(Ae)}catch(de){}finally{X(!1)}}),[n,i,a]),_e=v.useCallback(()=>H(null,null,function*(){try{const de=yield p();F(de);const Ae={},we=n();for(const Ie of we)if(Ie.includes(".")){const[Ke,...it]=Ie.split("."),De=it.join(".");if(de.some(nt=>nt.name===Ke))try{const nt=r.get(Ie)||'"'.concat(Ke,'"."').concat(De,'"'),Pt=yield a("DESCRIBE ".concat(nt));if(Pt){const pt=Pt.toArray().map(Bt=>({name:Bt.column_name||Bt.name||"",type:Bt.column_type||Bt.type||""}));Ae[Ie]={name:De,type:"table",source:"local",database:Ke,columns:pt}}}catch(nt){Ae[Ie]={name:De,type:"table",source:"local",database:Ke,columns:[]}}}B(Ae)}catch(de){}}),[p,n,r,a]),re=v.useCallback((de,Ae)=>H(null,null,function*(){var Ie,Ke;const we="".concat(de,".").concat(Ae);if(!(((Ke=(Ie=O[we])==null?void 0:Ie.columns)==null?void 0:Ke.length)>0||ie.has(we))){W(it=>new Set(it).add(we));try{const it=yield m('DESCRIBE "'.concat(de,'"."').concat(Ae,'"'),de);if(it&&Array.isArray(it)){const De=it.map(nt=>({name:nt.column_name||nt.name||"",type:nt.column_type||nt.type||""}));L(nt=>{var Pt,pt;return he(q({},nt),{[we]:{name:Ae,type:((pt=(Pt=u.get(de))==null?void 0:Pt.find(Bt=>Bt.name===Ae))==null?void 0:pt.type)||"table",source:"motherduck",database:de,columns:De}})})}}catch(it){}finally{W(it=>{const De=new Set(it);return De.delete(we),De})}}}),[m,u,O]);v.useEffect(()=>{I().catch(console.error)},[I]);const Se=de=>H(null,null,function*(){if(!z.has(de)){xe(Ae=>new Set(Ae).add(de));try{yield R(de),yield _(de)}catch(Ae){}finally{xe(Ae=>{const we=new Set(Ae);return we.delete(de),we})}}}),$e=de=>H(null,null,function*(){if(!Q.has(de)){se(Ae=>new Set(Ae).add(de));try{yield _(de)}catch(Ae){}finally{se(Ae=>{const we=new Set(Ae);return we.delete(de),we})}}});v.useEffect(()=>{pe(),_e()},[le]);const qe=()=>H(null,null,function*(){if(!Z){V(!0);try{yield pe(),yield _e()}finally{V(!1)}}}),Je=de=>H(null,null,function*(){if(!ne.has(de)){ce(Ae=>new Set(Ae).add(de));try{yield _e()}finally{ce(Ae=>{const we=new Set(Ae);return we.delete(de),we})}}}),lt=de=>H(null,null,function*(){if(!te.has(de)){ae(Ae=>new Set(Ae).add(de));try{yield h(de);const Ae=Object.keys(O).filter(we=>we.startsWith("".concat(de,".")));L(we=>{const Ie=q({},we);return Ae.forEach(Ke=>delete Ie[Ke]),Ie})}catch(Ae){}finally{ae(Ae=>{const we=new Set(Ae);return we.delete(de),we})}}}),at=de=>H(null,null,function*(){if(!j.has(de)&&de!=="local"&&l){const we=u.get(de);(!we||we.length===0)&&(yield lt(de))}G(we=>{const Ie=new Set(we);return Ie.has(de)?Ie.delete(de):Ie.add(de),Ie})}),ot=de=>H(null,null,function*(){if(!K.has(de)&&de.includes(".")){const[Ae,...we]=de.split("."),Ie=we.join(".");Ae!=="local"&&(yield re(Ae,Ie))}J(Ae=>{const we=new Set(Ae);return we.has(de)?we.delete(de):we.add(de),we})}),st=de=>{let Ae;if(de.source==="local"&&de.database){const we="".concat(de.database,".").concat(de.name),Ie=r.get(we)||'"'.concat(de.database,'"."').concat(de.name,'"');Ae="\nSELECT *\nFROM ".concat(Ie,"\nLIMIT 10;")}else if(de.source==="local"){const we=r.get(de.name)||'"'.concat(de.name,'"');Ae="\nSELECT *\nFROM ".concat(we,"\nLIMIT 10;")}else if(de.source==="postgresql"){const we='"'.concat(de.database,'"."').concat(de.name,'"');Ae="\nSELECT *\nFROM ".concat(we,"\nLIMIT 10;")}else{const we=de.database?'"'.concat(de.database,'"."').concat(de.name,'"'):'"'.concat(de.name,'"');Ae="\nSELECT *\nFROM ".concat(we,"\nLIMIT 10;")}e(Ae)},oe=(de,Ae)=>{let we;if(de.source==="local"&&de.database){const Ie="".concat(de.database,".").concat(de.name),Ke=r.get(Ie)||'"'.concat(de.database,'"."').concat(de.name,'"');we='\nSELECT "'.concat(Ae,'"\nFROM ').concat(Ke,"\nLIMIT 10;")}else if(de.source==="local"){const Ie=r.get(de.name)||'"'.concat(de.name,'"');we='\nSELECT "'.concat(Ae,'"\nFROM ').concat(Ie,"\nLIMIT 10;")}else if(de.source==="postgresql"){const Ie='"'.concat(de.database,'"."').concat(de.name,'"');we='\nSELECT "'.concat(Ae,'"\nFROM ').concat(Ie,"\nLIMIT 10;")}else{const Ie=de.database?'"'.concat(de.database,'"."').concat(de.name,'"'):'"'.concat(de.name,'"');we='\nSELECT "'.concat(Ae,'"\nFROM ').concat(Ie,"\nLIMIT 10;")}e(we)},ue=de=>de==="view"?o.jsx(Jr,{size:14,className:"text-blue-400"}):o.jsx(Bl,{size:14,className:"text-primary"}),Ee=de=>{const Ae=de.toLowerCase();return Ae.includes("int")||Ae.includes("float")||Ae.includes("double")||Ae.includes("numeric")?o.jsx(hu,{size:12,className:"text-yellow-400"}):Ae.includes("date")||Ae.includes("time")?o.jsx(Fl,{size:12,className:"text-green-400"}):Ae.includes("bool")?o.jsx(Pr,{size:12,className:"text-blue-400"}):o.jsx(Kh,{size:12,className:"text-white/70"})},Le=Object.values(D),ke=Le.filter(de=>de.type==="table"),Ge=Le.filter(de=>de.type==="view"),tt=ke.length>0||Ge.length>0,ct=l&&c.length>0,Te=T.size>0||N.length>0,Oe=tt||ct||Te;return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsx("div",{className:"px-4 py-3 border-b border-white/10",children:o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("h3",{className:"text-sm font-medium flex items-center",children:[o.jsx(Xs,{size:16,className:"mr-2 text-primary"}),t("query.schema.title")]})})}),o.jsx("div",{className:"flex-1 overflow-auto",children:!Oe&&!$?o.jsx("div",{className:"px-4 py-8 text-center text-white/50 text-xs",children:"No data available. Import files to get started."}):o.jsxs(o.Fragment,{children:[(tt||$)&&o.jsxs("div",{className:"border-b border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-between px-2 py-2 hover:bg-white/5 cursor-pointer",onClick:()=>at("local"),children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("span",{className:"text-white/70",children:j.has("local")?o.jsx(br,{size:16}):o.jsx(nr,{size:16})}),o.jsx(hO,{size:14,className:"text-primary"}),o.jsx("span",{className:"text-sm font-medium text-white",children:"Local"}),o.jsxs("span",{className:"text-xs text-white/60",children:["(",ke.length+Ge.length,")"]})]}),o.jsx(Ut,{placement:"left",content:"Refresh schemas",children:o.jsx("button",{onClick:de=>{de.stopPropagation(),qe()},disabled:Z,className:"p-1 hover:bg-white/10 rounded text-white/70 hover:text-white transition-colors",children:o.jsx(ma,{size:12,className:Z?"animate-spin":""})})})]}),j.has("local")&&o.jsx("div",{className:"pl-6",children:$?o.jsxs("div",{className:"flex items-center justify-center py-4 text-white/50",children:[o.jsx(Hn,{size:16,className:"animate-spin mr-2"}),o.jsx("span",{className:"text-sm",children:"Loading local schemas..."})]}):Le.length===0?o.jsx("div",{className:"px-2 py-4 text-center text-white/50 text-sm",children:"No local tables. Import data to get started."}):o.jsxs("div",{className:"py-1",children:[ke.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center px-2 py-1 text-xs font-medium text-white/50",children:[o.jsx(_T,{size:12,className:"mr-1"}),"Tables (",ke.length,")"]}),ke.map(de=>o.jsx(qm,{schema:de,tableId:"local.".concat(de.name),isExpanded:K.has("local.".concat(de.name)),onToggle:()=>ot("local.".concat(de.name)),onGenerateQuery:st,onGenerateColumnQuery:oe,getObjectIcon:ue,getColumnTypeIcon:Ee},de.name))]}),Ge.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center px-2 py-1 text-xs font-medium text-white/50",children:[o.jsx(Jr,{size:12,className:"mr-1"}),"Views (",Ge.length,")"]}),Ge.map(de=>o.jsx(qm,{schema:de,tableId:"local.".concat(de.name),isExpanded:K.has("local.".concat(de.name)),onToggle:()=>ot("local.".concat(de.name)),onGenerateQuery:st,onGenerateColumnQuery:oe,getObjectIcon:ue,getColumnTypeIcon:Ee},de.name))]})]})})]}),k.map(de=>{const Ae=Object.entries(U).filter(([Ie])=>Ie.startsWith("".concat(de.name,"."))).map(([Ie,Ke])=>Ke),we=j.has(de.name);return o.jsxs("div",{className:"border-b border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-between px-2 py-2 hover:bg-white/5 cursor-pointer",onClick:()=>at(de.name),children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("span",{className:"text-white/70",children:we?o.jsx(br,{size:16}):o.jsx(nr,{size:16})}),o.jsx(hO,{size:14,className:"text-blue-400"}),o.jsx(Ut,{placement:"top",content:"Attached: ".concat(de.name,".duckdb"),children:o.jsx("span",{className:"text-sm font-medium text-white truncate max-w-[120px] block",children:de.name})}),o.jsx("span",{className:"text-xs bg-blue-500/20 text-blue-400 px-1.5 py-0.5 rounded",children:"Attached"}),o.jsxs("span",{className:"text-xs text-white/60",children:["(",Ae.length,")"]})]}),o.jsx("div",{className:"flex items-center space-x-1",children:o.jsx(Ut,{placement:"left",content:"Refresh tables",children:o.jsx("button",{onClick:Ie=>{Ie.stopPropagation(),Je(de.name)},disabled:ne.has(de.name),className:"p-1 hover:bg-white/10 rounded text-white/70 hover:text-white transition-colors",children:o.jsx(ma,{size:12,className:ne.has(de.name)?"animate-spin":""})})})})]}),we&&o.jsx("div",{className:"pl-6",children:ne.has(de.name)?o.jsxs("div",{className:"flex items-center justify-center py-4 text-white/50",children:[o.jsx(Hn,{size:16,className:"animate-spin mr-2"}),o.jsxs("span",{className:"text-sm",children:["Loading ",de.name," tables..."]})]}):Ae.length===0?o.jsxs("div",{className:"px-2 py-4 text-center text-white/50 text-sm",children:["No tables found in ",de.name]}):o.jsx("div",{className:"py-1",children:o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center px-2 py-1 text-xs font-medium text-white/50",children:[o.jsx(_T,{size:12,className:"mr-1"}),"Tables (",Ae.length,")"]}),Ae.map(Ie=>{const Ke="".concat(de.name,".").concat(Ie.name);return o.jsx(qm,{schema:Ie,tableId:Ke,isExpanded:K.has(Ke),onToggle:()=>ot(Ke),onGenerateQuery:st,onGenerateColumnQuery:oe,getObjectIcon:ue,getColumnTypeIcon:Ee},Ke)})]})})})]},de.name)}),l&&c.map(de=>{const Ae=u.get(de.name)||[],we=Ae.filter(it=>it.type==="table"),Ie=Ae.filter(it=>it.type==="view"),Ke=j.has(de.name);return o.jsxs("div",{className:"border-b border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-between px-2 py-2 hover:bg-white/5 cursor-pointer",onClick:()=>at(de.name),children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("span",{className:"text-white/70",children:Ke?o.jsx(br,{size:16}):o.jsx(nr,{size:16})}),o.jsx(dh,{size:16,className:"text-orange-300"}),o.jsx(Ut,{placement:"top",content:de.name,children:o.jsx("span",{className:"text-sm font-medium text-white truncate max-w-[120px] block",children:de.name})}),de.shared&&o.jsx("span",{className:"text-xs bg-blue-500/20 text-blue-400 px-1.5 py-0.5 rounded",children:"Shared"}),o.jsxs("span",{className:"text-xs text-white/60",children:["(",we.length+Ie.length,")"]})]}),o.jsx(Ut,{placement:"left",content:"Refresh schemas",children:o.jsx("button",{onClick:it=>{it.stopPropagation(),lt(de.name)},disabled:te.has(de.name),className:"p-1 hover:bg-white/10 rounded text-white/70 hover:text-white transition-colors",children:o.jsx(ma,{size:12,className:te.has(de.name)?"animate-spin":""})})})]}),Ke&&o.jsx("div",{className:"pl-6",children:te.has(de.name)?o.jsxs("div",{className:"flex items-center justify-center py-4 text-white/50",children:[o.jsx(Hn,{size:16,className:"animate-spin mr-2"}),o.jsxs("span",{className:"text-xs",children:["Loading ",de.name," schemas..."]})]}):Ae.length===0?o.jsxs("div",{className:"px-2 py-4 text-center text-white/50 text-xs",children:["No tables found in ",de.name]}):o.jsxs("div",{className:"py-1",children:[we.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center px-2 py-1 text-xs font-medium text-white/50",children:[o.jsx(_T,{size:12,className:"mr-1"}),"Tables (",we.length,")"]}),we.map(it=>{const De="".concat(de.name,".").concat(it.name),nt=O[De]||{name:it.name,type:it.type,source:"motherduck",database:de.name,columns:[]};return o.jsx(qm,{schema:nt,tableId:De,isExpanded:K.has(De),isLoadingColumns:ie.has(De),onToggle:()=>ot(De),onGenerateQuery:st,onGenerateColumnQuery:oe,getObjectIcon:ue,getColumnTypeIcon:Ee},De)})]}),Ie.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center px-2 py-1 text-xs font-medium text-white/50",children:[o.jsx(Jr,{size:12,className:"mr-1"}),"Views (",Ie.length,")"]}),Ie.map(it=>{const De="".concat(de.name,".").concat(it.name),nt=O[De]||{name:it.name,type:it.type,source:"motherduck",database:de.name,columns:[]};return o.jsx(qm,{schema:nt,tableId:De,isExpanded:K.has(De),isLoadingColumns:ie.has(De),onToggle:()=>ot(De),onGenerateQuery:st,onGenerateColumnQuery:oe,getObjectIcon:ue,getColumnTypeIcon:Ee},De)})]})]})})]},de.name)}),Te&&o.jsxs(o.Fragment,{children:[N.filter(de=>!T.has(de.id)).map(de=>o.jsx("div",{className:"border-b border-white/5",children:o.jsxs("div",{className:"flex items-center justify-between px-2 py-2 hover:bg-white/5",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx($y,{size:14,className:"text-blue-400"}),o.jsx("span",{className:"text-sm font-medium text-white/80",children:de.name}),o.jsx("span",{className:"text-xs bg-blue-500/20 text-blue-400 px-1.5 py-0.5 rounded",children:"Available"})]}),o.jsx("div",{className:"flex items-center space-x-1",children:o.jsx(Ut,{placement:"left",content:"Connect and browse tables",children:o.jsx("button",{onClick:()=>Se(de.id),disabled:z.has(de.id),className:"p-1 hover:bg-white/10 rounded text-white/70 hover:text-white transition-colors",children:z.has(de.id)?o.jsx(Hn,{size:12,className:"animate-spin"}):o.jsx(ru,{size:12})})})})]})},"pg-available-".concat(de.id))),Array.from(T).map(de=>{const Ae=g.get(de);if(!Ae)return null;const we=j.has("pg-".concat(de)),Ie=Array.from(y.entries()).filter(([Ke,it])=>it.connectionId===de);return o.jsxs("div",{className:"border-b border-white/5",children:[o.jsxs("div",{className:"flex items-center justify-between px-2 py-2 hover:bg-white/5 cursor-pointer",onClick:()=>at("pg-".concat(de)),children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("span",{className:"text-white/70",children:we?o.jsx(br,{size:16}):o.jsx(nr,{size:16})}),o.jsx($y,{size:14,className:"text-blue-400"}),o.jsx("span",{className:"text-sm font-medium text-white",children:Ae.name}),o.jsx("span",{className:"text-xs bg-green-500/20 text-green-400 px-1.5 py-0.5 rounded",children:"Connected"}),o.jsxs("span",{className:"text-xs text-white/60",children:["(",Ie.length,")"]})]}),o.jsx("div",{className:"flex items-center space-x-1",children:o.jsx(Ut,{placement:"left",content:"Refresh schemas",children:o.jsx("button",{onClick:Ke=>{Ke.stopPropagation(),$e(de)},disabled:Q.has(de),className:"p-1 hover:bg-white/10 rounded text-white/70 hover:text-white transition-colors",children:o.jsx(ma,{size:12,className:Q.has(de)?"animate-spin":""})})})})]}),we&&o.jsx("div",{className:"pl-6",children:Q.has(de)?o.jsxs("div",{className:"flex items-center justify-center py-4 text-white/50",children:[o.jsx(Hn,{size:16,className:"animate-spin mr-2"}),o.jsx("span",{className:"text-xs",children:"Loading PostgreSQL schemas..."})]}):Ie.length===0?o.jsx("div",{className:"px-2 py-4 text-center text-white/50 text-xs",children:"No tables found. Click refresh to load schemas."}):o.jsx("div",{className:"py-1",children:(()=>{const Ke=new Map;return Ie.forEach(([it,De])=>{Ke.has(De.schemaName)||Ke.set(De.schemaName,{tables:[],views:[]});const nt=Ke.get(De.schemaName);De.tableType==="view"?nt.views.push({tableKey:it,table:De}):nt.tables.push({tableKey:it,table:De})}),Array.from(Ke.entries()).map(([it,{tables:De,views:nt}])=>o.jsxs("div",{className:"mb-3",children:[o.jsxs("div",{className:"flex items-center px-2 py-1 text-xs font-medium text-white/50",children:[o.jsx(Xs,{size:12,className:"mr-1"}),it," (",De.length+nt.length,")"]}),De.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center px-4 py-1 text-xs font-medium text-white/40",children:[o.jsx(_T,{size:10,className:"mr-1"}),"Tables (",De.length,")"]}),De.map(({tableKey:Pt,table:pt})=>{const Bt="pg-".concat(Pt),un={name:pt.tableName,type:pt.tableType,source:"postgresql",database:pt.schemaName,columns:pt.columns};return o.jsxs("div",{className:"schema-item group",children:[o.jsxs("div",{className:"flex items-center px-2 py-1.5 hover:bg-white/5 rounded text-sm cursor-pointer",onClick:()=>ot(Bt),children:[o.jsx("span",{className:"mr-1.5 text-white/70 flex-shrink-0",children:K.has(Bt)?o.jsx(br,{size:14}):o.jsx(nr,{size:14})}),o.jsx("span",{className:"flex-shrink-0",children:ue(pt.tableType)}),o.jsx("div",{className:"flex-1 min-w-0 ml-1.5",children:o.jsx("span",{className:"text-white/90 truncate block",children:pt.tableName})}),o.jsx("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all",children:o.jsx(Ut,{placement:"left",content:"Insert SELECT query",children:o.jsx("button",{className:"text-white/70 hover:text-primary p-1",onClick:_t=>{_t.stopPropagation(),st(un)},children:o.jsx(Xn,{size:12})})})})]}),K.has(Bt)&&o.jsx("div",{className:"ml-6 pl-2 border-l border-white/10 mt-1 mb-2",children:pt.columns.length>0?o.jsx("div",{className:"space-y-0.5",children:pt.columns.map(_t=>o.jsxs("div",{className:"flex items-center px-2 py-1 hover:bg-white/5 rounded text-xs group/column",onClick:()=>oe(un,_t.name),children:[o.jsx("span",{className:"flex-shrink-0",children:Ee(_t.type)}),o.jsx("span",{className:"ml-1.5 text-white/80 truncate flex-1 min-w-0",children:_t.name}),o.jsx("span",{className:"text-white/40 text-xs flex-shrink-0 ml-2 max-w-[60px] truncate",children:_t.type}),o.jsx("button",{className:"opacity-0 group-hover/column:opacity-100 hover:text-primary transition-all text-white/70 p-0.5 flex-shrink-0 ml-1",onClick:et=>{et.stopPropagation(),oe(un,_t.name)},children:o.jsx(Xn,{size:10})})]},"".concat(Bt,"-").concat(_t.name)))}):o.jsx("div",{className:"px-2 py-2 text-white/40 text-xs",children:"No columns available"})})]},Pt)})]}),nt.length>0&&o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center px-4 py-1 text-xs font-medium text-white/40",children:[o.jsx(Jr,{size:10,className:"mr-1"}),"Views (",nt.length,")"]}),nt.map(({tableKey:Pt,table:pt})=>{const Bt="pg-".concat(Pt),un={name:pt.tableName,type:pt.tableType,source:"postgresql",database:pt.schemaName,columns:pt.columns};return o.jsxs("div",{className:"schema-item group",children:[o.jsxs("div",{className:"flex items-center px-2 py-1.5 hover:bg-white/5 rounded text-sm cursor-pointer",onClick:()=>ot(Bt),children:[o.jsx("span",{className:"mr-1.5 text-white/70 flex-shrink-0",children:K.has(Bt)?o.jsx(br,{size:14}):o.jsx(nr,{size:14})}),o.jsx("span",{className:"flex-shrink-0",children:ue(pt.tableType)}),o.jsx("div",{className:"flex-1 min-w-0 ml-1.5",children:o.jsx("span",{className:"text-white/90 truncate block",children:pt.tableName})}),o.jsx("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-all",children:o.jsx(Ut,{placement:"left",content:"Insert SELECT query",children:o.jsx("button",{className:"text-white/70 hover:text-primary p-1",onClick:_t=>{_t.stopPropagation(),st(un)},children:o.jsx(Xn,{size:12})})})})]}),K.has(Bt)&&o.jsx("div",{className:"ml-6 pl-2 border-l border-white/10 mt-1 mb-2",children:pt.columns.length>0?o.jsx("div",{className:"space-y-0.5",children:pt.columns.map(_t=>o.jsxs("div",{className:"flex items-center px-2 py-1 hover:bg-white/5 rounded text-xs group/column",onClick:()=>oe(un,_t.name),children:[o.jsx("span",{className:"flex-shrink-0",children:Ee(_t.type)}),o.jsx("span",{className:"ml-1.5 text-white/80 truncate flex-1 min-w-0",children:_t.name}),o.jsx("span",{className:"text-white/40 text-xs flex-shrink-0 ml-2 max-w-[60px] truncate",children:_t.type}),o.jsx("button",{className:"opacity-0 group-hover/column:opacity-100 hover:text-primary transition-all text-white/70 p-0.5 flex-shrink-0 ml-1",onClick:et=>{et.stopPropagation(),oe(un,_t.name)},children:o.jsx(Xn,{size:10})})]},"".concat(Bt,"-").concat(_t.name)))}):o.jsx("div",{className:"px-2 py-2 text-white/40 text-xs",children:"No columns available"})})]},Pt)})]})]},"".concat(de,"-").concat(it)))})()})})]},"pg-active-".concat(de))})]})]})})]})},qm=({schema:e,tableId:t,isExpanded:n,isLoadingColumns:r=!1,onToggle:a,onGenerateQuery:s,onGenerateColumnQuery:i,getObjectIcon:l,getColumnTypeIcon:c})=>o.jsxs("div",{className:"schema-item group",children:[o.jsxs("div",{className:"flex items-center px-2 py-1.5 hover:bg-white/5 rounded cursor-pointer text-sm",onClick:a,children:[o.jsx("span",{className:"mr-1.5 text-white/70 flex-shrink-0",children:e.columns.length>0||r?n?o.jsx(br,{size:14}):o.jsx(nr,{size:14}):o.jsx("div",{className:"w-3.5 h-3.5"})}),o.jsx("span",{className:"flex-shrink-0",children:l(e.type)}),o.jsx(Ut,{content:e.name,placement:"top",children:o.jsx("span",{className:"flex-1 text-white/90 truncate ml-1.5 min-w-0",children:e.name})}),o.jsx(Ut,{placement:"top",content:"Insert SELECT query",children:o.jsx("button",{className:"opacity-0 group-hover:opacity-100 hover:text-primary transition-all text-white/70 p-1 flex-shrink-0",onClick:u=>{u.stopPropagation(),s(e)},children:o.jsx(Xn,{size:12})})})]}),n&&o.jsx("div",{className:"ml-6 pl-2 border-l border-white/10 mt-1 mb-2",children:r?o.jsxs("div",{className:"flex items-center py-2 text-white/40 text-xs",children:[o.jsx(Hn,{size:12,className:"animate-spin mr-1.5"}),"Loading columns..."]}):e.columns.length>0?o.jsx("div",{className:"space-y-0.5",children:e.columns.map(u=>o.jsxs("div",{className:"flex items-center px-2 py-1 hover:bg-white/5 rounded text-xs group/column",children:[o.jsx("span",{className:"flex-shrink-0",children:c(u.type)}),o.jsx(Ut,{content:u.name,placement:"top",children:o.jsx("span",{className:"ml-1.5 text-white/80 truncate flex-1 min-w-0",children:u.name})}),o.jsx(Ut,{content:u.type,placement:"top",children:o.jsx("span",{className:"text-white/40 text-xs flex-shrink-0 ml-2 max-w-[60px] truncate",children:u.type})}),o.jsx(Ut,{placement:"left",content:"Insert column query",children:o.jsx("button",{className:"opacity-0 group-hover/column:opacity-100 hover:text-primary transition-all text-white/70 p-0.5 flex-shrink-0 ml-1",onClick:h=>{h.stopPropagation(),i(e,u.name)},children:o.jsx(Xn,{size:10})})})]},"".concat(t,"-").concat(u.name)))}):o.jsx("div",{className:"px-2 py-2 text-white/40 text-xs",children:"No columns available"})})]});function mLe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function DG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function PG(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DG(Object(n),!0).forEach(function(r){mLe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DG(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pLe(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,s;for(s=0;s<r.length;s++)a=r[s],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function gLe(e,t){if(e==null)return{};var n=pLe(e,t),r,a;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)r=s[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ELe(e,t){return TLe(e)||yLe(e,t)||xLe(e,t)||SLe()}function TLe(e){if(Array.isArray(e))return e}function yLe(e,t){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,a=!1,s=void 0;try{for(var i=e[Symbol.iterator](),l;!(r=(l=i.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){a=!0,s=c}finally{try{!r&&i.return!=null&&i.return()}finally{if(a)throw s}}return n}}function xLe(e,t){if(e){if(typeof e=="string")return kG(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kG(e,t)}}function kG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function SLe(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bLe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function UG(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?jG(Object(n),!0).forEach(function(r){bLe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jG(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vLe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(a,s){return s(a)},r)}}function Ep(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return a.length>=e.length?e.apply(this,a):function(){for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return t.apply(n,[].concat(a,l))}}}function g0(e){return{}.toString.call(e).includes("Object")}function ALe(e){return!Object.keys(e).length}function Ag(e){return typeof e=="function"}function RLe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function NLe(e,t){return g0(t)||kl("changeType"),Object.keys(t).some(function(n){return!RLe(e,n)})&&kl("changeField"),t}function _Le(e){Ag(e)||kl("selectorType")}function wLe(e){Ag(e)||g0(e)||kl("handlerType"),g0(e)&&Object.values(e).some(function(t){return!Ag(t)})&&kl("handlersType")}function CLe(e){e||kl("initialIsRequired"),g0(e)||kl("initialType"),ALe(e)&&kl("initialContent")}function ILe(e,t){throw new Error(e[t]||e.default)}var OLe={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"},kl=Ep(ILe)(OLe),BT={changes:NLe,selector:_Le,handler:wLe,initial:CLe};function LLe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};BT.initial(e),BT.handler(t);var n={current:e},r=Ep(PLe)(n,t),a=Ep(DLe)(n),s=Ep(BT.changes)(e),i=Ep(MLe)(n);function l(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(h){return h};return BT.selector(u),u(n.current)}function c(u){vLe(r,a,s,i)(u)}return[l,c]}function MLe(e,t){return Ag(t)?t(e.current):t}function DLe(e,t){return e.current=UG(UG({},e.current),t),t}function PLe(e,t,n){return Ag(t)?t(e.current):Object.keys(n).forEach(function(r){var a;return(a=t[r])===null||a===void 0?void 0:a.call(t,e.current[r])}),n}var kLe={create:LLe},jLe={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}};function ULe(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),s=0;s<r;s++)a[s]=arguments[s];return a.length>=e.length?e.apply(this,a):function(){for(var i=arguments.length,l=new Array(i),c=0;c<i;c++)l[c]=arguments[c];return t.apply(n,[].concat(a,l))}}}function FLe(e){return{}.toString.call(e).includes("Object")}function $Le(e){return e||FG("configIsRequired"),FLe(e)||FG("configType"),e.urls?{paths:{vs:e.urls.monacoBase}}:e}function BLe(e,t){throw new Error(e[t]||e.default)}var HLe={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!\n    You are using deprecated way of configuration.\n\n    Instead of using\n      monaco.config({ urls: { monacoBase: '...' } })\n    use\n      monaco.config({ paths: { vs: '...' } })\n\n    For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n  "},FG=ULe(BLe)(HLe),VLe={config:$Le},GLe=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(a){return n.reduceRight(function(s,i){return i(s)},a)}};function pQ(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],pQ(e[n],t[n]))}),PG(PG({},e),t)}var zLe={type:"cancelation",msg:"operation is manually canceled"};function nC(e){var t=!1,n=new Promise(function(r,a){e.then(function(s){return t?a(zLe):r(s)}),e.catch(a)});return n.cancel=function(){return t=!0},n}var qLe=kLe.create({config:jLe,isInitialized:!1,resolve:null,reject:null,monaco:null}),gQ=ELe(qLe,2),Gg=gQ[0],hS=gQ[1];function YLe(e){var t=VLe.config(e),n=t.monaco,r=gLe(t,["monaco"]);hS(function(a){return{config:pQ(a.config,r),monaco:n}})}function WLe(){var e=Gg(function(t){var n=t.monaco,r=t.isInitialized,a=t.resolve;return{monaco:n,isInitialized:r,resolve:a}});if(!e.isInitialized){if(hS({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),nC(rC);if(window.monaco&&window.monaco.editor)return EQ(window.monaco),e.resolve(window.monaco),nC(rC);GLe(XLe,QLe)(JLe)}return nC(rC)}function XLe(e){return document.body.appendChild(e)}function KLe(e){var t=document.createElement("script");return e&&(t.src=e),t}function QLe(e){var t=Gg(function(r){var a=r.config,s=r.reject;return{config:a,reject:s}}),n=KLe("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function JLe(){var e=Gg(function(n){var r=n.config,a=n.resolve,s=n.reject;return{config:r,resolve:a,reject:s}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){EQ(n),e.resolve(n)},function(n){e.reject(n)})}function EQ(e){Gg().monaco||hS({monaco:e})}function ZLe(){return Gg(function(e){var t=e.monaco;return t})}var rC=new Promise(function(e,t){return hS({resolve:e,reject:t})}),E0={config:YLe,init:WLe,__getMonacoInstance:ZLe},eMe={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},aC=eMe,tMe={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},nMe=tMe;function rMe({children:e}){return Ht.createElement("div",{style:nMe.container},e)}var aMe=rMe,sMe=aMe;function iMe({width:e,height:t,isEditorReady:n,loading:r,_ref:a,className:s,wrapperProps:i}){return Ht.createElement("section",q({style:he(q({},aC.wrapper),{width:e,height:t})},i),!n&&Ht.createElement(sMe,null,r),Ht.createElement("div",{ref:a,style:q(q({},aC.fullWidth),!n&&aC.hide),className:s}))}var oMe=iMe,TQ=v.memo(oMe);function lMe(e){v.useEffect(e,[])}var ID=lMe;function cMe(e,t,n=!0){let r=v.useRef(!0);v.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var gs=cMe;function Pp(){}function sh(e,t,n,r){return uMe(e,r)||dMe(e,t,n,r)}function uMe(e,t){return e.editor.getModel(yQ(e,t))}function dMe(e,t,n,r){return e.editor.createModel(t,n,r?yQ(e,r):void 0)}function yQ(e,t){return e.Uri.parse(t)}function hMe({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:a,originalModelPath:s,modifiedModelPath:i,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:h="Loading...",options:m={},height:p="100%",width:g="100%",className:T,wrapperProps:y={},beforeMount:b=Pp,onMount:x=Pp}){let[R,A]=v.useState(!1),[w,_]=v.useState(!0),N=v.useRef(null),I=v.useRef(null),D=v.useRef(null),M=v.useRef(x),O=v.useRef(b),L=v.useRef(!1);ID(()=>{let B=E0.init();return B.then(j=>(I.current=j)&&_(!1)).catch(j=>(j==null?void 0:j.type)!=="cancelation"&&void 0),()=>N.current?U():B.cancel()}),gs(()=>{if(N.current&&I.current){let B=N.current.getOriginalEditor(),j=sh(I.current,e||"",r||n||"text",s||"");j!==B.getModel()&&B.setModel(j)}},[s],R),gs(()=>{if(N.current&&I.current){let B=N.current.getModifiedEditor(),j=sh(I.current,t||"",a||n||"text",i||"");j!==B.getModel()&&B.setModel(j)}},[i],R),gs(()=>{let B=N.current.getModifiedEditor();B.getOption(I.current.editor.EditorOption.readOnly)?B.setValue(t||""):t!==B.getValue()&&(B.executeEdits("",[{range:B.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),B.pushUndoStop())},[t],R),gs(()=>{var B,j;(j=(B=N.current)==null?void 0:B.getModel())==null||j.original.setValue(e||"")},[e],R),gs(()=>{let{original:B,modified:j}=N.current.getModel();I.current.editor.setModelLanguage(B,r||n||"text"),I.current.editor.setModelLanguage(j,a||n||"text")},[n,r,a],R),gs(()=>{var B;(B=I.current)==null||B.editor.setTheme(u)},[u],R),gs(()=>{var B;(B=N.current)==null||B.updateOptions(m)},[m],R);let k=v.useCallback(()=>{var G;if(!I.current)return;O.current(I.current);let B=sh(I.current,e||"",r||n||"text",s||""),j=sh(I.current,t||"",a||n||"text",i||"");(G=N.current)==null||G.setModel({original:B,modified:j})},[n,t,a,e,r,s,i]),F=v.useCallback(()=>{var B;!L.current&&D.current&&(N.current=I.current.editor.createDiffEditor(D.current,q({automaticLayout:!0},m)),k(),(B=I.current)==null||B.editor.setTheme(u),A(!0),L.current=!0)},[m,u,k]);v.useEffect(()=>{R&&M.current(N.current,I.current)},[R]),v.useEffect(()=>{!w&&!R&&F()},[w,R,F]);function U(){var j,G,K,J;let B=(j=N.current)==null?void 0:j.getModel();l||((G=B==null?void 0:B.original)==null||G.dispose()),c||((K=B==null?void 0:B.modified)==null||K.dispose()),(J=N.current)==null||J.dispose()}return Ht.createElement(TQ,{width:g,height:p,isEditorReady:R,loading:h,_ref:D,className:T,wrapperProps:y})}var fMe=hMe;v.memo(fMe);function mMe(){let[e,t]=v.useState(E0.__getMonacoInstance());return ID(()=>{let n;return e||(n=E0.init(),n.then(r=>{t(r)})),()=>n==null?void 0:n.cancel()}),e}var pMe=mMe;function gMe(e){let t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}var EMe=gMe,HT=new Map;function TMe({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:a,path:s,theme:i="light",line:l,loading:c="Loading...",options:u={},overrideServices:h={},saveViewState:m=!0,keepCurrentModel:p=!1,width:g="100%",height:T="100%",className:y,wrapperProps:b={},beforeMount:x=Pp,onMount:R=Pp,onChange:A,onValidate:w=Pp}){let[_,N]=v.useState(!1),[I,D]=v.useState(!0),M=v.useRef(null),O=v.useRef(null),L=v.useRef(null),k=v.useRef(R),F=v.useRef(x),U=v.useRef(),B=v.useRef(r),j=EMe(s),G=v.useRef(!1),K=v.useRef(!1);ID(()=>{let X=E0.init();return X.then(Z=>(M.current=Z)&&D(!1)).catch(Z=>(Z==null?void 0:Z.type)!=="cancelation"&&void 0),()=>O.current?$():X.cancel()}),gs(()=>{var Z,V,te,ae;let X=sh(M.current,e||r||"",t||a||"",s||n||"");X!==((Z=O.current)==null?void 0:Z.getModel())&&(m&&HT.set(j,(V=O.current)==null?void 0:V.saveViewState()),(te=O.current)==null||te.setModel(X),m&&((ae=O.current)==null||ae.restoreViewState(HT.get(s))))},[s],_),gs(()=>{var X;(X=O.current)==null||X.updateOptions(u)},[u],_),gs(()=>{!O.current||r===void 0||(O.current.getOption(M.current.editor.EditorOption.readOnly)?O.current.setValue(r):r!==O.current.getValue()&&(K.current=!0,O.current.executeEdits("",[{range:O.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),O.current.pushUndoStop(),K.current=!1))},[r],_),gs(()=>{var Z,V;let X=(Z=O.current)==null?void 0:Z.getModel();X&&a&&((V=M.current)==null||V.editor.setModelLanguage(X,a))},[a],_),gs(()=>{var X;l!==void 0&&((X=O.current)==null||X.revealLine(l))},[l],_),gs(()=>{var X;(X=M.current)==null||X.editor.setTheme(i)},[i],_);let J=v.useCallback(()=>{var X;if(!(!L.current||!M.current)&&!G.current){F.current(M.current);let Z=s||n,V=sh(M.current,r||e||"",t||a||"",Z||"");O.current=(X=M.current)==null?void 0:X.editor.create(L.current,q({model:V,automaticLayout:!0},u),h),m&&O.current.restoreViewState(HT.get(Z)),M.current.editor.setTheme(i),l!==void 0&&O.current.revealLine(l),N(!0),G.current=!0}},[e,t,n,r,a,s,u,h,m,i,l]);v.useEffect(()=>{_&&k.current(O.current,M.current)},[_]),v.useEffect(()=>{!I&&!_&&J()},[I,_,J]),B.current=r,v.useEffect(()=>{var X,Z;_&&A&&((X=U.current)==null||X.dispose(),U.current=(Z=O.current)==null?void 0:Z.onDidChangeModelContent(V=>{K.current||A(O.current.getValue(),V)}))},[_,A]),v.useEffect(()=>{if(_){let X=M.current.editor.onDidChangeMarkers(Z=>{var te;let V=(te=O.current.getModel())==null?void 0:te.uri;if(V&&Z.find(ae=>ae.path===V.path)){let ae=M.current.editor.getModelMarkers({resource:V});w==null||w(ae)}});return()=>{X==null||X.dispose()}}return()=>{}},[_,w]);function $(){var X,Z;(X=U.current)==null||X.dispose(),p?m&&HT.set(s,O.current.saveViewState()):(Z=O.current.getModel())==null||Z.dispose(),O.current.dispose()}return Ht.createElement(TQ,{width:g,height:T,isEditorReady:_,loading:c,_ref:L,className:y,wrapperProps:b})}var yMe=TMe,xMe=v.memo(yMe),xQ=xMe;const Me=e=>e.flatMap(SMe),SMe=e=>hy(vMe(e)).map(bMe),bMe=e=>e.replace(/ +/g," ").trim(),vMe=e=>({type:"mandatory_block",items:OD(e,0)[0]}),OD=(e,t,n)=>{const r=[];for(;e[t];){const[a,s]=AMe(e,t);if(r.push(a),t=s,e[t]==="|")t++;else if(e[t]==="}"||e[t]==="]"){if(n!==e[t])throw new Error("Unbalanced parenthesis in: ".concat(e));return t++,[r,t]}else if(t===e.length){if(n)throw new Error("Unbalanced parenthesis in: ".concat(e));return[r,t]}else throw new Error('Unexpected "'.concat(e[t],'"'))}return[r,t]},AMe=(e,t)=>{const n=[];for(;;){const[r,a]=RMe(e,t);if(r)n.push(r),t=a;else break}return n.length===1?[n[0],t]:[{type:"concatenation",items:n},t]},RMe=(e,t)=>{if(e[t]==="{")return NMe(e,t+1);if(e[t]==="[")return _Me(e,t+1);{let n="";for(;e[t]&&/[A-Za-z0-9_ ]/.test(e[t]);)n+=e[t],t++;return[n,t]}},NMe=(e,t)=>{const[n,r]=OD(e,t,"}");return[{type:"mandatory_block",items:n},r]},_Me=(e,t)=>{const[n,r]=OD(e,t,"]");return[{type:"optional_block",items:n},r]},hy=e=>{if(typeof e=="string")return[e];if(e.type==="concatenation")return e.items.map(hy).reduce(wMe,[""]);if(e.type==="mandatory_block")return e.items.flatMap(hy);if(e.type==="optional_block")return["",...e.items.flatMap(hy)];throw new Error("Unknown node type: ".concat(e))},wMe=(e,t)=>{const n=[];for(const r of e)for(const a of t)n.push(r+a);return n};var Ve;(function(e){e.QUOTED_IDENTIFIER="QUOTED_IDENTIFIER",e.IDENTIFIER="IDENTIFIER",e.STRING="STRING",e.VARIABLE="VARIABLE",e.RESERVED_DATA_TYPE="RESERVED_DATA_TYPE",e.RESERVED_PARAMETERIZED_DATA_TYPE="RESERVED_PARAMETERIZED_DATA_TYPE",e.RESERVED_KEYWORD="RESERVED_KEYWORD",e.RESERVED_FUNCTION_NAME="RESERVED_FUNCTION_NAME",e.RESERVED_PHRASE="RESERVED_PHRASE",e.RESERVED_SET_OPERATION="RESERVED_SET_OPERATION",e.RESERVED_CLAUSE="RESERVED_CLAUSE",e.RESERVED_SELECT="RESERVED_SELECT",e.RESERVED_JOIN="RESERVED_JOIN",e.ARRAY_IDENTIFIER="ARRAY_IDENTIFIER",e.ARRAY_KEYWORD="ARRAY_KEYWORD",e.CASE="CASE",e.END="END",e.WHEN="WHEN",e.ELSE="ELSE",e.THEN="THEN",e.LIMIT="LIMIT",e.BETWEEN="BETWEEN",e.AND="AND",e.OR="OR",e.XOR="XOR",e.OPERATOR="OPERATOR",e.COMMA="COMMA",e.ASTERISK="ASTERISK",e.PROPERTY_ACCESS_OPERATOR="PROPERTY_ACCESS_OPERATOR",e.OPEN_PAREN="OPEN_PAREN",e.CLOSE_PAREN="CLOSE_PAREN",e.LINE_COMMENT="LINE_COMMENT",e.BLOCK_COMMENT="BLOCK_COMMENT",e.DISABLE_COMMENT="DISABLE_COMMENT",e.NUMBER="NUMBER",e.NAMED_PARAMETER="NAMED_PARAMETER",e.QUOTED_PARAMETER="QUOTED_PARAMETER",e.NUMBERED_PARAMETER="NUMBERED_PARAMETER",e.POSITIONAL_PARAMETER="POSITIONAL_PARAMETER",e.CUSTOM_PARAMETER="CUSTOM_PARAMETER",e.DELIMITER="DELIMITER",e.EOF="EOF"})(Ve=Ve||(Ve={}));const SQ=e=>({type:Ve.EOF,raw:"«EOF»",text:"«EOF»",start:e}),Hh=SQ(1/0),Dd=e=>t=>t.type===e.type&&t.text===e.text,_u={ARRAY:Dd({text:"ARRAY",type:Ve.RESERVED_DATA_TYPE}),BY:Dd({text:"BY",type:Ve.RESERVED_KEYWORD}),SET:Dd({text:"SET",type:Ve.RESERVED_CLAUSE}),STRUCT:Dd({text:"STRUCT",type:Ve.RESERVED_DATA_TYPE}),WINDOW:Dd({text:"WINDOW",type:Ve.RESERVED_CLAUSE}),VALUES:Dd({text:"VALUES",type:Ve.RESERVED_CLAUSE})},bQ=e=>e===Ve.RESERVED_DATA_TYPE||e===Ve.RESERVED_KEYWORD||e===Ve.RESERVED_FUNCTION_NAME||e===Ve.RESERVED_PHRASE||e===Ve.RESERVED_CLAUSE||e===Ve.RESERVED_SELECT||e===Ve.RESERVED_SET_OPERATION||e===Ve.RESERVED_JOIN||e===Ve.ARRAY_KEYWORD||e===Ve.CASE||e===Ve.END||e===Ve.WHEN||e===Ve.ELSE||e===Ve.THEN||e===Ve.LIMIT||e===Ve.BETWEEN||e===Ve.AND||e===Ve.OR||e===Ve.XOR,CMe=e=>e===Ve.AND||e===Ve.OR||e===Ve.XOR,IMe=["KEYS.NEW_KEYSET","KEYS.ADD_KEY_FROM_RAW_BYTES","AEAD.DECRYPT_BYTES","AEAD.DECRYPT_STRING","AEAD.ENCRYPT","KEYS.KEYSET_CHAIN","KEYS.KEYSET_FROM_JSON","KEYS.KEYSET_TO_JSON","KEYS.ROTATE_KEYSET","KEYS.KEYSET_LENGTH","ANY_VALUE","ARRAY_AGG","AVG","CORR","COUNT","COUNTIF","COVAR_POP","COVAR_SAMP","MAX","MIN","ST_CLUSTERDBSCAN","STDDEV_POP","STDDEV_SAMP","STRING_AGG","SUM","VAR_POP","VAR_SAMP","ANY_VALUE","ARRAY_AGG","ARRAY_CONCAT_AGG","AVG","BIT_AND","BIT_OR","BIT_XOR","COUNT","COUNTIF","LOGICAL_AND","LOGICAL_OR","MAX","MIN","STRING_AGG","SUM","APPROX_COUNT_DISTINCT","APPROX_QUANTILES","APPROX_TOP_COUNT","APPROX_TOP_SUM","ARRAY_CONCAT","ARRAY_LENGTH","ARRAY_TO_STRING","GENERATE_ARRAY","GENERATE_DATE_ARRAY","GENERATE_TIMESTAMP_ARRAY","ARRAY_REVERSE","OFFSET","SAFE_OFFSET","ORDINAL","SAFE_ORDINAL","BIT_COUNT","PARSE_BIGNUMERIC","PARSE_NUMERIC","SAFE_CAST","CURRENT_DATE","EXTRACT","DATE","DATE_ADD","DATE_SUB","DATE_DIFF","DATE_TRUNC","DATE_FROM_UNIX_DATE","FORMAT_DATE","LAST_DAY","PARSE_DATE","UNIX_DATE","CURRENT_DATETIME","DATETIME","EXTRACT","DATETIME_ADD","DATETIME_SUB","DATETIME_DIFF","DATETIME_TRUNC","FORMAT_DATETIME","LAST_DAY","PARSE_DATETIME","ERROR","EXTERNAL_QUERY","S2_CELLIDFROMPOINT","S2_COVERINGCELLIDS","ST_ANGLE","ST_AREA","ST_ASBINARY","ST_ASGEOJSON","ST_ASTEXT","ST_AZIMUTH","ST_BOUNDARY","ST_BOUNDINGBOX","ST_BUFFER","ST_BUFFERWITHTOLERANCE","ST_CENTROID","ST_CENTROID_AGG","ST_CLOSESTPOINT","ST_CLUSTERDBSCAN","ST_CONTAINS","ST_CONVEXHULL","ST_COVEREDBY","ST_COVERS","ST_DIFFERENCE","ST_DIMENSION","ST_DISJOINT","ST_DISTANCE","ST_DUMP","ST_DWITHIN","ST_ENDPOINT","ST_EQUALS","ST_EXTENT","ST_EXTERIORRING","ST_GEOGFROM","ST_GEOGFROMGEOJSON","ST_GEOGFROMTEXT","ST_GEOGFROMWKB","ST_GEOGPOINT","ST_GEOGPOINTFROMGEOHASH","ST_GEOHASH","ST_GEOMETRYTYPE","ST_INTERIORRINGS","ST_INTERSECTION","ST_INTERSECTS","ST_INTERSECTSBOX","ST_ISCOLLECTION","ST_ISEMPTY","ST_LENGTH","ST_MAKELINE","ST_MAKEPOLYGON","ST_MAKEPOLYGONORIENTED","ST_MAXDISTANCE","ST_NPOINTS","ST_NUMGEOMETRIES","ST_NUMPOINTS","ST_PERIMETER","ST_POINTN","ST_SIMPLIFY","ST_SNAPTOGRID","ST_STARTPOINT","ST_TOUCHES","ST_UNION","ST_UNION_AGG","ST_WITHIN","ST_X","ST_Y","FARM_FINGERPRINT","MD5","SHA1","SHA256","SHA512","HLL_COUNT.INIT","HLL_COUNT.MERGE","HLL_COUNT.MERGE_PARTIAL","HLL_COUNT.EXTRACT","MAKE_INTERVAL","EXTRACT","JUSTIFY_DAYS","JUSTIFY_HOURS","JUSTIFY_INTERVAL","JSON_EXTRACT","JSON_QUERY","JSON_EXTRACT_SCALAR","JSON_VALUE","JSON_EXTRACT_ARRAY","JSON_QUERY_ARRAY","JSON_EXTRACT_STRING_ARRAY","JSON_VALUE_ARRAY","TO_JSON_STRING","ABS","SIGN","IS_INF","IS_NAN","IEEE_DIVIDE","RAND","SQRT","POW","POWER","EXP","LN","LOG","LOG10","GREATEST","LEAST","DIV","SAFE_DIVIDE","SAFE_MULTIPLY","SAFE_NEGATE","SAFE_ADD","SAFE_SUBTRACT","MOD","ROUND","TRUNC","CEIL","CEILING","FLOOR","COS","COSH","ACOS","ACOSH","SIN","SINH","ASIN","ASINH","TAN","TANH","ATAN","ATANH","ATAN2","RANGE_BUCKET","FIRST_VALUE","LAST_VALUE","NTH_VALUE","LEAD","LAG","PERCENTILE_CONT","PERCENTILE_DISC","NET.IP_FROM_STRING","NET.SAFE_IP_FROM_STRING","NET.IP_TO_STRING","NET.IP_NET_MASK","NET.IP_TRUNC","NET.IPV4_FROM_INT64","NET.IPV4_TO_INT64","NET.HOST","NET.PUBLIC_SUFFIX","NET.REG_DOMAIN","RANK","DENSE_RANK","PERCENT_RANK","CUME_DIST","NTILE","ROW_NUMBER","SESSION_USER","CORR","COVAR_POP","COVAR_SAMP","STDDEV_POP","STDDEV_SAMP","STDDEV","VAR_POP","VAR_SAMP","VARIANCE","ASCII","BYTE_LENGTH","CHAR_LENGTH","CHARACTER_LENGTH","CHR","CODE_POINTS_TO_BYTES","CODE_POINTS_TO_STRING","CONCAT","CONTAINS_SUBSTR","ENDS_WITH","FORMAT","FROM_BASE32","FROM_BASE64","FROM_HEX","INITCAP","INSTR","LEFT","LENGTH","LPAD","LOWER","LTRIM","NORMALIZE","NORMALIZE_AND_CASEFOLD","OCTET_LENGTH","REGEXP_CONTAINS","REGEXP_EXTRACT","REGEXP_EXTRACT_ALL","REGEXP_INSTR","REGEXP_REPLACE","REGEXP_SUBSTR","REPLACE","REPEAT","REVERSE","RIGHT","RPAD","RTRIM","SAFE_CONVERT_BYTES_TO_STRING","SOUNDEX","SPLIT","STARTS_WITH","STRPOS","SUBSTR","SUBSTRING","TO_BASE32","TO_BASE64","TO_CODE_POINTS","TO_HEX","TRANSLATE","TRIM","UNICODE","UPPER","CURRENT_TIME","TIME","EXTRACT","TIME_ADD","TIME_SUB","TIME_DIFF","TIME_TRUNC","FORMAT_TIME","PARSE_TIME","CURRENT_TIMESTAMP","EXTRACT","STRING","TIMESTAMP","TIMESTAMP_ADD","TIMESTAMP_SUB","TIMESTAMP_DIFF","TIMESTAMP_TRUNC","FORMAT_TIMESTAMP","PARSE_TIMESTAMP","TIMESTAMP_SECONDS","TIMESTAMP_MILLIS","TIMESTAMP_MICROS","UNIX_SECONDS","UNIX_MILLIS","UNIX_MICROS","GENERATE_UUID","COALESCE","IF","IFNULL","NULLIF","AVG","BIT_AND","BIT_OR","BIT_XOR","CORR","COUNT","COVAR_POP","COVAR_SAMP","EXACT_COUNT_DISTINCT","FIRST","GROUP_CONCAT","GROUP_CONCAT_UNQUOTED","LAST","MAX","MIN","NEST","NTH","QUANTILES","STDDEV","STDDEV_POP","STDDEV_SAMP","SUM","TOP","UNIQUE","VARIANCE","VAR_POP","VAR_SAMP","BIT_COUNT","BOOLEAN","BYTES","CAST","FLOAT","HEX_STRING","INTEGER","STRING","COALESCE","GREATEST","IFNULL","IS_INF","IS_NAN","IS_EXPLICITLY_DEFINED","LEAST","NVL","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATE","DATE_ADD","DATEDIFF","DAY","DAYOFWEEK","DAYOFYEAR","FORMAT_UTC_USEC","HOUR","MINUTE","MONTH","MSEC_TO_TIMESTAMP","NOW","PARSE_UTC_USEC","QUARTER","SEC_TO_TIMESTAMP","SECOND","STRFTIME_UTC_USEC","TIME","TIMESTAMP","TIMESTAMP_TO_MSEC","TIMESTAMP_TO_SEC","TIMESTAMP_TO_USEC","USEC_TO_TIMESTAMP","UTC_USEC_TO_DAY","UTC_USEC_TO_HOUR","UTC_USEC_TO_MONTH","UTC_USEC_TO_WEEK","UTC_USEC_TO_YEAR","WEEK","YEAR","FORMAT_IP","PARSE_IP","FORMAT_PACKED_IP","PARSE_PACKED_IP","JSON_EXTRACT","JSON_EXTRACT_SCALAR","ABS","ACOS","ACOSH","ASIN","ASINH","ATAN","ATANH","ATAN2","CEIL","COS","COSH","DEGREES","EXP","FLOOR","LN","LOG","LOG2","LOG10","PI","POW","RADIANS","RAND","ROUND","SIN","SINH","SQRT","TAN","TANH","REGEXP_MATCH","REGEXP_EXTRACT","REGEXP_REPLACE","CONCAT","INSTR","LEFT","LENGTH","LOWER","LPAD","LTRIM","REPLACE","RIGHT","RPAD","RTRIM","SPLIT","SUBSTR","UPPER","TABLE_DATE_RANGE","TABLE_DATE_RANGE_STRICT","TABLE_QUERY","HOST","DOMAIN","TLD","AVG","COUNT","MAX","MIN","STDDEV","SUM","CUME_DIST","DENSE_RANK","FIRST_VALUE","LAG","LAST_VALUE","LEAD","NTH_VALUE","NTILE","PERCENT_RANK","PERCENTILE_CONT","PERCENTILE_DISC","RANK","RATIO_TO_REPORT","ROW_NUMBER","CURRENT_USER","EVERY","FROM_BASE64","HASH","FARM_FINGERPRINT","IF","POSITION","SHA1","SOME","TO_BASE64","BQ.JOBS.CANCEL","BQ.REFRESH_MATERIALIZED_VIEW","OPTIONS","PIVOT","UNPIVOT"],OMe=["ALL","AND","ANY","AS","ASC","ASSERT_ROWS_MODIFIED","AT","BETWEEN","BY","CASE","CAST","COLLATE","CONTAINS","CREATE","CROSS","CUBE","CURRENT","DEFAULT","DEFINE","DESC","DISTINCT","ELSE","END","ENUM","ESCAPE","EXCEPT","EXCLUDE","EXISTS","EXTRACT","FALSE","FETCH","FOLLOWING","FOR","FROM","FULL","GROUP","GROUPING","GROUPS","HASH","HAVING","IF","IGNORE","IN","INNER","INTERSECT","INTO","IS","JOIN","LATERAL","LEFT","LIMIT","LOOKUP","MERGE","NATURAL","NEW","NO","NOT","NULL","NULLS","OF","ON","OR","ORDER","OUTER","OVER","PARTITION","PRECEDING","PROTO","RANGE","RECURSIVE","RESPECT","RIGHT","ROLLUP","ROWS","SELECT","SET","SOME","TABLE","TABLESAMPLE","THEN","TO","TREAT","TRUE","UNBOUNDED","UNION","UNNEST","USING","WHEN","WHERE","WINDOW","WITH","WITHIN","SAFE","LIKE","COPY","CLONE","IN","OUT","INOUT","RETURNS","LANGUAGE","CASCADE","RESTRICT","DETERMINISTIC"],LMe=["ARRAY","BOOL","BYTES","DATE","DATETIME","GEOGRAPHY","INTERVAL","INT64","INT","SMALLINT","INTEGER","BIGINT","TINYINT","BYTEINT","NUMERIC","DECIMAL","BIGNUMERIC","BIGDECIMAL","FLOAT64","STRING","STRUCT","TIME","TIMEZONE"],MMe=Me(["SELECT [ALL | DISTINCT] [AS STRUCT | AS VALUE]"]),DMe=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY","HAVING","QUALIFY","WINDOW","PARTITION BY","ORDER BY","LIMIT","OFFSET","OMIT RECORD IF","INSERT [INTO]","VALUES","SET","MERGE [INTO]","WHEN [NOT] MATCHED [BY SOURCE | BY TARGET] [THEN]","UPDATE SET","CLUSTER BY","FOR SYSTEM_TIME AS OF","WITH CONNECTION","WITH PARTITION COLUMNS","REMOTE WITH CONNECTION"]),$G=Me(["CREATE [OR REPLACE] [TEMP|TEMPORARY|SNAPSHOT|EXTERNAL] TABLE [IF NOT EXISTS]"]),sC=Me(["CREATE [OR REPLACE] [MATERIALIZED] VIEW [IF NOT EXISTS]","UPDATE","DELETE [FROM]","DROP [SNAPSHOT | EXTERNAL] TABLE [IF EXISTS]","ALTER TABLE [IF EXISTS]","ADD COLUMN [IF NOT EXISTS]","DROP COLUMN [IF EXISTS]","RENAME TO","ALTER COLUMN [IF EXISTS]","SET DEFAULT COLLATE","SET OPTIONS","DROP NOT NULL","SET DATA TYPE","ALTER SCHEMA [IF EXISTS]","ALTER [MATERIALIZED] VIEW [IF EXISTS]","ALTER BI_CAPACITY","TRUNCATE TABLE","CREATE SCHEMA [IF NOT EXISTS]","DEFAULT COLLATE","CREATE [OR REPLACE] [TEMP|TEMPORARY|TABLE] FUNCTION [IF NOT EXISTS]","CREATE [OR REPLACE] PROCEDURE [IF NOT EXISTS]","CREATE [OR REPLACE] ROW ACCESS POLICY [IF NOT EXISTS]","GRANT TO","FILTER USING","CREATE CAPACITY","AS JSON","CREATE RESERVATION","CREATE ASSIGNMENT","CREATE SEARCH INDEX [IF NOT EXISTS]","DROP SCHEMA [IF EXISTS]","DROP [MATERIALIZED] VIEW [IF EXISTS]","DROP [TABLE] FUNCTION [IF EXISTS]","DROP PROCEDURE [IF EXISTS]","DROP ROW ACCESS POLICY","DROP ALL ROW ACCESS POLICIES","DROP CAPACITY [IF EXISTS]","DROP RESERVATION [IF EXISTS]","DROP ASSIGNMENT [IF EXISTS]","DROP SEARCH INDEX [IF EXISTS]","DROP [IF EXISTS]","GRANT","REVOKE","DECLARE","EXECUTE IMMEDIATE","LOOP","END LOOP","REPEAT","END REPEAT","WHILE","END WHILE","BREAK","LEAVE","CONTINUE","ITERATE","FOR","END FOR","BEGIN","BEGIN TRANSACTION","COMMIT TRANSACTION","ROLLBACK TRANSACTION","RAISE","RETURN","CALL","ASSERT","EXPORT DATA"]),PMe=Me(["UNION {ALL | DISTINCT}","EXCEPT DISTINCT","INTERSECT DISTINCT"]),kMe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN"]),jMe=Me(["TABLESAMPLE SYSTEM","ANY TYPE","ALL COLUMNS","NOT DETERMINISTIC","{ROWS | RANGE} BETWEEN","IS [NOT] DISTINCT FROM"]);var s8;const UMe={name:"bigquery",tokenizerOptions:{reservedSelect:MMe,reservedClauses:[...DMe,...sC,...$G],reservedSetOperations:PMe,reservedJoins:kMe,reservedPhrases:jMe,reservedKeywords:OMe,reservedDataTypes:LMe,reservedFunctionNames:IMe,extraParens:["[]"],stringTypes:[{quote:'""".."""',prefixes:["R","B","RB","BR"]},{quote:"'''..'''",prefixes:["R","B","RB","BR"]},'""-bs',"''-bs",{quote:'""-raw',prefixes:["R","B","RB","BR"],requirePrefix:!0},{quote:"''-raw",prefixes:["R","B","RB","BR"],requirePrefix:!0}],identTypes:["``"],identChars:{dashes:!0},paramTypes:{positional:!0,named:["@"],quoted:["@"]},variableTypes:[{regex:String.raw(s8||(s8=wn(["@@w+"],["@@\\w+"])))}],lineCommentTypes:["--","#"],operators:["&","|","^","~",">>","<<","||","=>"],postProcess:FMe},formatOptions:{onelineClauses:[...$G,...sC],tabularOnelineClauses:sC}};function FMe(e){return $Me(BMe(e))}function $Me(e){let t=Hh;return e.map(n=>n.text==="OFFSET"&&t.text==="["?(t=n,Object.assign(Object.assign({},n),{type:Ve.RESERVED_FUNCTION_NAME})):(t=n,n))}function BMe(e){var t;const n=[];for(let r=0;r<e.length;r++){const a=e[r];if((_u.ARRAY(a)||_u.STRUCT(a))&&((t=e[r+1])===null||t===void 0?void 0:t.text)==="<"){const s=HMe(e,r+1),i=e.slice(r,s+1);n.push({type:Ve.IDENTIFIER,raw:i.map(BG("raw")).join(""),text:i.map(BG("text")).join(""),start:a.start}),r=s}else n.push(a)}return n}const BG=e=>t=>t.type===Ve.IDENTIFIER||t.type===Ve.COMMA?t[e]+" ":t[e];function HMe(e,t){let n=0;for(let r=t;r<e.length;r++){const a=e[r];if(a.text==="<"?n++:a.text===">"?n--:a.text===">>"&&(n-=2),n===0)return r}return e.length-1}const VMe=["ARRAY_AGG","AVG","CORRELATION","COUNT","COUNT_BIG","COVARIANCE","COVARIANCE_SAMP","CUME_DIST","GROUPING","LISTAGG","MAX","MEDIAN","MIN","PERCENTILE_CONT","PERCENTILE_DISC","PERCENT_RANK","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_ICPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","STDDEV","STDDEV_SAMP","SUM","VARIANCE","VARIANCE_SAMP","XMLAGG","XMLGROUP","ABS","ABSVAL","ACOS","ADD_DAYS","ADD_HOURS","ADD_MINUTES","ADD_MONTHS","ADD_SECONDS","ADD_YEARS","AGE","ARRAY_DELETE","ARRAY_FIRST","ARRAY_LAST","ARRAY_NEXT","ARRAY_PRIOR","ASCII","ASCII_STR","ASIN","ATAN","ATAN2","ATANH","BITAND","BITANDNOT","BITOR","BITXOR","BITNOT","BPCHAR","BSON_TO_JSON","BTRIM","CARDINALITY","CEILING","CEIL","CHARACTER_LENGTH","CHR","COALESCE","COLLATION_KEY","COLLATION_KEY_BIT","COMPARE_DECFLOAT","CONCAT","COS","COSH","COT","CURSOR_ROWCOUNT","DATAPARTITIONNUM","DATE_PART","DATE_TRUNC","DAY","DAYNAME","DAYOFMONTH","DAYOFWEEK","DAYOFWEEK_ISO","DAYOFYEAR","DAYS","DAYS_BETWEEN","DAYS_TO_END_OF_MONTH","DBPARTITIONNUM","DECFLOAT","DECFLOAT_FORMAT","DECODE","DECRYPT_BIN","DECRYPT_CHAR","DEGREES","DEREF","DIFFERENCE","DIGITS","DOUBLE_PRECISION","EMPTY_BLOB","EMPTY_CLOB","EMPTY_DBCLOB","EMPTY_NCLOB","ENCRYPT","EVENT_MON_STATE","EXP","EXTRACT","FIRST_DAY","FLOOR","FROM_UTC_TIMESTAMP","GENERATE_UNIQUE","GETHINT","GREATEST","HASH","HASH4","HASH8","HASHEDVALUE","HEX","HEXTORAW","HOUR","HOURS_BETWEEN","IDENTITY_VAL_LOCAL","IFNULL","INITCAP","INSERT","INSTR","INSTR2","INSTR4","INSTRB","INTNAND","INTNOR","INTNXOR","INTNNOT","ISNULL","JSON_ARRAY","JSON_OBJECT","JSON_QUERY","JSON_TO_BSON","JSON_VALUE","JULIAN_DAY","LAST_DAY","LCASE","LEAST","LEFT","LENGTH","LENGTH2","LENGTH4","LENGTHB","LN","LOCATE","LOCATE_IN_STRING","LOG10","LONG_VARCHAR","LONG_VARGRAPHIC","LOWER","LPAD","LTRIM","MAX","MAX_CARDINALITY","MICROSECOND","MIDNIGHT_SECONDS","MIN","MINUTE","MINUTES_BETWEEN","MOD","MONTH","MONTHNAME","MONTHS_BETWEEN","MULTIPLY_ALT","NEXT_DAY","NEXT_MONTH","NEXT_QUARTER","NEXT_WEEK","NEXT_YEAR","NORMALIZE_DECFLOAT","NOW","NULLIF","NVL","NVL2","OCTET_LENGTH","OVERLAY","PARAMETER","POSITION","POSSTR","POW","POWER","QUANTIZE","QUARTER","QUOTE_IDENT","QUOTE_LITERAL","RADIANS","RAISE_ERROR","RAND","RANDOM","RAWTOHEX","REC2XML","REGEXP_COUNT","REGEXP_EXTRACT","REGEXP_INSTR","REGEXP_LIKE","REGEXP_MATCH_COUNT","REGEXP_REPLACE","REGEXP_SUBSTR","REPEAT","REPLACE","RID","RID_BIT","RIGHT","ROUND","ROUND_TIMESTAMP","RPAD","RTRIM","SECLABEL","SECLABEL_BY_NAME","SECLABEL_TO_CHAR","SECOND","SECONDS_BETWEEN","SIGN","SIN","SINH","SOUNDEX","SPACE","SQRT","STRIP","STRLEFT","STRPOS","STRRIGHT","SUBSTR","SUBSTR2","SUBSTR4","SUBSTRB","SUBSTRING","TABLE_NAME","TABLE_SCHEMA","TAN","TANH","THIS_MONTH","THIS_QUARTER","THIS_WEEK","THIS_YEAR","TIMESTAMP_FORMAT","TIMESTAMP_ISO","TIMESTAMPDIFF","TIMEZONE","TO_CHAR","TO_CLOB","TO_DATE","TO_HEX","TO_MULTI_BYTE","TO_NCHAR","TO_NCLOB","TO_NUMBER","TO_SINGLE_BYTE","TO_TIMESTAMP","TO_UTC_TIMESTAMP","TOTALORDER","TRANSLATE","TRIM","TRIM_ARRAY","TRUNC_TIMESTAMP","TRUNCATE","TRUNC","TYPE_ID","TYPE_NAME","TYPE_SCHEMA","UCASE","UNICODE_STR","UPPER","VALUE","VARCHAR_BIT_FORMAT","VARCHAR_FORMAT","VARCHAR_FORMAT_BIT","VERIFY_GROUP_FOR_USER","VERIFY_ROLE_FOR_USER","VERIFY_TRUSTED_CONTEXT_ROLE_FOR_USER","WEEK","WEEK_ISO","WEEKS_BETWEEN","WIDTH_BUCKET","XMLATTRIBUTES","XMLCOMMENT","XMLCONCAT","XMLDOCUMENT","XMLELEMENT","XMLFOREST","XMLNAMESPACES","XMLPARSE","XMLPI","XMLQUERY","XMLROW","XMLSERIALIZE","XMLTEXT","XMLVALIDATE","XMLXSROBJECTID","XSLTRANSFORM","YEAR","YEARS_BETWEEN","YMD_BETWEEN","BASE_TABLE","JSON_TABLE","UNNEST","XMLTABLE","RANK","DENSE_RANK","NTILE","LAG","LEAD","ROW_NUMBER","FIRST_VALUE","LAST_VALUE","NTH_VALUE","RATIO_TO_REPORT","CAST"],GMe=["ACTIVATE","ADD","AFTER","ALIAS","ALL","ALLOCATE","ALLOW","ALTER","AND","ANY","AS","ASENSITIVE","ASSOCIATE","ASUTIME","AT","ATTRIBUTES","AUDIT","AUTHORIZATION","AUX","AUXILIARY","BEFORE","BEGIN","BETWEEN","BINARY","BUFFERPOOL","BY","CACHE","CALL","CALLED","CAPTURE","CARDINALITY","CASCADED","CASE","CAST","CHECK","CLONE","CLOSE","CLUSTER","COLLECTION","COLLID","COLUMN","COMMENT","COMMIT","CONCAT","CONDITION","CONNECT","CONNECTION","CONSTRAINT","CONTAINS","CONTINUE","COUNT","COUNT_BIG","CREATE","CROSS","CURRENT","CURRENT_DATE","CURRENT_LC_CTYPE","CURRENT_PATH","CURRENT_SCHEMA","CURRENT_SERVER","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_TIMEZONE","CURRENT_USER","CURSOR","CYCLE","DATA","DATABASE","DATAPARTITIONNAME","DATAPARTITIONNUM","DAY","DAYS","DB2GENERAL","DB2GENRL","DB2SQL","DBINFO","DBPARTITIONNAME","DBPARTITIONNUM","DEALLOCATE","DECLARE","DEFAULT","DEFAULTS","DEFINITION","DELETE","DENSERANK","DENSE_RANK","DESCRIBE","DESCRIPTOR","DETERMINISTIC","DIAGNOSTICS","DISABLE","DISALLOW","DISCONNECT","DISTINCT","DO","DOCUMENT","DROP","DSSIZE","DYNAMIC","EACH","EDITPROC","ELSE","ELSEIF","ENABLE","ENCODING","ENCRYPTION","END","END-EXEC","ENDING","ERASE","ESCAPE","EVERY","EXCEPT","EXCEPTION","EXCLUDING","EXCLUSIVE","EXECUTE","EXISTS","EXIT","EXPLAIN","EXTENDED","EXTERNAL","EXTRACT","FENCED","FETCH","FIELDPROC","FILE","FINAL","FIRST1","FOR","FOREIGN","FREE","FROM","FULL","FUNCTION","GENERAL","GENERATED","GET","GLOBAL","GO","GOTO","GRANT","GRAPHIC","GROUP","HANDLER","HASH","HASHED_VALUE","HAVING","HINT","HOLD","HOUR","HOURS","IDENTITY","IF","IMMEDIATE","IMPORT","IN","INCLUDING","INCLUSIVE","INCREMENT","INDEX","INDICATOR","INDICATORS","INF","INFINITY","INHERIT","INNER","INOUT","INSENSITIVE","INSERT","INTEGRITY","INTERSECT","INTO","IS","ISNULL","ISOBID","ISOLATION","ITERATE","JAR","JAVA","JOIN","KEEP","KEY","LABEL","LANGUAGE","LAST3","LATERAL","LC_CTYPE","LEAVE","LEFT","LIKE","LIMIT","LINKTYPE","LOCAL","LOCALDATE","LOCALE","LOCALTIME","LOCALTIMESTAMP","LOCATOR","LOCATORS","LOCK","LOCKMAX","LOCKSIZE","LOOP","MAINTAINED","MATERIALIZED","MAXVALUE","MICROSECOND","MICROSECONDS","MINUTE","MINUTES","MINVALUE","MODE","MODIFIES","MONTH","MONTHS","NAN","NEW","NEW_TABLE","NEXTVAL","NO","NOCACHE","NOCYCLE","NODENAME","NODENUMBER","NOMAXVALUE","NOMINVALUE","NONE","NOORDER","NORMALIZED","NOT2","NOTNULL","NULL","NULLS","NUMPARTS","OBID","OF","OFF","OFFSET","OLD","OLD_TABLE","ON","OPEN","OPTIMIZATION","OPTIMIZE","OPTION","OR","ORDER","OUT","OUTER","OVER","OVERRIDING","PACKAGE","PADDED","PAGESIZE","PARAMETER","PART","PARTITION","PARTITIONED","PARTITIONING","PARTITIONS","PASSWORD","PATH","PERCENT","PIECESIZE","PLAN","POSITION","PRECISION","PREPARE","PREVVAL","PRIMARY","PRIQTY","PRIVILEGES","PROCEDURE","PROGRAM","PSID","PUBLIC","QUERY","QUERYNO","RANGE","RANK","READ","READS","RECOVERY","REFERENCES","REFERENCING","REFRESH","RELEASE","RENAME","REPEAT","RESET","RESIGNAL","RESTART","RESTRICT","RESULT","RESULT_SET_LOCATOR","RETURN","RETURNS","REVOKE","RIGHT","ROLE","ROLLBACK","ROUND_CEILING","ROUND_DOWN","ROUND_FLOOR","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_HALF_UP","ROUND_UP","ROUTINE","ROW","ROWNUMBER","ROWS","ROWSET","ROW_NUMBER","RRN","RUN","SAVEPOINT","SCHEMA","SCRATCHPAD","SCROLL","SEARCH","SECOND","SECONDS","SECQTY","SECURITY","SELECT","SENSITIVE","SEQUENCE","SESSION","SESSION_USER","SET","SIGNAL","SIMPLE","SNAN","SOME","SOURCE","SPECIFIC","SQL","SQLID","STACKED","STANDARD","START","STARTING","STATEMENT","STATIC","STATMENT","STAY","STOGROUP","STORES","STYLE","SUBSTRING","SUMMARY","SYNONYM","SYSFUN","SYSIBM","SYSPROC","SYSTEM","SYSTEM_USER","TABLE","TABLESPACE","THEN","TO","TRANSACTION","TRIGGER","TRIM","TRUNCATE","TYPE","UNDO","UNION","UNIQUE","UNTIL","UPDATE","USAGE","USER","USING","VALIDPROC","VALUE","VALUES","VARIABLE","VARIANT","VCAT","VERSION","VIEW","VOLATILE","VOLUMES","WHEN","WHENEVER","WHERE","WHILE","WITH","WITHOUT","WLM","WRITE","XMLELEMENT","XMLEXISTS","XMLNAMESPACES","YEAR","YEARS"],zMe=["ARRAY","BIGINT","BINARY","BLOB","BOOLEAN","CCSID","CHAR","CHARACTER","CLOB","DATE","DATETIME","DBCLOB","DEC","DECIMAL","DOUBLE","DOUBLE PRECISION","FLOAT","FLOAT4","FLOAT8","GRAPHIC","INT","INT2","INT4","INT8","INTEGER","INTERVAL","LONG VARCHAR","LONG VARGRAPHIC","NCHAR","NCHR","NCLOB","NVARCHAR","NUMERIC","SMALLINT","REAL","TIME","TIMESTAMP","VARBINARY","VARCHAR","VARGRAPHIC"],qMe=Me(["SELECT [ALL | DISTINCT]"]),YMe=Me(["WITH","FROM","WHERE","GROUP BY","HAVING","PARTITION BY","ORDER BY [INPUT SEQUENCE]","LIMIT","OFFSET","FETCH NEXT","FOR UPDATE [OF]","FOR {READ | FETCH} ONLY","FOR {RR | CS | UR | RS} [USE AND KEEP {SHARE | UPDATE | EXCLUSIVE} LOCKS]","WAIT FOR OUTCOME","SKIP LOCKED DATA","INTO","INSERT INTO","VALUES","SET","MERGE INTO","WHEN [NOT] MATCHED [THEN]","UPDATE SET","INSERT"]),HG=Me(["CREATE [GLOBAL TEMPORARY | EXTERNAL] TABLE [IF NOT EXISTS]"]),iC=Me(["CREATE [OR REPLACE] VIEW","UPDATE","WHERE CURRENT OF","WITH {RR | RS | CS | UR}","DELETE FROM","DROP TABLE [IF EXISTS]","ALTER TABLE","ADD [COLUMN]","DROP [COLUMN]","RENAME COLUMN","ALTER [COLUMN]","SET DATA TYPE","SET NOT NULL","DROP {DEFAULT | GENERATED | NOT NULL}","TRUNCATE [TABLE]","ALLOCATE","ALTER AUDIT POLICY","ALTER BUFFERPOOL","ALTER DATABASE PARTITION GROUP","ALTER DATABASE","ALTER EVENT MONITOR","ALTER FUNCTION","ALTER HISTOGRAM TEMPLATE","ALTER INDEX","ALTER MASK","ALTER METHOD","ALTER MODULE","ALTER NICKNAME","ALTER PACKAGE","ALTER PERMISSION","ALTER PROCEDURE","ALTER SCHEMA","ALTER SECURITY LABEL COMPONENT","ALTER SECURITY POLICY","ALTER SEQUENCE","ALTER SERVER","ALTER SERVICE CLASS","ALTER STOGROUP","ALTER TABLESPACE","ALTER THRESHOLD","ALTER TRIGGER","ALTER TRUSTED CONTEXT","ALTER TYPE","ALTER USAGE LIST","ALTER USER MAPPING","ALTER VIEW","ALTER WORK ACTION SET","ALTER WORK CLASS SET","ALTER WORKLOAD","ALTER WRAPPER","ALTER XSROBJECT","ALTER STOGROUP","ALTER TABLESPACE","ALTER TRIGGER","ALTER TRUSTED CONTEXT","ALTER VIEW","ASSOCIATE [RESULT SET] {LOCATOR | LOCATORS}","AUDIT","BEGIN DECLARE SECTION","CALL","CLOSE","COMMENT ON","COMMIT [WORK]","CONNECT","CREATE [OR REPLACE] [PUBLIC] ALIAS","CREATE AUDIT POLICY","CREATE BUFFERPOOL","CREATE DATABASE PARTITION GROUP","CREATE EVENT MONITOR","CREATE [OR REPLACE] FUNCTION","CREATE FUNCTION MAPPING","CREATE HISTOGRAM TEMPLATE","CREATE [UNIQUE] INDEX","CREATE INDEX EXTENSION","CREATE [OR REPLACE] MASK","CREATE [SPECIFIC] METHOD","CREATE [OR REPLACE] MODULE","CREATE [OR REPLACE] NICKNAME","CREATE [OR REPLACE] PERMISSION","CREATE [OR REPLACE] PROCEDURE","CREATE ROLE","CREATE SCHEMA","CREATE SECURITY LABEL [COMPONENT]","CREATE SECURITY POLICY","CREATE [OR REPLACE] SEQUENCE","CREATE SERVICE CLASS","CREATE SERVER","CREATE STOGROUP","CREATE SYNONYM","CREATE [LARGE | REGULAR | {SYSTEM | USER} TEMPORARY] TABLESPACE","CREATE THRESHOLD","CREATE {TRANSFORM | TRANSFORMS} FOR","CREATE [OR REPLACE] TRIGGER","CREATE TRUSTED CONTEXT","CREATE [OR REPLACE] TYPE","CREATE TYPE MAPPING","CREATE USAGE LIST","CREATE USER MAPPING FOR","CREATE [OR REPLACE] VARIABLE","CREATE WORK ACTION SET","CREATE WORK CLASS SET","CREATE WORKLOAD","CREATE WRAPPER","DECLARE","DECLARE GLOBAL TEMPORARY TABLE","DESCRIBE [INPUT | OUTPUT]","DISCONNECT","DROP [PUBLIC] ALIAS","DROP AUDIT POLICY","DROP BUFFERPOOL","DROP DATABASE PARTITION GROUP","DROP EVENT MONITOR","DROP [SPECIFIC] FUNCTION","DROP FUNCTION MAPPING","DROP HISTOGRAM TEMPLATE","DROP INDEX [EXTENSION]","DROP MASK","DROP [SPECIFIC] METHOD","DROP MODULE","DROP NICKNAME","DROP PACKAGE","DROP PERMISSION","DROP [SPECIFIC] PROCEDURE","DROP ROLE","DROP SCHEMA","DROP SECURITY LABEL [COMPONENT]","DROP SECURITY POLICY","DROP SEQUENCE","DROP SERVER","DROP SERVICE CLASS","DROP STOGROUP","DROP TABLE HIERARCHY","DROP {TABLESPACE | TABLESPACES}","DROP {TRANSFORM | TRANSFORMS}","DROP THRESHOLD","DROP TRIGGER","DROP TRUSTED CONTEXT","DROP TYPE [MAPPING]","DROP USAGE LIST","DROP USER MAPPING FOR","DROP VARIABLE","DROP VIEW [HIERARCHY]","DROP WORK {ACTION | CLASS} SET","DROP WORKLOAD","DROP WRAPPER","DROP XSROBJECT","END DECLARE SECTION","EXECUTE [IMMEDIATE]","EXPLAIN {PLAN [SECTION] | ALL}","FETCH [FROM]","FLUSH {BUFFERPOOL | BUFFERPOOLS} ALL","FLUSH EVENT MONITOR","FLUSH FEDERATED CACHE","FLUSH OPTIMIZATION PROFILE CACHE","FLUSH PACKAGE CACHE [DYNAMIC]","FLUSH AUTHENTICATION CACHE [FOR ALL]","FREE LOCATOR","GET DIAGNOSTICS","GOTO","GRANT","INCLUDE","ITERATE","LEAVE","LOCK TABLE","LOOP","OPEN","PIPE","PREPARE","REFRESH TABLE","RELEASE","RELEASE [TO] SAVEPOINT","RENAME [TABLE | INDEX | STOGROUP | TABLESPACE]","REPEAT","RESIGNAL","RETURN","REVOKE","ROLLBACK [WORK] [TO SAVEPOINT]","SAVEPOINT","SET COMPILATION ENVIRONMENT","SET CONNECTION","SET CURRENT","SET ENCRYPTION PASSWORD","SET EVENT MONITOR STATE","SET INTEGRITY","SET PASSTHRU","SET PATH","SET ROLE","SET SCHEMA","SET SERVER OPTION","SET {SESSION AUTHORIZATION | SESSION_USER}","SET USAGE LIST","SIGNAL","TRANSFER OWNERSHIP OF","WHENEVER {NOT FOUND | SQLERROR | SQLWARNING}","WHILE"]),WMe=Me(["UNION [ALL]","EXCEPT [ALL]","INTERSECT [ALL]"]),XMe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN"]),KMe=Me(["ON DELETE","ON UPDATE","SET NULL","{ROWS | RANGE} BETWEEN"]),QMe={name:"db2",tokenizerOptions:{reservedSelect:qMe,reservedClauses:[...YMe,...HG,...iC],reservedSetOperations:WMe,reservedJoins:XMe,reservedPhrases:KMe,reservedKeywords:GMe,reservedDataTypes:zMe,reservedFunctionNames:VMe,extraParens:["[]"],stringTypes:[{quote:"''-qq",prefixes:["G","N","U&"]},{quote:"''-raw",prefixes:["X","BX","GX","UX"],requirePrefix:!0}],identTypes:['""-qq'],identChars:{first:"@#$",rest:"@#$"},paramTypes:{positional:!0,named:[":"]},paramChars:{first:"@#$",rest:"@#$"},operators:["**","%","|","&","^","~","¬=","¬>","¬<","!>","!<","^=","^>","^<","||","->","=>"]},formatOptions:{onelineClauses:[...HG,...iC],tabularOnelineClauses:iC}},JMe=["ARRAY_AGG","AVG","CORR","CORRELATION","COUNT","COUNT_BIG","COVAR_POP","COVARIANCE","COVAR","COVAR_SAMP","COVARIANCE_SAMP","EVERY","GROUPING","JSON_ARRAYAGG","JSON_OBJECTAGG","LISTAGG","MAX","MEDIAN","MIN","PERCENTILE_CONT","PERCENTILE_DISC","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","SOME","STDDEV_POP","STDDEV","STDDEV_SAMP","SUM","VAR_POP","VARIANCE","VAR","VAR_SAMP","VARIANCE_SAMP","XMLAGG","XMLGROUP","ABS","ABSVAL","ACOS","ADD_DAYS","ADD_HOURS","ADD_MINUTES","ADD_MONTHS","ADD_SECONDS","ADD_YEARS","ANTILOG","ARRAY_MAX_CARDINALITY","ARRAY_TRIM","ASCII","ASIN","ATAN","ATAN2","ATANH","BASE64_DECODE","BASE64_ENCODE","BIT_LENGTH","BITAND","BITANDNOT","BITNOT","BITOR","BITXOR","BSON_TO_JSON","CARDINALITY","CEIL","CEILING","CHAR_LENGTH","CHARACTER_LENGTH","CHR","COALESCE","COMPARE_DECFLOAT","CONCAT","CONTAINS","COS","COSH","COT","CURDATE","CURTIME","DATABASE","DATAPARTITIONNAME","DATAPARTITIONNUM","DAY","DAYNAME","DAYOFMONTH","DAYOFWEEK_ISO","DAYOFWEEK","DAYOFYEAR","DAYS","DBPARTITIONNAME","DBPARTITIONNUM","DECFLOAT_FORMAT","DECFLOAT_SORTKEY","DECRYPT_BINARY","DECRYPT_BIT","DECRYPT_CHAR","DECRYPT_DB","DEGREES","DIFFERENCE","DIGITS","DLCOMMENT","DLLINKTYPE","DLURLCOMPLETE","DLURLPATH","DLURLPATHONLY","DLURLSCHEME","DLURLSERVER","DLVALUE","DOUBLE_PRECISION","DOUBLE","ENCRPYT","ENCRYPT_AES","ENCRYPT_AES256","ENCRYPT_RC2","ENCRYPT_TDES","EXP","EXTRACT","FIRST_DAY","FLOOR","GENERATE_UNIQUE","GET_BLOB_FROM_FILE","GET_CLOB_FROM_FILE","GET_DBCLOB_FROM_FILE","GET_XML_FILE","GETHINT","GREATEST","HASH_MD5","HASH_ROW","HASH_SHA1","HASH_SHA256","HASH_SHA512","HASH_VALUES","HASHED_VALUE","HEX","HEXTORAW","HOUR","HTML_ENTITY_DECODE","HTML_ENTITY_ENCODE","HTTP_DELETE_BLOB","HTTP_DELETE","HTTP_GET_BLOB","HTTP_GET","HTTP_PATCH_BLOB","HTTP_PATCH","HTTP_POST_BLOB","HTTP_POST","HTTP_PUT_BLOB","HTTP_PUT","IDENTITY_VAL_LOCAL","IFNULL","INSERT","INSTR","INTERPRET","ISFALSE","ISNOTFALSE","ISNOTTRUE","ISTRUE","JSON_ARRAY","JSON_OBJECT","JSON_QUERY","JSON_TO_BSON","JSON_UPDATE","JSON_VALUE","JULIAN_DAY","LAND","LAST_DAY","LCASE","LEAST","LEFT","LENGTH","LN","LNOT","LOCATE_IN_STRING","LOCATE","LOG10","LOR","LOWER","LPAD","LTRIM","MAX_CARDINALITY","MAX","MICROSECOND","MIDNIGHT_SECONDS","MIN","MINUTE","MOD","MONTH","MONTHNAME","MONTHS_BETWEEN","MQREAD","MQREADCLOB","MQRECEIVE","MQRECEIVECLOB","MQSEND","MULTIPLY_ALT","NEXT_DAY","NORMALIZE_DECFLOAT","NOW","NULLIF","NVL","OCTET_LENGTH","OVERLAY","PI","POSITION","POSSTR","POW","POWER","QUANTIZE","QUARTER","RADIANS","RAISE_ERROR","RANDOM","RAND","REGEXP_COUNT","REGEXP_INSTR","REGEXP_REPLACE","REGEXP_SUBSTR","REPEAT","REPLACE","RID","RIGHT","ROUND_TIMESTAMP","ROUND","RPAD","RRN","RTRIM","SCORE","SECOND","SIGN","SIN","SINH","SOUNDEX","SPACE","SQRT","STRIP","STRLEFT","STRPOS","STRRIGHT","SUBSTR","SUBSTRING","TABLE_NAME","TABLE_SCHEMA","TAN","TANH","TIMESTAMP_FORMAT","TIMESTAMP_ISO","TIMESTAMPDIFF_BIG","TIMESTAMPDIFF","TO_CHAR","TO_CLOB","TO_DATE","TO_NUMBER","TO_TIMESTAMP","TOTALORDER","TRANSLATE","TRIM_ARRAY","TRIM","TRUNC_TIMESTAMP","TRUNC","TRUNCATE","UCASE","UPPER","URL_DECODE","URL_ENCODE","VALUE","VARBINARY_FORMAT","VARCHAR_BIT_FORMAT","VARCHAR_FORMAT_BINARY","VARCHAR_FORMAT","VERIFY_GROUP_FOR_USER","WEEK_ISO","WEEK","WRAP","XMLATTRIBUTES","XMLCOMMENT","XMLCONCAT","XMLDOCUMENT","XMLELEMENT","XMLFOREST","XMLNAMESPACES","XMLPARSE","XMLPI","XMLROW","XMLSERIALIZE","XMLTEXT","XMLVALIDATE","XOR","XSLTRANSFORM","YEAR","ZONED","BASE_TABLE","HTTP_DELETE_BLOB_VERBOSE","HTTP_DELETE_VERBOSE","HTTP_GET_BLOB_VERBOSE","HTTP_GET_VERBOSE","HTTP_PATCH_BLOB_VERBOSE","HTTP_PATCH_VERBOSE","HTTP_POST_BLOB_VERBOSE","HTTP_POST_VERBOSE","HTTP_PUT_BLOB_VERBOSE","HTTP_PUT_VERBOSE","JSON_TABLE","MQREADALL","MQREADALLCLOB","MQRECEIVEALL","MQRECEIVEALLCLOB","XMLTABLE","UNPACK","CUME_DIST","DENSE_RANK","FIRST_VALUE","LAG","LAST_VALUE","LEAD","NTH_VALUE","NTILE","PERCENT_RANK","RANK","RATIO_TO_REPORT","ROW_NUMBER","CAST"],ZMe=["ABSENT","ACCORDING","ACCTNG","ACTION","ACTIVATE","ADD","ALIAS","ALL","ALLOCATE","ALLOW","ALTER","AND","ANY","APPEND","APPLNAME","ARRAY","ARRAY_AGG","ARRAY_TRIM","AS","ASC","ASENSITIVE","ASSOCIATE","ATOMIC","ATTACH","ATTRIBUTES","AUTHORIZATION","AUTONOMOUS","BEFORE","BEGIN","BETWEEN","BIND","BSON","BUFFERPOOL","BY","CACHE","CALL","CALLED","CARDINALITY","CASE","CAST","CHECK","CL","CLOSE","CLUSTER","COLLECT","COLLECTION","COLUMN","COMMENT","COMMIT","COMPACT","COMPARISONS","COMPRESS","CONCAT","CONCURRENT","CONDITION","CONNECT","CONNECT_BY_ROOT","CONNECTION","CONSTANT","CONSTRAINT","CONTAINS","CONTENT","CONTINUE","COPY","COUNT","COUNT_BIG","CREATE","CREATEIN","CROSS","CUBE","CUME_DIST","CURRENT","CURRENT_DATE","CURRENT_PATH","CURRENT_SCHEMA","CURRENT_SERVER","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_TIMEZONE","CURRENT_USER","CURSOR","CYCLE","DATABASE","DATAPARTITIONNAME","DATAPARTITIONNUM","DAY","DAYS","DB2GENERAL","DB2GENRL","DB2SQL","DBINFO","DBPARTITIONNAME","DBPARTITIONNUM","DEACTIVATE","DEALLOCATE","DECLARE","DEFAULT","DEFAULTS","DEFER","DEFINE","DEFINITION","DELETE","DELETING","DENSE_RANK","DENSERANK","DESC","DESCRIBE","DESCRIPTOR","DETACH","DETERMINISTIC","DIAGNOSTICS","DISABLE","DISALLOW","DISCONNECT","DISTINCT","DO","DOCUMENT","DROP","DYNAMIC","EACH","ELSE","ELSEIF","EMPTY","ENABLE","ENCODING","ENCRYPTION","END","END-EXEC","ENDING","ENFORCED","ERROR","ESCAPE","EVERY","EXCEPT","EXCEPTION","EXCLUDING","EXCLUSIVE","EXECUTE","EXISTS","EXIT","EXTEND","EXTERNAL","EXTRACT","FALSE","FENCED","FETCH","FIELDPROC","FILE","FINAL","FIRST_VALUE","FOR","FOREIGN","FORMAT","FREE","FREEPAGE","FROM","FULL","FUNCTION","GBPCACHE","GENERAL","GENERATED","GET","GLOBAL","GO","GOTO","GRANT","GROUP","HANDLER","HASH","HASH_ROW","HASHED_VALUE","HAVING","HINT","HOLD","HOUR","HOURS","IDENTITY","IF","IGNORE","IMMEDIATE","IMPLICITLY","IN","INCLUDE","INCLUDING","INCLUSIVE","INCREMENT","INDEX","INDEXBP","INDICATOR","INF","INFINITY","INHERIT","INLINE","INNER","INOUT","INSENSITIVE","INSERT","INSERTING","INTEGRITY","INTERPRET","INTERSECT","INTO","IS","ISNULL","ISOLATION","ITERATE","JAVA","JOIN","JSON","JSON_ARRAY","JSON_ARRAYAGG","JSON_EXISTS","JSON_OBJECT","JSON_OBJECTAGG","JSON_QUERY","JSON_TABLE","JSON_VALUE","KEEP","KEY","KEYS","LABEL","LAG","LANGUAGE","LAST_VALUE","LATERAL","LEAD","LEAVE","LEFT","LEVEL2","LIKE","LIMIT","LINKTYPE","LISTAGG","LOCAL","LOCALDATE","LOCALTIME","LOCALTIMESTAMP","LOCATION","LOCATOR","LOCK","LOCKSIZE","LOG","LOGGED","LOOP","MAINTAINED","MASK","MATCHED","MATERIALIZED","MAXVALUE","MERGE","MICROSECOND","MICROSECONDS","MINPCTUSED","MINUTE","MINUTES","MINVALUE","MIRROR","MIXED","MODE","MODIFIES","MONTH","MONTHS","NAMESPACE","NAN","NATIONAL","NCHAR","NCLOB","NESTED","NEW","NEW_TABLE","NEXTVAL","NO","NOCACHE","NOCYCLE","NODENAME","NODENUMBER","NOMAXVALUE","NOMINVALUE","NONE","NOORDER","NORMALIZED","NOT","NOTNULL","NTH_VALUE","NTILE","NULL","NULLS","NVARCHAR","OBID","OBJECT","OF","OFF","OFFSET","OLD","OLD_TABLE","OMIT","ON","ONLY","OPEN","OPTIMIZE","OPTION","OR","ORDER","ORDINALITY","ORGANIZE","OUT","OUTER","OVER","OVERLAY","OVERRIDING","PACKAGE","PADDED","PAGE","PAGESIZE","PARAMETER","PART","PARTITION","PARTITIONED","PARTITIONING","PARTITIONS","PASSING","PASSWORD","PATH","PCTFREE","PERCENT_RANK","PERCENTILE_CONT","PERCENTILE_DISC","PERIOD","PERMISSION","PIECESIZE","PIPE","PLAN","POSITION","PREPARE","PREVVAL","PRIMARY","PRIOR","PRIQTY","PRIVILEGES","PROCEDURE","PROGRAM","PROGRAMID","QUERY","RANGE","RANK","RATIO_TO_REPORT","RCDFMT","READ","READS","RECOVERY","REFERENCES","REFERENCING","REFRESH","REGEXP_LIKE","RELEASE","RENAME","REPEAT","RESET","RESIGNAL","RESTART","RESULT","RESULT_SET_LOCATOR","RETURN","RETURNING","RETURNS","REVOKE","RID","RIGHT","ROLLBACK","ROLLUP","ROUTINE","ROW","ROW_NUMBER","ROWNUMBER","ROWS","RRN","RUN","SAVEPOINT","SBCS","SCALAR","SCHEMA","SCRATCHPAD","SCROLL","SEARCH","SECOND","SECONDS","SECQTY","SECURED","SELECT","SENSITIVE","SEQUENCE","SESSION","SESSION_USER","SET","SIGNAL","SIMPLE","SKIP","SNAN","SOME","SOURCE","SPECIFIC","SQL","SQLID","SQLIND_DEFAULT","SQLIND_UNASSIGNED","STACKED","START","STARTING","STATEMENT","STATIC","STOGROUP","SUBSTRING","SUMMARY","SYNONYM","SYSTEM_TIME","SYSTEM_USER","TABLE","TABLESPACE","TABLESPACES","TAG","THEN","THREADSAFE","TO","TRANSACTION","TRANSFER","TRIGGER","TRIM","TRIM_ARRAY","TRUE","TRUNCATE","TRY_CAST","TYPE","UNDO","UNION","UNIQUE","UNIT","UNKNOWN","UNNEST","UNTIL","UPDATE","UPDATING","URI","USAGE","USE","USER","USERID","USING","VALUE","VALUES","VARIABLE","VARIANT","VCAT","VERSION","VERSIONING","VIEW","VOLATILE","WAIT","WHEN","WHENEVER","WHERE","WHILE","WITH","WITHIN","WITHOUT","WRAPPED","WRAPPER","WRITE","WRKSTNNAME","XMLAGG","XMLATTRIBUTES","XMLCAST","XMLCOMMENT","XMLCONCAT","XMLDOCUMENT","XMLELEMENT","XMLFOREST","XMLGROUP","XMLNAMESPACES","XMLPARSE","XMLPI","XMLROW","XMLSERIALIZE","XMLTABLE","XMLTEXT","XMLVALIDATE","XSLTRANSFORM","XSROBJECT","YEAR","YEARS","YES","ZONE"],eDe=["ARRAY","BIGINT","BINARY","BIT","BLOB","BOOLEAN","CCSID","CHAR","CHARACTER","CLOB","DATA","DATALINK","DATE","DBCLOB","DECFLOAT","DECIMAL","DEC","DOUBLE","DOUBLE PRECISION","FLOAT","GRAPHIC","INT","INTEGER","LONG","NUMERIC","REAL","ROWID","SMALLINT","TIME","TIMESTAMP","VARBINARY","VARCHAR","VARGRAPHIC","XML"],tDe=Me(["SELECT [ALL | DISTINCT]"]),nDe=Me(["WITH [RECURSIVE]","INTO","FROM","WHERE","GROUP BY","HAVING","PARTITION BY","ORDER [SIBLINGS] BY [INPUT SEQUENCE]","LIMIT","OFFSET","FETCH {FIRST | NEXT}","FOR UPDATE [OF]","FOR READ ONLY","OPTIMIZE FOR","INSERT INTO","VALUES","SET","MERGE INTO","WHEN [NOT] MATCHED [THEN]","UPDATE SET","DELETE","INSERT","FOR SYSTEM NAME"]),VG=Me(["CREATE [OR REPLACE] TABLE"]),oC=Me(["CREATE [OR REPLACE] [RECURSIVE] VIEW","UPDATE","WHERE CURRENT OF","WITH {NC | RR | RS | CS | UR}","DELETE FROM","DROP TABLE","ALTER TABLE","ADD [COLUMN]","ALTER [COLUMN]","DROP [COLUMN]","SET DATA TYPE","SET {GENERATED ALWAYS | GENERATED BY DEFAULT}","SET NOT NULL","SET {NOT HIDDEN | IMPLICITLY HIDDEN}","SET FIELDPROC","DROP {DEFAULT | NOT NULL | GENERATED | IDENTITY | ROW CHANGE TIMESTAMP | FIELDPROC}","TRUNCATE [TABLE]","SET [CURRENT] SCHEMA","SET CURRENT_SCHEMA","ALLOCATE CURSOR","ALLOCATE [SQL] DESCRIPTOR [LOCAL | GLOBAL] SQL","ALTER [SPECIFIC] {FUNCTION | PROCEDURE}","ALTER {MASK | PERMISSION | SEQUENCE | TRIGGER}","ASSOCIATE [RESULT SET] {LOCATOR | LOCATORS}","BEGIN DECLARE SECTION","CALL","CLOSE","COMMENT ON {ALIAS | COLUMN | CONSTRAINT | INDEX | MASK | PACKAGE | PARAMETER | PERMISSION | SEQUENCE | TABLE | TRIGGER | VARIABLE | XSROBJECT}","COMMENT ON [SPECIFIC] {FUNCTION | PROCEDURE | ROUTINE}","COMMENT ON PARAMETER SPECIFIC {FUNCTION | PROCEDURE | ROUTINE}","COMMENT ON [TABLE FUNCTION] RETURN COLUMN","COMMENT ON [TABLE FUNCTION] RETURN COLUMN SPECIFIC [PROCEDURE | ROUTINE]","COMMIT [WORK] [HOLD]","CONNECT [TO | RESET] USER","CREATE [OR REPLACE] {ALIAS | FUNCTION | MASK | PERMISSION | PROCEDURE | SEQUENCE | TRIGGER | VARIABLE}","CREATE [ENCODED VECTOR] INDEX","CREATE UNIQUE [WHERE NOT NULL] INDEX","CREATE SCHEMA","CREATE TYPE","DEALLOCATE [SQL] DESCRIPTOR [LOCAL | GLOBAL]","DECLARE CURSOR","DECLARE GLOBAL TEMPORARY TABLE","DECLARE","DESCRIBE CURSOR","DESCRIBE INPUT","DESCRIBE [OUTPUT]","DESCRIBE {PROCEDURE | ROUTINE}","DESCRIBE TABLE","DISCONNECT ALL [SQL]","DISCONNECT [CURRENT]","DROP {ALIAS | INDEX | MASK | PACKAGE | PERMISSION | SCHEMA | SEQUENCE | TABLE | TYPE | VARIABLE | XSROBJECT} [IF EXISTS]","DROP [SPECIFIC] {FUNCTION | PROCEDURE | ROUTINE} [IF EXISTS]","END DECLARE SECTION","EXECUTE [IMMEDIATE]","FREE LOCATOR","GET [SQL] DESCRIPTOR [LOCAL | GLOBAL]","GET [CURRENT | STACKED] DIAGNOSTICS","GRANT {ALL [PRIVILEGES] | ALTER | EXECUTE} ON {FUNCTION | PROCEDURE | ROUTINE | PACKAGE | SCHEMA | SEQUENCE | TABLE | TYPE | VARIABLE | XSROBJECT}","HOLD LOCATOR","INCLUDE","LABEL ON {ALIAS | COLUMN | CONSTRAINT | INDEX | MASK | PACKAGE | PERMISSION | SEQUENCE | TABLE | TRIGGER | VARIABLE | XSROBJECT}","LABEL ON [SPECIFIC] {FUNCTION | PROCEDURE | ROUTINE}","LOCK TABLE","OPEN","PREPARE","REFRESH TABLE","RELEASE","RELEASE [TO] SAVEPOINT","RENAME [TABLE | INDEX] TO","REVOKE {ALL [PRIVILEGES] | ALTER | EXECUTE} ON {FUNCTION | PROCEDURE | ROUTINE | PACKAGE | SCHEMA | SEQUENCE | TABLE | TYPE | VARIABLE | XSROBJECT}","ROLLBACK [WORK] [HOLD | TO SAVEPOINT]","SAVEPOINT","SET CONNECTION","SET CURRENT {DEBUG MODE | DECFLOAT ROUNDING MODE | DEGREE | IMPLICIT XMLPARSE OPTION | TEMPORAL SYSTEM_TIME}","SET [SQL] DESCRIPTOR [LOCAL | GLOBAL]","SET ENCRYPTION PASSWORD","SET OPTION","SET {[CURRENT [FUNCTION]] PATH | CURRENT_PATH}","SET RESULT SETS [WITH RETURN [TO CALLER | TO CLIENT]]","SET SESSION AUTHORIZATION","SET SESSION_USER","SET TRANSACTION","SIGNAL SQLSTATE [VALUE]","TAG","TRANSFER OWNERSHIP OF","WHENEVER {NOT FOUND | SQLERROR | SQLWARNING}"]),rDe=Me(["UNION [ALL]","EXCEPT [ALL]","INTERSECT [ALL]"]),aDe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","[LEFT | RIGHT] EXCEPTION JOIN","{INNER | CROSS} JOIN"]),sDe=Me(["ON DELETE","ON UPDATE","SET NULL","{ROWS | RANGE} BETWEEN"]),iDe={name:"db2i",tokenizerOptions:{reservedSelect:tDe,reservedClauses:[...nDe,...VG,...oC],reservedSetOperations:rDe,reservedJoins:aDe,reservedPhrases:sDe,reservedKeywords:ZMe,reservedDataTypes:eDe,reservedFunctionNames:JMe,nestedBlockComments:!0,extraParens:["[]"],stringTypes:[{quote:"''-qq",prefixes:["G","N"]},{quote:"''-raw",prefixes:["X","BX","GX","UX"],requirePrefix:!0}],identTypes:['""-qq'],identChars:{first:"@#$",rest:"@#$"},paramTypes:{positional:!0,named:[":"]},paramChars:{first:"@#$",rest:"@#$"},operators:["**","¬=","¬>","¬<","!>","!<","||","=>"]},formatOptions:{onelineClauses:[...VG,...oC],tabularOnelineClauses:oC}},oDe=["ABS","ACOS","ADD","ADD_PARQUET_KEY","AGE","AGGREGATE","ALIAS","ALL_PROFILING_OUTPUT","ANY_VALUE","APPLY","APPROX_COUNT_DISTINCT","APPROX_QUANTILE","ARBITRARY","ARGMAX","ARGMIN","ARG_MAX","ARG_MAX_NULL","ARG_MIN","ARG_MIN_NULL","ARRAY_AGG","ARRAY_AGGR","ARRAY_AGGREGATE","ARRAY_APPEND","ARRAY_APPLY","ARRAY_CAT","ARRAY_CONCAT","ARRAY_CONTAINS","ARRAY_COSINE_SIMILARITY","ARRAY_CROSS_PRODUCT","ARRAY_DISTANCE","ARRAY_DISTINCT","ARRAY_DOT_PRODUCT","ARRAY_EXTRACT","ARRAY_FILTER","ARRAY_GRADE_UP","ARRAY_HAS","ARRAY_HAS_ALL","ARRAY_HAS_ANY","ARRAY_INDEXOF","ARRAY_INNER_PRODUCT","ARRAY_INTERSECT","ARRAY_LENGTH","ARRAY_POP_BACK","ARRAY_POP_FRONT","ARRAY_POSITION","ARRAY_PREPEND","ARRAY_PUSH_BACK","ARRAY_PUSH_FRONT","ARRAY_REDUCE","ARRAY_RESIZE","ARRAY_REVERSE","ARRAY_REVERSE_SORT","ARRAY_SELECT","ARRAY_SLICE","ARRAY_SORT","ARRAY_TO_JSON","ARRAY_TO_STRING","ARRAY_TRANSFORM","ARRAY_UNIQUE","ARRAY_VALUE","ARRAY_WHERE","ARRAY_ZIP","ARROW_SCAN","ARROW_SCAN_DUMB","ASCII","ASIN","ATAN","ATAN2","AVG","BASE64","BIN","BITSTRING","BITSTRING_AGG","BIT_AND","BIT_COUNT","BIT_LENGTH","BIT_OR","BIT_POSITION","BIT_XOR","BOOL_AND","BOOL_OR","CARDINALITY","CBRT","CEIL","CEILING","CENTURY","CHECKPOINT","CHR","COLLATIONS","COL_DESCRIPTION","COMBINE","CONCAT","CONCAT_WS","CONSTANT_OR_NULL","CONTAINS","COPY_DATABASE","CORR","COS","COT","COUNT","COUNT_IF","COUNT_STAR","COVAR_POP","COVAR_SAMP","CREATE_SORT_KEY","CURRENT_CATALOG","CURRENT_DATABASE","CURRENT_DATE","CURRENT_LOCALTIME","CURRENT_LOCALTIMESTAMP","CURRENT_QUERY","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_SCHEMAS","CURRENT_SETTING","CURRENT_USER","CURRVAL","DAMERAU_LEVENSHTEIN","DATABASE_LIST","DATABASE_SIZE","DATEDIFF","DATEPART","DATESUB","DATETRUNC","DATE_ADD","DATE_DIFF","DATE_PART","DATE_SUB","DATE_TRUNC","DAY","DAYNAME","DAYOFMONTH","DAYOFWEEK","DAYOFYEAR","DECADE","DECODE","DEGREES","DISABLE_CHECKPOINT_ON_SHUTDOWN","DISABLE_OBJECT_CACHE","DISABLE_OPTIMIZER","DISABLE_PRINT_PROGRESS_BAR","DISABLE_PROFILE","DISABLE_PROFILING","DISABLE_PROGRESS_BAR","DISABLE_VERIFICATION","DISABLE_VERIFY_EXTERNAL","DISABLE_VERIFY_FETCH_ROW","DISABLE_VERIFY_PARALLELISM","DISABLE_VERIFY_SERIALIZER","DIVIDE","DUCKDB_COLUMNS","DUCKDB_CONSTRAINTS","DUCKDB_DATABASES","DUCKDB_DEPENDENCIES","DUCKDB_EXTENSIONS","DUCKDB_FUNCTIONS","DUCKDB_INDEXES","DUCKDB_KEYWORDS","DUCKDB_MEMORY","DUCKDB_OPTIMIZERS","DUCKDB_SCHEMAS","DUCKDB_SECRETS","DUCKDB_SEQUENCES","DUCKDB_SETTINGS","DUCKDB_TABLES","DUCKDB_TEMPORARY_FILES","DUCKDB_TYPES","DUCKDB_VIEWS","EDIT","EDITDIST3","ELEMENT_AT","ENABLE_CHECKPOINT_ON_SHUTDOWN","ENABLE_OBJECT_CACHE","ENABLE_OPTIMIZER","ENABLE_PRINT_PROGRESS_BAR","ENABLE_PROFILE","ENABLE_PROFILING","ENABLE_PROGRESS_BAR","ENABLE_VERIFICATION","ENCODE","ENDS_WITH","ENTROPY","ENUM_CODE","ENUM_FIRST","ENUM_LAST","ENUM_RANGE","ENUM_RANGE_BOUNDARY","EPOCH","EPOCH_MS","EPOCH_NS","EPOCH_US","ERA","ERROR","EVEN","EXP","FACTORIAL","FAVG","FDIV","FILTER","FINALIZE","FIRST","FLATTEN","FLOOR","FMOD","FORCE_CHECKPOINT","FORMAT","FORMATREADABLEDECIMALSIZE","FORMATREADABLESIZE","FORMAT_BYTES","FORMAT_PG_TYPE","FORMAT_TYPE","FROM_BASE64","FROM_BINARY","FROM_HEX","FROM_JSON","FROM_JSON_STRICT","FSUM","FUNCTIONS","GAMMA","GCD","GENERATE_SERIES","GENERATE_SUBSCRIPTS","GEN_RANDOM_UUID","GEOMEAN","GEOMETRIC_MEAN","GETENV","GET_BIT","GET_BLOCK_SIZE","GET_CURRENT_TIME","GET_CURRENT_TIMESTAMP","GLOB","GRADE_UP","GREATEST","GREATEST_COMMON_DIVISOR","GROUP_CONCAT","HAMMING","HASH","HAS_ANY_COLUMN_PRIVILEGE","HAS_COLUMN_PRIVILEGE","HAS_DATABASE_PRIVILEGE","HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE","HAS_FUNCTION_PRIVILEGE","HAS_LANGUAGE_PRIVILEGE","HAS_SCHEMA_PRIVILEGE","HAS_SEQUENCE_PRIVILEGE","HAS_SERVER_PRIVILEGE","HAS_TABLESPACE_PRIVILEGE","HAS_TABLE_PRIVILEGE","HEX","HISTOGRAM","HOUR","ICU_CALENDAR_NAMES","ICU_SORT_KEY","ILIKE_ESCAPE","IMPORT_DATABASE","INDEX_SCAN","INET_CLIENT_ADDR","INET_CLIENT_PORT","INET_SERVER_ADDR","INET_SERVER_PORT","INSTR","IN_SEARCH_PATH","ISFINITE","ISINF","ISNAN","ISODOW","ISOYEAR","JACCARD","JARO_SIMILARITY","JARO_WINKLER_SIMILARITY","JSON_ARRAY","JSON_ARRAY_LENGTH","JSON_CONTAINS","JSON_DESERIALIZE_SQL","JSON_EXECUTE_SERIALIZED_SQL","JSON_EXTRACT","JSON_EXTRACT_PATH","JSON_EXTRACT_PATH_TEXT","JSON_EXTRACT_STRING","JSON_GROUP_ARRAY","JSON_GROUP_OBJECT","JSON_GROUP_STRUCTURE","JSON_KEYS","JSON_MERGE_PATCH","JSON_OBJECT","JSON_QUOTE","JSON_SERIALIZE_PLAN","JSON_SERIALIZE_SQL","JSON_STRUCTURE","JSON_TRANSFORM","JSON_TRANSFORM_STRICT","JSON_TYPE","JSON_VALID","JULIAN","KAHAN_SUM","KURTOSIS","KURTOSIS_POP","LAST","LAST_DAY","LCASE","LCM","LEAST","LEAST_COMMON_MULTIPLE","LEFT","LEFT_GRAPHEME","LEN","LENGTH","LENGTH_GRAPHEME","LEVENSHTEIN","LGAMMA","LIKE_ESCAPE","LIST","LISTAGG","LIST_AGGR","LIST_AGGREGATE","LIST_ANY_VALUE","LIST_APPEND","LIST_APPLY","LIST_APPROX_COUNT_DISTINCT","LIST_AVG","LIST_BIT_AND","LIST_BIT_OR","LIST_BIT_XOR","LIST_BOOL_AND","LIST_BOOL_OR","LIST_CAT","LIST_CONCAT","LIST_CONTAINS","LIST_COSINE_SIMILARITY","LIST_COUNT","LIST_DISTANCE","LIST_DISTINCT","LIST_DOT_PRODUCT","LIST_ELEMENT","LIST_ENTROPY","LIST_EXTRACT","LIST_FILTER","LIST_FIRST","LIST_GRADE_UP","LIST_HAS","LIST_HAS_ALL","LIST_HAS_ANY","LIST_HISTOGRAM","LIST_INDEXOF","LIST_INNER_PRODUCT","LIST_INTERSECT","LIST_KURTOSIS","LIST_KURTOSIS_POP","LIST_LAST","LIST_MAD","LIST_MAX","LIST_MEDIAN","LIST_MIN","LIST_MODE","LIST_PACK","LIST_POSITION","LIST_PREPEND","LIST_PRODUCT","LIST_REDUCE","LIST_RESIZE","LIST_REVERSE","LIST_REVERSE_SORT","LIST_SELECT","LIST_SEM","LIST_SKEWNESS","LIST_SLICE","LIST_SORT","LIST_STDDEV_POP","LIST_STDDEV_SAMP","LIST_STRING_AGG","LIST_SUM","LIST_TRANSFORM","LIST_UNIQUE","LIST_VALUE","LIST_VAR_POP","LIST_VAR_SAMP","LIST_WHERE","LIST_ZIP","LN","LOG","LOG10","LOG2","LOWER","LPAD","LSMODE","LTRIM","MAD","MAKE_DATE","MAKE_TIME","MAKE_TIMESTAMP","MAKE_TIMESTAMPTZ","MAP","MAP_CONCAT","MAP_ENTRIES","MAP_EXTRACT","MAP_FROM_ENTRIES","MAP_KEYS","MAP_VALUES","MAX","MAX_BY","MD5","MD5_NUMBER","MD5_NUMBER_LOWER","MD5_NUMBER_UPPER","MEAN","MEDIAN","METADATA_INFO","MICROSECOND","MILLENNIUM","MILLISECOND","MIN","MINUTE","MIN_BY","MISMATCHES","MOD","MODE","MONTH","MONTHNAME","MULTIPLY","NEXTAFTER","NEXTVAL","NFC_NORMALIZE","NOT_ILIKE_ESCAPE","NOT_LIKE_ESCAPE","NOW","NULLIF","OBJ_DESCRIPTION","OCTET_LENGTH","ORD","PARQUET_FILE_METADATA","PARQUET_KV_METADATA","PARQUET_METADATA","PARQUET_SCAN","PARQUET_SCHEMA","PARSE_DIRNAME","PARSE_DIRPATH","PARSE_FILENAME","PARSE_PATH","PG_COLLATION_IS_VISIBLE","PG_CONF_LOAD_TIME","PG_CONVERSION_IS_VISIBLE","PG_FUNCTION_IS_VISIBLE","PG_GET_CONSTRAINTDEF","PG_GET_EXPR","PG_GET_VIEWDEF","PG_HAS_ROLE","PG_IS_OTHER_TEMP_SCHEMA","PG_MY_TEMP_SCHEMA","PG_OPCLASS_IS_VISIBLE","PG_OPERATOR_IS_VISIBLE","PG_OPFAMILY_IS_VISIBLE","PG_POSTMASTER_START_TIME","PG_SIZE_PRETTY","PG_TABLE_IS_VISIBLE","PG_TIMEZONE_NAMES","PG_TS_CONFIG_IS_VISIBLE","PG_TS_DICT_IS_VISIBLE","PG_TS_PARSER_IS_VISIBLE","PG_TS_TEMPLATE_IS_VISIBLE","PG_TYPEOF","PG_TYPE_IS_VISIBLE","PI","PLATFORM","POSITION","POW","POWER","PRAGMA_COLLATIONS","PRAGMA_DATABASE_SIZE","PRAGMA_METADATA_INFO","PRAGMA_PLATFORM","PRAGMA_SHOW","PRAGMA_STORAGE_INFO","PRAGMA_TABLE_INFO","PRAGMA_USER_AGENT","PRAGMA_VERSION","PREFIX","PRINTF","PRODUCT","QUANTILE","QUANTILE_CONT","QUANTILE_DISC","QUARTER","RADIANS","RANDOM","RANGE","READFILE","READ_BLOB","READ_CSV","READ_CSV_AUTO","READ_JSON","READ_JSON_AUTO","READ_JSON_OBJECTS","READ_JSON_OBJECTS_AUTO","READ_NDJSON","READ_NDJSON_AUTO","READ_NDJSON_OBJECTS","READ_PARQUET","READ_TEXT","REDUCE","REGEXP_ESCAPE","REGEXP_EXTRACT","REGEXP_EXTRACT_ALL","REGEXP_FULL_MATCH","REGEXP_MATCHES","REGEXP_REPLACE","REGEXP_SPLIT_TO_ARRAY","REGEXP_SPLIT_TO_TABLE","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","REPEAT","REPEAT_ROW","REPLACE","RESERVOIR_QUANTILE","REVERSE","RIGHT","RIGHT_GRAPHEME","ROUND","ROUNDBANKERS","ROUND_EVEN","ROW","ROW_TO_JSON","RPAD","RTRIM","SECOND","SEM","SEQ_SCAN","SESSION_USER","SETSEED","SET_BIT","SHA256","SHA3","SHELL_ADD_SCHEMA","SHELL_ESCAPE_CRNL","SHELL_IDQUOTE","SHELL_MODULE_SCHEMA","SHELL_PUTSNL","SHOBJ_DESCRIPTION","SHOW","SHOW_DATABASES","SHOW_TABLES","SHOW_TABLES_EXPANDED","SIGN","SIGNBIT","SIN","SKEWNESS","SNIFF_CSV","SPLIT","SPLIT_PART","SQL_AUTO_COMPLETE","SQRT","STARTS_WITH","STATS","STDDEV","STDDEV_POP","STDDEV_SAMP","STORAGE_INFO","STRFTIME","STRING_AGG","STRING_SPLIT","STRING_SPLIT_REGEX","STRING_TO_ARRAY","STRIP_ACCENTS","STRLEN","STRPOS","STRPTIME","STRUCT_EXTRACT","STRUCT_INSERT","STRUCT_PACK","STR_SPLIT","STR_SPLIT_REGEX","SUBSTR","SUBSTRING","SUBSTRING_GRAPHEME","SUBTRACT","SUFFIX","SUM","SUMKAHAN","SUMMARY","SUM_NO_OVERFLOW","TABLE_INFO","TAN","TEST_ALL_TYPES","TEST_VECTOR_TYPES","TIMEZONE","TIMEZONE_HOUR","TIMEZONE_MINUTE","TIME_BUCKET","TODAY","TO_BASE","TO_BASE64","TO_BINARY","TO_CENTURIES","TO_DAYS","TO_DECADES","TO_HEX","TO_HOURS","TO_JSON","TO_MICROSECONDS","TO_MILLENNIA","TO_MILLISECONDS","TO_MINUTES","TO_MONTHS","TO_SECONDS","TO_TIMESTAMP","TO_WEEKS","TO_YEARS","TRANSACTION_TIMESTAMP","TRANSLATE","TRIM","TRUNC","TRY_STRPTIME","TXID_CURRENT","TYPEOF","UCASE","UNBIN","UNHEX","UNICODE","UNION_EXTRACT","UNION_TAG","UNION_VALUE","UNNEST","UNPIVOT_LIST","UPPER","USER","USER_AGENT","UUID","VARIANCE","VAR_POP","VAR_SAMP","VECTOR_TYPE","VERIFY_EXTERNAL","VERIFY_FETCH_ROW","VERIFY_PARALLELISM","VERIFY_SERIALIZER","VERSION","WEEK","WEEKDAY","WEEKOFYEAR","WHICH_SECRET","WRITEFILE","XOR","YEAR","YEARWEEK","CAST","COALESCE","NULL","RANK","ROW_NUMBER"],lDe=["ALL","ANALYSE","ANALYZE","AND","ANY","AS","ASC","ATTACH","ASYMMETRIC","BOTH","CASE","CAST","CHECK","COLLATE","COLUMN","CONSTRAINT","CREATE","DEFAULT","DEFERRABLE","DESC","DESCRIBE","DETACH","DISTINCT","DO","ELSE","END","EXCEPT","FALSE","FETCH","FOR","FOREIGN","FROM","GRANT","GROUP","HAVING","IN","INITIALLY","INTERSECT","INTO","LATERAL","LEADING","LIMIT","NOT","NULL","OFFSET","ON","ONLY","OR","ORDER","PIVOT","PIVOT_LONGER","PIVOT_WIDER","PLACING","PRIMARY","REFERENCES","RETURNING","SELECT","SHOW","SOME","SUMMARIZE","SYMMETRIC","TABLE","THEN","TO","TRAILING","TRUE","UNION","UNIQUE","UNPIVOT","USING","VARIADIC","WHEN","WHERE","WINDOW","WITH"],cDe=["ARRAY","BIGINT","BINARY","BIT","BITSTRING","BLOB","BOOL","BOOLEAN","BPCHAR","BYTEA","CHAR","DATE","DATETIME","DEC","DECIMAL","DOUBLE","ENUM","FLOAT","FLOAT4","FLOAT8","GUID","HUGEINT","INET","INT","INT1","INT128","INT16","INT2","INT32","INT4","INT64","INT8","INTEGER","INTEGRAL","INTERVAL","JSON","LIST","LOGICAL","LONG","MAP","NUMERIC","NVARCHAR","OID","REAL","ROW","SHORT","SIGNED","SMALLINT","STRING","STRUCT","TEXT","TIME","TIMESTAMP_MS","TIMESTAMP_NS","TIMESTAMP_S","TIMESTAMP_US","TIMESTAMP","TIMESTAMPTZ","TIMETZ","TINYINT","UBIGINT","UHUGEINT","UINT128","UINT16","UINT32","UINT64","UINT8","UINTEGER","UNION","USMALLINT","UTINYINT","UUID","VARBINARY","VARCHAR"],uDe=Me(["SELECT [ALL | DISTINCT]"]),dDe=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY [ALL]","HAVING","WINDOW","PARTITION BY","ORDER BY [ALL]","LIMIT","OFFSET","USING SAMPLE","QUALIFY","INSERT [OR REPLACE] INTO","VALUES","DEFAULT VALUES","SET","RETURNING"]),GG=Me(["CREATE [OR REPLACE] [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]"]),lC=Me(["UPDATE","ON CONFLICT","DELETE FROM","DROP TABLE [IF EXISTS]","TRUNCATE","ALTER TABLE","ADD [COLUMN] [IF NOT EXISTS]","ADD PRIMARY KEY","DROP [COLUMN] [IF EXISTS]","ALTER [COLUMN]","RENAME [COLUMN]","RENAME TO","SET [DATA] TYPE","{SET | DROP} DEFAULT","{SET | DROP} NOT NULL","CREATE [OR REPLACE] [TEMPORARY | TEMP] {MACRO | FUNCTION}","DROP MACRO [TABLE] [IF EXISTS]","DROP FUNCTION [IF EXISTS]","CREATE [UNIQUE] INDEX [IF NOT EXISTS]","DROP INDEX [IF EXISTS]","CREATE [OR REPLACE] SCHEMA [IF NOT EXISTS]","DROP SCHEMA [IF EXISTS]","CREATE [OR REPLACE] [PERSISTENT | TEMPORARY] SECRET [IF NOT EXISTS]","DROP [PERSISTENT | TEMPORARY] SECRET [IF EXISTS]","CREATE [OR REPLACE] [TEMPORARY | TEMP] SEQUENCE","DROP SEQUENCE [IF EXISTS]","CREATE [OR REPLACE] [TEMPORARY | TEMP] VIEW [IF NOT EXISTS]","DROP VIEW [IF EXISTS]","ALTER VIEW","CREATE TYPE","DROP TYPE [IF EXISTS]","ANALYZE","ATTACH [DATABASE] [IF NOT EXISTS]","DETACH [DATABASE] [IF EXISTS]","CALL","[FORCE] CHECKPOINT","COMMENT ON [TABLE | COLUMN | VIEW | INDEX | SEQUENCE | TYPE | MACRO | MACRO TABLE]","COPY [FROM DATABASE]","DESCRIBE","EXPORT DATABASE","IMPORT DATABASE","INSTALL","LOAD","PIVOT","PIVOT_WIDER","UNPIVOT","EXPLAIN [ANALYZE]","SET {LOCAL | SESSION | GLOBAL}","RESET [LOCAL | SESSION | GLOBAL]","{SET | RESET} VARIABLE","SUMMARIZE","BEGIN TRANSACTION","ROLLBACK","COMMIT","ABORT","USE","VACUUM [ANALYZE]","PREPARE","EXECUTE","DEALLOCATE [PREPARE]"]),hDe=Me(["UNION [ALL | BY NAME]","EXCEPT [ALL]","INTERSECT [ALL]"]),fDe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","{NATURAL | ASOF} [INNER] JOIN","{NATURAL | ASOF} {LEFT | RIGHT | FULL} [OUTER] JOIN","POSITIONAL JOIN","ANTI JOIN","SEMI JOIN"]),mDe=Me(["{ROWS | RANGE | GROUPS} BETWEEN","SIMILAR TO","IS [NOT] DISTINCT FROM","TIMESTAMP WITH TIME ZONE"]),pDe={name:"duckdb",tokenizerOptions:{reservedSelect:uDe,reservedClauses:[...dDe,...GG,...lC],reservedSetOperations:hDe,reservedJoins:fDe,reservedPhrases:mDe,supportsXor:!0,reservedKeywords:lDe,reservedDataTypes:cDe,reservedFunctionNames:oDe,nestedBlockComments:!0,extraParens:["[]","{}"],stringTypes:["$$","''-qq",{quote:"''-qq-bs",prefixes:["E"],requirePrefix:!0},{quote:"''-raw",prefixes:["B","X"],requirePrefix:!0}],identTypes:['""-qq'],identChars:{rest:"$"},paramTypes:{positional:!0,numbered:["$"],quoted:["$"]},operators:["//","%","**","^","!","&","|","~","<<",">>","::","==","->",":",":=","=>","~~","!~~","~~*","!~~*","~~~","~","!~","~*","!~*","^@","||",">>=","<<="]},formatOptions:{alwaysDenseOperators:["::"],onelineClauses:[...GG,...lC],tabularOnelineClauses:lC}},gDe=["ABS","ACOS","ASIN","ATAN","BIN","BROUND","CBRT","CEIL","CEILING","CONV","COS","DEGREES","EXP","FACTORIAL","FLOOR","GREATEST","HEX","LEAST","LN","LOG","LOG10","LOG2","NEGATIVE","PI","PMOD","POSITIVE","POW","POWER","RADIANS","RAND","ROUND","SHIFTLEFT","SHIFTRIGHT","SHIFTRIGHTUNSIGNED","SIGN","SIN","SQRT","TAN","UNHEX","WIDTH_BUCKET","ARRAY_CONTAINS","MAP_KEYS","MAP_VALUES","SIZE","SORT_ARRAY","BINARY","CAST","ADD_MONTHS","DATE","DATE_ADD","DATE_FORMAT","DATE_SUB","DATEDIFF","DAY","DAYNAME","DAYOFMONTH","DAYOFYEAR","EXTRACT","FROM_UNIXTIME","FROM_UTC_TIMESTAMP","HOUR","LAST_DAY","MINUTE","MONTH","MONTHS_BETWEEN","NEXT_DAY","QUARTER","SECOND","TIMESTAMP","TO_DATE","TO_UTC_TIMESTAMP","TRUNC","UNIX_TIMESTAMP","WEEKOFYEAR","YEAR","ASSERT_TRUE","COALESCE","IF","ISNOTNULL","ISNULL","NULLIF","NVL","ASCII","BASE64","CHARACTER_LENGTH","CHR","CONCAT","CONCAT_WS","CONTEXT_NGRAMS","DECODE","ELT","ENCODE","FIELD","FIND_IN_SET","FORMAT_NUMBER","GET_JSON_OBJECT","IN_FILE","INITCAP","INSTR","LCASE","LENGTH","LEVENSHTEIN","LOCATE","LOWER","LPAD","LTRIM","NGRAMS","OCTET_LENGTH","PARSE_URL","PRINTF","QUOTE","REGEXP_EXTRACT","REGEXP_REPLACE","REPEAT","REVERSE","RPAD","RTRIM","SENTENCES","SOUNDEX","SPACE","SPLIT","STR_TO_MAP","SUBSTR","SUBSTRING","TRANSLATE","TRIM","UCASE","UNBASE64","UPPER","MASK","MASK_FIRST_N","MASK_HASH","MASK_LAST_N","MASK_SHOW_FIRST_N","MASK_SHOW_LAST_N","AES_DECRYPT","AES_ENCRYPT","CRC32","CURRENT_DATABASE","CURRENT_USER","HASH","JAVA_METHOD","LOGGED_IN_USER","MD5","REFLECT","SHA","SHA1","SHA2","SURROGATE_KEY","VERSION","AVG","COLLECT_LIST","COLLECT_SET","CORR","COUNT","COVAR_POP","COVAR_SAMP","HISTOGRAM_NUMERIC","MAX","MIN","NTILE","PERCENTILE","PERCENTILE_APPROX","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","STDDEV_POP","STDDEV_SAMP","SUM","VAR_POP","VAR_SAMP","VARIANCE","EXPLODE","INLINE","JSON_TUPLE","PARSE_URL_TUPLE","POSEXPLODE","STACK","LEAD","LAG","FIRST_VALUE","LAST_VALUE","RANK","ROW_NUMBER","DENSE_RANK","CUME_DIST","PERCENT_RANK","NTILE"],EDe=["ADD","ADMIN","AFTER","ANALYZE","ARCHIVE","ASC","BEFORE","BUCKET","BUCKETS","CASCADE","CHANGE","CLUSTER","CLUSTERED","CLUSTERSTATUS","COLLECTION","COLUMNS","COMMENT","COMPACT","COMPACTIONS","COMPUTE","CONCATENATE","CONTINUE","DATA","DATABASES","DATETIME","DAY","DBPROPERTIES","DEFERRED","DEFINED","DELIMITED","DEPENDENCY","DESC","DIRECTORIES","DIRECTORY","DISABLE","DISTRIBUTE","ELEM_TYPE","ENABLE","ESCAPED","EXCLUSIVE","EXPLAIN","EXPORT","FIELDS","FILE","FILEFORMAT","FIRST","FORMAT","FORMATTED","FUNCTIONS","HOLD_DDLTIME","HOUR","IDXPROPERTIES","IGNORE","INDEX","INDEXES","INPATH","INPUTDRIVER","INPUTFORMAT","ITEMS","JAR","KEYS","KEY_TYPE","LIMIT","LINES","LOAD","LOCATION","LOCK","LOCKS","LOGICAL","LONG","MAPJOIN","MATERIALIZED","METADATA","MINUS","MINUTE","MONTH","MSCK","NOSCAN","NO_DROP","OFFLINE","OPTION","OUTPUTDRIVER","OUTPUTFORMAT","OVERWRITE","OWNER","PARTITIONED","PARTITIONS","PLUS","PRETTY","PRINCIPALS","PROTECTION","PURGE","READ","READONLY","REBUILD","RECORDREADER","RECORDWRITER","RELOAD","RENAME","REPAIR","REPLACE","REPLICATION","RESTRICT","REWRITE","ROLE","ROLES","SCHEMA","SCHEMAS","SECOND","SEMI","SERDE","SERDEPROPERTIES","SERVER","SETS","SHARED","SHOW","SHOW_DATABASE","SKEWED","SORT","SORTED","SSL","STATISTICS","STORED","STREAMTABLE","STRING","TABLES","TBLPROPERTIES","TEMPORARY","TERMINATED","TINYINT","TOUCH","TRANSACTIONS","UNARCHIVE","UNDO","UNIONTYPE","UNLOCK","UNSET","UNSIGNED","URI","USE","UTC","UTCTIMESTAMP","VALUE_TYPE","VIEW","WHILE","YEAR","AUTOCOMMIT","ISOLATION","LEVEL","OFFSET","SNAPSHOT","TRANSACTION","WORK","WRITE","ABORT","KEY","LAST","NORELY","NOVALIDATE","NULLS","RELY","VALIDATE","DETAIL","DOW","EXPRESSION","OPERATOR","QUARTER","SUMMARY","VECTORIZATION","WEEK","YEARS","MONTHS","WEEKS","DAYS","HOURS","MINUTES","SECONDS","TIMESTAMPTZ","ZONE","ALL","ALTER","AND","AS","AUTHORIZATION","BETWEEN","BOTH","BY","CASE","CAST","COLUMN","CONF","CREATE","CROSS","CUBE","CURRENT","CURRENT_DATE","CURRENT_TIMESTAMP","CURSOR","DATABASE","DELETE","DESCRIBE","DISTINCT","DROP","ELSE","END","EXCHANGE","EXISTS","EXTENDED","EXTERNAL","FALSE","FETCH","FOLLOWING","FOR","FROM","FULL","FUNCTION","GRANT","GROUP","GROUPING","HAVING","IF","IMPORT","IN","INNER","INSERT","INTERSECT","INTO","IS","JOIN","LATERAL","LEFT","LESS","LIKE","LOCAL","MACRO","MORE","NONE","NOT","NULL","OF","ON","OR","ORDER","OUT","OUTER","OVER","PARTIALSCAN","PARTITION","PERCENT","PRECEDING","PRESERVE","PROCEDURE","RANGE","READS","REDUCE","REVOKE","RIGHT","ROLLUP","ROW","ROWS","SELECT","SET","TABLE","TABLESAMPLE","THEN","TO","TRANSFORM","TRIGGER","TRUE","TRUNCATE","UNBOUNDED","UNION","UNIQUEJOIN","UPDATE","USER","USING","UTC_TMESTAMP","VALUES","WHEN","WHERE","WINDOW","WITH","COMMIT","ONLY","REGEXP","RLIKE","ROLLBACK","START","CACHE","CONSTRAINT","FOREIGN","PRIMARY","REFERENCES","DAYOFWEEK","EXTRACT","FLOOR","VIEWS","TIME","SYNC","TEXTFILE","SEQUENCEFILE","ORC","CSV","TSV","PARQUET","AVRO","RCFILE","JSONFILE","INPUTFORMAT","OUTPUTFORMAT"],TDe=["ARRAY","BIGINT","BINARY","BOOLEAN","CHAR","DATE","DECIMAL","DOUBLE","FLOAT","INT","INTEGER","INTERVAL","MAP","NUMERIC","PRECISION","SMALLINT","STRUCT","TIMESTAMP","VARCHAR"],yDe=Me(["SELECT [ALL | DISTINCT]"]),xDe=Me(["WITH","FROM","WHERE","GROUP BY","HAVING","WINDOW","PARTITION BY","ORDER BY","SORT BY","CLUSTER BY","DISTRIBUTE BY","LIMIT","INSERT INTO [TABLE]","VALUES","SET","MERGE INTO","WHEN [NOT] MATCHED [THEN]","UPDATE SET","INSERT [VALUES]","INSERT OVERWRITE [LOCAL] DIRECTORY","LOAD DATA [LOCAL] INPATH","[OVERWRITE] INTO TABLE"]),zG=Me(["CREATE [TEMPORARY] [EXTERNAL] TABLE [IF NOT EXISTS]"]),cC=Me(["CREATE [MATERIALIZED] VIEW [IF NOT EXISTS]","UPDATE","DELETE FROM","DROP TABLE [IF EXISTS]","ALTER TABLE","RENAME TO","TRUNCATE [TABLE]","ALTER","CREATE","USE","DESCRIBE","DROP","FETCH","SHOW","STORED AS","STORED BY","ROW FORMAT"]),SDe=Me(["UNION [ALL | DISTINCT]"]),bDe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","LEFT SEMI JOIN"]),vDe=Me(["{ROWS | RANGE} BETWEEN"]),ADe={name:"hive",tokenizerOptions:{reservedSelect:yDe,reservedClauses:[...xDe,...zG,...cC],reservedSetOperations:SDe,reservedJoins:bDe,reservedPhrases:vDe,reservedKeywords:EDe,reservedDataTypes:TDe,reservedFunctionNames:gDe,extraParens:["[]"],stringTypes:['""-bs',"''-bs"],identTypes:["``"],variableTypes:[{quote:"{}",prefixes:["$"],requirePrefix:!0}],operators:["%","~","^","|","&","<=>","==","!","||"]},formatOptions:{onelineClauses:[...zG,...cC],tabularOnelineClauses:cC}};function fS(e){return e.map((t,n)=>{const r=e[n+1]||Hh;if(_u.SET(t)&&r.text==="(")return Object.assign(Object.assign({},t),{type:Ve.RESERVED_FUNCTION_NAME});const a=e[n-1]||Hh;return _u.VALUES(t)&&a.text==="="?Object.assign(Object.assign({},t),{type:Ve.RESERVED_FUNCTION_NAME}):t})}const RDe=["ACCESSIBLE","ADD","ALL","ALTER","ANALYZE","AND","AS","ASC","ASENSITIVE","BEFORE","BETWEEN","BOTH","BY","CALL","CASCADE","CASE","CHANGE","CHECK","COLLATE","COLUMN","CONDITION","CONSTRAINT","CONTINUE","CONVERT","CREATE","CROSS","CURRENT_DATE","CURRENT_ROLE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURSOR","DATABASE","DATABASES","DAY_HOUR","DAY_MICROSECOND","DAY_MINUTE","DAY_SECOND","DECLARE","DEFAULT","DELAYED","DELETE","DELETE_DOMAIN_ID","DESC","DESCRIBE","DETERMINISTIC","DISTINCT","DISTINCTROW","DIV","DO_DOMAIN_IDS","DROP","DUAL","EACH","ELSE","ELSEIF","ENCLOSED","ESCAPED","EXCEPT","EXISTS","EXIT","EXPLAIN","FALSE","FETCH","FOR","FORCE","FOREIGN","FROM","FULLTEXT","GENERAL","GRANT","GROUP","HAVING","HIGH_PRIORITY","HOUR_MICROSECOND","HOUR_MINUTE","HOUR_SECOND","IF","IGNORE","IGNORE_DOMAIN_IDS","IGNORE_SERVER_IDS","IN","INDEX","INFILE","INNER","INOUT","INSENSITIVE","INSERT","INTERSECT","INTERVAL","INTO","IS","ITERATE","JOIN","KEY","KEYS","KILL","LEADING","LEAVE","LEFT","LIKE","LIMIT","LINEAR","LINES","LOAD","LOCALTIME","LOCALTIMESTAMP","LOCK","LOOP","LOW_PRIORITY","MASTER_HEARTBEAT_PERIOD","MASTER_SSL_VERIFY_SERVER_CERT","MATCH","MAXVALUE","MINUTE_MICROSECOND","MINUTE_SECOND","MOD","MODIFIES","NATURAL","NOT","NO_WRITE_TO_BINLOG","NULL","OFFSET","ON","OPTIMIZE","OPTION","OPTIONALLY","OR","ORDER","OUT","OUTER","OUTFILE","OVER","PAGE_CHECKSUM","PARSE_VCOL_EXPR","PARTITION","POSITION","PRIMARY","PROCEDURE","PURGE","RANGE","READ","READS","READ_WRITE","RECURSIVE","REF_SYSTEM_ID","REFERENCES","REGEXP","RELEASE","RENAME","REPEAT","REPLACE","REQUIRE","RESIGNAL","RESTRICT","RETURN","RETURNING","REVOKE","RIGHT","RLIKE","ROW_NUMBER","ROWS","SCHEMA","SCHEMAS","SECOND_MICROSECOND","SELECT","SENSITIVE","SEPARATOR","SET","SHOW","SIGNAL","SLOW","SPATIAL","SPECIFIC","SQL","SQLEXCEPTION","SQLSTATE","SQLWARNING","SQL_BIG_RESULT","SQL_CALC_FOUND_ROWS","SQL_SMALL_RESULT","SSL","STARTING","STATS_AUTO_RECALC","STATS_PERSISTENT","STATS_SAMPLE_PAGES","STRAIGHT_JOIN","TABLE","TERMINATED","THEN","TO","TRAILING","TRIGGER","TRUE","UNDO","UNION","UNIQUE","UNLOCK","UNSIGNED","UPDATE","USAGE","USE","USING","UTC_DATE","UTC_TIME","UTC_TIMESTAMP","VALUES","WHEN","WHERE","WHILE","WINDOW","WITH","WRITE","XOR","YEAR_MONTH","ZEROFILL"],NDe=["BIGINT","BINARY","BIT","BLOB","CHAR BYTE","CHAR","CHARACTER","DATETIME","DEC","DECIMAL","DOUBLE PRECISION","DOUBLE","ENUM","FIXED","FLOAT","FLOAT4","FLOAT8","INT","INT1","INT2","INT3","INT4","INT8","INTEGER","LONG","LONGBLOB","LONGTEXT","MEDIUMBLOB","MEDIUMINT","MEDIUMTEXT","MIDDLEINT","NATIONAL CHAR","NATIONAL VARCHAR","NUMERIC","PRECISION","REAL","SMALLINT","TEXT","TIMESTAMP","TINYBLOB","TINYINT","TINYTEXT","VARBINARY","VARCHAR","VARCHARACTER","VARYING","YEAR"],_De=["ADDDATE","ADD_MONTHS","BIT_AND","BIT_OR","BIT_XOR","CAST","COUNT","CUME_DIST","CURDATE","CURTIME","DATE_ADD","DATE_SUB","DATE_FORMAT","DECODE","DENSE_RANK","EXTRACT","FIRST_VALUE","GROUP_CONCAT","JSON_ARRAYAGG","JSON_OBJECTAGG","LAG","LEAD","MAX","MEDIAN","MID","MIN","NOW","NTH_VALUE","NTILE","POSITION","PERCENT_RANK","PERCENTILE_CONT","PERCENTILE_DISC","RANK","ROW_NUMBER","SESSION_USER","STD","STDDEV","STDDEV_POP","STDDEV_SAMP","SUBDATE","SUBSTR","SUBSTRING","SUM","SYSTEM_USER","TRIM","TRIM_ORACLE","VARIANCE","VAR_POP","VAR_SAMP","ABS","ACOS","ADDTIME","AES_DECRYPT","AES_ENCRYPT","ASIN","ATAN","ATAN2","BENCHMARK","BIN","BINLOG_GTID_POS","BIT_COUNT","BIT_LENGTH","CEIL","CEILING","CHARACTER_LENGTH","CHAR_LENGTH","CHR","COERCIBILITY","COLUMN_CHECK","COLUMN_EXISTS","COLUMN_LIST","COLUMN_JSON","COMPRESS","CONCAT","CONCAT_OPERATOR_ORACLE","CONCAT_WS","CONNECTION_ID","CONV","CONVERT_TZ","COS","COT","CRC32","DATEDIFF","DAYNAME","DAYOFMONTH","DAYOFWEEK","DAYOFYEAR","DEGREES","DECODE_HISTOGRAM","DECODE_ORACLE","DES_DECRYPT","DES_ENCRYPT","ELT","ENCODE","ENCRYPT","EXP","EXPORT_SET","EXTRACTVALUE","FIELD","FIND_IN_SET","FLOOR","FORMAT","FOUND_ROWS","FROM_BASE64","FROM_DAYS","FROM_UNIXTIME","GET_LOCK","GREATEST","HEX","IFNULL","INSTR","ISNULL","IS_FREE_LOCK","IS_USED_LOCK","JSON_ARRAY","JSON_ARRAY_APPEND","JSON_ARRAY_INSERT","JSON_COMPACT","JSON_CONTAINS","JSON_CONTAINS_PATH","JSON_DEPTH","JSON_DETAILED","JSON_EXISTS","JSON_EXTRACT","JSON_INSERT","JSON_KEYS","JSON_LENGTH","JSON_LOOSE","JSON_MERGE","JSON_MERGE_PATCH","JSON_MERGE_PRESERVE","JSON_QUERY","JSON_QUOTE","JSON_OBJECT","JSON_REMOVE","JSON_REPLACE","JSON_SET","JSON_SEARCH","JSON_TYPE","JSON_UNQUOTE","JSON_VALID","JSON_VALUE","LAST_DAY","LAST_INSERT_ID","LCASE","LEAST","LENGTH","LENGTHB","LN","LOAD_FILE","LOCATE","LOG","LOG10","LOG2","LOWER","LPAD","LPAD_ORACLE","LTRIM","LTRIM_ORACLE","MAKEDATE","MAKETIME","MAKE_SET","MASTER_GTID_WAIT","MASTER_POS_WAIT","MD5","MONTHNAME","NAME_CONST","NVL","NVL2","OCT","OCTET_LENGTH","ORD","PERIOD_ADD","PERIOD_DIFF","PI","POW","POWER","QUOTE","REGEXP_INSTR","REGEXP_REPLACE","REGEXP_SUBSTR","RADIANS","RAND","RELEASE_ALL_LOCKS","RELEASE_LOCK","REPLACE_ORACLE","REVERSE","ROUND","RPAD","RPAD_ORACLE","RTRIM","RTRIM_ORACLE","SEC_TO_TIME","SHA","SHA1","SHA2","SIGN","SIN","SLEEP","SOUNDEX","SPACE","SQRT","STRCMP","STR_TO_DATE","SUBSTR_ORACLE","SUBSTRING_INDEX","SUBTIME","SYS_GUID","TAN","TIMEDIFF","TIME_FORMAT","TIME_TO_SEC","TO_BASE64","TO_CHAR","TO_DAYS","TO_SECONDS","UCASE","UNCOMPRESS","UNCOMPRESSED_LENGTH","UNHEX","UNIX_TIMESTAMP","UPDATEXML","UPPER","UUID","UUID_SHORT","VERSION","WEEKDAY","WEEKOFYEAR","WSREP_LAST_WRITTEN_GTID","WSREP_LAST_SEEN_GTID","WSREP_SYNC_WAIT_UPTO_GTID","YEARWEEK","COALESCE","NULLIF"],wDe=Me(["SELECT [ALL | DISTINCT | DISTINCTROW]"]),CDe=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY","HAVING","PARTITION BY","ORDER BY","LIMIT","OFFSET","FETCH {FIRST | NEXT}","INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO]","REPLACE [LOW_PRIORITY | DELAYED] [INTO]","VALUES","ON DUPLICATE KEY UPDATE","SET","RETURNING"]),qG=Me(["CREATE [OR REPLACE] [TEMPORARY] TABLE [IF NOT EXISTS]"]),uC=Me(["CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]","UPDATE [LOW_PRIORITY] [IGNORE]","DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM","DROP [TEMPORARY] TABLE [IF EXISTS]","ALTER [ONLINE] [IGNORE] TABLE [IF EXISTS]","ADD [COLUMN] [IF NOT EXISTS]","{CHANGE | MODIFY} [COLUMN] [IF EXISTS]","DROP [COLUMN] [IF EXISTS]","RENAME [TO]","RENAME COLUMN","ALTER [COLUMN]","{SET | DROP} DEFAULT","SET {VISIBLE | INVISIBLE}","TRUNCATE [TABLE]","ALTER DATABASE","ALTER DATABASE COMMENT","ALTER EVENT","ALTER FUNCTION","ALTER PROCEDURE","ALTER SCHEMA","ALTER SCHEMA COMMENT","ALTER SEQUENCE","ALTER SERVER","ALTER USER","ALTER VIEW","ANALYZE","ANALYZE TABLE","BACKUP LOCK","BACKUP STAGE","BACKUP UNLOCK","BEGIN","BINLOG","CACHE INDEX","CALL","CHANGE MASTER TO","CHECK TABLE","CHECK VIEW","CHECKSUM TABLE","COMMIT","CREATE AGGREGATE FUNCTION","CREATE DATABASE","CREATE EVENT","CREATE FUNCTION","CREATE INDEX","CREATE PROCEDURE","CREATE ROLE","CREATE SEQUENCE","CREATE SERVER","CREATE SPATIAL INDEX","CREATE TRIGGER","CREATE UNIQUE INDEX","CREATE USER","DEALLOCATE PREPARE","DESCRIBE","DROP DATABASE","DROP EVENT","DROP FUNCTION","DROP INDEX","DROP PREPARE","DROP PROCEDURE","DROP ROLE","DROP SEQUENCE","DROP SERVER","DROP TRIGGER","DROP USER","DROP VIEW","EXECUTE","EXPLAIN","FLUSH","GET DIAGNOSTICS","GET DIAGNOSTICS CONDITION","GRANT","HANDLER","HELP","INSTALL PLUGIN","INSTALL SONAME","KILL","LOAD DATA INFILE","LOAD INDEX INTO CACHE","LOAD XML INFILE","LOCK TABLE","OPTIMIZE TABLE","PREPARE","PURGE BINARY LOGS","PURGE MASTER LOGS","RELEASE SAVEPOINT","RENAME TABLE","RENAME USER","REPAIR TABLE","REPAIR VIEW","RESET MASTER","RESET QUERY CACHE","RESET REPLICA","RESET SLAVE","RESIGNAL","REVOKE","ROLLBACK","SAVEPOINT","SET CHARACTER SET","SET DEFAULT ROLE","SET GLOBAL TRANSACTION","SET NAMES","SET PASSWORD","SET ROLE","SET STATEMENT","SET TRANSACTION","SHOW","SHOW ALL REPLICAS STATUS","SHOW ALL SLAVES STATUS","SHOW AUTHORS","SHOW BINARY LOGS","SHOW BINLOG EVENTS","SHOW BINLOG STATUS","SHOW CHARACTER SET","SHOW CLIENT_STATISTICS","SHOW COLLATION","SHOW COLUMNS","SHOW CONTRIBUTORS","SHOW CREATE DATABASE","SHOW CREATE EVENT","SHOW CREATE FUNCTION","SHOW CREATE PACKAGE","SHOW CREATE PACKAGE BODY","SHOW CREATE PROCEDURE","SHOW CREATE SEQUENCE","SHOW CREATE TABLE","SHOW CREATE TRIGGER","SHOW CREATE USER","SHOW CREATE VIEW","SHOW DATABASES","SHOW ENGINE","SHOW ENGINE INNODB STATUS","SHOW ENGINES","SHOW ERRORS","SHOW EVENTS","SHOW EXPLAIN","SHOW FUNCTION CODE","SHOW FUNCTION STATUS","SHOW GRANTS","SHOW INDEX","SHOW INDEXES","SHOW INDEX_STATISTICS","SHOW KEYS","SHOW LOCALES","SHOW MASTER LOGS","SHOW MASTER STATUS","SHOW OPEN TABLES","SHOW PACKAGE BODY CODE","SHOW PACKAGE BODY STATUS","SHOW PACKAGE STATUS","SHOW PLUGINS","SHOW PLUGINS SONAME","SHOW PRIVILEGES","SHOW PROCEDURE CODE","SHOW PROCEDURE STATUS","SHOW PROCESSLIST","SHOW PROFILE","SHOW PROFILES","SHOW QUERY_RESPONSE_TIME","SHOW RELAYLOG EVENTS","SHOW REPLICA","SHOW REPLICA HOSTS","SHOW REPLICA STATUS","SHOW SCHEMAS","SHOW SLAVE","SHOW SLAVE HOSTS","SHOW SLAVE STATUS","SHOW STATUS","SHOW STORAGE ENGINES","SHOW TABLE STATUS","SHOW TABLES","SHOW TRIGGERS","SHOW USER_STATISTICS","SHOW VARIABLES","SHOW WARNINGS","SHOW WSREP_MEMBERSHIP","SHOW WSREP_STATUS","SHUTDOWN","SIGNAL","START ALL REPLICAS","START ALL SLAVES","START REPLICA","START SLAVE","START TRANSACTION","STOP ALL REPLICAS","STOP ALL SLAVES","STOP REPLICA","STOP SLAVE","UNINSTALL PLUGIN","UNINSTALL SONAME","UNLOCK TABLE","USE","XA BEGIN","XA COMMIT","XA END","XA PREPARE","XA RECOVER","XA ROLLBACK","XA START"]),IDe=Me(["UNION [ALL | DISTINCT]","EXCEPT [ALL | DISTINCT]","INTERSECT [ALL | DISTINCT]","MINUS [ALL | DISTINCT]"]),ODe=Me(["JOIN","{LEFT | RIGHT} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL JOIN","NATURAL {LEFT | RIGHT} [OUTER] JOIN","STRAIGHT_JOIN"]),LDe=Me(["ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]","CHARACTER SET","{ROWS | RANGE} BETWEEN","IDENTIFIED BY"]),MDe={name:"mariadb",tokenizerOptions:{reservedSelect:wDe,reservedClauses:[...CDe,...qG,...uC],reservedSetOperations:IDe,reservedJoins:ODe,reservedPhrases:LDe,supportsXor:!0,reservedKeywords:RDe,reservedDataTypes:NDe,reservedFunctionNames:_De,stringTypes:['""-qq-bs',"''-qq-bs",{quote:"''-raw",prefixes:["B","X"],requirePrefix:!0}],identTypes:["``"],identChars:{first:"$",rest:"$",allowFirstCharNumber:!0},variableTypes:[{regex:"@@?[A-Za-z0-9_.$]+"},{quote:'""-qq-bs',prefixes:["@"],requirePrefix:!0},{quote:"''-qq-bs",prefixes:["@"],requirePrefix:!0},{quote:"``",prefixes:["@"],requirePrefix:!0}],paramTypes:{positional:!0},lineCommentTypes:["--","#"],operators:["%",":=","&","|","^","~","<<",">>","<=>","&&","||","!","*.*"],postProcess:fS},formatOptions:{onelineClauses:[...qG,...uC],tabularOnelineClauses:uC}},DDe=["ACCESSIBLE","ADD","ALL","ALTER","ANALYZE","AND","AS","ASC","ASENSITIVE","BEFORE","BETWEEN","BOTH","BY","CALL","CASCADE","CASE","CHANGE","CHECK","COLLATE","COLUMN","CONDITION","CONSTRAINT","CONTINUE","CONVERT","CREATE","CROSS","CUBE","CUME_DIST","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURSOR","DATABASE","DATABASES","DAY_HOUR","DAY_MICROSECOND","DAY_MINUTE","DAY_SECOND","DECLARE","DEFAULT","DELAYED","DELETE","DENSE_RANK","DESC","DESCRIBE","DETERMINISTIC","DISTINCT","DISTINCTROW","DIV","DROP","DUAL","EACH","ELSE","ELSEIF","EMPTY","ENCLOSED","ESCAPED","EXCEPT","EXISTS","EXIT","EXPLAIN","FALSE","FETCH","FIRST_VALUE","FOR","FORCE","FOREIGN","FROM","FULLTEXT","FUNCTION","GENERATED","GET","GRANT","GROUP","GROUPING","GROUPS","HAVING","HIGH_PRIORITY","HOUR_MICROSECOND","HOUR_MINUTE","HOUR_SECOND","IF","IGNORE","IN","INDEX","INFILE","INNER","INOUT","INSENSITIVE","INSERT","IN","INTERSECT","INTERVAL","INTO","IO_AFTER_GTIDS","IO_BEFORE_GTIDS","IS","ITERATE","JOIN","JSON_TABLE","KEY","KEYS","KILL","LAG","LAST_VALUE","LATERAL","LEAD","LEADING","LEAVE","LEFT","LIKE","LIMIT","LINEAR","LINES","LOAD","LOCALTIME","LOCALTIMESTAMP","LOCK","LONG","LOOP","LOW_PRIORITY","MASTER_BIND","MASTER_SSL_VERIFY_SERVER_CERT","MATCH","MAXVALUE","MINUTE_MICROSECOND","MINUTE_SECOND","MOD","MODIFIES","NATURAL","NOT","NO_WRITE_TO_BINLOG","NTH_VALUE","NTILE","NULL","OF","ON","OPTIMIZE","OPTIMIZER_COSTS","OPTION","OPTIONALLY","OR","ORDER","OUT","OUTER","OUTFILE","OVER","PARTITION","PERCENT_RANK","PRIMARY","PROCEDURE","PURGE","RANGE","RANK","READ","READS","READ_WRITE","RECURSIVE","REFERENCES","REGEXP","RELEASE","RENAME","REPEAT","REPLACE","REQUIRE","RESIGNAL","RESTRICT","RETURN","REVOKE","RIGHT","RLIKE","ROW","ROWS","ROW_NUMBER","SCHEMA","SCHEMAS","SECOND_MICROSECOND","SELECT","SENSITIVE","SEPARATOR","SET","SHOW","SIGNAL","SPATIAL","SPECIFIC","SQL","SQLEXCEPTION","SQLSTATE","SQLWARNING","SQL_BIG_RESULT","SQL_CALC_FOUND_ROWS","SQL_SMALL_RESULT","SSL","STARTING","STORED","STRAIGHT_JOIN","SYSTEM","TABLE","TERMINATED","THEN","TO","TRAILING","TRIGGER","TRUE","UNDO","UNION","UNIQUE","UNLOCK","UNSIGNED","UPDATE","USAGE","USE","USING","UTC_DATE","UTC_TIME","UTC_TIMESTAMP","VALUES","VIRTUAL","WHEN","WHERE","WHILE","WINDOW","WITH","WRITE","XOR","YEAR_MONTH","ZEROFILL"],PDe=["BIGINT","BINARY","BIT","BLOB","BOOL","BOOLEAN","CHAR","CHARACTER","DATE","DATETIME","DEC","DECIMAL","DOUBLE PRECISION","DOUBLE","ENUM","FIXED","FLOAT","FLOAT4","FLOAT8","INT","INT1","INT2","INT3","INT4","INT8","INTEGER","LONGBLOB","LONGTEXT","MEDIUMBLOB","MEDIUMINT","MEDIUMTEXT","MIDDLEINT","NATIONAL CHAR","NATIONAL VARCHAR","NUMERIC","PRECISION","REAL","SMALLINT","TEXT","TIME","TIMESTAMP","TINYBLOB","TINYINT","TINYTEXT","VARBINARY","VARCHAR","VARCHARACTER","VARYING","YEAR"],kDe=["ABS","ACOS","ADDDATE","ADDTIME","AES_DECRYPT","AES_ENCRYPT","ANY_VALUE","ASCII","ASIN","ATAN","ATAN2","AVG","BENCHMARK","BIN","BIN_TO_UUID","BINARY","BIT_AND","BIT_COUNT","BIT_LENGTH","BIT_OR","BIT_XOR","CAN_ACCESS_COLUMN","CAN_ACCESS_DATABASE","CAN_ACCESS_TABLE","CAN_ACCESS_USER","CAN_ACCESS_VIEW","CAST","CEIL","CEILING","CHAR","CHAR_LENGTH","CHARACTER_LENGTH","CHARSET","COALESCE","COERCIBILITY","COLLATION","COMPRESS","CONCAT","CONCAT_WS","CONNECTION_ID","CONV","CONVERT","CONVERT_TZ","COS","COT","COUNT","CRC32","CUME_DIST","CURDATE","CURRENT_DATE","CURRENT_ROLE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURTIME","DATABASE","DATE","DATE_ADD","DATE_FORMAT","DATE_SUB","DATEDIFF","DAY","DAYNAME","DAYOFMONTH","DAYOFWEEK","DAYOFYEAR","DEFAULT","DEGREES","DENSE_RANK","DIV","ELT","EXP","EXPORT_SET","EXTRACT","EXTRACTVALUE","FIELD","FIND_IN_SET","FIRST_VALUE","FLOOR","FORMAT","FORMAT_BYTES","FORMAT_PICO_TIME","FOUND_ROWS","FROM_BASE64","FROM_DAYS","FROM_UNIXTIME","GEOMCOLLECTION","GEOMETRYCOLLECTION","GET_DD_COLUMN_PRIVILEGES","GET_DD_CREATE_OPTIONS","GET_DD_INDEX_SUB_PART_LENGTH","GET_FORMAT","GET_LOCK","GREATEST","GROUP_CONCAT","GROUPING","GTID_SUBSET","GTID_SUBTRACT","HEX","HOUR","ICU_VERSION","IF","IFNULL","INET_ATON","INET_NTOA","INET6_ATON","INET6_NTOA","INSERT","INSTR","INTERNAL_AUTO_INCREMENT","INTERNAL_AVG_ROW_LENGTH","INTERNAL_CHECK_TIME","INTERNAL_CHECKSUM","INTERNAL_DATA_FREE","INTERNAL_DATA_LENGTH","INTERNAL_DD_CHAR_LENGTH","INTERNAL_GET_COMMENT_OR_ERROR","INTERNAL_GET_ENABLED_ROLE_JSON","INTERNAL_GET_HOSTNAME","INTERNAL_GET_USERNAME","INTERNAL_GET_VIEW_WARNING_OR_ERROR","INTERNAL_INDEX_COLUMN_CARDINALITY","INTERNAL_INDEX_LENGTH","INTERNAL_IS_ENABLED_ROLE","INTERNAL_IS_MANDATORY_ROLE","INTERNAL_KEYS_DISABLED","INTERNAL_MAX_DATA_LENGTH","INTERNAL_TABLE_ROWS","INTERNAL_UPDATE_TIME","INTERVAL","IS","IS_FREE_LOCK","IS_IPV4","IS_IPV4_COMPAT","IS_IPV4_MAPPED","IS_IPV6","IS NOT","IS NOT NULL","IS NULL","IS_USED_LOCK","IS_UUID","ISNULL","JSON_ARRAY","JSON_ARRAY_APPEND","JSON_ARRAY_INSERT","JSON_ARRAYAGG","JSON_CONTAINS","JSON_CONTAINS_PATH","JSON_DEPTH","JSON_EXTRACT","JSON_INSERT","JSON_KEYS","JSON_LENGTH","JSON_MERGE","JSON_MERGE_PATCH","JSON_MERGE_PRESERVE","JSON_OBJECT","JSON_OBJECTAGG","JSON_OVERLAPS","JSON_PRETTY","JSON_QUOTE","JSON_REMOVE","JSON_REPLACE","JSON_SCHEMA_VALID","JSON_SCHEMA_VALIDATION_REPORT","JSON_SEARCH","JSON_SET","JSON_STORAGE_FREE","JSON_STORAGE_SIZE","JSON_TABLE","JSON_TYPE","JSON_UNQUOTE","JSON_VALID","JSON_VALUE","LAG","LAST_DAY","LAST_INSERT_ID","LAST_VALUE","LCASE","LEAD","LEAST","LEFT","LENGTH","LIKE","LINESTRING","LN","LOAD_FILE","LOCALTIME","LOCALTIMESTAMP","LOCATE","LOG","LOG10","LOG2","LOWER","LPAD","LTRIM","MAKE_SET","MAKEDATE","MAKETIME","MASTER_POS_WAIT","MATCH","MAX","MBRCONTAINS","MBRCOVEREDBY","MBRCOVERS","MBRDISJOINT","MBREQUALS","MBRINTERSECTS","MBROVERLAPS","MBRTOUCHES","MBRWITHIN","MD5","MEMBER OF","MICROSECOND","MID","MIN","MINUTE","MOD","MONTH","MONTHNAME","MULTILINESTRING","MULTIPOINT","MULTIPOLYGON","NAME_CONST","NOT","NOT IN","NOT LIKE","NOT REGEXP","NOW","NTH_VALUE","NTILE","NULLIF","OCT","OCTET_LENGTH","ORD","PERCENT_RANK","PERIOD_ADD","PERIOD_DIFF","PI","POINT","POLYGON","POSITION","POW","POWER","PS_CURRENT_THREAD_ID","PS_THREAD_ID","QUARTER","QUOTE","RADIANS","RAND","RANDOM_BYTES","RANK","REGEXP","REGEXP_INSTR","REGEXP_LIKE","REGEXP_REPLACE","REGEXP_SUBSTR","RELEASE_ALL_LOCKS","RELEASE_LOCK","REPEAT","REPLACE","REVERSE","RIGHT","RLIKE","ROLES_GRAPHML","ROUND","ROW_COUNT","ROW_NUMBER","RPAD","RTRIM","SCHEMA","SEC_TO_TIME","SECOND","SESSION_USER","SHA1","SHA2","SIGN","SIN","SLEEP","SOUNDEX","SOUNDS LIKE","SOURCE_POS_WAIT","SPACE","SQRT","ST_AREA","ST_ASBINARY","ST_ASGEOJSON","ST_ASTEXT","ST_BUFFER","ST_BUFFER_STRATEGY","ST_CENTROID","ST_COLLECT","ST_CONTAINS","ST_CONVEXHULL","ST_CROSSES","ST_DIFFERENCE","ST_DIMENSION","ST_DISJOINT","ST_DISTANCE","ST_DISTANCE_SPHERE","ST_ENDPOINT","ST_ENVELOPE","ST_EQUALS","ST_EXTERIORRING","ST_FRECHETDISTANCE","ST_GEOHASH","ST_GEOMCOLLFROMTEXT","ST_GEOMCOLLFROMWKB","ST_GEOMETRYN","ST_GEOMETRYTYPE","ST_GEOMFROMGEOJSON","ST_GEOMFROMTEXT","ST_GEOMFROMWKB","ST_HAUSDORFFDISTANCE","ST_INTERIORRINGN","ST_INTERSECTION","ST_INTERSECTS","ST_ISCLOSED","ST_ISEMPTY","ST_ISSIMPLE","ST_ISVALID","ST_LATFROMGEOHASH","ST_LATITUDE","ST_LENGTH","ST_LINEFROMTEXT","ST_LINEFROMWKB","ST_LINEINTERPOLATEPOINT","ST_LINEINTERPOLATEPOINTS","ST_LONGFROMGEOHASH","ST_LONGITUDE","ST_MAKEENVELOPE","ST_MLINEFROMTEXT","ST_MLINEFROMWKB","ST_MPOINTFROMTEXT","ST_MPOINTFROMWKB","ST_MPOLYFROMTEXT","ST_MPOLYFROMWKB","ST_NUMGEOMETRIES","ST_NUMINTERIORRING","ST_NUMPOINTS","ST_OVERLAPS","ST_POINTATDISTANCE","ST_POINTFROMGEOHASH","ST_POINTFROMTEXT","ST_POINTFROMWKB","ST_POINTN","ST_POLYFROMTEXT","ST_POLYFROMWKB","ST_SIMPLIFY","ST_SRID","ST_STARTPOINT","ST_SWAPXY","ST_SYMDIFFERENCE","ST_TOUCHES","ST_TRANSFORM","ST_UNION","ST_VALIDATE","ST_WITHIN","ST_X","ST_Y","STATEMENT_DIGEST","STATEMENT_DIGEST_TEXT","STD","STDDEV","STDDEV_POP","STDDEV_SAMP","STR_TO_DATE","STRCMP","SUBDATE","SUBSTR","SUBSTRING","SUBSTRING_INDEX","SUBTIME","SUM","SYSDATE","SYSTEM_USER","TAN","TIME","TIME_FORMAT","TIME_TO_SEC","TIMEDIFF","TIMESTAMP","TIMESTAMPADD","TIMESTAMPDIFF","TO_BASE64","TO_DAYS","TO_SECONDS","TRIM","TRUNCATE","UCASE","UNCOMPRESS","UNCOMPRESSED_LENGTH","UNHEX","UNIX_TIMESTAMP","UPDATEXML","UPPER","UTC_DATE","UTC_TIME","UTC_TIMESTAMP","UUID","UUID_SHORT","UUID_TO_BIN","VALIDATE_PASSWORD_STRENGTH","VALUES","VAR_POP","VAR_SAMP","VARIANCE","VERSION","WAIT_FOR_EXECUTED_GTID_SET","WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS","WEEK","WEEKDAY","WEEKOFYEAR","WEIGHT_STRING","YEAR","YEARWEEK"],jDe=Me(["SELECT [ALL | DISTINCT | DISTINCTROW]"]),UDe=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY","HAVING","WINDOW","PARTITION BY","ORDER BY","LIMIT","OFFSET","INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO]","REPLACE [LOW_PRIORITY | DELAYED] [INTO]","VALUES","ON DUPLICATE KEY UPDATE","SET"]),YG=Me(["CREATE [TEMPORARY] TABLE [IF NOT EXISTS]"]),dC=Me(["CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]","UPDATE [LOW_PRIORITY] [IGNORE]","DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM","DROP [TEMPORARY] TABLE [IF EXISTS]","ALTER TABLE","ADD [COLUMN]","{CHANGE | MODIFY} [COLUMN]","DROP [COLUMN]","RENAME [TO | AS]","RENAME COLUMN","ALTER [COLUMN]","{SET | DROP} DEFAULT","TRUNCATE [TABLE]","ALTER DATABASE","ALTER EVENT","ALTER FUNCTION","ALTER INSTANCE","ALTER LOGFILE GROUP","ALTER PROCEDURE","ALTER RESOURCE GROUP","ALTER SERVER","ALTER TABLESPACE","ALTER USER","ALTER VIEW","ANALYZE TABLE","BINLOG","CACHE INDEX","CALL","CHANGE MASTER TO","CHANGE REPLICATION FILTER","CHANGE REPLICATION SOURCE TO","CHECK TABLE","CHECKSUM TABLE","CLONE","COMMIT","CREATE DATABASE","CREATE EVENT","CREATE FUNCTION","CREATE FUNCTION","CREATE INDEX","CREATE LOGFILE GROUP","CREATE PROCEDURE","CREATE RESOURCE GROUP","CREATE ROLE","CREATE SERVER","CREATE SPATIAL REFERENCE SYSTEM","CREATE TABLESPACE","CREATE TRIGGER","CREATE USER","DEALLOCATE PREPARE","DESCRIBE","DROP DATABASE","DROP EVENT","DROP FUNCTION","DROP FUNCTION","DROP INDEX","DROP LOGFILE GROUP","DROP PROCEDURE","DROP RESOURCE GROUP","DROP ROLE","DROP SERVER","DROP SPATIAL REFERENCE SYSTEM","DROP TABLESPACE","DROP TRIGGER","DROP USER","DROP VIEW","EXECUTE","EXPLAIN","FLUSH","GRANT","HANDLER","HELP","IMPORT TABLE","INSTALL COMPONENT","INSTALL PLUGIN","KILL","LOAD DATA","LOAD INDEX INTO CACHE","LOAD XML","LOCK INSTANCE FOR BACKUP","LOCK TABLES","MASTER_POS_WAIT","OPTIMIZE TABLE","PREPARE","PURGE BINARY LOGS","RELEASE SAVEPOINT","RENAME TABLE","RENAME USER","REPAIR TABLE","RESET","RESET MASTER","RESET PERSIST","RESET REPLICA","RESET SLAVE","RESTART","REVOKE","ROLLBACK","ROLLBACK TO SAVEPOINT","SAVEPOINT","SET CHARACTER SET","SET DEFAULT ROLE","SET NAMES","SET PASSWORD","SET RESOURCE GROUP","SET ROLE","SET TRANSACTION","SHOW","SHOW BINARY LOGS","SHOW BINLOG EVENTS","SHOW CHARACTER SET","SHOW COLLATION","SHOW COLUMNS","SHOW CREATE DATABASE","SHOW CREATE EVENT","SHOW CREATE FUNCTION","SHOW CREATE PROCEDURE","SHOW CREATE TABLE","SHOW CREATE TRIGGER","SHOW CREATE USER","SHOW CREATE VIEW","SHOW DATABASES","SHOW ENGINE","SHOW ENGINES","SHOW ERRORS","SHOW EVENTS","SHOW FUNCTION CODE","SHOW FUNCTION STATUS","SHOW GRANTS","SHOW INDEX","SHOW MASTER STATUS","SHOW OPEN TABLES","SHOW PLUGINS","SHOW PRIVILEGES","SHOW PROCEDURE CODE","SHOW PROCEDURE STATUS","SHOW PROCESSLIST","SHOW PROFILE","SHOW PROFILES","SHOW RELAYLOG EVENTS","SHOW REPLICA STATUS","SHOW REPLICAS","SHOW SLAVE","SHOW SLAVE HOSTS","SHOW STATUS","SHOW TABLE STATUS","SHOW TABLES","SHOW TRIGGERS","SHOW VARIABLES","SHOW WARNINGS","SHUTDOWN","SOURCE_POS_WAIT","START GROUP_REPLICATION","START REPLICA","START SLAVE","START TRANSACTION","STOP GROUP_REPLICATION","STOP REPLICA","STOP SLAVE","TABLE","UNINSTALL COMPONENT","UNINSTALL PLUGIN","UNLOCK INSTANCE","UNLOCK TABLES","USE","XA","ITERATE","LEAVE","LOOP","REPEAT","RETURN","WHILE"]),FDe=Me(["UNION [ALL | DISTINCT]"]),$De=Me(["JOIN","{LEFT | RIGHT} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT} [OUTER] JOIN","STRAIGHT_JOIN"]),BDe=Me(["ON {UPDATE | DELETE} [SET NULL]","CHARACTER SET","{ROWS | RANGE} BETWEEN","IDENTIFIED BY"]),HDe={name:"mysql",tokenizerOptions:{reservedSelect:jDe,reservedClauses:[...UDe,...YG,...dC],reservedSetOperations:FDe,reservedJoins:$De,reservedPhrases:BDe,supportsXor:!0,reservedKeywords:DDe,reservedDataTypes:PDe,reservedFunctionNames:kDe,stringTypes:['""-qq-bs',{quote:"''-qq-bs",prefixes:["N"]},{quote:"''-raw",prefixes:["B","X"],requirePrefix:!0}],identTypes:["``"],identChars:{first:"$",rest:"$",allowFirstCharNumber:!0},variableTypes:[{regex:"@@?[A-Za-z0-9_.$]+"},{quote:'""-qq-bs',prefixes:["@"],requirePrefix:!0},{quote:"''-qq-bs",prefixes:["@"],requirePrefix:!0},{quote:"``",prefixes:["@"],requirePrefix:!0}],paramTypes:{positional:!0},lineCommentTypes:["--","#"],operators:["%",":=","&","|","^","~","<<",">>","<=>","->","->>","&&","||","!","*.*"],postProcess:fS},formatOptions:{onelineClauses:[...YG,...dC],tabularOnelineClauses:dC}},VDe=["ADD","ALL","ALTER","ANALYZE","AND","ARRAY","AS","ASC","BETWEEN","BOTH","BY","CALL","CASCADE","CASE","CHANGE","CHECK","COLLATE","COLUMN","CONSTRAINT","CONTINUE","CONVERT","CREATE","CROSS","CURRENT_DATE","CURRENT_ROLE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURSOR","DATABASE","DATABASES","DAY_HOUR","DAY_MICROSECOND","DAY_MINUTE","DAY_SECOND","DEFAULT","DELAYED","DELETE","DESC","DESCRIBE","DISTINCT","DISTINCTROW","DIV","DOUBLE","DROP","DUAL","ELSE","ELSEIF","ENCLOSED","ESCAPED","EXCEPT","EXISTS","EXIT","EXPLAIN","FALSE","FETCH","FOR","FORCE","FOREIGN","FROM","FULLTEXT","GENERATED","GRANT","GROUP","GROUPS","HAVING","HIGH_PRIORITY","HOUR_MICROSECOND","HOUR_MINUTE","HOUR_SECOND","IF","IGNORE","ILIKE","IN","INDEX","INFILE","INNER","INOUT","INSERT","INTERSECT","INTERVAL","INTO","IS","ITERATE","JOIN","KEY","KEYS","KILL","LEADING","LEAVE","LEFT","LIKE","LIMIT","LINEAR","LINES","LOAD","LOCALTIME","LOCALTIMESTAMP","LOCK","LONG","LOW_PRIORITY","MATCH","MAXVALUE","MINUTE_MICROSECOND","MINUTE_SECOND","MOD","NATURAL","NOT","NO_WRITE_TO_BINLOG","NULL","OF","ON","OPTIMIZE","OPTION","OPTIONALLY","OR","ORDER","OUT","OUTER","OUTFILE","OVER","PARTITION","PRIMARY","PROCEDURE","RANGE","READ","RECURSIVE","REFERENCES","REGEXP","RELEASE","RENAME","REPEAT","REPLACE","REQUIRE","RESTRICT","REVOKE","RIGHT","RLIKE","ROW","ROWS","SECOND_MICROSECOND","SELECT","SET","SHOW","SPATIAL","SQL","SQLEXCEPTION","SQLSTATE","SQLWARNING","SQL_BIG_RESULT","SQL_CALC_FOUND_ROWS","SQL_SMALL_RESULT","SSL","STARTING","STATS_EXTENDED","STORED","STRAIGHT_JOIN","TABLE","TABLESAMPLE","TERMINATED","THEN","TO","TRAILING","TRIGGER","TRUE","TiDB_CURRENT_TSO","UNION","UNIQUE","UNLOCK","UNSIGNED","UNTIL","UPDATE","USAGE","USE","USING","UTC_DATE","UTC_TIME","UTC_TIMESTAMP","VALUES","VIRTUAL","WHEN","WHERE","WHILE","WINDOW","WITH","WRITE","XOR","YEAR_MONTH","ZEROFILL"],GDe=["BIGINT","BINARY","BIT","BLOB","BOOL","BOOLEAN","CHAR","CHARACTER","DATE","DATETIME","DEC","DECIMAL","DOUBLE PRECISION","DOUBLE","ENUM","FIXED","INT","INT1","INT2","INT3","INT4","INT8","INTEGER","LONGBLOB","LONGTEXT","MEDIUMBLOB","MEDIUMINT","MIDDLEINT","NATIONAL CHAR","NATIONAL VARCHAR","NUMERIC","PRECISION","SMALLINT","TEXT","TIME","TIMESTAMP","TINYBLOB","TINYINT","TINYTEXT","VARBINARY","VARCHAR","VARCHARACTER","VARYING","YEAR"],zDe=["ABS","ACOS","ADDDATE","ADDTIME","AES_DECRYPT","AES_ENCRYPT","ANY_VALUE","ASCII","ASIN","ATAN","ATAN2","AVG","BENCHMARK","BIN","BIN_TO_UUID","BIT_AND","BIT_COUNT","BIT_LENGTH","BIT_OR","BIT_XOR","BITAND","BITNEG","BITOR","BITXOR","CASE","CAST","CEIL","CEILING","CHAR_FUNC","CHAR_LENGTH","CHARACTER_LENGTH","CHARSET","COALESCE","COERCIBILITY","COLLATION","COMPRESS","CONCAT","CONCAT_WS","CONNECTION_ID","CONV","CONVERT","CONVERT_TZ","COS","COT","COUNT","CRC32","CUME_DIST","CURDATE","CURRENT_DATE","CURRENT_RESOURCE_GROUP","CURRENT_ROLE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURTIME","DATABASE","DATE","DATE_ADD","DATE_FORMAT","DATE_SUB","DATEDIFF","DAY","DAYNAME","DAYOFMONTH","DAYOFWEEK","DAYOFYEAR","DECODE","DEFAULT_FUNC","DEGREES","DENSE_RANK","DES_DECRYPT","DES_ENCRYPT","DIV","ELT","ENCODE","ENCRYPT","EQ","EXP","EXPORT_SET","EXTRACT","FIELD","FIND_IN_SET","FIRST_VALUE","FLOOR","FORMAT","FORMAT_BYTES","FORMAT_NANO_TIME","FOUND_ROWS","FROM_BASE64","FROM_DAYS","FROM_UNIXTIME","GE","GET_FORMAT","GET_LOCK","GETPARAM","GREATEST","GROUP_CONCAT","GROUPING","GT","HEX","HOUR","IF","IFNULL","ILIKE","INET6_ATON","INET6_NTOA","INET_ATON","INET_NTOA","INSERT_FUNC","INSTR","INTDIV","INTERVAL","IS_FREE_LOCK","IS_IPV4","IS_IPV4_COMPAT","IS_IPV4_MAPPED","IS_IPV6","IS_USED_LOCK","IS_UUID","ISFALSE","ISNULL","ISTRUE","JSON_ARRAY","JSON_ARRAYAGG","JSON_ARRAY_APPEND","JSON_ARRAY_INSERT","JSON_CONTAINS","JSON_CONTAINS_PATH","JSON_DEPTH","JSON_EXTRACT","JSON_INSERT","JSON_KEYS","JSON_LENGTH","JSON_MEMBEROF","JSON_MERGE","JSON_MERGE_PATCH","JSON_MERGE_PRESERVE","JSON_OBJECT","JSON_OBJECTAGG","JSON_OVERLAPS","JSON_PRETTY","JSON_QUOTE","JSON_REMOVE","JSON_REPLACE","JSON_SEARCH","JSON_SET","JSON_STORAGE_FREE","JSON_STORAGE_SIZE","JSON_TYPE","JSON_UNQUOTE","JSON_VALID","LAG","LAST_DAY","LAST_INSERT_ID","LAST_VALUE","LASTVAL","LCASE","LE","LEAD","LEAST","LEFT","LEFTSHIFT","LENGTH","LIKE","LN","LOAD_FILE","LOCALTIME","LOCALTIMESTAMP","LOCATE","LOG","LOG10","LOG2","LOWER","LPAD","LT","LTRIM","MAKE_SET","MAKEDATE","MAKETIME","MASTER_POS_WAIT","MAX","MD5","MICROSECOND","MID","MIN","MINUS","MINUTE","MOD","MONTH","MONTHNAME","MUL","NAME_CONST","NE","NEXTVAL","NOT","NOW","NTH_VALUE","NTILE","NULLEQ","OCT","OCTET_LENGTH","OLD_PASSWORD","ORD","PASSWORD_FUNC","PERCENT_RANK","PERIOD_ADD","PERIOD_DIFF","PI","PLUS","POSITION","POW","POWER","QUARTER","QUOTE","RADIANS","RAND","RANDOM_BYTES","RANK","REGEXP","REGEXP_INSTR","REGEXP_LIKE","REGEXP_REPLACE","REGEXP_SUBSTR","RELEASE_ALL_LOCKS","RELEASE_LOCK","REPEAT","REPLACE","REVERSE","RIGHT","RIGHTSHIFT","ROUND","ROW_COUNT","ROW_NUMBER","RPAD","RTRIM","SCHEMA","SEC_TO_TIME","SECOND","SESSION_USER","SETVAL","SETVAR","SHA","SHA1","SHA2","SIGN","SIN","SLEEP","SM3","SPACE","SQRT","STD","STDDEV","STDDEV_POP","STDDEV_SAMP","STR_TO_DATE","STRCMP","SUBDATE","SUBSTR","SUBSTRING","SUBSTRING_INDEX","SUBTIME","SUM","SYSDATE","SYSTEM_USER","TAN","TIDB_BOUNDED_STALENESS","TIDB_CURRENT_TSO","TIDB_DECODE_BINARY_PLAN","TIDB_DECODE_KEY","TIDB_DECODE_PLAN","TIDB_DECODE_SQL_DIGESTS","TIDB_ENCODE_SQL_DIGEST","TIDB_IS_DDL_OWNER","TIDB_PARSE_TSO","TIDB_PARSE_TSO_LOGICAL","TIDB_ROW_CHECKSUM","TIDB_SHARD","TIDB_VERSION","TIME","TIME_FORMAT","TIME_TO_SEC","TIMEDIFF","TIMESTAMP","TIMESTAMPADD","TIMESTAMPDIFF","TO_BASE64","TO_DAYS","TO_SECONDS","TRANSLATE","TRIM","TRUNCATE","UCASE","UNARYMINUS","UNCOMPRESS","UNCOMPRESSED_LENGTH","UNHEX","UNIX_TIMESTAMP","UPPER","UTC_DATE","UTC_TIME","UTC_TIMESTAMP","UUID","UUID_SHORT","UUID_TO_BIN","VALIDATE_PASSWORD_STRENGTH","VAR_POP","VAR_SAMP","VARIANCE","VERSION","VITESS_HASH","WEEK","WEEKDAY","WEEKOFYEAR","WEIGHT_STRING","YEAR","YEARWEEK"],qDe=Me(["SELECT [ALL | DISTINCT | DISTINCTROW]"]),YDe=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY","HAVING","WINDOW","PARTITION BY","ORDER BY","LIMIT","OFFSET","INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO]","REPLACE [LOW_PRIORITY | DELAYED] [INTO]","VALUES","ON DUPLICATE KEY UPDATE","SET"]),WG=Me(["CREATE [TEMPORARY] TABLE [IF NOT EXISTS]"]),hC=Me(["CREATE [OR REPLACE] [SQL SECURITY DEFINER | SQL SECURITY INVOKER] VIEW [IF NOT EXISTS]","UPDATE [LOW_PRIORITY] [IGNORE]","DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM","DROP [TEMPORARY] TABLE [IF EXISTS]","ALTER TABLE","ADD [COLUMN]","{CHANGE | MODIFY} [COLUMN]","DROP [COLUMN]","RENAME [TO | AS]","RENAME COLUMN","ALTER [COLUMN]","{SET | DROP} DEFAULT","TRUNCATE [TABLE]","ALTER DATABASE","ALTER INSTANCE","ALTER RESOURCE GROUP","ALTER SEQUENCE","ALTER USER","ALTER VIEW","ANALYZE TABLE","CHECK TABLE","CHECKSUM TABLE","COMMIT","CREATE DATABASE","CREATE INDEX","CREATE RESOURCE GROUP","CREATE ROLE","CREATE SEQUENCE","CREATE USER","DEALLOCATE PREPARE","DESCRIBE","DROP DATABASE","DROP INDEX","DROP RESOURCE GROUP","DROP ROLE","DROP TABLESPACE","DROP USER","DROP VIEW","EXPLAIN","FLUSH","GRANT","IMPORT TABLE","INSTALL COMPONENT","INSTALL PLUGIN","KILL","LOAD DATA","LOCK INSTANCE FOR BACKUP","LOCK TABLES","OPTIMIZE TABLE","PREPARE","RELEASE SAVEPOINT","RENAME TABLE","RENAME USER","REPAIR TABLE","RESET","REVOKE","ROLLBACK","ROLLBACK TO SAVEPOINT","SAVEPOINT","SET CHARACTER SET","SET DEFAULT ROLE","SET NAMES","SET PASSWORD","SET RESOURCE GROUP","SET ROLE","SET TRANSACTION","SHOW","SHOW BINARY LOGS","SHOW BINLOG EVENTS","SHOW CHARACTER SET","SHOW COLLATION","SHOW COLUMNS","SHOW CREATE DATABASE","SHOW CREATE TABLE","SHOW CREATE USER","SHOW CREATE VIEW","SHOW DATABASES","SHOW ENGINE","SHOW ENGINES","SHOW ERRORS","SHOW EVENTS","SHOW GRANTS","SHOW INDEX","SHOW MASTER STATUS","SHOW OPEN TABLES","SHOW PLUGINS","SHOW PRIVILEGES","SHOW PROCESSLIST","SHOW PROFILE","SHOW PROFILES","SHOW STATUS","SHOW TABLE STATUS","SHOW TABLES","SHOW TRIGGERS","SHOW VARIABLES","SHOW WARNINGS","TABLE","UNINSTALL COMPONENT","UNINSTALL PLUGIN","UNLOCK INSTANCE","UNLOCK TABLES","USE"]),WDe=Me(["UNION [ALL | DISTINCT]"]),XDe=Me(["JOIN","{LEFT | RIGHT} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT} [OUTER] JOIN","STRAIGHT_JOIN"]),KDe=Me(["ON {UPDATE | DELETE} [SET NULL]","CHARACTER SET","{ROWS | RANGE} BETWEEN","IDENTIFIED BY"]),QDe={name:"tidb",tokenizerOptions:{reservedSelect:qDe,reservedClauses:[...YDe,...WG,...hC],reservedSetOperations:WDe,reservedJoins:XDe,reservedPhrases:KDe,supportsXor:!0,reservedKeywords:VDe,reservedDataTypes:GDe,reservedFunctionNames:zDe,stringTypes:['""-qq-bs',{quote:"''-qq-bs",prefixes:["N"]},{quote:"''-raw",prefixes:["B","X"],requirePrefix:!0}],identTypes:["``"],identChars:{first:"$",rest:"$",allowFirstCharNumber:!0},variableTypes:[{regex:"@@?[A-Za-z0-9_.$]+"},{quote:'""-qq-bs',prefixes:["@"],requirePrefix:!0},{quote:"''-qq-bs",prefixes:["@"],requirePrefix:!0},{quote:"``",prefixes:["@"],requirePrefix:!0}],paramTypes:{positional:!0},lineCommentTypes:["--","#"],operators:["%",":=","&","|","^","~","<<",">>","<=>","->","->>","&&","||","!","*.*"],postProcess:fS},formatOptions:{onelineClauses:[...WG,...hC],tabularOnelineClauses:hC}},JDe=["ABORT","ABS","ACOS","ADVISOR","ARRAY_AGG","ARRAY_AGG","ARRAY_APPEND","ARRAY_AVG","ARRAY_BINARY_SEARCH","ARRAY_CONCAT","ARRAY_CONTAINS","ARRAY_COUNT","ARRAY_DISTINCT","ARRAY_EXCEPT","ARRAY_FLATTEN","ARRAY_IFNULL","ARRAY_INSERT","ARRAY_INTERSECT","ARRAY_LENGTH","ARRAY_MAX","ARRAY_MIN","ARRAY_MOVE","ARRAY_POSITION","ARRAY_PREPEND","ARRAY_PUT","ARRAY_RANGE","ARRAY_REMOVE","ARRAY_REPEAT","ARRAY_REPLACE","ARRAY_REVERSE","ARRAY_SORT","ARRAY_STAR","ARRAY_SUM","ARRAY_SYMDIFF","ARRAY_SYMDIFF1","ARRAY_SYMDIFFN","ARRAY_UNION","ASIN","ATAN","ATAN2","AVG","BASE64","BASE64_DECODE","BASE64_ENCODE","BITAND ","BITCLEAR ","BITNOT ","BITOR ","BITSET ","BITSHIFT ","BITTEST ","BITXOR ","CEIL","CLOCK_LOCAL","CLOCK_MILLIS","CLOCK_STR","CLOCK_TZ","CLOCK_UTC","COALESCE","CONCAT","CONCAT2","CONTAINS","CONTAINS_TOKEN","CONTAINS_TOKEN_LIKE","CONTAINS_TOKEN_REGEXP","COS","COUNT","COUNT","COUNTN","CUME_DIST","CURL","DATE_ADD_MILLIS","DATE_ADD_STR","DATE_DIFF_MILLIS","DATE_DIFF_STR","DATE_FORMAT_STR","DATE_PART_MILLIS","DATE_PART_STR","DATE_RANGE_MILLIS","DATE_RANGE_STR","DATE_TRUNC_MILLIS","DATE_TRUNC_STR","DECODE","DECODE_JSON","DEGREES","DENSE_RANK","DURATION_TO_STR","ENCODED_SIZE","ENCODE_JSON","EXP","FIRST_VALUE","FLOOR","GREATEST","HAS_TOKEN","IFINF","IFMISSING","IFMISSINGORNULL","IFNAN","IFNANORINF","IFNULL","INITCAP","ISARRAY","ISATOM","ISBITSET","ISBOOLEAN","ISNUMBER","ISOBJECT","ISSTRING","LAG","LAST_VALUE","LEAD","LEAST","LENGTH","LN","LOG","LOWER","LTRIM","MAX","MEAN","MEDIAN","META","MILLIS","MILLIS_TO_LOCAL","MILLIS_TO_STR","MILLIS_TO_TZ","MILLIS_TO_UTC","MILLIS_TO_ZONE_NAME","MIN","MISSINGIF","NANIF","NEGINFIF","NOW_LOCAL","NOW_MILLIS","NOW_STR","NOW_TZ","NOW_UTC","NTH_VALUE","NTILE","NULLIF","NVL","NVL2","OBJECT_ADD","OBJECT_CONCAT","OBJECT_INNER_PAIRS","OBJECT_INNER_VALUES","OBJECT_LENGTH","OBJECT_NAMES","OBJECT_PAIRS","OBJECT_PUT","OBJECT_REMOVE","OBJECT_RENAME","OBJECT_REPLACE","OBJECT_UNWRAP","OBJECT_VALUES","PAIRS","PERCENT_RANK","PI","POLY_LENGTH","POSINFIF","POSITION","POWER","RADIANS","RANDOM","RANK","RATIO_TO_REPORT","REGEXP_CONTAINS","REGEXP_LIKE","REGEXP_MATCHES","REGEXP_POSITION","REGEXP_REPLACE","REGEXP_SPLIT","REGEX_CONTAINS","REGEX_LIKE","REGEX_MATCHES","REGEX_POSITION","REGEX_REPLACE","REGEX_SPLIT","REPEAT","REPLACE","REVERSE","ROUND","ROW_NUMBER","RTRIM","SEARCH","SEARCH_META","SEARCH_SCORE","SIGN","SIN","SPLIT","SQRT","STDDEV","STDDEV_POP","STDDEV_SAMP","STR_TO_DURATION","STR_TO_MILLIS","STR_TO_TZ","STR_TO_UTC","STR_TO_ZONE_NAME","SUBSTR","SUFFIXES","SUM","TAN","TITLE","TOARRAY","TOATOM","TOBOOLEAN","TOKENS","TOKENS","TONUMBER","TOOBJECT","TOSTRING","TRIM","TRUNC","UPPER","UUID","VARIANCE","VARIANCE_POP","VARIANCE_SAMP","VAR_POP","VAR_SAMP","WEEKDAY_MILLIS","WEEKDAY_STR","CAST"],ZDe=["ADVISE","ALL","ALTER","ANALYZE","AND","ANY","ARRAY","AS","ASC","AT","BEGIN","BETWEEN","BINARY","BOOLEAN","BREAK","BUCKET","BUILD","BY","CALL","CASE","CAST","CLUSTER","COLLATE","COLLECTION","COMMIT","COMMITTED","CONNECT","CONTINUE","CORRELATED","COVER","CREATE","CURRENT","DATABASE","DATASET","DATASTORE","DECLARE","DECREMENT","DELETE","DERIVED","DESC","DESCRIBE","DISTINCT","DO","DROP","EACH","ELEMENT","ELSE","END","EVERY","EXCEPT","EXCLUDE","EXECUTE","EXISTS","EXPLAIN","FALSE","FETCH","FILTER","FIRST","FLATTEN","FLUSH","FOLLOWING","FOR","FORCE","FROM","FTS","FUNCTION","GOLANG","GRANT","GROUP","GROUPS","GSI","HASH","HAVING","IF","IGNORE","ILIKE","IN","INCLUDE","INCREMENT","INDEX","INFER","INLINE","INNER","INSERT","INTERSECT","INTO","IS","ISOLATION","JAVASCRIPT","JOIN","KEY","KEYS","KEYSPACE","KNOWN","LANGUAGE","LAST","LEFT","LET","LETTING","LEVEL","LIKE","LIMIT","LSM","MAP","MAPPING","MATCHED","MATERIALIZED","MERGE","MINUS","MISSING","NAMESPACE","NEST","NL","NO","NOT","NTH_VALUE","NULL","NULLS","NUMBER","OBJECT","OFFSET","ON","OPTION","OPTIONS","OR","ORDER","OTHERS","OUTER","OVER","PARSE","PARTITION","PASSWORD","PATH","POOL","PRECEDING","PREPARE","PRIMARY","PRIVATE","PRIVILEGE","PROBE","PROCEDURE","PUBLIC","RANGE","RAW","REALM","REDUCE","RENAME","RESPECT","RETURN","RETURNING","REVOKE","RIGHT","ROLE","ROLLBACK","ROW","ROWS","SATISFIES","SAVEPOINT","SCHEMA","SCOPE","SELECT","SELF","SEMI","SET","SHOW","SOME","START","STATISTICS","STRING","SYSTEM","THEN","TIES","TO","TRAN","TRANSACTION","TRIGGER","TRUE","TRUNCATE","UNBOUNDED","UNDER","UNION","UNIQUE","UNKNOWN","UNNEST","UNSET","UPDATE","UPSERT","USE","USER","USING","VALIDATE","VALUE","VALUED","VALUES","VIA","VIEW","WHEN","WHERE","WHILE","WINDOW","WITH","WITHIN","WORK","XOR"],ePe=[],tPe=Me(["SELECT [ALL | DISTINCT]"]),nPe=Me(["WITH","FROM","WHERE","GROUP BY","HAVING","WINDOW","PARTITION BY","ORDER BY","LIMIT","OFFSET","INSERT INTO","VALUES","SET","MERGE INTO","WHEN [NOT] MATCHED THEN","UPDATE SET","INSERT","NEST","UNNEST","RETURNING"]),XG=Me(["UPDATE","DELETE FROM","SET SCHEMA","ADVISE","ALTER INDEX","BEGIN TRANSACTION","BUILD INDEX","COMMIT TRANSACTION","CREATE COLLECTION","CREATE FUNCTION","CREATE INDEX","CREATE PRIMARY INDEX","CREATE SCOPE","DROP COLLECTION","DROP FUNCTION","DROP INDEX","DROP PRIMARY INDEX","DROP SCOPE","EXECUTE","EXECUTE FUNCTION","EXPLAIN","GRANT","INFER","PREPARE","REVOKE","ROLLBACK TRANSACTION","SAVEPOINT","SET TRANSACTION","UPDATE STATISTICS","UPSERT","LET","SET CURRENT SCHEMA","SHOW","USE [PRIMARY] KEYS"]),rPe=Me(["UNION [ALL]","EXCEPT [ALL]","INTERSECT [ALL]"]),aPe=Me(["JOIN","{LEFT | RIGHT} [OUTER] JOIN","INNER JOIN"]),sPe=Me(["{ROWS | RANGE | GROUPS} BETWEEN"]),iPe={name:"n1ql",tokenizerOptions:{reservedSelect:tPe,reservedClauses:[...nPe,...XG],reservedSetOperations:rPe,reservedJoins:aPe,reservedPhrases:sPe,supportsXor:!0,reservedKeywords:ZDe,reservedDataTypes:ePe,reservedFunctionNames:JDe,stringTypes:['""-bs',"''-bs"],identTypes:["``"],extraParens:["[]","{}"],paramTypes:{positional:!0,numbered:["$"],named:["$"]},lineCommentTypes:["#","--"],operators:["%","==",":","||"]},formatOptions:{onelineClauses:XG}},oPe=["ADD","AGENT","AGGREGATE","ALL","ALTER","AND","ANY","ARROW","AS","ASC","AT","ATTRIBUTE","AUTHID","AVG","BEGIN","BETWEEN","BLOCK","BODY","BOTH","BOUND","BULK","BY","BYTE","CALL","CALLING","CASCADE","CASE","CHARSET","CHARSETFORM","CHARSETID","CHECK","CLOSE","CLUSTER","CLUSTERS","COLAUTH","COLLECT","COLUMNS","COMMENT","COMMIT","COMMITTED","COMPILED","COMPRESS","CONNECT","CONSTANT","CONSTRUCTOR","CONTEXT","CONVERT","COUNT","CRASH","CREATE","CURRENT","CURSOR","CUSTOMDATUM","DANGLING","DATA","DAY","DECLARE","DEFAULT","DEFINE","DELETE","DESC","DETERMINISTIC","DISTINCT","DROP","DURATION","ELEMENT","ELSE","ELSIF","EMPTY","END","ESCAPE","EXCEPT","EXCEPTION","EXCEPTIONS","EXCLUSIVE","EXECUTE","EXISTS","EXIT","EXTERNAL","FETCH","FINAL","FIXED","FOR","FORALL","FORCE","FORM","FROM","FUNCTION","GENERAL","GOTO","GRANT","GROUP","HASH","HAVING","HEAP","HIDDEN","HOUR","IDENTIFIED","IF","IMMEDIATE","IN","INCLUDING","INDEX","INDEXES","INDICATOR","INDICES","INFINITE","INSERT","INSTANTIABLE","INTERFACE","INTERSECT","INTERVAL","INTO","INVALIDATE","IS","ISOLATION","JAVA","LANGUAGE","LARGE","LEADING","LENGTH","LEVEL","LIBRARY","LIKE","LIKE2","LIKE4","LIKEC","LIMIT","LIMITED","LOCAL","LOCK","LOOP","MAP","MAX","MAXLEN","MEMBER","MERGE","MIN","MINUS","MINUTE","MOD","MODE","MODIFY","MONTH","MULTISET","NAME","NAN","NATIONAL","NATIVE","NEW","NOCOMPRESS","NOCOPY","NOT","NOWAIT","NULL","OBJECT","OCICOLL","OCIDATE","OCIDATETIME","OCIDURATION","OCIINTERVAL","OCILOBLOCATOR","OCINUMBER","OCIRAW","OCIREF","OCIREFCURSOR","OCIROWID","OCISTRING","OCITYPE","OF","ON","ONLY","OPAQUE","OPEN","OPERATOR","OPTION","OR","ORACLE","ORADATA","ORDER","OVERLAPS","ORGANIZATION","ORLANY","ORLVARY","OTHERS","OUT","OVERRIDING","PACKAGE","PARALLEL_ENABLE","PARAMETER","PARAMETERS","PARTITION","PASCAL","PIPE","PIPELINED","PRAGMA","PRIOR","PRIVATE","PROCEDURE","PUBLIC","RAISE","RANGE","READ","RECORD","REF","REFERENCE","REM","REMAINDER","RENAME","RESOURCE","RESULT","RETURN","RETURNING","REVERSE","REVOKE","ROLLBACK","ROW","SAMPLE","SAVE","SAVEPOINT","SB1","SB2","SB4","SECOND","SEGMENT","SELECT","SELF","SEPARATE","SEQUENCE","SERIALIZABLE","SET","SHARE","SHORT","SIZE","SIZE_T","SOME","SPARSE","SQL","SQLCODE","SQLDATA","SQLNAME","SQLSTATE","STANDARD","START","STATIC","STDDEV","STORED","STRING","STRUCT","STYLE","SUBMULTISET","SUBPARTITION","SUBSTITUTABLE","SUBTYPE","SUM","SYNONYM","TABAUTH","TABLE","TDO","THE","THEN","TIME","TIMEZONE_ABBR","TIMEZONE_HOUR","TIMEZONE_MINUTE","TIMEZONE_REGION","TO","TRAILING","TRANSAC","TRANSACTIONAL","TRUSTED","TYPE","UB1","UB2","UB4","UNDER","UNION","UNIQUE","UNSIGNED","UNTRUSTED","UPDATE","USE","USING","VALIST","VALUE","VALUES","VARIABLE","VARIANCE","VARRAY","VIEW","VIEWS","VOID","WHEN","WHERE","WHILE","WITH","WORK","WRAPPED","WRITE","YEAR","ZONE"],lPe=["ARRAY","BFILE_BASE","BINARY","BLOB_BASE","CHAR VARYING","CHAR_BASE","CHAR","CHARACTER VARYING","CHARACTER","CLOB_BASE","DATE_BASE","DATE","DECIMAL","DOUBLE","FLOAT","INT","INTERVAL DAY","INTERVAL YEAR","LONG","NATIONAL CHAR VARYING","NATIONAL CHAR","NATIONAL CHARACTER VARYING","NATIONAL CHARACTER","NCHAR VARYING","NCHAR","NCHAR","NUMBER_BASE","NUMBER","NUMBERIC","NVARCHAR","PRECISION","RAW","TIMESTAMP","UROWID","VARCHAR","VARCHAR2"],cPe=["ABS","ACOS","ASIN","ATAN","ATAN2","BITAND","CEIL","COS","COSH","EXP","FLOOR","LN","LOG","MOD","NANVL","POWER","REMAINDER","ROUND","SIGN","SIN","SINH","SQRT","TAN","TANH","TRUNC","WIDTH_BUCKET","CHR","CONCAT","INITCAP","LOWER","LPAD","LTRIM","NLS_INITCAP","NLS_LOWER","NLSSORT","NLS_UPPER","REGEXP_REPLACE","REGEXP_SUBSTR","REPLACE","RPAD","RTRIM","SOUNDEX","SUBSTR","TRANSLATE","TREAT","TRIM","UPPER","NLS_CHARSET_DECL_LEN","NLS_CHARSET_ID","NLS_CHARSET_NAME","ASCII","INSTR","LENGTH","REGEXP_INSTR","ADD_MONTHS","CURRENT_DATE","CURRENT_TIMESTAMP","DBTIMEZONE","EXTRACT","FROM_TZ","LAST_DAY","LOCALTIMESTAMP","MONTHS_BETWEEN","NEW_TIME","NEXT_DAY","NUMTODSINTERVAL","NUMTOYMINTERVAL","ROUND","SESSIONTIMEZONE","SYS_EXTRACT_UTC","SYSDATE","SYSTIMESTAMP","TO_CHAR","TO_TIMESTAMP","TO_TIMESTAMP_TZ","TO_DSINTERVAL","TO_YMINTERVAL","TRUNC","TZ_OFFSET","GREATEST","LEAST","ASCIISTR","BIN_TO_NUM","CAST","CHARTOROWID","COMPOSE","CONVERT","DECOMPOSE","HEXTORAW","NUMTODSINTERVAL","NUMTOYMINTERVAL","RAWTOHEX","RAWTONHEX","ROWIDTOCHAR","ROWIDTONCHAR","SCN_TO_TIMESTAMP","TIMESTAMP_TO_SCN","TO_BINARY_DOUBLE","TO_BINARY_FLOAT","TO_CHAR","TO_CLOB","TO_DATE","TO_DSINTERVAL","TO_LOB","TO_MULTI_BYTE","TO_NCHAR","TO_NCLOB","TO_NUMBER","TO_DSINTERVAL","TO_SINGLE_BYTE","TO_TIMESTAMP","TO_TIMESTAMP_TZ","TO_YMINTERVAL","TO_YMINTERVAL","TRANSLATE","UNISTR","BFILENAME","EMPTY_BLOB,","EMPTY_CLOB","CARDINALITY","COLLECT","POWERMULTISET","POWERMULTISET_BY_CARDINALITY","SET","SYS_CONNECT_BY_PATH","CLUSTER_ID","CLUSTER_PROBABILITY","CLUSTER_SET","FEATURE_ID","FEATURE_SET","FEATURE_VALUE","PREDICTION","PREDICTION_COST","PREDICTION_DETAILS","PREDICTION_PROBABILITY","PREDICTION_SET","APPENDCHILDXML","DELETEXML","DEPTH","EXTRACT","EXISTSNODE","EXTRACTVALUE","INSERTCHILDXML","INSERTXMLBEFORE","PATH","SYS_DBURIGEN","SYS_XMLAGG","SYS_XMLGEN","UPDATEXML","XMLAGG","XMLCDATA","XMLCOLATTVAL","XMLCOMMENT","XMLCONCAT","XMLFOREST","XMLPARSE","XMLPI","XMLQUERY","XMLROOT","XMLSEQUENCE","XMLSERIALIZE","XMLTABLE","XMLTRANSFORM","DECODE","DUMP","ORA_HASH","VSIZE","COALESCE","LNNVL","NULLIF","NVL","NVL2","SYS_CONTEXT","SYS_GUID","SYS_TYPEID","UID","USER","USERENV","AVG","COLLECT","CORR","CORR_S","CORR_K","COUNT","COVAR_POP","COVAR_SAMP","CUME_DIST","DENSE_RANK","FIRST","GROUP_ID","GROUPING","GROUPING_ID","LAST","MAX","MEDIAN","MIN","PERCENTILE_CONT","PERCENTILE_DISC","PERCENT_RANK","RANK","REGR_SLOPE","REGR_INTERCEPT","REGR_COUNT","REGR_R2","REGR_AVGX","REGR_AVGY","REGR_SXX","REGR_SYY","REGR_SXY","STATS_BINOMIAL_TEST","STATS_CROSSTAB","STATS_F_TEST","STATS_KS_TEST","STATS_MODE","STATS_MW_TEST","STATS_ONE_WAY_ANOVA","STATS_T_TEST_ONE","STATS_T_TEST_PAIRED","STATS_T_TEST_INDEP","STATS_T_TEST_INDEPU","STATS_WSR_TEST","STDDEV","STDDEV_POP","STDDEV_SAMP","SUM","VAR_POP","VAR_SAMP","VARIANCE","FIRST_VALUE","LAG","LAST_VALUE","LEAD","NTILE","RATIO_TO_REPORT","ROW_NUMBER","DEREF","MAKE_REF","REF","REFTOHEX","VALUE","CV","ITERATION_NUMBER","PRESENTNNV","PRESENTV","PREVIOUS"],uPe=Me(["SELECT [ALL | DISTINCT | UNIQUE]"]),dPe=Me(["WITH","FROM","WHERE","GROUP BY","HAVING","PARTITION BY","ORDER [SIBLINGS] BY","OFFSET","FETCH {FIRST | NEXT}","FOR UPDATE [OF]","INSERT [INTO | ALL INTO]","VALUES","SET","MERGE [INTO]","WHEN [NOT] MATCHED [THEN]","UPDATE SET","RETURNING"]),KG=Me(["CREATE [GLOBAL TEMPORARY | PRIVATE TEMPORARY | SHARDED | DUPLICATED | IMMUTABLE BLOCKCHAIN | BLOCKCHAIN | IMMUTABLE] TABLE"]),fC=Me(["CREATE [OR REPLACE] [NO FORCE | FORCE] [EDITIONING | EDITIONABLE | EDITIONABLE EDITIONING | NONEDITIONABLE] VIEW","CREATE MATERIALIZED VIEW","UPDATE [ONLY]","DELETE FROM [ONLY]","DROP TABLE","ALTER TABLE","ADD","DROP {COLUMN | UNUSED COLUMNS | COLUMNS CONTINUE}","MODIFY","RENAME TO","RENAME COLUMN","TRUNCATE TABLE","SET SCHEMA","BEGIN","CONNECT BY","DECLARE","EXCEPT","EXCEPTION","LOOP","START WITH"]),hPe=Me(["UNION [ALL]","MINUS","INTERSECT"]),fPe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN","{CROSS | OUTER} APPLY"]),mPe=Me(["ON {UPDATE | DELETE} [SET NULL]","ON COMMIT","{ROWS | RANGE} BETWEEN"]),pPe={name:"plsql",tokenizerOptions:{reservedSelect:uPe,reservedClauses:[...dPe,...KG,...fC],reservedSetOperations:hPe,reservedJoins:fPe,reservedPhrases:mPe,supportsXor:!0,reservedKeywords:oPe,reservedDataTypes:lPe,reservedFunctionNames:cPe,stringTypes:[{quote:"''-qq",prefixes:["N"]},{quote:"q''",prefixes:["N"]}],identTypes:['""-qq'],identChars:{rest:"$#"},variableTypes:[{regex:"&{1,2}[A-Za-z][A-Za-z0-9_$#]*"}],paramTypes:{numbered:[":"],named:[":"]},operators:["**",":=","%","~=","^=",">>","<<","=>","@","||"],postProcess:gPe},formatOptions:{alwaysDenseOperators:["@"],onelineClauses:[...KG,...fC],tabularOnelineClauses:fC}};function gPe(e){let t=Hh;return e.map(n=>_u.SET(n)&&_u.BY(t)?Object.assign(Object.assign({},n),{type:Ve.RESERVED_KEYWORD}):(bQ(n.type)&&(t=n),n))}const EPe=["ABS","ACOS","ACOSD","ACOSH","ASIN","ASIND","ASINH","ATAN","ATAN2","ATAN2D","ATAND","ATANH","CBRT","CEIL","CEILING","COS","COSD","COSH","COT","COTD","DEGREES","DIV","EXP","FACTORIAL","FLOOR","GCD","LCM","LN","LOG","LOG10","MIN_SCALE","MOD","PI","POWER","RADIANS","RANDOM","ROUND","SCALE","SETSEED","SIGN","SIN","SIND","SINH","SQRT","TAN","TAND","TANH","TRIM_SCALE","TRUNC","WIDTH_BUCKET","ABS","ASCII","BIT_LENGTH","BTRIM","CHARACTER_LENGTH","CHAR_LENGTH","CHR","CONCAT","CONCAT_WS","FORMAT","INITCAP","LEFT","LENGTH","LOWER","LPAD","LTRIM","MD5","NORMALIZE","OCTET_LENGTH","OVERLAY","PARSE_IDENT","PG_CLIENT_ENCODING","POSITION","QUOTE_IDENT","QUOTE_LITERAL","QUOTE_NULLABLE","REGEXP_MATCH","REGEXP_MATCHES","REGEXP_REPLACE","REGEXP_SPLIT_TO_ARRAY","REGEXP_SPLIT_TO_TABLE","REPEAT","REPLACE","REVERSE","RIGHT","RPAD","RTRIM","SPLIT_PART","SPRINTF","STARTS_WITH","STRING_AGG","STRING_TO_ARRAY","STRING_TO_TABLE","STRPOS","SUBSTR","SUBSTRING","TO_ASCII","TO_HEX","TRANSLATE","TRIM","UNISTR","UPPER","BIT_COUNT","BIT_LENGTH","BTRIM","CONVERT","CONVERT_FROM","CONVERT_TO","DECODE","ENCODE","GET_BIT","GET_BYTE","LENGTH","LTRIM","MD5","OCTET_LENGTH","OVERLAY","POSITION","RTRIM","SET_BIT","SET_BYTE","SHA224","SHA256","SHA384","SHA512","STRING_AGG","SUBSTR","SUBSTRING","TRIM","BIT_COUNT","BIT_LENGTH","GET_BIT","LENGTH","OCTET_LENGTH","OVERLAY","POSITION","SET_BIT","SUBSTRING","REGEXP_MATCH","REGEXP_MATCHES","REGEXP_REPLACE","REGEXP_SPLIT_TO_ARRAY","REGEXP_SPLIT_TO_TABLE","TO_CHAR","TO_DATE","TO_NUMBER","TO_TIMESTAMP","CLOCK_TIMESTAMP","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATE_BIN","DATE_PART","DATE_TRUNC","EXTRACT","ISFINITE","JUSTIFY_DAYS","JUSTIFY_HOURS","JUSTIFY_INTERVAL","LOCALTIME","LOCALTIMESTAMP","MAKE_DATE","MAKE_INTERVAL","MAKE_TIME","MAKE_TIMESTAMP","MAKE_TIMESTAMPTZ","NOW","PG_SLEEP","PG_SLEEP_FOR","PG_SLEEP_UNTIL","STATEMENT_TIMESTAMP","TIMEOFDAY","TO_TIMESTAMP","TRANSACTION_TIMESTAMP","ENUM_FIRST","ENUM_LAST","ENUM_RANGE","AREA","BOUND_BOX","BOX","CENTER","CIRCLE","DIAGONAL","DIAMETER","HEIGHT","ISCLOSED","ISOPEN","LENGTH","LINE","LSEG","NPOINTS","PATH","PCLOSE","POINT","POLYGON","POPEN","RADIUS","SLOPE","WIDTH","ABBREV","BROADCAST","FAMILY","HOST","HOSTMASK","INET_MERGE","INET_SAME_FAMILY","MACADDR8_SET7BIT","MASKLEN","NETMASK","NETWORK","SET_MASKLEN","TRUNC","ARRAY_TO_TSVECTOR","GET_CURRENT_TS_CONFIG","JSONB_TO_TSVECTOR","JSON_TO_TSVECTOR","LENGTH","NUMNODE","PHRASETO_TSQUERY","PLAINTO_TSQUERY","QUERYTREE","SETWEIGHT","STRIP","TO_TSQUERY","TO_TSVECTOR","TSQUERY_PHRASE","TSVECTOR_TO_ARRAY","TS_DEBUG","TS_DELETE","TS_FILTER","TS_HEADLINE","TS_LEXIZE","TS_PARSE","TS_RANK","TS_RANK_CD","TS_REWRITE","TS_STAT","TS_TOKEN_TYPE","WEBSEARCH_TO_TSQUERY","UUID","CURSOR_TO_XML","CURSOR_TO_XMLSCHEMA","DATABASE_TO_XML","DATABASE_TO_XMLSCHEMA","DATABASE_TO_XML_AND_XMLSCHEMA","NEXTVAL","QUERY_TO_XML","QUERY_TO_XMLSCHEMA","QUERY_TO_XML_AND_XMLSCHEMA","SCHEMA_TO_XML","SCHEMA_TO_XMLSCHEMA","SCHEMA_TO_XML_AND_XMLSCHEMA","STRING","TABLE_TO_XML","TABLE_TO_XMLSCHEMA","TABLE_TO_XML_AND_XMLSCHEMA","XMLAGG","XMLCOMMENT","XMLCONCAT","XMLELEMENT","XMLEXISTS","XMLFOREST","XMLPARSE","XMLPI","XMLROOT","XMLSERIALIZE","XMLTABLE","XML_IS_WELL_FORMED","XML_IS_WELL_FORMED_CONTENT","XML_IS_WELL_FORMED_DOCUMENT","XPATH","XPATH_EXISTS","ARRAY_TO_JSON","JSONB_AGG","JSONB_ARRAY_ELEMENTS","JSONB_ARRAY_ELEMENTS_TEXT","JSONB_ARRAY_LENGTH","JSONB_BUILD_ARRAY","JSONB_BUILD_OBJECT","JSONB_EACH","JSONB_EACH_TEXT","JSONB_EXTRACT_PATH","JSONB_EXTRACT_PATH_TEXT","JSONB_INSERT","JSONB_OBJECT","JSONB_OBJECT_AGG","JSONB_OBJECT_KEYS","JSONB_PATH_EXISTS","JSONB_PATH_EXISTS_TZ","JSONB_PATH_MATCH","JSONB_PATH_MATCH_TZ","JSONB_PATH_QUERY","JSONB_PATH_QUERY_ARRAY","JSONB_PATH_QUERY_ARRAY_TZ","JSONB_PATH_QUERY_FIRST","JSONB_PATH_QUERY_FIRST_TZ","JSONB_PATH_QUERY_TZ","JSONB_POPULATE_RECORD","JSONB_POPULATE_RECORDSET","JSONB_PRETTY","JSONB_SET","JSONB_SET_LAX","JSONB_STRIP_NULLS","JSONB_TO_RECORD","JSONB_TO_RECORDSET","JSONB_TYPEOF","JSON_AGG","JSON_ARRAY_ELEMENTS","JSON_ARRAY_ELEMENTS_TEXT","JSON_ARRAY_LENGTH","JSON_BUILD_ARRAY","JSON_BUILD_OBJECT","JSON_EACH","JSON_EACH_TEXT","JSON_EXTRACT_PATH","JSON_EXTRACT_PATH_TEXT","JSON_OBJECT","JSON_OBJECT_AGG","JSON_OBJECT_KEYS","JSON_POPULATE_RECORD","JSON_POPULATE_RECORDSET","JSON_STRIP_NULLS","JSON_TO_RECORD","JSON_TO_RECORDSET","JSON_TYPEOF","ROW_TO_JSON","TO_JSON","TO_JSONB","TO_TIMESTAMP","CURRVAL","LASTVAL","NEXTVAL","SETVAL","COALESCE","GREATEST","LEAST","NULLIF","ARRAY_AGG","ARRAY_APPEND","ARRAY_CAT","ARRAY_DIMS","ARRAY_FILL","ARRAY_LENGTH","ARRAY_LOWER","ARRAY_NDIMS","ARRAY_POSITION","ARRAY_POSITIONS","ARRAY_PREPEND","ARRAY_REMOVE","ARRAY_REPLACE","ARRAY_TO_STRING","ARRAY_UPPER","CARDINALITY","STRING_TO_ARRAY","TRIM_ARRAY","UNNEST","ISEMPTY","LOWER","LOWER_INC","LOWER_INF","MULTIRANGE","RANGE_MERGE","UPPER","UPPER_INC","UPPER_INF","ARRAY_AGG","AVG","BIT_AND","BIT_OR","BIT_XOR","BOOL_AND","BOOL_OR","COALESCE","CORR","COUNT","COVAR_POP","COVAR_SAMP","CUME_DIST","DENSE_RANK","EVERY","GROUPING","JSONB_AGG","JSONB_OBJECT_AGG","JSON_AGG","JSON_OBJECT_AGG","MAX","MIN","MODE","PERCENTILE_CONT","PERCENTILE_DISC","PERCENT_RANK","RANGE_AGG","RANGE_INTERSECT_AGG","RANK","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","STDDEV","STDDEV_POP","STDDEV_SAMP","STRING_AGG","SUM","TO_JSON","TO_JSONB","VARIANCE","VAR_POP","VAR_SAMP","XMLAGG","CUME_DIST","DENSE_RANK","FIRST_VALUE","LAG","LAST_VALUE","LEAD","NTH_VALUE","NTILE","PERCENT_RANK","RANK","ROW_NUMBER","GENERATE_SERIES","GENERATE_SUBSCRIPTS","ACLDEFAULT","ACLEXPLODE","COL_DESCRIPTION","CURRENT_CATALOG","CURRENT_DATABASE","CURRENT_QUERY","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_SCHEMAS","CURRENT_USER","FORMAT_TYPE","HAS_ANY_COLUMN_PRIVILEGE","HAS_COLUMN_PRIVILEGE","HAS_DATABASE_PRIVILEGE","HAS_FOREIGN_DATA_WRAPPER_PRIVILEGE","HAS_FUNCTION_PRIVILEGE","HAS_LANGUAGE_PRIVILEGE","HAS_SCHEMA_PRIVILEGE","HAS_SEQUENCE_PRIVILEGE","HAS_SERVER_PRIVILEGE","HAS_TABLESPACE_PRIVILEGE","HAS_TABLE_PRIVILEGE","HAS_TYPE_PRIVILEGE","INET_CLIENT_ADDR","INET_CLIENT_PORT","INET_SERVER_ADDR","INET_SERVER_PORT","MAKEACLITEM","OBJ_DESCRIPTION","PG_BACKEND_PID","PG_BLOCKING_PIDS","PG_COLLATION_IS_VISIBLE","PG_CONF_LOAD_TIME","PG_CONTROL_CHECKPOINT","PG_CONTROL_INIT","PG_CONTROL_SYSTEM","PG_CONVERSION_IS_VISIBLE","PG_CURRENT_LOGFILE","PG_CURRENT_SNAPSHOT","PG_CURRENT_XACT_ID","PG_CURRENT_XACT_ID_IF_ASSIGNED","PG_DESCRIBE_OBJECT","PG_FUNCTION_IS_VISIBLE","PG_GET_CATALOG_FOREIGN_KEYS","PG_GET_CONSTRAINTDEF","PG_GET_EXPR","PG_GET_FUNCTIONDEF","PG_GET_FUNCTION_ARGUMENTS","PG_GET_FUNCTION_IDENTITY_ARGUMENTS","PG_GET_FUNCTION_RESULT","PG_GET_INDEXDEF","PG_GET_KEYWORDS","PG_GET_OBJECT_ADDRESS","PG_GET_OWNED_SEQUENCE","PG_GET_RULEDEF","PG_GET_SERIAL_SEQUENCE","PG_GET_STATISTICSOBJDEF","PG_GET_TRIGGERDEF","PG_GET_USERBYID","PG_GET_VIEWDEF","PG_HAS_ROLE","PG_IDENTIFY_OBJECT","PG_IDENTIFY_OBJECT_AS_ADDRESS","PG_INDEXAM_HAS_PROPERTY","PG_INDEX_COLUMN_HAS_PROPERTY","PG_INDEX_HAS_PROPERTY","PG_IS_OTHER_TEMP_SCHEMA","PG_JIT_AVAILABLE","PG_LAST_COMMITTED_XACT","PG_LISTENING_CHANNELS","PG_MY_TEMP_SCHEMA","PG_NOTIFICATION_QUEUE_USAGE","PG_OPCLASS_IS_VISIBLE","PG_OPERATOR_IS_VISIBLE","PG_OPFAMILY_IS_VISIBLE","PG_OPTIONS_TO_TABLE","PG_POSTMASTER_START_TIME","PG_SAFE_SNAPSHOT_BLOCKING_PIDS","PG_SNAPSHOT_XIP","PG_SNAPSHOT_XMAX","PG_SNAPSHOT_XMIN","PG_STATISTICS_OBJ_IS_VISIBLE","PG_TABLESPACE_DATABASES","PG_TABLESPACE_LOCATION","PG_TABLE_IS_VISIBLE","PG_TRIGGER_DEPTH","PG_TS_CONFIG_IS_VISIBLE","PG_TS_DICT_IS_VISIBLE","PG_TS_PARSER_IS_VISIBLE","PG_TS_TEMPLATE_IS_VISIBLE","PG_TYPEOF","PG_TYPE_IS_VISIBLE","PG_VISIBLE_IN_SNAPSHOT","PG_XACT_COMMIT_TIMESTAMP","PG_XACT_COMMIT_TIMESTAMP_ORIGIN","PG_XACT_STATUS","PQSERVERVERSION","ROW_SECURITY_ACTIVE","SESSION_USER","SHOBJ_DESCRIPTION","TO_REGCLASS","TO_REGCOLLATION","TO_REGNAMESPACE","TO_REGOPER","TO_REGOPERATOR","TO_REGPROC","TO_REGPROCEDURE","TO_REGROLE","TO_REGTYPE","TXID_CURRENT","TXID_CURRENT_IF_ASSIGNED","TXID_CURRENT_SNAPSHOT","TXID_SNAPSHOT_XIP","TXID_SNAPSHOT_XMAX","TXID_SNAPSHOT_XMIN","TXID_STATUS","TXID_VISIBLE_IN_SNAPSHOT","USER","VERSION","BRIN_DESUMMARIZE_RANGE","BRIN_SUMMARIZE_NEW_VALUES","BRIN_SUMMARIZE_RANGE","CONVERT_FROM","CURRENT_SETTING","GIN_CLEAN_PENDING_LIST","PG_ADVISORY_LOCK","PG_ADVISORY_LOCK_SHARED","PG_ADVISORY_UNLOCK","PG_ADVISORY_UNLOCK_ALL","PG_ADVISORY_UNLOCK_SHARED","PG_ADVISORY_XACT_LOCK","PG_ADVISORY_XACT_LOCK_SHARED","PG_BACKUP_START_TIME","PG_CANCEL_BACKEND","PG_COLLATION_ACTUAL_VERSION","PG_COLUMN_COMPRESSION","PG_COLUMN_SIZE","PG_COPY_LOGICAL_REPLICATION_SLOT","PG_COPY_PHYSICAL_REPLICATION_SLOT","PG_CREATE_LOGICAL_REPLICATION_SLOT","PG_CREATE_PHYSICAL_REPLICATION_SLOT","PG_CREATE_RESTORE_POINT","PG_CURRENT_WAL_FLUSH_LSN","PG_CURRENT_WAL_INSERT_LSN","PG_CURRENT_WAL_LSN","PG_DATABASE_SIZE","PG_DROP_REPLICATION_SLOT","PG_EXPORT_SNAPSHOT","PG_FILENODE_RELATION","PG_GET_WAL_REPLAY_PAUSE_STATE","PG_IMPORT_SYSTEM_COLLATIONS","PG_INDEXES_SIZE","PG_IS_IN_BACKUP","PG_IS_IN_RECOVERY","PG_IS_WAL_REPLAY_PAUSED","PG_LAST_WAL_RECEIVE_LSN","PG_LAST_WAL_REPLAY_LSN","PG_LAST_XACT_REPLAY_TIMESTAMP","PG_LOGICAL_EMIT_MESSAGE","PG_LOGICAL_SLOT_GET_BINARY_CHANGES","PG_LOGICAL_SLOT_GET_CHANGES","PG_LOGICAL_SLOT_PEEK_BINARY_CHANGES","PG_LOGICAL_SLOT_PEEK_CHANGES","PG_LOG_BACKEND_MEMORY_CONTEXTS","PG_LS_ARCHIVE_STATUSDIR","PG_LS_DIR","PG_LS_LOGDIR","PG_LS_TMPDIR","PG_LS_WALDIR","PG_PARTITION_ANCESTORS","PG_PARTITION_ROOT","PG_PARTITION_TREE","PG_PROMOTE","PG_READ_BINARY_FILE","PG_READ_FILE","PG_RELATION_FILENODE","PG_RELATION_FILEPATH","PG_RELATION_SIZE","PG_RELOAD_CONF","PG_REPLICATION_ORIGIN_ADVANCE","PG_REPLICATION_ORIGIN_CREATE","PG_REPLICATION_ORIGIN_DROP","PG_REPLICATION_ORIGIN_OID","PG_REPLICATION_ORIGIN_PROGRESS","PG_REPLICATION_ORIGIN_SESSION_IS_SETUP","PG_REPLICATION_ORIGIN_SESSION_PROGRESS","PG_REPLICATION_ORIGIN_SESSION_RESET","PG_REPLICATION_ORIGIN_SESSION_SETUP","PG_REPLICATION_ORIGIN_XACT_RESET","PG_REPLICATION_ORIGIN_XACT_SETUP","PG_REPLICATION_SLOT_ADVANCE","PG_ROTATE_LOGFILE","PG_SIZE_BYTES","PG_SIZE_PRETTY","PG_START_BACKUP","PG_STAT_FILE","PG_STOP_BACKUP","PG_SWITCH_WAL","PG_TABLESPACE_SIZE","PG_TABLE_SIZE","PG_TERMINATE_BACKEND","PG_TOTAL_RELATION_SIZE","PG_TRY_ADVISORY_LOCK","PG_TRY_ADVISORY_LOCK_SHARED","PG_TRY_ADVISORY_XACT_LOCK","PG_TRY_ADVISORY_XACT_LOCK_SHARED","PG_WALFILE_NAME","PG_WALFILE_NAME_OFFSET","PG_WAL_LSN_DIFF","PG_WAL_REPLAY_PAUSE","PG_WAL_REPLAY_RESUME","SET_CONFIG","SUPPRESS_REDUNDANT_UPDATES_TRIGGER","TSVECTOR_UPDATE_TRIGGER","TSVECTOR_UPDATE_TRIGGER_COLUMN","PG_EVENT_TRIGGER_DDL_COMMANDS","PG_EVENT_TRIGGER_DROPPED_OBJECTS","PG_EVENT_TRIGGER_TABLE_REWRITE_OID","PG_EVENT_TRIGGER_TABLE_REWRITE_REASON","PG_GET_OBJECT_ADDRESS","PG_MCV_LIST_ITEMS","CAST"],TPe=["ALL","ANALYSE","ANALYZE","AND","ANY","AS","ASC","ASYMMETRIC","AUTHORIZATION","BETWEEN","BINARY","BOTH","CASE","CAST","CHECK","COLLATE","COLLATION","COLUMN","CONCURRENTLY","CONSTRAINT","CREATE","CROSS","CURRENT_CATALOG","CURRENT_DATE","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","DAY","DEFAULT","DEFERRABLE","DESC","DISTINCT","DO","ELSE","END","EXCEPT","EXISTS","FALSE","FETCH","FILTER","FOR","FOREIGN","FREEZE","FROM","FULL","GRANT","GROUP","HAVING","HOUR","ILIKE","IN","INITIALLY","INNER","INOUT","INTERSECT","INTO","IS","ISNULL","JOIN","LATERAL","LEADING","LEFT","LIKE","LIMIT","LOCALTIME","LOCALTIMESTAMP","MINUTE","MONTH","NATURAL","NOT","NOTNULL","NULL","NULLIF","OFFSET","ON","ONLY","OR","ORDER","OUT","OUTER","OVER","OVERLAPS","PLACING","PRIMARY","REFERENCES","RETURNING","RIGHT","ROW","SECOND","SELECT","SESSION_USER","SIMILAR","SOME","SYMMETRIC","TABLE","TABLESAMPLE","THEN","TO","TRAILING","TRUE","UNION","UNIQUE","USER","USING","VALUES","VARIADIC","VERBOSE","WHEN","WHERE","WINDOW","WITH","WITHIN","WITHOUT","YEAR"],yPe=["ARRAY","BIGINT","BIT","BIT VARYING","BOOL","BOOLEAN","CHAR","CHARACTER","CHARACTER VARYING","DECIMAL","DEC","DOUBLE","ENUM","FLOAT","INT","INTEGER","INTERVAL","NCHAR","NUMERIC","JSON","JSONB","PRECISION","REAL","SMALLINT","TEXT","TIME","TIMESTAMP","TIMESTAMPTZ","VARCHAR","XML","ZONE"],xPe=Me(["SELECT [ALL | DISTINCT]"]),SPe=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY [ALL | DISTINCT]","HAVING","WINDOW","PARTITION BY","ORDER BY","LIMIT","OFFSET","FETCH {FIRST | NEXT}","FOR {UPDATE | NO KEY UPDATE | SHARE | KEY SHARE} [OF]","INSERT INTO","VALUES","DEFAULT VALUES","SET","RETURNING"]),QG=Me(["CREATE [GLOBAL | LOCAL] [TEMPORARY | TEMP | UNLOGGED] TABLE [IF NOT EXISTS]"]),mC=Me(["CREATE [OR REPLACE] [TEMP | TEMPORARY] [RECURSIVE] VIEW","CREATE [MATERIALIZED] VIEW [IF NOT EXISTS]","UPDATE [ONLY]","WHERE CURRENT OF","ON CONFLICT","DELETE FROM [ONLY]","DROP TABLE [IF EXISTS]","ALTER TABLE [IF EXISTS] [ONLY]","ALTER TABLE ALL IN TABLESPACE","RENAME [COLUMN]","RENAME TO","ADD [COLUMN] [IF NOT EXISTS]","DROP [COLUMN] [IF EXISTS]","ALTER [COLUMN]","SET DATA TYPE","{SET | DROP} DEFAULT","{SET | DROP} NOT NULL","TRUNCATE [TABLE] [ONLY]","SET SCHEMA","AFTER","ABORT","ALTER AGGREGATE","ALTER COLLATION","ALTER CONVERSION","ALTER DATABASE","ALTER DEFAULT PRIVILEGES","ALTER DOMAIN","ALTER EVENT TRIGGER","ALTER EXTENSION","ALTER FOREIGN DATA WRAPPER","ALTER FOREIGN TABLE","ALTER FUNCTION","ALTER GROUP","ALTER INDEX","ALTER LANGUAGE","ALTER LARGE OBJECT","ALTER MATERIALIZED VIEW","ALTER OPERATOR","ALTER OPERATOR CLASS","ALTER OPERATOR FAMILY","ALTER POLICY","ALTER PROCEDURE","ALTER PUBLICATION","ALTER ROLE","ALTER ROUTINE","ALTER RULE","ALTER SCHEMA","ALTER SEQUENCE","ALTER SERVER","ALTER STATISTICS","ALTER SUBSCRIPTION","ALTER SYSTEM","ALTER TABLESPACE","ALTER TEXT SEARCH CONFIGURATION","ALTER TEXT SEARCH DICTIONARY","ALTER TEXT SEARCH PARSER","ALTER TEXT SEARCH TEMPLATE","ALTER TRIGGER","ALTER TYPE","ALTER USER","ALTER USER MAPPING","ALTER VIEW","ANALYZE","BEGIN","CALL","CHECKPOINT","CLOSE","CLUSTER","COMMIT","COMMIT PREPARED","COPY","CREATE ACCESS METHOD","CREATE [OR REPLACE] AGGREGATE","CREATE CAST","CREATE COLLATION","CREATE [DEFAULT] CONVERSION","CREATE DATABASE","CREATE DOMAIN","CREATE EVENT TRIGGER","CREATE EXTENSION","CREATE FOREIGN DATA WRAPPER","CREATE FOREIGN TABLE","CREATE [OR REPLACE] FUNCTION","CREATE GROUP","CREATE [UNIQUE] INDEX","CREATE [OR REPLACE] [TRUSTED] [PROCEDURAL] LANGUAGE","CREATE OPERATOR","CREATE OPERATOR CLASS","CREATE OPERATOR FAMILY","CREATE POLICY","CREATE [OR REPLACE] PROCEDURE","CREATE PUBLICATION","CREATE ROLE","CREATE [OR REPLACE] RULE","CREATE SCHEMA [AUTHORIZATION]","CREATE [TEMPORARY | TEMP | UNLOGGED] SEQUENCE","CREATE SERVER","CREATE STATISTICS","CREATE SUBSCRIPTION","CREATE TABLESPACE","CREATE TEXT SEARCH CONFIGURATION","CREATE TEXT SEARCH DICTIONARY","CREATE TEXT SEARCH PARSER","CREATE TEXT SEARCH TEMPLATE","CREATE [OR REPLACE] TRANSFORM","CREATE [OR REPLACE] [CONSTRAINT] TRIGGER","CREATE TYPE","CREATE USER","CREATE USER MAPPING","DEALLOCATE","DECLARE","DISCARD","DROP ACCESS METHOD","DROP AGGREGATE","DROP CAST","DROP COLLATION","DROP CONVERSION","DROP DATABASE","DROP DOMAIN","DROP EVENT TRIGGER","DROP EXTENSION","DROP FOREIGN DATA WRAPPER","DROP FOREIGN TABLE","DROP FUNCTION","DROP GROUP","DROP IDENTITY","DROP INDEX","DROP LANGUAGE","DROP MATERIALIZED VIEW [IF EXISTS]","DROP OPERATOR","DROP OPERATOR CLASS","DROP OPERATOR FAMILY","DROP OWNED","DROP POLICY","DROP PROCEDURE","DROP PUBLICATION","DROP ROLE","DROP ROUTINE","DROP RULE","DROP SCHEMA","DROP SEQUENCE","DROP SERVER","DROP STATISTICS","DROP SUBSCRIPTION","DROP TABLESPACE","DROP TEXT SEARCH CONFIGURATION","DROP TEXT SEARCH DICTIONARY","DROP TEXT SEARCH PARSER","DROP TEXT SEARCH TEMPLATE","DROP TRANSFORM","DROP TRIGGER","DROP TYPE","DROP USER","DROP USER MAPPING","DROP VIEW","EXECUTE","EXPLAIN","FETCH","GRANT","IMPORT FOREIGN SCHEMA","LISTEN","LOAD","LOCK","MOVE","NOTIFY","OVERRIDING SYSTEM VALUE","PREPARE","PREPARE TRANSACTION","REASSIGN OWNED","REFRESH MATERIALIZED VIEW","REINDEX","RELEASE SAVEPOINT","RESET [ALL|ROLE|SESSION AUTHORIZATION]","REVOKE","ROLLBACK","ROLLBACK PREPARED","ROLLBACK TO SAVEPOINT","SAVEPOINT","SECURITY LABEL","SELECT INTO","SET CONSTRAINTS","SET ROLE","SET SESSION AUTHORIZATION","SET TRANSACTION","SHOW","START TRANSACTION","UNLISTEN","VACUUM"]),bPe=Me(["UNION [ALL | DISTINCT]","EXCEPT [ALL | DISTINCT]","INTERSECT [ALL | DISTINCT]"]),vPe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"]),APe=Me(["PRIMARY KEY","GENERATED {ALWAYS | BY DEFAULT} AS IDENTITY","ON {UPDATE | DELETE} [NO ACTION | RESTRICT | CASCADE | SET NULL | SET DEFAULT]","DO {NOTHING | UPDATE}","AS MATERIALIZED","{ROWS | RANGE | GROUPS} BETWEEN","[TIMESTAMP | TIME] {WITH | WITHOUT} TIME ZONE","IS [NOT] DISTINCT FROM","NULLS {FIRST | LAST}","WITH ORDINALITY"]),RPe={name:"postgresql",tokenizerOptions:{reservedSelect:xPe,reservedClauses:[...SPe,...QG,...mC],reservedSetOperations:bPe,reservedJoins:vPe,reservedPhrases:APe,reservedKeywords:TPe,reservedDataTypes:yPe,reservedFunctionNames:EPe,nestedBlockComments:!0,extraParens:["[]"],stringTypes:["$$",{quote:"''-qq",prefixes:["U&"]},{quote:"''-qq-bs",prefixes:["E"],requirePrefix:!0},{quote:"''-raw",prefixes:["B","X"],requirePrefix:!0}],identTypes:[{quote:'""-qq',prefixes:["U&"]}],identChars:{rest:"$"},paramTypes:{numbered:["$"]},operators:["%","^","|/","||/","@",":=","&","|","#","~","<<",">>","~>~","~<~","~>=~","~<=~","@-@","@@","##","<->","&&","&<","&>","<<|","&<|","|>>","|&>","<^","^>","?#","?-","?|","?-|","?||","@>","<@","~=","?","@?","?&","->","->>","#>","#>>","#-","=>",">>=","<<=","~~","~~*","!~~","!~~*","~","~*","!~","!~*","-|-","||","@@@","!!","^@","<%","%>","<<%","%>>","<<->","<->>","<<<->","<->>>","::",":","<#>","<=>","<+>","<~>","<%>"],operatorKeyword:!0},formatOptions:{alwaysDenseOperators:["::",":"],onelineClauses:[...QG,...mC],tabularOnelineClauses:mC}},NPe=["ANY_VALUE","APPROXIMATE PERCENTILE_DISC","AVG","COUNT","LISTAGG","MAX","MEDIAN","MIN","PERCENTILE_CONT","STDDEV_SAMP","STDDEV_POP","SUM","VAR_SAMP","VAR_POP","array","array_concat","array_flatten","get_array_length","split_to_array","subarray","BIT_AND","BIT_OR","BOOL_AND","BOOL_OR","COALESCE","DECODE","GREATEST","LEAST","NVL","NVL2","NULLIF","ADD_MONTHS","AT TIME ZONE","CONVERT_TIMEZONE","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATE_CMP","DATE_CMP_TIMESTAMP","DATE_CMP_TIMESTAMPTZ","DATE_PART_YEAR","DATEADD","DATEDIFF","DATE_PART","DATE_TRUNC","EXTRACT","GETDATE","INTERVAL_CMP","LAST_DAY","MONTHS_BETWEEN","NEXT_DAY","SYSDATE","TIMEOFDAY","TIMESTAMP_CMP","TIMESTAMP_CMP_DATE","TIMESTAMP_CMP_TIMESTAMPTZ","TIMESTAMPTZ_CMP","TIMESTAMPTZ_CMP_DATE","TIMESTAMPTZ_CMP_TIMESTAMP","TIMEZONE","TO_TIMESTAMP","TRUNC","AddBBox","DropBBox","GeometryType","ST_AddPoint","ST_Angle","ST_Area","ST_AsBinary","ST_AsEWKB","ST_AsEWKT","ST_AsGeoJSON","ST_AsText","ST_Azimuth","ST_Boundary","ST_Collect","ST_Contains","ST_ContainsProperly","ST_ConvexHull","ST_CoveredBy","ST_Covers","ST_Crosses","ST_Dimension","ST_Disjoint","ST_Distance","ST_DistanceSphere","ST_DWithin","ST_EndPoint","ST_Envelope","ST_Equals","ST_ExteriorRing","ST_Force2D","ST_Force3D","ST_Force3DM","ST_Force3DZ","ST_Force4D","ST_GeometryN","ST_GeometryType","ST_GeomFromEWKB","ST_GeomFromEWKT","ST_GeomFromText","ST_GeomFromWKB","ST_InteriorRingN","ST_Intersects","ST_IsPolygonCCW","ST_IsPolygonCW","ST_IsClosed","ST_IsCollection","ST_IsEmpty","ST_IsSimple","ST_IsValid","ST_Length","ST_LengthSphere","ST_Length2D","ST_LineFromMultiPoint","ST_LineInterpolatePoint","ST_M","ST_MakeEnvelope","ST_MakeLine","ST_MakePoint","ST_MakePolygon","ST_MemSize","ST_MMax","ST_MMin","ST_Multi","ST_NDims","ST_NPoints","ST_NRings","ST_NumGeometries","ST_NumInteriorRings","ST_NumPoints","ST_Perimeter","ST_Perimeter2D","ST_Point","ST_PointN","ST_Points","ST_Polygon","ST_RemovePoint","ST_Reverse","ST_SetPoint","ST_SetSRID","ST_Simplify","ST_SRID","ST_StartPoint","ST_Touches","ST_Within","ST_X","ST_XMax","ST_XMin","ST_Y","ST_YMax","ST_YMin","ST_Z","ST_ZMax","ST_ZMin","SupportsBBox","CHECKSUM","FUNC_SHA1","FNV_HASH","MD5","SHA","SHA1","SHA2","HLL","HLL_CREATE_SKETCH","HLL_CARDINALITY","HLL_COMBINE","IS_VALID_JSON","IS_VALID_JSON_ARRAY","JSON_ARRAY_LENGTH","JSON_EXTRACT_ARRAY_ELEMENT_TEXT","JSON_EXTRACT_PATH_TEXT","JSON_PARSE","JSON_SERIALIZE","ABS","ACOS","ASIN","ATAN","ATAN2","CBRT","CEILING","CEIL","COS","COT","DEGREES","DEXP","DLOG1","DLOG10","EXP","FLOOR","LN","LOG","MOD","PI","POWER","RADIANS","RANDOM","ROUND","SIN","SIGN","SQRT","TAN","TO_HEX","TRUNC","EXPLAIN_MODEL","ASCII","BPCHARCMP","BTRIM","BTTEXT_PATTERN_CMP","CHAR_LENGTH","CHARACTER_LENGTH","CHARINDEX","CHR","COLLATE","CONCAT","CRC32","DIFFERENCE","INITCAP","LEFT","RIGHT","LEN","LENGTH","LOWER","LPAD","RPAD","LTRIM","OCTETINDEX","OCTET_LENGTH","POSITION","QUOTE_IDENT","QUOTE_LITERAL","REGEXP_COUNT","REGEXP_INSTR","REGEXP_REPLACE","REGEXP_SUBSTR","REPEAT","REPLACE","REPLICATE","REVERSE","RTRIM","SOUNDEX","SPLIT_PART","STRPOS","STRTOL","SUBSTRING","TEXTLEN","TRANSLATE","TRIM","UPPER","decimal_precision","decimal_scale","is_array","is_bigint","is_boolean","is_char","is_decimal","is_float","is_integer","is_object","is_scalar","is_smallint","is_varchar","json_typeof","AVG","COUNT","CUME_DIST","DENSE_RANK","FIRST_VALUE","LAST_VALUE","LAG","LEAD","LISTAGG","MAX","MEDIAN","MIN","NTH_VALUE","NTILE","PERCENT_RANK","PERCENTILE_CONT","PERCENTILE_DISC","RANK","RATIO_TO_REPORT","ROW_NUMBER","STDDEV_SAMP","STDDEV_POP","SUM","VAR_SAMP","VAR_POP","CAST","CONVERT","TO_CHAR","TO_DATE","TO_NUMBER","TEXT_TO_INT_ALT","TEXT_TO_NUMERIC_ALT","CHANGE_QUERY_PRIORITY","CHANGE_SESSION_PRIORITY","CHANGE_USER_PRIORITY","CURRENT_SETTING","PG_CANCEL_BACKEND","PG_TERMINATE_BACKEND","REBOOT_CLUSTER","SET_CONFIG","CURRENT_AWS_ACCOUNT","CURRENT_DATABASE","CURRENT_NAMESPACE","CURRENT_SCHEMA","CURRENT_SCHEMAS","CURRENT_USER","CURRENT_USER_ID","HAS_ASSUMEROLE_PRIVILEGE","HAS_DATABASE_PRIVILEGE","HAS_SCHEMA_PRIVILEGE","HAS_TABLE_PRIVILEGE","PG_BACKEND_PID","PG_GET_COLS","PG_GET_GRANTEE_BY_IAM_ROLE","PG_GET_IAM_ROLE_BY_USER","PG_GET_LATE_BINDING_VIEW_COLS","PG_LAST_COPY_COUNT","PG_LAST_COPY_ID","PG_LAST_UNLOAD_ID","PG_LAST_QUERY_ID","PG_LAST_UNLOAD_COUNT","SESSION_USER","SLICE_NUM","USER","VERSION"],_Pe=["AES128","AES256","ALL","ALLOWOVERWRITE","ANY","AS","ASC","AUTHORIZATION","BACKUP","BETWEEN","BINARY","BOTH","CHECK","COLUMN","CONSTRAINT","CREATE","CROSS","DEFAULT","DEFERRABLE","DEFLATE","DEFRAG","DESC","DISABLE","DISTINCT","DO","ENABLE","ENCODE","ENCRYPT","ENCRYPTION","EXPLICIT","FALSE","FOR","FOREIGN","FREEZE","FROM","FULL","GLOBALDICT256","GLOBALDICT64K","GROUP","IDENTITY","IGNORE","ILIKE","IN","INITIALLY","INNER","INTO","IS","ISNULL","LANGUAGE","LEADING","LIKE","LIMIT","LOCALTIME","LOCALTIMESTAMP","LUN","LUNS","MINUS","NATURAL","NEW","NOT","NOTNULL","NULL","NULLS","OFF","OFFLINE","OFFSET","OID","OLD","ON","ONLY","OPEN","ORDER","OUTER","OVERLAPS","PARALLEL","PARTITION","PERCENT","PERMISSIONS","PLACING","PRIMARY","RECOVER","REFERENCES","REJECTLOG","RESORT","RESPECT","RESTORE","SIMILAR","SNAPSHOT","SOME","SYSTEM","TABLE","TAG","TDES","THEN","TIMESTAMP","TO","TOP","TRAILING","TRUE","UNIQUE","USING","VERBOSE","WALLET","WITHOUT","ACCEPTANYDATE","ACCEPTINVCHARS","BLANKSASNULL","DATEFORMAT","EMPTYASNULL","ENCODING","ESCAPE","EXPLICIT_IDS","FILLRECORD","IGNOREBLANKLINES","IGNOREHEADER","REMOVEQUOTES","ROUNDEC","TIMEFORMAT","TRIMBLANKS","TRUNCATECOLUMNS","COMPROWS","COMPUPDATE","MAXERROR","NOLOAD","STATUPDATE","FORMAT","CSV","DELIMITER","FIXEDWIDTH","SHAPEFILE","AVRO","JSON","PARQUET","ORC","ACCESS_KEY_ID","CREDENTIALS","ENCRYPTED","IAM_ROLE","MASTER_SYMMETRIC_KEY","SECRET_ACCESS_KEY","SESSION_TOKEN","BZIP2","GZIP","LZOP","ZSTD","MANIFEST","READRATIO","REGION","SSH","RAW","AZ64","BYTEDICT","DELTA","DELTA32K","LZO","MOSTLY8","MOSTLY16","MOSTLY32","RUNLENGTH","TEXT255","TEXT32K","CATALOG_ROLE","SECRET_ARN","EXTERNAL","AUTO","EVEN","KEY","PREDICATE","COMPRESSION"],wPe=["ARRAY","BIGINT","BPCHAR","CHAR","CHARACTER VARYING","CHARACTER","DECIMAL","INT","INT2","INT4","INT8","INTEGER","NCHAR","NUMERIC","NVARCHAR","SMALLINT","TEXT","VARBYTE","VARCHAR"],CPe=Me(["SELECT [ALL | DISTINCT]"]),IPe=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY","HAVING","PARTITION BY","ORDER BY","LIMIT","OFFSET","INSERT INTO","VALUES","SET"]),JG=Me(["CREATE [TEMPORARY | TEMP | LOCAL TEMPORARY | LOCAL TEMP] TABLE [IF NOT EXISTS]"]),pC=Me(["CREATE [OR REPLACE | MATERIALIZED] VIEW","UPDATE","DELETE [FROM]","DROP TABLE [IF EXISTS]","ALTER TABLE","ALTER TABLE APPEND","ADD [COLUMN]","DROP [COLUMN]","RENAME TO","RENAME COLUMN","ALTER COLUMN","TYPE","ENCODE","TRUNCATE [TABLE]","ABORT","ALTER DATABASE","ALTER DATASHARE","ALTER DEFAULT PRIVILEGES","ALTER GROUP","ALTER MATERIALIZED VIEW","ALTER PROCEDURE","ALTER SCHEMA","ALTER USER","ANALYSE","ANALYZE","ANALYSE COMPRESSION","ANALYZE COMPRESSION","BEGIN","CALL","CANCEL","CLOSE","COMMIT","COPY","CREATE DATABASE","CREATE DATASHARE","CREATE EXTERNAL FUNCTION","CREATE EXTERNAL SCHEMA","CREATE EXTERNAL TABLE","CREATE FUNCTION","CREATE GROUP","CREATE LIBRARY","CREATE MODEL","CREATE PROCEDURE","CREATE SCHEMA","CREATE USER","DEALLOCATE","DECLARE","DESC DATASHARE","DROP DATABASE","DROP DATASHARE","DROP FUNCTION","DROP GROUP","DROP LIBRARY","DROP MODEL","DROP MATERIALIZED VIEW","DROP PROCEDURE","DROP SCHEMA","DROP USER","DROP VIEW","DROP","EXECUTE","EXPLAIN","FETCH","GRANT","LOCK","PREPARE","REFRESH MATERIALIZED VIEW","RESET","REVOKE","ROLLBACK","SELECT INTO","SET SESSION AUTHORIZATION","SET SESSION CHARACTERISTICS","SHOW","SHOW EXTERNAL TABLE","SHOW MODEL","SHOW DATASHARES","SHOW PROCEDURE","SHOW TABLE","SHOW VIEW","START TRANSACTION","UNLOAD","VACUUM"]),OPe=Me(["UNION [ALL]","EXCEPT","INTERSECT","MINUS"]),LPe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"]),MPe=Me(["NULL AS","DATA CATALOG","HIVE METASTORE","{ROWS | RANGE} BETWEEN"]),DPe={name:"redshift",tokenizerOptions:{reservedSelect:CPe,reservedClauses:[...IPe,...JG,...pC],reservedSetOperations:OPe,reservedJoins:LPe,reservedPhrases:MPe,reservedKeywords:_Pe,reservedDataTypes:wPe,reservedFunctionNames:NPe,stringTypes:["''-qq"],identTypes:['""-qq'],identChars:{first:"#"},paramTypes:{numbered:["$"]},operators:["^","%","@","|/","||/","&","|","~","<<",">>","||","::"]},formatOptions:{alwaysDenseOperators:["::"],onelineClauses:[...JG,...pC],tabularOnelineClauses:pC}},PPe=["ADD","AFTER","ALL","ALTER","ANALYZE","AND","ANTI","ANY","ARCHIVE","AS","ASC","AT","AUTHORIZATION","BETWEEN","BOTH","BUCKET","BUCKETS","BY","CACHE","CASCADE","CAST","CHANGE","CHECK","CLEAR","CLUSTER","CLUSTERED","CODEGEN","COLLATE","COLLECTION","COLUMN","COLUMNS","COMMENT","COMMIT","COMPACT","COMPACTIONS","COMPUTE","CONCATENATE","CONSTRAINT","COST","CREATE","CROSS","CUBE","CURRENT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","DATA","DATABASE","DATABASES","DAY","DBPROPERTIES","DEFINED","DELETE","DELIMITED","DESC","DESCRIBE","DFS","DIRECTORIES","DIRECTORY","DISTINCT","DISTRIBUTE","DIV","DROP","ESCAPE","ESCAPED","EXCEPT","EXCHANGE","EXISTS","EXPORT","EXTENDED","EXTERNAL","EXTRACT","FALSE","FETCH","FIELDS","FILTER","FILEFORMAT","FIRST","FIRST_VALUE","FOLLOWING","FOR","FOREIGN","FORMAT","FORMATTED","FULL","FUNCTION","FUNCTIONS","GLOBAL","GRANT","GROUP","GROUPING","HOUR","IF","IGNORE","IMPORT","IN","INDEX","INDEXES","INNER","INPATH","INPUTFORMAT","INTERSECT","INTO","IS","ITEMS","KEYS","LAST","LAST_VALUE","LATERAL","LAZY","LEADING","LEFT","LIKE","LINES","LIST","LOCAL","LOCATION","LOCK","LOCKS","LOGICAL","MACRO","MATCHED","MERGE","MINUTE","MONTH","MSCK","NAMESPACE","NAMESPACES","NATURAL","NO","NOT","NULL","NULLS","OF","ONLY","OPTION","OPTIONS","OR","ORDER","OUT","OUTER","OUTPUTFORMAT","OVER","OVERLAPS","OVERLAY","OVERWRITE","OWNER","PARTITION","PARTITIONED","PARTITIONS","PERCENT","PLACING","POSITION","PRECEDING","PRIMARY","PRINCIPALS","PROPERTIES","PURGE","QUERY","RANGE","RECORDREADER","RECORDWRITER","RECOVER","REDUCE","REFERENCES","RENAME","REPAIR","REPLACE","RESPECT","RESTRICT","REVOKE","RIGHT","RLIKE","ROLE","ROLES","ROLLBACK","ROLLUP","ROW","ROWS","SCHEMA","SECOND","SELECT","SEMI","SEPARATED","SERDE","SERDEPROPERTIES","SESSION_USER","SETS","SHOW","SKEWED","SOME","SORT","SORTED","START","STATISTICS","STORED","STRATIFY","SUBSTR","SUBSTRING","TABLE","TABLES","TBLPROPERTIES","TEMPORARY","TERMINATED","THEN","TO","TOUCH","TRAILING","TRANSACTION","TRANSACTIONS","TRIM","TRUE","TRUNCATE","UNARCHIVE","UNBOUNDED","UNCACHE","UNIQUE","UNKNOWN","UNLOCK","UNSET","USE","USER","USING","VIEW","WINDOW","YEAR","ANALYSE","ARRAY_ZIP","COALESCE","CONTAINS","CONVERT","DAYS","DAY_HOUR","DAY_MINUTE","DAY_SECOND","DECODE","DEFAULT","DISTINCTROW","ENCODE","EXPLODE","EXPLODE_OUTER","FIXED","GREATEST","GROUP_CONCAT","HOURS","HOUR_MINUTE","HOUR_SECOND","IFNULL","LEAST","LEVEL","MINUTE_SECOND","NULLIF","OFFSET","ON","OPTIMIZE","REGEXP","SEPARATOR","SIZE","TYPE","TYPES","UNSIGNED","VARIABLES","YEAR_MONTH"],kPe=["ARRAY","BIGINT","BINARY","BOOLEAN","BYTE","CHAR","DATE","DEC","DECIMAL","DOUBLE","FLOAT","INT","INTEGER","INTERVAL","LONG","MAP","NUMERIC","REAL","SHORT","SMALLINT","STRING","STRUCT","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP","TINYINT","VARCHAR"],jPe=["APPROX_COUNT_DISTINCT","APPROX_PERCENTILE","AVG","BIT_AND","BIT_OR","BIT_XOR","BOOL_AND","BOOL_OR","COLLECT_LIST","COLLECT_SET","CORR","COUNT","COUNT","COUNT","COUNT_IF","COUNT_MIN_SKETCH","COVAR_POP","COVAR_SAMP","EVERY","FIRST","FIRST_VALUE","GROUPING","GROUPING_ID","KURTOSIS","LAST","LAST_VALUE","MAX","MAX_BY","MEAN","MIN","MIN_BY","PERCENTILE","PERCENTILE","PERCENTILE_APPROX","SKEWNESS","STD","STDDEV","STDDEV_POP","STDDEV_SAMP","SUM","VAR_POP","VAR_SAMP","VARIANCE","CUME_DIST","DENSE_RANK","LAG","LEAD","NTH_VALUE","NTILE","PERCENT_RANK","RANK","ROW_NUMBER","ARRAY","ARRAY_CONTAINS","ARRAY_DISTINCT","ARRAY_EXCEPT","ARRAY_INTERSECT","ARRAY_JOIN","ARRAY_MAX","ARRAY_MIN","ARRAY_POSITION","ARRAY_REMOVE","ARRAY_REPEAT","ARRAY_UNION","ARRAYS_OVERLAP","ARRAYS_ZIP","FLATTEN","SEQUENCE","SHUFFLE","SLICE","SORT_ARRAY","ELEMENT_AT","ELEMENT_AT","MAP_CONCAT","MAP_ENTRIES","MAP_FROM_ARRAYS","MAP_FROM_ENTRIES","MAP_KEYS","MAP_VALUES","STR_TO_MAP","ADD_MONTHS","CURRENT_DATE","CURRENT_DATE","CURRENT_TIMESTAMP","CURRENT_TIMESTAMP","CURRENT_TIMEZONE","DATE_ADD","DATE_FORMAT","DATE_FROM_UNIX_DATE","DATE_PART","DATE_SUB","DATE_TRUNC","DATEDIFF","DAY","DAYOFMONTH","DAYOFWEEK","DAYOFYEAR","EXTRACT","FROM_UNIXTIME","FROM_UTC_TIMESTAMP","HOUR","LAST_DAY","MAKE_DATE","MAKE_DT_INTERVAL","MAKE_INTERVAL","MAKE_TIMESTAMP","MAKE_YM_INTERVAL","MINUTE","MONTH","MONTHS_BETWEEN","NEXT_DAY","NOW","QUARTER","SECOND","SESSION_WINDOW","TIMESTAMP_MICROS","TIMESTAMP_MILLIS","TIMESTAMP_SECONDS","TO_DATE","TO_TIMESTAMP","TO_UNIX_TIMESTAMP","TO_UTC_TIMESTAMP","TRUNC","UNIX_DATE","UNIX_MICROS","UNIX_MILLIS","UNIX_SECONDS","UNIX_TIMESTAMP","WEEKDAY","WEEKOFYEAR","WINDOW","YEAR","FROM_JSON","GET_JSON_OBJECT","JSON_ARRAY_LENGTH","JSON_OBJECT_KEYS","JSON_TUPLE","SCHEMA_OF_JSON","TO_JSON","ABS","ACOS","ACOSH","AGGREGATE","ARRAY_SORT","ASCII","ASIN","ASINH","ASSERT_TRUE","ATAN","ATAN2","ATANH","BASE64","BIN","BIT_COUNT","BIT_GET","BIT_LENGTH","BROUND","BTRIM","CARDINALITY","CBRT","CEIL","CEILING","CHAR_LENGTH","CHARACTER_LENGTH","CHR","CONCAT","CONCAT_WS","CONV","COS","COSH","COT","CRC32","CURRENT_CATALOG","CURRENT_DATABASE","CURRENT_USER","DEGREES","ELT","EXP","EXPM1","FACTORIAL","FIND_IN_SET","FLOOR","FORALL","FORMAT_NUMBER","FORMAT_STRING","FROM_CSV","GETBIT","HASH","HEX","HYPOT","INITCAP","INLINE","INLINE_OUTER","INPUT_FILE_BLOCK_LENGTH","INPUT_FILE_BLOCK_START","INPUT_FILE_NAME","INSTR","ISNAN","ISNOTNULL","ISNULL","JAVA_METHOD","LCASE","LEFT","LENGTH","LEVENSHTEIN","LN","LOCATE","LOG","LOG10","LOG1P","LOG2","LOWER","LPAD","LTRIM","MAP_FILTER","MAP_ZIP_WITH","MD5","MOD","MONOTONICALLY_INCREASING_ID","NAMED_STRUCT","NANVL","NEGATIVE","NVL","NVL2","OCTET_LENGTH","OVERLAY","PARSE_URL","PI","PMOD","POSEXPLODE","POSEXPLODE_OUTER","POSITION","POSITIVE","POW","POWER","PRINTF","RADIANS","RAISE_ERROR","RAND","RANDN","RANDOM","REFLECT","REGEXP_EXTRACT","REGEXP_EXTRACT_ALL","REGEXP_LIKE","REGEXP_REPLACE","REPEAT","REPLACE","REVERSE","RIGHT","RINT","ROUND","RPAD","RTRIM","SCHEMA_OF_CSV","SENTENCES","SHA","SHA1","SHA2","SHIFTLEFT","SHIFTRIGHT","SHIFTRIGHTUNSIGNED","SIGN","SIGNUM","SIN","SINH","SOUNDEX","SPACE","SPARK_PARTITION_ID","SPLIT","SQRT","STACK","SUBSTR","SUBSTRING","SUBSTRING_INDEX","TAN","TANH","TO_CSV","TRANSFORM_KEYS","TRANSFORM_VALUES","TRANSLATE","TRIM","TRY_ADD","TRY_DIVIDE","TYPEOF","UCASE","UNBASE64","UNHEX","UPPER","UUID","VERSION","WIDTH_BUCKET","XPATH","XPATH_BOOLEAN","XPATH_DOUBLE","XPATH_FLOAT","XPATH_INT","XPATH_LONG","XPATH_NUMBER","XPATH_SHORT","XPATH_STRING","XXHASH64","ZIP_WITH","CAST","COALESCE","NULLIF"],UPe=Me(["SELECT [ALL | DISTINCT]"]),FPe=Me(["WITH","FROM","WHERE","GROUP BY","HAVING","WINDOW","PARTITION BY","ORDER BY","SORT BY","CLUSTER BY","DISTRIBUTE BY","LIMIT","INSERT [INTO | OVERWRITE] [TABLE]","VALUES","INSERT OVERWRITE [LOCAL] DIRECTORY","LOAD DATA [LOCAL] INPATH","[OVERWRITE] INTO TABLE"]),ZG=Me(["CREATE [EXTERNAL] TABLE [IF NOT EXISTS]"]),gC=Me(["CREATE [OR REPLACE] [GLOBAL TEMPORARY | TEMPORARY] VIEW [IF NOT EXISTS]","DROP TABLE [IF EXISTS]","ALTER TABLE","ADD COLUMNS","DROP {COLUMN | COLUMNS}","RENAME TO","RENAME COLUMN","ALTER COLUMN","TRUNCATE TABLE","LATERAL VIEW","ALTER DATABASE","ALTER VIEW","CREATE DATABASE","CREATE FUNCTION","DROP DATABASE","DROP FUNCTION","DROP VIEW","REPAIR TABLE","USE DATABASE","TABLESAMPLE","PIVOT","TRANSFORM","EXPLAIN","ADD FILE","ADD JAR","ANALYZE TABLE","CACHE TABLE","CLEAR CACHE","DESCRIBE DATABASE","DESCRIBE FUNCTION","DESCRIBE QUERY","DESCRIBE TABLE","LIST FILE","LIST JAR","REFRESH","REFRESH TABLE","REFRESH FUNCTION","RESET","SHOW COLUMNS","SHOW CREATE TABLE","SHOW DATABASES","SHOW FUNCTIONS","SHOW PARTITIONS","SHOW TABLE EXTENDED","SHOW TABLES","SHOW TBLPROPERTIES","SHOW VIEWS","UNCACHE TABLE"]),$Pe=Me(["UNION [ALL | DISTINCT]","EXCEPT [ALL | DISTINCT]","INTERSECT [ALL | DISTINCT]"]),BPe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN","[LEFT] {ANTI | SEMI} JOIN","NATURAL [LEFT] {ANTI | SEMI} JOIN"]),HPe=Me(["ON DELETE","ON UPDATE","CURRENT ROW","{ROWS | RANGE} BETWEEN"]),VPe={name:"spark",tokenizerOptions:{reservedSelect:UPe,reservedClauses:[...FPe,...ZG,...gC],reservedSetOperations:$Pe,reservedJoins:BPe,reservedPhrases:HPe,supportsXor:!0,reservedKeywords:PPe,reservedDataTypes:kPe,reservedFunctionNames:jPe,extraParens:["[]"],stringTypes:["''-bs",'""-bs',{quote:"''-raw",prefixes:["R","X"],requirePrefix:!0},{quote:'""-raw',prefixes:["R","X"],requirePrefix:!0}],identTypes:["``"],identChars:{allowFirstCharNumber:!0},variableTypes:[{quote:"{}",prefixes:["$"],requirePrefix:!0}],operators:["%","~","^","|","&","<=>","==","!","||","->"],postProcess:GPe},formatOptions:{onelineClauses:[...ZG,...gC],tabularOnelineClauses:gC}};function GPe(e){return e.map((t,n)=>{const r=e[n-1]||Hh,a=e[n+1]||Hh;return _u.WINDOW(t)&&a.type===Ve.OPEN_PAREN?Object.assign(Object.assign({},t),{type:Ve.RESERVED_FUNCTION_NAME}):t.text==="ITEMS"&&t.type===Ve.RESERVED_KEYWORD&&!(r.text==="COLLECTION"&&a.text==="TERMINATED")?Object.assign(Object.assign({},t),{type:Ve.IDENTIFIER,text:t.raw}):t})}const zPe=["ABS","CHANGES","CHAR","COALESCE","FORMAT","GLOB","HEX","IFNULL","IIF","INSTR","LAST_INSERT_ROWID","LENGTH","LIKE","LIKELIHOOD","LIKELY","LOAD_EXTENSION","LOWER","LTRIM","NULLIF","PRINTF","QUOTE","RANDOM","RANDOMBLOB","REPLACE","ROUND","RTRIM","SIGN","SOUNDEX","SQLITE_COMPILEOPTION_GET","SQLITE_COMPILEOPTION_USED","SQLITE_OFFSET","SQLITE_SOURCE_ID","SQLITE_VERSION","SUBSTR","SUBSTRING","TOTAL_CHANGES","TRIM","TYPEOF","UNICODE","UNLIKELY","UPPER","ZEROBLOB","AVG","COUNT","GROUP_CONCAT","MAX","MIN","SUM","TOTAL","DATE","TIME","DATETIME","JULIANDAY","UNIXEPOCH","STRFTIME","row_number","rank","dense_rank","percent_rank","cume_dist","ntile","lag","lead","first_value","last_value","nth_value","ACOS","ACOSH","ASIN","ASINH","ATAN","ATAN2","ATANH","CEIL","CEILING","COS","COSH","DEGREES","EXP","FLOOR","LN","LOG","LOG","LOG10","LOG2","MOD","PI","POW","POWER","RADIANS","SIN","SINH","SQRT","TAN","TANH","TRUNC","JSON","JSON_ARRAY","JSON_ARRAY_LENGTH","JSON_ARRAY_LENGTH","JSON_EXTRACT","JSON_INSERT","JSON_OBJECT","JSON_PATCH","JSON_REMOVE","JSON_REPLACE","JSON_SET","JSON_TYPE","JSON_TYPE","JSON_VALID","JSON_QUOTE","JSON_GROUP_ARRAY","JSON_GROUP_OBJECT","JSON_EACH","JSON_TREE","CAST"],qPe=["ABORT","ACTION","ADD","AFTER","ALL","ALTER","AND","ARE","ALWAYS","ANALYZE","AS","ASC","ATTACH","AUTOINCREMENT","BEFORE","BEGIN","BETWEEN","BY","CASCADE","CASE","CAST","CHECK","COLLATE","COLUMN","COMMIT","CONFLICT","CONSTRAINT","CREATE","CROSS","CURRENT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","DATABASE","DEFAULT","DEFERRABLE","DEFERRED","DELETE","DESC","DETACH","DISTINCT","DO","DROP","EACH","ELSE","END","ESCAPE","EXCEPT","EXCLUDE","EXCLUSIVE","EXISTS","EXPLAIN","FAIL","FILTER","FIRST","FOLLOWING","FOR","FOREIGN","FROM","FULL","GENERATED","GLOB","GROUP","HAVING","IF","IGNORE","IMMEDIATE","IN","INDEX","INDEXED","INITIALLY","INNER","INSERT","INSTEAD","INTERSECT","INTO","IS","ISNULL","JOIN","KEY","LAST","LEFT","LIKE","LIMIT","MATCH","MATERIALIZED","NATURAL","NO","NOT","NOTHING","NOTNULL","NULL","NULLS","OF","OFFSET","ON","ONLY","OPEN","OR","ORDER","OTHERS","OUTER","OVER","PARTITION","PLAN","PRAGMA","PRECEDING","PRIMARY","QUERY","RAISE","RANGE","RECURSIVE","REFERENCES","REGEXP","REINDEX","RELEASE","RENAME","REPLACE","RESTRICT","RETURNING","RIGHT","ROLLBACK","ROW","ROWS","SAVEPOINT","SELECT","SET","TABLE","TEMP","TEMPORARY","THEN","TIES","TO","TRANSACTION","TRIGGER","UNBOUNDED","UNION","UNIQUE","UPDATE","USING","VACUUM","VALUES","VIEW","VIRTUAL","WHEN","WHERE","WINDOW","WITH","WITHOUT"],YPe=["ANY","ARRAY","BLOB","CHARACTER","DECIMAL","INT","INTEGER","NATIVE CHARACTER","NCHAR","NUMERIC","NVARCHAR","REAL","TEXT","VARCHAR","VARYING CHARACTER"],WPe=Me(["SELECT [ALL | DISTINCT]"]),XPe=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY","HAVING","WINDOW","PARTITION BY","ORDER BY","LIMIT","OFFSET","INSERT [OR ABORT | OR FAIL | OR IGNORE | OR REPLACE | OR ROLLBACK] INTO","REPLACE INTO","VALUES","SET"]),e6=Me(["CREATE [TEMPORARY | TEMP] TABLE [IF NOT EXISTS]"]),EC=Me(["CREATE [TEMPORARY | TEMP] VIEW [IF NOT EXISTS]","UPDATE [OR ABORT | OR FAIL | OR IGNORE | OR REPLACE | OR ROLLBACK]","ON CONFLICT","DELETE FROM","DROP TABLE [IF EXISTS]","ALTER TABLE","ADD [COLUMN]","DROP [COLUMN]","RENAME [COLUMN]","RENAME TO","SET SCHEMA"]),KPe=Me(["UNION [ALL]","EXCEPT","INTERSECT"]),QPe=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"]),JPe=Me(["ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]","{ROWS | RANGE | GROUPS} BETWEEN","DO UPDATE"]),ZPe={name:"sqlite",tokenizerOptions:{reservedSelect:WPe,reservedClauses:[...XPe,...e6,...EC],reservedSetOperations:KPe,reservedJoins:QPe,reservedPhrases:JPe,reservedKeywords:qPe,reservedDataTypes:YPe,reservedFunctionNames:zPe,stringTypes:["''-qq",{quote:"''-raw",prefixes:["X"],requirePrefix:!0}],identTypes:['""-qq',"``","[]"],paramTypes:{positional:!0,numbered:["?"],named:[":","@","$"]},operators:["%","~","&","|","<<",">>","==","->","->>","||"]},formatOptions:{onelineClauses:[...e6,...EC],tabularOnelineClauses:EC}},e2e=["GROUPING","RANK","DENSE_RANK","PERCENT_RANK","CUME_DIST","ROW_NUMBER","POSITION","OCCURRENCES_REGEX","POSITION_REGEX","EXTRACT","CHAR_LENGTH","CHARACTER_LENGTH","OCTET_LENGTH","CARDINALITY","ABS","MOD","LN","EXP","POWER","SQRT","FLOOR","CEIL","CEILING","WIDTH_BUCKET","SUBSTRING","SUBSTRING_REGEX","UPPER","LOWER","CONVERT","TRANSLATE","TRANSLATE_REGEX","TRIM","OVERLAY","NORMALIZE","SPECIFICTYPE","CURRENT_DATE","CURRENT_TIME","LOCALTIME","CURRENT_TIMESTAMP","LOCALTIMESTAMP","COUNT","AVG","MAX","MIN","SUM","STDDEV_POP","STDDEV_SAMP","VAR_SAMP","VAR_POP","COLLECT","FUSION","INTERSECTION","COVAR_POP","COVAR_SAMP","CORR","REGR_SLOPE","REGR_INTERCEPT","REGR_COUNT","REGR_R2","REGR_AVGX","REGR_AVGY","REGR_SXX","REGR_SYY","REGR_SXY","PERCENTILE_CONT","PERCENTILE_DISC","CAST","COALESCE","NULLIF","ROUND","SIN","COS","TAN","ASIN","ACOS","ATAN"],t2e=["ALL","ALLOCATE","ALTER","ANY","ARE","AS","ASC","ASENSITIVE","ASYMMETRIC","AT","ATOMIC","AUTHORIZATION","BEGIN","BETWEEN","BOTH","BY","CALL","CALLED","CASCADED","CAST","CHECK","CLOSE","COALESCE","COLLATE","COLUMN","COMMIT","CONDITION","CONNECT","CONSTRAINT","CORRESPONDING","CREATE","CROSS","CUBE","CURRENT","CURRENT_CATALOG","CURRENT_DEFAULT_TRANSFORM_GROUP","CURRENT_PATH","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_TRANSFORM_GROUP_FOR_TYPE","CURRENT_USER","CURSOR","CYCLE","DEALLOCATE","DAY","DECLARE","DEFAULT","DELETE","DEREF","DESC","DESCRIBE","DETERMINISTIC","DISCONNECT","DISTINCT","DROP","DYNAMIC","EACH","ELEMENT","END-EXEC","ESCAPE","EVERY","EXCEPT","EXEC","EXECUTE","EXISTS","EXTERNAL","FALSE","FETCH","FILTER","FOR","FOREIGN","FREE","FROM","FULL","FUNCTION","GET","GLOBAL","GRANT","GROUP","HAVING","HOLD","HOUR","IDENTITY","IN","INDICATOR","INNER","INOUT","INSENSITIVE","INSERT","INTERSECT","INTO","IS","LANGUAGE","LARGE","LATERAL","LEADING","LEFT","LIKE","LIKE_REGEX","LOCAL","MATCH","MEMBER","MERGE","METHOD","MINUTE","MODIFIES","MODULE","MONTH","NATURAL","NEW","NO","NONE","NOT","NULL","NULLIF","OF","OLD","ON","ONLY","OPEN","ORDER","OUT","OUTER","OVER","OVERLAPS","PARAMETER","PARTITION","PRECISION","PREPARE","PRIMARY","PROCEDURE","RANGE","READS","REAL","RECURSIVE","REF","REFERENCES","REFERENCING","RELEASE","RESULT","RETURN","RETURNS","REVOKE","RIGHT","ROLLBACK","ROLLUP","ROW","ROWS","SAVEPOINT","SCOPE","SCROLL","SEARCH","SECOND","SELECT","SENSITIVE","SESSION_USER","SET","SIMILAR","SOME","SPECIFIC","SQL","SQLEXCEPTION","SQLSTATE","SQLWARNING","START","STATIC","SUBMULTISET","SYMMETRIC","SYSTEM","SYSTEM_USER","TABLE","TABLESAMPLE","THEN","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRANSLATION","TREAT","TRIGGER","TRUE","UESCAPE","UNION","UNIQUE","UNKNOWN","UNNEST","UPDATE","USER","USING","VALUE","VALUES","WHENEVER","WINDOW","WITHIN","WITHOUT","YEAR"],n2e=["ARRAY","BIGINT","BINARY LARGE OBJECT","BINARY VARYING","BINARY","BLOB","BOOLEAN","CHAR LARGE OBJECT","CHAR VARYING","CHAR","CHARACTER LARGE OBJECT","CHARACTER VARYING","CHARACTER","CLOB","DATE","DEC","DECIMAL","DOUBLE","FLOAT","INT","INTEGER","INTERVAL","MULTISET","NATIONAL CHAR VARYING","NATIONAL CHAR","NATIONAL CHARACTER LARGE OBJECT","NATIONAL CHARACTER VARYING","NATIONAL CHARACTER","NCHAR LARGE OBJECT","NCHAR VARYING","NCHAR","NCLOB","NUMERIC","SMALLINT","TIME","TIMESTAMP","VARBINARY","VARCHAR"],r2e=Me(["SELECT [ALL | DISTINCT]"]),a2e=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY [ALL | DISTINCT]","HAVING","WINDOW","PARTITION BY","ORDER BY","LIMIT","OFFSET","FETCH {FIRST | NEXT}","INSERT INTO","VALUES","SET"]),t6=Me(["CREATE [GLOBAL TEMPORARY | LOCAL TEMPORARY] TABLE"]),TC=Me(["CREATE [RECURSIVE] VIEW","UPDATE","WHERE CURRENT OF","DELETE FROM","DROP TABLE","ALTER TABLE","ADD COLUMN","DROP [COLUMN]","RENAME COLUMN","RENAME TO","ALTER [COLUMN]","{SET | DROP} DEFAULT","ADD SCOPE","DROP SCOPE {CASCADE | RESTRICT}","RESTART WITH","TRUNCATE TABLE","SET SCHEMA"]),s2e=Me(["UNION [ALL | DISTINCT]","EXCEPT [ALL | DISTINCT]","INTERSECT [ALL | DISTINCT]"]),i2e=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"]),o2e=Me(["ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]","{ROWS | RANGE} BETWEEN"]),l2e={name:"sql",tokenizerOptions:{reservedSelect:r2e,reservedClauses:[...a2e,...t6,...TC],reservedSetOperations:s2e,reservedJoins:i2e,reservedPhrases:o2e,reservedKeywords:t2e,reservedDataTypes:n2e,reservedFunctionNames:e2e,stringTypes:[{quote:"''-qq-bs",prefixes:["N","U&"]},{quote:"''-raw",prefixes:["X"],requirePrefix:!0}],identTypes:['""-qq',"``"],paramTypes:{positional:!0},operators:["||"]},formatOptions:{onelineClauses:[...t6,...TC],tabularOnelineClauses:TC}},c2e=["ABS","ACOS","ALL_MATCH","ANY_MATCH","APPROX_DISTINCT","APPROX_MOST_FREQUENT","APPROX_PERCENTILE","APPROX_SET","ARBITRARY","ARRAYS_OVERLAP","ARRAY_AGG","ARRAY_DISTINCT","ARRAY_EXCEPT","ARRAY_INTERSECT","ARRAY_JOIN","ARRAY_MAX","ARRAY_MIN","ARRAY_POSITION","ARRAY_REMOVE","ARRAY_SORT","ARRAY_UNION","ASIN","ATAN","ATAN2","AT_TIMEZONE","AVG","BAR","BETA_CDF","BING_TILE","BING_TILES_AROUND","BING_TILE_AT","BING_TILE_COORDINATES","BING_TILE_POLYGON","BING_TILE_QUADKEY","BING_TILE_ZOOM_LEVEL","BITWISE_AND","BITWISE_AND_AGG","BITWISE_LEFT_SHIFT","BITWISE_NOT","BITWISE_OR","BITWISE_OR_AGG","BITWISE_RIGHT_SHIFT","BITWISE_RIGHT_SHIFT_ARITHMETIC","BITWISE_XOR","BIT_COUNT","BOOL_AND","BOOL_OR","CARDINALITY","CAST","CBRT","CEIL","CEILING","CHAR2HEXINT","CHECKSUM","CHR","CLASSIFY","COALESCE","CODEPOINT","COLOR","COMBINATIONS","CONCAT","CONCAT_WS","CONTAINS","CONTAINS_SEQUENCE","CONVEX_HULL_AGG","CORR","COS","COSH","COSINE_SIMILARITY","COUNT","COUNT_IF","COVAR_POP","COVAR_SAMP","CRC32","CUME_DIST","CURRENT_CATALOG","CURRENT_DATE","CURRENT_GROUPS","CURRENT_SCHEMA","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_TIMEZONE","CURRENT_USER","DATE","DATE_ADD","DATE_DIFF","DATE_FORMAT","DATE_PARSE","DATE_TRUNC","DAY","DAY_OF_MONTH","DAY_OF_WEEK","DAY_OF_YEAR","DEGREES","DENSE_RANK","DOW","DOY","E","ELEMENT_AT","EMPTY_APPROX_SET","EVALUATE_CLASSIFIER_PREDICTIONS","EVERY","EXP","EXTRACT","FEATURES","FILTER","FIRST_VALUE","FLATTEN","FLOOR","FORMAT","FORMAT_DATETIME","FORMAT_NUMBER","FROM_BASE","FROM_BASE32","FROM_BASE64","FROM_BASE64URL","FROM_BIG_ENDIAN_32","FROM_BIG_ENDIAN_64","FROM_ENCODED_POLYLINE","FROM_GEOJSON_GEOMETRY","FROM_HEX","FROM_IEEE754_32","FROM_IEEE754_64","FROM_ISO8601_DATE","FROM_ISO8601_TIMESTAMP","FROM_ISO8601_TIMESTAMP_NANOS","FROM_UNIXTIME","FROM_UNIXTIME_NANOS","FROM_UTF8","GEOMETRIC_MEAN","GEOMETRY_FROM_HADOOP_SHAPE","GEOMETRY_INVALID_REASON","GEOMETRY_NEAREST_POINTS","GEOMETRY_TO_BING_TILES","GEOMETRY_UNION","GEOMETRY_UNION_AGG","GREATEST","GREAT_CIRCLE_DISTANCE","HAMMING_DISTANCE","HASH_COUNTS","HISTOGRAM","HMAC_MD5","HMAC_SHA1","HMAC_SHA256","HMAC_SHA512","HOUR","HUMAN_READABLE_SECONDS","IF","INDEX","INFINITY","INTERSECTION_CARDINALITY","INVERSE_BETA_CDF","INVERSE_NORMAL_CDF","IS_FINITE","IS_INFINITE","IS_JSON_SCALAR","IS_NAN","JACCARD_INDEX","JSON_ARRAY_CONTAINS","JSON_ARRAY_GET","JSON_ARRAY_LENGTH","JSON_EXISTS","JSON_EXTRACT","JSON_EXTRACT_SCALAR","JSON_FORMAT","JSON_PARSE","JSON_QUERY","JSON_SIZE","JSON_VALUE","KURTOSIS","LAG","LAST_DAY_OF_MONTH","LAST_VALUE","LEAD","LEARN_CLASSIFIER","LEARN_LIBSVM_CLASSIFIER","LEARN_LIBSVM_REGRESSOR","LEARN_REGRESSOR","LEAST","LENGTH","LEVENSHTEIN_DISTANCE","LINE_INTERPOLATE_POINT","LINE_INTERPOLATE_POINTS","LINE_LOCATE_POINT","LISTAGG","LN","LOCALTIME","LOCALTIMESTAMP","LOG","LOG10","LOG2","LOWER","LPAD","LTRIM","LUHN_CHECK","MAKE_SET_DIGEST","MAP","MAP_AGG","MAP_CONCAT","MAP_ENTRIES","MAP_FILTER","MAP_FROM_ENTRIES","MAP_KEYS","MAP_UNION","MAP_VALUES","MAP_ZIP_WITH","MAX","MAX_BY","MD5","MERGE","MERGE_SET_DIGEST","MILLISECOND","MIN","MINUTE","MIN_BY","MOD","MONTH","MULTIMAP_AGG","MULTIMAP_FROM_ENTRIES","MURMUR3","NAN","NGRAMS","NONE_MATCH","NORMALIZE","NORMAL_CDF","NOW","NTH_VALUE","NTILE","NULLIF","NUMERIC_HISTOGRAM","OBJECTID","OBJECTID_TIMESTAMP","PARSE_DATA_SIZE","PARSE_DATETIME","PARSE_DURATION","PERCENT_RANK","PI","POSITION","POW","POWER","QDIGEST_AGG","QUARTER","RADIANS","RAND","RANDOM","RANK","REDUCE","REDUCE_AGG","REGEXP_COUNT","REGEXP_EXTRACT","REGEXP_EXTRACT_ALL","REGEXP_LIKE","REGEXP_POSITION","REGEXP_REPLACE","REGEXP_SPLIT","REGRESS","REGR_INTERCEPT","REGR_SLOPE","RENDER","REPEAT","REPLACE","REVERSE","RGB","ROUND","ROW_NUMBER","RPAD","RTRIM","SECOND","SEQUENCE","SHA1","SHA256","SHA512","SHUFFLE","SIGN","SIMPLIFY_GEOMETRY","SIN","SKEWNESS","SLICE","SOUNDEX","SPATIAL_PARTITIONING","SPATIAL_PARTITIONS","SPLIT","SPLIT_PART","SPLIT_TO_MAP","SPLIT_TO_MULTIMAP","SPOOKY_HASH_V2_32","SPOOKY_HASH_V2_64","SQRT","STARTS_WITH","STDDEV","STDDEV_POP","STDDEV_SAMP","STRPOS","ST_AREA","ST_ASBINARY","ST_ASTEXT","ST_BOUNDARY","ST_BUFFER","ST_CENTROID","ST_CONTAINS","ST_CONVEXHULL","ST_COORDDIM","ST_CROSSES","ST_DIFFERENCE","ST_DIMENSION","ST_DISJOINT","ST_DISTANCE","ST_ENDPOINT","ST_ENVELOPE","ST_ENVELOPEASPTS","ST_EQUALS","ST_EXTERIORRING","ST_GEOMETRIES","ST_GEOMETRYFROMTEXT","ST_GEOMETRYN","ST_GEOMETRYTYPE","ST_GEOMFROMBINARY","ST_INTERIORRINGN","ST_INTERIORRINGS","ST_INTERSECTION","ST_INTERSECTS","ST_ISCLOSED","ST_ISEMPTY","ST_ISRING","ST_ISSIMPLE","ST_ISVALID","ST_LENGTH","ST_LINEFROMTEXT","ST_LINESTRING","ST_MULTIPOINT","ST_NUMGEOMETRIES","ST_NUMINTERIORRING","ST_NUMPOINTS","ST_OVERLAPS","ST_POINT","ST_POINTN","ST_POINTS","ST_POLYGON","ST_RELATE","ST_STARTPOINT","ST_SYMDIFFERENCE","ST_TOUCHES","ST_UNION","ST_WITHIN","ST_X","ST_XMAX","ST_XMIN","ST_Y","ST_YMAX","ST_YMIN","SUBSTR","SUBSTRING","SUM","TAN","TANH","TDIGEST_AGG","TIMESTAMP_OBJECTID","TIMEZONE_HOUR","TIMEZONE_MINUTE","TO_BASE","TO_BASE32","TO_BASE64","TO_BASE64URL","TO_BIG_ENDIAN_32","TO_BIG_ENDIAN_64","TO_CHAR","TO_DATE","TO_ENCODED_POLYLINE","TO_GEOJSON_GEOMETRY","TO_GEOMETRY","TO_HEX","TO_IEEE754_32","TO_IEEE754_64","TO_ISO8601","TO_MILLISECONDS","TO_SPHERICAL_GEOGRAPHY","TO_TIMESTAMP","TO_UNIXTIME","TO_UTF8","TRANSFORM","TRANSFORM_KEYS","TRANSFORM_VALUES","TRANSLATE","TRIM","TRIM_ARRAY","TRUNCATE","TRY","TRY_CAST","TYPEOF","UPPER","URL_DECODE","URL_ENCODE","URL_EXTRACT_FRAGMENT","URL_EXTRACT_HOST","URL_EXTRACT_PARAMETER","URL_EXTRACT_PATH","URL_EXTRACT_PORT","URL_EXTRACT_PROTOCOL","URL_EXTRACT_QUERY","UUID","VALUES_AT_QUANTILES","VALUE_AT_QUANTILE","VARIANCE","VAR_POP","VAR_SAMP","VERSION","WEEK","WEEK_OF_YEAR","WIDTH_BUCKET","WILSON_INTERVAL_LOWER","WILSON_INTERVAL_UPPER","WITH_TIMEZONE","WORD_STEM","XXHASH64","YEAR","YEAR_OF_WEEK","YOW","ZIP","ZIP_WITH","CLASSIFIER","FIRST","LAST","MATCH_NUMBER","NEXT","PERMUTE","PREV"],u2e=["ABSENT","ADD","ADMIN","AFTER","ALL","ALTER","ANALYZE","AND","ANY","AS","ASC","AT","AUTHORIZATION","BERNOULLI","BETWEEN","BOTH","BY","CALL","CASCADE","CASE","CATALOGS","COLUMN","COLUMNS","COMMENT","COMMIT","COMMITTED","CONDITIONAL","CONSTRAINT","COPARTITION","CREATE","CROSS","CUBE","CURRENT","CURRENT_PATH","CURRENT_ROLE","DATA","DEALLOCATE","DEFAULT","DEFINE","DEFINER","DELETE","DENY","DESC","DESCRIBE","DESCRIPTOR","DISTINCT","DISTRIBUTED","DOUBLE","DROP","ELSE","EMPTY","ENCODING","END","ERROR","ESCAPE","EXCEPT","EXCLUDING","EXECUTE","EXISTS","EXPLAIN","FALSE","FETCH","FINAL","FIRST","FOLLOWING","FOR","FROM","FULL","FUNCTIONS","GRANT","GRANTED","GRANTS","GRAPHVIZ","GROUP","GROUPING","GROUPS","HAVING","IGNORE","IN","INCLUDING","INITIAL","INNER","INPUT","INSERT","INTERSECT","INTERVAL","INTO","INVOKER","IO","IS","ISOLATION","JOIN","JSON","JSON_ARRAY","JSON_OBJECT","KEEP","KEY","KEYS","LAST","LATERAL","LEADING","LEFT","LEVEL","LIKE","LIMIT","LOCAL","LOGICAL","MATCH","MATCHED","MATCHES","MATCH_RECOGNIZE","MATERIALIZED","MEASURES","NATURAL","NEXT","NFC","NFD","NFKC","NFKD","NO","NONE","NOT","NULL","NULLS","OBJECT","OF","OFFSET","OMIT","ON","ONE","ONLY","OPTION","OR","ORDER","ORDINALITY","OUTER","OUTPUT","OVER","OVERFLOW","PARTITION","PARTITIONS","PASSING","PAST","PATH","PATTERN","PER","PERMUTE","PRECEDING","PRECISION","PREPARE","PRIVILEGES","PROPERTIES","PRUNE","QUOTES","RANGE","READ","RECURSIVE","REFRESH","RENAME","REPEATABLE","RESET","RESPECT","RESTRICT","RETURNING","REVOKE","RIGHT","ROLE","ROLES","ROLLBACK","ROLLUP","ROW","ROWS","RUNNING","SCALAR","SCHEMA","SCHEMAS","SECURITY","SEEK","SELECT","SERIALIZABLE","SESSION","SET","SETS","SHOW","SKIP","SOME","START","STATS","STRING","SUBSET","SYSTEM","TABLE","TABLES","TABLESAMPLE","TEXT","THEN","TIES","TIME","TIMESTAMP","TO","TRAILING","TRANSACTION","TRUE","TYPE","UESCAPE","UNBOUNDED","UNCOMMITTED","UNCONDITIONAL","UNION","UNIQUE","UNKNOWN","UNMATCHED","UNNEST","UPDATE","USE","USER","USING","UTF16","UTF32","UTF8","VALIDATE","VALUE","VALUES","VERBOSE","VIEW","WHEN","WHERE","WINDOW","WITH","WITHIN","WITHOUT","WORK","WRAPPER","WRITE","ZONE"],d2e=["BIGINT","INT","INTEGER","SMALLINT","TINYINT","BOOLEAN","DATE","DECIMAL","REAL","DOUBLE","HYPERLOGLOG","QDIGEST","TDIGEST","P4HYPERLOGLOG","INTERVAL","TIMESTAMP","TIME","VARBINARY","VARCHAR","CHAR","ROW","ARRAY","MAP","JSON","JSON2016","IPADDRESS","GEOMETRY","UUID","SETDIGEST","JONIREGEXP","RE2JREGEXP","LIKEPATTERN","COLOR","CODEPOINTS","FUNCTION","JSONPATH"],h2e=Me(["SELECT [ALL | DISTINCT]"]),f2e=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY [ALL | DISTINCT]","HAVING","WINDOW","PARTITION BY","ORDER BY","LIMIT","OFFSET","FETCH {FIRST | NEXT}","INSERT INTO","VALUES","SET","MATCH_RECOGNIZE","MEASURES","ONE ROW PER MATCH","ALL ROWS PER MATCH","AFTER MATCH","PATTERN","SUBSET","DEFINE"]),n6=Me(["CREATE TABLE [IF NOT EXISTS]"]),yC=Me(["CREATE [OR REPLACE] [MATERIALIZED] VIEW","UPDATE","DELETE FROM","DROP TABLE [IF EXISTS]","ALTER TABLE [IF EXISTS]","ADD COLUMN [IF NOT EXISTS]","DROP COLUMN [IF EXISTS]","RENAME COLUMN [IF EXISTS]","RENAME TO","SET AUTHORIZATION [USER | ROLE]","SET PROPERTIES","EXECUTE","TRUNCATE TABLE","ALTER SCHEMA","ALTER MATERIALIZED VIEW","ALTER VIEW","CREATE SCHEMA","CREATE ROLE","DROP SCHEMA","DROP MATERIALIZED VIEW","DROP VIEW","DROP ROLE","EXPLAIN","ANALYZE","EXPLAIN ANALYZE","EXPLAIN ANALYZE VERBOSE","USE","DESCRIBE INPUT","DESCRIBE OUTPUT","REFRESH MATERIALIZED VIEW","RESET SESSION","SET SESSION","SET PATH","SET TIME ZONE","SHOW GRANTS","SHOW CREATE TABLE","SHOW CREATE SCHEMA","SHOW CREATE VIEW","SHOW CREATE MATERIALIZED VIEW","SHOW TABLES","SHOW SCHEMAS","SHOW CATALOGS","SHOW COLUMNS","SHOW STATS FOR","SHOW ROLES","SHOW CURRENT ROLES","SHOW ROLE GRANTS","SHOW FUNCTIONS","SHOW SESSION"]),m2e=Me(["UNION [ALL | DISTINCT]","EXCEPT [ALL | DISTINCT]","INTERSECT [ALL | DISTINCT]"]),p2e=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL [INNER] JOIN","NATURAL {LEFT | RIGHT | FULL} [OUTER] JOIN"]),g2e=Me(["{ROWS | RANGE | GROUPS} BETWEEN","IS [NOT] DISTINCT FROM"]),E2e={name:"trino",tokenizerOptions:{reservedSelect:h2e,reservedClauses:[...f2e,...n6,...yC],reservedSetOperations:m2e,reservedJoins:p2e,reservedPhrases:g2e,reservedKeywords:u2e,reservedDataTypes:d2e,reservedFunctionNames:c2e,extraParens:["[]","{}"],stringTypes:[{quote:"''-qq",prefixes:["U&"]},{quote:"''-raw",prefixes:["X"],requirePrefix:!0}],identTypes:['""-qq'],paramTypes:{positional:!0},operators:["%","->","=>",":","||","|","^","$"]},formatOptions:{onelineClauses:[...n6,...yC],tabularOnelineClauses:yC}},T2e=["APPROX_COUNT_DISTINCT","AVG","CHECKSUM_AGG","COUNT","COUNT_BIG","GROUPING","GROUPING_ID","MAX","MIN","STDEV","STDEVP","SUM","VAR","VARP","CUME_DIST","FIRST_VALUE","LAG","LAST_VALUE","LEAD","PERCENTILE_CONT","PERCENTILE_DISC","PERCENT_RANK","Collation - COLLATIONPROPERTY","Collation - TERTIARY_WEIGHTS","@@DBTS","@@LANGID","@@LANGUAGE","@@LOCK_TIMEOUT","@@MAX_CONNECTIONS","@@MAX_PRECISION","@@NESTLEVEL","@@OPTIONS","@@REMSERVER","@@SERVERNAME","@@SERVICENAME","@@SPID","@@TEXTSIZE","@@VERSION","CAST","CONVERT","PARSE","TRY_CAST","TRY_CONVERT","TRY_PARSE","ASYMKEY_ID","ASYMKEYPROPERTY","CERTPROPERTY","CERT_ID","CRYPT_GEN_RANDOM","DECRYPTBYASYMKEY","DECRYPTBYCERT","DECRYPTBYKEY","DECRYPTBYKEYAUTOASYMKEY","DECRYPTBYKEYAUTOCERT","DECRYPTBYPASSPHRASE","ENCRYPTBYASYMKEY","ENCRYPTBYCERT","ENCRYPTBYKEY","ENCRYPTBYPASSPHRASE","HASHBYTES","IS_OBJECTSIGNED","KEY_GUID","KEY_ID","KEY_NAME","SIGNBYASYMKEY","SIGNBYCERT","SYMKEYPROPERTY","VERIFYSIGNEDBYCERT","VERIFYSIGNEDBYASYMKEY","@@CURSOR_ROWS","@@FETCH_STATUS","CURSOR_STATUS","DATALENGTH","IDENT_CURRENT","IDENT_INCR","IDENT_SEED","IDENTITY","SQL_VARIANT_PROPERTY","@@DATEFIRST","CURRENT_TIMESTAMP","CURRENT_TIMEZONE","CURRENT_TIMEZONE_ID","DATEADD","DATEDIFF","DATEDIFF_BIG","DATEFROMPARTS","DATENAME","DATEPART","DATETIME2FROMPARTS","DATETIMEFROMPARTS","DATETIMEOFFSETFROMPARTS","DAY","EOMONTH","GETDATE","GETUTCDATE","ISDATE","MONTH","SMALLDATETIMEFROMPARTS","SWITCHOFFSET","SYSDATETIME","SYSDATETIMEOFFSET","SYSUTCDATETIME","TIMEFROMPARTS","TODATETIMEOFFSET","YEAR","JSON","ISJSON","JSON_VALUE","JSON_QUERY","JSON_MODIFY","ABS","ACOS","ASIN","ATAN","ATN2","CEILING","COS","COT","DEGREES","EXP","FLOOR","LOG","LOG10","PI","POWER","RADIANS","RAND","ROUND","SIGN","SIN","SQRT","SQUARE","TAN","CHOOSE","GREATEST","IIF","LEAST","@@PROCID","APP_NAME","APPLOCK_MODE","APPLOCK_TEST","ASSEMBLYPROPERTY","COL_LENGTH","COL_NAME","COLUMNPROPERTY","DATABASEPROPERTYEX","DB_ID","DB_NAME","FILE_ID","FILE_IDEX","FILE_NAME","FILEGROUP_ID","FILEGROUP_NAME","FILEGROUPPROPERTY","FILEPROPERTY","FILEPROPERTYEX","FULLTEXTCATALOGPROPERTY","FULLTEXTSERVICEPROPERTY","INDEX_COL","INDEXKEY_PROPERTY","INDEXPROPERTY","NEXT VALUE FOR","OBJECT_DEFINITION","OBJECT_ID","OBJECT_NAME","OBJECT_SCHEMA_NAME","OBJECTPROPERTY","OBJECTPROPERTYEX","ORIGINAL_DB_NAME","PARSENAME","SCHEMA_ID","SCHEMA_NAME","SCOPE_IDENTITY","SERVERPROPERTY","STATS_DATE","TYPE_ID","TYPE_NAME","TYPEPROPERTY","DENSE_RANK","NTILE","RANK","ROW_NUMBER","PUBLISHINGSERVERNAME","CERTENCODED","CERTPRIVATEKEY","CURRENT_USER","DATABASE_PRINCIPAL_ID","HAS_DBACCESS","HAS_PERMS_BY_NAME","IS_MEMBER","IS_ROLEMEMBER","IS_SRVROLEMEMBER","LOGINPROPERTY","ORIGINAL_LOGIN","PERMISSIONS","PWDENCRYPT","PWDCOMPARE","SESSION_USER","SESSIONPROPERTY","SUSER_ID","SUSER_NAME","SUSER_SID","SUSER_SNAME","SYSTEM_USER","USER","USER_ID","USER_NAME","ASCII","CHARINDEX","CONCAT","CONCAT_WS","DIFFERENCE","FORMAT","LEFT","LEN","LOWER","LTRIM","PATINDEX","QUOTENAME","REPLACE","REPLICATE","REVERSE","RIGHT","RTRIM","SOUNDEX","SPACE","STR","STRING_AGG","STRING_ESCAPE","STUFF","SUBSTRING","TRANSLATE","TRIM","UNICODE","UPPER","$PARTITION","@@ERROR","@@IDENTITY","@@PACK_RECEIVED","@@ROWCOUNT","@@TRANCOUNT","BINARY_CHECKSUM","CHECKSUM","COMPRESS","CONNECTIONPROPERTY","CONTEXT_INFO","CURRENT_REQUEST_ID","CURRENT_TRANSACTION_ID","DECOMPRESS","ERROR_LINE","ERROR_MESSAGE","ERROR_NUMBER","ERROR_PROCEDURE","ERROR_SEVERITY","ERROR_STATE","FORMATMESSAGE","GET_FILESTREAM_TRANSACTION_CONTEXT","GETANSINULL","HOST_ID","HOST_NAME","ISNULL","ISNUMERIC","MIN_ACTIVE_ROWVERSION","NEWID","NEWSEQUENTIALID","ROWCOUNT_BIG","SESSION_CONTEXT","XACT_STATE","@@CONNECTIONS","@@CPU_BUSY","@@IDLE","@@IO_BUSY","@@PACK_SENT","@@PACKET_ERRORS","@@TIMETICKS","@@TOTAL_ERRORS","@@TOTAL_READ","@@TOTAL_WRITE","TEXTPTR","TEXTVALID","COLUMNS_UPDATED","EVENTDATA","TRIGGER_NESTLEVEL","UPDATE","COALESCE","NULLIF"],y2e=["ADD","ALL","ALTER","AND","ANY","AS","ASC","AUTHORIZATION","BACKUP","BEGIN","BETWEEN","BREAK","BROWSE","BULK","BY","CASCADE","CHECK","CHECKPOINT","CLOSE","CLUSTERED","COALESCE","COLLATE","COLUMN","COMMIT","COMPUTE","CONSTRAINT","CONTAINS","CONTAINSTABLE","CONTINUE","CONVERT","CREATE","CROSS","CURRENT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURSOR","DATABASE","DBCC","DEALLOCATE","DECLARE","DEFAULT","DELETE","DENY","DESC","DISK","DISTINCT","DISTRIBUTED","DROP","DUMP","ERRLVL","ESCAPE","EXEC","EXECUTE","EXISTS","EXIT","EXTERNAL","FETCH","FILE","FILLFACTOR","FOR","FOREIGN","FREETEXT","FREETEXTTABLE","FROM","FULL","FUNCTION","GOTO","GRANT","GROUP","HAVING","HOLDLOCK","IDENTITY","IDENTITYCOL","IDENTITY_INSERT","IF","IN","INDEX","INNER","INSERT","INTERSECT","INTO","IS","JOIN","KEY","KILL","LEFT","LIKE","LINENO","LOAD","MERGE","NOCHECK","NONCLUSTERED","NOT","NULL","NULLIF","OF","OFF","OFFSETS","ON","OPEN","OPENDATASOURCE","OPENQUERY","OPENROWSET","OPENXML","OPTION","OR","ORDER","OUTER","OVER","PERCENT","PIVOT","PLAN","PRIMARY","PRINT","PROC","PROCEDURE","PUBLIC","RAISERROR","READ","READTEXT","RECONFIGURE","REFERENCES","REPLICATION","RESTORE","RESTRICT","RETURN","REVERT","REVOKE","RIGHT","ROLLBACK","ROWCOUNT","ROWGUIDCOL","RULE","SAVE","SCHEMA","SECURITYAUDIT","SELECT","SEMANTICKEYPHRASETABLE","SEMANTICSIMILARITYDETAILSTABLE","SEMANTICSIMILARITYTABLE","SESSION_USER","SET","SETUSER","SHUTDOWN","SOME","STATISTICS","SYSTEM_USER","TABLE","TABLESAMPLE","TEXTSIZE","THEN","TO","TOP","TRAN","TRANSACTION","TRIGGER","TRUNCATE","TRY_CONVERT","TSEQUAL","UNION","UNIQUE","UNPIVOT","UPDATE","UPDATETEXT","USE","USER","VALUES","VIEW","WAITFOR","WHERE","WHILE","WITH","WITHIN GROUP","WRITETEXT","$ACTION"],x2e=["BINARY","BIT","CHAR","CHAR","CHARACTER","DATE","DATETIME2","DATETIMEOFFSET","DEC","DECIMAL","DOUBLE","FLOAT","INT","INTEGER","NATIONAL","NCHAR","NUMERIC","NVARCHAR","PRECISION","REAL","SMALLINT","TIME","TIMESTAMP","VARBINARY","VARCHAR"],S2e=Me(["SELECT [ALL | DISTINCT]"]),b2e=Me(["WITH","INTO","FROM","WHERE","GROUP BY","HAVING","WINDOW","PARTITION BY","ORDER BY","OFFSET","FETCH {FIRST | NEXT}","FOR {BROWSE | XML | JSON}","OPTION","INSERT [INTO]","VALUES","SET","MERGE [INTO]","WHEN [NOT] MATCHED [BY TARGET | BY SOURCE] [THEN]","UPDATE SET","CREATE [OR ALTER] {PROC | PROCEDURE}"]),r6=Me(["CREATE TABLE"]),xC=Me(["CREATE [OR ALTER] [MATERIALIZED] VIEW","UPDATE","WHERE CURRENT OF","DELETE [FROM]","DROP TABLE [IF EXISTS]","ALTER TABLE","ADD","DROP COLUMN [IF EXISTS]","ALTER COLUMN","TRUNCATE TABLE","CREATE [UNIQUE] [CLUSTERED] INDEX","CREATE DATABASE","ALTER DATABASE","DROP DATABASE [IF EXISTS]","GO","USE","ADD SENSITIVITY CLASSIFICATION","ADD SIGNATURE","AGGREGATE","ANSI_DEFAULTS","ANSI_NULLS","ANSI_NULL_DFLT_OFF","ANSI_NULL_DFLT_ON","ANSI_PADDING","ANSI_WARNINGS","APPLICATION ROLE","ARITHABORT","ARITHIGNORE","ASSEMBLY","ASYMMETRIC KEY","AUTHORIZATION","AVAILABILITY GROUP","BACKUP","BACKUP CERTIFICATE","BACKUP MASTER KEY","BACKUP SERVICE MASTER KEY","BEGIN CONVERSATION TIMER","BEGIN DIALOG CONVERSATION","BROKER PRIORITY","BULK INSERT","CERTIFICATE","CLOSE MASTER KEY","CLOSE SYMMETRIC KEY","COLLATE","COLUMN ENCRYPTION KEY","COLUMN MASTER KEY","COLUMNSTORE INDEX","CONCAT_NULL_YIELDS_NULL","CONTEXT_INFO","CONTRACT","CREDENTIAL","CRYPTOGRAPHIC PROVIDER","CURSOR_CLOSE_ON_COMMIT","DATABASE","DATABASE AUDIT SPECIFICATION","DATABASE ENCRYPTION KEY","DATABASE HADR","DATABASE SCOPED CONFIGURATION","DATABASE SCOPED CREDENTIAL","DATABASE SET","DATEFIRST","DATEFORMAT","DEADLOCK_PRIORITY","DENY","DENY XML","DISABLE TRIGGER","ENABLE TRIGGER","END CONVERSATION","ENDPOINT","EVENT NOTIFICATION","EVENT SESSION","EXECUTE AS","EXTERNAL DATA SOURCE","EXTERNAL FILE FORMAT","EXTERNAL LANGUAGE","EXTERNAL LIBRARY","EXTERNAL RESOURCE POOL","EXTERNAL TABLE","FIPS_FLAGGER","FMTONLY","FORCEPLAN","FULLTEXT CATALOG","FULLTEXT INDEX","FULLTEXT STOPLIST","FUNCTION","GET CONVERSATION GROUP","GET_TRANSMISSION_STATUS","GRANT","GRANT XML","IDENTITY_INSERT","IMPLICIT_TRANSACTIONS","INDEX","LANGUAGE","LOCK_TIMEOUT","LOGIN","MASTER KEY","MESSAGE TYPE","MOVE CONVERSATION","NOCOUNT","NOEXEC","NUMERIC_ROUNDABORT","OFFSETS","OPEN MASTER KEY","OPEN SYMMETRIC KEY","PARSEONLY","PARTITION FUNCTION","PARTITION SCHEME","PROCEDURE","QUERY_GOVERNOR_COST_LIMIT","QUEUE","QUOTED_IDENTIFIER","RECEIVE","REMOTE SERVICE BINDING","REMOTE_PROC_TRANSACTIONS","RESOURCE GOVERNOR","RESOURCE POOL","RESTORE","RESTORE FILELISTONLY","RESTORE HEADERONLY","RESTORE LABELONLY","RESTORE MASTER KEY","RESTORE REWINDONLY","RESTORE SERVICE MASTER KEY","RESTORE VERIFYONLY","REVERT","REVOKE","REVOKE XML","ROLE","ROUTE","ROWCOUNT","RULE","SCHEMA","SEARCH PROPERTY LIST","SECURITY POLICY","SELECTIVE XML INDEX","SEND","SENSITIVITY CLASSIFICATION","SEQUENCE","SERVER AUDIT","SERVER AUDIT SPECIFICATION","SERVER CONFIGURATION","SERVER ROLE","SERVICE","SERVICE MASTER KEY","SETUSER","SHOWPLAN_ALL","SHOWPLAN_TEXT","SHOWPLAN_XML","SIGNATURE","SPATIAL INDEX","STATISTICS","STATISTICS IO","STATISTICS PROFILE","STATISTICS TIME","STATISTICS XML","SYMMETRIC KEY","SYNONYM","TABLE","TABLE IDENTITY","TEXTSIZE","TRANSACTION ISOLATION LEVEL","TRIGGER","TYPE","UPDATE STATISTICS","USER","WORKLOAD GROUP","XACT_ABORT","XML INDEX","XML SCHEMA COLLECTION"]),v2e=Me(["UNION [ALL]","EXCEPT","INTERSECT"]),A2e=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","{CROSS | OUTER} APPLY"]),R2e=Me(["ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]","{ROWS | RANGE} BETWEEN"]),N2e={name:"transactsql",tokenizerOptions:{reservedSelect:S2e,reservedClauses:[...b2e,...r6,...xC],reservedSetOperations:v2e,reservedJoins:A2e,reservedPhrases:R2e,reservedKeywords:y2e,reservedDataTypes:x2e,reservedFunctionNames:T2e,nestedBlockComments:!0,stringTypes:[{quote:"''-qq",prefixes:["N"]}],identTypes:['""-qq',"[]"],identChars:{first:"#@",rest:"#@$"},paramTypes:{named:["@"],quoted:["@"]},operators:["%","&","|","^","~","!<","!>","+=","-=","*=","/=","%=","|=","&=","^=","::",":"],propertyAccessOperators:[".."]},formatOptions:{alwaysDenseOperators:["::"],onelineClauses:[...r6,...xC],tabularOnelineClauses:xC}},_2e=["ADD","ALL","ALTER","ANALYZE","AND","AS","ASC","ASENSITIVE","BEFORE","BETWEEN","_BINARY","BOTH","BY","CALL","CASCADE","CASE","CHANGE","CHECK","COLLATE","COLUMN","CONDITION","CONSTRAINT","CONTINUE","CONVERT","CREATE","CROSS","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURSOR","DATABASE","DATABASES","DAY_HOUR","DAY_MICROSECOND","DAY_MINUTE","DAY_SECOND","DECLARE","DEFAULT","DELAYED","DELETE","DESC","DESCRIBE","DETERMINISTIC","DISTINCT","DISTINCTROW","DIV","DROP","DUAL","EACH","ELSE","ELSEIF","ENCLOSED","ESCAPED","EXCEPT","EXISTS","EXIT","EXPLAIN","EXTRA_JOIN","FALSE","FETCH","FOR","FORCE","FORCE_COMPILED_MODE","FORCE_INTERPRETER_MODE","FOREIGN","FROM","FULL","FULLTEXT","GRANT","GROUP","HAVING","HEARTBEAT_NO_LOGGING","HIGH_PRIORITY","HOUR_MICROSECOND","HOUR_MINUTE","HOUR_SECOND","IF","IGNORE","IN","INDEX","INFILE","INNER","INOUT","INSENSITIVE","INSERT","IN","_INTERNAL_DYNAMIC_TYPECAST","INTERSECT","INTERVAL","INTO","ITERATE","JOIN","KEY","KEYS","KILL","LEADING","LEAVE","LEFT","LIKE","LIMIT","LINES","LOAD","LOCALTIME","LOCALTIMESTAMP","LOCK","LOOP","LOW_PRIORITY","MATCH","MAXVALUE","MINUS","MINUTE_MICROSECOND","MINUTE_SECOND","MOD","MODIFIES","NATURAL","NO_QUERY_REWRITE","NOT","NO_WRITE_TO_BINLOG","NO_QUERY_REWRITE","NULL","ON","OPTIMIZE","OPTION","OPTIONALLY","OR","ORDER","OUT","OUTER","OUTFILE","OVER","PRIMARY","PROCEDURE","PURGE","RANGE","READ","READS","REFERENCES","REGEXP","RELEASE","RENAME","REPEAT","REPLACE","REQUIRE","RESTRICT","RETURN","REVOKE","RIGHT","RIGHT_ANTI_JOIN","RIGHT_SEMI_JOIN","RIGHT_STRAIGHT_JOIN","RLIKE","SCHEMA","SCHEMAS","SECOND_MICROSECOND","SELECT","SEMI_JOIN","SENSITIVE","SEPARATOR","SET","SHOW","SIGNAL","SPATIAL","SPECIFIC","SQL","SQL_BIG_RESULT","SQL_BUFFER_RESULT","SQL_CACHE","SQL_CALC_FOUND_ROWS","SQLEXCEPTION","SQL_NO_CACHE","SQL_NO_LOGGING","SQL_SMALL_RESULT","SQLSTATE","SQLWARNING","STRAIGHT_JOIN","TABLE","TERMINATED","THEN","TO","TRAILING","TRIGGER","TRUE","UNBOUNDED","UNDO","UNION","UNIQUE","UNLOCK","UPDATE","USAGE","USE","USING","UTC_DATE","UTC_TIME","UTC_TIMESTAMP","_UTF8","VALUES","WHEN","WHERE","WHILE","WINDOW","WITH","WITHIN","WRITE","XOR","YEAR_MONTH","ZEROFILL"],w2e=["BIGINT","BINARY","BIT","BLOB","CHAR","CHARACTER","DATETIME","DEC","DECIMAL","DOUBLE PRECISION","DOUBLE","ENUM","FIXED","FLOAT","FLOAT4","FLOAT8","INT","INT1","INT2","INT3","INT4","INT8","INTEGER","LONG","LONGBLOB","LONGTEXT","MEDIUMBLOB","MEDIUMINT","MEDIUMTEXT","MIDDLEINT","NATIONAL CHAR","NATIONAL VARCHAR","NUMERIC","PRECISION","REAL","SMALLINT","TEXT","TIME","TIMESTAMP","TINYBLOB","TINYINT","TINYTEXT","UNSIGNED","VARBINARY","VARCHAR","VARCHARACTER","YEAR"],C2e=["ABS","ACOS","ADDDATE","ADDTIME","AES_DECRYPT","AES_ENCRYPT","ANY_VALUE","APPROX_COUNT_DISTINCT","APPROX_COUNT_DISTINCT_ACCUMULATE","APPROX_COUNT_DISTINCT_COMBINE","APPROX_COUNT_DISTINCT_ESTIMATE","APPROX_GEOGRAPHY_INTERSECTS","APPROX_PERCENTILE","ASCII","ASIN","ATAN","ATAN2","AVG","BIN","BINARY","BIT_AND","BIT_COUNT","BIT_OR","BIT_XOR","CAST","CEIL","CEILING","CHAR","CHARACTER_LENGTH","CHAR_LENGTH","CHARSET","COALESCE","COERCIBILITY","COLLATION","COLLECT","CONCAT","CONCAT_WS","CONNECTION_ID","CONV","CONVERT","CONVERT_TZ","COS","COT","COUNT","CUME_DIST","CURDATE","CURRENT_DATE","CURRENT_ROLE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURTIME","DATABASE","DATE","DATE_ADD","DATEDIFF","DATE_FORMAT","DATE_SUB","DATE_TRUNC","DAY","DAYNAME","DAYOFMONTH","DAYOFWEEK","DAYOFYEAR","DECODE","DEFAULT","DEGREES","DENSE_RANK","DIV","DOT_PRODUCT","ELT","EUCLIDEAN_DISTANCE","EXP","EXTRACT","FIELD","FIRST","FIRST_VALUE","FLOOR","FORMAT","FOUND_ROWS","FROM_BASE64","FROM_DAYS","FROM_UNIXTIME","GEOGRAPHY_AREA","GEOGRAPHY_CONTAINS","GEOGRAPHY_DISTANCE","GEOGRAPHY_INTERSECTS","GEOGRAPHY_LATITUDE","GEOGRAPHY_LENGTH","GEOGRAPHY_LONGITUDE","GEOGRAPHY_POINT","GEOGRAPHY_WITHIN_DISTANCE","GEOMETRY_AREA","GEOMETRY_CONTAINS","GEOMETRY_DISTANCE","GEOMETRY_FILTER","GEOMETRY_INTERSECTS","GEOMETRY_LENGTH","GEOMETRY_POINT","GEOMETRY_WITHIN_DISTANCE","GEOMETRY_X","GEOMETRY_Y","GREATEST","GROUPING","GROUP_CONCAT","HEX","HIGHLIGHT","HOUR","ICU_VERSION","IF","IFNULL","INET_ATON","INET_NTOA","INET6_ATON","INET6_NTOA","INITCAP","INSERT","INSTR","INTERVAL","IS","IS NULL","JSON_AGG","JSON_ARRAY_CONTAINS_DOUBLE","JSON_ARRAY_CONTAINS_JSON","JSON_ARRAY_CONTAINS_STRING","JSON_ARRAY_PUSH_DOUBLE","JSON_ARRAY_PUSH_JSON","JSON_ARRAY_PUSH_STRING","JSON_DELETE_KEY","JSON_EXTRACT_DOUBLE","JSON_EXTRACT_JSON","JSON_EXTRACT_STRING","JSON_EXTRACT_BIGINT","JSON_GET_TYPE","JSON_LENGTH","JSON_SET_DOUBLE","JSON_SET_JSON","JSON_SET_STRING","JSON_SPLICE_DOUBLE","JSON_SPLICE_JSON","JSON_SPLICE_STRING","LAG","LAST_DAY","LAST_VALUE","LCASE","LEAD","LEAST","LEFT","LENGTH","LIKE","LN","LOCALTIME","LOCALTIMESTAMP","LOCATE","LOG","LOG10","LOG2","LPAD","LTRIM","MATCH","MAX","MD5","MEDIAN","MICROSECOND","MIN","MINUTE","MOD","MONTH","MONTHNAME","MONTHS_BETWEEN","NOT","NOW","NTH_VALUE","NTILE","NULLIF","OCTET_LENGTH","PERCENT_RANK","PERCENTILE_CONT","PERCENTILE_DISC","PI","PIVOT","POSITION","POW","POWER","QUARTER","QUOTE","RADIANS","RAND","RANK","REGEXP","REPEAT","REPLACE","REVERSE","RIGHT","RLIKE","ROUND","ROW_COUNT","ROW_NUMBER","RPAD","RTRIM","SCALAR","SCHEMA","SEC_TO_TIME","SHA1","SHA2","SIGMOID","SIGN","SIN","SLEEP","SPLIT","SOUNDEX","SOUNDS LIKE","SOURCE_POS_WAIT","SPACE","SQRT","STDDEV","STDDEV_POP","STDDEV_SAMP","STR_TO_DATE","SUBDATE","SUBSTR","SUBSTRING","SUBSTRING_INDEX","SUM","SYS_GUID","TAN","TIME","TIMEDIFF","TIME_BUCKET","TIME_FORMAT","TIMESTAMP","TIMESTAMPADD","TIMESTAMPDIFF","TIME_TO_SEC","TO_BASE64","TO_CHAR","TO_DAYS","TO_JSON","TO_NUMBER","TO_SECONDS","TO_TIMESTAMP","TRIM","TRUNC","TRUNCATE","UCASE","UNHEX","UNIX_TIMESTAMP","UPDATEXML","UPPER","UTC_DATE","UTC_TIME","UTC_TIMESTAMP","UUID","VALUES","VARIANCE","VAR_POP","VAR_SAMP","VECTOR_SUB","VERSION","WEEK","WEEKDAY","WEEKOFYEAR","YEAR"],I2e=Me(["SELECT [ALL | DISTINCT | DISTINCTROW]"]),O2e=Me(["WITH","FROM","WHERE","GROUP BY","HAVING","PARTITION BY","ORDER BY","LIMIT","OFFSET","INSERT [IGNORE] [INTO]","VALUES","REPLACE [INTO]","ON DUPLICATE KEY UPDATE","SET","CREATE [OR REPLACE] [TEMPORARY] PROCEDURE [IF NOT EXISTS]","CREATE [OR REPLACE] [EXTERNAL] FUNCTION"]),a6=Me(["CREATE [ROWSTORE] [REFERENCE | TEMPORARY | GLOBAL TEMPORARY] TABLE [IF NOT EXISTS]"]),SC=Me(["CREATE VIEW","UPDATE","DELETE [FROM]","DROP [TEMPORARY] TABLE [IF EXISTS]","ALTER [ONLINE] TABLE","ADD [COLUMN]","ADD [UNIQUE] {INDEX | KEY}","DROP [COLUMN]","MODIFY [COLUMN]","CHANGE","RENAME [TO | AS]","TRUNCATE [TABLE]","ADD AGGREGATOR","ADD LEAF","AGGREGATOR SET AS MASTER","ALTER DATABASE","ALTER PIPELINE","ALTER RESOURCE POOL","ALTER USER","ALTER VIEW","ANALYZE TABLE","ATTACH DATABASE","ATTACH LEAF","ATTACH LEAF ALL","BACKUP DATABASE","BINLOG","BOOTSTRAP AGGREGATOR","CACHE INDEX","CALL","CHANGE","CHANGE MASTER TO","CHANGE REPLICATION FILTER","CHANGE REPLICATION SOURCE TO","CHECK BLOB CHECKSUM","CHECK TABLE","CHECKSUM TABLE","CLEAR ORPHAN DATABASES","CLONE","COMMIT","CREATE DATABASE","CREATE GROUP","CREATE INDEX","CREATE LINK","CREATE MILESTONE","CREATE PIPELINE","CREATE RESOURCE POOL","CREATE ROLE","CREATE USER","DEALLOCATE PREPARE","DESCRIBE","DETACH DATABASE","DETACH PIPELINE","DROP DATABASE","DROP FUNCTION","DROP INDEX","DROP LINK","DROP PIPELINE","DROP PROCEDURE","DROP RESOURCE POOL","DROP ROLE","DROP USER","DROP VIEW","EXECUTE","EXPLAIN","FLUSH","FORCE","GRANT","HANDLER","HELP","KILL CONNECTION","KILLALL QUERIES","LOAD DATA","LOAD INDEX INTO CACHE","LOAD XML","LOCK INSTANCE FOR BACKUP","LOCK TABLES","MASTER_POS_WAIT","OPTIMIZE TABLE","PREPARE","PURGE BINARY LOGS","REBALANCE PARTITIONS","RELEASE SAVEPOINT","REMOVE AGGREGATOR","REMOVE LEAF","REPAIR TABLE","REPLACE","REPLICATE DATABASE","RESET","RESET MASTER","RESET PERSIST","RESET REPLICA","RESET SLAVE","RESTART","RESTORE DATABASE","RESTORE REDUNDANCY","REVOKE","ROLLBACK","ROLLBACK TO SAVEPOINT","SAVEPOINT","SET CHARACTER SET","SET DEFAULT ROLE","SET NAMES","SET PASSWORD","SET RESOURCE GROUP","SET ROLE","SET TRANSACTION","SHOW","SHOW CHARACTER SET","SHOW COLLATION","SHOW COLUMNS","SHOW CREATE DATABASE","SHOW CREATE FUNCTION","SHOW CREATE PIPELINE","SHOW CREATE PROCEDURE","SHOW CREATE TABLE","SHOW CREATE USER","SHOW CREATE VIEW","SHOW DATABASES","SHOW ENGINE","SHOW ENGINES","SHOW ERRORS","SHOW FUNCTION CODE","SHOW FUNCTION STATUS","SHOW GRANTS","SHOW INDEX","SHOW MASTER STATUS","SHOW OPEN TABLES","SHOW PLUGINS","SHOW PRIVILEGES","SHOW PROCEDURE CODE","SHOW PROCEDURE STATUS","SHOW PROCESSLIST","SHOW PROFILE","SHOW PROFILES","SHOW RELAYLOG EVENTS","SHOW REPLICA STATUS","SHOW REPLICAS","SHOW SLAVE","SHOW SLAVE HOSTS","SHOW STATUS","SHOW TABLE STATUS","SHOW TABLES","SHOW VARIABLES","SHOW WARNINGS","SHUTDOWN","SNAPSHOT DATABASE","SOURCE_POS_WAIT","START GROUP_REPLICATION","START PIPELINE","START REPLICA","START SLAVE","START TRANSACTION","STOP GROUP_REPLICATION","STOP PIPELINE","STOP REPLICA","STOP REPLICATING","STOP SLAVE","TEST PIPELINE","UNLOCK INSTANCE","UNLOCK TABLES","USE","XA","ITERATE","LEAVE","LOOP","REPEAT","RETURN","WHILE"]),L2e=Me(["UNION [ALL | DISTINCT]","EXCEPT","INTERSECT","MINUS"]),M2e=Me(["JOIN","{LEFT | RIGHT | FULL} [OUTER] JOIN","{INNER | CROSS} JOIN","NATURAL {LEFT | RIGHT} [OUTER] JOIN","STRAIGHT_JOIN"]),D2e=Me(["ON DELETE","ON UPDATE","CHARACTER SET","{ROWS | RANGE} BETWEEN","IDENTIFIED BY"]),P2e={name:"singlestoredb",tokenizerOptions:{reservedSelect:I2e,reservedClauses:[...O2e,...a6,...SC],reservedSetOperations:L2e,reservedJoins:M2e,reservedPhrases:D2e,reservedKeywords:_2e,reservedDataTypes:w2e,reservedFunctionNames:C2e,stringTypes:['""-qq-bs',"''-qq-bs",{quote:"''-raw",prefixes:["B","X"],requirePrefix:!0}],identTypes:["``"],identChars:{first:"$",rest:"$",allowFirstCharNumber:!0},variableTypes:[{regex:"@@?[A-Za-z0-9_$]+"},{quote:"``",prefixes:["@"],requirePrefix:!0}],lineCommentTypes:["--","#"],operators:[":=","&","|","^","~","<<",">>","<=>","&&","||","::","::$","::%",":>","!:>","*.*"],postProcess:fS},formatOptions:{alwaysDenseOperators:["::","::$","::%"],onelineClauses:[...a6,...SC],tabularOnelineClauses:SC}},k2e=["ABS","ACOS","ACOSH","ADD_MONTHS","ALL_USER_NAMES","ANY_VALUE","APPROX_COUNT_DISTINCT","APPROX_PERCENTILE","APPROX_PERCENTILE_ACCUMULATE","APPROX_PERCENTILE_COMBINE","APPROX_PERCENTILE_ESTIMATE","APPROX_TOP_K","APPROX_TOP_K_ACCUMULATE","APPROX_TOP_K_COMBINE","APPROX_TOP_K_ESTIMATE","APPROXIMATE_JACCARD_INDEX","APPROXIMATE_SIMILARITY","ARRAY_AGG","ARRAY_APPEND","ARRAY_CAT","ARRAY_COMPACT","ARRAY_CONSTRUCT","ARRAY_CONSTRUCT_COMPACT","ARRAY_CONTAINS","ARRAY_INSERT","ARRAY_INTERSECTION","ARRAY_POSITION","ARRAY_PREPEND","ARRAY_SIZE","ARRAY_SLICE","ARRAY_TO_STRING","ARRAY_UNION_AGG","ARRAY_UNIQUE_AGG","ARRAYS_OVERLAP","AS_ARRAY","AS_BINARY","AS_BOOLEAN","AS_CHAR","AS_VARCHAR","AS_DATE","AS_DECIMAL","AS_NUMBER","AS_DOUBLE","AS_REAL","AS_INTEGER","AS_OBJECT","AS_TIME","AS_TIMESTAMP_LTZ","AS_TIMESTAMP_NTZ","AS_TIMESTAMP_TZ","ASCII","ASIN","ASINH","ATAN","ATAN2","ATANH","AUTO_REFRESH_REGISTRATION_HISTORY","AUTOMATIC_CLUSTERING_HISTORY","AVG","BASE64_DECODE_BINARY","BASE64_DECODE_STRING","BASE64_ENCODE","BIT_LENGTH","BITAND","BITAND_AGG","BITMAP_BIT_POSITION","BITMAP_BUCKET_NUMBER","BITMAP_CONSTRUCT_AGG","BITMAP_COUNT","BITMAP_OR_AGG","BITNOT","BITOR","BITOR_AGG","BITSHIFTLEFT","BITSHIFTRIGHT","BITXOR","BITXOR_AGG","BOOLAND","BOOLAND_AGG","BOOLNOT","BOOLOR","BOOLOR_AGG","BOOLXOR","BOOLXOR_AGG","BUILD_SCOPED_FILE_URL","BUILD_STAGE_FILE_URL","CASE","CAST","CBRT","CEIL","CHARINDEX","CHECK_JSON","CHECK_XML","CHR","CHAR","COALESCE","COLLATE","COLLATION","COMPLETE_TASK_GRAPHS","COMPRESS","CONCAT","CONCAT_WS","CONDITIONAL_CHANGE_EVENT","CONDITIONAL_TRUE_EVENT","CONTAINS","CONVERT_TIMEZONE","COPY_HISTORY","CORR","COS","COSH","COT","COUNT","COUNT_IF","COVAR_POP","COVAR_SAMP","CUME_DIST","CURRENT_ACCOUNT","CURRENT_AVAILABLE_ROLES","CURRENT_CLIENT","CURRENT_DATABASE","CURRENT_DATE","CURRENT_IP_ADDRESS","CURRENT_REGION","CURRENT_ROLE","CURRENT_SCHEMA","CURRENT_SCHEMAS","CURRENT_SECONDARY_ROLES","CURRENT_SESSION","CURRENT_STATEMENT","CURRENT_TASK_GRAPHS","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_TRANSACTION","CURRENT_USER","CURRENT_VERSION","CURRENT_WAREHOUSE","DATA_TRANSFER_HISTORY","DATABASE_REFRESH_HISTORY","DATABASE_REFRESH_PROGRESS","DATABASE_REFRESH_PROGRESS_BY_JOB","DATABASE_STORAGE_USAGE_HISTORY","DATE_FROM_PARTS","DATE_PART","DATE_TRUNC","DATEADD","DATEDIFF","DAYNAME","DECODE","DECOMPRESS_BINARY","DECOMPRESS_STRING","DECRYPT","DECRYPT_RAW","DEGREES","DENSE_RANK","DIV0","EDITDISTANCE","ENCRYPT","ENCRYPT_RAW","ENDSWITH","EQUAL_NULL","EXP","EXPLAIN_JSON","EXTERNAL_FUNCTIONS_HISTORY","EXTERNAL_TABLE_FILES","EXTERNAL_TABLE_FILE_REGISTRATION_HISTORY","EXTRACT","EXTRACT_SEMANTIC_CATEGORIES","FACTORIAL","FILTER","FIRST_VALUE","FLATTEN","FLOOR","GENERATE_COLUMN_DESCRIPTION","GENERATOR","GET","GET_ABSOLUTE_PATH","GET_DDL","GET_IGNORE_CASE","GET_OBJECT_REFERENCES","GET_PATH","GET_PRESIGNED_URL","GET_RELATIVE_PATH","GET_STAGE_LOCATION","GETBIT","GREATEST","GREATEST_IGNORE_NULLS","GROUPING","GROUPING_ID","HASH","HASH_AGG","HAVERSINE","HEX_DECODE_BINARY","HEX_DECODE_STRING","HEX_ENCODE","HLL","HLL_ACCUMULATE","HLL_COMBINE","HLL_ESTIMATE","HLL_EXPORT","HLL_IMPORT","HOUR","MINUTE","SECOND","IFF","IFNULL","ILIKE","ILIKE ANY","INFER_SCHEMA","INITCAP","INSERT","INVOKER_ROLE","INVOKER_SHARE","IS_ARRAY","IS_BINARY","IS_BOOLEAN","IS_CHAR","IS_VARCHAR","IS_DATE","IS_DATE_VALUE","IS_DECIMAL","IS_DOUBLE","IS_REAL","IS_GRANTED_TO_INVOKER_ROLE","IS_INTEGER","IS_NULL_VALUE","IS_OBJECT","IS_ROLE_IN_SESSION","IS_TIME","IS_TIMESTAMP_LTZ","IS_TIMESTAMP_NTZ","IS_TIMESTAMP_TZ","JAROWINKLER_SIMILARITY","JSON_EXTRACT_PATH_TEXT","KURTOSIS","LAG","LAST_DAY","LAST_QUERY_ID","LAST_TRANSACTION","LAST_VALUE","LEAD","LEAST","LEFT","LENGTH","LEN","LIKE","LIKE ALL","LIKE ANY","LISTAGG","LN","LOCALTIME","LOCALTIMESTAMP","LOG","LOGIN_HISTORY","LOGIN_HISTORY_BY_USER","LOWER","LPAD","LTRIM","MATERIALIZED_VIEW_REFRESH_HISTORY","MD5","MD5_HEX","MD5_BINARY","MD5_NUMBER — Obsoleted","MD5_NUMBER_LOWER64","MD5_NUMBER_UPPER64","MEDIAN","MIN","MAX","MINHASH","MINHASH_COMBINE","MOD","MODE","MONTHNAME","MONTHS_BETWEEN","NEXT_DAY","NORMAL","NTH_VALUE","NTILE","NULLIF","NULLIFZERO","NVL","NVL2","OBJECT_AGG","OBJECT_CONSTRUCT","OBJECT_CONSTRUCT_KEEP_NULL","OBJECT_DELETE","OBJECT_INSERT","OBJECT_KEYS","OBJECT_PICK","OCTET_LENGTH","PARSE_IP","PARSE_JSON","PARSE_URL","PARSE_XML","PERCENT_RANK","PERCENTILE_CONT","PERCENTILE_DISC","PI","PIPE_USAGE_HISTORY","POLICY_CONTEXT","POLICY_REFERENCES","POSITION","POW","POWER","PREVIOUS_DAY","QUERY_ACCELERATION_HISTORY","QUERY_HISTORY","QUERY_HISTORY_BY_SESSION","QUERY_HISTORY_BY_USER","QUERY_HISTORY_BY_WAREHOUSE","RADIANS","RANDOM","RANDSTR","RANK","RATIO_TO_REPORT","REGEXP","REGEXP_COUNT","REGEXP_INSTR","REGEXP_LIKE","REGEXP_REPLACE","REGEXP_SUBSTR","REGEXP_SUBSTR_ALL","REGR_AVGX","REGR_AVGY","REGR_COUNT","REGR_INTERCEPT","REGR_R2","REGR_SLOPE","REGR_SXX","REGR_SXY","REGR_SYY","REGR_VALX","REGR_VALY","REPEAT","REPLACE","REPLICATION_GROUP_REFRESH_HISTORY","REPLICATION_GROUP_REFRESH_PROGRESS","REPLICATION_GROUP_REFRESH_PROGRESS_BY_JOB","REPLICATION_GROUP_USAGE_HISTORY","REPLICATION_USAGE_HISTORY","REST_EVENT_HISTORY","RESULT_SCAN","REVERSE","RIGHT","RLIKE","ROUND","ROW_NUMBER","RPAD","RTRIM","RTRIMMED_LENGTH","SEARCH_OPTIMIZATION_HISTORY","SEQ1","SEQ2","SEQ4","SEQ8","SERVERLESS_TASK_HISTORY","SHA1","SHA1_HEX","SHA1_BINARY","SHA2","SHA2_HEX","SHA2_BINARY","SIGN","SIN","SINH","SKEW","SOUNDEX","SPACE","SPLIT","SPLIT_PART","SPLIT_TO_TABLE","SQRT","SQUARE","ST_AREA","ST_ASEWKB","ST_ASEWKT","ST_ASGEOJSON","ST_ASWKB","ST_ASBINARY","ST_ASWKT","ST_ASTEXT","ST_AZIMUTH","ST_CENTROID","ST_COLLECT","ST_CONTAINS","ST_COVEREDBY","ST_COVERS","ST_DIFFERENCE","ST_DIMENSION","ST_DISJOINT","ST_DISTANCE","ST_DWITHIN","ST_ENDPOINT","ST_ENVELOPE","ST_GEOGFROMGEOHASH","ST_GEOGPOINTFROMGEOHASH","ST_GEOGRAPHYFROMWKB","ST_GEOGRAPHYFROMWKT","ST_GEOHASH","ST_GEOMETRYFROMWKB","ST_GEOMETRYFROMWKT","ST_HAUSDORFFDISTANCE","ST_INTERSECTION","ST_INTERSECTS","ST_LENGTH","ST_MAKEGEOMPOINT","ST_GEOM_POINT","ST_MAKELINE","ST_MAKEPOINT","ST_POINT","ST_MAKEPOLYGON","ST_POLYGON","ST_NPOINTS","ST_NUMPOINTS","ST_PERIMETER","ST_POINTN","ST_SETSRID","ST_SIMPLIFY","ST_SRID","ST_STARTPOINT","ST_SYMDIFFERENCE","ST_UNION","ST_WITHIN","ST_X","ST_XMAX","ST_XMIN","ST_Y","ST_YMAX","ST_YMIN","STAGE_DIRECTORY_FILE_REGISTRATION_HISTORY","STAGE_STORAGE_USAGE_HISTORY","STARTSWITH","STDDEV","STDDEV_POP","STDDEV_SAMP","STRIP_NULL_VALUE","STRTOK","STRTOK_SPLIT_TO_TABLE","STRTOK_TO_ARRAY","SUBSTR","SUBSTRING","SUM","SYSDATE","SYSTEM$ABORT_SESSION","SYSTEM$ABORT_TRANSACTION","SYSTEM$AUTHORIZE_PRIVATELINK","SYSTEM$AUTHORIZE_STAGE_PRIVATELINK_ACCESS","SYSTEM$BEHAVIOR_CHANGE_BUNDLE_STATUS","SYSTEM$CANCEL_ALL_QUERIES","SYSTEM$CANCEL_QUERY","SYSTEM$CLUSTERING_DEPTH","SYSTEM$CLUSTERING_INFORMATION","SYSTEM$CLUSTERING_RATIO ","SYSTEM$CURRENT_USER_TASK_NAME","SYSTEM$DATABASE_REFRESH_HISTORY ","SYSTEM$DATABASE_REFRESH_PROGRESS","SYSTEM$DATABASE_REFRESH_PROGRESS_BY_JOB ","SYSTEM$DISABLE_BEHAVIOR_CHANGE_BUNDLE","SYSTEM$DISABLE_DATABASE_REPLICATION","SYSTEM$ENABLE_BEHAVIOR_CHANGE_BUNDLE","SYSTEM$ESTIMATE_QUERY_ACCELERATION","SYSTEM$ESTIMATE_SEARCH_OPTIMIZATION_COSTS","SYSTEM$EXPLAIN_JSON_TO_TEXT","SYSTEM$EXPLAIN_PLAN_JSON","SYSTEM$EXTERNAL_TABLE_PIPE_STATUS","SYSTEM$GENERATE_SAML_CSR","SYSTEM$GENERATE_SCIM_ACCESS_TOKEN","SYSTEM$GET_AWS_SNS_IAM_POLICY","SYSTEM$GET_PREDECESSOR_RETURN_VALUE","SYSTEM$GET_PRIVATELINK","SYSTEM$GET_PRIVATELINK_AUTHORIZED_ENDPOINTS","SYSTEM$GET_PRIVATELINK_CONFIG","SYSTEM$GET_SNOWFLAKE_PLATFORM_INFO","SYSTEM$GET_TAG","SYSTEM$GET_TAG_ALLOWED_VALUES","SYSTEM$GET_TAG_ON_CURRENT_COLUMN","SYSTEM$GET_TAG_ON_CURRENT_TABLE","SYSTEM$GLOBAL_ACCOUNT_SET_PARAMETER","SYSTEM$LAST_CHANGE_COMMIT_TIME","SYSTEM$LINK_ACCOUNT_OBJECTS_BY_NAME","SYSTEM$MIGRATE_SAML_IDP_REGISTRATION","SYSTEM$PIPE_FORCE_RESUME","SYSTEM$PIPE_STATUS","SYSTEM$REVOKE_PRIVATELINK","SYSTEM$REVOKE_STAGE_PRIVATELINK_ACCESS","SYSTEM$SET_RETURN_VALUE","SYSTEM$SHOW_OAUTH_CLIENT_SECRETS","SYSTEM$STREAM_GET_TABLE_TIMESTAMP","SYSTEM$STREAM_HAS_DATA","SYSTEM$TASK_DEPENDENTS_ENABLE","SYSTEM$TYPEOF","SYSTEM$USER_TASK_CANCEL_ONGOING_EXECUTIONS","SYSTEM$VERIFY_EXTERNAL_OAUTH_TOKEN","SYSTEM$WAIT","SYSTEM$WHITELIST","SYSTEM$WHITELIST_PRIVATELINK","TAG_REFERENCES","TAG_REFERENCES_ALL_COLUMNS","TAG_REFERENCES_WITH_LINEAGE","TAN","TANH","TASK_DEPENDENTS","TASK_HISTORY","TIME_FROM_PARTS","TIME_SLICE","TIMEADD","TIMEDIFF","TIMESTAMP_FROM_PARTS","TIMESTAMPADD","TIMESTAMPDIFF","TO_ARRAY","TO_BINARY","TO_BOOLEAN","TO_CHAR","TO_VARCHAR","TO_DATE","DATE","TO_DECIMAL","TO_NUMBER","TO_NUMERIC","TO_DOUBLE","TO_GEOGRAPHY","TO_GEOMETRY","TO_JSON","TO_OBJECT","TO_TIME","TIME","TO_TIMESTAMP","TO_TIMESTAMP_LTZ","TO_TIMESTAMP_NTZ","TO_TIMESTAMP_TZ","TO_VARIANT","TO_XML","TRANSLATE","TRIM","TRUNCATE","TRUNC","TRUNC","TRY_BASE64_DECODE_BINARY","TRY_BASE64_DECODE_STRING","TRY_CAST","TRY_HEX_DECODE_BINARY","TRY_HEX_DECODE_STRING","TRY_PARSE_JSON","TRY_TO_BINARY","TRY_TO_BOOLEAN","TRY_TO_DATE","TRY_TO_DECIMAL","TRY_TO_NUMBER","TRY_TO_NUMERIC","TRY_TO_DOUBLE","TRY_TO_GEOGRAPHY","TRY_TO_GEOMETRY","TRY_TO_TIME","TRY_TO_TIMESTAMP","TRY_TO_TIMESTAMP_LTZ","TRY_TO_TIMESTAMP_NTZ","TRY_TO_TIMESTAMP_TZ","TYPEOF","UNICODE","UNIFORM","UPPER","UUID_STRING","VALIDATE","VALIDATE_PIPE_LOAD","VAR_POP","VAR_SAMP","VARIANCE","VARIANCE_SAMP","VARIANCE_POP","WAREHOUSE_LOAD_HISTORY","WAREHOUSE_METERING_HISTORY","WIDTH_BUCKET","XMLGET","YEAR","YEAROFWEEK","YEAROFWEEKISO","DAY","DAYOFMONTH","DAYOFWEEK","DAYOFWEEKISO","DAYOFYEAR","WEEK","WEEK","WEEKOFYEAR","WEEKISO","MONTH","QUARTER","ZEROIFNULL","ZIPF"],j2e=["ACCOUNT","ALL","ALTER","AND","ANY","AS","BETWEEN","BY","CASE","CAST","CHECK","COLUMN","CONNECT","CONNECTION","CONSTRAINT","CREATE","CROSS","CURRENT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","DATABASE","DELETE","DISTINCT","DROP","ELSE","EXISTS","FALSE","FOLLOWING","FOR","FROM","FULL","GRANT","GROUP","GSCLUSTER","HAVING","ILIKE","IN","INCREMENT","INNER","INSERT","INTERSECT","INTO","IS","ISSUE","JOIN","LATERAL","LEFT","LIKE","LOCALTIME","LOCALTIMESTAMP","MINUS","NATURAL","NOT","NULL","OF","ON","OR","ORDER","ORGANIZATION","QUALIFY","REGEXP","REVOKE","RIGHT","RLIKE","ROW","ROWS","SAMPLE","SCHEMA","SELECT","SET","SOME","START","TABLE","TABLESAMPLE","THEN","TO","TRIGGER","TRUE","TRY_CAST","UNION","UNIQUE","UPDATE","USING","VALUES","VIEW","WHEN","WHENEVER","WHERE","WITH","COMMENT"],U2e=["NUMBER","DECIMAL","NUMERIC","INT","INTEGER","BIGINT","SMALLINT","TINYINT","BYTEINT","FLOAT","FLOAT4","FLOAT8","DOUBLE","DOUBLE PRECISION","REAL","VARCHAR","CHAR","CHARACTER","STRING","TEXT","BINARY","VARBINARY","BOOLEAN","DATE","DATETIME","TIME","TIMESTAMP","TIMESTAMP_LTZ","TIMESTAMP_NTZ","TIMESTAMP","TIMESTAMP_TZ","VARIANT","OBJECT","ARRAY","GEOGRAPHY","GEOMETRY"],F2e=Me(["SELECT [ALL | DISTINCT]"]),$2e=Me(["WITH [RECURSIVE]","FROM","WHERE","GROUP BY","HAVING","PARTITION BY","ORDER BY","QUALIFY","LIMIT","OFFSET","FETCH [FIRST | NEXT]","INSERT [OVERWRITE] [ALL INTO | INTO | ALL | FIRST]","{THEN | ELSE} INTO","VALUES","SET","CLUSTER BY","[WITH] {MASKING POLICY | TAG | ROW ACCESS POLICY}","COPY GRANTS","USING TEMPLATE","MERGE INTO","WHEN MATCHED [AND]","THEN {UPDATE SET | DELETE}","WHEN NOT MATCHED THEN INSERT"]),s6=Me(["CREATE [OR REPLACE] [VOLATILE] TABLE [IF NOT EXISTS]","CREATE [OR REPLACE] [LOCAL | GLOBAL] {TEMP|TEMPORARY} TABLE [IF NOT EXISTS]"]),bC=Me(["CREATE [OR REPLACE] [SECURE] [RECURSIVE] VIEW [IF NOT EXISTS]","UPDATE","DELETE FROM","DROP TABLE [IF EXISTS]","ALTER TABLE [IF EXISTS]","RENAME TO","SWAP WITH","[SUSPEND | RESUME] RECLUSTER","DROP CLUSTERING KEY","ADD [COLUMN]","RENAME COLUMN","{ALTER | MODIFY} [COLUMN]","DROP [COLUMN]","{ADD | ALTER | MODIFY | DROP} [CONSTRAINT]","RENAME CONSTRAINT","{ADD | DROP} SEARCH OPTIMIZATION","{SET | UNSET} TAG","{ADD | DROP} ROW ACCESS POLICY","DROP ALL ROW ACCESS POLICIES","{SET | DROP} DEFAULT","{SET | DROP} NOT NULL","SET DATA TYPE","UNSET COMMENT","{SET | UNSET} MASKING POLICY","TRUNCATE [TABLE] [IF EXISTS]","ALTER ACCOUNT","ALTER API INTEGRATION","ALTER CONNECTION","ALTER DATABASE","ALTER EXTERNAL TABLE","ALTER FAILOVER GROUP","ALTER FILE FORMAT","ALTER FUNCTION","ALTER INTEGRATION","ALTER MASKING POLICY","ALTER MATERIALIZED VIEW","ALTER NETWORK POLICY","ALTER NOTIFICATION INTEGRATION","ALTER PIPE","ALTER PROCEDURE","ALTER REPLICATION GROUP","ALTER RESOURCE MONITOR","ALTER ROLE","ALTER ROW ACCESS POLICY","ALTER SCHEMA","ALTER SECURITY INTEGRATION","ALTER SEQUENCE","ALTER SESSION","ALTER SESSION POLICY","ALTER SHARE","ALTER STAGE","ALTER STORAGE INTEGRATION","ALTER STREAM","ALTER TAG","ALTER TASK","ALTER USER","ALTER VIEW","ALTER WAREHOUSE","BEGIN","CALL","COMMIT","COPY INTO","CREATE ACCOUNT","CREATE API INTEGRATION","CREATE CONNECTION","CREATE DATABASE","CREATE EXTERNAL FUNCTION","CREATE EXTERNAL TABLE","CREATE FAILOVER GROUP","CREATE FILE FORMAT","CREATE FUNCTION","CREATE INTEGRATION","CREATE MANAGED ACCOUNT","CREATE MASKING POLICY","CREATE MATERIALIZED VIEW","CREATE NETWORK POLICY","CREATE NOTIFICATION INTEGRATION","CREATE PIPE","CREATE PROCEDURE","CREATE REPLICATION GROUP","CREATE RESOURCE MONITOR","CREATE ROLE","CREATE ROW ACCESS POLICY","CREATE SCHEMA","CREATE SECURITY INTEGRATION","CREATE SEQUENCE","CREATE SESSION POLICY","CREATE SHARE","CREATE STAGE","CREATE STORAGE INTEGRATION","CREATE STREAM","CREATE TAG","CREATE TASK","CREATE USER","CREATE WAREHOUSE","DELETE","DESCRIBE DATABASE","DESCRIBE EXTERNAL TABLE","DESCRIBE FILE FORMAT","DESCRIBE FUNCTION","DESCRIBE INTEGRATION","DESCRIBE MASKING POLICY","DESCRIBE MATERIALIZED VIEW","DESCRIBE NETWORK POLICY","DESCRIBE PIPE","DESCRIBE PROCEDURE","DESCRIBE RESULT","DESCRIBE ROW ACCESS POLICY","DESCRIBE SCHEMA","DESCRIBE SEQUENCE","DESCRIBE SESSION POLICY","DESCRIBE SHARE","DESCRIBE STAGE","DESCRIBE STREAM","DESCRIBE TABLE","DESCRIBE TASK","DESCRIBE TRANSACTION","DESCRIBE USER","DESCRIBE VIEW","DESCRIBE WAREHOUSE","DROP CONNECTION","DROP DATABASE","DROP EXTERNAL TABLE","DROP FAILOVER GROUP","DROP FILE FORMAT","DROP FUNCTION","DROP INTEGRATION","DROP MANAGED ACCOUNT","DROP MASKING POLICY","DROP MATERIALIZED VIEW","DROP NETWORK POLICY","DROP PIPE","DROP PROCEDURE","DROP REPLICATION GROUP","DROP RESOURCE MONITOR","DROP ROLE","DROP ROW ACCESS POLICY","DROP SCHEMA","DROP SEQUENCE","DROP SESSION POLICY","DROP SHARE","DROP STAGE","DROP STREAM","DROP TAG","DROP TASK","DROP USER","DROP VIEW","DROP WAREHOUSE","EXECUTE IMMEDIATE","EXECUTE TASK","EXPLAIN","GET","GRANT OWNERSHIP","GRANT ROLE","INSERT","LIST","MERGE","PUT","REMOVE","REVOKE ROLE","ROLLBACK","SHOW COLUMNS","SHOW CONNECTIONS","SHOW DATABASES","SHOW DATABASES IN FAILOVER GROUP","SHOW DATABASES IN REPLICATION GROUP","SHOW DELEGATED AUTHORIZATIONS","SHOW EXTERNAL FUNCTIONS","SHOW EXTERNAL TABLES","SHOW FAILOVER GROUPS","SHOW FILE FORMATS","SHOW FUNCTIONS","SHOW GLOBAL ACCOUNTS","SHOW GRANTS","SHOW INTEGRATIONS","SHOW LOCKS","SHOW MANAGED ACCOUNTS","SHOW MASKING POLICIES","SHOW MATERIALIZED VIEWS","SHOW NETWORK POLICIES","SHOW OBJECTS","SHOW ORGANIZATION ACCOUNTS","SHOW PARAMETERS","SHOW PIPES","SHOW PRIMARY KEYS","SHOW PROCEDURES","SHOW REGIONS","SHOW REPLICATION ACCOUNTS","SHOW REPLICATION DATABASES","SHOW REPLICATION GROUPS","SHOW RESOURCE MONITORS","SHOW ROLES","SHOW ROW ACCESS POLICIES","SHOW SCHEMAS","SHOW SEQUENCES","SHOW SESSION POLICIES","SHOW SHARES","SHOW SHARES IN FAILOVER GROUP","SHOW SHARES IN REPLICATION GROUP","SHOW STAGES","SHOW STREAMS","SHOW TABLES","SHOW TAGS","SHOW TASKS","SHOW TRANSACTIONS","SHOW USER FUNCTIONS","SHOW USERS","SHOW VARIABLES","SHOW VIEWS","SHOW WAREHOUSES","TRUNCATE MATERIALIZED VIEW","UNDROP DATABASE","UNDROP SCHEMA","UNDROP TABLE","UNDROP TAG","UNSET","USE DATABASE","USE ROLE","USE SCHEMA","USE SECONDARY ROLES","USE WAREHOUSE"]),B2e=Me(["UNION [ALL]","MINUS","EXCEPT","INTERSECT"]),H2e=Me(["[INNER] JOIN","[NATURAL] {LEFT | RIGHT | FULL} [OUTER] JOIN","{CROSS | NATURAL} JOIN"]),V2e=Me(["{ROWS | RANGE} BETWEEN","ON {UPDATE | DELETE} [SET NULL | SET DEFAULT]"]),G2e={name:"snowflake",tokenizerOptions:{reservedSelect:F2e,reservedClauses:[...$2e,...s6,...bC],reservedSetOperations:B2e,reservedJoins:H2e,reservedPhrases:V2e,reservedKeywords:j2e,reservedDataTypes:U2e,reservedFunctionNames:k2e,stringTypes:["$$","''-qq-bs"],identTypes:['""-qq'],variableTypes:[{regex:"[$][1-9]\\d*"},{regex:"[$][_a-zA-Z][_a-zA-Z0-9$]*"}],extraParens:["[]"],identChars:{rest:"$"},lineCommentTypes:["--","//"],operators:["%","::","||","=>",":=","->"],propertyAccessOperators:[":"]},formatOptions:{alwaysDenseOperators:["::"],onelineClauses:[...s6,...bC],tabularOnelineClauses:bC}},z2e=Object.freeze(Object.defineProperty({__proto__:null,bigquery:UMe,db2:QMe,db2i:iDe,duckdb:pDe,hive:ADe,mariadb:MDe,mysql:HDe,n1ql:iPe,plsql:pPe,postgresql:RPe,redshift:DPe,singlestoredb:P2e,snowflake:G2e,spark:VPe,sql:l2e,sqlite:ZPe,tidb:QDe,transactsql:N2e,trino:E2e},Symbol.toStringTag,{value:"Module"})),kp=e=>e[e.length-1],vQ=e=>e.sort((t,n)=>n.length-t.length||t.localeCompare(n)),fy=e=>e.replace(new RegExp("\\s+","gu")," "),vC=e=>/\n/.test(e),mi=e=>e.replace(new RegExp("[.*+?^${}()|[\\]\\\\]","gu"),"\\$&"),i6=new RegExp("\\s+","uy"),Hu=e=>new RegExp("(?:".concat(e,")"),"uy"),q2e=e=>e.split("").map(t=>new RegExp(" ","gu").test(t)?"\\s+":"[".concat(t.toUpperCase()).concat(t.toLowerCase(),"]")).join(""),Y2e=e=>e+"(?:-"+e+")*",W2e=({prefixes:e,requirePrefix:t})=>"(?:".concat(e.map(q2e).join("|")).concat(t?"":"|",")"),X2e=e=>new RegExp("(?:".concat(e.map(mi).join("|"),").*?(?=\r\n|\r|\n|$)"),"uy"),o6=(e,t=[])=>{const n=e==="open"?0:1,r=["()",...t].map(a=>a[n]);return Hu(r.map(mi).join("|"))},l6=e=>Hu("".concat(vQ(e).map(mi).join("|"))),K2e=({rest:e,dashes:t})=>e||t?"(?![".concat(e||"").concat(t?"-":"","])"):"",bl=(e,t={})=>{if(e.length===0)return new RegExp("^\\b$","u");const n=K2e(t),r=vQ(e).map(mi).join("|").replace(new RegExp(" ","gu"),"\\s+");return new RegExp("(?:".concat(r,")").concat(n,"\\b"),"iuy")},AC=(e,t)=>{if(!e.length)return;const n=e.map(mi).join("|");return Hu("(?:".concat(n,")(?:").concat(t,")"))};var i8;const Q2e=()=>{const e={"<":">","[":"]","(":")","{":"}"},t="{left}(?:(?!{right}').)*?{right}",n=Object.entries(e).map(([i,l])=>t.replace(/{left}/g,mi(i)).replace(/{right}/g,mi(l))),r=mi(Object.keys(e).join("")),a=String.raw(i8||(i8=wn(["(?<tag>[^s","])(?:(?!k<tag>').)*?k<tag>"],["(?<tag>[^\\s","])(?:(?!\\k<tag>').)*?\\k<tag>"])),r);return"[Qq]'(?:".concat(a,"|").concat(n.join("|"),")'")};var o8,l8,c8,u8,d8,h8,f8,m8,p8,g8,E8,T8,y8;const c6={"``":"(?:`[^`]*`)+","[]":String.raw(o8||(o8=wn(["(?:[[^]]*])(?:][^]]*])*"],["(?:\\[[^\\]]*\\])(?:\\][^\\]]*\\])*"]))),'""-qq':String.raw(l8||(l8=wn(['(?:"[^"]*")+']))),'""-bs':String.raw(c8||(c8=wn(['(?:"[^"\\]*(?:\\.[^"\\]*)*")'],['(?:"[^"\\\\]*(?:\\\\.[^"\\\\]*)*")']))),'""-qq-bs':String.raw(u8||(u8=wn(['(?:"[^"\\]*(?:\\.[^"\\]*)*")+'],['(?:"[^"\\\\]*(?:\\\\.[^"\\\\]*)*")+']))),'""-raw':String.raw(d8||(d8=wn(['(?:"[^"]*")']))),"''-qq":String.raw(h8||(h8=wn(["(?:'[^']*')+"]))),"''-bs":String.raw(f8||(f8=wn(["(?:'[^'\\]*(?:\\.[^'\\]*)*')"],["(?:'[^'\\\\]*(?:\\\\.[^'\\\\]*)*')"]))),"''-qq-bs":String.raw(m8||(m8=wn(["(?:'[^'\\]*(?:\\.[^'\\]*)*')+"],["(?:'[^'\\\\]*(?:\\\\.[^'\\\\]*)*')+"]))),"''-raw":String.raw(p8||(p8=wn(["(?:'[^']*')"]))),$$:String.raw(g8||(g8=wn(["(?<tag>$w*$)[sS]*?k<tag>"],["(?<tag>\\$\\w*\\$)[\\s\\S]*?\\k<tag>"]))),"'''..'''":String.raw(E8||(E8=wn(["'''[^\\]*?(?:\\.[^\\]*?)*?'''"],["'''[^\\\\]*?(?:\\\\.[^\\\\]*?)*?'''"]))),'""".."""':String.raw(T8||(T8=wn(['"""[^\\]*?(?:\\.[^\\]*?)*?"""'],['"""[^\\\\]*?(?:\\\\.[^\\\\]*?)*?"""']))),"{}":String.raw(y8||(y8=wn(["(?:{[^}]*})"],["(?:\\{[^\\}]*\\})"]))),"q''":Q2e()},AQ=e=>typeof e=="string"?c6[e]:"regex"in e?e.regex:W2e(e)+c6[e.quote],J2e=e=>Hu(e.map(t=>"regex"in t?t.regex:AQ(t)).join("|")),RQ=e=>e.map(AQ).join("|"),u6=e=>Hu(RQ(e)),Z2e=(e={})=>Hu(NQ(e)),NQ=({first:e,rest:t,dashes:n,allowFirstCharNumber:r}={})=>{const a="\\p{Alphabetic}\\p{Mark}_",s="\\p{Decimal_Number}",i=mi(e!=null?e:""),l=mi(t!=null?t:""),c=r?"[".concat(a).concat(s).concat(i,"][").concat(a).concat(s).concat(l,"]*"):"[".concat(a).concat(i,"][").concat(a).concat(s).concat(l,"]*");return n?Y2e(c):c};function _Q(e,t){const n=e.slice(0,t).split(/\n/);return{line:n.length,col:n[n.length-1].length+1}}class eke{constructor(t,n){this.rules=t,this.dialectName=n,this.input="",this.index=0}tokenize(t){this.input=t,this.index=0;const n=[];let r;for(;this.index<this.input.length;){const a=this.getWhitespace();if(this.index<this.input.length){if(r=this.getNextToken(),!r)throw this.createParseError();n.push(Object.assign(Object.assign({},r),{precedingWhitespace:a}))}}return n}createParseError(){const t=this.input.slice(this.index,this.index+10),{line:n,col:r}=_Q(this.input,this.index);return new Error('Parse error: Unexpected "'.concat(t,'" at line ').concat(n," column ").concat(r,".\n").concat(this.dialectInfo()))}dialectInfo(){return this.dialectName==="sql"?'This likely happens because you\'re using the default "sql" dialect.\nIf possible, please select a more specific dialect (like sqlite, postgresql, etc).':'SQL dialect used: "'.concat(this.dialectName,'".')}getWhitespace(){i6.lastIndex=this.index;const t=i6.exec(this.input);if(t)return this.index+=t[0].length,t[0]}getNextToken(){for(const t of this.rules){const n=this.match(t);if(n)return n}}match(t){t.regex.lastIndex=this.index;const n=t.regex.exec(this.input);if(n){const r=n[0],a={type:t.type,raw:r,text:t.text?t.text(r):r,start:this.index};return t.key&&(a.key=t.key(r)),this.index+=r.length,a}}}const d6=new RegExp("\\/\\*","uy"),tke=new RegExp("[\\s\\S]","uy"),nke=new RegExp("\\*\\/","uy");class rke{constructor(){this.lastIndex=0}exec(t){let n="",r,a=0;if(r=this.matchSection(d6,t))n+=r,a++;else return null;for(;a>0;)if(r=this.matchSection(d6,t))n+=r,a++;else if(r=this.matchSection(nke,t))n+=r,a--;else if(r=this.matchSection(tke,t))n+=r;else return null;return[n]}matchSection(t,n){t.lastIndex=this.lastIndex;const r=t.exec(n);return r&&(this.lastIndex+=r[0].length),r?r[0]:null}}class ake{constructor(t,n){this.cfg=t,this.dialectName=n,this.rulesBeforeParams=this.buildRulesBeforeParams(t),this.rulesAfterParams=this.buildRulesAfterParams(t)}tokenize(t,n){const r=[...this.rulesBeforeParams,...this.buildParamRules(this.cfg,n),...this.rulesAfterParams],a=new eke(r,this.dialectName).tokenize(t);return this.cfg.postProcess?this.cfg.postProcess(a):a}buildRulesBeforeParams(t){var n,r;return this.validRules([{type:Ve.BLOCK_COMMENT,regex:new RegExp("(\\/\\* *sql-formatter-disable *\\*\\/[\\s\\S]*?(?:\\/\\* *sql-formatter-enable *\\*\\/|$))","uy")},{type:Ve.BLOCK_COMMENT,regex:t.nestedBlockComments?new rke:new RegExp("(\\/\\*[^]*?\\*\\/)","uy")},{type:Ve.LINE_COMMENT,regex:X2e((n=t.lineCommentTypes)!==null&&n!==void 0?n:["--"])},{type:Ve.QUOTED_IDENTIFIER,regex:u6(t.identTypes)},{type:Ve.NUMBER,regex:new RegExp("(?:0x[0-9a-fA-F]+|0b[01]+|(?:-\\s*)?(?:[0-9]*\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)(?:[eE][-+]?[0-9]+(?:\\.[0-9]+)?)?)(?![\\w\\p{Alphabetic}])","uy")},{type:Ve.RESERVED_PHRASE,regex:bl((r=t.reservedPhrases)!==null&&r!==void 0?r:[],t.identChars),text:Xr},{type:Ve.CASE,regex:new RegExp("CASE\\b","iuy"),text:Xr},{type:Ve.END,regex:new RegExp("END\\b","iuy"),text:Xr},{type:Ve.BETWEEN,regex:new RegExp("BETWEEN\\b","iuy"),text:Xr},{type:Ve.LIMIT,regex:t.reservedClauses.includes("LIMIT")?new RegExp("LIMIT\\b","iuy"):void 0,text:Xr},{type:Ve.RESERVED_CLAUSE,regex:bl(t.reservedClauses,t.identChars),text:Xr},{type:Ve.RESERVED_SELECT,regex:bl(t.reservedSelect,t.identChars),text:Xr},{type:Ve.RESERVED_SET_OPERATION,regex:bl(t.reservedSetOperations,t.identChars),text:Xr},{type:Ve.WHEN,regex:new RegExp("WHEN\\b","iuy"),text:Xr},{type:Ve.ELSE,regex:new RegExp("ELSE\\b","iuy"),text:Xr},{type:Ve.THEN,regex:new RegExp("THEN\\b","iuy"),text:Xr},{type:Ve.RESERVED_JOIN,regex:bl(t.reservedJoins,t.identChars),text:Xr},{type:Ve.AND,regex:new RegExp("AND\\b","iuy"),text:Xr},{type:Ve.OR,regex:new RegExp("OR\\b","iuy"),text:Xr},{type:Ve.XOR,regex:t.supportsXor?new RegExp("XOR\\b","iuy"):void 0,text:Xr},...t.operatorKeyword?[{type:Ve.OPERATOR,regex:new RegExp("OPERATOR *\\([^)]+\\)","iuy")}]:[],{type:Ve.RESERVED_FUNCTION_NAME,regex:bl(t.reservedFunctionNames,t.identChars),text:Xr},{type:Ve.RESERVED_DATA_TYPE,regex:bl(t.reservedDataTypes,t.identChars),text:Xr},{type:Ve.RESERVED_KEYWORD,regex:bl(t.reservedKeywords,t.identChars),text:Xr}])}buildRulesAfterParams(t){var n,r;return this.validRules([{type:Ve.VARIABLE,regex:t.variableTypes?J2e(t.variableTypes):void 0},{type:Ve.STRING,regex:u6(t.stringTypes)},{type:Ve.IDENTIFIER,regex:Z2e(t.identChars)},{type:Ve.DELIMITER,regex:new RegExp("[;]","uy")},{type:Ve.COMMA,regex:new RegExp("[,]","y")},{type:Ve.OPEN_PAREN,regex:o6("open",t.extraParens)},{type:Ve.CLOSE_PAREN,regex:o6("close",t.extraParens)},{type:Ve.OPERATOR,regex:l6(["+","-","/",">","<","=","<>","<=",">=","!=",...(n=t.operators)!==null&&n!==void 0?n:[]])},{type:Ve.ASTERISK,regex:new RegExp("[*]","uy")},{type:Ve.PROPERTY_ACCESS_OPERATOR,regex:l6([".",...(r=t.propertyAccessOperators)!==null&&r!==void 0?r:[]])}])}buildParamRules(t,n){var r,a,s,i,l;const c={named:(n==null?void 0:n.named)||((r=t.paramTypes)===null||r===void 0?void 0:r.named)||[],quoted:(n==null?void 0:n.quoted)||((a=t.paramTypes)===null||a===void 0?void 0:a.quoted)||[],numbered:(n==null?void 0:n.numbered)||((s=t.paramTypes)===null||s===void 0?void 0:s.numbered)||[],positional:typeof(n==null?void 0:n.positional)=="boolean"?n.positional:(i=t.paramTypes)===null||i===void 0?void 0:i.positional,custom:(n==null?void 0:n.custom)||((l=t.paramTypes)===null||l===void 0?void 0:l.custom)||[]};return this.validRules([{type:Ve.NAMED_PARAMETER,regex:AC(c.named,NQ(t.paramChars||t.identChars)),key:u=>u.slice(1)},{type:Ve.QUOTED_PARAMETER,regex:AC(c.quoted,RQ(t.identTypes)),key:u=>(({tokenKey:h,quoteChar:m})=>h.replace(new RegExp(mi("\\"+m),"gu"),m))({tokenKey:u.slice(2,-1),quoteChar:u.slice(-1)})},{type:Ve.NUMBERED_PARAMETER,regex:AC(c.numbered,"[0-9]+"),key:u=>u.slice(1)},{type:Ve.POSITIONAL_PARAMETER,regex:c.positional?new RegExp("[?]","y"):void 0},...c.custom.map(u=>{var h;return{type:Ve.CUSTOM_PARAMETER,regex:Hu(u.regex),key:(h=u.key)!==null&&h!==void 0?h:m=>m}})])}validRules(t){return t.filter(n=>!!n.regex)}}const Xr=e=>fy(e.toUpperCase()),h6=new Map,ske=e=>{let t=h6.get(e);return t||(t=ike(e),h6.set(e,t)),t},ike=e=>({tokenizer:new ake(e.tokenizerOptions,e.name),formatOptions:oke(e.formatOptions)}),oke=e=>{var t;return{alwaysDenseOperators:e.alwaysDenseOperators||[],onelineClauses:Object.fromEntries(e.onelineClauses.map(n=>[n,!0])),tabularOnelineClauses:Object.fromEntries(((t=e.tabularOnelineClauses)!==null&&t!==void 0?t:e.onelineClauses).map(n=>[n,!0]))}};function lke(e){return e.indentStyle==="tabularLeft"||e.indentStyle==="tabularRight"?" ".repeat(10):e.useTabs?"	":" ".repeat(e.tabWidth)}function Pd(e){return e.indentStyle==="tabularLeft"||e.indentStyle==="tabularRight"}class cke{constructor(t){this.params=t,this.index=0}get({key:t,text:n}){return this.params?t?this.params[t]:this.params[this.index++]:n}getPositionalParameterIndex(){return this.index}setPositionalParameterIndex(t){this.index=t}}var my={exports:{}},uke=my.exports,f6;function dke(){return f6||(f6=1,function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(uke,function(){function t(u,h,m){return this.id=++t.highestId,this.name=u,this.symbols=h,this.postprocess=m,this}t.highestId=0,t.prototype.toString=function(u){var h=typeof u=="undefined"?this.symbols.map(c).join(" "):this.symbols.slice(0,u).map(c).join(" ")+" ● "+this.symbols.slice(u).map(c).join(" ");return this.name+" → "+h};function n(u,h,m,p){this.rule=u,this.dot=h,this.reference=m,this.data=[],this.wantedBy=p,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var h=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return h.left=this,h.right=u,h.isComplete&&(h.data=h.build(),h.right=void 0),h},n.prototype.build=function(){var u=[],h=this;do u.push(h.right.data),h=h.left;while(h.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,i.fail))};function r(u,h){this.grammar=u,this.index=h,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var h=this.states,m=this.wants,p=this.completed,g=0;g<h.length;g++){var T=h[g];if(T.isComplete){if(T.finish(),T.data!==i.fail){for(var y=T.wantedBy,b=y.length;b--;){var x=y[b];this.complete(x,T)}if(T.reference===this.index){var R=T.rule.name;(this.completed[R]=this.completed[R]||[]).push(T)}}}else{var R=T.rule.symbols[T.dot];if(typeof R!="string"){this.scannable.push(T);continue}if(m[R]){if(m[R].push(T),p.hasOwnProperty(R))for(var A=p[R],b=0;b<A.length;b++){var w=A[b];this.complete(T,w)}}else m[R]=[T],this.predict(R)}}},r.prototype.predict=function(u){for(var h=this.grammar.byName[u]||[],m=0;m<h.length;m++){var p=h[m],g=this.wants[u],T=new n(p,0,this.index,g);this.states.push(T)}},r.prototype.complete=function(u,h){var m=u.nextState(h);this.states.push(m)};function a(u,h){this.rules=u,this.start=h||this.rules[0].name;var m=this.byName={};this.rules.forEach(function(p){m.hasOwnProperty(p.name)||(m[p.name]=[]),m[p.name].push(p)})}a.fromCompiled=function(p,h){var m=p.Lexer;p.ParserStart&&(h=p.ParserStart,p=p.ParserRules);var p=p.map(function(T){return new t(T.name,T.symbols,T.postprocess)}),g=new a(p,h);return g.lexer=m,g};function s(){this.reset("")}s.prototype.reset=function(u,h){this.buffer=u,this.index=0,this.line=h?h.line:1,this.lastLineBreak=h?-h.col:0},s.prototype.next=function(){if(this.index<this.buffer.length){var u=this.buffer[this.index++];return u==="\n"&&(this.line+=1,this.lastLineBreak=this.index),{value:u}}},s.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},s.prototype.formatError=function(u,h){var m=this.buffer;if(typeof m=="string"){var p=m.split("\n").slice(Math.max(0,this.line-5),this.line),g=m.indexOf("\n",this.index);g===-1&&(g=m.length);var T=this.index-this.lastLineBreak,y=String(this.line).length;return h+=" at line "+this.line+" col "+T+":\n\n",h+=p.map(function(x,R){return b(this.line-p.length+R+1,y)+" "+x},this).join("\n"),h+="\n"+b("",y+T)+"^\n",h}else return h+" at index "+(this.index-1);function b(x,R){var A=String(x);return Array(R-A.length+1).join(" ")+A}};function i(u,h,m){if(u instanceof a)var p=u,m=h;else var p=a.fromCompiled(u,h);this.grammar=p,this.options={keepHistory:!1,lexer:p.lexer||new s};for(var g in m||{})this.options[g]=m[g];this.lexer=this.options.lexer,this.lexerState=void 0;var T=new r(p,0);this.table=[T],T.wants[p.start]=[],T.predict(p.start),T.process(),this.current=0}i.fail={},i.prototype.feed=function(u){var h=this.lexer;h.reset(u,this.lexerState);for(var m;;){try{if(m=h.next(),!m)break}catch(I){var y=new r(this.grammar,this.current+1);this.table.push(y);var p=new Error(this.reportLexerError(I));throw p.offset=this.current,p.token=I.token,p}var g=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var T=this.current+1,y=new r(this.grammar,T);this.table.push(y);for(var b=m.text!==void 0?m.text:m.value,x=h.constructor===s?m.value:m,R=g.scannable,A=R.length;A--;){var w=R[A],_=w.rule.symbols[w.dot];if(_.test?_.test(x):_.type?_.type===m.type:_.literal===b){var N=w.nextState({data:x,token:m,isToken:!0,reference:T-1});y.states.push(N)}}if(y.process(),y.states.length===0){var p=new Error(this.reportError(m));throw p.offset=this.current,p.token=m,p}this.options.keepHistory&&(g.lexerState=h.save()),this.current++}return g&&(this.lexerState=h.save()),this.results=this.finish(),this},i.prototype.reportLexerError=function(u){var h,m,p=u.token;return p?(h="input "+JSON.stringify(p.text[0])+" (lexer error)",m=this.lexer.formatError(p,"Syntax error")):(h="input (lexer error)",m=u.message),this.reportErrorCommon(m,h)},i.prototype.reportError=function(u){var h=(u.type?u.type+" token: ":"")+JSON.stringify(u.value!==void 0?u.value:u),m=this.lexer.formatError(u,"Syntax error");return this.reportErrorCommon(m,h)},i.prototype.reportErrorCommon=function(u,h){var m=[];m.push(u);var p=this.table.length-2,g=this.table[p],T=g.states.filter(function(b){var x=b.rule.symbols[b.dot];return x&&typeof x!="string"});if(T.length===0)m.push("Unexpected "+h+". I did not expect any more input. Here is the state of my parse table:\n"),this.displayStateStack(g.states,m);else{m.push("Unexpected "+h+". Instead, I was expecting to see one of the following:\n");var y=T.map(function(b){return this.buildFirstStateStack(b,[])||[b]},this);y.forEach(function(b){var x=b[0],R=x.rule.symbols[x.dot],A=this.getSymbolDisplay(R);m.push("A "+A+" based on:"),this.displayStateStack(b,m)},this)}return m.push(""),m.join("\n")},i.prototype.displayStateStack=function(u,h){for(var m,p=0,g=0;g<u.length;g++){var T=u[g],y=T.rule.toString(T.dot);y===m?p++:(p>0&&h.push("    ^ "+p+" more lines identical to this"),p=0,h.push("    "+y)),m=y}},i.prototype.getSymbolDisplay=function(u){return l(u)},i.prototype.buildFirstStateStack=function(u,h){if(h.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var m=u.wantedBy[0],p=[u].concat(h),g=this.buildFirstStateStack(m,p);return g===null?null:[u].concat(g)},i.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},i.prototype.restore=function(u){var h=u.index;this.current=h,this.table[h]=u,this.table.splice(h+1),this.lexerState=u.lexerState,this.results=this.finish()},i.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},i.prototype.finish=function(){var u=[],h=this.grammar.start,m=this.table[this.table.length-1];return m.states.forEach(function(p){p.rule.name===h&&p.dot===p.rule.symbols.length&&p.reference===0&&p.data!==i.fail&&u.push(p)}),u.map(function(p){return p.data})};function l(u){var h=typeof u;if(h==="string")return u;if(h==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function c(u){var h=typeof u;if(h==="string")return u;if(h==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:i,Grammar:a,Rule:t}})}(my)),my.exports}var hke=dke();const fke=ir(hke);function mke(e){return e.map(pke).map(gke).map(Eke).map(Tke).map(yke)}const pke=(e,t,n)=>{if(bQ(e.type)){const r=xke(n,t);if(r&&r.type===Ve.PROPERTY_ACCESS_OPERATOR)return Object.assign(Object.assign({},e),{type:Ve.IDENTIFIER,text:e.raw});const a=uf(n,t);if(a&&a.type===Ve.PROPERTY_ACCESS_OPERATOR)return Object.assign(Object.assign({},e),{type:Ve.IDENTIFIER,text:e.raw})}return e},gke=(e,t,n)=>{if(e.type===Ve.RESERVED_FUNCTION_NAME){const r=uf(n,t);if(!r||!wQ(r))return Object.assign(Object.assign({},e),{type:Ve.IDENTIFIER,text:e.raw})}return e},Eke=(e,t,n)=>{if(e.type===Ve.RESERVED_DATA_TYPE){const r=uf(n,t);if(r&&wQ(r))return Object.assign(Object.assign({},e),{type:Ve.RESERVED_PARAMETERIZED_DATA_TYPE})}return e},Tke=(e,t,n)=>{if(e.type===Ve.IDENTIFIER){const r=uf(n,t);if(r&&CQ(r))return Object.assign(Object.assign({},e),{type:Ve.ARRAY_IDENTIFIER})}return e},yke=(e,t,n)=>{if(e.type===Ve.RESERVED_DATA_TYPE){const r=uf(n,t);if(r&&CQ(r))return Object.assign(Object.assign({},e),{type:Ve.ARRAY_KEYWORD})}return e},xke=(e,t)=>uf(e,t,-1),uf=(e,t,n=1)=>{let r=1;for(;e[t+r*n]&&Ske(e[t+r*n]);)r++;return e[t+r*n]},wQ=e=>e.type===Ve.OPEN_PAREN&&e.text==="(",CQ=e=>e.type===Ve.OPEN_PAREN&&e.text==="[",Ske=e=>e.type===Ve.BLOCK_COMMENT||e.type===Ve.LINE_COMMENT;class IQ{constructor(t){this.tokenize=t,this.index=0,this.tokens=[],this.input=""}reset(t,n){this.input=t,this.index=0,this.tokens=this.tokenize(t)}next(){return this.tokens[this.index++]}save(){}formatError(t){const{line:n,col:r}=_Q(this.input,t.start);return"Parse error at token: ".concat(t.text," at line ").concat(n," column ").concat(r)}has(t){return t in Ve}}var Et;(function(e){e.statement="statement",e.clause="clause",e.set_operation="set_operation",e.function_call="function_call",e.parameterized_data_type="parameterized_data_type",e.array_subscript="array_subscript",e.property_access="property_access",e.parenthesis="parenthesis",e.between_predicate="between_predicate",e.case_expression="case_expression",e.case_when="case_when",e.case_else="case_else",e.limit_clause="limit_clause",e.all_columns_asterisk="all_columns_asterisk",e.literal="literal",e.identifier="identifier",e.keyword="keyword",e.data_type="data_type",e.parameter="parameter",e.operator="operator",e.comma="comma",e.line_comment="line_comment",e.block_comment="block_comment",e.disable_comment="disable_comment"})(Et=Et||(Et={}));function RC(e){return e[0]}const jt=new IQ(e=>[]),Oc=([[e]])=>e,Kr=e=>({type:Et.keyword,tokenType:e.type,text:e.text,raw:e.raw}),m6=e=>({type:Et.data_type,text:e.text,raw:e.raw}),Qr=(e,{leading:t,trailing:n})=>(t!=null&&t.length&&(e=Object.assign(Object.assign({},e),{leadingComments:t})),n!=null&&n.length&&(e=Object.assign(Object.assign({},e),{trailingComments:n})),e),bke=(e,{leading:t,trailing:n})=>{if(t!=null&&t.length){const[r,...a]=e;e=[Qr(r,{leading:t}),...a]}if(n!=null&&n.length){const r=e.slice(0,-1),a=e[e.length-1];e=[...r,Qr(a,{trailing:n})]}return e},vke={Lexer:jt,ParserRules:[{name:"main$ebnf$1",symbols:[]},{name:"main$ebnf$1",symbols:["main$ebnf$1","statement"],postprocess:e=>e[0].concat([e[1]])},{name:"main",symbols:["main$ebnf$1"],postprocess:([e])=>{const t=e[e.length-1];return t&&!t.hasSemicolon?t.children.length>0?e:e.slice(0,-1):e}},{name:"statement$subexpression$1",symbols:[jt.has("DELIMITER")?{type:"DELIMITER"}:DELIMITER]},{name:"statement$subexpression$1",symbols:[jt.has("EOF")?{type:"EOF"}:EOF]},{name:"statement",symbols:["expressions_or_clauses","statement$subexpression$1"],postprocess:([e,[t]])=>({type:Et.statement,children:e,hasSemicolon:t.type===Ve.DELIMITER})},{name:"expressions_or_clauses$ebnf$1",symbols:[]},{name:"expressions_or_clauses$ebnf$1",symbols:["expressions_or_clauses$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"expressions_or_clauses$ebnf$2",symbols:[]},{name:"expressions_or_clauses$ebnf$2",symbols:["expressions_or_clauses$ebnf$2","clause"],postprocess:e=>e[0].concat([e[1]])},{name:"expressions_or_clauses",symbols:["expressions_or_clauses$ebnf$1","expressions_or_clauses$ebnf$2"],postprocess:([e,t])=>[...e,...t]},{name:"clause$subexpression$1",symbols:["limit_clause"]},{name:"clause$subexpression$1",symbols:["select_clause"]},{name:"clause$subexpression$1",symbols:["other_clause"]},{name:"clause$subexpression$1",symbols:["set_operation"]},{name:"clause",symbols:["clause$subexpression$1"],postprocess:Oc},{name:"limit_clause$ebnf$1$subexpression$1$ebnf$1",symbols:["free_form_sql"]},{name:"limit_clause$ebnf$1$subexpression$1$ebnf$1",symbols:["limit_clause$ebnf$1$subexpression$1$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"limit_clause$ebnf$1$subexpression$1",symbols:[jt.has("COMMA")?{type:"COMMA"}:COMMA,"limit_clause$ebnf$1$subexpression$1$ebnf$1"]},{name:"limit_clause$ebnf$1",symbols:["limit_clause$ebnf$1$subexpression$1"],postprocess:RC},{name:"limit_clause$ebnf$1",symbols:[],postprocess:()=>null},{name:"limit_clause",symbols:[jt.has("LIMIT")?{type:"LIMIT"}:LIMIT,"_","expression_chain_","limit_clause$ebnf$1"],postprocess:([e,t,n,r])=>{if(r){const[a,s]=r;return{type:Et.limit_clause,limitKw:Qr(Kr(e),{trailing:t}),offset:n,count:s}}else return{type:Et.limit_clause,limitKw:Qr(Kr(e),{trailing:t}),count:n}}},{name:"select_clause$subexpression$1$ebnf$1",symbols:[]},{name:"select_clause$subexpression$1$ebnf$1",symbols:["select_clause$subexpression$1$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"select_clause$subexpression$1",symbols:["all_columns_asterisk","select_clause$subexpression$1$ebnf$1"]},{name:"select_clause$subexpression$1$ebnf$2",symbols:[]},{name:"select_clause$subexpression$1$ebnf$2",symbols:["select_clause$subexpression$1$ebnf$2","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"select_clause$subexpression$1",symbols:["asteriskless_free_form_sql","select_clause$subexpression$1$ebnf$2"]},{name:"select_clause",symbols:[jt.has("RESERVED_SELECT")?{type:"RESERVED_SELECT"}:RESERVED_SELECT,"select_clause$subexpression$1"],postprocess:([e,[t,n]])=>({type:Et.clause,nameKw:Kr(e),children:[t,...n]})},{name:"select_clause",symbols:[jt.has("RESERVED_SELECT")?{type:"RESERVED_SELECT"}:RESERVED_SELECT],postprocess:([e])=>({type:Et.clause,nameKw:Kr(e),children:[]})},{name:"all_columns_asterisk",symbols:[jt.has("ASTERISK")?{type:"ASTERISK"}:ASTERISK],postprocess:()=>({type:Et.all_columns_asterisk})},{name:"other_clause$ebnf$1",symbols:[]},{name:"other_clause$ebnf$1",symbols:["other_clause$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"other_clause",symbols:[jt.has("RESERVED_CLAUSE")?{type:"RESERVED_CLAUSE"}:RESERVED_CLAUSE,"other_clause$ebnf$1"],postprocess:([e,t])=>({type:Et.clause,nameKw:Kr(e),children:t})},{name:"set_operation$ebnf$1",symbols:[]},{name:"set_operation$ebnf$1",symbols:["set_operation$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"set_operation",symbols:[jt.has("RESERVED_SET_OPERATION")?{type:"RESERVED_SET_OPERATION"}:RESERVED_SET_OPERATION,"set_operation$ebnf$1"],postprocess:([e,t])=>({type:Et.set_operation,nameKw:Kr(e),children:t})},{name:"expression_chain_$ebnf$1",symbols:["expression_with_comments_"]},{name:"expression_chain_$ebnf$1",symbols:["expression_chain_$ebnf$1","expression_with_comments_"],postprocess:e=>e[0].concat([e[1]])},{name:"expression_chain_",symbols:["expression_chain_$ebnf$1"],postprocess:RC},{name:"expression_chain$ebnf$1",symbols:[]},{name:"expression_chain$ebnf$1",symbols:["expression_chain$ebnf$1","_expression_with_comments"],postprocess:e=>e[0].concat([e[1]])},{name:"expression_chain",symbols:["expression","expression_chain$ebnf$1"],postprocess:([e,t])=>[e,...t]},{name:"andless_expression_chain$ebnf$1",symbols:[]},{name:"andless_expression_chain$ebnf$1",symbols:["andless_expression_chain$ebnf$1","_andless_expression_with_comments"],postprocess:e=>e[0].concat([e[1]])},{name:"andless_expression_chain",symbols:["andless_expression","andless_expression_chain$ebnf$1"],postprocess:([e,t])=>[e,...t]},{name:"expression_with_comments_",symbols:["expression","_"],postprocess:([e,t])=>Qr(e,{trailing:t})},{name:"_expression_with_comments",symbols:["_","expression"],postprocess:([e,t])=>Qr(t,{leading:e})},{name:"_andless_expression_with_comments",symbols:["_","andless_expression"],postprocess:([e,t])=>Qr(t,{leading:e})},{name:"free_form_sql$subexpression$1",symbols:["asteriskless_free_form_sql"]},{name:"free_form_sql$subexpression$1",symbols:["asterisk"]},{name:"free_form_sql",symbols:["free_form_sql$subexpression$1"],postprocess:Oc},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["asteriskless_andless_expression"]},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["logic_operator"]},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["comma"]},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["comment"]},{name:"asteriskless_free_form_sql$subexpression$1",symbols:["other_keyword"]},{name:"asteriskless_free_form_sql",symbols:["asteriskless_free_form_sql$subexpression$1"],postprocess:Oc},{name:"expression$subexpression$1",symbols:["andless_expression"]},{name:"expression$subexpression$1",symbols:["logic_operator"]},{name:"expression",symbols:["expression$subexpression$1"],postprocess:Oc},{name:"andless_expression$subexpression$1",symbols:["asteriskless_andless_expression"]},{name:"andless_expression$subexpression$1",symbols:["asterisk"]},{name:"andless_expression",symbols:["andless_expression$subexpression$1"],postprocess:Oc},{name:"asteriskless_andless_expression$subexpression$1",symbols:["atomic_expression"]},{name:"asteriskless_andless_expression$subexpression$1",symbols:["between_predicate"]},{name:"asteriskless_andless_expression$subexpression$1",symbols:["case_expression"]},{name:"asteriskless_andless_expression",symbols:["asteriskless_andless_expression$subexpression$1"],postprocess:Oc},{name:"atomic_expression$subexpression$1",symbols:["array_subscript"]},{name:"atomic_expression$subexpression$1",symbols:["function_call"]},{name:"atomic_expression$subexpression$1",symbols:["property_access"]},{name:"atomic_expression$subexpression$1",symbols:["parenthesis"]},{name:"atomic_expression$subexpression$1",symbols:["curly_braces"]},{name:"atomic_expression$subexpression$1",symbols:["square_brackets"]},{name:"atomic_expression$subexpression$1",symbols:["operator"]},{name:"atomic_expression$subexpression$1",symbols:["identifier"]},{name:"atomic_expression$subexpression$1",symbols:["parameter"]},{name:"atomic_expression$subexpression$1",symbols:["literal"]},{name:"atomic_expression$subexpression$1",symbols:["data_type"]},{name:"atomic_expression$subexpression$1",symbols:["keyword"]},{name:"atomic_expression",symbols:["atomic_expression$subexpression$1"],postprocess:Oc},{name:"array_subscript",symbols:[jt.has("ARRAY_IDENTIFIER")?{type:"ARRAY_IDENTIFIER"}:ARRAY_IDENTIFIER,"_","square_brackets"],postprocess:([e,t,n])=>({type:Et.array_subscript,array:Qr({type:Et.identifier,quoted:!1,text:e.text},{trailing:t}),parenthesis:n})},{name:"array_subscript",symbols:[jt.has("ARRAY_KEYWORD")?{type:"ARRAY_KEYWORD"}:ARRAY_KEYWORD,"_","square_brackets"],postprocess:([e,t,n])=>({type:Et.array_subscript,array:Qr(Kr(e),{trailing:t}),parenthesis:n})},{name:"function_call",symbols:[jt.has("RESERVED_FUNCTION_NAME")?{type:"RESERVED_FUNCTION_NAME"}:RESERVED_FUNCTION_NAME,"_","parenthesis"],postprocess:([e,t,n])=>({type:Et.function_call,nameKw:Qr(Kr(e),{trailing:t}),parenthesis:n})},{name:"parenthesis",symbols:[{literal:"("},"expressions_or_clauses",{literal:")"}],postprocess:([e,t,n])=>({type:Et.parenthesis,children:t,openParen:"(",closeParen:")"})},{name:"curly_braces$ebnf$1",symbols:[]},{name:"curly_braces$ebnf$1",symbols:["curly_braces$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"curly_braces",symbols:[{literal:"{"},"curly_braces$ebnf$1",{literal:"}"}],postprocess:([e,t,n])=>({type:Et.parenthesis,children:t,openParen:"{",closeParen:"}"})},{name:"square_brackets$ebnf$1",symbols:[]},{name:"square_brackets$ebnf$1",symbols:["square_brackets$ebnf$1","free_form_sql"],postprocess:e=>e[0].concat([e[1]])},{name:"square_brackets",symbols:[{literal:"["},"square_brackets$ebnf$1",{literal:"]"}],postprocess:([e,t,n])=>({type:Et.parenthesis,children:t,openParen:"[",closeParen:"]"})},{name:"property_access$subexpression$1",symbols:["identifier"]},{name:"property_access$subexpression$1",symbols:["array_subscript"]},{name:"property_access$subexpression$1",symbols:["all_columns_asterisk"]},{name:"property_access$subexpression$1",symbols:["parameter"]},{name:"property_access",symbols:["atomic_expression","_",jt.has("PROPERTY_ACCESS_OPERATOR")?{type:"PROPERTY_ACCESS_OPERATOR"}:PROPERTY_ACCESS_OPERATOR,"_","property_access$subexpression$1"],postprocess:([e,t,n,r,[a]])=>({type:Et.property_access,object:Qr(e,{trailing:t}),operator:n.text,property:Qr(a,{leading:r})})},{name:"between_predicate",symbols:[jt.has("BETWEEN")?{type:"BETWEEN"}:BETWEEN,"_","andless_expression_chain","_",jt.has("AND")?{type:"AND"}:AND,"_","andless_expression"],postprocess:([e,t,n,r,a,s,i])=>({type:Et.between_predicate,betweenKw:Kr(e),expr1:bke(n,{leading:t,trailing:r}),andKw:Kr(a),expr2:[Qr(i,{leading:s})]})},{name:"case_expression$ebnf$1",symbols:["expression_chain_"],postprocess:RC},{name:"case_expression$ebnf$1",symbols:[],postprocess:()=>null},{name:"case_expression$ebnf$2",symbols:[]},{name:"case_expression$ebnf$2",symbols:["case_expression$ebnf$2","case_clause"],postprocess:e=>e[0].concat([e[1]])},{name:"case_expression",symbols:[jt.has("CASE")?{type:"CASE"}:CASE,"_","case_expression$ebnf$1","case_expression$ebnf$2",jt.has("END")?{type:"END"}:END],postprocess:([e,t,n,r,a])=>({type:Et.case_expression,caseKw:Qr(Kr(e),{trailing:t}),endKw:Kr(a),expr:n||[],clauses:r})},{name:"case_clause",symbols:[jt.has("WHEN")?{type:"WHEN"}:WHEN,"_","expression_chain_",jt.has("THEN")?{type:"THEN"}:THEN,"_","expression_chain_"],postprocess:([e,t,n,r,a,s])=>({type:Et.case_when,whenKw:Qr(Kr(e),{trailing:t}),thenKw:Qr(Kr(r),{trailing:a}),condition:n,result:s})},{name:"case_clause",symbols:[jt.has("ELSE")?{type:"ELSE"}:ELSE,"_","expression_chain_"],postprocess:([e,t,n])=>({type:Et.case_else,elseKw:Qr(Kr(e),{trailing:t}),result:n})},{name:"comma$subexpression$1",symbols:[jt.has("COMMA")?{type:"COMMA"}:COMMA]},{name:"comma",symbols:["comma$subexpression$1"],postprocess:([[e]])=>({type:Et.comma})},{name:"asterisk$subexpression$1",symbols:[jt.has("ASTERISK")?{type:"ASTERISK"}:ASTERISK]},{name:"asterisk",symbols:["asterisk$subexpression$1"],postprocess:([[e]])=>({type:Et.operator,text:e.text})},{name:"operator$subexpression$1",symbols:[jt.has("OPERATOR")?{type:"OPERATOR"}:OPERATOR]},{name:"operator",symbols:["operator$subexpression$1"],postprocess:([[e]])=>({type:Et.operator,text:e.text})},{name:"identifier$subexpression$1",symbols:[jt.has("IDENTIFIER")?{type:"IDENTIFIER"}:IDENTIFIER]},{name:"identifier$subexpression$1",symbols:[jt.has("QUOTED_IDENTIFIER")?{type:"QUOTED_IDENTIFIER"}:QUOTED_IDENTIFIER]},{name:"identifier$subexpression$1",symbols:[jt.has("VARIABLE")?{type:"VARIABLE"}:VARIABLE]},{name:"identifier",symbols:["identifier$subexpression$1"],postprocess:([[e]])=>({type:Et.identifier,quoted:e.type!=="IDENTIFIER",text:e.text})},{name:"parameter$subexpression$1",symbols:[jt.has("NAMED_PARAMETER")?{type:"NAMED_PARAMETER"}:NAMED_PARAMETER]},{name:"parameter$subexpression$1",symbols:[jt.has("QUOTED_PARAMETER")?{type:"QUOTED_PARAMETER"}:QUOTED_PARAMETER]},{name:"parameter$subexpression$1",symbols:[jt.has("NUMBERED_PARAMETER")?{type:"NUMBERED_PARAMETER"}:NUMBERED_PARAMETER]},{name:"parameter$subexpression$1",symbols:[jt.has("POSITIONAL_PARAMETER")?{type:"POSITIONAL_PARAMETER"}:POSITIONAL_PARAMETER]},{name:"parameter$subexpression$1",symbols:[jt.has("CUSTOM_PARAMETER")?{type:"CUSTOM_PARAMETER"}:CUSTOM_PARAMETER]},{name:"parameter",symbols:["parameter$subexpression$1"],postprocess:([[e]])=>({type:Et.parameter,key:e.key,text:e.text})},{name:"literal$subexpression$1",symbols:[jt.has("NUMBER")?{type:"NUMBER"}:NUMBER]},{name:"literal$subexpression$1",symbols:[jt.has("STRING")?{type:"STRING"}:STRING]},{name:"literal",symbols:["literal$subexpression$1"],postprocess:([[e]])=>({type:Et.literal,text:e.text})},{name:"keyword$subexpression$1",symbols:[jt.has("RESERVED_KEYWORD")?{type:"RESERVED_KEYWORD"}:RESERVED_KEYWORD]},{name:"keyword$subexpression$1",symbols:[jt.has("RESERVED_PHRASE")?{type:"RESERVED_PHRASE"}:RESERVED_PHRASE]},{name:"keyword$subexpression$1",symbols:[jt.has("RESERVED_JOIN")?{type:"RESERVED_JOIN"}:RESERVED_JOIN]},{name:"keyword",symbols:["keyword$subexpression$1"],postprocess:([[e]])=>Kr(e)},{name:"data_type$subexpression$1",symbols:[jt.has("RESERVED_DATA_TYPE")?{type:"RESERVED_DATA_TYPE"}:RESERVED_DATA_TYPE]},{name:"data_type",symbols:["data_type$subexpression$1"],postprocess:([[e]])=>m6(e)},{name:"data_type",symbols:[jt.has("RESERVED_PARAMETERIZED_DATA_TYPE")?{type:"RESERVED_PARAMETERIZED_DATA_TYPE"}:RESERVED_PARAMETERIZED_DATA_TYPE,"_","parenthesis"],postprocess:([e,t,n])=>({type:Et.parameterized_data_type,dataType:Qr(m6(e),{trailing:t}),parenthesis:n})},{name:"logic_operator$subexpression$1",symbols:[jt.has("AND")?{type:"AND"}:AND]},{name:"logic_operator$subexpression$1",symbols:[jt.has("OR")?{type:"OR"}:OR]},{name:"logic_operator$subexpression$1",symbols:[jt.has("XOR")?{type:"XOR"}:XOR]},{name:"logic_operator",symbols:["logic_operator$subexpression$1"],postprocess:([[e]])=>Kr(e)},{name:"other_keyword$subexpression$1",symbols:[jt.has("WHEN")?{type:"WHEN"}:WHEN]},{name:"other_keyword$subexpression$1",symbols:[jt.has("THEN")?{type:"THEN"}:THEN]},{name:"other_keyword$subexpression$1",symbols:[jt.has("ELSE")?{type:"ELSE"}:ELSE]},{name:"other_keyword$subexpression$1",symbols:[jt.has("END")?{type:"END"}:END]},{name:"other_keyword",symbols:["other_keyword$subexpression$1"],postprocess:([[e]])=>Kr(e)},{name:"_$ebnf$1",symbols:[]},{name:"_$ebnf$1",symbols:["_$ebnf$1","comment"],postprocess:e=>e[0].concat([e[1]])},{name:"_",symbols:["_$ebnf$1"],postprocess:([e])=>e},{name:"comment",symbols:[jt.has("LINE_COMMENT")?{type:"LINE_COMMENT"}:LINE_COMMENT],postprocess:([e])=>({type:Et.line_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})},{name:"comment",symbols:[jt.has("BLOCK_COMMENT")?{type:"BLOCK_COMMENT"}:BLOCK_COMMENT],postprocess:([e])=>({type:Et.block_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})},{name:"comment",symbols:[jt.has("DISABLE_COMMENT")?{type:"DISABLE_COMMENT"}:DISABLE_COMMENT],postprocess:([e])=>({type:Et.disable_comment,text:e.text,precedingWhitespace:e.precedingWhitespace})}],ParserStart:"main"},{Parser:Ake,Grammar:Rke}=fke;function Nke(e){let t={};const n=new IQ(a=>[...mke(e.tokenize(a,t)),SQ(a.length)]),r=new Ake(Rke.fromCompiled(vke),{lexer:n});return{parse:(a,s)=>{t=s;const{results:i}=r.feed(a);if(i.length===1)return i[0];throw i.length===0?new Error("Parse error: Invalid SQL"):new Error("Parse error: Ambiguous grammar\n".concat(JSON.stringify(i,void 0,2)))}}}var Fe;(function(e){e[e.SPACE=0]="SPACE",e[e.NO_SPACE=1]="NO_SPACE",e[e.NO_NEWLINE=2]="NO_NEWLINE",e[e.NEWLINE=3]="NEWLINE",e[e.MANDATORY_NEWLINE=4]="MANDATORY_NEWLINE",e[e.INDENT=5]="INDENT",e[e.SINGLE_INDENT=6]="SINGLE_INDENT"})(Fe=Fe||(Fe={}));class OQ{constructor(t){this.indentation=t,this.items=[]}add(...t){for(const n of t)switch(n){case Fe.SPACE:this.items.push(Fe.SPACE);break;case Fe.NO_SPACE:this.trimHorizontalWhitespace();break;case Fe.NO_NEWLINE:this.trimWhitespace();break;case Fe.NEWLINE:this.trimHorizontalWhitespace(),this.addNewline(Fe.NEWLINE);break;case Fe.MANDATORY_NEWLINE:this.trimHorizontalWhitespace(),this.addNewline(Fe.MANDATORY_NEWLINE);break;case Fe.INDENT:this.addIndentation();break;case Fe.SINGLE_INDENT:this.items.push(Fe.SINGLE_INDENT);break;default:this.items.push(n)}}trimHorizontalWhitespace(){for(;_ke(kp(this.items));)this.items.pop()}trimWhitespace(){for(;wke(kp(this.items));)this.items.pop()}addNewline(t){if(this.items.length>0)switch(kp(this.items)){case Fe.NEWLINE:this.items.pop(),this.items.push(t);break;case Fe.MANDATORY_NEWLINE:break;default:this.items.push(t);break}}addIndentation(){for(let t=0;t<this.indentation.getLevel();t++)this.items.push(Fe.SINGLE_INDENT)}toString(){return this.items.map(t=>this.itemToString(t)).join("")}getLayoutItems(){return this.items}itemToString(t){switch(t){case Fe.SPACE:return" ";case Fe.NEWLINE:case Fe.MANDATORY_NEWLINE:return"\n";case Fe.SINGLE_INDENT:return this.indentation.getSingleIndent();default:return t}}}const _ke=e=>e===Fe.SPACE||e===Fe.SINGLE_INDENT,wke=e=>e===Fe.SPACE||e===Fe.SINGLE_INDENT||e===Fe.NEWLINE;function p6(e,t){if(t==="standard")return e;let n=[];return e.length>=10&&e.includes(" ")&&([e,...n]=e.split(" ")),t==="tabularLeft"?e=e.padEnd(9," "):e=e.padStart(9," "),e+["",...n].join(" ")}function g6(e){return CMe(e)||e===Ve.RESERVED_CLAUSE||e===Ve.RESERVED_SELECT||e===Ve.RESERVED_SET_OPERATION||e===Ve.RESERVED_JOIN||e===Ve.LIMIT}const NC="top-level",Cke="block-level";class LQ{constructor(t){this.indent=t,this.indentTypes=[]}getSingleIndent(){return this.indent}getLevel(){return this.indentTypes.length}increaseTopLevel(){this.indentTypes.push(NC)}increaseBlockLevel(){this.indentTypes.push(Cke)}decreaseTopLevel(){this.indentTypes.length>0&&kp(this.indentTypes)===NC&&this.indentTypes.pop()}decreaseBlockLevel(){for(;this.indentTypes.length>0&&this.indentTypes.pop()===NC;);}}class Ike extends OQ{constructor(t){super(new LQ("")),this.expressionWidth=t,this.length=0,this.trailingSpace=!1}add(...t){if(t.forEach(n=>this.addToLength(n)),this.length>this.expressionWidth)throw new s1;super.add(...t)}addToLength(t){if(typeof t=="string")this.length+=t.length,this.trailingSpace=!1;else{if(t===Fe.MANDATORY_NEWLINE||t===Fe.NEWLINE)throw new s1;t===Fe.INDENT||t===Fe.SINGLE_INDENT||t===Fe.SPACE?this.trailingSpace||(this.length++,this.trailingSpace=!0):(t===Fe.NO_NEWLINE||t===Fe.NO_SPACE)&&this.trailingSpace&&(this.trailingSpace=!1,this.length--)}}}class s1 extends Error{}class T0{constructor({cfg:t,dialectCfg:n,params:r,layout:a,inline:s=!1}){this.inline=!1,this.nodes=[],this.index=-1,this.cfg=t,this.dialectCfg=n,this.inline=s,this.params=r,this.layout=a}format(t){for(this.nodes=t,this.index=0;this.index<this.nodes.length;this.index++)this.formatNode(this.nodes[this.index]);return this.layout}formatNode(t){this.formatComments(t.leadingComments),this.formatNodeWithoutComments(t),this.formatComments(t.trailingComments)}formatNodeWithoutComments(t){switch(t.type){case Et.function_call:return this.formatFunctionCall(t);case Et.parameterized_data_type:return this.formatParameterizedDataType(t);case Et.array_subscript:return this.formatArraySubscript(t);case Et.property_access:return this.formatPropertyAccess(t);case Et.parenthesis:return this.formatParenthesis(t);case Et.between_predicate:return this.formatBetweenPredicate(t);case Et.case_expression:return this.formatCaseExpression(t);case Et.case_when:return this.formatCaseWhen(t);case Et.case_else:return this.formatCaseElse(t);case Et.clause:return this.formatClause(t);case Et.set_operation:return this.formatSetOperation(t);case Et.limit_clause:return this.formatLimitClause(t);case Et.all_columns_asterisk:return this.formatAllColumnsAsterisk(t);case Et.literal:return this.formatLiteral(t);case Et.identifier:return this.formatIdentifier(t);case Et.parameter:return this.formatParameter(t);case Et.operator:return this.formatOperator(t);case Et.comma:return this.formatComma(t);case Et.line_comment:return this.formatLineComment(t);case Et.block_comment:return this.formatBlockComment(t);case Et.disable_comment:return this.formatBlockComment(t);case Et.data_type:return this.formatDataType(t);case Et.keyword:return this.formatKeywordNode(t)}}formatFunctionCall(t){this.withComments(t.nameKw,()=>{this.layout.add(this.showFunctionKw(t.nameKw))}),this.formatNode(t.parenthesis)}formatParameterizedDataType(t){this.withComments(t.dataType,()=>{this.layout.add(this.showDataType(t.dataType))}),this.formatNode(t.parenthesis)}formatArraySubscript(t){let n;switch(t.array.type){case Et.data_type:n=this.showDataType(t.array);break;case Et.keyword:n=this.showKw(t.array);break;default:n=this.showIdentifier(t.array);break}this.withComments(t.array,()=>{this.layout.add(n)}),this.formatNode(t.parenthesis)}formatPropertyAccess(t){this.formatNode(t.object),this.layout.add(Fe.NO_SPACE,t.operator),this.formatNode(t.property)}formatParenthesis(t){const n=this.formatInlineExpression(t.children);n?(this.layout.add(t.openParen),this.layout.add(...n.getLayoutItems()),this.layout.add(Fe.NO_SPACE,t.closeParen,Fe.SPACE)):(this.layout.add(t.openParen,Fe.NEWLINE),Pd(this.cfg)?(this.layout.add(Fe.INDENT),this.layout=this.formatSubExpression(t.children)):(this.layout.indentation.increaseBlockLevel(),this.layout.add(Fe.INDENT),this.layout=this.formatSubExpression(t.children),this.layout.indentation.decreaseBlockLevel()),this.layout.add(Fe.NEWLINE,Fe.INDENT,t.closeParen,Fe.SPACE))}formatBetweenPredicate(t){this.layout.add(this.showKw(t.betweenKw),Fe.SPACE),this.layout=this.formatSubExpression(t.expr1),this.layout.add(Fe.NO_SPACE,Fe.SPACE,this.showNonTabularKw(t.andKw),Fe.SPACE),this.layout=this.formatSubExpression(t.expr2),this.layout.add(Fe.SPACE)}formatCaseExpression(t){this.formatNode(t.caseKw),this.layout.indentation.increaseBlockLevel(),this.layout=this.formatSubExpression(t.expr),this.layout=this.formatSubExpression(t.clauses),this.layout.indentation.decreaseBlockLevel(),this.layout.add(Fe.NEWLINE,Fe.INDENT),this.formatNode(t.endKw)}formatCaseWhen(t){this.layout.add(Fe.NEWLINE,Fe.INDENT),this.formatNode(t.whenKw),this.layout=this.formatSubExpression(t.condition),this.formatNode(t.thenKw),this.layout=this.formatSubExpression(t.result)}formatCaseElse(t){this.layout.add(Fe.NEWLINE,Fe.INDENT),this.formatNode(t.elseKw),this.layout=this.formatSubExpression(t.result)}formatClause(t){this.isOnelineClause(t)?this.formatClauseInOnelineStyle(t):Pd(this.cfg)?this.formatClauseInTabularStyle(t):this.formatClauseInIndentedStyle(t)}isOnelineClause(t){return Pd(this.cfg)?this.dialectCfg.tabularOnelineClauses[t.nameKw.text]:this.dialectCfg.onelineClauses[t.nameKw.text]}formatClauseInIndentedStyle(t){this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t.nameKw),Fe.NEWLINE),this.layout.indentation.increaseTopLevel(),this.layout.add(Fe.INDENT),this.layout=this.formatSubExpression(t.children),this.layout.indentation.decreaseTopLevel()}formatClauseInOnelineStyle(t){this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t.nameKw),Fe.SPACE),this.layout=this.formatSubExpression(t.children)}formatClauseInTabularStyle(t){this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t.nameKw),Fe.SPACE),this.layout.indentation.increaseTopLevel(),this.layout=this.formatSubExpression(t.children),this.layout.indentation.decreaseTopLevel()}formatSetOperation(t){this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t.nameKw),Fe.NEWLINE),this.layout.add(Fe.INDENT),this.layout=this.formatSubExpression(t.children)}formatLimitClause(t){this.withComments(t.limitKw,()=>{this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t.limitKw))}),this.layout.indentation.increaseTopLevel(),Pd(this.cfg)?this.layout.add(Fe.SPACE):this.layout.add(Fe.NEWLINE,Fe.INDENT),t.offset?(this.layout=this.formatSubExpression(t.offset),this.layout.add(Fe.NO_SPACE,",",Fe.SPACE),this.layout=this.formatSubExpression(t.count)):this.layout=this.formatSubExpression(t.count),this.layout.indentation.decreaseTopLevel()}formatAllColumnsAsterisk(t){this.layout.add("*",Fe.SPACE)}formatLiteral(t){this.layout.add(t.text,Fe.SPACE)}formatIdentifier(t){this.layout.add(this.showIdentifier(t),Fe.SPACE)}formatParameter(t){this.layout.add(this.params.get(t),Fe.SPACE)}formatOperator({text:t}){this.cfg.denseOperators||this.dialectCfg.alwaysDenseOperators.includes(t)?this.layout.add(Fe.NO_SPACE,t):t===":"?this.layout.add(Fe.NO_SPACE,t,Fe.SPACE):this.layout.add(t,Fe.SPACE)}formatComma(t){this.inline?this.layout.add(Fe.NO_SPACE,",",Fe.SPACE):this.layout.add(Fe.NO_SPACE,",",Fe.NEWLINE,Fe.INDENT)}withComments(t,n){this.formatComments(t.leadingComments),n(),this.formatComments(t.trailingComments)}formatComments(t){t&&t.forEach(n=>{n.type===Et.line_comment?this.formatLineComment(n):this.formatBlockComment(n)})}formatLineComment(t){vC(t.precedingWhitespace||"")?this.layout.add(Fe.NEWLINE,Fe.INDENT,t.text,Fe.MANDATORY_NEWLINE,Fe.INDENT):this.layout.getLayoutItems().length>0?this.layout.add(Fe.NO_NEWLINE,Fe.SPACE,t.text,Fe.MANDATORY_NEWLINE,Fe.INDENT):this.layout.add(t.text,Fe.MANDATORY_NEWLINE,Fe.INDENT)}formatBlockComment(t){t.type===Et.block_comment&&this.isMultilineBlockComment(t)?(this.splitBlockComment(t.text).forEach(n=>{this.layout.add(Fe.NEWLINE,Fe.INDENT,n)}),this.layout.add(Fe.NEWLINE,Fe.INDENT)):this.layout.add(t.text,Fe.SPACE)}isMultilineBlockComment(t){return vC(t.text)||vC(t.precedingWhitespace||"")}isDocComment(t){const n=t.split(/\n/);return/^\/\*\*?$/.test(n[0])&&n.slice(1,n.length-1).every(r=>/^\s*\*/.test(r))&&/^\s*\*\/$/.test(kp(n))}splitBlockComment(t){return this.isDocComment(t)?t.split(/\n/).map(n=>/^\s*\*/.test(n)?" "+n.replace(/^\s*/,""):n):t.split(/\n/).map(n=>n.replace(/^\s*/,""))}formatSubExpression(t){return new T0({cfg:this.cfg,dialectCfg:this.dialectCfg,params:this.params,layout:this.layout,inline:this.inline}).format(t)}formatInlineExpression(t){const n=this.params.getPositionalParameterIndex();try{return new T0({cfg:this.cfg,dialectCfg:this.dialectCfg,params:this.params,layout:new Ike(this.cfg.expressionWidth),inline:!0}).format(t)}catch(r){if(r instanceof s1){this.params.setPositionalParameterIndex(n);return}else throw r}}formatKeywordNode(t){switch(t.tokenType){case Ve.RESERVED_JOIN:return this.formatJoin(t);case Ve.AND:case Ve.OR:case Ve.XOR:return this.formatLogicalOperator(t);default:return this.formatKeyword(t)}}formatJoin(t){Pd(this.cfg)?(this.layout.indentation.decreaseTopLevel(),this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t),Fe.SPACE),this.layout.indentation.increaseTopLevel()):this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t),Fe.SPACE)}formatKeyword(t){this.layout.add(this.showKw(t),Fe.SPACE)}formatLogicalOperator(t){this.cfg.logicalOperatorNewline==="before"?Pd(this.cfg)?(this.layout.indentation.decreaseTopLevel(),this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t),Fe.SPACE),this.layout.indentation.increaseTopLevel()):this.layout.add(Fe.NEWLINE,Fe.INDENT,this.showKw(t),Fe.SPACE):this.layout.add(this.showKw(t),Fe.NEWLINE,Fe.INDENT)}formatDataType(t){this.layout.add(this.showDataType(t),Fe.SPACE)}showKw(t){return g6(t.tokenType)?p6(this.showNonTabularKw(t),this.cfg.indentStyle):this.showNonTabularKw(t)}showNonTabularKw(t){switch(this.cfg.keywordCase){case"preserve":return fy(t.raw);case"upper":return t.text;case"lower":return t.text.toLowerCase()}}showFunctionKw(t){return g6(t.tokenType)?p6(this.showNonTabularFunctionKw(t),this.cfg.indentStyle):this.showNonTabularFunctionKw(t)}showNonTabularFunctionKw(t){switch(this.cfg.functionCase){case"preserve":return fy(t.raw);case"upper":return t.text;case"lower":return t.text.toLowerCase()}}showIdentifier(t){if(t.quoted)return t.text;switch(this.cfg.identifierCase){case"preserve":return t.text;case"upper":return t.text.toUpperCase();case"lower":return t.text.toLowerCase()}}showDataType(t){switch(this.cfg.dataTypeCase){case"preserve":return fy(t.raw);case"upper":return t.text;case"lower":return t.text.toLowerCase()}}}let Oke=class{constructor(t,n){this.dialect=t,this.cfg=n,this.params=new cke(this.cfg.params)}format(t){const n=this.parse(t);return this.formatAst(n).trimEnd()}parse(t){return Nke(this.dialect.tokenizer).parse(t,this.cfg.paramTypes||{})}formatAst(t){return t.map(n=>this.formatStatement(n)).join("\n".repeat(this.cfg.linesBetweenQueries+1))}formatStatement(t){const n=new T0({cfg:this.cfg,dialectCfg:this.dialect.formatOptions,params:this.params,layout:new OQ(new LQ(lke(this.cfg)))}).format(t.children);return t.hasSemicolon&&(this.cfg.newlineBeforeSemicolon?n.add(Fe.NEWLINE,";"):n.add(Fe.NO_NEWLINE,";")),n.toString()}};class py extends Error{}function Lke(e){const t=["multilineLists","newlineBeforeOpenParen","newlineBeforeCloseParen","aliasAs","commaPosition","tabulateAlias"];for(const n of t)if(n in e)throw new py("".concat(n," config is no more supported."));if(e.expressionWidth<=0)throw new py("expressionWidth config must be positive number. Received ".concat(e.expressionWidth," instead."));if(e.params&&Mke(e.params),e.paramTypes&&!Dke(e.paramTypes))throw new py("Empty regex given in custom paramTypes. That would result in matching infinite amount of parameters.");return e}function Mke(e){return(e instanceof Array?e:Object.values(e)).every(n=>typeof n=="string")}function Dke(e){return e.custom&&Array.isArray(e.custom)?e.custom.every(t=>t.regex!==""):!0}var Pke=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n};const MQ={bigquery:"bigquery",db2:"db2",db2i:"db2i",duckdb:"duckdb",hive:"hive",mariadb:"mariadb",mysql:"mysql",n1ql:"n1ql",plsql:"plsql",postgresql:"postgresql",redshift:"redshift",spark:"spark",sqlite:"sqlite",sql:"sql",tidb:"tidb",trino:"trino",transactsql:"transactsql",tsql:"transactsql",singlestoredb:"singlestoredb",snowflake:"snowflake"},kke=Object.keys(MQ),jke={tabWidth:2,useTabs:!1,keywordCase:"preserve",identifierCase:"preserve",dataTypeCase:"preserve",functionCase:"preserve",indentStyle:"standard",logicalOperatorNewline:"before",expressionWidth:50,linesBetweenQueries:1,denseOperators:!1,newlineBeforeSemicolon:!1},Uke=(e,t={})=>{if(typeof t.language=="string"&&!kke.includes(t.language))throw new py("Unsupported SQL dialect: ".concat(t.language));const n=MQ[t.language||"sql"];return Fke(e,Object.assign(Object.assign({},t),{dialect:z2e[n]}))},Fke=(e,t)=>{var{dialect:n}=t,r=Pke(t,["dialect"]);if(typeof e!="string")throw new Error("Invalid query argument. Expected string, instead got "+typeof e);const a=Lke(Object.assign(Object.assign({},jke),r));return new Oke(ske(n),a).format(e)},_C=["SELECT","FROM","WHERE","GROUP BY","ORDER BY","HAVING","LIMIT","OFFSET","JOIN","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","ON","AND","OR","NOT","IN","LIKE","ILIKE","IS NULL","IS NOT NULL","AS","UNION","ALL","DISTINCT","COUNT","SUM","AVG","MIN","MAX","CAST","CASE","WHEN","THEN","ELSE","END","BETWEEN","EXISTS","INSERT","INTO","VALUES","UPDATE","SET","DELETE","CREATE","TABLE","VIEW","DROP","ALTER","ADD","COLUMN","INDEX","PRIMARY KEY","FOREIGN KEY","REFERENCES","DEFAULT","NULL","NOT NULL","WITH","RECURSIVE","USING"],wC=["DATE_PART","EXTRACT","CURRENT_DATE","CURRENT_TIME","CURRENT_TIMESTAMP","STRFTIME","CONCAT","STRING_AGG","SUBSTRING","REGEXP_MATCHES","COALESCE","NULLIF","IFF","IF","TYPEOF","LIST","STRUCT","MAP","MAP_EXTRACT","LIST_EXTRACT","STRUCT_EXTRACT","TO_TIMESTAMP","TO_DATE","ROUND","FLOOR","CEIL","GREATEST","LEAST","ABS","REPLACE","TRANSLATE","TRIM","LTRIM","RTRIM","LOWER","UPPER"],$ke=[{label:"sel",detail:"SELECT ... FROM ... WHERE ...",insertText:"SELECT $1\nFROM $2\nWHERE $3;",insertTextRules:4,kind:15},{label:"selall",detail:"SELECT * FROM ...",insertText:"SELECT *\nFROM $1\nWHERE $2;",insertTextRules:4,kind:15},{label:"join",detail:"SELECT ... FROM ... JOIN ... ON ...",insertText:"SELECT $1\nFROM $2\nJOIN $3 ON $4;",insertTextRules:4,kind:15},{label:"groupby",detail:"SELECT ... FROM ... GROUP BY ...",insertText:"SELECT $1\nFROM $2\nGROUP BY $3;",insertTextRules:4,kind:15},{label:"createview",detail:"CREATE VIEW ... AS SELECT ...",insertText:"CREATE VIEW $1 AS\nSELECT $2\nFROM $3;",insertTextRules:4,kind:15}],i1=({value:e,onChange:t,onExecute:n,onExecuteSelection:r,language:a="sql",height:s="100%",minHeight:i,maxHeight:l,className:c=""})=>{const{getAvailableTables:u,registeredTables:h,executeQuery:m,getObjectType:p,lastTableRefresh:g,motherDuckConnected:T,motherDuckSchemas:y,executeMotherDuckQuery:b}=Dt(),x=pMe(),R=v.useRef(null),A=v.useRef(""),w=v.useMemo(()=>{const O=u().sort().join(","),L=Array.from(h.keys()).sort().join(","),k=Array.from(y.entries()).map(([F,U])=>"".concat(F,":").concat(U.map(B=>B.name).join(","))).join(";");return"".concat(O,"-").concat(L,"-").concat(g,"-").concat(k)},[u,h,g,y]),_=v.useCallback(()=>{if(R.current)try{const O=Uke(R.current.getValue(),{language:"sql",keywordCase:"upper",indentStyle:"standard",logicalOperatorNewline:"before"});R.current.setValue(O)}catch(O){}},[]),N=v.useCallback(()=>H(null,null,function*(){if(!x)return null;try{const O=[],k=u().map(U=>H(null,null,function*(){try{const B=yield p(U),j=yield m('DESCRIBE "'.concat(U,'"'));if(j&&B){const G=j.toArray().map(K=>K.column_name||K.name||"");return{name:U,type:B,columns:G,source:"local"}}}catch(B){}return null})),F=yield Promise.all(k);if(O.push(...F.filter(U=>U!==null)),T)for(const[U,B]of y.entries())for(const j of B)try{const G=yield b('DESCRIBE "'.concat(U,'"."').concat(j.name,'"'),U);if(G&&Array.isArray(G)){const K=G.map(J=>J.column_name||J.name||"");O.push({name:j.name,type:j.type,columns:K,database:U,source:"motherduck"})}}catch(G){O.push({name:j.name,type:j.type,columns:[],database:U,source:"motherduck"})}return{objects:O}}catch(O){return{objects:[]}}}),[x,u,p,m,T,y,b]),I=v.useCallback(O=>{if(!x)return;const L=x.languages.registerCompletionItemProvider("sql",{triggerCharacters:[" ",".",'"',"'"],provideCompletionItems:(F,U)=>{const B=F.getValueInRange({startLineNumber:U.lineNumber,startColumn:1,endLineNumber:U.lineNumber,endColumn:U.column}),j=F.getWordUntilPosition(U),G={startLineNumber:U.lineNumber,endLineNumber:U.lineNumber,startColumn:j.startColumn,endColumn:j.endColumn},K=[];_C.forEach(X=>{K.push({label:X,kind:x.languages.CompletionItemKind.Keyword,insertText:X,range:G})}),wC.forEach(X=>{K.push({label:X,kind:x.languages.CompletionItemKind.Function,insertText:X,range:G})}),$ke.forEach(X=>{K.push(he(q({},X),{range:G}))});const J=B.match(/"([^"]+)"\s*\.\s*$/);if(J){const X=J[1];O.objects.filter(Z=>Z.database===X).forEach(Z=>{const V=Z.type==="view"?x.languages.CompletionItemKind.Interface:x.languages.CompletionItemKind.Class;K.push({label:Z.name,kind:V,insertText:'"'.concat(Z.name,'"'),range:G,detail:"".concat(Z.type," in ").concat(X),documentation:Z.columns.length>0?"Columns: ".concat(Z.columns.join(", ")):"Columns not loaded"})})}else O.objects.forEach(X=>{const Z=X.type==="view"?x.languages.CompletionItemKind.Interface:x.languages.CompletionItemKind.Class,V=X.source==="motherduck"?"".concat(X.type," (").concat(X.database,")"):"".concat(X.type," (local)"),te=X.source==="motherduck"&&X.database?'"'.concat(X.database,'"."').concat(X.name,'"'):'"'.concat(X.name,'"');K.push({label:X.source==="motherduck"?"".concat(X.database,".").concat(X.name):X.name,kind:Z,insertText:te,range:G,detail:V,documentation:X.columns.length>0?"Columns: ".concat(X.columns.join(", ")):"Columns not loaded",sortText:X.source==="local"?"0_".concat(X.name):"1_".concat(X.database,"_").concat(X.name)})});const $=[/FROM\s+"([^"]+)"\."([^"]+)"\s+(?:AS\s+)?([a-zA-Z_]\w*)?\s*$/i,/FROM\s+"([^"]+)"\s+(?:AS\s+)?([a-zA-Z_]\w*)?\s*$/i,/JOIN\s+"([^"]+)"\."([^"]+)"\s+(?:AS\s+)?([a-zA-Z_]\w*)?\s*$/i,/JOIN\s+"([^"]+)"\s+(?:AS\s+)?([a-zA-Z_]\w*)?\s*$/i];for(const X of $){const Z=B.match(X);if(Z){let V,te;if(Z.length===4&&Z[2]){const[,ae,ne,ce]=Z;V=O.objects.find(ie=>ie.database===ae&&ie.name===ne),te=ce}else if(Z.length===3){const[,ae,ne]=Z;V=O.objects.find(ce=>ce.source==="local"&&ce.name===ae),te=ne}te&&B.endsWith("".concat(te,"."))&&V&&V.columns.length>0&&V.columns.forEach(ae=>{K.push({label:ae,kind:x.languages.CompletionItemKind.Field,insertText:'"'.concat(ae,'"'),range:G,detail:"Column from ".concat(V.name)})})}}return{suggestions:K}}}),k=x.languages.registerHoverProvider("sql",{provideHover:(F,U)=>{const B=F.getWordAtPosition(U);if(!B)return null;const j=B.word.toLowerCase(),G=F.getLineContent(U.lineNumber);G.substring(0,B.startColumn-1);const K=G.substring(B.endColumn-1);let J;if(K.match(/^\s*\.\s*"/)){const $=O.objects.filter(X=>{var Z;return((Z=X.database)==null?void 0:Z.toLowerCase())===j});if($.length>0)return{contents:[{value:"**".concat(j,"** (MotherDuck Database)")},{value:"Tables: ".concat($.filter(X=>X.type==="table").length)},{value:"Views: ".concat($.filter(X=>X.type==="view").length)}]}}if(J=O.objects.find($=>$.name.toLowerCase()===j),J){const $=J.type==="view"?"View":"Table",X=J.source==="motherduck"?"MotherDuck (".concat(J.database,")"):"Local";return{contents:[{value:"**".concat(J.name,"** (").concat($,")")},{value:"Location: ".concat(X)},{value:J.columns.length>0?"Columns: ".concat(J.columns.join(", ")):"Columns not loaded"}]}}if(_C.some($=>$.toLowerCase()===j)){const $=_C.find(Z=>Z.toLowerCase()===j),X={select:"Retrieves data from one or more tables or views",from:"Specifies the table(s) or view(s) to query",where:"Filters rows based on a condition",join:"Combines rows from two or more tables or views","group by":"Groups rows that have the same values",having:"Filters groups based on a condition","order by":"Sorts the result set",limit:"Limits the number of rows returned","create view":"Creates a virtual table based on a SELECT statement","drop view":"Removes a view from the database"};return{contents:[{value:"**".concat($,"**")},{value:X[j]||"SQL keyword"}]}}if(wC.some($=>$.toLowerCase()===j)){const $=wC.find(X=>X.toLowerCase()===j);return{contents:[{value:"**".concat($,"**")},{value:"DuckDB SQL function"}]}}return null}});return()=>{L.dispose(),k.dispose()}},[x]);v.useEffect(()=>{!x||w===A.current||a!=="sql"||(A.current=w,N().then(O=>{O&&I(O)}))},[w,x,a,N,I]),v.useEffect(()=>()=>{R.current&&R.current._autoHeightDisposables&&R.current._autoHeightDisposables.forEach(O=>{O.dispose()})},[]);const D=v.useCallback((O,L)=>{R.current=O;const k=a==="sql"?"Execute Query":"Execute Code";if(O.addAction({id:"execute-code",label:k,keybindings:[L.KeyMod.CtrlCmd|L.KeyCode.Enter],run:()=>{var B;const F=O.getSelection();if(F&&!F.isEmpty()&&r){const j=(B=O.getModel())==null?void 0:B.getValueInRange(F);if(j&&j.trim()){r(j.trim());return}}n&&n()}}),a==="sql"&&(O.addCommand(L.KeyMod.Alt|L.KeyCode.KeyF,()=>{_()}),O.addAction({id:"format-sql",label:"Format SQL",keybindings:[L.KeyMod.Alt|L.KeyCode.KeyF],contextMenuGroupId:"modification",run:_})),s==="auto"){let F;const U=()=>{clearTimeout(F),F=setTimeout(()=>{const j=O.getModel();if(!j)return;const G=j.getLineCount(),K=O.getOption(L.editor.EditorOption.lineHeight),J=G*K,X=Math.max(J+10,i||80),Z=l?Math.min(X,l):X,V=O.getContainerDomNode();V&&V.parentElement&&(V.style.height="".concat(Z,"px"),V.parentElement.style.height="".concat(Z,"px"),O.layout())},10)},B=O.onDidChangeModelContent(U);U(),window.editorDisposable=B}},[n,r,_,a,s,i,l]),M=s==="auto"?"".concat(i||80,"px"):s;return o.jsx("div",{className:"".concat(s==="auto"?"":"h-full"," ").concat(c),children:o.jsx(xQ,{height:M,defaultLanguage:a,defaultValue:e,value:e,onChange:O=>t(O||""),theme:"vs-dark",options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",wrappingIndent:"indent",automaticLayout:!0,tabSize:2,fontSize:14,fontFamily:"JetBrains Mono, monospace",insertSpaces:!0,cursorBlinking:"smooth",cursorSmoothCaretAnimation:"on",renderLineHighlight:"all",glyphMargin:!1,folding:!0,contextmenu:!0,quickSuggestions:!0,suggest:{showKeywords:!0,showSnippets:!0,preview:!0},parameterHints:{enabled:!0},formatOnPaste:!0,formatOnType:!1,lineNumbers:"on",lineDecorationsWidth:10,renderWhitespace:"selection",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},scrollbar:{vertical:s==="auto"?"hidden":"auto",horizontal:"auto",alwaysConsumeMouseWheel:!1},overviewRulerLanes:s==="auto"?0:3,scrollBeyondLastLine:!1,fixedOverflowWidgets:s==="auto"},onMount:D})})},DQ=e=>{const{recentQueries:t,savedQueries:n,addRecentQuery:r,saveQuery:a,deleteQuery:s,loadQueriesFromStorage:i}=ut(),[l,c]=v.useState(!1);v.useEffect(()=>{H(null,null,function*(){c(!0);try{yield i()}catch(T){}finally{c(!1)}})},[i]);const u=v.useCallback(g=>{e&&e(g)},[e]),h=v.useCallback((g,T)=>{a(g,T)},[a]),m=v.useCallback(g=>{s(g)},[s]),p=v.useCallback(g=>{r(g)},[r]);return{recentQueries:t,savedQueries:n,isLoadingQueries:l,selectQuery:u,saveQuery:h,deleteQuery:m,addToRecentQueries:p}},Bke=({onSelectQuery:e})=>{const{t}=Ze(),{recentQueries:n,savedQueries:r,saveQuery:a,deleteQuery:s}=DQ(e),[i,l]=v.useState("recent"),[c,u]=v.useState(null),[h,m]=v.useState(null),[p,g]=v.useState(""),T=(A,w)=>{navigator.clipboard.writeText(A),u(w),setTimeout(()=>u(null),2e3)},y=i==="recent"?n:r,b=A=>{const w=new Date(A),_=new Date;if(w.toDateString()===_.toDateString())return t("queryHistory.dateFormat.today",{defaultValue:"Today at {{time}}",time:w.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})});const N=new Date;if(N.setDate(_.getDate()-1),w.toDateString()===N.toDateString())return t("queryHistory.dateFormat.yesterday",{defaultValue:"Yesterday at {{time}}",time:w.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})});const I=new Date;return I.setDate(_.getDate()-7),w>I?w.toLocaleDateString(void 0,{weekday:"long",hour:"2-digit",minute:"2-digit"}):w.toLocaleDateString(void 0,{month:"short",day:"numeric",year:_.getFullYear()!==w.getFullYear()?"numeric":void 0})},x=A=>{m(A),g(A.name)},R=()=>{!h||!p.trim()||(a(h.query,p),s(h.id),m(null),g(""))};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsxs("h3",{className:"text-sm font-medium flex items-center",children:[o.jsx(du,{size:16,className:"mr-2 text-primary"}),o.jsxs("span",{className:"flex items-center",children:[t("queryHistory.title",{defaultValue:"Query History"}),o.jsx("span",{className:"text-[10px] bg-white/10 text-white/60 px-1.5 py-0.5 rounded ml-1.5",children:t("queryHistory.source",{defaultValue:"from indexedDB"})})]})]}),o.jsxs("div",{className:"flex mt-3 border-b border-white/10",children:[o.jsx("button",{className:"px-3 py-1.5 text-xs font-medium ".concat(i==="recent"?"text-primary border-b-2 border-primary":"text-white/70 hover:text-white/90"),onClick:()=>l("recent"),children:t("queryHistory.tabs.recent",{defaultValue:"Recent"})}),o.jsx("button",{className:"px-3 py-1.5 text-xs font-medium ".concat(i==="saved"?"text-primary border-b-2 border-primary":"text-white/70 hover:text-white/90"),onClick:()=>l("saved"),children:t("queryHistory.tabs.saved",{defaultValue:"Saved"})})]})]}),o.jsx("div",{className:"flex-1 overflow-auto p-2",children:y.length===0?o.jsx("div",{className:"p-4 text-center text-white/50 text-xs",children:i==="recent"?t("queryHistory.empty.recent",{defaultValue:"No recent queries. Execute a query to see it here."}):t("queryHistory.empty.saved",{defaultValue:"No saved queries. Click the star icon to save a query."})}):o.jsx("div",{className:"space-y-2",children:y.map(A=>o.jsxs("div",{className:"p-2 rounded bg-background hover:bg-background/80 border border-white/5",children:[(h==null?void 0:h.id)===A.id?o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("input",{type:"text",value:p,onChange:w=>g(w.target.value),className:"flex-1 bg-darkNav px-2 py-1 text-xs rounded border border-white/10",autoFocus:!0}),o.jsxs("div",{className:"flex items-center ml-2",children:[o.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>m(null),title:t("queryHistory.actions.cancel",{defaultValue:"Cancel"}),children:o.jsx(ur,{size:14,className:"text-white/70"})}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:R,title:t("queryHistory.actions.save",{defaultValue:"Save"}),disabled:!p.trim(),children:o.jsx(DL,{size:14,className:"text-primary"})})]})]}):o.jsxs("div",{className:"flex items-center justify-between mb-1 group",children:[o.jsx("div",{className:"text-xs font-medium text-white/80 truncate flex-1",children:A.name||t("queryHistory.unnamedQuery",{defaultValue:"Unnamed Query"})}),o.jsxs("div",{className:"flex items-center space-x-1",children:[i==="recent"&&o.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>a(A.query,A.name),title:t("queryHistory.actions.save",{defaultValue:"Save Query"}),children:o.jsx(Nme,{size:14,className:"text-secondary"})}),i==="saved"&&o.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>x(A),title:t("queryHistory.actions.editName",{defaultValue:"Edit Name"}),children:o.jsx(PL,{size:14,className:"text-white/70"})}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>T(A.query,A.id),title:t("queryHistory.actions.copy",{defaultValue:"Copy Query"}),children:c===A.id?o.jsx(Pr,{size:14,className:"text-primary"}):o.jsx(gi,{size:14,className:"text-white/70"})}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>s(A.id),title:t("queryHistory.actions.delete",{defaultValue:"Delete Query"}),children:o.jsx(kme,{size:14,className:"text-destructive"})})]})]}),o.jsxs("div",{className:"text-xs mt-1 p-2 bg-darkNav/60 rounded font-mono overflow-hidden max-h-20 cursor-pointer",onClick:()=>e(A.query),children:[A.query.split("\n").slice(0,3).join("\n"),A.query.split("\n").length>3&&o.jsx("div",{className:"text-white/50 text-center",children:"..."})]}),o.jsxs("div",{className:"mt-1 flex justify-between items-center",children:[o.jsx("div",{className:"text-[10px] text-white/50",children:b(A.timestamp)}),o.jsx(je,{variant:"ghost",size:"sm",className:"h-6 py-0 px-2 text-xs",onClick:()=>e(A.query),children:t("queryHistory.actions.use",{defaultValue:"Use"})})]})]},A.id))})})]})},LD=({results:e,columns:t})=>{const n=v.useMemo(()=>!(t!=null&&t.length)||!(e!=null&&e.length)?[]:t.map(a=>{const s=e.slice(0,100).map(h=>h[a]).filter(h=>h!=null);if(s.length===0)return Nt.Text;const i=a.toLowerCase().includes("id")||a.toLowerCase().includes("_id")||a.toLowerCase().endsWith("id");return s.filter(h=>i&&typeof h=="number"?!1:!!(typeof h=="number"&&h>9466848e5&&h<41024448e5||typeof h=="string"&&/\d{4}-\d{2}-\d{2}/.test(h))).length/s.length>.5?Nt.Date:s.filter(h=>typeof h=="number"||!isNaN(Number(h))&&!isNaN(parseFloat(h))&&h.toString().trim()!=="").length/s.length>.8?Nt.Number:s.filter(h=>typeof h=="boolean"||typeof h=="string"&&["true","false","yes","no"].includes(h.toLowerCase())).length/s.length>.8?Nt.Boolean:Nt.Text}),[t,e]),{formatCellValue:r}=dS(n,!0);return{columnTypes:n,formatCellValue:r}},Hke=({totalRows:e,currentPage:t,totalPages:n,rowsPerPage:r,results:a,columns:s,onImportAsTable:i,isImporting:l=!1,showDownloadCSV:c=!0})=>{const{t:u}=Ze(),{formatCellValue:h}=LD({results:a,columns:s}),m=()=>{if(!a||!s)return;const p=[s.join(","),...a.map((b,x)=>s.map((R,A)=>{const w=b[R],_=h(String(w||""),x+1,A+1);if(_==null||_==="")return"";const N=String(_);return N.includes(",")||N.includes('"')||N.includes("\n")?'"'.concat(N.replace(/"/g,'""'),'"'):N}).join(","))].join("\n"),g=new Blob([p],{type:"text/csv;charset=utf-8;"}),T=URL.createObjectURL(g),y=document.createElement("a");y.href=T,y.setAttribute("download","query_results_".concat(new Date().toISOString().slice(0,19).replace(/[:-]/g,""),".csv")),document.body.appendChild(y),y.click(),document.body.removeChild(y)};return o.jsxs("div",{className:"flex justify-between items-center p-3 border-b border-white/10",children:[o.jsxs("div",{className:"text-xs text-white text-opacity-70",children:[o.jsx("span",{className:"font-medium",children:e.toLocaleString()})," ",u("queryResults.header.rowsReturned",{defaultValue:"rows returned"}),e>r&&o.jsxs("span",{className:"ml-2",children:["(",u("queryResults.header.showingPage",{defaultValue:"showing page {{current}} of {{total}}",current:t,total:n}),")"]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[i&&o.jsx(Ut,{content:"Save results in DataKit",placement:"bottom",children:o.jsxs(je,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs border-primary",onClick:i,disabled:l||!a||a.length===0,children:[o.jsx(Bl,{size:12,className:"mr-1"}),o.jsx("span",{children:l?"Importing...":"Save as Table"})]})}),c&&o.jsxs(je,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs border-primary",onClick:m,children:[o.jsx(Hr,{size:12,className:"mr-1"}),o.jsx("span",{children:u("queryResults.header.downloadCSV",{defaultValue:"Download CSV"})})]})]})]})},Vke=({value:e,formattedValue:t,width:n,cellClass:r="",columnType:a})=>{const[s,i]=v.useState(!1),[l,c]=v.useState(!1),u=v.useRef(null),h=v.useRef(null),[m,p]=v.useState({top:0,left:0});v.useEffect(()=>{if(!document.getElementById("tooltip-container")){const N=document.createElement("div");N.id="tooltip-container",N.style.position="fixed",N.style.zIndex="9999",N.style.pointerEvents="none",document.body.appendChild(N)}return()=>{if(document.querySelectorAll("[data-tablecell]").length<=1){const N=document.getElementById("tooltip-container");N&&document.body.removeChild(N)}}},[]),v.useEffect(()=>{const N=()=>{if(u.current){const D=u.current.scrollWidth>u.current.clientWidth;c(D)}};requestAnimationFrame(N);const I=()=>{requestAnimationFrame(N)};return window.addEventListener("resize",I),()=>{window.removeEventListener("resize",I)}},[e]);const g=()=>{l&&i(!0)},T=()=>{i(!1)},y=N=>{if(l){const I=N.clientX,D=N.clientY;let M=D-10,O=I+10;if(h.current){const L=h.current.offsetWidth,k=h.current.offsetHeight;O+L>window.innerWidth-20&&(O=I-L-10),M-k<10&&(M=D+20)}p({top:M,left:O})}},b=N=>r||(N==null?"text-white/30 italic":typeof N=="number"?"text-tertiary font-mono text-right":typeof N=="boolean"?"text-primary text-center":typeof N=="string"&&(/^\d{4}-\d{2}-\d{2}/.test(N)||/^\d{2}\/\d{2}\/\d{4}/.test(N))?"text-secondary":""),x=N=>{if(t!==void 0)return o.jsx("span",{children:t});const I=FI(N);if(I==null)return o.jsx("span",{className:"text-gray-400",children:"null"});if(typeof I=="object")try{return o.jsx("span",{children:JSON.stringify(I)})}catch(D){return o.jsx("span",{className:"text-red-500",children:"Error formatting value"})}return o.jsx("span",{children:String(I)})},R=N=>{if(N==null)return"null";if(typeof N=="object")try{return JSON.stringify(N,null,2)}catch(I){return"Error formatting value"}return String(N)},A=b(e),w=R(e),_=()=>{if(typeof e=="object"&&e!==null)try{return o.jsx("pre",{className:"text-xs whitespace-pre-wrap overflow-auto max-h-60 max-w-md",children:JSON.stringify(e,null,2)})}catch(N){return"Error formatting value"}return w};return o.jsxs("div",{ref:u,"data-tablecell":"true",style:{width:n,minWidth:n},className:"p-2 text-xs border-b border-r border-white/10 ".concat(A," truncate"),onMouseEnter:g,onMouseLeave:T,onMouseMove:y,role:"cell",children:[x(e),s&&l&&document.getElementById("tooltip-container")&&Gh.createPortal(o.jsx("div",{ref:h,className:"bg-black/90 border border-primary p-2 rounded shadow-lg text-white text-xs",style:{position:"fixed",top:"".concat(m.top,"px"),left:"".concat(m.left,"px"),maxWidth:"400px",zIndex:9999,pointerEvents:"none"},role:"tooltip",children:_()}),document.getElementById("tooltip-container"))]})},Gke=Ht.memo(Vke),zke=({results:e,columns:t})=>{const[n,r]=v.useState([]),[a,s]=v.useState(0),{columnTypes:i,formatCellValue:l}=LD({results:e,columns:t}),{getCellClass:c}=dS(i,!0);v.useEffect(()=>{if(!(t!=null&&t.length)||!(e!=null&&e.length)){r([]);return}const m=100,p=300,g=Math.min(e.length,100),T=e.slice(0,g),y=t.map((x,R)=>{let A=x.length;for(const w of T){const _=w[x],N=u(_);A=Math.max(A,N.length)}return Math.max(m,Math.min(p,A*8+24))});r(y);const b=y.reduce((x,R)=>x+R,0);s(Math.max(b,500))},[t,e]);const u=m=>{if(m==null)return"null";if(typeof m=="object")try{return JSON.stringify(m)}catch(p){return"Error formatting value"}return String(m)},h=v.useMemo(()=>Ht.memo(({index:m,style:p})=>{const g=e[m];return g?o.jsx("div",{style:he(q({},p),{display:"flex"}),className:"".concat(m%2===0?"bg-black/20":""," hover:bg-white/5"),role:"row",children:t.map((T,y)=>{const b=g[T],x=l(String(b||""),m+1,y+1),R=c(m+1,y+1);return o.jsx(Gke,{value:b,formattedValue:x,width:n[y]||150,cellClass:R,columnType:i[y]},y)})}):null}),[e,t,n,l,c,i]);return!(e!=null&&e.length)||!(t!=null&&t.length)?o.jsx("div",{className:"p-4 text-white/70",children:"No data to display"}):o.jsx("div",{className:"h-full flex flex-col",role:"table","aria-label":"Query Results Table","aria-rowcount":e.length,"aria-colcount":t.length,children:o.jsx("div",{className:"flex-1 overflow-auto",children:o.jsxs("div",{style:{width:a,minWidth:"100%"},children:[o.jsx("div",{className:"sticky top-0 bg-darkNav z-10 border-b border-white/10 shadow-sm",role:"rowgroup",children:o.jsx("div",{className:"flex",role:"row",children:t.map((m,p)=>o.jsx("div",{className:"text-left p-2 text-xs font-medium text-white/90 border-r border-white/10 whitespace-nowrap z-100 bg-black",style:{width:n[p]||150,minWidth:n[p]||150},title:m,role:"columnheader",children:m},p))})}),o.jsx("div",{className:"flex-1",children:o.jsx(yEe,{height:500,width:a,itemCount:e.length,itemSize:28,overscanCount:10,className:"scrollbar",children:h})})]})})})},qke=Ht.memo(zke),Yke=({currentPage:e,totalPages:t,rowsPerPage:n,onPageChange:r,onRowsPerPageChange:a})=>{const{t:s}=Ze(),i=l=>{const c=Number(l.target.value);a&&a(c)};return o.jsxs("div",{className:"flex items-center justify-between p-3 bg-darkNav mt-1 rounded-b",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("span",{className:"text-xs text-white/70",children:s("queryResults.pagination.rowsPerPage",{defaultValue:"Rows per page:"})}),o.jsxs("select",{value:n,onChange:i,className:"bg-background text-white text-xs p-1 rounded border border-white/10",children:[o.jsx("option",{value:100,children:"100"}),o.jsx("option",{value:500,children:"500"}),o.jsx("option",{value:1e3,children:"1000"}),o.jsx("option",{value:5e3,children:"5000"}),o.jsx("option",{value:1e4,children:"10000"}),o.jsx("option",{value:2e4,children:"20000"}),o.jsx("option",{value:5e4,children:"50000"})]})]}),o.jsxs("div",{className:"flex items-center space-x-1",children:[o.jsx(je,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 flex items-center justify-center",disabled:e===1,onClick:()=>r&&r(1),title:s("queryResults.pagination.firstPage",{defaultValue:"First Page"}),children:o.jsx(FW,{size:14})}),o.jsx(je,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 flex items-center justify-center",disabled:e===1,onClick:()=>r&&r(e-1),title:s("queryResults.pagination.previousPage",{defaultValue:"Previous Page"}),children:o.jsx(Dg,{size:14})}),o.jsx("span",{className:"text-xs text-white/70 px-2",children:s("queryResults.pagination.pageOf",{defaultValue:"Page {{current}} of {{total}}",current:e.toLocaleString(),total:t.toLocaleString()})}),o.jsx(je,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 flex items-center justify-center",disabled:e===t,onClick:()=>r&&r(e+1),title:s("queryResults.pagination.nextPage",{defaultValue:"Next Page"}),children:o.jsx(nr,{size:14})}),o.jsx(je,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 flex items-center justify-center",disabled:e===t,onClick:()=>r&&r(t),title:s("queryResults.pagination.lastPage",{defaultValue:"Last Page"}),children:o.jsx($W,{size:14})})]}),t>10&&o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx("span",{className:"text-xs text-white/70",children:s("queryResults.pagination.goTo",{defaultValue:"Go to:"})}),o.jsx("input",{type:"number",min:1,max:t,value:e,onChange:l=>{const c=parseInt(l.target.value);!isNaN(c)&&c>=1&&c<=t&&r&&r(c)},className:"bg-background text-white text-xs p-1 rounded border border-white/10 w-16 text-center"})]})]})},VT=({type:e,message:t})=>{const{t:n}=Ze();switch(e){case"loading":return o.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-10 text-white text-opacity-70",children:[o.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent mb-4"}),o.jsx("p",{className:"text-sm",children:n("queryResults.emptyState.executing",{defaultValue:"Executing query..."})})]});case"error":return o.jsxs("div",{className:"bg-destructive/10 border border-destructive/30 rounded p-4 text-white m-3",children:[o.jsxs("h4",{className:"font-medium text-destructive mb-2 flex items-center",children:[o.jsx(Cn,{size:16,className:"mr-2"}),n("queryResults.emptyState.error",{defaultValue:"Error"})]}),o.jsx("pre",{className:"text-xs bg-background p-3 rounded overflow-auto max-h-60 whitespace-pre-wrap",children:t})]});case"empty":return o.jsx("div",{className:"flex flex-col items-center justify-center h-full py-10 text-white text-opacity-70",children:o.jsx("p",{className:"text-sm",children:n("queryResults.emptyState.empty",{defaultValue:"Execute a query to see results."})})});case"no-results":return o.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-10 text-white text-opacity-70",children:[o.jsx(Pr,{size:24,className:"text-primary mb-4"}),o.jsx("p",{className:"text-sm",children:n("queryResults.emptyState.noResults",{defaultValue:"Query executed successfully. No results returned."})})]});default:return null}},Wke=({results:e,columns:t,isLoading:n,error:r,totalRows:a=0,currentPage:s=1,totalPages:i=0,rowsPerPage:l=100,onPageChange:c,onRowsPerPageChange:u,onImportAsTable:h,isImporting:m=!1,showDownloadCSV:p=!0})=>{const{t:g}=Ze();return n?o.jsx(VT,{type:"loading"}):r?o.jsx(VT,{type:"error",message:r}):!e||!t?o.jsx(VT,{type:"empty"}):e.length===0?o.jsx(VT,{type:"no-results"}):o.jsxs("div",{className:"flex flex-col h-full border border-white/10 rounded-md overflow-hidden","aria-busy":n,"aria-live":"polite",children:[o.jsx(Hke,{totalRows:a,currentPage:s,totalPages:i,rowsPerPage:l,results:e,columns:t,onImportAsTable:h,isImporting:m,showDownloadCSV:p}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(qke,{results:e,columns:t})}),i>1&&o.jsx(Yke,{currentPage:s,totalPages:i,rowsPerPage:l,onPageChange:c,onRowsPerPageChange:u})]})},E6=Ht.memo(Wke),Xke=({isOpen:e,onClose:t,onConfirm:n,isImporting:r,rowCount:a,columnCount:s,sourceFileName:i})=>{const[l,c]=v.useState(""),[u,h]=v.useState("");v.useEffect(()=>{if(e){const T=new Date,y=T.toISOString().split("T")[0].replace(/-/g,""),b=T.toTimeString().split(" ")[0].replace(/:/g,"").substring(0,4);if(i){const x=i.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_").toLowerCase();c("".concat(x,"_").concat(y,"_").concat(b))}else c("results_".concat(y,"_").concat(b));h("")}},[e,i]);const m=T=>T.trim()?/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(T)?T.length>63?(h("Table name must be 63 characters or less"),!1):["select","from","where","table","view","create","drop","insert","update","delete"].includes(T.toLowerCase())?(h("Table name cannot be a reserved SQL keyword"),!1):(h(""),!0):(h("Table name must start with a letter or underscore and contain only letters, numbers, and underscores"),!1):(h("Table name is required"),!1),p=()=>{m(l)&&n(l)},g=T=>{const y=T.target.value;c(y),m(y)};return o.jsx(At,{children:e&&o.jsxs(me.div,{className:"fixed inset-0 z-50 flex items-center justify-center",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[o.jsx(me.div,{className:"absolute inset-0 bg-black/60 backdrop-blur-xs",onClick:t,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2}}),o.jsxs(me.div,{className:"relative bg-black border border-white/10 rounded-lg shadow-2xl w-full max-w-lg mx-4",initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",stiffness:300,damping:25,duration:.3},children:[o.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-white/10",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("h2",{className:"text-lg font-semibold",children:"Save Results"})}),o.jsx("button",{onClick:t,className:"p-1 hover:bg-white/10 rounded transition-colors",disabled:r,children:o.jsx(ur,{className:"w-5 h-5"})})]}),o.jsxs("div",{className:"p-5 space-y-4",children:[o.jsx("div",{className:"bg-primary/10 border border-primary/30 rounded-lg p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(jo,{className:"w-4 h-4 text-primary mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"space-y-1 text-sm",children:[o.jsx("p",{className:"font-medium",children:"How it works:"}),o.jsxs("ul",{className:"space-y-1 text-white/80",children:[o.jsx("li",{children:"• The table will appear as a new tab for easy access"}),o.jsx("li",{children:"• You can query this table directly using SQL"}),o.jsx("li",{children:"• This table exists only in your browser - download the file to save permanently"})]})]})]})}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[o.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[o.jsx("div",{className:"text-white/60 mb-1",children:"Rows"}),o.jsx("div",{className:"font-semibold",children:a.toLocaleString()})]}),o.jsxs("div",{className:"bg-white/5 rounded-lg p-3",children:[o.jsx("div",{className:"text-white/60 mb-1",children:"Columns"}),o.jsx("div",{className:"font-semibold",children:s})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{htmlFor:"tableName",className:"block text-sm font-medium",children:"Table Name"}),o.jsx("input",{id:"tableName",type:"text",value:l,onChange:g,className:"w-full px-3 py-2 bg-background border border-white/10 rounded-lg focus:outline-none focus:border-primary transition-colors",placeholder:"Enter table name",disabled:r,autoFocus:!0}),u&&o.jsx("p",{className:"text-xs text-destructive",children:u}),o.jsx("p",{className:"text-xs text-white/60",children:"Choose a descriptive name for your table. Only letters, numbers, and underscores are allowed."})]})]}),o.jsxs("div",{className:"flex justify-end gap-2 p-5 border-t border-white/10",children:[o.jsx(je,{variant:"ghost",onClick:t,disabled:r,children:"Cancel"}),o.jsx(je,{variant:"outline",onClick:p,disabled:r||!l.trim()||!!u,children:r?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin mr-2"}),"Creating..."]}):o.jsx(o.Fragment,{children:"Create Table"})})]})]})]})})},Kke=({isDirty:e})=>{const{t}=Ze();return e?o.jsxs("div",{className:"flex items-center px-2 py-1 bg-amber-500/10 border border-amber-500/20 rounded text-xs text-amber-400",children:[o.jsx("div",{className:"w-1.5 h-1.5 bg-amber-400 rounded-full mr-1.5"}),t("query.draft.label",{defaultValue:"Draft"})]}):null},Qke=(e,t)=>{const{direction:n="vertical",initialSize:r=300,minSize:a=100,maxSize:s=800,storageKey:i,useRelativeSize:l=!1,parentRef:c}=t,u=i&&localStorage.getItem(i)?parseFloat(localStorage.getItem(i)||"0"):0,[h,m]=v.useState(u||r),[p,g]=v.useState(!1),T=v.useCallback(b=>{b.preventDefault(),g(!0),document.body.style.cursor=n==="vertical"?"row-resize":"col-resize",document.body.style.userSelect="none"},[n]),y=v.useCallback(()=>{g(!1),document.body.style.cursor="",document.body.style.userSelect="",i&&h&&localStorage.setItem(i,h.toString())},[h,i]);return v.useEffect(()=>{const b=x=>{var w;if(!p||!e.current)return;const R=e.current.getBoundingClientRect(),A=(w=c==null?void 0:c.current)==null?void 0:w.getBoundingClientRect();if(n==="vertical"){const _=x.clientY-R.top,N=Math.max(a,Math.min(s,_));if(m(N),e.current.style.height="".concat(N,"px"),l&&(c!=null&&c.current)){const I=N/A.height;i&&localStorage.setItem("".concat(i,"-relative"),I.toString())}}else{const _=x.clientX-R.left,N=Math.max(a,Math.min(s,_));if(m(N),e.current.style.width="".concat(N,"px"),l&&(c!=null&&c.current)){const I=N/A.width;i&&localStorage.setItem("".concat(i,"-relative"),I.toString())}}};return p&&(window.addEventListener("mousemove",b),window.addEventListener("mouseup",y)),()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",y)}},[p,e,n,a,s,y,c,l,i]),v.useEffect(()=>{e.current&&(n==="vertical"?e.current.style.height="".concat(h,"px"):e.current.style.width="".concat(h,"px"))},[e,h,n]),v.useEffect(()=>{if(!l||!(c!=null&&c.current)||!i)return;const b=()=>{if(!e.current||!c.current)return;const x=localStorage.getItem("".concat(i,"-relative"));if(x){const R=n==="vertical"?c.current.clientHeight*parseFloat(x):c.current.clientWidth*parseFloat(x),A=Math.max(a,Math.min(s,R));n==="vertical"?e.current.style.height="".concat(A,"px"):e.current.style.width="".concat(A,"px"),m(A)}};return window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[e,c,n,l,i,a,s]),{size:h,isResizing:p,startResize:T,stopResize:y}},Jke=(e,t,n=null,r={})=>{const{initialRowsPerPage:a=100,largeDatasetThreshold:s=1e4}=r,{executePaginatedQuery:i,isLoading:l,motherDuckConnected:c,isMotherDuckQuery:u}=Dt(),{addRecentQuery:h}=ut(),[m,p]=v.useState(null),[g,T]=v.useState(null),[y,b]=v.useState(null),[x,R]=v.useState(null),[A,w]=v.useState(0),[_,N]=v.useState(1),[I,D]=v.useState(0),[M,O]=v.useState(a),[L,k]=v.useState(!1),[F,U]=v.useState(!1),B=v.useCallback(ae=>{const ne=ae.trim().toLowerCase(),ce=!ne.includes("limit");return ne.includes("select *")&&ce},[]),j=v.useCallback((ae,ne=1e3)=>{const ce=ae.trim();return ce.toLowerCase().includes("limit")?ae:"".concat(ce," LIMIT ").concat(ne)},[]),G=v.useCallback((ae,ne=!0)=>H(null,null,function*(){if(!ae.trim()){b("Please enter a query");return}if(u(ae).isMotherDuck&&!c){b("This query targets MotherDuck tables, but MotherDuck is not connected. Please connect first.");return}try{b(null),p(null),T(null),R(null),N(1),k(!1);const ie=yield i(ae,1,M);if(ie)try{if(w(ie.totalRows),D(ie.totalPages),p(ie.data),T(ie.columns),R(ie.queryTime),h(ae),ne){const{updateFile:W}=ut.getState();if(n){const Q=n.sqlState||{query:"",history:[],lastExecutedAt:void 0};W(n.id,{sqlState:he(q({},Q),{query:ae,lastExecutedQuery:ae,lastExecutedAt:Date.now()})}),t(ae)}}}catch(W){}else p([]),T([]),w(0),D(0)}catch(ie){let W=ie instanceof Error?ie.message:"Unknown error executing query";W.includes('syntax error at or near "LIMIT"')?W="SQL syntax error: Invalid LIMIT clause. Please check your query syntax.":W.includes("not connected")&&(W="Database connection lost. Please refresh and try again."),b(W),p(null),T(null),w(0),D(0)}}),[M,i,h,B,u,c,n,t]),K=v.useCallback(()=>H(null,null,function*(){yield G(e,!0)}),[e,G]),J=v.useCallback(ae=>H(null,null,function*(){yield G(ae,!1)}),[G]),$=v.useCallback(ae=>H(null,null,function*(){if(!(ae<1||ae>I||ae===_))try{b(null),k(!0);const ne=yield i(e,ae,M);ne&&(p(ne.data),N(ae))}catch(ne){b(ne instanceof Error?ne.message:"Error fetching page data")}finally{k(!1)}}),[e,M,_,I,i]),X=v.useCallback(ae=>H(null,null,function*(){try{b(null),k(!0);const ne=yield i(e,1,ae);ne&&(p(ne.data),T(ne.columns),O(ae),D(ne.totalPages),N(1))}catch(ne){b(ne instanceof Error?ne.message:"Error changing results per page")}finally{k(!1)}}),[e,i]),Z=v.useCallback(()=>{const ae=j(e);t(ae),U(!1)},[e,t,j]),V=v.useCallback(()=>{U(!1)},[]),te=v.useCallback(()=>{p(null),T(null),b(null),R(null),w(0),N(1),D(0),U(!1)},[]);return v.useEffect(()=>{A>s&&U(!0)},[A,s]),{results:m,columns:g,error:y,executionTime:x,totalRows:A,currentPage:_,totalPages:I,rowsPerPage:M,isLoading:l,isChangingPage:L,showLargeDataWarning:F,executeQuery:K,executeCustomQuery:J,changePage:$,changeRowsPerPage:X,optimizeQuery:Z,dismissWarning:V,clearResults:te}},Zke=()=>{const[e,t]=v.useState([]),[n,r]=v.useState(!1),[a,s]=v.useState(!1),i=v.useCallback(g=>{const T=g.trim().toLowerCase();return T.startsWith("select")&&!T.includes("limit")?{id:"missing-limit",message:"This query has no LIMIT clause, which could return a large result set",severity:"warning",fix:()=>"".concat(g.trim()," LIMIT 1000")}:null},[]),l=v.useCallback(g=>g.trim().toLowerCase().includes("select *")?{id:"select-star",message:"Using SELECT * can be inefficient. Consider selecting only needed columns",severity:"info"}:null,[]),c=v.useCallback(g=>{const T=g.trim().toLowerCase();return T.startsWith("select")&&!T.includes("where")&&(T.includes("order by")||T.includes("group by"))?{id:"missing-where",message:"This query lacks a WHERE clause but has sorting/grouping which could be inefficient",severity:"warning"}:null},[]),u=v.useCallback(g=>{if(!g.trim()){t([]),r(!1),s(!1);return}const T=[],y=i(g);y&&T.push(y);const b=l(g);b&&T.push(b);const x=c(g);x&&T.push(x),t(T);const R=T.some(w=>w.severity==="warning"),A=T.some(w=>w.severity==="critical");r(R),s(A)},[i,l,c]),h=v.useCallback((g,T)=>{const y=e.find(b=>b.id===g);return y!=null&&y.fix?y.fix():T},[e]),m=v.useCallback(()=>{t([]),r(!1),s(!1)},[]),p=v.useCallback(g=>{let T=g;const y=i(g);return y&&y.fix&&(T=y.fix()),T},[i]);return{suggestions:e,hasWarnings:n,hasCriticalIssues:a,analyzeQuery:u,applySuggestion:h,clearSuggestions:m,optimizeQuery:p}},Ym=e=>{const t=Math.min(100,e.length),n=e.slice(0,t).filter(l=>l!=null&&l!=="");return n.length===0?Nt.Text:n.every(l=>typeof l=="boolean"||typeof l=="string"&&(l.toLowerCase()==="true"||l.toLowerCase()==="false")||l===0||l===1)?Nt.Boolean:n.every(l=>{if(typeof l=="number")return!0;if(typeof l=="string"){const c=parseFloat(l);return!isNaN(c)&&l.trim()===c.toString()}return!1})?Nt.Number:n.every(l=>{if(l instanceof Date)return!0;if(typeof l=="string"&&[/^\d{4}-\d{2}-\d{2}$/,/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,/^\d{2}\/\d{2}\/\d{4}$/,/^\d{2}-\d{2}-\d{4}$/].some(u=>u.test(l))){const u=new Date(l);return!isNaN(u.getTime())}return!1})?Nt.Date:n.some(l=>{if(Array.isArray(l)||typeof l=="object"&&l!==null)return!0;if(typeof l=="string"&&(l.startsWith("[")||l.startsWith("{")))try{return JSON.parse(l),!0}catch(c){return!1}return!1})?n.every(c=>Array.isArray(c)||typeof c=="string"&&c.startsWith("["))?Nt.Array:Nt.Object:Nt.String},eje=()=>{const[e,t]=v.useState(!1),{addFile:n}=ut(),{loadData:r,getTableSchema:a,executeQuery:s,db:i,registeredTables:l}=Dt(),{addNode:c,ensureTempFolder:u}=xs(),h=v.useCallback((m,p,g,T,y)=>H(null,null,function*(){if(!m||!p||m.length===0)return!1;t(!0);try{let b;if(y)b=y;else{const M=new Date,O=M.toISOString().split("T")[0].replace(/-/g,""),L=M.toTimeString().split(" ")[0].replace(/:/g,""),k="".concat(O,"_").concat(L);if(g){const F=g.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_");b="".concat(F,"_modified_").concat(k)}else b="query_results_".concat(k);if(b.length>63){const U=g?g.replace(/\.[^/.]+$/,"").replace(/[^a-zA-Z0-9_]/g,"_").slice(0,25):"query_results";b="".concat(U,"_mod_").concat(k)}}const x=1e5,R=m.length<=x,A=R?"TABLE":"VIEW";let w,_;const N='"'.concat(b,'"');if(R){if(!T)throw new Error("Original query is required to preserve data types when creating tables");const M=T.trim().replace(/;+$/,""),O="CREATE TABLE ".concat(N," AS (").concat(M,")");yield s(O),w=b;const L=new Map(l);L.set(b,N),Dt.setState({registeredTables:L});try{const k=yield a(w);k?_=zc({toArray:()=>k}):_=p.map(F=>{const U=m.map(B=>B[F]);return Ym(U)})}catch(k){_=p.map(F=>{const U=m.map(B=>B[F]);return Ym(U)})}}else{if(!T)throw new Error("Original query is required for creating views of large result sets");const M=T.trim().replace(/;+$/,""),O="CREATE VIEW ".concat(N," AS (").concat(M,")");yield s(O),w=b;const L=new Map(l);L.set(b,N),Dt.setState({registeredTables:L});try{const k=yield a(w);k?_=zc({toArray:()=>k}):_=p.map(F=>{const U=m.map(B=>B[F]);return Ym(U)})}catch(k){_=p.map(F=>{const U=m.map(B=>B[F]);return Ym(U)})}}const D={data:[],columnTypes:_,fileName:b,rowCount:m.length,columnCount:p.length,sourceType:tr.TABLE,loadedToDuckDB:!0,tableName:w,isView:!R,isQueryResult:!0,metadata:{importedFrom:g||"query_results",importedAt:new Date().toISOString(),isModified:!0,objectType:A,rowThreshold:x,originalQuery:T,preservedDataTypes:!0,isQueryResult:!0}};n(D);try{const M=u();c({name:"".concat(b,".sql"),type:"file",fileData:{size:0,lastModified:Date.now(),fileType:"query",isLoaded:!0,tableName:w,isRemote:!1,isTemporary:!0,rowCount:m.length,columnCount:p.length,sourceFileName:g}},M)}catch(M){}return!0}catch(b){return alert("Failed to import results. Please try again."),!1}finally{t(!1)}}),[r,n,a,s]);return{isImporting:e,importQueryResultsAsTable:h,detectColumnType:Ym}},T6=300,tje=()=>{const[e,t]=v.useState(()=>localStorage.getItem("datakit-show-schema-browser")!=="false"),[n,r]=v.useState(()=>localStorage.getItem("datakit-show-query-history")==="true"),[a,s]=v.useState(!1),[i,l]=v.useState("none"),[c,u]=v.useState(()=>parseInt(localStorage.getItem("datakit-query-editor-height")||String(T6),10)),[h,m]=v.useState(!1),[p,g]=v.useState("");return v.useEffect(()=>{localStorage.getItem("datakit-show-schema-browser")===null&&localStorage.setItem("datakit-show-schema-browser","true"),localStorage.getItem("datakit-show-query-history")===null&&localStorage.setItem("datakit-show-query-history","false"),localStorage.getItem("datakit-query-editor-height")===null&&localStorage.setItem("datakit-query-editor-height",String(T6))},[]),{showSchemaBrowser:e,showQueryHistory:n,showOptimizationTips:a,fullScreenMode:i,queryInputHeight:c,saveDialogOpen:h,queryName:p,setShowOptimizationTips:s,setQueryInputHeight:u,setSaveDialogOpen:m,setQueryName:g,toggleSchemaBrowser:()=>{const x=!e;t(x),localStorage.setItem("datakit-show-schema-browser",String(x))},toggleQueryHistory:()=>{const x=!n;r(x),localStorage.setItem("datakit-show-query-history",String(x))},toggleFullScreenMode:x=>{l(R=>R===x?"none":x)}}},y6=260,nje=50,rje=400,aje=()=>{const{t:e}=Ze(),{isInitialized:t,isInitializing:n,error:r,retry:a}=hLe(),{query:s,setQuery:i,hasUnsavedChanges:l,isDirty:c,saveCurrentQuery:u,canExecuteQueries:h,hasUserTables:m,addToHistory:p,markAsClean:g,setQueryAndMarkDirty:T,activeFile:y}=dLe();fLe(i),v.useEffect(()=>()=>{l&&u()},[l,u]);const{showSchemaBrowser:b,showQueryHistory:x,showOptimizationTips:R,fullScreenMode:A,queryInputHeight:w,saveDialogOpen:_,queryName:N,setShowOptimizationTips:I,setSaveDialogOpen:D,setQueryName:M,toggleSchemaBrowser:O,toggleQueryHistory:L,toggleFullScreenMode:k}=tje(),[F,U]=v.useState(!1),{results:B,columns:j,error:G,executionTime:K,totalRows:J,currentPage:$,totalPages:X,rowsPerPage:Z,isLoading:V,isChangingPage:te,showLargeDataWarning:ae,executeQuery:ne,executeCustomQuery:ce,changePage:ie,changeRowsPerPage:W,optimizeQuery:Q,dismissWarning:se,clearResults:z}=Jke(s,i,y);v.useEffect(()=>{z()},[y==null?void 0:y.id,z]);const{selectQuery:xe,saveQuery:le,isLoadingQueries:pe}=DQ(De=>i(De)),{suggestions:_e,hasWarnings:re,analyzeQuery:Se,optimizeQuery:$e}=Zke(),{isImporting:qe,importQueryResultsAsTable:Je}=eje(),[lt,at]=v.useState(()=>{const De=localStorage.getItem("datakit-schema-browser-width");return De?parseInt(De,10):y6}),[ot,st]=v.useState(!1),oe=v.useRef(null),ue=v.useRef(null),Ee=v.useRef(null),Le=v.useRef(null),{startResize:ke}=Qke(ue,{direction:"vertical",initialSize:w,minSize:100,maxSize:800,storageKey:"datakit-query-editor-height"}),Ge=v.useCallback(De=>{requestAnimationFrame(()=>{if(!oe.current)return;const nt=oe.current.getBoundingClientRect(),Pt=Math.min(Math.max(De.clientX-nt.left,nje),rje);at(Pt)})},[]),tt=v.useCallback(De=>{De.preventDefault(),st(!0)},[]),ct=v.useCallback(()=>{ot&&(st(!1),localStorage.setItem("datakit-schema-browser-width",lt.toString()))},[ot,lt]);v.useEffect(()=>{if(ot)return document.addEventListener("mousemove",Ge),document.addEventListener("mouseup",ct),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ge),document.removeEventListener("mouseup",ct),document.body.style.cursor="",document.body.style.userSelect=""}},[ot,Ge,ct]),v.useEffect(()=>{h&&s.trim()&&Se(s)},[s,Se,h]);const Te=()=>{s.trim()&&(N.trim()?(le(s,N),D(!1),M("")):D(!0))},Oe=()=>{const De=$e(s);i(De),I(!1)},de=v.useCallback(()=>{U(!0)},[]),Ae=v.useCallback(De=>H(null,null,function*(){const nt=(y==null?void 0:y.fileName)||(y==null?void 0:y.tableName);(yield Je(B,j,nt,s,De))&&U(!1)}),[B,j,y,s,Je]),we=v.useCallback(()=>H(null,null,function*(){if(h&&s.trim())try{yield ne(),g(),p(s,K)}catch(De){}}),[h,s,ne,p,K,g]),Ie=v.useCallback(De=>H(null,null,function*(){if(!(!h||!De.trim()))try{yield ce(De),p(De)}catch(nt){}}),[h,ce,p,K]),Ke=v.useMemo(()=>({executeQuery:we,saveQuery:Te,exitFullScreen:()=>setFullScreenMode("none")}),[we,Te]);if(v.useEffect(()=>{const De=nt=>{(nt.ctrlKey||nt.metaKey)&&nt.key==="Enter"&&nt.target.closest(".monaco-editor")&&(nt.preventDefault(),Ke.executeQuery()),(nt.ctrlKey||nt.metaKey)&&nt.key==="s"&&(nt.preventDefault(),Ke.saveQuery()),nt.key==="Escape"&&A!=="none"&&(nt.preventDefault(),Ke.exitFullScreen())};return window.addEventListener("keydown",De,!0),()=>window.removeEventListener("keydown",De,!0)},[Ke,A]),!t)return r?o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsxs("div",{className:"text-center p-8 max-w-md",children:[o.jsx("div",{className:"mb-6 flex justify-center",children:o.jsx("div",{className:"w-16 h-16 bg-red-500/10 rounded-full flex items-center justify-center",children:o.jsx(Ma,{className:"w-8 h-8 text-red-500"})})}),o.jsx("h3",{className:"text-lg font-heading font-medium text-white mb-2",children:e("query.workspace.errors.initFailed")}),o.jsx("p",{className:"text-white/70 mb-4",children:r}),o.jsx(je,{onClick:a,variant:"primary",children:e("query.workspace.actions.retryInit")})]})}):o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsxs("div",{className:"text-center p-8 max-w-md",children:[o.jsx("div",{className:"mb-6 flex justify-center"}),o.jsx("h3",{className:"text-lg font-heading font-medium text-white mb-2",children:e(n?"query.workspace.status.initializing":"query.workspace.status.notReady")}),o.jsx("p",{className:"text-white/70 mb-4",children:e(n?"query.workspace.status.settingUp":"query.workspace.status.preparing")})]})});const it=()=>o.jsxs("div",{className:"flex items-center justify-between p-2 bg-darkNav border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center space-x-3",children:[o.jsx("h3",{className:"text-sm font-medium",children:"Query Results"}),!!K&&o.jsxs("div",{className:"flex items-center text-xs text-white/60",children:[o.jsx(du,{size:12,className:"mr-1"}),o.jsxs("span",{children:[K.toFixed(0),"ms"]})]}),J>0&&o.jsxs("div",{className:"text-xs text-white/60",children:[J.toLocaleString()," rows"]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>k("results"),title:"Full Screen Results",children:o.jsx(G5,{size:16})}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:L,title:x?"Hide Query History":"Show Query History",children:o.jsx(nr,{size:16,className:"transition-transform ".concat(x?"":"rotate-180")})})]})]});return A!=="none"?o.jsx("div",{className:"w-full h-full flex flex-col",children:A==="editor"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between p-2 bg-darkNav border-b border-white/10",children:[o.jsx("h3",{className:"text-sm font-medium",children:"SQL Editor (Fullscreen)"}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>k("editor"),title:"Exit Full Screen",children:o.jsx(fO,{size:16})})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(i1,{value:s,onChange:T,onExecute:Ke.executeQuery,onExecuteSelection:Ie})})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center justify-between p-2 bg-darkNav border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center space-x-3",children:[o.jsx("h3",{className:"text-sm font-medium",children:"Query Results (Fullscreen)"}),K!==null&&o.jsxs("div",{className:"flex items-center text-xs text-white/60",children:[o.jsx(du,{size:12,className:"mr-1"}),o.jsxs("span",{children:[K.toFixed(0),"ms"]})]}),J>0&&o.jsxs("div",{className:"text-xs text-white/60",children:[J.toLocaleString()," rows"]})]}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>k("results"),title:"Exit Full Screen",children:o.jsx(fO,{size:16})})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(E6,{results:B,columns:j,isLoading:V||te||pe,error:G,totalRows:J,currentPage:$,totalPages:X,rowsPerPage:Z,onPageChange:ie,onRowsPerPageChange:W,onImportAsTable:de,isImporting:qe})})]})}):o.jsxs("div",{ref:oe,className:"h-full w-full flex overflow-hidden relative border-t border-l border-white/10",children:[ot&&o.jsx("div",{className:"absolute inset-0 z-50",style:{cursor:"col-resize"}}),o.jsxs("div",{className:"flex-shrink-0 overflow-hidden bg-darkNav border-r border-white/10 relative ".concat(ot?"":"transition-all duration-200"),style:{width:b?"".concat(lt,"px"):"0px"},children:[o.jsx("div",{className:"h-full w-full",children:o.jsx(mQ,{onInsertQuery:De=>i(s+De)})}),b&&o.jsx("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize bg-transparent ".concat(ot?"bg-primary/50":"hover:bg-primary/30 transition-colors"),onMouseDown:tt,style:{width:"5px",right:"-2px"},children:ot&&o.jsx("div",{className:"absolute inset-0 bg-primary/50"})})]}),o.jsxs("div",{className:"flex-grow flex flex-col min-w-0 overflow-hidden",children:[o.jsxs("div",{ref:ue,className:"flex flex-col relative",style:{height:"".concat(w,"px")},children:[o.jsxs("div",{className:"flex items-center justify-between p-2 bg-darkNav border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:O,title:b?"Hide Schema Browser":"Show Schema Browser",children:o.jsx(Dg,{size:16,className:"transition-transform ".concat(b?"":"rotate-180")})}),o.jsx("h3",{className:"text-sm font-medium",children:"SQL Editor"}),re&&o.jsxs("button",{className:"flex items-center text-xs px-2 py-0.5 bg-warning/20 text-warning rounded cursor-pointer",onClick:()=>I(!R),title:"Query optimization suggestions available",children:[o.jsx(mO,{size:12,className:"mr-1"}),o.jsx("span",{children:"Optimize"})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Kke,{isDirty:c}),o.jsxs(je,{variant:"ghost",size:"sm",onClick:Te,className:"h-8",disabled:!s.trim(),children:[o.jsx(DL,{size:14,className:"mr-1"}),o.jsx("span",{children:"Save"})]}),o.jsxs(je,{variant:"primary",size:"sm",onClick:Ke.executeQuery,disabled:V||te||!s.trim()||!h,className:"h-8 gap-2",title:"Execute query (⌘+Enter)",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx($l,{size:14,className:"mr-1"}),o.jsx("span",{children:"Execute"})]}),o.jsxs("div",{className:"flex items-center text-[11px] opacity-60 bg-white/10 px-1.5 py-0.5 rounded",children:[o.jsx(NL,{size:11,className:"mr-0.5"}),o.jsx("span",{className:"leading-none",children:"↵"})]})]}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>k("editor"),title:"Full Screen Editor",children:o.jsx(G5,{size:16})})]})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(i1,{value:s,onChange:T,onExecute:Ke.executeQuery,onExecuteSelection:Ie})}),R&&_e.length>0&&o.jsxs("div",{className:"absolute top-12 right-0 w-80 bg-background border border-white/10 rounded-md shadow-lg z-10 p-3",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsxs("h3",{className:"text-sm font-medium flex items-center",children:[o.jsx(mO,{size:14,className:"mr-1 text-warning"}),"Query Optimization Tips"]}),o.jsx("button",{className:"text-white/50 hover:text-white",onClick:()=>I(!1),children:"×"})]}),o.jsx("div",{className:"space-y-2 mb-2",children:_e.map(De=>o.jsxs("div",{className:"p-2 text-xs rounded ".concat(De.severity==="warning"?"bg-warning/10 border border-warning/30":De.severity==="critical"?"bg-destructive/10 border border-destructive/30":"bg-white/5 border border-white/10"),children:[o.jsx("div",{className:"mb-1",children:De.message}),De.fix&&o.jsx("button",{className:"text-xs px-2 py-0.5 bg-primary/20 text-primary rounded",onClick:()=>{i(De.fix()),I(!1)},children:"Apply Fix"})]},De.id))}),o.jsx("div",{className:"flex justify-end",children:o.jsx("button",{className:"text-xs px-3 py-1 rounded bg-primary text-white",onClick:Oe,children:"Optimize Query"})})]})]}),o.jsx("div",{ref:Le,className:"h-2 bg-darkNav/50 cursor-row-resize hover:bg-primary/30 transition-colors flex items-center justify-center",onMouseDown:ke,children:o.jsx("div",{className:"w-8 h-1 bg-white/20 rounded-full"})}),o.jsxs("div",{ref:Ee,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[it(),ae&&o.jsx("div",{className:"bg-primary/10 border border-primary/30 rounded p-3 m-3 text-white text-sm",children:o.jsxs("div",{className:"flex items-start",children:[o.jsx(Ma,{size:18,className:"text-primary mt-0.5 mr-2 flex-shrink-0"}),o.jsxs("div",{className:"flex-1",children:[o.jsxs("h4",{className:"text-sm font-medium mb-1",children:["Large Result Set (",J.toLocaleString()," rows)"]}),o.jsx("p",{className:"text-xs text-white/80 mb-2",children:"This query is returning a large dataset which may affect performance. Consider adding filters or LIMIT clause with lower value to reduce the result size."}),o.jsxs("div",{className:"flex justify-end space-x-2 mt-2",children:[o.jsx("button",{className:"text-xs px-3 py-1 rounded bg-primary text-white",onClick:Q,children:"Add LIMIT Clause"}),o.jsx("button",{className:"text-xs px-3 py-1 rounded bg-white/10 hover:bg-white/20",onClick:se,children:"Dismiss"})]})]})]})}),!h&&o.jsx("div",{className:"bg-secondary/10 border border-secondary/30 rounded p-3 m-3 text-white text-sm",children:o.jsxs("div",{className:"flex items-start",children:[o.jsx(Xs,{size:18,className:"text-secondary mt-0.5 mr-2 flex-shrink-0"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("h4",{className:"text-sm font-medium mb-1",children:"Ready to Query Sample Data!"}),o.jsx("p",{className:"text-xs text-white/80 mb-2",children:m?"You have uploaded data ready to query. Try the sample query above or write your own SQL.":"A sample employees table is available for testing. Import your own CSV, JSON, or Parquet files to query your data."})]})]})}),o.jsx("div",{className:"flex-1 overflow-hidden",children:o.jsx(E6,{results:B,columns:j,isLoading:V||te||pe,error:G,totalRows:J,currentPage:$,totalPages:X,rowsPerPage:Z,onPageChange:ie,onRowsPerPageChange:W,onImportAsTable:de,isImporting:qe})})]})]}),o.jsx("div",{className:"flex-shrink-0 transition-all duration-200 overflow-hidden",style:{width:x?"".concat(y6,"px"):"0px",opacity:x?1:0},children:x&&o.jsx("div",{className:"h-full border-l border-white/10 bg-darkNav overflow-hidden",children:o.jsx(Bke,{onSelectQuery:xe})})}),_&&o.jsx("div",{className:"fixed inset-0 backdrop-blur-sm bg-black/60 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-darkNav p-4 rounded-lg shadow-lg w-96",children:[o.jsx("h3",{className:"text-lg font-medium mb-4",children:"Save Query"}),o.jsx("input",{type:"text",className:"w-full p-2 bg-background border border-white/10 rounded mb-4",placeholder:"Enter query name",value:N,onChange:De=>M(De.target.value),autoFocus:!0}),o.jsxs("div",{className:"flex justify-end space-x-2",children:[o.jsx(je,{variant:"ghost",onClick:()=>{D(!1),M("")},children:"Cancel"}),o.jsx(je,{variant:"outline",onClick:()=>{N.trim()&&(le(s,N),D(!1),M(""))},disabled:!N.trim(),children:"Save"})]})]})}),o.jsx(Xke,{isOpen:F,onClose:()=>U(!1),onConfirm:Ae,isImporting:qe,rowCount:J,columnCount:(j==null?void 0:j.length)||0,sourceFileName:(y==null?void 0:y.fileName)||(y==null?void 0:y.tableName)})]})},sje=()=>o.jsx(aje,{});var ije=Object.defineProperty,vt=(e,t)=>ije(e,"name",{value:t,configurable:!0}),PQ=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),oje=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return n=>{for(var r=n.length,a=new Uint8Array((r-(n[r-1]=="=")-(n[r-2]=="="))*3/4|0),s=0,i=0;s<r;){var l=e[n.charCodeAt(s++)],c=e[n.charCodeAt(s++)],u=e[n.charCodeAt(s++)],h=e[n.charCodeAt(s++)];a[i++]=l<<2|c>>4,a[i++]=c<<4|u>>2,a[i++]=u<<6|h}return a}})();function kQ(e){return!isNaN(parseFloat(e))&&isFinite(e)}vt(kQ,"_isNumber");function Kl(e){return e.charAt(0).toUpperCase()+e.substring(1)}vt(Kl,"_capitalize");function mS(e){return function(){return this[e]}}vt(mS,"_getter");var zd=["isConstructor","isEval","isNative","isToplevel"],qd=["columnNumber","lineNumber"],Yd=["fileName","functionName","source"],lje=["args"],cje=["evalOrigin"],GT=zd.concat(qd,Yd,lje,cje);function Ss(e){if(e)for(var t=0;t<GT.length;t++)e[GT[t]]!==void 0&&this["set"+Kl(GT[t])](e[GT[t]])}vt(Ss,"StackFrame");Ss.prototype={getArgs:vt(function(){return this.args},"getArgs"),setArgs:vt(function(e){if(Object.prototype.toString.call(e)!=="[object Array]")throw new TypeError("Args must be an Array");this.args=e},"setArgs"),getEvalOrigin:vt(function(){return this.evalOrigin},"getEvalOrigin"),setEvalOrigin:vt(function(e){if(e instanceof Ss)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new Ss(e);else throw new TypeError("Eval Origin must be an Object or StackFrame")},"setEvalOrigin"),toString:vt(function(){var e=this.getFileName()||"",t=this.getLineNumber()||"",n=this.getColumnNumber()||"",r=this.getFunctionName()||"";return this.getIsEval()?e?"[eval] ("+e+":"+t+":"+n+")":"[eval]:"+t+":"+n:r?r+" ("+e+":"+t+":"+n+")":e+":"+t+":"+n},"toString")};Ss.fromString=vt(function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),r=e.substring(0,t),a=e.substring(t+1,n).split(","),s=e.substring(n+1);if(s.indexOf("@")===0)var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),l=i[1],c=i[2],u=i[3];return new Ss({functionName:r,args:a||void 0,fileName:l,lineNumber:c||void 0,columnNumber:u||void 0})},"StackFrame$$fromString");for(Lc=0;Lc<zd.length;Lc++)Ss.prototype["get"+Kl(zd[Lc])]=mS(zd[Lc]),Ss.prototype["set"+Kl(zd[Lc])]=function(e){return function(t){this[e]=!!t}}(zd[Lc]);var Lc;for(Mc=0;Mc<qd.length;Mc++)Ss.prototype["get"+Kl(qd[Mc])]=mS(qd[Mc]),Ss.prototype["set"+Kl(qd[Mc])]=function(e){return function(t){if(!kQ(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(qd[Mc]);var Mc;for(Dc=0;Dc<Yd.length;Dc++)Ss.prototype["get"+Kl(Yd[Dc])]=mS(Yd[Dc]),Ss.prototype["set"+Kl(Yd[Dc])]=function(e){return function(t){this[e]=String(t)}}(Yd[Dc]);var Dc,CC=Ss;function jQ(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:vt(function(n){if(n.stack&&n.stack.match(e))return this.parseV8OrIE(n);if(n.stack)return this.parseFFOrSafari(n);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:vt(function(n){if(n.indexOf(":")===-1)return[n];var r=/(.+?)(?::(\d+))?(?::(\d+))?$/,a=r.exec(n.replace(/[()]/g,""));return[a[1],a[2]||void 0,a[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:vt(function(n){var r=n.stack.split("\n").filter(function(a){return!!a.match(e)},this);return r.map(function(a){a.indexOf("(eval ")>-1&&(a=a.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));var s=a.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,""),i=s.match(/ (\(.+\)$)/);s=i?s.replace(i[0],""):s;var l=this.extractLocation(i?i[1]:s),c=i&&s||void 0,u=["eval","<anonymous>"].indexOf(l[0])>-1?void 0:l[0];return new CC({functionName:c,fileName:u,lineNumber:l[1],columnNumber:l[2],source:a})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:vt(function(n){var r=n.stack.split("\n").filter(function(a){return!a.match(t)},this);return r.map(function(a){if(a.indexOf(" > eval")>-1&&(a=a.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),a.indexOf("@")===-1&&a.indexOf(":")===-1)return new CC({functionName:a});var s=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=a.match(s),l=i&&i[1]?i[1]:void 0,c=this.extractLocation(a.replace(s,""));return new CC({functionName:l,fileName:c[0],lineNumber:c[1],columnNumber:c[2],source:a})},this)},"ErrorStackParser$$parseFFOrSafari")}}vt(jQ,"ErrorStackParser");var uje=new jQ,dje=uje,to=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&!process.browser,UQ=to&&typeof module<"u"&&typeof module.exports<"u"&&typeof PQ<"u"&&typeof __dirname<"u",hje=to&&!UQ,fje=typeof Deno<"u",FQ=!to&&!fje,mje=FQ&&typeof window=="object"&&typeof document=="object"&&typeof document.createElement=="function"&&"sessionStorage"in window&&typeof importScripts!="function",pje=FQ&&typeof importScripts=="function"&&typeof self=="object";typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Chrome")==-1&&navigator.userAgent.indexOf("Safari")>-1;var pS=typeof read=="function"&&typeof load=="function",$Q,o1,BQ,x6,MD;function DD(){return H(this,null,function*(){if(!to||($Q=(yield fn(()=>H(null,null,function*(){const{default:s}=yield import("./__vite-browser-external-BIHI7g3E.js");return{default:s}}),[])).default,x6=yield fn(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),MD=yield fn(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),BQ=(yield fn(()=>H(null,null,function*(){const{default:s}=yield import("./__vite-browser-external-BIHI7g3E.js");return{default:s}}),[])).default,o1=yield fn(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),PD=o1.sep,typeof PQ<"u"))return;let e=x6,t=yield fn(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),n=yield fn(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),r=yield fn(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),a={fs:e,crypto:t,ws:n,child_process:r};globalThis.require=function(s){return a[s]}})}vt(DD,"initNodeModules");function HQ(e,t){return o1.resolve(t||".",e)}vt(HQ,"node_resolvePath");function VQ(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}vt(VQ,"browser_resolvePath");var gy;to?gy=HQ:pS?gy=vt(e=>e,"resolvePath"):gy=VQ;var PD;to||(PD="/");function GQ(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:MD.readFile(e).then(n=>new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}}vt(GQ,"node_getBinaryResponse");function zQ(e,t){if(e.startsWith("file://")&&(e=e.slice(7)),e.includes("://"))throw new Error("Shell cannot fetch urls");return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}vt(zQ,"shell_getBinaryResponse");function qQ(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}vt(qQ,"browser_getBinaryResponse");var jp;to?jp=GQ:pS?jp=zQ:jp=qQ;function YQ(e,t){return H(this,null,function*(){let{response:n,binary:r}=jp(e,t);if(r)return r;let a=yield n;if(!a.ok)throw new Error("Failed to load '".concat(e,"': request failed."));return new Uint8Array(yield a.arrayBuffer())})}vt(YQ,"loadBinaryFile");var Tp;if(mje)Tp=vt(e=>H(null,null,function*(){return yield import(e)}),"loadScript");else if(pje)Tp=vt(e=>H(null,null,function*(){try{globalThis.importScripts(e)}catch(t){if(t instanceof TypeError)yield import(e);else throw t}}),"loadScript");else if(to)Tp=WQ;else if(pS)Tp=load;else throw new Error("Cannot determine runtime environment");function WQ(e){return H(this,null,function*(){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?BQ.runInThisContext(yield(yield fetch(e)).text()):yield import($Q.pathToFileURL(e).href)})}vt(WQ,"nodeLoadScript");function XQ(e){return H(this,null,function*(){if(to){yield DD();let t=yield MD.readFile(e,{encoding:"utf8"});return JSON.parse(t)}else if(pS){let t=read(e);return JSON.parse(t)}else return yield(yield fetch(e)).json()})}vt(XQ,"loadLockFile");function KQ(){return H(this,null,function*(){if(UQ)return __dirname;let e;try{throw new Error}catch(r){e=r}let t=dje.parse(e)[0].fileName;if(to&&!t.startsWith("file://")&&(t="file://".concat(t)),hje){let r=yield fn(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);return(yield fn(()=>H(null,null,function*(){const{fileURLToPath:a}=yield import("./__vite-browser-external-BIHI7g3E.js");return{fileURLToPath:a}}),[])).fileURLToPath(r.dirname(t))}let n=t.lastIndexOf(PD);if(n===-1)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,n)})}vt(KQ,"calculateDirname");function QQ(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:vt(function(s){if(!s.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return n.mount.apply(null,arguments)},"mount"),syncfs:vt((s,i,l)=>H(null,null,function*(){try{let c=a.getLocalSet(s),u=yield a.getRemoteSet(s),h=i?u:c,m=i?c:u;yield a.reconcile(s,h,m),l(null)}catch(c){l(c)}}),"syncfs"),getLocalSet:vt(s=>{let i=Object.create(null);function l(h){return h!=="."&&h!==".."}vt(l,"isRealDir");function c(h){return m=>r.join2(h,m)}vt(c,"toAbsolute");let u=t.readdir(s.mountpoint).filter(l).map(c(s.mountpoint));for(;u.length;){let h=u.pop(),m=t.stat(h);t.isDir(m.mode)&&u.push.apply(u,t.readdir(h).filter(l).map(c(h))),i[h]={timestamp:m.mtime,mode:m.mode}}return{type:"local",entries:i}},"getLocalSet"),getRemoteSet:vt(s=>H(null,null,function*(){let i=Object.create(null),l=yield gje(s.opts.fileSystemHandle);for(let[c,u]of l)c!=="."&&(i[r.join2(s.mountpoint,c)]={timestamp:u.kind==="file"?new Date((yield u.getFile()).lastModified):new Date,mode:u.kind==="file"?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:i,handles:l}}),"getRemoteSet"),loadLocalEntry:vt(s=>{let i=t.lookupPath(s).node,l=t.stat(s);if(t.isDir(l.mode))return{timestamp:l.mtime,mode:l.mode};if(t.isFile(l.mode))return i.contents=n.getFileDataAsTypedArray(i),{timestamp:l.mtime,mode:l.mode,contents:i.contents};throw new Error("node type not supported")},"loadLocalEntry"),storeLocalEntry:vt((s,i)=>{if(t.isDir(i.mode))t.mkdirTree(s,i.mode);else if(t.isFile(i.mode))t.writeFile(s,i.contents,{canOwn:!0});else throw new Error("node type not supported");t.chmod(s,i.mode),t.utime(s,i.timestamp,i.timestamp)},"storeLocalEntry"),removeLocalEntry:vt(s=>{var i=t.stat(s);t.isDir(i.mode)?t.rmdir(s):t.isFile(i.mode)&&t.unlink(s)},"removeLocalEntry"),loadRemoteEntry:vt(s=>H(null,null,function*(){if(s.kind==="file"){let i=yield s.getFile();return{contents:new Uint8Array(yield i.arrayBuffer()),mode:a.FILE_MODE,timestamp:new Date(i.lastModified)}}else{if(s.kind==="directory")return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+s.kind)}}),"loadRemoteEntry"),storeRemoteEntry:vt((s,i,l)=>H(null,null,function*(){let c=s.get(r.dirname(i)),u=t.isFile(l.mode)?yield c.getFileHandle(r.basename(i),{create:!0}):yield c.getDirectoryHandle(r.basename(i),{create:!0});if(u.kind==="file"){let h=yield u.createWritable();yield h.write(l.contents),yield h.close()}s.set(i,u)}),"storeRemoteEntry"),removeRemoteEntry:vt((s,i)=>H(null,null,function*(){yield s.get(r.dirname(i)).removeEntry(r.basename(i)),s.delete(i)}),"removeRemoteEntry"),reconcile:vt((s,i,l)=>H(null,null,function*(){let c=0,u=[];Object.keys(i.entries).forEach(function(p){let g=i.entries[p],T=l.entries[p];(!T||t.isFile(g.mode)&&g.timestamp.getTime()>T.timestamp.getTime())&&(u.push(p),c++)}),u.sort();let h=[];if(Object.keys(l.entries).forEach(function(p){i.entries[p]||(h.push(p),c++)}),h.sort().reverse(),!c)return;let m=i.type==="remote"?i.handles:l.handles;for(let p of u){let g=r.normalize(p.replace(s.mountpoint,"/")).substring(1);if(l.type==="local"){let T=m.get(g),y=yield a.loadRemoteEntry(T);a.storeLocalEntry(p,y)}else{let T=a.loadLocalEntry(p);yield a.storeRemoteEntry(m,g,T)}}for(let p of h)if(l.type==="local")a.removeLocalEntry(p);else{let g=r.normalize(p.replace(s.mountpoint,"/")).substring(1);yield a.removeRemoteEntry(m,g)}}),"reconcile")};e.FS.filesystems.NATIVEFS_ASYNC=a}vt(QQ,"initializeNativeFS");var gje=vt(e=>H(null,null,function*(){let t=[];function n(a){return H(this,null,function*(){try{for(var s=iT(a.values()),i,l,c;i=!(l=yield s.next()).done;i=!1){let u=l.value;t.push(u),u.kind==="directory"&&(yield n(u))}}catch(l){c=[l]}finally{try{i&&(l=s.return)&&(yield l.call(s))}finally{if(c)throw c[0]}}})}vt(n,"collect"),yield n(e);let r=new Map;r.set(".",e);for(let a of t){let s=(yield e.resolve(a)).join("/");r.set(s,a)}return r}),"getFsHandles");oje("AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECByECD2NyZWF0ZV9zZW50aW5lbAAAC2lzX3NlbnRpbmVsAAEKEwIHAPsBAPsbCwkAIAD7GvsUAAs=");var Eje=function(){return H(this,null,function*(){globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&typeof navigator.maxTouchPoints<"u"&&navigator.maxTouchPoints>1)})}();function JQ(){return H(this,null,function*(){let e=yield Eje;if(e)return e.exports;let t=Symbol("error marker");return{create_sentinel:vt(()=>t,"create_sentinel"),is_sentinel:vt(n=>n===t,"is_sentinel")}})}vt(JQ,"getSentinelImport");function ZQ(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:sJ(e),print:e.stdout,printErr:e.stderr,onExit(n){t.exitCode=n},thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:vt(n=>e.indexURL+n,"locateFile"),instantiateWasm:iJ(e.indexURL)};return t}vt(ZQ,"createSettings");function eJ(e){return function(t){let n="/";try{t.FS.mkdirTree(e)}catch(r){e=n}t.FS.chdir(e)}}vt(eJ,"createHomeDirectory");function tJ(e){return function(t){Object.assign(t.ENV,e)}}vt(tJ,"setEnvironment");function nJ(e){return e?[t=>H(null,null,function*(){t.addRunDependency("fsInitHook");try{yield e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}})]:[]}vt(nJ,"callFsInitHook");function rJ(e){let t=e.HEAPU32[e._Py_Version>>>2],n=t>>>24&255,r=t>>>16&255,a=t>>>8&255;return[n,r,a]}vt(rJ,"computeVersionTuple");function aJ(e){let t=YQ(e);return n=>H(null,null,function*(){n.API.pyVersionTuple=rJ(n);let[r,a]=n.API.pyVersionTuple;n.FS.mkdirTree("/lib"),n.API.sitePackages="/lib/python".concat(r,".").concat(a,"/site-packages"),n.FS.mkdirTree(n.API.sitePackages),n.addRunDependency("install-stdlib");try{let s=yield t;n.FS.writeFile("/lib/python".concat(r).concat(a,".zip"),s)}catch(s){}finally{n.removeRunDependency("install-stdlib")}})}vt(aJ,"installStdlib");function sJ(e){let t;return e.stdLibURL!=null?t=e.stdLibURL:t=e.indexURL+"python_stdlib.zip",[aJ(t),eJ(e.env.HOME),tJ(e.env),QQ,...nJ(e.fsInit)]}vt(sJ,"getFileSystemInitializationFuncs");function iJ(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:n}=jp(e+"pyodide.asm.wasm"),r=JQ();return function(a,s){return function(){return H(this,null,function*(){a.sentinel=yield r;try{let i;n?i=yield WebAssembly.instantiateStreaming(n,a):i=yield WebAssembly.instantiate(yield t,a);let{instance:l,module:c}=i;s(l,c)}catch(i){}})}(),{}}}vt(iJ,"getInstantiateWasmFunc");var S6="0.28.0";function oJ(){return H(this,arguments,function*(e={}){var h,m,p,g;yield DD();let t=e.indexURL||(yield KQ());t=gy(t),t.endsWith("/")||(t+="/"),e.indexURL=t;let n={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:t+"pyodide-lock.json",args:[],env:{},packages:[],enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:"aca77914b08e1d99774d24f0b7c9b8f9068e2c62cf4696d7e95d8c3b72139f2d"},r=Object.assign(n,e);(m=(h=r.env).HOME)!=null||(h.HOME="/home/pyodide"),(g=(p=r.env).PYTHONINSPECT)!=null||(p.PYTHONINSPECT="1");let a=ZQ(r),s=a.API;if(s.lockFilePromise=XQ(r.lockFileURL),typeof _createPyodideModule!="function"){let T="".concat(r.indexURL,"pyodide.asm.js");yield Tp(T)}let i;if(e._loadSnapshot){let T=yield e._loadSnapshot;ArrayBuffer.isView(T)?i=T:i=new Uint8Array(T),a.noInitialRun=!0,a.INITIAL_MEMORY=i.length}let l=yield _createPyodideModule(a);if(a.exitCode!==void 0)throw new l.ExitStatus(a.exitCode);if(e.pyproxyToStringRepr&&s.setPyProxyToStringMethod(!0),e.convertNullToNone&&s.setCompatNullToNone(!0),s.version!==S6&&r.checkAPIVersion)throw new Error("Pyodide version does not match: '".concat(S6,"' <==> '").concat(s.version,"'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide."));l.locateFile=T=>{throw T.endsWith(".so")?new Error('Failed to find dynamic library "'.concat(T,'"')):new Error('Unexpected call to locateFile("'.concat(T,'")'))};let c;i&&(c=s.restoreSnapshot(i));let u=s.finalizeBootstrap(c,e._snapshotDeserializer);return s.sys.path.insert(0,""),u.version.includes("dev")||s.setCdnUrl("https://cdn.jsdelivr.net/pyodide/v".concat(u.version,"/full/")),s._pyodide.set_excepthook(),yield s.packageIndexReady,s.initializeStreams(r.stdin,r.stdout,r.stderr),u})}vt(oJ,"loadPyodide");let Na=null,yp=null;function Tje(){return H(this,null,function*(){return Na||yp||(yp=H(null,null,function*(){let e;try{e=yield oJ({indexURL:"https://cdn.jsdelivr.net/pyodide/v0.28.0/full/",stdout:n=>{},stderr:n=>{}})}catch(n){throw new Error("Failed to load Pyodide: ".concat(n instanceof Error?n.message:String(n)))}const t=["numpy","pandas","matplotlib","micropip"];for(const n of t)try{yield e.loadPackage([n]),yield new Promise(r=>setTimeout(r,0))}catch(r){throw new Error("Failed to load ".concat(n,": ").concat(r instanceof Error?r.message:String(r)))}try{yield e.runPythonAsync('\n        import micropip\n        \n        async def install_data_science_packages():\n            """Install packages that are commonly available in Pyodide and useful for data analysis"""\n            try:\n                # Essential data science and visualization packages\n                packages_to_install = [\n                    \'plotly\',           # Interactive visualizations\n                    \'altair\',           # Grammar of graphics visualization\n                    \'scikit-learn\',     # Machine learning\n                    \'scipy\',            # Scientific computing\n                ]\n                \n                print("📦 Installing data science packages...")\n                for package in packages_to_install:\n                    try:\n                        print(f"   Installing {package}...")\n                        await micropip.install(package)\n                        print(f"   ✅ {package} installed successfully")\n                    except Exception as pkg_error:\n                        print(f"   ⚠️ Failed to install {package}: {pkg_error}")\n                        \n                # Try to install seaborn if available\n                try:\n                    print("   Installing seaborn...")\n                    # Import seaborn after installation to verify it works\n                    await micropip.install(\'seaborn\')\n                    import seaborn as sns\n                    print("   ✅ seaborn installed and imported successfully")\n                except Exception as seaborn_error:\n                    print(f"   ⚠️ seaborn installation failed: {seaborn_error}")\n                \n                print("📦 Data science package installation completed")\n                    \n            except Exception as e:\n                print(f"⚠️ Some data science packages failed to install: {e}")\n        \n        # Install packages\n        await install_data_science_packages()\n      ')}catch(n){}try{yield e.runPythonAsync('\n        import matplotlib\n        matplotlib.use(\'Agg\')  # Use non-interactive backend\n        import matplotlib.pyplot as plt\n        import base64\n        import io\n        \n        # Helper function to get plot as base64\n        def get_plot_base64(fig=None, dpi=100, format=\'png\'):\n            if fig is None:\n                fig = plt.gcf()\n            \n            buf = io.BytesIO()\n            fig.savefig(buf, format=format, dpi=dpi, bbox_inches=\'tight\')\n            buf.seek(0)\n            img_base64 = base64.b64encode(buf.read()).decode(\'utf-8\')\n            buf.close()\n            \n            return f"data:image/{format};base64,{img_base64}"\n        \n        # Setup additional visualization helpers\n        def show_plotly_chart(fig):\n            """Helper to display Plotly charts as HTML"""\n            try:\n                import plotly\n                html_str = fig.to_html(include_plotlyjs=\'cdn\', div_id="plotly-div")\n                return html_str\n            except Exception as e:\n                print(f"Plotly visualization error: {e}")\n                return None\n                \n        def show_altair_chart(chart):\n            """Helper to display Altair charts as HTML"""\n            try:\n                import altair as alt\n                return chart.to_html()\n            except Exception as e:\n                print(f"Altair visualization error: {e}")\n                return None\n        \n        # Make visualization helpers globally available\n        import builtins\n        builtins.get_plot_base64 = get_plot_base64\n        builtins.show_plotly_chart = show_plotly_chart\n        builtins.show_altair_chart = show_altair_chart\n        \n        # Also make micropip globally available for easy package installation\n        import micropip\n        builtins.micropip = micropip\n        \n        # Try to import and setup additional visualization libraries\n        try:\n            import plotly.express as px\n            import plotly.graph_objects as go\n            builtins.px = px\n            builtins.go = go\n            print("📊 Plotly imported and ready")\n        except ImportError:\n            print("📊 Plotly not available")\n            \n        try:\n            import altair as alt\n            builtins.alt = alt\n            print("📊 Altair imported and ready")\n        except ImportError:\n            print("📊 Altair not available")\n            \n        try:\n            import seaborn as sns\n            builtins.sns = sns\n            print("📊 Seaborn imported and ready")\n        except ImportError:\n            print("📊 Seaborn not available")\n            \n        try:\n            from sklearn import datasets, model_selection, preprocessing, metrics\n            builtins.sklearn_datasets = datasets\n            builtins.train_test_split = model_selection.train_test_split\n            builtins.StandardScaler = preprocessing.StandardScaler\n            builtins.sklearn_metrics = metrics\n            print("🤖 Scikit-learn basics imported and ready")\n        except ImportError:\n            print("🤖 Scikit-learn not available")\n      '),yield new Promise(n=>setTimeout(n,0))}catch(n){throw new Error("Failed to setup visualization libraries: ".concat(n instanceof Error?n.message:String(n)))}try{yield e.runPythonAsync("\n        import pandas as pd\n        import json\n        \n        def df_to_dict(df):\n            \"\"\"Convert DataFrame to dictionary for display\"\"\"\n            return {\n                'shape': df.shape,\n                'columns': df.columns.tolist(),\n                'dtypes': {col: str(dtype) for col, dtype in df.dtypes.items()},\n                'preview': df.head(100).fillna('').values.tolist(),\n                'memory_usage': df.memory_usage(deep=True).sum() if hasattr(df, 'memory_usage') else None\n            }\n        \n        # Make it globally available\n        import builtins\n        builtins.df_to_dict = df_to_dict\n      "),yield new Promise(n=>setTimeout(n,0))}catch(n){throw new Error("Failed to setup DataFrame helpers: ".concat(n instanceof Error?n.message:String(n)))}return Na=e,e}),yp)})}function gS(){return Na}function yje(e){return H(this,null,function*(){if(!Na)throw new Error("Pyodide not initialized");try{yield Na.runPython("\n      import micropip\n      await micropip.install('".concat(e,"')\n    "))}catch(t){try{yield Na.loadPackage([e])}catch(n){throw new Error("Failed to install ".concat(e,": ").concat(n))}}})}function b6(){return H(this,null,function*(){if(!Na)return new Map;try{const e=yield Na.runPython("\n      import sys\n      import json\n      import micropip\n      \n      packages = {}\n      \n      # Get packages from sys.modules (already imported)\n      for name, module in sys.modules.items():\n          if hasattr(module, '__version__'):\n              packages[name] = module.__version__\n          elif name in ['numpy', 'pandas', 'matplotlib', 'plotly', 'seaborn', 'scipy', 'requests', 'pillow', 'lxml', 'statsmodels']:\n              # For packages that might not have __version__ but are important\n              packages[name] = 'installed'\n      \n      # Check for packages that are available but not yet imported\n      import importlib.util\n      common_packages = ['scipy', 'requests', 'pillow', 'lxml', 'statsmodels', 'plotly', 'seaborn']\n      for pkg_name in common_packages:\n          if pkg_name not in packages:\n              try:\n                  spec = importlib.util.find_spec(pkg_name)\n                  if spec is not None:\n                      packages[pkg_name] = 'available'\n              except (ImportError, ModuleNotFoundError):\n                  pass\n      \n      # Also check installed packages via micropip\n      try:\n          installed = micropip.list()\n          for pkg in installed:\n              # micropip.list() returns a list of strings (package names)\n              if isinstance(pkg, str) and pkg not in packages:\n                  packages[pkg] = 'installed'\n              # Handle case where it might return dict-like objects\n              elif hasattr(pkg, 'get'):\n                  pkg_name = pkg.get('name', '')\n                  pkg_version = pkg.get('version', 'installed')\n                  if pkg_name and pkg_name not in packages:\n                      packages[pkg_name] = pkg_version\n      except Exception as e:\n          print(f\"Could not get micropip package list: {e}\")\n      \n      json.dumps(packages)\n    "),t=JSON.parse(e);return new Map(Object.entries(t))}catch(e){return new Map}})}function xje(e){const t={queryToPandas(r){return H(this,null,function*(){if(!Na)throw new Error("Pyodide not initialized");const a=yield e.executePaginatedQuery(r,1,1e4,!1,!1);if(!a||!a.data)throw new Error("Query returned no data");const s=JSON.stringify({columns:a.columns,data:a.data}),i="\nimport pandas as pd\nimport json\n\n_query_result_data = json.loads('''".concat(s,"''')\n_query_result_df = pd.DataFrame(_query_result_data['data'], columns=_query_result_data['columns'])\n_query_result_df\n      ");return yield Na.runPythonAsync(i)})},pandasToTable(r,a){return H(this,null,function*(){if(!Na)throw new Error("Pyodide not initialized");const s=yield Na.runPython("\n        import json\n        json.dumps(".concat(r.name,".to_dict('records'))\n      ")),i=JSON.parse(s),l=Object.keys(i[0]||{}),c=i.map(u=>l.map(h=>u[h]));yield e.loadData(c,l,a,[])})},getTableNames(){return e.getAvailableTables()},getTableSchema(r){return H(this,null,function*(){return yield e.getTableSchema(r)})}};return Na&&(Na.runPython('\n      class DuckDBBridge:\n          def __init__(self):\n              pass\n              \n          def query_to_pandas(self, sql):\n              """Execute a SQL query on DuckDB and return results as a pandas DataFrame"""\n              # This will be replaced with the actual implementation\n              pass\n              \n          def pandas_to_table(self, df, table_name):\n              """Save a pandas DataFrame to DuckDB as a table"""\n              # This will be replaced with the actual implementation\n              pass\n              \n          def get_table_names(self):\n              """Get list of available tables in DuckDB"""\n              # This will be replaced with the actual implementation\n              pass\n              \n          def get_table_schema(self, table_name):\n              """Get schema information for a table"""\n              # This will be replaced with the actual implementation\n              pass\n      \n      # Create global instance\n      duckdb_bridge = DuckDBBridge()\n    '),Na.registerJsModule("duckdb_js_bridge",{queryToPandas:t.queryToPandas.bind(t),pandasToTable:t.pandasToTable.bind(t),getTableNames:t.getTableNames.bind(t),getTableSchema:t.getTableSchema.bind(t)})),t}function Sje(){yp=null}function bje(e){return H(this,null,function*(){const t=gS();if(!t)throw new Error("Pyodide not initialized");const n=performance.now(),r=[];let a;try{yield t.runPython("\n      import sys\n      import io\n      from contextlib import redirect_stdout, redirect_stderr\n      \n      # Create string buffers for capturing output\n      _stdout_buffer = io.StringIO()\n      _stderr_buffer = io.StringIO()\n      _output_captured = []\n      \n      # Custom print function to capture output\n      _original_print = print\n      def _capture_print(*args, **kwargs):\n          # Capture in buffer\n          _original_print(*args, file=_stdout_buffer, **kwargs)\n          # Also print normally for console\n          _original_print(*args, **kwargs)\n      \n      print = _capture_print\n    ");let i;try{e.includes("sql(")||e.includes("query(")||e.includes("sql_bridge.")||e.includes("await ")||e.includes("micropip.install")?i=yield t.runPythonAsync(e):i=t.runPython(e)}catch(u){a="".concat(u.name,": ").concat(u.message),r.push({id:crypto.randomUUID(),type:"error",content:a,timestamp:new Date})}const l=yield t.runPython("\n      output = _stdout_buffer.getvalue()\n      _stdout_buffer.close()\n      output\n    ");if(l.trim()&&r.push({id:crypto.randomUUID(),type:"text",content:l.trim(),timestamp:new Date}),yield t.runPython("\n      import matplotlib.pyplot as plt\n      len(plt.get_fignums()) > 0\n    ")){const u=yield t.runPython("\n        import matplotlib.pyplot as plt\n        \n        plots = []\n        for fignum in plt.get_fignums():\n            fig = plt.figure(fignum)\n            plot_b64 = get_plot_base64(fig)\n            plots.append(plot_b64)\n            plt.close(fig)  # Close after capturing\n        \n        plots\n      ");for(const h of u)r.push({id:crypto.randomUUID(),type:"image",content:h,timestamp:new Date})}if(i&&typeof i=="object")try{if(yield t.runPython("\n          import pandas as pd\n          hasattr(_last_result, 'shape') and hasattr(_last_result, 'columns')\n        ")){t.globals.set("_last_result",i);const h=yield t.runPython("\n            df_to_dict(_last_result)\n          ");r.push({id:crypto.randomUUID(),type:"dataframe",content:JSON.stringify(h),timestamp:new Date})}}catch(u){}i!=null&&r.length===0&&r.push({id:crypto.randomUUID(),type:"text",content:String(i),timestamp:new Date}),yield t.runPython("\n      print = _original_print\n    ")}catch(i){a="Execution Error: ".concat(i.message),r.push({id:crypto.randomUUID(),type:"error",content:a,timestamp:new Date})}const s=performance.now()-n;return{output:r,error:a,executionTime:s}})}function vje(){return H(this,null,function*(){const e=gS();if(!e)return{};try{const t=yield e.runPython("\n      import json\n      import pandas as pd\n      import numpy as np\n      \n      vars_info = {}\n      # Create a snapshot to avoid \"dictionary changed size during iteration\" error\n      globals_snapshot = dict(globals())\n      for name, obj in globals_snapshot.items():\n          if not name.startswith('_') and not callable(obj):\n              try:\n                  if isinstance(obj, pd.DataFrame):\n                      vars_info[name] = {\n                          'type': 'DataFrame',\n                          'shape': obj.shape,\n                          'columns': obj.columns.tolist()\n                      }\n                  elif isinstance(obj, np.ndarray):\n                      vars_info[name] = {\n                          'type': 'ndarray',\n                          'shape': obj.shape,\n                          'dtype': str(obj.dtype)\n                      }\n                  elif isinstance(obj, (list, tuple, dict)):\n                      vars_info[name] = {\n                          'type': type(obj).__name__,\n                          'length': len(obj) if hasattr(obj, '__len__') else None\n                      }\n                  else:\n                      vars_info[name] = {\n                          'type': type(obj).__name__,\n                          'value': str(obj)[:100]  # Truncate long values\n                      }\n              except:\n                  pass  # Skip problematic objects\n      \n      json.dumps(vars_info)\n    ");return JSON.parse(t)}catch(t){return{}}})}function Aje(){return H(this,null,function*(){const e=gS();e&&(yield e.runPython("\n    # Get list of user-defined variables\n    user_vars = [name for name in globals().keys() \n                 if not name.startswith('_') \n                 and name not in ['In', 'Out', 'exit', 'quit', 'get_plot_base64', 'df_to_dict']\n                 and not callable(globals()[name])\n                 and name not in ['np', 'pd', 'plt', 'matplotlib', 'numpy', 'pandas']]\n    \n    # Delete user variables\n    for var in user_vars:\n        try:\n            del globals()[var]\n        except:\n            pass\n    \n    # Clear matplotlib figures\n    import matplotlib.pyplot as plt\n    plt.close('all')\n  "))})}function Rje(e){try{return JSON.parse(e)}catch(t){return{shape:[0,0],columns:[],dtypes:{},preview:[]}}}const ii=()=>crypto.randomUUID(),Ia=Ki()(V1((e,t)=>({pyodide:{pyodide:null,isInitializing:!1,isInitialized:!1,error:null,installedPackages:new Map,standardPackages:["numpy","pandas","matplotlib","micropip"]},currentScript:null,cells:[],activeCellId:null,saveStatus:"saved",lastSavedState:null,savedScripts:[],scriptHistory:[],availablePackages:[],installedPackages:new Map,isExecuting:!1,executionQueue:[],globalVariables:{},duckDBBridge:null,showPackageManager:!1,showScriptHistory:!1,showVariableInspector:!1,showTemplates:!1,autoSave:!0,maxHistoryItems:50,cellExecutionTimeout:3e4,initializePython:()=>H(null,null,function*(){const n=t();if(n.pyodide.isInitialized||n.pyodide.isInitializing)return n.pyodide.isInitialized;e(r=>({pyodide:he(q({},r.pyodide),{isInitializing:!0,error:null})}));try{const r=yield Tje(),a=yield b6();return e(s=>({pyodide:he(q({},s.pyodide),{pyodide:r,isInitialized:!0,isInitializing:!1,installedPackages:a}),installedPackages:a})),t().initializeDuckDBBridge(),!0}catch(r){return Sje(),e(a=>({pyodide:he(q({},a.pyodide),{error:r instanceof Error?r.message:String(r),isInitializing:!1})})),!1}}),installPythonPackage:n=>H(null,null,function*(){if(!t().pyodide.isInitialized)throw new Error("Pyodide not initialized");try{yield yje(n),yield t().refreshInstalledPackages()}catch(a){throw a}}),refreshInstalledPackages:()=>H(null,null,function*(){if(t().pyodide.isInitialized)try{const r=yield b6();e({installedPackages:r})}catch(r){}}),createCell:(n="code",r="",a)=>{const s={id:ii(),type:n,code:r,output:[],executionCount:null,isExecuting:!1,isEditing:!1,createdAt:new Date,updatedAt:new Date};return e(i=>{const l=[...i.cells],c=a!==void 0?a:l.length;return l.splice(c,0,s),{cells:l,activeCellId:s.id}}),t().markAsUnsaved(),s.id},updateCell:(n,r)=>{e(a=>({cells:a.cells.map(s=>s.id===n?he(q({},s),{code:r,updatedAt:new Date}):s)})),t().markAsUnsaved(),t().autoSave&&t().currentScript},toggleCellEditMode:n=>{e(r=>({cells:r.cells.map(a=>a.id===n?he(q({},a),{isEditing:!a.isEditing,updatedAt:new Date}):a)}))},toggleCellInputCollapse:n=>{e(r=>({cells:r.cells.map(a=>a.id===n?he(q({},a),{isInputCollapsed:!a.isInputCollapsed,updatedAt:new Date}):a)}))},toggleCellOutputCollapse:n=>{e(r=>({cells:r.cells.map(a=>a.id===n?he(q({},a),{isOutputCollapsed:!a.isOutputCollapsed,updatedAt:new Date}):a)}))},convertCellType:(n,r)=>{e(a=>({cells:a.cells.map(s=>s.id===n?he(q({},s),{type:r,isEditing:r==="markdown",output:r==="markdown"?[]:s.output,executionCount:r==="markdown"?null:s.executionCount,updatedAt:new Date}):s)}))},deleteCell:n=>{e(r=>{var i;const a=r.cells.filter(l=>l.id!==n),s=r.activeCellId===n?((i=a[0])==null?void 0:i.id)||null:r.activeCellId;return{cells:a,activeCellId:s}}),t().markAsUnsaved()},moveCell:(n,r)=>{e(a=>{const s=[...a.cells],i=s.findIndex(c=>c.id===n);if(i===-1)return a;const l=r==="up"?i-1:i+1;return l<0||l>=s.length?a:([s[i],s[l]]=[s[l],s[i]],he(q({},a),{cells:s}))})},clearCell:n=>{e(r=>({cells:r.cells.map(a=>a.id===n?he(q({},a),{output:[],executionCount:null,updatedAt:new Date}):a)}))},executeCell:n=>H(null,null,function*(){const r=t();if(!r.pyodide.isInitialized||r.isExecuting)return;const a=r.cells.find(s=>s.id===n);if(!(!a||!a.code.trim())){e(s=>({isExecuting:!0,cells:s.cells.map(i=>i.id===n?he(q({},i),{isExecuting:!0,output:[]}):i)}));try{const s=yield bje(a.code);e(i=>{const l=Math.max(...i.cells.map(c=>c.executionCount||0))+1;return{isExecuting:!1,cells:i.cells.map(c=>c.id===n?he(q({},c),{isExecuting:!1,output:s.output,executionCount:l,updatedAt:new Date}):c)}}),yield t().refreshVariables()}catch(s){e(i=>({isExecuting:!1,cells:i.cells.map(l=>l.id===n?he(q({},l),{isExecuting:!1,output:[{id:ii(),type:"error",content:s instanceof Error?s.message:String(s),timestamp:new Date}],updatedAt:new Date}):l)}))}}}),executeAllCells:()=>H(null,null,function*(){const n=t();if(!n.pyodide.isInitialized||n.isExecuting)return;const r=n.cells.filter(a=>a.code.trim());for(const a of r)yield t().executeCell(a.id),yield new Promise(s=>setTimeout(s,100))}),createNewScript:n=>{const r={id:ii(),name:n||"Script ".concat(Date.now()),cells:[],createdAt:new Date,updatedAt:new Date};e({currentScript:r,cells:[],activeCellId:null}),t().updateLastSavedState(),e({saveStatus:"saved"})},saveScript:(n,r)=>{var i,l;const a=t();t().markAsSaving();const s={id:((i=a.currentScript)==null?void 0:i.id)||ii(),name:n,description:r,cells:a.cells,createdAt:((l=a.currentScript)==null?void 0:l.createdAt)||new Date,updatedAt:new Date};e(c=>{const u=c.savedScripts.filter(m=>m.id!==s.id);u.unshift(s);const h=u.slice(0,c.maxHistoryItems);return{currentScript:s,savedScripts:h}}),t().markAsSaved()},loadScript:n=>{var s;const a=t().savedScripts.find(i=>i.id===n);a&&(e({currentScript:a,cells:a.cells,activeCellId:((s=a.cells[0])==null?void 0:s.id)||null}),t().markAsSaved())},deleteScript:n=>{e(r=>({savedScripts:r.savedScripts.filter(a=>a.id!==n)}))},duplicateScript:n=>{const a=t().savedScripts.find(i=>i.id===n);if(!a)return;const s=he(q({},a),{id:ii(),name:"".concat(a.name," (Copy)"),createdAt:new Date,updatedAt:new Date,cells:a.cells.map(i=>he(q({},i),{id:ii(),output:[],executionCount:null,isExecuting:!1,createdAt:new Date,updatedAt:new Date}))});e(i=>{var l;return{savedScripts:[s,...i.savedScripts],currentScript:s,cells:s.cells,activeCellId:((l=s.cells[0])==null?void 0:l.id)||null}})},importScript:n=>H(null,null,function*(){var r,a,s;try{const i=yield n.text();if(n.name.endsWith(".ipynb"))try{const l=JSON.parse(i);if(!l.cells||!Array.isArray(l.cells))throw new Error("Invalid Jupyter notebook format: missing cells array");!l.nbformat||l.nbformat;for(const h of l.cells){if(!h.cell_type||!["code","markdown","raw"].includes(h.cell_type))throw new Error("Invalid cell type: ".concat(h.cell_type));if(h.source===void 0)throw new Error("Cell missing source property")}const c=l.cells.filter(h=>h.cell_type!=="raw").map(h=>{const m=h.cell_type==="code"?"code":"markdown";let p="";return Array.isArray(h.source)?p=h.source.join("").replace(/\n$/,""):typeof h.source=="string"&&(p=h.source),{id:ii(),type:m,code:p,output:[],executionCount:h.execution_count||null,isExecuting:!1,isEditing:!1,createdAt:new Date,updatedAt:new Date}}),u={id:ii(),name:n.name.replace(".ipynb",""),description:(r=l.metadata)==null?void 0:r.description,cells:c,createdAt:new Date,updatedAt:new Date};e({currentScript:u,cells:u.cells,activeCellId:((a=u.cells[0])==null?void 0:a.id)||null});return}catch(l){throw new Error("Invalid Jupyter notebook format")}try{const l=JSON.parse(i),c={id:ii(),name:l.name||n.name.replace(".json",""),description:l.description,cells:l.cells||[],createdAt:new Date,updatedAt:new Date};e({currentScript:c,cells:c.cells,activeCellId:((s=c.cells[0])==null?void 0:s.id)||null})}catch(l){const c={id:ii(),type:"code",code:i,output:[],executionCount:null,isExecuting:!1,createdAt:new Date,updatedAt:new Date},u={id:ii(),name:n.name.replace(".py",""),cells:[c],createdAt:new Date,updatedAt:new Date};e({currentScript:u,cells:u.cells,activeCellId:c.id})}}catch(i){throw i}}),exportScript:n=>{const a=t().savedScripts.find(i=>i.id===n);if(!a)throw new Error("Script not found");const s={name:a.name,description:a.description,cells:a.cells,createdAt:a.createdAt,updatedAt:a.updatedAt,exportedAt:new Date,version:"1.0"};return JSON.stringify(s,null,2)},initializeDuckDBBridge:()=>{const n=Dt.getState(),r=xje(n);e({duckDBBridge:r});const a=gS();if(a)try{a.runPython('\n              import js\n              import pandas as pd\n              from pyodide.ffi import to_js\n              \n              class SQLBridge:\n                  async def query_to_pandas(self, sql):\n                      """Execute a SQL query on DuckDB and return results as a pandas DataFrame"""\n                      # Call the JavaScript async function\n                      result = await _sql_query_to_pandas(sql)\n                      return result\n                  \n                  async def pandas_to_table(self, df, table_name):\n                      """Save a pandas DataFrame to DuckDB as a table"""\n                      await _sql_pandas_to_table(df, table_name)\n                  \n                  def get_table_names(self):\n                      """Get list of available tables in DuckDB"""\n                      return _sql_get_table_names()\n                  \n                  async def get_table_schema(self, table_name):\n                      """Get schema information for a table"""\n                      result = await _sql_get_table_schema(table_name)\n                      return result\n              \n              # Create global instance\n              sql_bridge = SQLBridge()\n              \n              # Create async convenience functions\n              async def query(sql_str):\n                  """Query DuckDB and return pandas DataFrame"""\n                  return await sql_bridge.query_to_pandas(sql_str)\n              \n              async def sql(query_str):\n                  """Execute SQL query and return pandas DataFrame"""\n                  return await sql_bridge.query_to_pandas(query_str)\n            '),a.globals.set("_sql_query_to_pandas",s=>H(null,null,function*(){return yield r.queryToPandas(s)})),a.globals.set("_sql_pandas_to_table",(s,i)=>H(null,null,function*(){yield r.pandasToTable(s,i)})),a.globals.set("_sql_get_table_names",()=>r.getTableNames()),a.globals.set("_sql_get_table_schema",s=>H(null,null,function*(){return yield r.getTableSchema(s)}))}catch(s){}},queryToPandas:n=>H(null,null,function*(){const r=t();if(!r.duckDBBridge)throw new Error("DuckDB bridge not initialized");return yield r.duckDBBridge.queryToPandas(n)}),pandasToTable:(n,r)=>H(null,null,function*(){const a=t();if(!a.duckDBBridge)throw new Error("DuckDB bridge not initialized");return yield a.duckDBBridge.pandasToTable(n,r)}),clearAllCells:()=>{e(n=>({cells:n.cells.map(r=>he(q({},r),{output:[],executionCount:null,updatedAt:new Date}))}))},clearPythonNamespace:()=>H(null,null,function*(){if(t().pyodide.isInitialized)try{yield Aje(),yield t().refreshVariables()}catch(r){}}),refreshVariables:()=>H(null,null,function*(){if(t().pyodide.isInitialized)try{const r=yield vje();e({globalVariables:r})}catch(r){}}),setActiveCellId:n=>{e({activeCellId:n})},togglePackageManager:()=>{e(n=>({showPackageManager:!n.showPackageManager}))},toggleScriptHistory:()=>{e(n=>({showScriptHistory:!n.showScriptHistory}))},toggleVariableInspector:()=>{e(n=>({showVariableInspector:!n.showVariableInspector}))},toggleTemplates:()=>{e(n=>({showTemplates:!n.showTemplates}))},hasUnsavedChanges:()=>{var s;const n=t();if(!n.lastSavedState)return n.cells.length>0||((s=n.currentScript)==null?void 0:s.name)&&n.currentScript.name.trim()!=="";const r=JSON.stringify({script:n.currentScript,cells:n.cells}),a=JSON.stringify(n.lastSavedState);return r!==a},markAsUnsaved:()=>{e({saveStatus:"unsaved"})},markAsSaving:()=>{e({saveStatus:"saving"})},markAsSaved:()=>{const n=t();e({saveStatus:"saved",lastSavedState:{script:n.currentScript,cells:[...n.cells]}})},updateLastSavedState:()=>{const n=t();e({lastSavedState:{script:n.currentScript,cells:[...n.cells]}})},updateSettings:n=>{e(r=>q(q({},r),n))}}),{name:"python-store",partialize:e=>({savedScripts:e.savedScripts.slice(0,50),autoSave:e.autoSave,maxHistoryItems:e.maxHistoryItems,cellExecutionTimeout:e.cellExecutionTimeout})})),Nje=e=>{const t=v.useRef(null),[n,r]=v.useState(()=>{if(!e.leftPanel)return 0;const b=localStorage.getItem(e.leftPanel.storageKey);return b?parseInt(b,10):e.leftPanel.defaultWidth}),[a,s]=v.useState(()=>{if(!e.rightPanel)return 0;const b=localStorage.getItem(e.rightPanel.storageKey);return b?parseInt(b,10):e.rightPanel.defaultWidth}),[i,l]=v.useState(!1),[c,u]=v.useState(!1),h=v.useCallback(b=>{e.leftPanel&&requestAnimationFrame(()=>{var A,w;if(!t.current)return;const x=t.current.getBoundingClientRect(),R=Math.min(Math.max(b.clientX-x.left,((A=e.leftPanel)==null?void 0:A.minWidth)||50),((w=e.leftPanel)==null?void 0:w.maxWidth)||400);r(R)})},[e.leftPanel]),m=v.useCallback(b=>{b.preventDefault(),l(!0)},[]),p=v.useCallback(()=>{i&&e.leftPanel&&(l(!1),localStorage.setItem(e.leftPanel.storageKey,n.toString()))},[i,n,e.leftPanel]),g=v.useCallback(b=>{e.rightPanel&&requestAnimationFrame(()=>{var A,w;if(!t.current)return;const x=t.current.getBoundingClientRect(),R=Math.min(Math.max(x.right-b.clientX,((A=e.rightPanel)==null?void 0:A.minWidth)||50),((w=e.rightPanel)==null?void 0:w.maxWidth)||400);s(R)})},[e.rightPanel]),T=v.useCallback(b=>{b.preventDefault(),u(!0)},[]),y=v.useCallback(()=>{c&&e.rightPanel&&(u(!1),localStorage.setItem(e.rightPanel.storageKey,a.toString()))},[c,a,e.rightPanel]);return v.useEffect(()=>{if(i)return document.addEventListener("mousemove",h),document.addEventListener("mouseup",p),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",p),document.body.style.cursor="",document.body.style.userSelect=""}},[i,h,p]),v.useEffect(()=>{if(c)return document.addEventListener("mousemove",g),document.addEventListener("mouseup",y),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",y),document.body.style.cursor="",document.body.style.userSelect=""}},[c,g,y]),{containerRef:t,leftPanelWidth:n,isResizingLeft:i,startLeftPanelResize:m,rightPanelWidth:a,isResizingRight:c,startRightPanelResize:T}},_je=(e,t={})=>{const{enabled:n=!0,preventDefault:r=!0,capture:a=!1}=t;v.useEffect(()=>{if(!n)return;const s=i=>{const l=i.key.toLowerCase(),c=i.ctrlKey,u=i.metaKey,h=i.shiftKey,m=i.altKey;let p="";c&&(p+="ctrl+"),u&&(p+="cmd+"),h&&(p+="shift+"),m&&(p+="alt+"),p+=l;const g=e[p];if(g){r&&i.preventDefault(),g();return}if((c||u)&&l==="enter"){const T=e["ctrl+enter"]||e["cmd+enter"];if(T){r&&i.preventDefault(),T();return}}if((c||u)&&l==="s"){const T=e["ctrl+s"]||e["cmd+s"];if(T){r&&i.preventDefault(),T();return}}l==="escape"&&e.escape&&(r&&i.preventDefault(),e.escape())};return window.addEventListener("keydown",s,a),()=>window.removeEventListener("keydown",s,a)},[e,n,r,a])},wje=(e,t={})=>{const n={};e.onExecuteCell&&e.canExecuteCell&&(n["shift+enter"]=e.onExecuteCell),e.onExecute?(n["ctrl+enter"]=e.onExecute,n["cmd+enter"]=e.onExecute):e.onExecuteCell&&e.canExecuteCell&&(n["ctrl+enter"]=e.onExecuteCell,n["cmd+enter"]=e.onExecuteCell),e.onExecuteAll&&(n["ctrl+shift+enter"]=e.onExecuteAll,n["cmd+shift+enter"]=e.onExecuteAll),e.onSave&&e.canSave&&(n["ctrl+s"]=e.onSave,n["cmd+s"]=e.onSave),e.onEscape&&(n.escape=e.onEscape),_je(n,t)},Cje=({panelStates:e,panelToggles:t})=>{const n=v.useCallback(i=>{var c,u;e[i]?(c=t[i])==null||c.call(t):(Object.keys(e).forEach(h=>{var m;e[h]&&h!==i&&((m=t[h])==null||m.call(t))}),(u=t[i])==null||u.call(t))},[e,t]),r=v.useCallback(()=>{Object.keys(e).forEach(i=>{var l;e[i]&&((l=t[i])==null||l.call(t))})},[e,t]),a=Object.values(e).some(i=>i),s=Object.keys(e).find(i=>e[i])||null;return{handlePanelToggle:n,closeAllPanels:r,hasOpenPanel:a,activePanelKey:s}},lJ=(e={})=>{const{cells:t,currentScript:n,saveScript:r,loadScript:a,createNewScript:s,saveStatus:i,hasUnsavedChanges:l,markAsSaving:c,markAsSaved:u,markAsUnsaved:h}=Ia(),[m,p]=v.useState(!1),[g,T]=v.useState(!1),[y,b]=v.useState(null),x=v.useRef(null),R=k=>{var F;if(n){const U=q(q({},n),k);Ia.setState({currentScript:U}),h();const B=((F=U.name)==null?void 0:F.trim())||"",j=B!=="",G=t.length>0;(n.id&&B||!n.id&&j&&G)&&(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{c(),r(U.name,U.description)},500))}},A=()=>{var k;n?(r(n.name,n.description),(k=e.onAfterAction)==null||k.call(e)):p(!0)},w=()=>{var k,F,U;l()?(b({type:"new"}),T(!0),(k=e.closeMenus)==null||k.call(e)):(s(),(F=e.closeMenus)==null||F.call(e),(U=e.onAfterAction)==null||U.call(e))},_=k=>{var F,U,B;l()?(b({type:"switch",notebookId:k}),T(!0),(F=e.closeMenus)==null||F.call(e)):(a(k),(U=e.closeMenus)==null||U.call(e),(B=e.onAfterAction)==null||B.call(e))},N=()=>{n!=null&&n.name&&n.name.trim()?(r(n.name,n.description),setTimeout(()=>{D()},100)):p(!0)},I=()=>{D()},D=()=>{var k;(y==null?void 0:y.type)==="new"?s():(y==null?void 0:y.type)==="switch"&&y.notebookId&&a(y.notebookId),T(!1),b(null),(k=e.onAfterAction)==null||k.call(e)},M=k=>{var F;r(k),p(!1),y?setTimeout(()=>{D()},100):(F=e.onAfterAction)==null||F.call(e)},O=()=>{p(!1),b(null)},L=()=>{T(!1),b(null)};return{showSaveDialog:m,showSaveConfirm:g,hasUnsavedChanges:l(),saveStatus:i,handleSaveScript:A,handleCreateNewNotebook:w,handleNotebookSwitch:_,handleSaveAndContinue:N,handleDiscardAndContinue:I,handleSaveDialogComplete:M,handleCloseSaveDialog:O,handleCloseSaveConfirm:L,handleUpdateNotebook:R,currentScript:n}};function Ije(e,t){const n=e||"data",r=t||"data.csv",a=new Date;return[{id:"intro-"+Date.now(),type:"markdown",code:"# ".concat(r," Analysis\n\nThis notebook analyzes the ** ").concat(n," ** table loaded from ").concat(r,"."),output:[],executionCount:null,isExecuting:!1,createdAt:a,updatedAt:a},{id:"imports-"+Date.now()+1,type:"code",code:'# Import necessary libraries\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n# Data is automatically available through the sql() function\nprint("📊 Data Analysis Environment Ready!")',output:[],executionCount:null,isExecuting:!1,createdAt:a,updatedAt:a},{id:"analysis-"+Date.now()+7,type:"markdown",code:'## Further Analysis\n\nAdd your custom analysis below. You can:\n- Query the data using SQL: `await sql("SELECT ...")`\n- Use pandas for data manipulation\n- Create visualizations with matplotlib or seaborn\n- Perform statistical analysis with scipy\n- Build machine learning models with scikit-learn',output:[],executionCount:null,isExecuting:!1,createdAt:a,updatedAt:a}]}function v6(){const e=new Date;return[{id:"welcome-"+Date.now(),type:"markdown",code:"# Data Analysis Notebook\n\nWelcome to DataKit! Load a file to start analyzing your data.",output:[],executionCount:null,isExecuting:!1,createdAt:e,updatedAt:e},{id:"imports-"+Date.now()+1,type:"code",code:'# Import common libraries\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nprint("Ready to analyze data!")',output:[],executionCount:null,isExecuting:!1,createdAt:e,updatedAt:e}]}const Oje=()=>{var T;const e=ut(kr),t=ut(y=>y.updateFile),{cells:n}=Ia(),r=v.useCallback(y=>{Ia.setState({cells:y})},[]),a=v.useRef(null),s=v.useRef(!1);v.useEffect(()=>{a.current=(e==null?void 0:e.id)||null},[]);const i=v.useCallback(()=>{var y;return((y=e==null?void 0:e.notebookState)==null?void 0:y.cells)||[]},[(T=e==null?void 0:e.notebookState)==null?void 0:T.cells]),l=v.useCallback(y=>{if(!e)return;const b=e.notebookState||{cells:[],lastExecutedAt:void 0};t(e.id,{notebookState:he(q({},b),{cells:y})})},[e,t]),c=v.useCallback(()=>{const y=(e==null?void 0:e.id)||null,b=a.current!==y;return b&&(a.current=y),b},[e==null?void 0:e.id]),u=v.useCallback(()=>{var b;if(!e||(b=e.notebookState)!=null&&b.cells&&e.notebookState.cells.length>0)return;const y=e.tableName?Ije(e.tableName,e.fileName):v6();t(e.id,{notebookState:{cells:y,lastExecutedAt:void 0}}),r(y),h.current=y},[e,t,r]);v.useEffect(()=>{var y;if(c()){if(s.current=!1,(y=e==null?void 0:e.notebookState)!=null&&y.cells&&e.notebookState.cells.length>0)r(e.notebookState.cells),h.current=e.notebookState.cells;else if(e)u();else{const b=v6();r(b),h.current=b}setTimeout(()=>{s.current=!0},100)}},[e==null?void 0:e.id,c,r,u]);const h=v.useRef([]),m=v.useRef(null),p=v.useRef(0);v.useEffect(()=>{if(!s.current||!e){h.current=n;return}if(n.length===0)return;const y=n.map(R=>{var A;return{id:R.id,code:((A=R.code)==null?void 0:A.trim())||"",type:R.type}}),b=h.current.map(R=>{var A;return{id:R.id,code:((A=R.code)==null?void 0:A.trim())||"",type:R.type}});if(JSON.stringify(y)!==JSON.stringify(b)){h.current=[...n],m.current&&clearTimeout(m.current);const w=Date.now()-p.current<1e3?1e3:500;m.current=setTimeout(()=>{p.current=Date.now(),l(n)},w)}},[n,e==null?void 0:e.id,l]),v.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]);const g=v.useCallback(()=>{if(!e)return;const y=e.notebookState||{cells:[],lastExecutedAt:void 0};t(e.id,{notebookState:he(q({},y),{lastExecutedAt:Date.now()})})},[e,t]);return{fileNotebook:i(),saveNotebookToFile:l,hasFileSwitched:c,initializeFileNotebook:u,updateLastExecutedAt:g,activeFile:e}},cJ=({isOpen:e,onClose:t,onSave:n,title:r,placeholder:a,initialValue:s="",disabled:i=!1})=>{const{t:l}=Ze(),[c,u]=v.useState(s);v.useEffect(()=>{e&&u(s)},[e,s]);const h=()=>{c.trim()&&(n(c.trim()),u(""))},m=p=>{p.key==="Enter"?h():p.key==="Escape"&&t()};return e?o.jsx("div",{className:"fixed inset-0 backdrop-blur-sm bg-black/60 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-darkNav p-4 rounded-lg shadow-lg w-96",children:[o.jsx("h3",{className:"text-lg font-medium mb-4",children:r||l("common.save",{defaultValue:"Save"})}),o.jsx("input",{type:"text",className:"w-full p-2 bg-background border border-white/10 rounded mb-4 text-white placeholder:text-white/50 focus:outline-none focus:border-primary/50",placeholder:a||l("common.enterName",{defaultValue:"Enter name"}),value:c,onChange:p=>u(p.target.value),onKeyDown:m,autoFocus:!0,disabled:i}),o.jsxs("div",{className:"flex justify-end space-x-2",children:[o.jsx(je,{variant:"ghost",onClick:t,disabled:i,children:l("common.cancel",{defaultValue:"Cancel"})}),o.jsx(je,{variant:"primary",onClick:h,disabled:!c.trim()||i,children:l("common.save",{defaultValue:"Save"})})]})]})}):null},uJ=({isOpen:e,onClose:t,onSave:n,onDiscard:r,title:a,message:s,saveButtonText:i,discardButtonText:l})=>{const{t:c}=Ze();return e?o.jsx("div",{className:"fixed inset-0 backdrop-blur-sm bg-black/60 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-darkNav p-6 rounded-lg shadow-lg w-96 max-w-[90vw]",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[o.jsx("div",{className:"w-6 h-6 bg-yellow-500/20 rounded-full flex items-center justify-center",children:o.jsx("span",{className:"text-yellow-400 text-sm",children:"!"})}),o.jsx("h3",{className:"text-lg font-medium text-white",children:a||c("dialog.unsavedChanges.title",{defaultValue:"Unsaved Changes"})})]}),o.jsx("p",{className:"text-white/70 mb-6 leading-relaxed",children:s||c("dialog.unsavedChanges.message",{defaultValue:"You have unsaved changes in your current notebook. What would you like to do?"})}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx(je,{variant:"outline",className:"border-primary hover:border-primary/80 justify-center",onClick:n,children:i||c("dialog.unsavedChanges.saveAndContinue",{defaultValue:"Save and Continue"})}),o.jsx(je,{variant:"outline",className:"justify-center",onClick:r,children:l||c("dialog.unsavedChanges.discardChanges",{defaultValue:"Discard Changes"})}),o.jsx(je,{variant:"ghost",className:"justify-center",onClick:t,children:c("common.cancel",{defaultValue:"Cancel"})})]})]})}):null},Lje=({isOpen:e,onClose:t,script:n,onUpdate:r,title:a})=>{const{t:s}=Ze(),[i,l]=v.useState(""),[c,u]=v.useState("");v.useEffect(()=>{n?(l(n.name||""),u(n.description||"")):(l(""),u(""))},[n]);const h=p=>{l(p),r({name:p})},m=p=>{u(p),r({description:p})};return e?o.jsxs("div",{className:"bg-black border border-white/10 rounded shadow-xl min-w-80 p-4",children:[o.jsx("h3",{className:"text-sm font-medium text-white mb-3",children:a||s("ui.notebookEditor.title",{defaultValue:"Edit Notebook"})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-white/60 mb-1",children:s("ui.notebookEditor.nameLabel",{defaultValue:"Name"})}),o.jsx("input",{type:"text",value:i,onChange:p=>h(p.target.value),placeholder:s("ui.notebookEditor.namePlaceholder",{defaultValue:"Untitled Notebook"}),className:"w-full px-3 py-2 bg-background border border-white/10 rounded text-sm text-white placeholder:text-white/50 focus:outline-none focus:border-primary/50",autoFocus:!0})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs text-white/60 mb-1",children:s("ui.notebookEditor.descriptionLabel",{defaultValue:"Description"})}),o.jsx("textarea",{value:c,onChange:p=>m(p.target.value),placeholder:s("ui.notebookEditor.descriptionPlaceholder",{defaultValue:"Optional description..."}),rows:3,className:"w-full px-3 py-2 bg-background border border-white/10 rounded text-sm text-white placeholder:text-white/50 focus:outline-none focus:border-primary/50 resize-none"})]}),o.jsx("div",{className:"pt-2 border-t border-white/10",children:o.jsx("p",{className:"text-xs text-white/50 text-center",children:s("ui.notebookEditor.autoSaveMessage",{defaultValue:"Changes are saved automatically"})})})]})]}):null},Mje=(n,...r)=>H(null,[n,...r],function*(e,t={}){const{filename:a="DataKit_Export",title:s="DataKit Export",includeTimestamp:i=!0}=t;try{const l=(yield fn(()=>H(null,null,function*(){const{default:w}=yield import("./jspdf.es.min-Dnb8MB36.js").then(_=>_.j);return{default:w}}),[])).default,c=(yield fn(()=>H(null,null,function*(){const{default:w}=yield import("./html2canvas.esm-Bc6Ti1ol.js");return{default:w}}),[])).default,u=document.createElement("div");u.style.position="absolute",u.style.left="-9999px",u.style.width="794px",u.style.backgroundColor="#ffffff",u.style.color="#000000",u.style.fontFamily="Arial, sans-serif",u.style.padding="40px",u.style.lineHeight="1.4";const h=document.createElement("h1");if(h.textContent=s,h.style.fontSize="24px",h.style.marginBottom="20px",h.style.color="#000000",h.style.fontWeight="bold",h.style.textAlign="center",h.style.borderBottom="2px solid #000000",h.style.paddingBottom="10px",u.appendChild(h),i){const w=document.createElement("div");w.textContent="Generated on: ".concat(new Date().toLocaleDateString()," with DataKit"),w.style.fontSize="12px",w.style.color="#666666",w.style.textAlign="center",w.style.marginBottom="30px",u.appendChild(w)}const m=document.createElement("div");m.innerHTML=e,u.appendChild(m),document.body.appendChild(u);const p=yield c(u,{backgroundColor:"#ffffff",scale:2,useCORS:!0,allowTaint:!0,width:794,height:u.scrollHeight});document.body.removeChild(u);const g=new l("p","mm","a4"),T=p.toDataURL("image/png"),y=210,b=297,x=p.height*y/p.width;let R=x,A=0;for(g.addImage(T,"PNG",0,A,y,x),R-=b;R>=0;)A=R-x,g.addPage(),g.addImage(T,"PNG",0,A,y,x),R-=b;g.save("".concat(a,".pdf"))}catch(l){throw new Error("PDF generation failed. Please try again.")}}),Dje=(e,t="DataKit_Export",n="json")=>{try{const r=n==="ipynb"?"application/x-ipynb+json":"application/json",a=new Blob([JSON.stringify(e,null,2)],{type:r}),s=URL.createObjectURL(a),i=document.createElement("a");i.href=s,i.download="".concat(t,".").concat(n),document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)}catch(r){throw new Error("JSON download failed. Please try again.")}},Wm={cellContainer:"margin-bottom: 25px; border: 1px solid #cccccc; border-radius: 6px; overflow: hidden; page-break-inside: avoid;",cellHeader:"padding: 8px 12px; background-color: #f5f5f5; border-bottom: 1px solid #cccccc; font-size: 12px; color: #666666; font-weight: bold;",cellContent:"padding: 12px; background-color: #ffffff;",codeBlock:"background-color: #f8f8f8; padding: 10px; border-radius: 4px; font-size: 11px; font-family: Consolas, Monaco, monospace; color: #000000; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid #e0e0e0;",outputBlock:"margin-top: 5px; padding: 8px; background-color: #fafafa; border-radius: 4px; border: 1px solid #e0e0e0;"},Pje=(e,t="DataKit_Notebook")=>{try{const r={cells:e.map(a=>{const s={cell_type:a.type==="markdown"?"markdown":"code",source:a.code.split("\n").map((i,l,c)=>l===c.length-1?i:i+"\n"),metadata:{}};if(a.type==="code"){const i=l=>{switch(l.type){case"error":return{output_type:"error",ename:"Error",evalue:l.content,traceback:[l.content]};case"text":return{output_type:"stream",name:"stdout",text:Array.isArray(l.content)?l.content:[l.content]};case"image":return{output_type:"display_data",data:{"image/png":l.content.includes(",")?l.content.split(",")[1]:l.content},metadata:{}};case"html":return{output_type:"display_data",data:{"text/html":Array.isArray(l.content)?l.content:[l.content]},metadata:{}};case"dataframe":return{output_type:"execute_result",data:{"text/plain":Array.isArray(l.content)?l.content:[l.content]},metadata:{},execution_count:a.executionCount};default:return{output_type:"display_data",data:{"text/plain":Array.isArray(l.content)?l.content:[l.content]},metadata:{}}}};return he(q({},s),{execution_count:a.executionCount,outputs:a.output.map(i)})}return s}),metadata:{kernelspec:{display_name:"Python 3 (Pyodide)",language:"python",name:"python3"},language_info:{name:"python",version:"3.11.3",mimetype:"text/x-python",codemirror_mode:{name:"ipython",version:3},pygments_lexer:"ipython3",nbconvert_exporter:"python",file_extension:".py"}},nbformat:4,nbformat_minor:4};Dje(r,t,"ipynb")}catch(n){throw new Error("Jupyter notebook export failed. Please try again.")}},kje=e=>e.replace(/^# (.*$)/gim,'<h1 style="font-size: 18px; font-weight: bold; margin: 10px 0; color: #000;">$1</h1>').replace(/^## (.*$)/gim,'<h2 style="font-size: 16px; font-weight: bold; margin: 8px 0; color: #000;">$1</h2>').replace(/^### (.*$)/gim,'<h3 style="font-size: 14px; font-weight: bold; margin: 6px 0; color: #000;">$1</h3>').replace(/\*\*(.*?)\*\*/g,'<strong style="font-weight: bold;">$1</strong>').replace(/\*(.*?)\*/g,'<em style="font-style: italic;">$1</em>').replace(/`(.*?)`/g,'<code style="background-color: #f0f0f0; padding: 2px 4px; border-radius: 3px; font-family: monospace;">$1</code>').replace(/^- (.*$)/gim,'<li style="margin: 4px 0;">$1</li>').replace(/(\n|^)([^<\n].*?)(\n|$)/g,'<p style="margin: 8px 0; line-height: 1.4;">$2</p>').replace(/(<li.*?<\/li>)+/g,'<ul style="margin: 8px 0; padding-left: 20px;">$&</ul>'),jje=e=>e.map((n,r)=>{let a='\n      <div style="'.concat(Wm.cellContainer,'">\n        <div style="').concat(Wm.cellHeader,'">\n          ').concat(n.type==="code"?"Code":"Markdown"," Cell [").concat(r+1,']\n        </div>\n        <div style="').concat(Wm.cellContent,'">\n    ');return n.type==="markdown"?a+=kje(n.code):(a+='\n        <pre style="'.concat(Wm.codeBlock,'">').concat(n.code,"</pre>\n      "),n.output.length>0&&(a+='\n          <div style="font-weight: bold; margin-top: 10px; margin-bottom: 5px; font-size: 12px;">\n            Output:\n          </div>\n          <div style="'.concat(Wm.outputBlock,'">\n        '),n.output.forEach(s=>{s.type==="error"?a+='\n              <div style="color: #d32f2f; font-weight: bold; margin-bottom: 5px; font-size: 11px; font-family: Consolas, Monaco, monospace;">\n                '.concat(s.content,"\n              </div>\n            "):s.type==="image"?a+='\n              <img src="'.concat(s.content,'" style="max-width: 100%; height: auto; border: 1px solid #ccc; border-radius: 4px;" />\n            '):a+='\n              <div style="color: #333333; white-space: pre-wrap; margin-bottom: 5px; font-size: 11px; font-family: Consolas, Monaco, monospace;">\n                '.concat(s.content,"\n              </div>\n            ")}),a+="</div>")),a+="\n        </div>\n      </div>\n    ",a}).join(""),Uje=(e,t="DataKit_Notebook")=>H(null,null,function*(){try{const n=jje(e);yield Mje(n,{filename:t,title:t,includeTimestamp:!0})}catch(n){throw new Error("PDF export failed. Please try again.")}});function Fje(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $je=new RegExp("^[$_\\p{ID_Start}][$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$","u"),Bje=new RegExp("^[$_\\p{ID_Start}][-$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$","u"),Hje={};function A6(e,t){return(Hje.jsx?Bje:$je).test(e)}const Vje=/[ \t\n\f\r]/g;function Gje(e){return typeof e=="object"?e.type==="text"?R6(e.value):!1:R6(e)}function R6(e){return e.replace(Vje,"")===""}class zg{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}zg.prototype.normal={};zg.prototype.property={};zg.prototype.space=void 0;function dJ(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new zg(n,r,t)}function l1(e){return e.toLowerCase()}let is=class{constructor(t,n){this.attribute=n,this.property=t}};is.prototype.attribute="";is.prototype.booleanish=!1;is.prototype.boolean=!1;is.prototype.commaOrSpaceSeparated=!1;is.prototype.commaSeparated=!1;is.prototype.defined=!1;is.prototype.mustUseProperty=!1;is.prototype.number=!1;is.prototype.overloadedBoolean=!1;is.prototype.property="";is.prototype.spaceSeparated=!1;is.prototype.space=void 0;let zje=0;const Zt=Vu(),Mr=Vu(),c1=Vu(),Ye=Vu(),Zn=Vu(),yh=Vu(),ps=Vu();function Vu(){return cm(2,++zje)}const u1=Object.freeze(Object.defineProperty({__proto__:null,boolean:Zt,booleanish:Mr,commaOrSpaceSeparated:ps,commaSeparated:yh,number:Ye,overloadedBoolean:c1,spaceSeparated:Zn},Symbol.toStringTag,{value:"Module"})),IC=Object.keys(u1);class kD extends is{constructor(t,n,r,a){let s=-1;if(super(t,n),N6(this,"space",a),typeof r=="number")for(;++s<IC.length;){const i=IC[s];N6(this,IC[s],(r&u1[i])===u1[i])}}}kD.prototype.defined=!0;function N6(e,t,n){n&&(e[t]=n)}function df(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const s=new kD(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[l1(r)]=r,n[l1(s.attribute)]=r}return new zg(t,n,e.space)}const hJ=df({properties:{ariaActiveDescendant:null,ariaAtomic:Mr,ariaAutoComplete:null,ariaBusy:Mr,ariaChecked:Mr,ariaColCount:Ye,ariaColIndex:Ye,ariaColSpan:Ye,ariaControls:Zn,ariaCurrent:null,ariaDescribedBy:Zn,ariaDetails:null,ariaDisabled:Mr,ariaDropEffect:Zn,ariaErrorMessage:null,ariaExpanded:Mr,ariaFlowTo:Zn,ariaGrabbed:Mr,ariaHasPopup:null,ariaHidden:Mr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Zn,ariaLevel:Ye,ariaLive:null,ariaModal:Mr,ariaMultiLine:Mr,ariaMultiSelectable:Mr,ariaOrientation:null,ariaOwns:Zn,ariaPlaceholder:null,ariaPosInSet:Ye,ariaPressed:Mr,ariaReadOnly:Mr,ariaRelevant:null,ariaRequired:Mr,ariaRoleDescription:Zn,ariaRowCount:Ye,ariaRowIndex:Ye,ariaRowSpan:Ye,ariaSelected:Mr,ariaSetSize:Ye,ariaSort:null,ariaValueMax:Ye,ariaValueMin:Ye,ariaValueNow:Ye,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function fJ(e,t){return t in e?e[t]:t}function mJ(e,t){return fJ(e,t.toLowerCase())}const qje=df({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:yh,acceptCharset:Zn,accessKey:Zn,action:null,allow:null,allowFullScreen:Zt,allowPaymentRequest:Zt,allowUserMedia:Zt,alt:null,as:null,async:Zt,autoCapitalize:null,autoComplete:Zn,autoFocus:Zt,autoPlay:Zt,blocking:Zn,capture:null,charSet:null,checked:Zt,cite:null,className:Zn,cols:Ye,colSpan:null,content:null,contentEditable:Mr,controls:Zt,controlsList:Zn,coords:Ye|yh,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Zt,defer:Zt,dir:null,dirName:null,disabled:Zt,download:c1,draggable:Mr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Zt,formTarget:null,headers:Zn,height:Ye,hidden:c1,high:Ye,href:null,hrefLang:null,htmlFor:Zn,httpEquiv:Zn,id:null,imageSizes:null,imageSrcSet:null,inert:Zt,inputMode:null,integrity:null,is:null,isMap:Zt,itemId:null,itemProp:Zn,itemRef:Zn,itemScope:Zt,itemType:Zn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Zt,low:Ye,manifest:null,max:null,maxLength:Ye,media:null,method:null,min:null,minLength:Ye,multiple:Zt,muted:Zt,name:null,nonce:null,noModule:Zt,noValidate:Zt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Zt,optimum:Ye,pattern:null,ping:Zn,placeholder:null,playsInline:Zt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Zt,referrerPolicy:null,rel:Zn,required:Zt,reversed:Zt,rows:Ye,rowSpan:Ye,sandbox:Zn,scope:null,scoped:Zt,seamless:Zt,selected:Zt,shadowRootClonable:Zt,shadowRootDelegatesFocus:Zt,shadowRootMode:null,shape:null,size:Ye,sizes:null,slot:null,span:Ye,spellCheck:Mr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ye,step:null,style:null,tabIndex:Ye,target:null,title:null,translate:null,type:null,typeMustMatch:Zt,useMap:null,value:Mr,width:Ye,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Zn,axis:null,background:null,bgColor:null,border:Ye,borderColor:null,bottomMargin:Ye,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Zt,declare:Zt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ye,leftMargin:Ye,link:null,longDesc:null,lowSrc:null,marginHeight:Ye,marginWidth:Ye,noResize:Zt,noHref:Zt,noShade:Zt,noWrap:Zt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ye,rules:null,scheme:null,scrolling:Mr,standby:null,summary:null,text:null,topMargin:Ye,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ye,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Zt,disableRemotePlayback:Zt,prefix:null,property:null,results:Ye,security:null,unselectable:null},space:"html",transform:mJ}),Yje=df({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ps,accentHeight:Ye,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ye,amplitude:Ye,arabicForm:null,ascent:Ye,attributeName:null,attributeType:null,azimuth:Ye,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ye,by:null,calcMode:null,capHeight:Ye,className:Zn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ye,diffuseConstant:Ye,direction:null,display:null,dur:null,divisor:Ye,dominantBaseline:null,download:Zt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ye,enableBackground:null,end:null,event:null,exponent:Ye,externalResourcesRequired:null,fill:null,fillOpacity:Ye,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:yh,g2:yh,glyphName:yh,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ye,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ye,horizOriginX:Ye,horizOriginY:Ye,id:null,ideographic:Ye,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ye,k:Ye,k1:Ye,k2:Ye,k3:Ye,k4:Ye,kernelMatrix:ps,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ye,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ye,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ye,overlineThickness:Ye,paintOrder:null,panose1:null,path:null,pathLength:Ye,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Zn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ye,pointsAtY:Ye,pointsAtZ:Ye,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ps,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ps,rev:ps,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ps,requiredFeatures:ps,requiredFonts:ps,requiredFormats:ps,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ye,specularExponent:Ye,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ye,strikethroughThickness:Ye,string:null,stroke:null,strokeDashArray:ps,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ye,strokeOpacity:Ye,strokeWidth:null,style:null,surfaceScale:Ye,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ps,tabIndex:Ye,tableValues:null,target:null,targetX:Ye,targetY:Ye,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ps,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ye,underlineThickness:Ye,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ye,values:null,vAlphabetic:Ye,vMathematical:Ye,vectorEffect:null,vHanging:Ye,vIdeographic:Ye,version:null,vertAdvY:Ye,vertOriginX:Ye,vertOriginY:Ye,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ye,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:fJ}),pJ=df({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),gJ=df({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:mJ}),EJ=df({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Wje={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Xje=/[A-Z]/g,_6=/-[a-z]/g,Kje=/^data[-\w.:]+$/i;function Qje(e,t){const n=l1(t);let r=t,a=is;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Kje.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(_6,Zje);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!_6.test(s)){let i=s.replace(Xje,Jje);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}a=kD}return new a(r,t)}function Jje(e){return"-"+e.toLowerCase()}function Zje(e){return e.charAt(1).toUpperCase()}const eUe=dJ([hJ,qje,pJ,gJ,EJ],"html"),jD=dJ([hJ,Yje,pJ,gJ,EJ],"svg");function tUe(e){return e.join(" ").trim()}var kd={},OC,w6;function nUe(){if(w6)return OC;w6=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,l=/^\s+|\s+$/g,c="\n",u="/",h="*",m="",p="comment",g="declaration";OC=function(y,b){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];b=b||{};var x=1,R=1;function A(F){var U=F.match(t);U&&(x+=U.length);var B=F.lastIndexOf(c);R=~B?F.length-B:R+F.length}function w(){var F={line:x,column:R};return function(U){return U.position=new _(F),D(),U}}function _(F){this.start=F,this.end={line:x,column:R},this.source=b.source}_.prototype.content=y;function N(F){var U=new Error(b.source+":"+x+":"+R+": "+F);if(U.reason=F,U.filename=b.source,U.line=x,U.column=R,U.source=y,!b.silent)throw U}function I(F){var U=F.exec(y);if(U){var B=U[0];return A(B),y=y.slice(B.length),U}}function D(){I(n)}function M(F){var U;for(F=F||[];U=O();)U!==!1&&F.push(U);return F}function O(){var F=w();if(!(u!=y.charAt(0)||h!=y.charAt(1))){for(var U=2;m!=y.charAt(U)&&(h!=y.charAt(U)||u!=y.charAt(U+1));)++U;if(U+=2,m===y.charAt(U-1))return N("End of comment missing");var B=y.slice(2,U-2);return R+=2,A(B),y=y.slice(U),R+=2,F({type:p,comment:B})}}function L(){var F=w(),U=I(r);if(U){if(O(),!I(a))return N("property missing ':'");var B=I(s),j=F({type:g,property:T(U[0].replace(e,m)),value:B?T(B[0].replace(e,m)):m});return I(i),j}}function k(){var F=[];M(F);for(var U;U=L();)U!==!1&&(F.push(U),M(F));return F}return D(),k()};function T(y){return y?y.replace(l,m):m}return OC}var C6;function rUe(){if(C6)return kd;C6=1;var e=kd&&kd.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(kd,"__esModule",{value:!0}),kd.default=n;var t=e(nUe());function n(r,a){var s=null;if(!r||typeof r!="string")return s;var i=(0,t.default)(r),l=typeof a=="function";return i.forEach(function(c){if(c.type==="declaration"){var u=c.property,h=c.value;l?a(u,h,c):h&&(s=s||{},s[u]=h)}}),s}return kd}var Xm={},I6;function aUe(){if(I6)return Xm;I6=1,Object.defineProperty(Xm,"__esModule",{value:!0}),Xm.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},i=function(u,h){return h.toUpperCase()},l=function(u,h){return"".concat(h,"-")},c=function(u,h){return h===void 0&&(h={}),s(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(a,l):u=u.replace(r,l),u.replace(t,i))};return Xm.camelCase=c,Xm}var Km,O6;function sUe(){if(O6)return Km;O6=1;var e=Km&&Km.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(rUe()),n=aUe();function r(a,s){var i={};return!a||typeof a!="string"||(0,t.default)(a,function(l,c){l&&c&&(i[(0,n.camelCase)(l,s)]=c)}),i}return r.default=r,Km=r,Km}var iUe=sUe();const oUe=ir(iUe),TJ=yJ("end"),UD=yJ("start");function yJ(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function lUe(e){const t=UD(e),n=TJ(e);if(t&&n)return{start:t,end:n}}function Up(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?L6(e.position):"start"in e||"end"in e?L6(e):"line"in e||"column"in e?d1(e):""}function d1(e){return M6(e&&e.line)+":"+M6(e&&e.column)}function L6(e){return d1(e&&e.start)+"-"+d1(e&&e.end)}function M6(e){return e&&typeof e=="number"?e:1}class ka extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s=q({},n)),typeof t=="string"?a=t:!s.cause&&t&&(i=!0,a=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=l?l.line:void 0,this.name=Up(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ka.prototype.file="";ka.prototype.name="";ka.prototype.reason="";ka.prototype.message="";ka.prototype.stack="";ka.prototype.column=void 0;ka.prototype.line=void 0;ka.prototype.ancestors=void 0;ka.prototype.cause=void 0;ka.prototype.fatal=void 0;ka.prototype.place=void 0;ka.prototype.ruleId=void 0;ka.prototype.source=void 0;const FD={}.hasOwnProperty,cUe=new Map,uUe=/[A-Z]/g,dUe=new Set(["table","tbody","thead","tfoot","tr"]),hUe=new Set(["td","th"]),xJ="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function fUe(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=SUe(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=xUe(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?jD:eUe,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=SJ(a,e,void 0);return s&&typeof s!="string"?s:a.create(e,a.Fragment,{children:s||void 0},void 0)}function SJ(e,t,n){if(t.type==="element")return mUe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return pUe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return EUe(e,t,n);if(t.type==="mdxjsEsm")return gUe(e,t);if(t.type==="root")return TUe(e,t,n);if(t.type==="text")return yUe(e,t)}function mUe(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=jD,e.schema=a),e.ancestors.push(t);const s=vJ(e,t.tagName,!1),i=bUe(e,t);let l=BD(e,t);return dUe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Gje(c):!0})),bJ(e,i,s,t),$D(i,l),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function pUe(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Rg(e,t.position)}function gUe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Rg(e,t.position)}function EUe(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=jD,e.schema=a),e.ancestors.push(t);const s=t.name===null?e.Fragment:vJ(e,t.name,!0),i=vUe(e,t),l=BD(e,t);return bJ(e,i,s,t),$D(i,l),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function TUe(e,t,n){const r={};return $D(r,BD(e,t)),e.create(t,e.Fragment,r,n)}function yUe(e,t){return t.value}function bJ(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function $D(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function xUe(e,t,n){return r;function r(a,s,i,l){const u=Array.isArray(i.children)?n:t;return l?u(s,i,l):u(s,i)}}function SUe(e,t){return n;function n(r,a,s,i){const l=Array.isArray(s.children),c=UD(r);return t(a,s,i,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function bUe(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&FD.call(t.properties,a)){const s=AUe(e,a,t.properties[a]);if(s){const[i,l]=s;e.tableCellAlignToStyle&&i==="align"&&typeof l=="string"&&hUe.has(t.tagName)?r=l:n[i]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function vUe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const l=i.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Rg(e,t.position);else{const a=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Rg(e,t.position);else s=r.value===null?!0:r.value;n[a]=s}return n}function BD(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:cUe;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=a.get(c)||0;i=c+"-"+u,a.set(c,u+1)}}const l=SJ(e,s,i);l!==void 0&&n.push(l)}return n}function AUe(e,t,n){const r=Qje(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Fje(n):tUe(n)),r.property==="style"){let a=typeof n=="object"?n:RUe(e,String(n));return e.stylePropertyNameCase==="css"&&(a=NUe(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?Wje[r.property]||r.property:r.attribute,n]}}function RUe(e,t){try{return oUe(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new ka("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=xJ+"#cannot-parse-style-attribute",a}}function vJ(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let s=-1,i;for(;++s<a.length;){const l=A6(a[s])?{type:"Identifier",name:a[s]}:{type:"Literal",value:a[s]};i=i?{type:"MemberExpression",object:i,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}r=i}else r=A6(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return FD.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Rg(e)}function Rg(e,t){const n=new ka("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=xJ+"#cannot-handle-mdx-estrees-without-createevaluater",n}function NUe(e){const t={};let n;for(n in e)FD.call(e,n)&&(t[_Ue(n)]=e[n]);return t}function _Ue(e){let t=e.replace(uUe,wUe);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function wUe(e){return"-"+e.toLowerCase()}const LC={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},CUe={};function HD(e,t){const n=CUe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return AJ(e,r,a)}function AJ(e,t,n){if(IUe(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return D6(e.children,t,n)}return Array.isArray(e)?D6(e,t,n):""}function D6(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=AJ(e[a],t,n);return r.join("")}function IUe(e){return!!(e&&typeof e=="object")}const P6=document.createElement("i");function VD(e){const t="&"+e+";";P6.innerHTML=t;const n=P6.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function bs(e,t,n,r){const a=e.length;let s=0,i;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function Us(e,t){return e.length>0?(bs(e,e.length,0,t),e):t}const k6={}.hasOwnProperty;function RJ(e){const t={};let n=-1;for(;++n<e.length;)OUe(t,e[n]);return t}function OUe(e,t){let n;for(n in t){const a=(k6.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){k6.call(a,i)||(a[i]=[]);const l=s[i];LUe(a[i],Array.isArray(l)?l:l?[l]:[])}}}function LUe(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);bs(e,0,0,r)}function NJ(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function pi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ha=rc(/[A-Za-z]/),Oa=rc(/[\dA-Za-z]/),MUe=rc(/[#-'*+\--9=?A-Z^-~]/);function y0(e){return e!==null&&(e<32||e===127)}const h1=rc(/\d/),DUe=rc(/[\dA-Fa-f]/),PUe=rc(/[!-/:-@[-`{-~]/);function It(e){return e!==null&&e<-2}function Kn(e){return e!==null&&(e<0||e===32)}function cn(e){return e===-2||e===-1||e===32}const ES=rc(new RegExp("\\p{P}|\\p{S}","u")),wu=rc(/\s/);function rc(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hf(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&Oa(e.charCodeAt(n+1))&&Oa(e.charCodeAt(n+2)))a=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(i=String.fromCharCode(s,l),a=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+a+1,i=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function mn(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(c){return cn(c)?(e.enter(n),l(c)):t(c)}function l(c){return cn(c)&&s++<a?(e.consume(c),l):(e.exit(n),t(c))}}const kUe={tokenize:jUe};function jUe(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),mn(e,t,"linePrefix")}function a(l){return e.enter("paragraph"),s(l)}function s(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,i(l)}function i(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return It(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),i)}}const UUe={tokenize:FUe},j6={tokenize:$Ue};function FUe(e){const t=this,n=[];let r=0,a,s,i;return l;function l(A){if(r<n.length){const w=n[r];return t.containerState=w[1],e.attempt(w[0].continuation,c,u)(A)}return u(A)}function c(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&R();const w=t.events.length;let _=w,N;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){N=t.events[_][1].end;break}x(r);let I=w;for(;I<t.events.length;)t.events[I][1].end=q({},N),I++;return bs(t.events,_+1,0,t.events.slice(w)),t.events.length=I,u(A)}return l(A)}function u(A){if(r===n.length){if(!a)return p(A);if(a.currentConstruct&&a.currentConstruct.concrete)return T(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(j6,h,m)(A)}function h(A){return a&&R(),x(r),p(A)}function m(A){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,T(A)}function p(A){return t.containerState={},e.attempt(j6,g,T)(A)}function g(A){return r++,n.push([t.currentConstruct,t.containerState]),p(A)}function T(A){if(A===null){a&&R(),x(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:s}),y(A)}function y(A){if(A===null){b(e.exit("chunkFlow"),!0),x(0),e.consume(A);return}return It(A)?(e.consume(A),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(A),y)}function b(A,w){const _=t.sliceStream(A);if(w&&_.push(null),A.previous=s,s&&(s.next=A),s=A,a.defineSkip(A.start),a.write(_),t.parser.lazy[A.start.line]){let N=a.events.length;for(;N--;)if(a.events[N][1].start.offset<i&&(!a.events[N][1].end||a.events[N][1].end.offset>i))return;const I=t.events.length;let D=I,M,O;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(M){O=t.events[D][1].end;break}M=!0}for(x(r),N=I;N<t.events.length;)t.events[N][1].end=q({},O),N++;bs(t.events,D+1,0,t.events.slice(I)),t.events.length=N}}function x(A){let w=n.length;for(;w-- >A;){const _=n[w];t.containerState=_[1],_[0].exit.call(t,e)}n.length=A}function R(){a.write([null]),s=void 0,a=void 0,t.containerState._closeFlow=void 0}}function $Ue(e,t,n){return mn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Vh(e){if(e===null||Kn(e)||wu(e))return 1;if(ES(e))return 2}function TS(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const s=e[a].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const f1={name:"attention",resolveAll:BUe,tokenize:HUe};function BUe(e,t){let n=-1,r,a,s,i,l,c,u,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m=q({},e[r][1].end),p=q({},e[n][1].start);U6(m,-c),U6(p,c),i={type:c>1?"strongSequence":"emphasisSequence",start:m,end:q({},e[r][1].end)},l={type:c>1?"strongSequence":"emphasisSequence",start:q({},e[n][1].start),end:p},s={type:c>1?"strongText":"emphasisText",start:q({},e[r][1].end),end:q({},e[n][1].start)},a={type:c>1?"strong":"emphasis",start:q({},i.start),end:q({},l.end)},e[r][1].end=q({},i.start),e[n][1].start=q({},l.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Us(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Us(u,[["enter",a,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=Us(u,TS(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Us(u,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,u=Us(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,bs(e,r-1,n-r+3,u),n=r+u.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HUe(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Vh(r);let s;return i;function i(c){return s=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===s)return e.consume(c),l;const u=e.exit("attentionSequence"),h=Vh(c),m=!h||h===2&&a||n.includes(c),p=!a||a===2&&h||n.includes(r);return u._open=!!(s===42?m:m&&(a||!p)),u._close=!!(s===42?p:p&&(h||!m)),t(c)}}function U6(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const VUe={name:"autolink",tokenize:GUe};function GUe(e,t,n){let r=0;return a;function a(g){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(g){return Ha(g)?(e.consume(g),i):g===64?n(g):u(g)}function i(g){return g===43||g===45||g===46||Oa(g)?(r=1,l(g)):u(g)}function l(g){return g===58?(e.consume(g),r=0,c):(g===43||g===45||g===46||Oa(g))&&r++<32?(e.consume(g),l):(r=0,u(g))}function c(g){return g===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):g===null||g===32||g===60||y0(g)?n(g):(e.consume(g),c)}function u(g){return g===64?(e.consume(g),h):MUe(g)?(e.consume(g),u):n(g)}function h(g){return Oa(g)?m(g):n(g)}function m(g){return g===46?(e.consume(g),r=0,h):g===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):p(g)}function p(g){if((g===45||Oa(g))&&r++<63){const T=g===45?p:m;return e.consume(g),T}return n(g)}}const qg={partial:!0,tokenize:zUe};function zUe(e,t,n){return r;function r(s){return cn(s)?mn(e,a,"linePrefix")(s):a(s)}function a(s){return s===null||It(s)?t(s):n(s)}}const _J={continuation:{tokenize:YUe},exit:WUe,name:"blockQuote",tokenize:qUe};function qUe(e,t,n){const r=this;return a;function a(i){if(i===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return cn(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function YUe(e,t,n){const r=this;return a;function a(i){return cn(i)?mn(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(_J,t,n)(i)}}function WUe(e){e.exit("blockQuote")}const wJ={name:"characterEscape",tokenize:XUe};function XUe(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),a}function a(s){return PUe(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const CJ={name:"characterReference",tokenize:KUe};function KUe(e,t,n){const r=this;let a=0,s,i;return l;function l(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),c}function c(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,i=Oa,h(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=DUe,h):(e.enter("characterReferenceValue"),s=7,i=h1,h(m))}function h(m){if(m===59&&a){const p=e.exit("characterReferenceValue");return i===Oa&&!VD(r.sliceSerialize(p))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(m)&&a++<s?(e.consume(m),h):n(m)}}const F6={partial:!0,tokenize:JUe},$6={concrete:!0,name:"codeFenced",tokenize:QUe};function QUe(e,t,n){const r=this,a={partial:!0,tokenize:_};let s=0,i=0,l;return c;function c(N){return u(N)}function u(N){const I=r.events[r.events.length-1];return s=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,l=N,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(N)}function h(N){return N===l?(i++,e.consume(N),h):i<3?n(N):(e.exit("codeFencedFenceSequence"),cn(N)?mn(e,m,"whitespace")(N):m(N))}function m(N){return N===null||It(N)?(e.exit("codeFencedFence"),r.interrupt?t(N):e.check(F6,y,w)(N)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(N))}function p(N){return N===null||It(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(N)):cn(N)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mn(e,g,"whitespace")(N)):N===96&&N===l?n(N):(e.consume(N),p)}function g(N){return N===null||It(N)?m(N):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),T(N))}function T(N){return N===null||It(N)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(N)):N===96&&N===l?n(N):(e.consume(N),T)}function y(N){return e.attempt(a,w,b)(N)}function b(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),x}function x(N){return s>0&&cn(N)?mn(e,R,"linePrefix",s+1)(N):R(N)}function R(N){return N===null||It(N)?e.check(F6,y,w)(N):(e.enter("codeFlowValue"),A(N))}function A(N){return N===null||It(N)?(e.exit("codeFlowValue"),R(N)):(e.consume(N),A)}function w(N){return e.exit("codeFenced"),t(N)}function _(N,I,D){let M=0;return O;function O(B){return N.enter("lineEnding"),N.consume(B),N.exit("lineEnding"),L}function L(B){return N.enter("codeFencedFence"),cn(B)?mn(N,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):k(B)}function k(B){return B===l?(N.enter("codeFencedFenceSequence"),F(B)):D(B)}function F(B){return B===l?(M++,N.consume(B),F):M>=i?(N.exit("codeFencedFenceSequence"),cn(B)?mn(N,U,"whitespace")(B):U(B)):D(B)}function U(B){return B===null||It(B)?(N.exit("codeFencedFence"),I(B)):D(B)}}}function JUe(e,t,n){const r=this;return a;function a(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const MC={name:"codeIndented",tokenize:eFe},ZUe={partial:!0,tokenize:tFe};function eFe(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),mn(e,s,"linePrefix",5)(u)}function s(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):It(u)?e.attempt(ZUe,i,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||It(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function tFe(e,t,n){const r=this;return a;function a(i){return r.parser.lazy[r.now().line]?n(i):It(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),a):mn(e,s,"linePrefix",5)(i)}function s(i){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):It(i)?a(i):n(i)}}const nFe={name:"codeText",previous:aFe,resolve:rFe,tokenize:sFe};function rFe(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function aFe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sFe(e,t,n){let r=0,a,s;return i;function i(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),r++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(s=e.enter("codeTextSequence"),a=0,h(m)):It(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||It(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),u)}function h(m){return m===96?(e.consume(m),a++,h):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(s.type="codeTextData",u(m))}}class iFe{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n==null?Number.POSITIVE_INFINITY:n;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Qm(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Qm(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qm(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Qm(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qm(this.left,n.reverse())}}}function Qm(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function IJ(e){const t={};let n=-1,r,a,s,i,l,c,u;const h=new iFe(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,oFe(h,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,a=void 0;s--;)if(i=h.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(a&&(h.get(a)[1].type="lineEndingBlank"),i[1].type="lineEnding",a=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;a&&(r[1].end=q({},h.get(a)[1].start),l=h.slice(a,n),l.unshift(r),h.splice(a,n-a+1,l))}}return bs(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function oFe(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const l=i.events,c=[],u={};let h,m,p=-1,g=n,T=0,y=0;const b=[y];for(;g;){for(;e.get(++a)[1]!==g;);s.push(a),g._tokenizer||(h=r.sliceStream(g),g.next||h.push(null),m&&i.defineSkip(g.start),g._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(h),g._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),m=g,g=g.next}for(g=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(y=p+1,b.push(y),g._tokenizer=void 0,g.previous=void 0,g=g.next);for(i.events=[],g?(g._tokenizer=void 0,g.previous=void 0):b.pop(),p=b.length;p--;){const x=l.slice(b[p],b[p+1]),R=s.pop();c.push([R,R+x.length-1]),e.splice(R,2,x)}for(c.reverse(),p=-1;++p<c.length;)u[T+c[p][0]]=T+c[p][1],T+=c[p][1]-c[p][0]-1;return u}const lFe={resolve:uFe,tokenize:dFe},cFe={partial:!0,tokenize:hFe};function uFe(e){return IJ(e),e}function dFe(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(l)}function a(l){return l===null?s(l):It(l)?e.check(cFe,i,s)(l):(e.consume(l),a)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function i(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function hFe(e,t,n){const r=this;return a;function a(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),mn(e,s,"linePrefix")}function s(i){if(i===null||It(i))return n(i);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function OJ(e,t,n,r,a,s,i,l,c){const u=c||Number.POSITIVE_INFINITY;let h=0;return m;function m(x){return x===60?(e.enter(r),e.enter(a),e.enter(s),e.consume(x),e.exit(s),p):x===null||x===32||x===41||y0(x)?n(x):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),y(x))}function p(x){return x===62?(e.enter(s),e.consume(x),e.exit(s),e.exit(a),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===62?(e.exit("chunkString"),e.exit(l),p(x)):x===null||x===60||It(x)?n(x):(e.consume(x),x===92?T:g)}function T(x){return x===60||x===62||x===92?(e.consume(x),g):g(x)}function y(x){return!h&&(x===null||x===41||Kn(x))?(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(x)):h<u&&x===40?(e.consume(x),h++,y):x===41?(e.consume(x),h--,y):x===null||x===32||x===40||y0(x)?n(x):(e.consume(x),x===92?b:y)}function b(x){return x===40||x===41||x===92?(e.consume(x),y):y(x)}}function LJ(e,t,n,r,a,s){const i=this;let l=0,c;return u;function u(g){return e.enter(r),e.enter(a),e.consume(g),e.exit(a),e.enter(s),h}function h(g){return l>999||g===null||g===91||g===93&&!c||g===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(g):g===93?(e.exit(s),e.enter(a),e.consume(g),e.exit(a),e.exit(r),t):It(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===null||g===91||g===93||It(g)||l++>999?(e.exit("chunkString"),h(g)):(e.consume(g),c||(c=!cn(g)),g===92?p:m)}function p(g){return g===91||g===92||g===93?(e.consume(g),l++,m):m(g)}}function MJ(e,t,n,r,a,s){let i;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),i=p===40?41:p,c):n(p)}function c(p){return p===i?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===i?(e.exit(s),c(i)):p===null?n(p):It(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),mn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===i||p===null||It(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?m:h)}function m(p){return p===i||p===92?(e.consume(p),h):h(p)}}function Fp(e,t){let n;return r;function r(a){return It(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):cn(a)?mn(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const fFe={name:"definition",tokenize:pFe},mFe={partial:!0,tokenize:gFe};function pFe(e,t,n){const r=this;let a;return s;function s(g){return e.enter("definition"),i(g)}function i(g){return LJ.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function l(g){return a=pi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),c):n(g)}function c(g){return Kn(g)?Fp(e,u)(g):u(g)}function u(g){return OJ(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function h(g){return e.attempt(mFe,m,m)(g)}function m(g){return cn(g)?mn(e,p,"whitespace")(g):p(g)}function p(g){return g===null||It(g)?(e.exit("definition"),r.parser.defined.push(a),t(g)):n(g)}}function gFe(e,t,n){return r;function r(l){return Kn(l)?Fp(e,a)(l):n(l)}function a(l){return MJ(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return cn(l)?mn(e,i,"whitespace")(l):i(l)}function i(l){return l===null||It(l)?t(l):n(l)}}const EFe={name:"hardBreakEscape",tokenize:TFe};function TFe(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),a}function a(s){return It(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const yFe={name:"headingAtx",resolve:xFe,tokenize:SFe};function xFe(e,t){let n=e.length-2,r=3,a,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},bs(e,r,n-r+1,[["enter",a,t],["enter",s,t],["exit",s,t],["exit",a,t]])),e}function SFe(e,t,n){let r=0;return a;function a(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),i(h)}function i(h){return h===35&&r++<6?(e.consume(h),i):h===null||Kn(h)?(e.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(e.enter("atxHeadingSequence"),c(h)):h===null||It(h)?(e.exit("atxHeading"),t(h)):cn(h)?mn(e,l,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function c(h){return h===35?(e.consume(h),c):(e.exit("atxHeadingSequence"),l(h))}function u(h){return h===null||h===35||Kn(h)?(e.exit("atxHeadingText"),l(h)):(e.consume(h),u)}}const bFe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],B6=["pre","script","style","textarea"],vFe={concrete:!0,name:"htmlFlow",resolveTo:NFe,tokenize:_Fe},AFe={partial:!0,tokenize:CFe},RFe={partial:!0,tokenize:wFe};function NFe(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function _Fe(e,t,n){const r=this;let a,s,i,l,c;return u;function u(V){return h(V)}function h(V){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(V),m}function m(V){return V===33?(e.consume(V),p):V===47?(e.consume(V),s=!0,y):V===63?(e.consume(V),a=3,r.interrupt?t:$):Ha(V)?(e.consume(V),i=String.fromCharCode(V),b):n(V)}function p(V){return V===45?(e.consume(V),a=2,g):V===91?(e.consume(V),a=5,l=0,T):Ha(V)?(e.consume(V),a=4,r.interrupt?t:$):n(V)}function g(V){return V===45?(e.consume(V),r.interrupt?t:$):n(V)}function T(V){const te="CDATA[";return V===te.charCodeAt(l++)?(e.consume(V),l===te.length?r.interrupt?t:k:T):n(V)}function y(V){return Ha(V)?(e.consume(V),i=String.fromCharCode(V),b):n(V)}function b(V){if(V===null||V===47||V===62||Kn(V)){const te=V===47,ae=i.toLowerCase();return!te&&!s&&B6.includes(ae)?(a=1,r.interrupt?t(V):k(V)):bFe.includes(i.toLowerCase())?(a=6,te?(e.consume(V),x):r.interrupt?t(V):k(V)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(V):s?R(V):A(V))}return V===45||Oa(V)?(e.consume(V),i+=String.fromCharCode(V),b):n(V)}function x(V){return V===62?(e.consume(V),r.interrupt?t:k):n(V)}function R(V){return cn(V)?(e.consume(V),R):O(V)}function A(V){return V===47?(e.consume(V),O):V===58||V===95||Ha(V)?(e.consume(V),w):cn(V)?(e.consume(V),A):O(V)}function w(V){return V===45||V===46||V===58||V===95||Oa(V)?(e.consume(V),w):_(V)}function _(V){return V===61?(e.consume(V),N):cn(V)?(e.consume(V),_):A(V)}function N(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(e.consume(V),c=V,I):cn(V)?(e.consume(V),N):D(V)}function I(V){return V===c?(e.consume(V),c=null,M):V===null||It(V)?n(V):(e.consume(V),I)}function D(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||Kn(V)?_(V):(e.consume(V),D)}function M(V){return V===47||V===62||cn(V)?A(V):n(V)}function O(V){return V===62?(e.consume(V),L):n(V)}function L(V){return V===null||It(V)?k(V):cn(V)?(e.consume(V),L):n(V)}function k(V){return V===45&&a===2?(e.consume(V),j):V===60&&a===1?(e.consume(V),G):V===62&&a===4?(e.consume(V),X):V===63&&a===3?(e.consume(V),$):V===93&&a===5?(e.consume(V),J):It(V)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(AFe,Z,F)(V)):V===null||It(V)?(e.exit("htmlFlowData"),F(V)):(e.consume(V),k)}function F(V){return e.check(RFe,U,Z)(V)}function U(V){return e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),B}function B(V){return V===null||It(V)?F(V):(e.enter("htmlFlowData"),k(V))}function j(V){return V===45?(e.consume(V),$):k(V)}function G(V){return V===47?(e.consume(V),i="",K):k(V)}function K(V){if(V===62){const te=i.toLowerCase();return B6.includes(te)?(e.consume(V),X):k(V)}return Ha(V)&&i.length<8?(e.consume(V),i+=String.fromCharCode(V),K):k(V)}function J(V){return V===93?(e.consume(V),$):k(V)}function $(V){return V===62?(e.consume(V),X):V===45&&a===2?(e.consume(V),$):k(V)}function X(V){return V===null||It(V)?(e.exit("htmlFlowData"),Z(V)):(e.consume(V),X)}function Z(V){return e.exit("htmlFlow"),t(V)}}function wFe(e,t,n){const r=this;return a;function a(i){return It(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function CFe(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(qg,t,n)}}const IFe={name:"htmlText",tokenize:OFe};function OFe(e,t,n){const r=this;let a,s,i;return l;function l($){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume($),c}function c($){return $===33?(e.consume($),u):$===47?(e.consume($),_):$===63?(e.consume($),A):Ha($)?(e.consume($),D):n($)}function u($){return $===45?(e.consume($),h):$===91?(e.consume($),s=0,T):Ha($)?(e.consume($),R):n($)}function h($){return $===45?(e.consume($),g):n($)}function m($){return $===null?n($):$===45?(e.consume($),p):It($)?(i=m,G($)):(e.consume($),m)}function p($){return $===45?(e.consume($),g):m($)}function g($){return $===62?j($):$===45?p($):m($)}function T($){const X="CDATA[";return $===X.charCodeAt(s++)?(e.consume($),s===X.length?y:T):n($)}function y($){return $===null?n($):$===93?(e.consume($),b):It($)?(i=y,G($)):(e.consume($),y)}function b($){return $===93?(e.consume($),x):y($)}function x($){return $===62?j($):$===93?(e.consume($),x):y($)}function R($){return $===null||$===62?j($):It($)?(i=R,G($)):(e.consume($),R)}function A($){return $===null?n($):$===63?(e.consume($),w):It($)?(i=A,G($)):(e.consume($),A)}function w($){return $===62?j($):A($)}function _($){return Ha($)?(e.consume($),N):n($)}function N($){return $===45||Oa($)?(e.consume($),N):I($)}function I($){return It($)?(i=I,G($)):cn($)?(e.consume($),I):j($)}function D($){return $===45||Oa($)?(e.consume($),D):$===47||$===62||Kn($)?M($):n($)}function M($){return $===47?(e.consume($),j):$===58||$===95||Ha($)?(e.consume($),O):It($)?(i=M,G($)):cn($)?(e.consume($),M):j($)}function O($){return $===45||$===46||$===58||$===95||Oa($)?(e.consume($),O):L($)}function L($){return $===61?(e.consume($),k):It($)?(i=L,G($)):cn($)?(e.consume($),L):M($)}function k($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),a=$,F):It($)?(i=k,G($)):cn($)?(e.consume($),k):(e.consume($),U)}function F($){return $===a?(e.consume($),a=void 0,B):$===null?n($):It($)?(i=F,G($)):(e.consume($),F)}function U($){return $===null||$===34||$===39||$===60||$===61||$===96?n($):$===47||$===62||Kn($)?M($):(e.consume($),U)}function B($){return $===47||$===62||Kn($)?M($):n($)}function j($){return $===62?(e.consume($),e.exit("htmlTextData"),e.exit("htmlText"),t):n($)}function G($){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),K}function K($){return cn($)?mn(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):J($)}function J($){return e.enter("htmlTextData"),i($)}}const GD={name:"labelEnd",resolveAll:PFe,resolveTo:kFe,tokenize:jFe},LFe={tokenize:UFe},MFe={tokenize:FFe},DFe={tokenize:$Fe};function PFe(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&bs(e,0,e.length,n),e}function kFe(e,t){let n=e.length,r=0,a,s,i,l;for(;n--;)if(a=e[n][1],s){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(s=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(i=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:q({},e[s][1].start),end:q({},e[e.length-1][1].end)},u={type:"label",start:q({},e[s][1].start),end:q({},e[i][1].end)},h={type:"labelText",start:q({},e[s+r+2][1].end),end:q({},e[i-2][1].start)};return l=[["enter",c,t],["enter",u,t]],l=Us(l,e.slice(s+1,s+r+3)),l=Us(l,[["enter",h,t]]),l=Us(l,TS(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),l=Us(l,[["exit",h,t],e[i-2],e[i-1],["exit",u,t]]),l=Us(l,e.slice(i+1)),l=Us(l,[["exit",c,t]]),bs(e,s,e.length,l),e}function jFe(e,t,n){const r=this;let a=r.events.length,s,i;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){s=r.events[a][1];break}return l;function l(p){return s?s._inactive?m(p):(i=r.parser.defined.includes(pi(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(LFe,h,i?h:m)(p):p===91?e.attempt(MFe,h,i?u:m)(p):i?h(p):m(p)}function u(p){return e.attempt(DFe,h,m)(p)}function h(p){return t(p)}function m(p){return s._balanced=!0,n(p)}}function UFe(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return Kn(m)?Fp(e,s)(m):s(m)}function s(m){return m===41?h(m):OJ(e,i,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function i(m){return Kn(m)?Fp(e,c)(m):h(m)}function l(m){return n(m)}function c(m){return m===34||m===39||m===40?MJ(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):h(m)}function u(m){return Kn(m)?Fp(e,h)(m):h(m)}function h(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function FFe(e,t,n){const r=this;return a;function a(l){return LJ.call(r,e,s,i,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(pi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function i(l){return n(l)}}function $Fe(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),a}function a(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const BFe={name:"labelStartImage",resolveAll:GD.resolveAll,tokenize:HFe};function HFe(e,t,n){const r=this;return a;function a(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),i):n(l)}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const VFe={name:"labelStartLink",resolveAll:GD.resolveAll,tokenize:GFe};function GFe(e,t,n){const r=this;return a;function a(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const DC={name:"lineEnding",tokenize:zFe};function zFe(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),mn(e,t,"linePrefix")}}const Ey={name:"thematicBreak",tokenize:qFe};function qFe(e,t,n){let r=0,a;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return a=u,l(u)}function l(u){return u===a?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||It(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===a?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),cn(u)?mn(e,l,"whitespace")(u):l(u))}}const Qa={continuation:{tokenize:KFe},exit:JFe,name:"list",tokenize:XFe},YFe={partial:!0,tokenize:ZFe},WFe={partial:!0,tokenize:QFe};function XFe(e,t,n){const r=this,a=r.events[r.events.length-1];let s=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,i=0;return l;function l(g){const T=r.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(T==="listUnordered"?!r.containerState.marker||g===r.containerState.marker:h1(g)){if(r.containerState.type||(r.containerState.type=T,e.enter(T,{_container:!0})),T==="listUnordered")return e.enter("listItemPrefix"),g===42||g===45?e.check(Ey,n,u)(g):u(g);if(!r.interrupt||g===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(g)}return n(g)}function c(g){return h1(g)&&++i<10?(e.consume(g),c):(!r.interrupt||i<2)&&(r.containerState.marker?g===r.containerState.marker:g===41||g===46)?(e.exit("listItemValue"),u(g)):n(g)}function u(g){return e.enter("listItemMarker"),e.consume(g),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||g,e.check(qg,r.interrupt?n:h,e.attempt(YFe,p,m))}function h(g){return r.containerState.initialBlankLine=!0,s++,p(g)}function m(g){return cn(g)?(e.enter("listItemPrefixWhitespace"),e.consume(g),e.exit("listItemPrefixWhitespace"),p):n(g)}function p(g){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(g)}}function KFe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(qg,a,s);function a(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,mn(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!cn(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(WFe,t,i)(l))}function i(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,mn(e,e.attempt(Qa,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function QFe(e,t,n){const r=this;return mn(e,a,"listItemIndent",r.containerState.size+1);function a(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function JFe(e){e.exit(this.containerState.type)}function ZFe(e,t,n){const r=this;return mn(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(s){const i=r.events[r.events.length-1];return!cn(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const H6={name:"setextUnderline",resolveTo:e5e,tokenize:t5e};function e5e(e,t){let n=e.length,r,a,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:q({},e[r][1].start),end:q({},e[e.length-1][1].end)};return e[a][1].type="setextHeadingText",s?(e.splice(a,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end=q({},e[s][1].end)):e[r][1]=i,e.push(["exit",i,t]),e}function t5e(e,t,n){const r=this;let a;return s;function s(u){let h=r.events.length,m;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){m=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),a=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===a?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),cn(u)?mn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||It(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const n5e={tokenize:r5e};function r5e(e){const t=this,n=e.attempt(qg,r,e.attempt(this.parser.constructs.flowInitial,a,mn(e,e.attempt(this.parser.constructs.flow,a,e.attempt(lFe,a)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const a5e={resolveAll:PJ()},s5e=DJ("string"),i5e=DJ("text");function DJ(e){return{resolveAll:PJ(e==="text"?o5e:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],s=n.attempt(a,i,l);return i;function i(h){return u(h)?s(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),c}function c(h){return u(h)?(n.exit("data"),s(h)):(n.consume(h),c)}function u(h){if(h===null)return!0;const m=a[h];let p=-1;if(m)for(;++p<m.length;){const g=m[p];if(!g.previous||g.previous.call(r,r.previous))return!0}return!1}}}function PJ(e){return t;function t(n,r){let a=-1,s;for(;++a<=n.length;)s===void 0?n[a]&&n[a][1].type==="data"&&(s=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==s+2&&(n[s][1].end=n[a-1][1].end,n.splice(s+2,a-s-2),a=s+2),s=void 0);return e?e(n,r):n}}function o5e(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let s=a.length,i=-1,l=0,c;for(;s--;){const u=a[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)l++,i--;if(i)break;i=-1}else if(u===-2)c=!0,l++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:q({},r.end)};r.end=q({},u.start),r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const l5e={42:Qa,43:Qa,45:Qa,48:Qa,49:Qa,50:Qa,51:Qa,52:Qa,53:Qa,54:Qa,55:Qa,56:Qa,57:Qa,62:_J},c5e={91:fFe},u5e={[-2]:MC,[-1]:MC,32:MC},d5e={35:yFe,42:Ey,45:[H6,Ey],60:vFe,61:H6,95:Ey,96:$6,126:$6},h5e={38:CJ,92:wJ},f5e={[-5]:DC,[-4]:DC,[-3]:DC,33:BFe,38:CJ,42:f1,60:[VUe,IFe],91:VFe,92:[EFe,wJ],93:GD,95:f1,96:nFe},m5e={null:[f1,a5e]},p5e={null:[42,95]},g5e={null:[]},E5e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:p5e,contentInitial:c5e,disable:g5e,document:l5e,flow:d5e,flowInitial:u5e,insideSpan:m5e,string:h5e,text:f5e},Symbol.toStringTag,{value:"Module"}));function T5e(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},s=[];let i=[],l=[];const c={attempt:I(_),check:I(N),consume:R,enter:A,exit:w,interrupt:I(N,{interrupt:!0})},u={code:null,containerState:{},defineSkip:y,events:[],now:T,parser:e,previous:null,sliceSerialize:p,sliceStream:g,write:m};let h=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function m(L){return i=Us(i,L),b(),i[i.length-1]!==null?[]:(D(t,0),u.events=TS(s,u.events,u),u.events)}function p(L,k){return x5e(g(L),k)}function g(L){return y5e(i,L)}function T(){const{_bufferIndex:L,_index:k,line:F,column:U,offset:B}=r;return{_bufferIndex:L,_index:k,line:F,column:U,offset:B}}function y(L){a[L.line]=L.column,O()}function b(){let L;for(;r._index<i.length;){const k=i[r._index];if(typeof k=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<k.length;)x(k.charCodeAt(r._bufferIndex));else x(k)}}function x(L){h=h(L)}function R(L){It(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,O()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function A(L,k){const F=k||{};return F.type=L,F.start=T(),u.events.push(["enter",F,u]),l.push(F),F}function w(L){const k=l.pop();return k.end=T(),u.events.push(["exit",k,u]),k}function _(L,k){D(L,k.from)}function N(L,k){k.restore()}function I(L,k){return F;function F(U,B,j){let G,K,J,$;return Array.isArray(U)?Z(U):"tokenize"in U?Z([U]):X(U);function X(ne){return ce;function ce(ie){const W=ie!==null&&ne[ie],Q=ie!==null&&ne.null,se=[...Array.isArray(W)?W:W?[W]:[],...Array.isArray(Q)?Q:Q?[Q]:[]];return Z(se)(ie)}}function Z(ne){return G=ne,K=0,ne.length===0?j:V(ne[K])}function V(ne){return ce;function ce(ie){return $=M(),J=ne,ne.partial||(u.currentConstruct=ne),ne.name&&u.parser.constructs.disable.null.includes(ne.name)?ae():ne.tokenize.call(k?Object.assign(Object.create(u),k):u,c,te,ae)(ie)}}function te(ne){return L(J,$),B}function ae(ne){return $.restore(),++K<G.length?V(G[K]):j}}}function D(L,k){L.resolveAll&&!s.includes(L)&&s.push(L),L.resolve&&bs(u.events,k,u.events.length-k,L.resolve(u.events.slice(k),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function M(){const L=T(),k=u.previous,F=u.currentConstruct,U=u.events.length,B=Array.from(l);return{from:U,restore:j};function j(){r=L,u.previous=k,u.currentConstruct=F,u.events.length=U,l=B,O()}}function O(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function y5e(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;let i;if(n===a)i=[e[n].slice(r,s)];else{if(i=e.slice(n,a),r>-1){const l=i[0];typeof l=="string"?i[0]=l.slice(r):i.shift()}s>0&&i.push(e[a].slice(0,s))}return i}function x5e(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i="\n";break}case-3:{i="\r\n";break}case-2:{i=t?" ":"	";break}case-1:{if(!t&&a)continue;i=" ";break}default:i=String.fromCharCode(s)}a=s===-2,r.push(i)}return r.join("")}function S5e(e){const r={constructs:RJ([E5e,...(e||{}).extensions||[]]),content:a(kUe),defined:[],document:a(UUe),flow:a(n5e),lazy:{},string:a(s5e),text:a(i5e)};return r;function a(s){return i;function i(l){return T5e(r,s,l)}}}function b5e(e){for(;!IJ(e););return e}const V6=/[\0\t\n\r]/g;function v5e(){let e=1,t="",n=!0,r;return a;function a(s,i,l){const c=[];let u,h,m,p,g;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),m=0,t="",n&&(s.charCodeAt(0)===65279&&m++,n=void 0);m<s.length;){if(V6.lastIndex=m,u=V6.exec(s),p=u&&u.index!==void 0?u.index:s.length,g=s.charCodeAt(p),!u){t=s.slice(m);break}if(g===10&&m===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),m<p&&(c.push(s.slice(m,p)),e+=p-m),g){case 0:{c.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,c.push(-2);e++<h;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}m=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const A5e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function R5e(e){return e.replace(A5e,N5e)}function N5e(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),s=a===120||a===88;return NJ(n.slice(s?2:1),s?16:10)}return VD(n)||e}const kJ={}.hasOwnProperty;function _5e(e,t,n){return typeof t!="string"&&(n=t,t=void 0),w5e(n)(b5e(S5e(n).document().write(v5e()(e,t,!0))))}function w5e(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s($e),autolinkProtocol:M,autolinkEmail:M,atxHeading:s(pe),blockQuote:s(Q),characterEscape:M,characterReference:M,codeFenced:s(se),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(se,i),codeText:s(z,i),codeTextData:M,data:M,codeFlowValue:M,definition:s(xe),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(le),hardBreakEscape:s(_e),hardBreakTrailing:s(_e),htmlFlow:s(re,i),htmlFlowData:M,htmlText:s(re,i),htmlTextData:M,image:s(Se),label:i,link:s($e),listItem:s(Je),listItemValue:p,listOrdered:s(qe,m),listUnordered:s(qe),paragraph:s(lt),reference:V,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(pe),strong:s(at),thematicBreak:s(st)},exit:{atxHeading:c(),atxHeadingSequence:_,autolink:c(),autolinkEmail:W,autolinkProtocol:ie,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:ne,characterReference:ce,codeFenced:c(b),codeFencedFence:y,codeFencedFenceInfo:g,codeFencedFenceMeta:T,codeFlowValue:O,codeIndented:c(x),codeText:c(B),codeTextData:O,data:O,definition:c(),definitionDestinationString:w,definitionLabelString:R,definitionTitleString:A,emphasis:c(),hardBreakEscape:c(k),hardBreakTrailing:c(k),htmlFlow:c(F),htmlFlowData:O,htmlText:c(U),htmlTextData:O,image:c(G),label:J,labelText:K,lineEnding:L,link:c(j),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:$,resourceTitleString:X,resource:Z,setextHeading:c(D),setextHeadingLineSequence:I,setextHeadingText:N,strong:c(),thematicBreak:c()}};jJ(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let ue={type:"root",children:[]};const Ee={stack:[ue],tokenStack:[],config:t,enter:l,exit:u,buffer:i,resume:h,data:n},Le=[];let ke=-1;for(;++ke<oe.length;)if(oe[ke][1].type==="listOrdered"||oe[ke][1].type==="listUnordered")if(oe[ke][0]==="enter")Le.push(ke);else{const Ge=Le.pop();ke=a(oe,Ge,ke)}for(ke=-1;++ke<oe.length;){const Ge=t[oe[ke][0]];kJ.call(Ge,oe[ke][1].type)&&Ge[oe[ke][1].type].call(Object.assign({sliceSerialize:oe[ke][2].sliceSerialize},Ee),oe[ke][1])}if(Ee.tokenStack.length>0){const Ge=Ee.tokenStack[Ee.tokenStack.length-1];(Ge[1]||G6).call(Ee,void 0,Ge[0])}for(ue.position={start:vl(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:vl(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<t.transforms.length;)ue=t.transforms[ke](ue)||ue;return ue}function a(oe,ue,Ee){let Le=ue-1,ke=-1,Ge=!1,tt,ct,Te,Oe;for(;++Le<=Ee;){const de=oe[Le];switch(de[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{de[0]==="enter"?ke++:ke--,Oe=void 0;break}case"lineEndingBlank":{de[0]==="enter"&&(tt&&!Oe&&!ke&&!Te&&(Te=Le),Oe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Oe=void 0}if(!ke&&de[0]==="enter"&&de[1].type==="listItemPrefix"||ke===-1&&de[0]==="exit"&&(de[1].type==="listUnordered"||de[1].type==="listOrdered")){if(tt){let Ae=Le;for(ct=void 0;Ae--;){const we=oe[Ae];if(we[1].type==="lineEnding"||we[1].type==="lineEndingBlank"){if(we[0]==="exit")continue;ct&&(oe[ct][1].type="lineEndingBlank",Ge=!0),we[1].type="lineEnding",ct=Ae}else if(!(we[1].type==="linePrefix"||we[1].type==="blockQuotePrefix"||we[1].type==="blockQuotePrefixWhitespace"||we[1].type==="blockQuoteMarker"||we[1].type==="listItemIndent"))break}Te&&(!ct||Te<ct)&&(tt._spread=!0),tt.end=Object.assign({},ct?oe[ct][1].start:de[1].end),oe.splice(ct||Le,0,["exit",tt,de[2]]),Le++,Ee++}if(de[1].type==="listItemPrefix"){const Ae={type:"listItem",_spread:!1,start:Object.assign({},de[1].start),end:void 0};tt=Ae,oe.splice(Le,0,["enter",Ae,de[2]]),Le++,Ee++,Te=void 0,Oe=!0}}}return oe[ue][1]._spread=Ge,Ee}function s(oe,ue){return Ee;function Ee(Le){l.call(this,oe(Le),Le),ue&&ue.call(this,Le)}}function i(){this.stack.push({type:"fragment",children:[]})}function l(oe,ue,Ee){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ue,Ee||void 0]),oe.position={start:vl(ue.start),end:void 0}}function c(oe){return ue;function ue(Ee){oe&&oe.call(this,Ee),u.call(this,Ee)}}function u(oe,ue){const Ee=this.stack.pop(),Le=this.tokenStack.pop();if(Le)Le[0].type!==oe.type&&(ue?ue.call(this,oe,Le[0]):(Le[1]||G6).call(this,oe,Le[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Up({start:oe.start,end:oe.end})+"): it’s not open");Ee.position.end=vl(oe.end)}function h(){return HD(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function p(oe){if(this.data.expectingFirstListItemValue){const ue=this.stack[this.stack.length-2];ue.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function g(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.lang=oe}function T(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.meta=oe}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.value=oe.replace(/(\r?\n|\r)$/g,"")}function R(oe){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=ue,Ee.identifier=pi(this.sliceSerialize(oe)).toLowerCase()}function A(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.title=oe}function w(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.url=oe}function _(oe){const ue=this.stack[this.stack.length-1];if(!ue.depth){const Ee=this.sliceSerialize(oe).length;ue.depth=Ee}}function N(){this.data.setextHeadingSlurpLineEnding=!0}function I(oe){const ue=this.stack[this.stack.length-1];ue.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function M(oe){const Ee=this.stack[this.stack.length-1].children;let Le=Ee[Ee.length-1];(!Le||Le.type!=="text")&&(Le=ot(),Le.position={start:vl(oe.start),end:void 0},Ee.push(Le)),this.stack.push(Le)}function O(oe){const ue=this.stack.pop();ue.value+=this.sliceSerialize(oe),ue.position.end=vl(oe.end)}function L(oe){const ue=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ee=ue.children[ue.children.length-1];Ee.position.end=vl(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ue.type)&&(M.call(this,oe),O.call(this,oe))}function k(){this.data.atHardBreak=!0}function F(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.value=oe}function U(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.value=oe}function B(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.value=oe}function j(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ue,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function G(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ue=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ue,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function K(oe){const ue=this.sliceSerialize(oe),Ee=this.stack[this.stack.length-2];Ee.label=R5e(ue),Ee.identifier=pi(ue).toLowerCase()}function J(){const oe=this.stack[this.stack.length-1],ue=this.resume(),Ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ee.type==="link"){const Le=oe.children;Ee.children=Le}else Ee.alt=ue}function $(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.url=oe}function X(){const oe=this.resume(),ue=this.stack[this.stack.length-1];ue.title=oe}function Z(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function te(oe){const ue=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=ue,Ee.identifier=pi(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function ae(oe){this.data.characterReferenceType=oe.type}function ne(oe){const ue=this.sliceSerialize(oe),Ee=this.data.characterReferenceType;let Le;Ee?(Le=NJ(ue,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=VD(ue);const ke=this.stack[this.stack.length-1];ke.value+=Le}function ce(oe){const ue=this.stack.pop();ue.position.end=vl(oe.end)}function ie(oe){O.call(this,oe);const ue=this.stack[this.stack.length-1];ue.url=this.sliceSerialize(oe)}function W(oe){O.call(this,oe);const ue=this.stack[this.stack.length-1];ue.url="mailto:"+this.sliceSerialize(oe)}function Q(){return{type:"blockquote",children:[]}}function se(){return{type:"code",lang:null,meta:null,value:""}}function z(){return{type:"inlineCode",value:""}}function xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function le(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function re(){return{type:"html",value:""}}function Se(){return{type:"image",title:null,url:"",alt:null}}function $e(){return{type:"link",title:null,url:"",children:[]}}function qe(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Je(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function lt(){return{type:"paragraph",children:[]}}function at(){return{type:"strong",children:[]}}function ot(){return{type:"text",value:""}}function st(){return{type:"thematicBreak"}}}function vl(e){return{line:e.line,column:e.column,offset:e.offset}}function jJ(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?jJ(e,r):C5e(e,r)}}function C5e(e,t){let n;for(n in t)if(kJ.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function G6(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Up({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Up({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Up({start:t.start,end:t.end})+") is still open")}function I5e(e){const t=this;t.parser=n;function n(r){return _5e(r,he(q(q({},t.data("settings")),e),{extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]}))}}function O5e(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function L5e(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]}function M5e(e,t){const n=t.value?t.value+"\n":"",r={};t.lang&&(r.className=["language-"+t.lang]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function D5e(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function P5e(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k5e(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=hf(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function j5e(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function U5e(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function UJ(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),s=a[0];s&&s.type==="text"?s.value="["+s.value:a.unshift({type:"text",value:"["});const i=a[a.length-1];return i&&i.type==="text"?i.value+=r:a.push({type:"text",value:r}),a}function F5e(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return UJ(e,t);const a={src:hf(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const s={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,s),e.applyData(t,s)}function $5e(e,t){const n={src:hf(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function B5e(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function H5e(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return UJ(e,t);const a={href:hf(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const s={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function V5e(e,t){const n={href:hf(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function G5e(e,t,n){const r=e.all(t),a=n?z5e(n):FJ(t),s={},i=[];if(typeof t.checked=="boolean"){const h=r[0];let m;h&&h.type==="element"&&h.tagName==="p"?m=h:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const h=r[l];(a||l!==0||h.type!=="element"||h.tagName!=="p")&&i.push({type:"text",value:"\n"}),h.type==="element"&&h.tagName==="p"&&!a?i.push(...h.children):i.push(h)}const c=r[r.length-1];c&&(a||c.type!=="element"||c.tagName!=="p")&&i.push({type:"text",value:"\n"});const u={type:"element",tagName:"li",properties:s,children:i};return e.patch(t,u),e.applyData(t,u)}function z5e(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=FJ(n[r])}return t}function FJ(e){const t=e.spread;return t==null?e.children.length>1:t}function q5e(e,t){const n={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<r.length;){const i=r[a];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function Y5e(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function W5e(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function X5e(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function K5e(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),a.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=UD(t.children[1]),c=TJ(t.children[t.children.length-1]);l&&c&&(i.position={start:l,end:c}),a.push(i)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,s),e.applyData(t,s)}function Q5e(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,l=i?i.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const m=t.children[c],p={},g=i?i[c]:void 0;g&&(p.align=g);let T={type:"element",tagName:s,properties:p,children:[]};m&&(T.children=e.all(m),e.patch(m,T),T=e.applyData(m,T)),u.push(T)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,h),e.applyData(t,h)}function J5e(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const z6=9,q6=32;function Z5e(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const s=[];for(;r;)s.push(Y6(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return s.push(Y6(t.slice(a),a>0,!1)),s.join("")}function Y6(e,t,n){let r=0,a=e.length;if(t){let s=e.codePointAt(r);for(;s===z6||s===q6;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(a-1);for(;s===z6||s===q6;)a--,s=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function e3e(e,t){const n={type:"text",value:Z5e(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function t3e(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const n3e={blockquote:O5e,break:L5e,code:M5e,delete:D5e,emphasis:P5e,footnoteReference:k5e,heading:j5e,html:U5e,imageReference:F5e,image:$5e,inlineCode:B5e,linkReference:H5e,link:V5e,listItem:G5e,list:q5e,paragraph:Y5e,root:W5e,strong:X5e,table:K5e,tableCell:J5e,tableRow:Q5e,text:e3e,thematicBreak:t3e,toml:zT,yaml:zT,definition:zT,footnoteDefinition:zT};function zT(){}const $J=-1,yS=0,$p=1,x0=2,zD=3,qD=4,YD=5,WD=6,BJ=7,HJ=8,W6=typeof self=="object"?self:globalThis,r3e=(e,t)=>{const n=(a,s)=>(e.set(s,a),a),r=a=>{if(e.has(a))return e.get(a);const[s,i]=t[a];switch(s){case yS:case $J:return n(i,a);case $p:{const l=n([],a);for(const c of i)l.push(r(c));return l}case x0:{const l=n({},a);for(const[c,u]of i)l[r(c)]=r(u);return l}case zD:return n(new Date(i),a);case qD:{const{source:l,flags:c}=i;return n(new RegExp(l,c),a)}case YD:{const l=n(new Map,a);for(const[c,u]of i)l.set(r(c),r(u));return l}case WD:{const l=n(new Set,a);for(const c of i)l.add(r(c));return l}case BJ:{const{name:l,message:c}=i;return n(new W6[l](c),a)}case HJ:return n(BigInt(i),a);case"BigInt":return n(Object(BigInt(i)),a);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:l}=new Uint8Array(i);return n(new DataView(l),i)}}return n(new W6[s](i),a)};return r},X6=e=>r3e(new Map,e)(0),jd="",{toString:a3e}={},{keys:s3e}=Object,Jm=e=>{const t=typeof e;if(t!=="object"||!e)return[yS,t];const n=a3e.call(e).slice(8,-1);switch(n){case"Array":return[$p,jd];case"Object":return[x0,jd];case"Date":return[zD,jd];case"RegExp":return[qD,jd];case"Map":return[YD,jd];case"Set":return[WD,jd];case"DataView":return[$p,n]}return n.includes("Array")?[$p,n]:n.includes("Error")?[BJ,n]:[x0,n]},qT=([e,t])=>e===yS&&(t==="function"||t==="symbol"),i3e=(e,t,n,r)=>{const a=(i,l)=>{const c=r.push(i)-1;return n.set(l,c),c},s=i=>{if(n.has(i))return n.get(i);let[l,c]=Jm(i);switch(l){case yS:{let h=i;switch(c){case"bigint":l=HJ,h=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return a([$J],i)}return a([l,h],i)}case $p:{if(c){let p=i;return c==="DataView"?p=new Uint8Array(i.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(i)),a([c,[...p]],i)}const h=[],m=a([l,h],i);for(const p of i)h.push(s(p));return m}case x0:{if(c)switch(c){case"BigInt":return a([c,i.toString()],i);case"Boolean":case"Number":case"String":return a([c,i.valueOf()],i)}if(t&&"toJSON"in i)return s(i.toJSON());const h=[],m=a([l,h],i);for(const p of s3e(i))(e||!qT(Jm(i[p])))&&h.push([s(p),s(i[p])]);return m}case zD:return a([l,i.toISOString()],i);case qD:{const{source:h,flags:m}=i;return a([l,{source:h,flags:m}],i)}case YD:{const h=[],m=a([l,h],i);for(const[p,g]of i)(e||!(qT(Jm(p))||qT(Jm(g))))&&h.push([s(p),s(g)]);return m}case WD:{const h=[],m=a([l,h],i);for(const p of i)(e||!qT(Jm(p)))&&h.push(s(p));return m}}const{message:u}=i;return a([l,{name:c,message:u}],i)};return s},K6=(e,{json:t,lossy:n}={})=>{const r=[];return i3e(!(t||n),!!t,new Map,r)(e),r},S0=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?X6(K6(e,t)):structuredClone(e):(e,t)=>X6(K6(e,t));function o3e(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function l3e(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function c3e(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||o3e,r=e.options.footnoteBackLabel||l3e,a=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const h=e.all(u),m=String(u.identifier).toUpperCase(),p=hf(m.toLowerCase());let g=0;const T=[],y=e.footnoteCounts.get(m);for(;y!==void 0&&++g<=y;){T.length>0&&T.push({type:"text",value:" "});let R=typeof n=="string"?n:n(c,g);typeof R=="string"&&(R={type:"text",value:R}),T.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,g),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const b=h[h.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const R=b.children[b.children.length-1];R&&R.type==="text"?R.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...T)}else h.push(...T);const x={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(h,!0)};e.patch(u,x),l.push(x)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:he(q({},S0(i)),{id:"footnote-label"}),children:[{type:"text",value:a}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:"\n"}]}}const xS=function(e){if(e==null)return f3e;if(typeof e=="function")return SS(e);if(typeof e=="object")return Array.isArray(e)?u3e(e):d3e(e);if(typeof e=="string")return h3e(e);throw new Error("Expected function, string, or object as test")};function u3e(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=xS(e[n]);return SS(r);function r(...a){let s=-1;for(;++s<t.length;)if(t[s].apply(this,a))return!0;return!1}}function d3e(e){const t=e;return SS(n);function n(r){const a=r;let s;for(s in e)if(a[s]!==t[s])return!1;return!0}}function h3e(e){return SS(t);function t(n){return n&&n.type===e}}function SS(e){return t;function t(n,r,a){return!!(m3e(n)&&e.call(this,n,typeof r=="number"?r:void 0,a||void 0))}}function f3e(){return!0}function m3e(e){return e!==null&&typeof e=="object"&&"type"in e}const VJ=[],p3e=!0,m1=!1,g3e="skip";function GJ(e,t,n,r){let a;typeof t=="function"&&typeof n!="function"?(r=n,n=t):a=t;const s=xS(a),i=r?-1:1;l(e,void 0,[])();function l(c,u,h){const m=c&&typeof c=="object"?c:{};if(typeof m.type=="string"){const g=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(g?"<"+g+">":""))+")"})}return p;function p(){let g=VJ,T,y,b;if((!t||s(c,u,h[h.length-1]||void 0))&&(g=E3e(n(c,h)),g[0]===m1))return g;if("children"in c&&c.children){const x=c;if(x.children&&g[0]!==g3e)for(y=(r?x.children.length:-1)+i,b=h.concat(x);y>-1&&y<x.children.length;){const R=x.children[y];if(T=l(R,y,b)(),T[0]===m1)return T;y=typeof T[1]=="number"?T[1]:y+i}}return g}}}function E3e(e){return Array.isArray(e)?e:typeof e=="number"?[p3e,e]:e==null?VJ:[e]}function XD(e,t,n,r){let a,s,i;typeof t=="function"?(s=void 0,i=t,a=n):(s=t,i=n,a=r),GJ(e,s,l,a);function l(c,u){const h=u[u.length-1],m=h?h.children.indexOf(c):void 0;return i(c,m,h)}}const p1={}.hasOwnProperty,T3e={};function y3e(e,t){const n=t||T3e,r=new Map,a=new Map,s=new Map,i=q(q({},n3e),n.handlers),l={all:u,applyData:S3e,definitionById:r,footnoteById:a,footnoteCounts:s,footnoteOrder:[],handlers:i,one:c,options:n,patch:x3e,wrap:v3e};return XD(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const m=h.type==="definition"?r:a,p=String(h.identifier).toUpperCase();m.has(p)||m.set(p,h)}}),l;function c(h,m){const p=h.type,g=l.handlers[p];if(p1.call(l.handlers,p)&&g)return g(l,h,m);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in h){const y=h,{children:b}=y,x=Tn(y,["children"]),R=S0(x);return R.children=l.all(h),R}return S0(h)}return(l.options.unknownHandler||b3e)(l,h,m)}function u(h){const m=[];if("children"in h){const p=h.children;let g=-1;for(;++g<p.length;){const T=l.one(p[g],h);if(T){if(g&&p[g-1].type==="break"&&(!Array.isArray(T)&&T.type==="text"&&(T.value=Q6(T.value)),!Array.isArray(T)&&T.type==="element")){const y=T.children[0];y&&y.type==="text"&&(y.value=Q6(y.value))}Array.isArray(T)?m.push(...T):m.push(T)}}}return m}}function x3e(e,t){e.position&&(t.position=lUe(e))}function S3e(e,t){let n=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const i="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:i}}n.type==="element"&&s&&Object.assign(n.properties,S0(s)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function b3e(e,t){const n=t.data||{},r="value"in t&&!(p1.call(n,"hProperties")||p1.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function v3e(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function Q6(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function J6(e,t){const n=y3e(e,t),r=n.one(e,void 0),a=c3e(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&s.children.push({type:"text",value:"\n"},a),s}function A3e(e,t){return e&&"run"in e?function(n,r){return H(this,null,function*(){const a=J6(n,q({file:r},t));yield e.run(a,r)})}:function(n,r){return J6(n,q({file:r},e||t))}}function Z6(e){if(e)throw e}var PC,ez;function R3e(){if(ez)return PC;ez=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var h=e.call(u,"constructor"),m=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!h&&!m)return!1;var p;for(p in u);return typeof p=="undefined"||e.call(u,p)},i=function(u,h){n&&h.name==="__proto__"?n(u,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):u[h.name]=h.newValue},l=function(u,h){if(h==="__proto__")if(e.call(u,h)){if(r)return r(u,h).value}else return;return u[h]};return PC=function c(){var u,h,m,p,g,T,y=arguments[0],b=1,x=arguments.length,R=!1;for(typeof y=="boolean"&&(R=y,y=arguments[1]||{},b=2),(y==null||typeof y!="object"&&typeof y!="function")&&(y={});b<x;++b)if(u=arguments[b],u!=null)for(h in u)m=l(y,h),p=l(u,h),y!==p&&(R&&p&&(s(p)||(g=a(p)))?(g?(g=!1,T=m&&a(m)?m:[]):T=m&&s(m)?m:{},i(y,{name:h,newValue:c(R,T,p)})):typeof p!="undefined"&&i(y,{name:h,newValue:p}));return y},PC}var N3e=R3e();const kC=ir(N3e);function g1(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function _3e(){const e=[],t={run:n,use:r};return t;function n(...a){let s=-1;const i=a.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);l(null,...a);function l(c,...u){const h=e[++s];let m=-1;if(c){i(c);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,h?w3e(h,l)(...u):i(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function w3e(e,t){let n;return r;function r(...i){const l=e.length>i.length;let c;l&&i.push(a);try{c=e.apply(this,i)}catch(u){const h=u;if(l&&n)throw h;return a(h)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,a):c instanceof Error?a(c):s(c))}function a(i,...l){n||(n=!0,t(i,...l))}function s(i){a(null,i)}}const Oi={basename:C3e,dirname:I3e,extname:O3e,join:L3e,sep:"/"};function C3e(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Yg(e);let n=0,r=-1,a=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(s){n=a+1;break}}else r<0&&(s=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,l=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(s){n=a+1;break}}else i<0&&(s=!0,i=a+1),l>-1&&(e.codePointAt(a)===t.codePointAt(l--)?l<0&&(r=a):(l=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function I3e(e){if(Yg(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function O3e(e){Yg(e);let t=e.length,n=-1,r=0,a=-1,s=0,i;for(;t--;){const l=e.codePointAt(t);if(l===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),l===46?a<0?a=t:s!==1&&(s=1):a>-1&&(s=-1)}return a<0||n<0||s===0||s===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function L3e(...e){let t=-1,n;for(;++t<e.length;)Yg(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":M3e(n)}function M3e(e){Yg(e);const t=e.codePointAt(0)===47;let n=D3e(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function D3e(e,t){let n="",r=0,a=-1,s=0,i=-1,l,c;for(;++i<=e.length;){if(i<e.length)l=e.codePointAt(i);else{if(l===47)break;l=47}if(l===47){if(!(a===i-1||s===1))if(a!==i-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),a=i,s=0;continue}}else if(n.length>0){n="",r=0,a=i,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,i):n=e.slice(a+1,i),r=i-a-1;a=i,s=0}else l===46&&s>-1?s++:s=-1}return n}function Yg(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const P3e={cwd:k3e};function k3e(){return"/"}function E1(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function j3e(e){if(typeof e=="string")e=new URL(e);else if(!E1(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return U3e(e)}function U3e(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const jC=["history","path","basename","stem","extname","dirname"];class zJ{constructor(t){let n;t?E1(t)?n={path:t}:typeof t=="string"||F3e(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":P3e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<jC.length;){const s=jC[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let a;for(a in n)jC.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Oi.basename(this.path):void 0}set basename(t){FC(t,"basename"),UC(t,"basename"),this.path=Oi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Oi.dirname(this.path):void 0}set dirname(t){tz(this.basename,"dirname"),this.path=Oi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Oi.extname(this.path):void 0}set extname(t){if(UC(t,"extname"),tz(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Oi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){E1(t)&&(t=j3e(t)),FC(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Oi.basename(this.path,this.extname):void 0}set stem(t){FC(t,"stem"),UC(t,"stem"),this.path=Oi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ka(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function UC(e,t){if(e&&e.includes(Oi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Oi.sep+"`")}function FC(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function tz(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function F3e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $3e=function(e){const r=this.constructor.prototype,a=r[e],s=function(){return a.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},B3e={}.hasOwnProperty;class KD extends $3e{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=_3e()}copy(){const t=new KD;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(kC(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(HC("data",this.frozen),this.namespace[t]=n,this):B3e.call(this.namespace,t)&&this.namespace[t]||void 0:t?(HC("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=YT(t),r=this.parser||this.Parser;return $C("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),$C("process",this.parser||this.Parser),BC("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(s,i){const l=YT(t),c=r.parse(l);r.run(c,l,function(h,m,p){if(h||!m||!p)return u(h);const g=m,T=r.stringify(g,p);G3e(T)?p.value=T:p.result=T,u(h,p)});function u(h,m){h||!m?i(h):s?s(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),$C("processSync",this.parser||this.Parser),BC("processSync",this.compiler||this.Compiler),this.process(t,a),rz("processSync","process",n),r;function a(s,i){n=!0,Z6(s),r=i}}run(t,n,r){nz(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(i,l){const c=YT(n);a.run(t,c,u);function u(h,m,p){const g=m||t;h?l(h):i?i(g):r(void 0,g,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,s),rz("runSync","run",r),a;function s(i,l){Z6(i),a=l,r=!0}}stringify(t,n){this.freeze();const r=YT(n),a=this.compiler||this.Compiler;return BC("stringify",a),nz(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(HC("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[h,...m]=u;c(h,m)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(a.settings=kC(!0,a.settings,u.settings))}function l(u){let h=-1;if(u!=null)if(Array.isArray(u))for(;++h<u.length;){const m=u[h];s(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,h){let m=-1,p=-1;for(;++m<r.length;)if(r[m][0]===u){p=m;break}if(p===-1)r.push([u,...h]);else if(h.length>0){let[g,...T]=h;const y=r[p][1];g1(y)&&g1(g)&&(g=kC(!0,y,g)),r[p]=[u,g,...T]}}}}const H3e=new KD().freeze();function $C(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function BC(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function HC(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function nz(e){if(!g1(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function rz(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function YT(e){return V3e(e)?e:new zJ(e)}function V3e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function G3e(e){return typeof e=="string"||z3e(e)}function z3e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const q3e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",az=[],sz={allowDangerousHtml:!0},Y3e=/^(https?|ircs?|mailto|xmpp)$/i,W3e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function qJ(e){const t=X3e(e),n=K3e(e);return Q3e(t.runSync(t.parse(n),n),e)}function X3e(e){const t=e.rehypePlugins||az,n=e.remarkPlugins||az,r=e.remarkRehypeOptions?q(q({},e.remarkRehypeOptions),sz):sz;return H3e().use(I5e).use(n).use(A3e,r).use(t)}function K3e(e){const t=e.children||"",n=new zJ;return typeof t=="string"&&(n.value=t),n}function Q3e(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,s=t.disallowedElements,i=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||J3e;for(const h of W3e)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+q3e+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),XD(e,u),fUe(e,{Fragment:o.Fragment,components:a,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(h,m,p){if(h.type==="raw"&&p&&typeof m=="number")return i?p.children.splice(m,1):p.children[m]={type:"text",value:h.value},m;if(h.type==="element"){let g;for(g in LC)if(Object.hasOwn(LC,g)&&Object.hasOwn(h.properties,g)){const T=h.properties[g],y=LC[g];(y===null||y.includes(h.tagName))&&(h.properties[g]=c(String(T||""),g,h))}}if(h.type==="element"){let g=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!g&&r&&typeof m=="number"&&(g=!r(h,m,p)),g&&p&&typeof m=="number")return l&&h.children?p.children.splice(m,1,...h.children):p.children.splice(m,1),m}}}function J3e(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||r!==-1&&t>r||Y3e.test(e.slice(0,t))?e:""}function iz(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;a!==-1;)r++,a=n.indexOf(t,a+t.length);return r}function Z3e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function e4e(e,t,n){const a=xS((n||{}).ignore||[]),s=t4e(t);let i=-1;for(;++i<s.length;)GJ(e,"text",l);function l(u,h){let m=-1,p;for(;++m<h.length;){const g=h[m],T=p?p.children:void 0;if(a(g,T?T.indexOf(g):void 0,p))return;p=g}if(p)return c(u,h)}function c(u,h){const m=h[h.length-1],p=s[i][0],g=s[i][1];let T=0;const b=m.children.indexOf(u);let x=!1,R=[];p.lastIndex=0;let A=p.exec(u.value);for(;A;){const w=A.index,_={index:A.index,input:A.input,stack:[...h,u]};let N=g(...A,_);if(typeof N=="string"&&(N=N.length>0?{type:"text",value:N}:void 0),N===!1?p.lastIndex=w+1:(T!==w&&R.push({type:"text",value:u.value.slice(T,w)}),Array.isArray(N)?R.push(...N):N&&R.push(N),T=w+A[0].length,x=!0),!p.global)break;A=p.exec(u.value)}return x?(T<u.value.length&&R.push({type:"text",value:u.value.slice(T)}),m.children.splice(b,1,...R)):R=[u],b+R.length}}function t4e(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const a=n[r];t.push([n4e(a[0]),r4e(a[1])])}return t}function n4e(e){return typeof e=="string"?new RegExp(Z3e(e),"g"):e}function r4e(e){return typeof e=="function"?e:function(){return e}}const VC="phrasing",GC=["autolink","link","image","label"];function a4e(){return{transforms:[d4e],enter:{literalAutolink:i4e,literalAutolinkEmail:zC,literalAutolinkHttp:zC,literalAutolinkWww:zC},exit:{literalAutolink:u4e,literalAutolinkEmail:c4e,literalAutolinkHttp:o4e,literalAutolinkWww:l4e}}}function s4e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:VC,notInConstruct:GC},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:VC,notInConstruct:GC},{character:":",before:"[ps]",after:"\\/",inConstruct:VC,notInConstruct:GC}]}}function i4e(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function zC(e){this.config.enter.autolinkProtocol.call(this,e)}function o4e(e){this.config.exit.autolinkProtocol.call(this,e)}function l4e(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function c4e(e){this.config.exit.autolinkEmail.call(this,e)}function u4e(e){this.exit(e)}function d4e(e){e4e(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,h4e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),f4e]],{ignore:["link","linkReference"]})}function h4e(e,t,n,r,a){let s="";if(!YJ(a)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!m4e(n)))return!1;const i=p4e(n+r);if(!i[0])return!1;const l={type:"link",title:null,url:s+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[l,{type:"text",value:i[1]}]:l}function f4e(e,t,n,r){return!YJ(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function m4e(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function p4e(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=iz(e,"(");let s=iz(e,")");for(;r!==-1&&a>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function YJ(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||wu(n)||ES(n))&&(!t||n!==47)}WJ.peek=A4e;function g4e(){this.buffer()}function E4e(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function T4e(){this.buffer()}function y4e(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function x4e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function S4e(e){this.exit(e)}function b4e(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=pi(this.sliceSerialize(e)).toLowerCase(),n.label=t}function v4e(e){this.exit(e)}function A4e(){return"["}function WJ(e,t,n,r){const a=n.createTracker(r);let s=a.move("[^");const i=n.enter("footnoteReference"),l=n.enter("reference");return s+=a.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),i(),s+=a.move("]"),s}function R4e(){return{enter:{gfmFootnoteCallString:g4e,gfmFootnoteCall:E4e,gfmFootnoteDefinitionLabelString:T4e,gfmFootnoteDefinition:y4e},exit:{gfmFootnoteCallString:x4e,gfmFootnoteCall:S4e,gfmFootnoteDefinitionLabelString:b4e,gfmFootnoteDefinition:v4e}}}function N4e(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:WJ},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,a,s,i){const l=s.createTracker(i);let c=l.move("[^");const u=s.enter("footnoteDefinition"),h=s.enter("label");return c+=l.move(s.safe(s.associationId(r),{before:c,after:"]"})),h(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?"\n":" ")+s.indentLines(s.containerFlow(r,l.current()),t?XJ:_4e))),u(),c}}function _4e(e,t,n){return t===0?e:XJ(e,t,n)}function XJ(e,t,n){return(n?"":"    ")+e}const w4e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];KJ.peek=M4e;function C4e(){return{canContainEols:["delete"],enter:{strikethrough:O4e},exit:{strikethrough:L4e}}}function I4e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:w4e}],handlers:{delete:KJ}}}function O4e(e){this.enter({type:"delete",children:[]},e)}function L4e(e){this.exit(e)}function KJ(e,t,n,r){const a=n.createTracker(r),s=n.enter("strikethrough");let i=a.move("~~");return i+=n.containerPhrasing(e,he(q({},a.current()),{before:i,after:"~"})),i+=a.move("~~"),s(),i}function M4e(){return"~"}function D4e(e){return e.length}function P4e(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||D4e,s=[],i=[],l=[],c=[];let u=0,h=-1;for(;++h<e.length;){const y=[],b=[];let x=-1;for(e[h].length>u&&(u=e[h].length);++x<e[h].length;){const R=k4e(e[h][x]);if(n.alignDelimiters!==!1){const A=a(R);b[x]=A,(c[x]===void 0||A>c[x])&&(c[x]=A)}y.push(R)}i[h]=y,l[h]=b}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<u;)s[m]=oz(r[m]);else{const y=oz(r);for(;++m<u;)s[m]=y}m=-1;const p=[],g=[];for(;++m<u;){const y=s[m];let b="",x="";y===99?(b=":",x=":"):y===108?b=":":y===114&&(x=":");let R=n.alignDelimiters===!1?1:Math.max(1,c[m]-b.length-x.length);const A=b+"-".repeat(R)+x;n.alignDelimiters!==!1&&(R=b.length+R+x.length,R>c[m]&&(c[m]=R),g[m]=R),p[m]=A}i.splice(1,0,p),l.splice(1,0,g),h=-1;const T=[];for(;++h<i.length;){const y=i[h],b=l[h];m=-1;const x=[];for(;++m<u;){const R=y[m]||"";let A="",w="";if(n.alignDelimiters!==!1){const _=c[m]-(b[m]||0),N=s[m];N===114?A=" ".repeat(_):N===99?_%2?(A=" ".repeat(_/2+.5),w=" ".repeat(_/2-.5)):(A=" ".repeat(_/2),w=A):w=" ".repeat(_)}n.delimiterStart!==!1&&!m&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&R==="")&&(n.delimiterStart!==!1||m)&&x.push(" "),n.alignDelimiters!==!1&&x.push(A),x.push(R),n.alignDelimiters!==!1&&x.push(w),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||m!==u-1)&&x.push("|")}T.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return T.join("\n")}function k4e(e){return e==null?"":String(e)}function oz(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function j4e(e,t,n,r){const a=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const i=n.indentLines(n.containerFlow(e,s.current()),U4e);return a(),i}function U4e(e,t,n){return">"+(n?"":" ")+e}function F4e(e,t){return lz(e,t.inConstruct,!0)&&!lz(e,t.notInConstruct,!1)}function lz(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function cz(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character==="\n"&&F4e(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function $4e(e,t){const n=String(e);let r=n.indexOf(t),a=r,s=0,i=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++s>i&&(i=s):s=1,a=r+t.length,r=n.indexOf(t,a);return i}function B4e(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function H4e(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function V4e(e,t,n,r){const a=H4e(n),s=e.value||"",i=a==="`"?"GraveAccent":"Tilde";if(B4e(e,n)){const m=n.enter("codeIndented"),p=n.indentLines(s,G4e);return m(),p}const l=n.createTracker(r),c=a.repeat(Math.max($4e(s,a)+1,3)),u=n.enter("codeFenced");let h=l.move(c);if(e.lang){const m=n.enter("codeFencedLang".concat(i));h+=l.move(n.safe(e.lang,q({before:h,after:" ",encode:["`"]},l.current()))),m()}if(e.lang&&e.meta){const m=n.enter("codeFencedMeta".concat(i));h+=l.move(" "),h+=l.move(n.safe(e.meta,q({before:h,after:"\n",encode:["`"]},l.current()))),m()}return h+=l.move("\n"),s&&(h+=l.move(s+"\n")),h+=l.move(c),u(),h}function G4e(e,t,n){return(n?"":"    ")+e}function QD(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function z4e(e,t,n,r){const a=QD(n),s=a==='"'?"Quote":"Apostrophe",i=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),q({before:u,after:"]"},c.current()))),u+=c.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,q({before:u,after:">"},c.current()))),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,q({before:u,after:e.title?" ":"\n"},c.current())))),l(),e.title&&(l=n.enter("title".concat(s)),u+=c.move(" "+a),u+=c.move(n.safe(e.title,q({before:u,after:a},c.current()))),u+=c.move(a),l()),i(),u}function q4e(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ng(e){return"&#x"+e.toString(16).toUpperCase()+";"}function b0(e,t,n){const r=Vh(e),a=Vh(t);return r===void 0?a===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}QJ.peek=Y4e;function QJ(e,t,n,r){const a=q4e(n),s=n.enter("emphasis"),i=n.createTracker(r),l=i.move(a);let c=i.move(n.containerPhrasing(e,q({after:a,before:l},i.current())));const u=c.charCodeAt(0),h=b0(r.before.charCodeAt(r.before.length-1),u,a);h.inside&&(c=Ng(u)+c.slice(1));const m=c.charCodeAt(c.length-1),p=b0(r.after.charCodeAt(0),m,a);p.inside&&(c=c.slice(0,-1)+Ng(m));const g=i.move(a);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},l+c+g}function Y4e(e,t,n){return n.options.emphasis||"*"}function W4e(e,t){let n=!1;return XD(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,m1}),!!((!e.depth||e.depth<3)&&HD(e)&&(t.options.setext||n))}function X4e(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(W4e(e,n)){const h=n.enter("headingSetext"),m=n.enter("phrasing"),p=n.containerPhrasing(e,he(q({},s.current()),{before:"\n",after:"\n"}));return m(),h(),p+"\n"+(a===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf("\n"))+1))}const i="#".repeat(a),l=n.enter("headingAtx"),c=n.enter("phrasing");s.move(i+" ");let u=n.containerPhrasing(e,q({before:"# ",after:"\n"},s.current()));return/^[\t ]/.test(u)&&(u=Ng(u.charCodeAt(0))+u.slice(1)),u=u?i+" "+u:i,n.options.closeAtx&&(u+=" "+i),c(),l(),u}JJ.peek=K4e;function JJ(e){return e.value||""}function K4e(){return"<"}ZJ.peek=Q4e;function ZJ(e,t,n,r){const a=QD(n),s=a==='"'?"Quote":"Apostrophe",i=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,q({before:u,after:"]"},c.current()))),u+=c.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,q({before:u,after:">"},c.current()))),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,q({before:u,after:e.title?" ":")"},c.current())))),l(),e.title&&(l=n.enter("title".concat(s)),u+=c.move(" "+a),u+=c.move(n.safe(e.title,q({before:u,after:a},c.current()))),u+=c.move(a),l()),u+=c.move(")"),i(),u}function Q4e(){return"!"}eZ.peek=J4e;function eZ(e,t,n,r){const a=e.referenceType,s=n.enter("imageReference");let i=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,q({before:c,after:"]"},l.current()));c+=l.move(u+"]["),i();const h=n.stack;n.stack=[],i=n.enter("reference");const m=n.safe(n.associationId(e),q({before:c,after:"]"},l.current()));return i(),n.stack=h,s(),a==="full"||!u||u!==m?c+=l.move(m+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function J4e(){return"!"}tZ.peek=Z4e;function tZ(e,t,n){let r=e.value||"",a="`",s=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const i=n.unsafe[s],l=n.compilePattern(i);let c;if(i.atBreak)for(;c=l.exec(r);){let u=c.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(c.index+1)}}return a+r+a}function Z4e(){return"`"}function nZ(e,t){const n=HD(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}rZ.peek=e$e;function rZ(e,t,n,r){const a=QD(n),s=a==='"'?"Quote":"Apostrophe",i=n.createTracker(r);let l,c;if(nZ(e,n)){const h=n.stack;n.stack=[],l=n.enter("autolink");let m=i.move("<");return m+=i.move(n.containerPhrasing(e,q({before:m,after:">"},i.current()))),m+=i.move(">"),l(),n.stack=h,m}l=n.enter("link"),c=n.enter("label");let u=i.move("[");return u+=i.move(n.containerPhrasing(e,q({before:u,after:"]("},i.current()))),u+=i.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=i.move("<"),u+=i.move(n.safe(e.url,q({before:u,after:">"},i.current()))),u+=i.move(">")):(c=n.enter("destinationRaw"),u+=i.move(n.safe(e.url,q({before:u,after:e.title?" ":")"},i.current())))),c(),e.title&&(c=n.enter("title".concat(s)),u+=i.move(" "+a),u+=i.move(n.safe(e.title,q({before:u,after:a},i.current()))),u+=i.move(a),c()),u+=i.move(")"),l(),u}function e$e(e,t,n){return nZ(e,n)?"<":"["}aZ.peek=t$e;function aZ(e,t,n,r){const a=e.referenceType,s=n.enter("linkReference");let i=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,q({before:c,after:"]"},l.current()));c+=l.move(u+"]["),i();const h=n.stack;n.stack=[],i=n.enter("reference");const m=n.safe(n.associationId(e),q({before:c,after:"]"},l.current()));return i(),n.stack=h,s(),a==="full"||!u||u!==m?c+=l.move(m+"]"):a==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function t$e(){return"["}function JD(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function n$e(e){const t=JD(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function r$e(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function sZ(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function a$e(e,t,n,r){const a=n.enter("list"),s=n.bulletCurrent;let i=e.ordered?r$e(n):JD(n);const l=e.ordered?i==="."?")":".":n$e(n);let c=t&&n.bulletLastUsed?i===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((i==="*"||i==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),sZ(n)===i&&h){let m=-1;for(;++m<e.children.length;){const p=e.children[m];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(i=l),n.bulletCurrent=i;const u=n.containerFlow(e,r);return n.bulletLastUsed=i,n.bulletCurrent=s,a(),u}function s$e(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function i$e(e,t,n,r){const a=s$e(n);let s=n.bulletCurrent||JD(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let i=s.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(i=Math.ceil(i/4)*4);const l=n.createTracker(r);l.move(s+" ".repeat(i-s.length)),l.shift(i);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),h);return c(),u;function h(m,p,g){return p?(g?"":" ".repeat(i))+m:(g?s:s+" ".repeat(i-s.length))+m}}function o$e(e,t,n,r){const a=n.enter("paragraph"),s=n.enter("phrasing"),i=n.containerPhrasing(e,r);return s(),a(),i}const l$e=xS(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function c$e(e,t,n,r){return(e.children.some(function(i){return l$e(i)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function u$e(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}iZ.peek=d$e;function iZ(e,t,n,r){const a=u$e(n),s=n.enter("strong"),i=n.createTracker(r),l=i.move(a+a);let c=i.move(n.containerPhrasing(e,q({after:a,before:l},i.current())));const u=c.charCodeAt(0),h=b0(r.before.charCodeAt(r.before.length-1),u,a);h.inside&&(c=Ng(u)+c.slice(1));const m=c.charCodeAt(c.length-1),p=b0(r.after.charCodeAt(0),m,a);p.inside&&(c=c.slice(0,-1)+Ng(m));const g=i.move(a+a);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},l+c+g}function d$e(e,t,n){return n.options.strong||"*"}function h$e(e,t,n,r){return n.safe(e.value,r)}function f$e(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function m$e(e,t,n){const r=(sZ(n)+(n.options.ruleSpaces?" ":"")).repeat(f$e(n));return n.options.ruleSpaces?r.slice(0,-1):r}const oZ={blockquote:j4e,break:cz,code:V4e,definition:z4e,emphasis:QJ,hardBreak:cz,heading:X4e,html:JJ,image:ZJ,imageReference:eZ,inlineCode:tZ,link:rZ,linkReference:aZ,list:a$e,listItem:i$e,paragraph:o$e,root:c$e,strong:iZ,text:h$e,thematicBreak:m$e};function p$e(){return{enter:{table:g$e,tableData:uz,tableHeader:uz,tableRow:T$e},exit:{codeText:y$e,table:E$e,tableData:qC,tableHeader:qC,tableRow:qC}}}function g$e(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function E$e(e){this.exit(e),this.data.inTable=void 0}function T$e(e){this.enter({type:"tableRow",children:[]},e)}function qC(e){this.exit(e)}function uz(e){this.enter({type:"tableCell",children:[]},e)}function y$e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,x$e));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function x$e(e,t){return t==="|"?t:e}function S$e(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:i,tableCell:c,tableRow:l}};function i(g,T,y,b){return u(h(g,y,b),g.align)}function l(g,T,y,b){const x=m(g,y,b),R=u([x]);return R.slice(0,R.indexOf("\n"))}function c(g,T,y,b){const x=y.enter("tableCell"),R=y.enter("phrasing"),A=y.containerPhrasing(g,he(q({},b),{before:s,after:s}));return R(),x(),A}function u(g,T){return P4e(g,{align:T,alignDelimiters:r,padding:n,stringLength:a})}function h(g,T,y){const b=g.children;let x=-1;const R=[],A=T.enter("table");for(;++x<b.length;)R[x]=m(b[x],T,y);return A(),R}function m(g,T,y){const b=g.children;let x=-1;const R=[],A=T.enter("tableRow");for(;++x<b.length;)R[x]=c(b[x],g,T,y);return A(),R}function p(g,T,y){let b=oZ.inlineCode(g,T,y);return y.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function b$e(){return{exit:{taskListCheckValueChecked:dz,taskListCheckValueUnchecked:dz,paragraph:A$e}}}function v$e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:R$e}}}function dz(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function A$e(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let s=-1,i;for(;++s<a.length;){const l=a[s];if(l.type==="paragraph"){i=l;break}}i===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function R$e(e,t,n,r){const a=e.children[0],s=typeof e.checked=="boolean"&&a&&a.type==="paragraph",i="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);s&&l.move(i);let c=oZ.listItem(e,t,n,q(q({},r),l.current()));return s&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),c;function u(h){return h+i}}function N$e(){return[a4e(),R4e(),C4e(),p$e(),b$e()]}function _$e(e){return{extensions:[s4e(),N4e(e),I4e(),S$e(e),v$e()]}}const w$e={tokenize:D$e,partial:!0},lZ={tokenize:P$e,partial:!0},cZ={tokenize:k$e,partial:!0},uZ={tokenize:j$e,partial:!0},C$e={tokenize:U$e,partial:!0},dZ={name:"wwwAutolink",tokenize:L$e,previous:fZ},hZ={name:"protocolAutolink",tokenize:M$e,previous:mZ},Yo={name:"emailAutolink",tokenize:O$e,previous:pZ},no={};function I$e(){return{text:no}}let Pc=48;for(;Pc<123;)no[Pc]=Yo,Pc++,Pc===58?Pc=65:Pc===91&&(Pc=97);no[43]=Yo;no[45]=Yo;no[46]=Yo;no[95]=Yo;no[72]=[Yo,hZ];no[104]=[Yo,hZ];no[87]=[Yo,dZ];no[119]=[Yo,dZ];function O$e(e,t,n){const r=this;let a,s;return i;function i(m){return!T1(m)||!pZ.call(r,r.previous)||ZD(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(m))}function l(m){return T1(m)?(e.consume(m),l):m===64?(e.consume(m),c):n(m)}function c(m){return m===46?e.check(C$e,h,u)(m):m===45||m===95||Oa(m)?(s=!0,e.consume(m),c):h(m)}function u(m){return e.consume(m),a=!0,c}function h(m){return s&&a&&Ha(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function L$e(e,t,n){const r=this;return a;function a(i){return i!==87&&i!==119||!fZ.call(r,r.previous)||ZD(r.events)?n(i):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(w$e,e.attempt(lZ,e.attempt(cZ,s),n),n)(i))}function s(i){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(i)}}function M$e(e,t,n){const r=this;let a="",s=!1;return i;function i(m){return(m===72||m===104)&&mZ.call(r,r.previous)&&!ZD(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(m),e.consume(m),l):n(m)}function l(m){if(Ha(m)&&a.length<5)return a+=String.fromCodePoint(m),e.consume(m),l;if(m===58){const p=a.toLowerCase();if(p==="http"||p==="https")return e.consume(m),c}return n(m)}function c(m){return m===47?(e.consume(m),s?u:(s=!0,c)):n(m)}function u(m){return m===null||y0(m)||Kn(m)||wu(m)||ES(m)?n(m):e.attempt(lZ,e.attempt(cZ,h),n)(m)}function h(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function D$e(e,t,n){let r=0;return a;function a(i){return(i===87||i===119)&&r<3?(r++,e.consume(i),a):i===46&&r===3?(e.consume(i),s):n(i)}function s(i){return i===null?n(i):t(i)}}function P$e(e,t,n){let r,a,s;return i;function i(u){return u===46||u===95?e.check(uZ,c,l)(u):u===null||Kn(u)||wu(u)||u!==45&&ES(u)?c(u):(s=!0,e.consume(u),i)}function l(u){return u===95?r=!0:(a=r,r=void 0),e.consume(u),i}function c(u){return a||r||!s?n(u):t(u)}}function k$e(e,t){let n=0,r=0;return a;function a(i){return i===40?(n++,e.consume(i),a):i===41&&r<n?s(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?e.check(uZ,t,s)(i):i===null||Kn(i)||wu(i)?t(i):(e.consume(i),a)}function s(i){return i===41&&r++,e.consume(i),a}}function j$e(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),s):l===93?(e.consume(l),a):l===60||l===null||Kn(l)||wu(l)?t(l):n(l)}function a(l){return l===null||l===40||l===91||Kn(l)||wu(l)?t(l):r(l)}function s(l){return Ha(l)?i(l):n(l)}function i(l){return l===59?(e.consume(l),r):Ha(l)?(e.consume(l),i):n(l)}}function U$e(e,t,n){return r;function r(s){return e.consume(s),a}function a(s){return Oa(s)?n(s):t(s)}}function fZ(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Kn(e)}function mZ(e){return!Ha(e)}function pZ(e){return!(e===47||T1(e))}function T1(e){return e===43||e===45||e===46||e===95||Oa(e)}function ZD(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const F$e={tokenize:Y$e,partial:!0};function $$e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:G$e,continuation:{tokenize:z$e},exit:q$e}},text:{91:{name:"gfmFootnoteCall",tokenize:V$e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:B$e,resolveTo:H$e}}}}function B$e(e,t,n){const r=this;let a=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i;for(;a--;){const c=r.events[a][1];if(c.type==="labelImage"){i=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return l;function l(c){if(!i||!i._balanced)return n(c);const u=pi(r.sliceSerialize({start:i.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function H$e(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function V$e(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,i;return l;function l(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(m){if(s>999||m===93&&!i||m===null||m===91||Kn(m))return n(m);if(m===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return a.includes(pi(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Kn(m)||(i=!0),s++,e.consume(m),m===92?h:u}function h(m){return m===91||m===92||m===93?(e.consume(m),s++,u):u(m)}}function G$e(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,i=0,l;return c;function c(T){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(T),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(T){return T===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(T),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(T)}function h(T){if(i>999||T===93&&!l||T===null||T===91||Kn(T))return n(T);if(T===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return s=pi(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(T),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Kn(T)||(l=!0),i++,e.consume(T),T===92?m:h}function m(T){return T===91||T===92||T===93?(e.consume(T),i++,h):h(T)}function p(T){return T===58?(e.enter("definitionMarker"),e.consume(T),e.exit("definitionMarker"),a.includes(s)||a.push(s),mn(e,g,"gfmFootnoteDefinitionWhitespace")):n(T)}function g(T){return t(T)}}function z$e(e,t,n){return e.check(qg,t,e.attempt(F$e,t,n))}function q$e(e){e.exit("gfmFootnoteDefinition")}function Y$e(e,t,n){const r=this;return mn(e,a,"gfmFootnoteDefinitionIndent",5);function a(s){const i=r.events[r.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?t(s):n(s)}}function W$e(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(i,l){let c=-1;for(;++c<i.length;)if(i[c][0]==="enter"&&i[c][1].type==="strikethroughSequenceTemporary"&&i[c][1]._close){let u=c;for(;u--;)if(i[u][0]==="exit"&&i[u][1].type==="strikethroughSequenceTemporary"&&i[u][1]._open&&i[c][1].end.offset-i[c][1].start.offset===i[u][1].end.offset-i[u][1].start.offset){i[c][1].type="strikethroughSequence",i[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},i[u][1].start),end:Object.assign({},i[c][1].end)},m={type:"strikethroughText",start:Object.assign({},i[u][1].end),end:Object.assign({},i[c][1].start)},p=[["enter",h,l],["enter",i[u][1],l],["exit",i[u][1],l],["enter",m,l]],g=l.parser.constructs.insideSpan.null;g&&bs(p,p.length,0,TS(g,i.slice(u+1,c),l)),bs(p,p.length,0,[["exit",m,l],["enter",i[c][1],l],["exit",i[c][1],l],["exit",h,l]]),bs(i,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<i.length;)i[c][1].type==="strikethroughSequenceTemporary"&&(i[c][1].type="data");return i}function s(i,l,c){const u=this.previous,h=this.events;let m=0;return p;function p(T){return u===126&&h[h.length-1][1].type!=="characterEscape"?c(T):(i.enter("strikethroughSequenceTemporary"),g(T))}function g(T){const y=Vh(u);if(T===126)return m>1?c(T):(i.consume(T),m++,g);if(m<2&&!n)return c(T);const b=i.exit("strikethroughSequenceTemporary"),x=Vh(T);return b._open=!x||x===2&&!!y,b._close=!y||y===2&&!!x,l(T)}}}class X$e{constructor(){this.map=[]}add(t,n,r){K$e(this,t,n,r)}consume(t){if(this.map.sort(function(s,i){return s[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const s of a)t.push(s);a=r.pop()}this.map.length=0}}function K$e(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function Q$e(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function J$e(){return{flow:{null:{name:"table",tokenize:Z$e,resolveAll:eBe}}}}function Z$e(e,t,n){const r=this;let a=0,s=0,i;return l;function l(O){let L=r.events.length-1;for(;L>-1;){const U=r.events[L][1].type;if(U==="lineEnding"||U==="linePrefix")L--;else break}const k=L>-1?r.events[L][1].type:null,F=k==="tableHead"||k==="tableRow"?N:c;return F===N&&r.parser.lazy[r.now().line]?n(O):F(O)}function c(O){return e.enter("tableHead"),e.enter("tableRow"),u(O)}function u(O){return O===124||(i=!0,s+=1),h(O)}function h(O){return O===null?n(O):It(O)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),g):n(O):cn(O)?mn(e,h,"whitespace")(O):(s+=1,i&&(i=!1,a+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),i=!0,h):(e.enter("data"),m(O)))}function m(O){return O===null||O===124||Kn(O)?(e.exit("data"),h(O)):(e.consume(O),O===92?p:m)}function p(O){return O===92||O===124?(e.consume(O),m):m(O)}function g(O){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(O):(e.enter("tableDelimiterRow"),i=!1,cn(O)?mn(e,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):T(O))}function T(O){return O===45||O===58?b(O):O===124?(i=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),y):_(O)}function y(O){return cn(O)?mn(e,b,"whitespace")(O):b(O)}function b(O){return O===58?(s+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),x):O===45?(s+=1,x(O)):O===null||It(O)?w(O):_(O)}function x(O){return O===45?(e.enter("tableDelimiterFiller"),R(O)):_(O)}function R(O){return O===45?(e.consume(O),R):O===58?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(O))}function A(O){return cn(O)?mn(e,w,"whitespace")(O):w(O)}function w(O){return O===124?T(O):O===null||It(O)?!i||a!==s?_(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(O)):_(O)}function _(O){return n(O)}function N(O){return e.enter("tableRow"),I(O)}function I(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),I):O===null||It(O)?(e.exit("tableRow"),t(O)):cn(O)?mn(e,I,"whitespace")(O):(e.enter("data"),D(O))}function D(O){return O===null||O===124||Kn(O)?(e.exit("data"),I(O)):(e.consume(O),O===92?M:D)}function M(O){return O===92||O===124?(e.consume(O),D):D(O)}}function eBe(e,t){let n=-1,r=!0,a=0,s=[0,0,0,0],i=[0,0,0,0],l=!1,c=0,u,h,m;const p=new X$e;for(;++n<e.length;){const g=e[n],T=g[1];g[0]==="enter"?T.type==="tableHead"?(l=!1,c!==0&&(hz(p,t,c,u,h),h=void 0,c=0),u={type:"table",start:Object.assign({},T.start),end:Object.assign({},T.end)},p.add(n,0,[["enter",u,t]])):T.type==="tableRow"||T.type==="tableDelimiterRow"?(r=!0,m=void 0,s=[0,0,0,0],i=[0,n+1,0,0],l&&(l=!1,h={type:"tableBody",start:Object.assign({},T.start),end:Object.assign({},T.end)},p.add(n,0,[["enter",h,t]])),a=T.type==="tableDelimiterRow"?2:h?3:1):a&&(T.type==="data"||T.type==="tableDelimiterMarker"||T.type==="tableDelimiterFiller")?(r=!1,i[2]===0&&(s[1]!==0&&(i[0]=i[1],m=WT(p,t,s,a,void 0,m),s=[0,0,0,0]),i[2]=n)):T.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(i[0]=i[1],m=WT(p,t,s,a,void 0,m)),s=i,i=[s[1],n,0,0])):T.type==="tableHead"?(l=!0,c=n):T.type==="tableRow"||T.type==="tableDelimiterRow"?(c=n,s[1]!==0?(i[0]=i[1],m=WT(p,t,s,a,n,m)):i[1]!==0&&(m=WT(p,t,i,a,n,m)),a=0):a&&(T.type==="data"||T.type==="tableDelimiterMarker"||T.type==="tableDelimiterFiller")&&(i[3]=n)}for(c!==0&&hz(p,t,c,u,h),p.consume(t.events),n=-1;++n<t.events.length;){const g=t.events[n];g[0]==="enter"&&g[1].type==="table"&&(g[1]._align=Q$e(t.events,n))}return e}function WT(e,t,n,r,a,s){const i=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(s.end=Object.assign({},Wd(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const c=Wd(t.events,n[1]);if(s={type:i,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=Wd(t.events,n[2]),h=Wd(t.events,n[3]),m={type:l,start:Object.assign({},u),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",m,t]]),r!==2){const p=t.events[n[2]],g=t.events[n[3]];if(p[1].end=Object.assign({},g[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const T=n[2]+1,y=n[3]-n[2]-1;e.add(T,y,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return a!==void 0&&(s.end=Object.assign({},Wd(t.events,a)),e.add(a,0,[["exit",s,t]]),s=void 0),s}function hz(e,t,n,r,a){const s=[],i=Wd(t.events,n);a&&(a.end=Object.assign({},i),s.push(["exit",a,t])),r.end=Object.assign({},i),s.push(["exit",r,t]),e.add(n+1,0,s)}function Wd(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const tBe={name:"tasklistCheck",tokenize:rBe};function nBe(){return{text:{91:tBe}}}function rBe(e,t,n){const r=this;return a;function a(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),s)}function s(c){return Kn(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),i):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),i):n(c)}function i(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(c)}function l(c){return It(c)?t(c):cn(c)?e.check({tokenize:aBe},t,n)(c):n(c)}}function aBe(e,t,n){return mn(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function sBe(e){return RJ([I$e(),$$e(),W$e(e),J$e(),nBe()])}const iBe={};function gZ(e){const t=this,n=e||iBe,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),i=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(sBe(n)),s.push(N$e()),i.push(_$e(n))}class oBe extends Ht.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){var r;const n=t.message.includes("InstantiationService has been disposed")||t.message.includes("domNode")||t.message.includes("monaco")||((r=t.stack)==null?void 0:r.includes("monaco"));return{hasError:n,error:n?t:void 0}}componentDidCatch(t,n){this.state.hasError}render(){return this.state.hasError?o.jsx("div",{className:"flex items-center justify-center p-4 bg-red-500/10 border border-red-500/20 rounded",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Cn,{className:"w-8 h-8 text-red-400 mx-auto mb-2"}),o.jsx("p",{className:"text-sm text-red-400 mb-3",children:"Editor temporarily unavailable"}),o.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>{this.setState({hasError:!1,error:void 0})},className:"text-red-400 hover:text-red-300",children:[o.jsx(ma,{className:"w-4 h-4 mr-1"}),"Retry"]})]})}):this.props.children}}const lBe=({cell:e,isActive:t,onActivate:n,cellNumber:r})=>{const{t:a}=Ze(),{updateCell:s,deleteCell:i,executeCell:l,moveCell:c,clearCell:u,toggleCellEditMode:h,toggleCellInputCollapse:m,toggleCellOutputCollapse:p,isExecuting:g}=Ia(),[T,y]=v.useState(!1),[b,x]=v.useState(null),R=v.useRef(null),A=v.useRef(null);v.useEffect(()=>{const O=L=>{R.current&&!R.current.contains(L.target)&&y(!1),e.type==="markdown"&&e.isEditing&&A.current&&!A.current.contains(L.target)&&h(e.id)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[e.type,e.isEditing,e.id,h]);const w=()=>H(null,null,function*(){const O=performance.now();yield l(e.id);const L=performance.now();x(L-O)}),_=()=>{navigator.clipboard.writeText(e.code),y(!1)},N=()=>{e.type==="markdown"&&h(e.id)},I=O=>{const k={bold:"**text**",italic:"*text*",h1:"# ",h2:"## ",h3:"### ",list:"- ",quote:"> ",link:"[text](url)",code:"`code`"}[O]||O,F=e.code+k;s(e.id,F)},D=v.useCallback((()=>{let O;return(L,k)=>{clearTimeout(O),O=setTimeout(()=>{s(L,k)},100)}})(),[s]),M=O=>{switch(O.type){case"text":return o.jsx("div",{className:"font-mono text-sm text-white/90 whitespace-pre-wrap",children:O.content});case"error":return o.jsx("div",{className:"font-mono text-sm text-red-400 whitespace-pre-wrap bg-red-500/10 p-3 rounded border border-red-500/20",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(Cn,{size:16,className:"text-red-400 mt-0.5 flex-shrink-0"}),o.jsx("div",{children:O.content})]})});case"image":return o.jsxs("div",{className:"bg-white/5 p-3 rounded border border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(wfe,{size:16,className:"text-blue-400"}),o.jsx("span",{className:"text-sm text-white/70",children:a("notebooks.pythonCell.plotOutput",{defaultValue:"Plot Output"})})]}),o.jsx("img",{src:O.content,alt:a("notebooks.pythonCell.plotOutputAlt",{defaultValue:"Python plot output"}),className:"max-w-full h-auto rounded border border-white/10"})]});case"dataframe":const L=Rje(O.content);return o.jsxs("div",{className:"bg-white/5 p-3 rounded border border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(Bl,{size:16,className:"text-green-400"}),o.jsxs("span",{className:"text-sm text-white/70",children:["DataFrame (",L.shape[0]," rows × ",L.shape[1]," columns)"]}),L.memory_usage&&o.jsxs("span",{className:"text-xs text-white/50",children:[(L.memory_usage/1024/1024).toFixed(2)," MB"]})]}),o.jsxs("div",{className:"mb-3",children:[o.jsx("div",{className:"text-xs text-white/60 mb-1",children:a("notebooks.pythonCell.columns",{defaultValue:"Columns:"})}),o.jsx("div",{className:"flex flex-wrap gap-1",children:L.columns.map((k,F)=>o.jsx("span",{className:"text-xs bg-white/10 px-2 py-1 rounded",title:"".concat(k,": ").concat(L.dtypes[k]||"unknown"),children:k},F))})]}),L.preview.length>0&&o.jsxs("div",{className:"overflow-x-auto",children:[o.jsxs("table",{className:"w-full text-xs",children:[o.jsx("thead",{children:o.jsx("tr",{className:"border-b border-white/10",children:L.columns.map((k,F)=>o.jsx("th",{className:"text-left p-2 text-white/80 font-medium",children:k},F))})}),o.jsx("tbody",{children:L.preview.slice(0,10).map((k,F)=>o.jsx("tr",{className:"border-b border-white/5",children:k.map((U,B)=>o.jsx("td",{className:"p-2 text-white/70",children:String(U).length>50?String(U).substring(0,50)+"...":String(U)},B))},F))})]}),L.preview.length>10&&o.jsx("div",{className:"text-xs text-white/50 p-2",children:a("notebooks.pythonCell.moreRows",{defaultValue:"... and {{count}} more rows",count:L.preview.length-10})})]})]});case"html":return o.jsxs("div",{className:"bg-white/5 p-3 rounded border border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Xn,{size:16,className:"text-purple-400"}),o.jsx("span",{className:"text-sm text-white/70",children:a("notebooks.pythonCell.htmlOutput",{defaultValue:"HTML Output"})})]}),o.jsx("div",{className:"prose prose-invert max-w-none",dangerouslySetInnerHTML:{__html:O.content}})]});default:return o.jsx("div",{className:"font-mono text-sm text-white/70 whitespace-pre-wrap",children:O.content})}};return o.jsxs("div",{ref:A,className:"border rounded-lg overflow-visible transition-colors ".concat(t?"border-primary/50 bg-primary/5":"border-white/10 bg-black/20"),onClick:n,children:[o.jsxs("div",{className:"flex items-center justify-between px-2.5 py-1.5 bg-darkNav/50 border-b border-white/10 relative",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:O=>{O.stopPropagation(),m(e.id)},className:"p-1 hover:bg-white/10 rounded transition-colors",title:e.isInputCollapsed?a("notebooks.pythonCell.expandInput",{defaultValue:"Expand input"}):a("notebooks.pythonCell.collapseInput",{defaultValue:"Collapse input"}),children:o.jsx(nr,{size:14,className:"text-white/50 transition-transform ".concat(e.isInputCollapsed?"":"rotate-90")})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-white/50",children:"In"}),o.jsx("span",{className:"text-xs font-mono bg-white/10 px-2 py-1 rounded",children:e.executionCount||r})]}),e.isExecuting&&o.jsxs("div",{className:"flex items-center gap-2 text-xs text-blue-400",children:[o.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full animate-pulse"}),o.jsx("span",{children:a("notebooks.pythonCell.executing",{defaultValue:"Executing..."})})]}),b&&!e.isExecuting&&o.jsxs("div",{className:"flex items-center gap-1 text-xs text-white/50",children:[o.jsx(du,{size:12}),o.jsxs("span",{children:[b.toFixed(0),"ms"]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[e.type==="code"&&o.jsx(Ut,{content:a("notebooks.pythonCell.executeTooltip",{defaultValue:"Execute Cell (Shift+Enter)"}),placement:"bottom",children:o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:O=>{O.stopPropagation(),w()},disabled:e.isExecuting||g||!e.code.trim(),title:"",children:e.isExecuting?o.jsx(q5,{size:14}):o.jsx($l,{size:14})})}),e.type==="markdown"&&o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:O=>{O.stopPropagation(),N()},title:e.isEditing?a("notebooks.pythonCell.previewMarkdown",{defaultValue:"Preview Markdown"}):a("notebooks.pythonCell.editMarkdown",{defaultValue:"Edit Markdown"}),children:e.isEditing?o.jsx(Jr,{size:14}):o.jsx(ML,{size:14})}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:O=>{O.stopPropagation(),i(e.id)},title:a("notebooks.pythonCell.deleteCell",{defaultValue:"Delete Cell"}),children:o.jsx(Hl,{size:14})}),o.jsxs("div",{className:"relative",ref:R,children:[o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:O=>{O.stopPropagation(),y(!T)},children:o.jsx(_L,{size:14})}),T&&o.jsxs("div",{className:"absolute right-0 top-full mt-1 bg-black border border-white/10 rounded shadow-xl z-50 min-w-40",children:[o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:O=>{O.preventDefault(),O.stopPropagation(),c(e.id,"up"),setTimeout(()=>y(!1),100)},children:[o.jsx($0,{size:14}),a("notebooks.pythonCell.moveUp",{defaultValue:"Move Up"})]}),o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:O=>{O.preventDefault(),O.stopPropagation(),c(e.id,"down"),setTimeout(()=>y(!1),100)},children:[o.jsx(br,{size:14}),a("notebooks.pythonCell.moveDown",{defaultValue:"Move Down"})]}),o.jsx("div",{className:"border-t border-white/10"}),o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:_,children:[o.jsx(gi,{size:14}),a("notebooks.pythonCell.copyCode",{defaultValue:"Copy Code"})]}),o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:()=>{u(e.id),y(!1)},children:[o.jsx(q5,{size:14}),a("notebooks.pythonCell.clearOutput",{defaultValue:"Clear Output"})]}),o.jsx("div",{className:"border-t border-white/10"}),o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:()=>{m(e.id),y(!1)},children:[o.jsx(Jr,{size:14}),e.isInputCollapsed?a("notebooks.pythonCell.showInput",{defaultValue:"Show Input"}):a("notebooks.pythonCell.hideInput",{defaultValue:"Hide Input"})]}),e.type==="code"&&e.output.length>0&&o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:()=>{p(e.id),y(!1)},children:[o.jsx(Jr,{size:14}),e.isOutputCollapsed?a("notebooks.pythonCell.showOutput",{defaultValue:"Show Output"}):a("notebooks.pythonCell.hideOutput",{defaultValue:"Hide Output"})]})]})]})]})]}),e.type==="markdown"&&e.isEditing&&o.jsx("div",{className:"px-3 py-2 bg-darkNav/30 border-b border-white/10",children:o.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[o.jsx("button",{onClick:()=>I("bold"),className:"p-1 hover:bg-white/10 rounded transition-colors",title:a("notebooks.pythonCell.bold",{defaultValue:"Bold"}),children:o.jsx(dhe,{size:12})}),o.jsx("button",{onClick:()=>I("italic"),className:"p-1 hover:bg-white/10 rounded transition-colors",title:a("notebooks.pythonCell.italic",{defaultValue:"Italic"}),children:o.jsx(Ofe,{size:12})}),o.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),o.jsx("button",{onClick:()=>I("h1"),className:"px-2 py-1 hover:bg-white/10 rounded transition-colors font-mono",title:a("notebooks.pythonCell.header1",{defaultValue:"Header 1"}),children:"H1"}),o.jsx("button",{onClick:()=>I("h2"),className:"px-2 py-1 hover:bg-white/10 rounded transition-colors font-mono",title:a("notebooks.pythonCell.header2",{defaultValue:"Header 2"}),children:"H2"}),o.jsx("button",{onClick:()=>I("h3"),className:"px-2 py-1 hover:bg-white/10 rounded transition-colors font-mono",title:a("notebooks.pythonCell.header3",{defaultValue:"Header 3"}),children:"H3"}),o.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),o.jsx("button",{onClick:()=>I("list"),className:"p-1 hover:bg-white/10 rounded transition-colors",title:a("notebooks.pythonCell.list",{defaultValue:"List"}),children:o.jsx(hh,{size:12})}),o.jsx("button",{onClick:()=>I("quote"),className:"p-1 hover:bg-white/10 rounded transition-colors",title:a("notebooks.pythonCell.quote",{defaultValue:"Quote"}),children:o.jsx(hme,{size:12})}),o.jsx("button",{onClick:()=>I("link"),className:"p-1 hover:bg-white/10 rounded transition-colors",title:a("notebooks.pythonCell.link",{defaultValue:"Link"}),children:o.jsx(IL,{size:12})}),o.jsx("button",{onClick:()=>I("code"),className:"p-1 hover:bg-white/10 rounded transition-colors",title:a("notebooks.pythonCell.inlineCode",{defaultValue:"Inline Code"}),children:o.jsx(B0,{size:12})})]})}),!e.isInputCollapsed&&o.jsx("div",{className:"border-b border-white/10",children:e.type==="code"||e.type==="markdown"&&e.isEditing?o.jsx(oBe,{cellId:e.id,children:o.jsx(i1,{value:e.code,onChange:O=>D(e.id,O||""),onExecute:()=>w(),language:e.type==="code"?"python":"markdown",height:"auto",minHeight:80,maxHeight:2e3},"monaco-".concat(e.id))}):o.jsx("div",{className:"p-4 min-h-[100px] cursor-text",onClick:N,children:e.code.trim()?o.jsx("div",{className:"markdown-content",children:o.jsx(qJ,{remarkPlugins:[gZ],components:{h1:({children:O})=>o.jsx("h1",{className:"text-2xl font-bold text-white font-heading mb-4",children:O}),h2:({children:O})=>o.jsx("h2",{className:"text-xl font-semibold text-white font-heading mb-3",children:O}),h3:({children:O})=>o.jsx("h3",{className:"text-lg font-medium text-white font-heading mb-2",children:O}),p:({children:O})=>o.jsx("p",{className:"text-white/90 leading-relaxed mb-3",children:O}),strong:({children:O})=>o.jsx("strong",{className:"text-white font-semibold",children:O}),em:({children:O})=>o.jsx("em",{className:"text-white/80 italic",children:O}),ul:({children:O})=>o.jsx("ul",{className:"text-white/90 list-disc list-inside mb-3 space-y-1",children:O}),ol:({children:O})=>o.jsx("ol",{className:"text-white/90 list-decimal list-inside mb-3 space-y-1",children:O}),li:({children:O})=>o.jsx("li",{className:"text-white/90",children:O}),code:({children:O})=>o.jsx("code",{className:"text-green-400 bg-white/10 px-1 py-0.5 rounded text-sm font-mono",children:O}),blockquote:({children:O})=>o.jsx("blockquote",{className:"border-l-4 border-primary bg-white/5 p-3 rounded-r mb-3",children:O}),a:({children:O,href:L})=>o.jsx("a",{href:L,className:"text-primary underline decoration-primary/50 hover:decoration-primary",children:O})},children:e.code})}):o.jsx("div",{className:"text-white/50 italic",children:a("notebooks.pythonCell.clickToEdit",{defaultValue:"Click to edit markdown..."})})})}),e.type==="code"&&e.output.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 bg-darkNav/30 border-b border-white/10",children:[o.jsx("button",{onClick:O=>{O.stopPropagation(),p(e.id)},className:"p-1 hover:bg-white/10 rounded transition-colors",title:e.isOutputCollapsed?a("notebooks.pythonCell.expandOutput",{defaultValue:"Expand output"}):a("notebooks.pythonCell.collapseOutput",{defaultValue:"Collapse output"}),children:o.jsx(nr,{size:14,className:"text-white/50 transition-transform ".concat(e.isOutputCollapsed?"":"rotate-90")})}),o.jsx("span",{className:"text-xs text-white/50",children:a("notebooks.pythonCell.output",{defaultValue:"Output"})})]}),!e.isOutputCollapsed&&o.jsx("div",{className:"p-3 space-y-3",children:e.output.map(O=>o.jsx("div",{className:"overflow-x-auto",children:M(O)},O.id))})]})]})},fz=({insertIndex:e,isLastCell:t=!1})=>{const{createCell:n}=Ia(),[r,a]=v.useState(!1),s=i=>{n(i,"",e)};return o.jsxs("div",{className:"relative flex items-center justify-center group transition-all duration-200 ".concat(t?"py-4":"py-2"),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[o.jsx("div",{className:"absolute inset-x-0 h-px bg-white/10 transition-opacity ".concat(r||t?"opacity-100":"opacity-30")}),o.jsxs("div",{className:"flex items-center bg-black border border-white/10 rounded-md shadow-lg transition-all duration-200 ".concat(r||t?"opacity-100 scale-100":"opacity-0 scale-95"),children:[o.jsxs("button",{onClick:()=>s("code"),className:"flex items-center gap-2 px-3 py-2 text-xs text-white/70 hover:text-white hover:bg-white/10 transition-colors rounded-l-md border-r border-white/10",title:"Add Code Cell",children:[o.jsx(B0,{size:12}),o.jsx("span",{children:"Code"})]}),o.jsxs("button",{onClick:()=>s("markdown"),className:"flex items-center gap-2 px-3 py-2 text-xs text-white/70 hover:text-white hover:bg-white/10 transition-colors rounded-r-md",title:"Add Text Cell",children:[o.jsx(Kh,{size:12}),o.jsx("span",{children:"Text"})]})]})]})},cBe=()=>{const{savedScripts:e,currentScript:t,loadScript:n,deleteScript:r,duplicateScript:a,importScript:s,exportScript:i,saveScript:l}=Ia(),[c,u]=v.useState(null),[h,m]=v.useState(""),[p,g]=v.useState(null);return{editingName:c,newName:h,showMenu:p,setNewName:m,setShowMenu:g,handleLoadScript:N=>{n(N.id),g(null)},handleDeleteScript:N=>{confirm("Are you sure you want to delete this script?")&&r(N),g(null)},handleDuplicateScript:N=>{a(N),g(null)},handleExportScript:N=>{try{const I=i(N.id),D=new Blob([I],{type:"application/json"}),M=URL.createObjectURL(D),O=document.createElement("a");O.href=M,O.download="".concat(N.name.replace(/[^a-z0-9]/gi,"_"),".json"),document.body.appendChild(O),O.click(),document.body.removeChild(O),URL.revokeObjectURL(M)}catch(I){}g(null)},handleImportScript:N=>{var D;const I=(D=N.target.files)==null?void 0:D[0];I&&(s(I).catch(M=>{alert("Failed to import script: "+M.message)}),N.target.value="")},startRenaming:N=>{u(N.id),m(N.name),g(null)},saveRename:N=>{const I=e.find(D=>D.id===N);if(I&&h.trim()){const D=he(q({},I),{name:h.trim(),updatedAt:new Date}),M=e.map(O=>O.id===N?D:O);Ia.setState({savedScripts:M,currentScript:(t==null?void 0:t.id)===N?D:t})}u(null),m("")},cancelRename:()=>{u(null),m("")},savedScripts:e,currentScript:t}},uBe=()=>{const{t:e}=Ze(),[t,n]=v.useState(""),[r,a]=v.useState(null),{showSaveDialog:s,showSaveConfirm:i,handleCreateNewNotebook:l,handleSaveDialogComplete:c,handleCloseSaveDialog:u,handleSaveAndContinue:h,handleDiscardAndContinue:m,handleCloseSaveConfirm:p}=lJ(),{editingName:g,newName:T,showMenu:y,setNewName:b,setShowMenu:x,handleLoadScript:R,handleDeleteScript:A,handleDuplicateScript:w,handleExportScript:_,handleImportScript:N,startRenaming:I,saveRename:D,cancelRename:M,savedScripts:O,currentScript:L}=cBe(),k=O.filter(B=>B.name.toLowerCase().includes(t.toLowerCase())||B.description&&B.description.toLowerCase().includes(t.toLowerCase())),F=B=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(B)),U=B=>{const G=new Date().getTime()-new Date(B).getTime(),K=Math.floor(G/(1e3*60)),J=Math.floor(G/(1e3*60*60)),$=Math.floor(G/(1e3*60*60*24));return K<60?K<=1?e("notebooks.scriptHistory.justNow",{defaultValue:"Just now"}):e("notebooks.scriptHistory.minutesAgo",{defaultValue:"{{count}}m ago",count:K}):J<24?e("notebooks.scriptHistory.hoursAgo",{defaultValue:"{{count}}h ago",count:J}):$<7?e("notebooks.scriptHistory.daysAgo",{defaultValue:"{{count}}d ago",count:$}):F(B)};return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(VW,{className:"w-5 h-5 text-primary"}),o.jsx("h3",{className:"font-medium text-white",children:e("notebooks.scriptHistory.title",{defaultValue:"Notebooks"})})]}),o.jsxs("div",{className:"relative mb-3",children:[o.jsx(Qi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-white/50"}),o.jsx("input",{type:"text",placeholder:e("notebooks.scriptHistory.searchPlaceholder",{defaultValue:"Search Notebooks..."}),className:"w-full pl-10 pr-4 py-2 bg-background border border-white/10 rounded text-sm text-white placeholder:text-white/50 focus:outline-none focus:border-primary/50",value:t,onChange:B=>n(B.target.value)})]}),o.jsxs(je,{variant:"outline",size:"sm",onClick:l,className:"w-full mb-3 h-8 border-white/30 text-white/80 hover:bg-white/10 hover:border-white/30",title:e("notebooks.scriptHistory.createNewNotebook",{defaultValue:"Create New Notebook"}),children:[o.jsx(wp,{className:"w-4 h-4 mr-2"}),e("notebooks.scriptHistory.newNotebook",{defaultValue:"New Notebook"})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-xs text-white/60",children:e("notebooks.scriptHistory.savedScriptsCount",{defaultValue:"{{count}} saved scripts",count:O.length})}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",accept:".ipynb,.py",onChange:N,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",title:e("notebooks.scriptHistory.importScript",{defaultValue:"Import script"})}),o.jsxs(je,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",title:e("notebooks.scriptHistory.importScript",{defaultValue:"Import Script"}),children:[o.jsx(G0,{className:"w-3 h-3 mr-1"}),e("notebooks.scriptHistory.import",{defaultValue:"Import"})]})]})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:k.length===0?o.jsxs("div",{className:"p-4 text-center",children:[o.jsx(Nfe,{className:"w-8 h-8 text-white/30 mx-auto mb-2"}),o.jsx("p",{className:"text-sm text-white/60",children:t?e("notebooks.scriptHistory.noScriptsFound",{defaultValue:"No scripts found"}):e("notebooks.scriptHistory.noSavedScripts",{defaultValue:"No saved scripts"})}),!t&&o.jsx("p",{className:"text-xs text-white/40 mt-1",children:e("notebooks.scriptHistory.saveFirstScript",{defaultValue:"Save your first script to see it here"})})]}):o.jsx("div",{className:"space-y-1 p-2",children:k.map(B=>o.jsx("div",{className:"relative group rounded-lg p-3 transition-colors ".concat((L==null?void 0:L.id)===B.id?"bg-primary/20 border border-primary/30":"bg-white/5 hover:bg-white/10"),onClick:()=>a(r===B.id?null:B.id),children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[g===B.id?o.jsx("div",{className:"flex items-center gap-2 mb-2",children:o.jsx("input",{type:"text",value:T,onChange:j=>b(j.target.value),className:"flex-1 px-2 py-1 bg-background border border-white/20 rounded text-sm text-white focus:outline-none focus:border-primary/50",onKeyDown:j=>{j.key==="Enter"&&D(B.id),j.key==="Escape"&&M()},onBlur:()=>M(),autoFocus:!0})}):o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h4",{className:"font-medium text-white text-sm truncate",children:B.name}),(L==null?void 0:L.id)===B.id&&o.jsx("span",{className:"text-xs bg-primary/20 text-primary px-2 py-0.5 rounded",children:e("notebooks.scriptHistory.current",{defaultValue:"Current"})})]}),B.description&&o.jsx("p",{className:"text-xs text-white/60 mb-2 line-clamp-2",children:B.description}),o.jsxs("div",{className:"flex items-center gap-4 text-xs text-white/50",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Fl,{className:"w-3 h-3"}),o.jsx("span",{children:U(B.updatedAt)})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Xn,{className:"w-3 h-3"}),o.jsx("span",{children:e("notebooks.scriptHistory.cellsCount",{defaultValue:"{{count}} cells",count:B.cells.length})})]}),B.cells.some(j=>j.executionCount)&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx($l,{className:"w-3 h-3"}),o.jsx("span",{children:e("notebooks.scriptHistory.executed",{defaultValue:"Executed"})})]})]})]}),o.jsxs("div",{className:"relative",children:[o.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 opacity-100 transition-opacity",onClick:j=>{j.stopPropagation(),x(y===B.id?null:B.id)},children:o.jsx(_L,{className:"w-4 h-4"})}),y===B.id&&o.jsxs("div",{className:"absolute right-0 top-full mt-1 bg-black border border-white/10 rounded shadow-lg z-20 min-w-40",children:[o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:j=>{j.stopPropagation(),R(B)},children:[o.jsx($l,{className:"w-4 h-4"}),e("notebooks.scriptHistory.loadScript",{defaultValue:"Load Script"})]}),o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:j=>{j.stopPropagation(),I(B)},children:[o.jsx(ML,{className:"w-4 h-4"}),e("notebooks.scriptHistory.rename",{defaultValue:"Rename"})]}),o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:j=>{j.stopPropagation(),w(B.id)},children:[o.jsx(gi,{className:"w-4 h-4"}),e("notebooks.scriptHistory.duplicate",{defaultValue:"Duplicate"})]}),o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2",onClick:j=>{j.stopPropagation(),_(B)},children:[o.jsx(Hr,{className:"w-4 h-4"}),e("notebooks.scriptHistory.export",{defaultValue:"Export"})]}),o.jsx("div",{className:"border-t border-white/10"}),o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-red-400 hover:bg-red-500/10 flex items-center gap-2",onClick:j=>{j.stopPropagation(),A(B.id)},children:[o.jsx(Hl,{className:"w-4 h-4"}),e("notebooks.scriptHistory.delete",{defaultValue:"Delete"})]})]})]})]})},B.id))})}),y&&o.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>x(null)}),o.jsx(uJ,{isOpen:i,onClose:p,onSave:h,onDiscard:m,saveButtonText:e("notebooks.scriptHistory.saveAndCreateNew",{defaultValue:"Save and Create New"})}),o.jsx(cJ,{isOpen:s,title:e("notebooks.scriptHistory.saveNotebook",{defaultValue:"Save Notebook"}),placeholder:e("notebooks.scriptHistory.enterNotebookName",{defaultValue:"Enter notebook name"}),onSave:c,onClose:u})]})},dBe=[{name:"scikit-learn",description:"Machine learning library"},{name:"scipy",description:"Scientific computing library"},{name:"requests",description:"HTTP library"},{name:"pillow",description:"Image processing library"},{name:"lxml",description:"XML processing library"},{name:"statsmodels",description:"Statistical modeling"}],hBe=()=>{const{t:e}=Ze(),{pyodide:t,installedPackages:n,installPythonPackage:r,refreshInstalledPackages:a}=Ia(),[s,i]=v.useState(""),[l,c]=v.useState(""),[u,h]=v.useState(new Set),[m,p]=v.useState(new Map),[g,T]=v.useState(!1);v.useEffect(()=>{t.isInitialized&&a()},[t.isInitialized,a]);const b=dBe.map(w=>he(q({},w),{version:n.get(w.name)||void 0,isInstalled:n.has(w.name),isInstalling:u.has(w.name)})).filter(w=>{const _=s===""||w.name.toLowerCase().includes(s.toLowerCase())||w.description&&w.description.toLowerCase().includes(s.toLowerCase()),N=!g||w.isInstalled;return _&&N}),x=w=>H(null,null,function*(){if(!(!t.isInitialized||u.has(w))){h(_=>new Set(_).add(w)),p(_=>{const N=new Map(_);return N.delete(w),N});try{yield r(w),yield a()}catch(_){p(N=>new Map(N).set(w,_ instanceof Error?_.message:"Installation failed"))}finally{h(_=>{const N=new Set(_);return N.delete(w),N})}}}),R=()=>H(null,null,function*(){const w=l.trim();w&&(yield x(w),c(""))}),A=()=>Array.from(n.entries()).map(([w,_])=>({name:w,version:_}));return t.isInitialized?o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(Dl,{className:"w-5 h-5 text-primary"}),o.jsx("h3",{className:"font-medium text-white",children:e("notebooks.packageManager.title",{defaultValue:"Package Manager"})})]}),o.jsxs("div",{className:"relative mb-3",children:[o.jsx(Qi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-white/50"}),o.jsx("input",{type:"text",placeholder:e("notebooks.packageManager.searchPlaceholder",{defaultValue:"Search packages..."}),className:"w-full pl-10 pr-4 py-2 bg-background border border-white/10 rounded text-sm text-white placeholder:text-white/50 focus:outline-none focus:border-primary/50",value:s,onChange:w=>i(w.target.value)})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{className:"text-xs px-3 py-1 rounded transition-colors ".concat(g?"bg-primary/20 text-primary":"bg-white/10 text-white/70 hover:bg-white/20"),onClick:()=>T(!g),children:e("notebooks.packageManager.showInstalledOnly",{defaultValue:"Show Installed Only"})}),o.jsx("span",{className:"text-xs text-white/50",children:e("notebooks.packageManager.installedCount",{defaultValue:"{{count}} installed",count:n.size})})]})]}),o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Hr,{className:"w-4 h-4 text-secondary"}),o.jsx("span",{className:"text-sm font-medium text-white",children:e("notebooks.packageManager.installCustom",{defaultValue:"Install Custom Package"})})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("input",{type:"text",placeholder:e("notebooks.packageManager.packageNamePlaceholder",{defaultValue:"Package name (e.g., requests)"}),className:"flex-1 px-3 py-2 bg-background border border-white/10 rounded text-sm text-white placeholder:text-white/50 focus:outline-none focus:border-primary/50",value:l,onChange:w=>c(w.target.value),onKeyDown:w=>{w.key==="Enter"&&R()}}),o.jsx(je,{variant:"primary",size:"sm",onClick:R,disabled:!l.trim()||u.has(l.trim()),className:"px-3",children:u.has(l.trim())?o.jsx(Hn,{className:"w-4 h-4 animate-spin"}):o.jsx(Hr,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"mt-2 text-xs text-white/60 flex items-start gap-1",children:[o.jsx(jo,{className:"w-3 h-3 mt-0.5 flex-shrink-0"}),o.jsx("span",{children:e("notebooks.packageManager.packageInfo",{defaultValue:"Only pure Python packages or packages with WebAssembly builds"})})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length===0?o.jsxs("div",{className:"p-4 text-center",children:[o.jsx(Dl,{className:"w-8 h-8 text-white/30 mx-auto mb-2"}),o.jsx("p",{className:"text-sm text-white/60",children:s?e("notebooks.packageManager.noPackagesFound",{defaultValue:"No packages found"}):e("notebooks.packageManager.noPackagesToShow",{defaultValue:"No packages to show"})})]}):o.jsx("div",{className:"space-y-1 p-2",children:b.map(w=>o.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium text-white text-sm",children:w.name}),w.isInstalled&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Pr,{className:"w-3 h-3 text-green-400"}),w.version&&o.jsxs("span",{className:"text-xs text-white/50",children:["v",w.version]})]})]}),w.description&&o.jsx("p",{className:"text-xs text-white/60 mt-1",children:w.description}),m.has(w.name)&&o.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[o.jsx(Cn,{className:"w-3 h-3 text-red-400"}),o.jsx("span",{className:"text-xs text-red-400",children:m.get(w.name)})]})]}),o.jsx("div",{className:"flex items-center gap-2",children:w.isInstalled?o.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-green-500/20 text-green-400 rounded text-xs",children:[o.jsx(Pr,{className:"w-3 h-3"}),o.jsx("span",{children:e("notebooks.packageManager.installed",{defaultValue:"Installed"})})]}):o.jsx(je,{variant:"ghost",size:"sm",onClick:()=>x(w.name),disabled:w.isInstalling,className:"h-8 px-3",children:w.isInstalling?o.jsx(Hn,{className:"w-4 h-4 animate-spin"}):o.jsxs(o.Fragment,{children:[o.jsx(Hr,{className:"w-4 h-4 mr-1"}),o.jsx("span",{children:e("notebooks.packageManager.install",{defaultValue:"Install"})})]})})})]},w.name))})}),n.size>0&&o.jsxs("div",{className:"border-t border-white/10 p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"text-sm font-medium text-white",children:e("notebooks.packageManager.installedPackagesTitle",{defaultValue:"Installed Packages ({{count}})",count:n.size})}),o.jsx(je,{variant:"ghost",size:"sm",onClick:a,className:"h-7 px-2 text-xs",children:e("notebooks.packageManager.refresh",{defaultValue:"Refresh"})})]}),o.jsxs("div",{className:"max-h-32 overflow-y-auto",children:[o.jsx("div",{className:"grid grid-cols-1 gap-1",children:A().slice(0,10).map(({name:w,version:_})=>o.jsxs("div",{className:"flex items-center justify-between text-xs bg-white/5 px-2 py-1 rounded",children:[o.jsx("span",{className:"text-white",children:w}),o.jsx("span",{className:"text-white/50",children:_})]},w))}),n.size>10&&o.jsx("div",{className:"text-xs text-white/50 text-center mt-2",children:e("notebooks.packageManager.andMore",{defaultValue:"... and {{count}} more",count:n.size-10})})]})]})]}):o.jsx("div",{className:"h-full flex items-center justify-center p-4",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Dl,{className:"w-12 h-12 text-white/50 mx-auto mb-3"}),o.jsx("p",{className:"text-white/70",children:e("notebooks.packageManager.pythonNotInitialized",{defaultValue:"Python not initialized"})}),o.jsx("p",{className:"text-sm text-white/50",children:e("notebooks.packageManager.initializePython",{defaultValue:"Initialize Python to manage packages"})})]})})},EZ=[{id:"sample_employees_analysis",name:"Sample Employees Analysis",description:"Get started quickly with the built-in employees sample table",category:"data_analysis",tags:["quickstart","duckdb"],code:"# Working with the sample employees table\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# Query the sample employees table using the sql() function\ndf = await sql(\"SELECT * FROM employees_sample\")\n\nprint(\"Sample Employees Data:\")\nprint(df)\nprint(f\"\\nTotal employees: {len(df)}\")\n\n# Group by department and calculate average salary\ndept_summary = await sql(\"\"\"\n    SELECT \n        department,\n        COUNT(*) as employee_count,\n        AVG(salary) as avg_salary,\n        MIN(salary) as min_salary,\n        MAX(salary) as max_salary\n    FROM employees_sample\n    GROUP BY department\n    ORDER BY avg_salary DESC\n\"\"\")\n\nprint(\"\\nDepartment Summary:\")\nprint(dept_summary)\n\n# Create a bar chart of average salaries by department\nplt.figure(figsize=(10, 6))\nbars = plt.bar(dept_summary['department'], dept_summary['avg_salary'], color=['#1f77b4', '#ff7f0e', '#2ca02c'])\n\n# Add value labels on bars\nfor bar in bars:\n    height = bar.get_height()\n    plt.text(bar.get_x() + bar.get_width()/2., height,\n             '$' + f'{height:,.0f}', ha='center', va='bottom')\n\nplt.xlabel('Department')\nplt.ylabel('Average Salary ($)')\nplt.title('Average Salary by Department')\nplt.xticks(rotation=45)\nplt.tight_layout()\nplt.show()\n\n# You can also use query() or sql_bridge.query_to_pandas() for more explicit calls\n# employees_hr = await query(\"SELECT * FROM employees_sample WHERE department = 'HR'\")",requiredPackages:["pandas","matplotlib"]},{id:"basic_data_exploration",name:"Basic Data Exploration",description:"Load data from DuckDB and perform basic exploration",category:"data_analysis",tags:["pandas","exploration","duckdb"],code:'# Load data from DuckDB table\nimport pandas as pd\nimport numpy as np\n\n# List available tables\nprint("Available tables:", sql_bridge.get_table_names())\n\n# Load the sample employees table\ndf = await sql("SELECT * FROM employees_sample")\n\n# Basic information about the dataset\nprint("\\nDataset shape:", df.shape)\nprint("\\nColumn information:")\nprint(df.info())\n\nprint("\\nFirst few rows:")\ndf.head()\n\nprint("\\nBasic statistics:")\ndf.describe()\n\nprint("\\nMissing values:")\nprint(df.isnull().sum())\n\n# Group by department\ndept_counts = df[\'department\'].value_counts()\nprint("\\nEmployees per department:")\nprint(dept_counts)',requiredPackages:["pandas","numpy"]},{id:"basic_plotting",name:"Basic Data Visualization",description:"Create common plots with matplotlib",category:"visualization",tags:["matplotlib","plotting","visualization"],code:"import matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\n\n# Load employees data\ndf = await sql(\"SELECT * FROM employees_sample\")\n\n# Create figure with subplots\nfig, axes = plt.subplots(2, 2, figsize=(12, 10))\nfig.suptitle('Employee Data Analysis Dashboard', fontsize=16)\n\n# 1. Salary distribution histogram\naxes[0, 0].hist(df['salary'], bins=15, alpha=0.7, color='skyblue', edgecolor='black')\naxes[0, 0].set_title('Salary Distribution')\naxes[0, 0].set_xlabel('Salary ($)')\naxes[0, 0].set_ylabel('Number of Employees')\naxes[0, 0].axvline(df['salary'].mean(), color='red', linestyle='--', label=f'Mean: $' + f'{df[\"salary\"].mean():,.0f}')\naxes[0, 0].legend()\n\n# 2. Department bar plot\ndept_counts = df['department'].value_counts()\nbars = axes[0, 1].bar(dept_counts.index, dept_counts.values, color=['#1f77b4', '#ff7f0e', '#2ca02c'])\naxes[0, 1].set_title('Employees by Department')\naxes[0, 1].set_xlabel('Department')\naxes[0, 1].set_ylabel('Count')\nfor bar in bars:\n    height = bar.get_height()\n    axes[0, 1].text(bar.get_x() + bar.get_width()/2., height,\n                    f'{int(height)}', ha='center', va='bottom')\n\n# 3. Salary by department box plot\ndepartments = df['department'].unique()\nsalary_data = [df[df['department'] == dept]['salary'].values for dept in departments]\naxes[1, 0].boxplot(salary_data, labels=departments)\naxes[1, 0].set_title('Salary Distribution by Department')\naxes[1, 0].set_xlabel('Department')\naxes[1, 0].set_ylabel('Salary ($)')\n\n# 4. ID vs Salary scatter plot (to show any patterns)\naxes[1, 1].scatter(df['id'], df['salary'], alpha=0.6, c=df['department'].astype('category').cat.codes, cmap='viridis')\naxes[1, 1].set_title('Employee ID vs Salary (colored by department)')\naxes[1, 1].set_xlabel('Employee ID')\naxes[1, 1].set_ylabel('Salary ($)')\n\nplt.tight_layout()\nplt.show()",requiredPackages:["matplotlib","pandas","numpy"]},{id:"seaborn_advanced",name:"Advanced Plots with Seaborn",description:"Create publication-ready plots with seaborn",category:"visualization",tags:["seaborn","statistical-plots","advanced"],code:"import seaborn as sns\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport numpy as np\n\n# Set seaborn style\nsns.set_style(\"whitegrid\")\nplt.rcParams['figure.figsize'] = (12, 8)\n\n# Load employees data\ndf = await sql(\"SELECT * FROM employees_sample\")\n\n# Create a comprehensive analysis plot\nfig, axes = plt.subplots(2, 3, figsize=(18, 12))\nfig.suptitle('Employee Data Analysis with Seaborn', fontsize=16)\n\n# 1. Salary distribution with KDE\nsns.histplot(data=df, x='salary', kde=True, ax=axes[0, 0], color='skyblue')\naxes[0, 0].set_title('Salary Distribution with KDE')\naxes[0, 0].set_xlabel('Salary ($)')\n\n# 2. Box plot by department\nsns.boxplot(data=df, x='department', y='salary', ax=axes[0, 1], palette='Set2')\naxes[0, 1].set_title('Salary Box Plot by Department')\naxes[0, 1].set_xlabel('Department')\naxes[0, 1].set_ylabel('Salary ($)')\n\n# 3. Create a correlation matrix with additional metrics\n# Add some calculated fields for correlation\ndf['salary_rank'] = df['salary'].rank()\ndf['id_group'] = pd.cut(df['id'], bins=5, labels=['1-20', '21-40', '41-60', '61-80', '81-100'])\nnumeric_cols = ['id', 'salary', 'salary_rank']\ncorr_matrix = df[numeric_cols].corr()\nsns.heatmap(corr_matrix, annot=True, cmap='coolwarm', center=0, ax=axes[0, 2])\naxes[0, 2].set_title('Correlation Matrix')\n\n# 4. Violin plot\nsns.violinplot(data=df, x='department', y='salary', ax=axes[1, 0], palette='muted')\naxes[1, 0].set_title('Salary Distribution (Violin Plot)')\naxes[1, 0].set_xlabel('Department')\naxes[1, 0].set_ylabel('Salary ($)')\n\n# 5. Count plot for departments\nsns.countplot(data=df, x='department', ax=axes[1, 1], palette='pastel')\naxes[1, 1].set_title('Employee Count by Department')\naxes[1, 1].set_xlabel('Department')\naxes[1, 1].set_ylabel('Count')\n\n# Add value labels on bars\nfor container in axes[1, 1].containers:\n    axes[1, 1].bar_label(container)\n\n# 6. Swarm plot for detailed view\nsns.swarmplot(data=df, x='department', y='salary', ax=axes[1, 2], alpha=0.7)\naxes[1, 2].set_title('Individual Salaries by Department')\naxes[1, 2].set_xlabel('Department')\naxes[1, 2].set_ylabel('Salary ($)')\n\nplt.tight_layout()\nplt.show()\n\n# Create a separate pairplot for salary analysis\nplt.figure(figsize=(10, 8))\n# Add some derived features for better visualization\ndf['salary_percentile'] = df['salary'].rank(pct=True) * 100\npairplot_df = df[['salary', 'salary_percentile', 'department']].copy()\nsns.pairplot(pairplot_df, hue='department', diag_kind='kde', palette='Set1')\nplt.suptitle('Salary Analysis Pairplot', y=1.02)\nplt.show()",requiredPackages:["seaborn","matplotlib","pandas","numpy"]},{id:"basic_ml_analysis",name:"Basic Machine Learning",description:"Simple ML analysis with scikit-learn",category:"ml",tags:["scikit-learn","machine-learning","classification"],code:"# Note: scikit-learn needs to be installed first\n# Run: import micropip; await micropip.install('scikit-learn')\nawait micropip.install('scikit-learn')\n\nimport pandas as pd\nimport numpy as np\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.metrics import classification_report, mean_squared_error, r2_score\nfrom sklearn.preprocessing import LabelEncoder\nimport matplotlib.pyplot as plt\n\n# Load employee data\ndf = await sql(\"SELECT * FROM employees_sample\")\n\nprint(\"Employee Dataset:\")\nprint(df.head())\nprint(f\"\\nShape: {df.shape}\")\n\n# ML Task 1: Predict department based on salary and ID\nprint(\"\\n\" + \"=\"*50)\nprint(\"CLASSIFICATION: Predicting Department\")\nprint(\"=\"*50)\n\n# Features for classification\nX_class = df[['id', 'salary']]\ny_class = df['department']\n\n# Encode the target\nle = LabelEncoder()\ny_class_encoded = le.fit_transform(y_class)\n\n# Split the data\nX_train, X_test, y_train, y_test = train_test_split(\n    X_class, y_class_encoded, test_size=0.3, random_state=42\n)\n\n# Train Random Forest classifier\nrf = RandomForestClassifier(n_estimators=50, random_state=42)\nrf.fit(X_train, y_train)\n\n# Make predictions\ny_pred = rf.predict(X_test)\n\n# Results\nprint(\"\\nClassification Results:\")\nprint(classification_report(y_test, y_pred, target_names=le.classes_))\n\n# Feature importance\nfeature_importance = pd.DataFrame({\n    'feature': ['Employee ID', 'Salary'],\n    'importance': rf.feature_importances_\n}).sort_values('importance', ascending=False)\n\nprint(\"\\nFeature Importance for Department Prediction:\")\nprint(feature_importance)\n\n# ML Task 2: Predict salary based on ID (regression)\nprint(\"\\n\" + \"=\"*50)\nprint(\"REGRESSION: Predicting Salary from Employee ID\")\nprint(\"=\"*50)\n\n# Features for regression\nX_reg = df[['id']].values\ny_reg = df['salary'].values\n\n# Split the data\nX_train_reg, X_test_reg, y_train_reg, y_test_reg = train_test_split(\n    X_reg, y_reg, test_size=0.3, random_state=42\n)\n\n# Train Linear Regression\nlr = LinearRegression()\nlr.fit(X_train_reg, y_train_reg)\n\n# Make predictions\ny_pred_reg = lr.predict(X_test_reg)\n\n# Results\nmse = mean_squared_error(y_test_reg, y_pred_reg)\nr2 = r2_score(y_test_reg, y_pred_reg)\n\nprint(f\"Mean Squared Error: {mse:.2f}\")\nprint(f\"R² Score: {r2:.4f}\")\n\n# Visualization\nfig, axes = plt.subplots(1, 2, figsize=(15, 6))\n\n# Plot 1: Feature importance\naxes[0].barh(feature_importance['feature'], feature_importance['importance'])\naxes[0].set_title('Feature Importance for Department Prediction')\naxes[0].set_xlabel('Importance')\n\n# Plot 2: Regression results\naxes[1].scatter(y_test_reg, y_pred_reg, alpha=0.7)\naxes[1].plot([y_test_reg.min(), y_test_reg.max()], [y_test_reg.min(), y_test_reg.max()], 'r--', lw=2)\naxes[1].set_xlabel('Actual Salary')\naxes[1].set_ylabel('Predicted Salary')\naxes[1].set_title(f'Salary Prediction (R² = {r2:.4f})')\n\nplt.tight_layout()\nplt.show()",requiredPackages:["pandas","numpy","matplotlib"]},{id:"statistical_analysis",name:"Statistical Analysis",description:"Perform statistical tests and analysis",category:"stats",tags:["statistics","scipy","analysis"],code:"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy import stats\n\n# Load employee data\ndf = await sql(\"SELECT * FROM employees_sample\")\n\nprint(\"Employee Statistical Analysis Report\")\nprint(\"=\" * 50)\n\n# Basic descriptive statistics for salary\nsalary_data = df['salary'].dropna()\n\nprint(\"\\nSALARY ANALYSIS:\")\nprint(f\"  Mean: $\" + f\"{salary_data.mean():,.2f}\")\nprint(f\"  Median: $\" + f\"{salary_data.median():,.2f}\")\nprint(f\"  Std Dev: $\" + f\"{salary_data.std():,.2f}\")\nprint(f\"  Min: $\" + f\"{salary_data.min():,.2f}\")\nprint(f\"  Max: $\" + f\"{salary_data.max():,.2f}\")\nprint(f\"  Skewness: {stats.skew(salary_data):.2f}\")\nprint(f\"  Kurtosis: {stats.kurtosis(salary_data):.2f}\")\n\n# Normality test for salary\nstat, p_value = stats.shapiro(salary_data)\nprint(f\"  Normality test p-value: {p_value:.4f}\")\nprint(f\"  Normal distribution: {'Yes' if p_value > 0.05 else 'No'}\")\n\n# Department-wise analysis\nprint(\"\\nDEPARTMENT COMPARISON:\")\ndepartments = df['department'].unique()\n\ndept_stats = []\nfor dept in departments:\n    dept_salaries = df[df['department'] == dept]['salary']\n    dept_stats.append({\n        'department': dept,\n        'count': len(dept_salaries),\n        'mean': dept_salaries.mean(),\n        'median': dept_salaries.median(),\n        'std': dept_salaries.std()\n    })\n\ndept_df = pd.DataFrame(dept_stats).sort_values('mean', ascending=False)\nprint(dept_df.round(2))\n\n# Statistical tests\nprint(\"\\nSTATISTICAL TESTS:\")\n\n# 1. ANOVA test for salary differences between departments\ndept_groups = [df[df['department'] == dept]['salary'].values for dept in departments]\nf_stat, anova_p = stats.f_oneway(*dept_groups)\nprint(f\"\\nANOVA Test (salary differences between departments):\")\nprint(f\"  F-statistic: {f_stat:.4f}\")\nprint(f\"  p-value: {anova_p:.4f}\")\nprint(f\"  Significant difference: {'Yes' if anova_p < 0.05 else 'No'}\")\n\n# 2. T-test between highest and lowest paying departments\nif len(departments) >= 2:\n    high_dept = dept_df.iloc[0]['department']\n    low_dept = dept_df.iloc[-1]['department']\n    \n    high_salaries = df[df['department'] == high_dept]['salary']\n    low_salaries = df[df['department'] == low_dept]['salary']\n    \n    t_stat, t_p = stats.ttest_ind(high_salaries, low_salaries)\n    print(f\"\\nT-test ({high_dept} vs {low_dept}):\")\n    print(f\"  t-statistic: {t_stat:.4f}\")\n    print(f\"  p-value: {t_p:.4f}\")\n    print(f\"  Significant difference: {'Yes' if t_p < 0.05 else 'No'}\")\n\n# 3. Correlation between ID and salary\nid_salary_corr, corr_p = stats.pearsonr(df['id'], df['salary'])\nprint(f\"\\nCorrelation (ID vs Salary):\")\nprint(f\"  Pearson r: {id_salary_corr:.4f}\")\nprint(f\"  p-value: {corr_p:.4f}\")\nprint(f\"  Significant correlation: {'Yes' if corr_p < 0.05 else 'No'}\")\n\n# Visualization\nfig, axes = plt.subplots(2, 2, figsize=(15, 10))\n\n# Salary histogram\naxes[0, 0].hist(salary_data, bins=15, alpha=0.7, color='skyblue', edgecolor='black')\naxes[0, 0].axvline(salary_data.mean(), color='red', linestyle='--', label=f'Mean: $' + f'{salary_data.mean():,.0f}')\naxes[0, 0].set_title('Salary Distribution')\naxes[0, 0].set_xlabel('Salary ($)')\naxes[0, 0].set_ylabel('Frequency')\naxes[0, 0].legend()\n\n# Q-Q plot for normality\nstats.probplot(salary_data, dist=\"norm\", plot=axes[0, 1])\naxes[0, 1].set_title('Q-Q Plot (Salary Normality)')\n\n# Department comparison\ndept_df.plot(x='department', y='mean', kind='bar', ax=axes[1, 0], color='lightcoral')\naxes[1, 0].set_title('Average Salary by Department')\naxes[1, 0].set_ylabel('Average Salary ($)')\naxes[1, 0].tick_params(axis='x', rotation=45)\n\n# ID vs Salary scatter\naxes[1, 1].scatter(df['id'], df['salary'], alpha=0.6, c=df['department'].astype('category').cat.codes)\naxes[1, 1].set_title(f'ID vs Salary (r = {id_salary_corr:.3f})')\naxes[1, 1].set_xlabel('Employee ID')\naxes[1, 1].set_ylabel('Salary ($)')\n\nplt.tight_layout()\nplt.show()\n\nprint(\"\\nAnalysis complete!\")",requiredPackages:["pandas","numpy","matplotlib","scipy"]},{id:"data_cleaning",name:"Data Cleaning Utilities",description:"Common data cleaning and preprocessing operations",category:"utils",tags:["data-cleaning","preprocessing","utilities"],code:'import pandas as pd\nimport numpy as np\n\n# Load your data\ndf = await sql("SELECT * FROM employees_sample")\n\nprint("Data Cleaning Report")\nprint("=" * 40)\nprint(f"Original dataset shape: {df.shape}")\n\n# 1. Check for missing values\nprint("\\n1. Missing Values Analysis:")\nmissing_data = df.isnull().sum()\nmissing_percent = (missing_data / len(df)) * 100\nmissing_df = pd.DataFrame({\n    \'Column\': missing_data.index,\n    \'Missing Count\': missing_data.values,\n    \'Missing %\': missing_percent.values\n}).sort_values(\'Missing %\', ascending=False)\n\nprint(missing_df[missing_df[\'Missing Count\'] > 0])\n\n# 2. Handle duplicates\nprint("\\n2. Duplicate Analysis:")\nduplicates = df.duplicated().sum()\nprint(f"Number of duplicate rows: {duplicates}")\n\nif duplicates > 0:\n    df_cleaned = df.drop_duplicates()\n    print(f"Dataset shape after removing duplicates: {df_cleaned.shape}")\nelse:\n    df_cleaned = df.copy()\n\n# 3. Data type optimization\nprint("\\n3. Data Type Optimization:")\nprint("Current data types:")\nprint(df_cleaned.dtypes)\n\n# Convert string columns that might be categorical\nfor col in df_cleaned.select_dtypes(include=[\'object\']).columns:\n    unique_ratio = df_cleaned[col].nunique() / len(df_cleaned)\n    if unique_ratio < 0.5:  # If less than 50% unique values, convert to category\n        df_cleaned[col] = df_cleaned[col].astype(\'category\')\n        print(f"Converted {col} to category (unique ratio: {unique_ratio:.2f})")\n\n# 4. Outlier detection (for numeric columns)\nprint("\\n4. Outlier Detection (IQR method):")\nnumeric_cols = df_cleaned.select_dtypes(include=[np.number]).columns\n\noutlier_summary = []\nfor col in numeric_cols:\n    Q1 = df_cleaned[col].quantile(0.25)\n    Q3 = df_cleaned[col].quantile(0.75)\n    IQR = Q3 - Q1\n    \n    lower_bound = Q1 - 1.5 * IQR\n    upper_bound = Q3 + 1.5 * IQR\n    \n    outliers = df_cleaned[(df_cleaned[col] < lower_bound) | (df_cleaned[col] > upper_bound)]\n    outlier_count = len(outliers)\n    outlier_percent = (outlier_count / len(df_cleaned)) * 100\n    \n    outlier_summary.append({\n        \'Column\': col,\n        \'Outliers\': outlier_count,\n        \'Outlier %\': outlier_percent,\n        \'Lower Bound\': lower_bound,\n        \'Upper Bound\': upper_bound\n    })\n\noutlier_df = pd.DataFrame(outlier_summary)\nprint(outlier_df.round(2))\n\n# 5. Missing value imputation options\nprint("\\n5. Missing Value Imputation Suggestions:")\nfor col in df_cleaned.columns:\n    missing_pct = (df_cleaned[col].isnull().sum() / len(df_cleaned)) * 100\n    \n    if missing_pct > 0:\n        if df_cleaned[col].dtype in [\'int64\', \'float64\']:\n            mean_val = df_cleaned[col].mean()\n            median_val = df_cleaned[col].median()\n            print(f"{col}: Mean={mean_val:.2f}, Median={median_val:.2f}")\n        elif df_cleaned[col].dtype == \'object\':\n            mode_val = df_cleaned[col].mode().iloc[0] if not df_cleaned[col].mode().empty else \'N/A\'\n            print(f"{col}: Mode=\'{mode_val}\'")\n\n# 6. Create cleaned dataset\nprint("\\n6. Cleaning Summary:")\nprint(f"Original shape: {df.shape}")\nprint(f"After cleaning: {df_cleaned.shape}")\nprint(f"Rows removed: {df.shape[0] - df_cleaned.shape[0]}")\n\n# Optional: Save cleaned data back to DuckDB\n# pandas_to_table(df_cleaned, "cleaned_data")\n# print("\\nCleaned data saved as \'cleaned_data\' table")',requiredPackages:["pandas","numpy"]},{id:"export_utilities",name:"Data Export Utilities",description:"Export data to various formats and create summaries",category:"utils",tags:["export","csv","json","utilities"],code:"import pandas as pd\nimport json\nfrom datetime import datetime\n\n# Load your data\ndf = await sql(\"SELECT * FROM employees_sample\")\n\nprint(\"Data Export Utilities\")\nprint(\"=\" * 30)\n\n# 1. Create data summary report\ndef create_data_summary(df):\n    summary = {\n        'dataset_info': {\n            'shape': df.shape,\n            'columns': df.columns.tolist(),\n            'memory_usage': f\"{df.memory_usage(deep=True).sum() / 1024**2:.2f} MB\",\n            'export_timestamp': datetime.now().isoformat()\n        },\n        'column_analysis': {}\n    }\n    \n    for col in df.columns:\n        col_info = {\n            'dtype': str(df[col].dtype),\n            'non_null_count': int(df[col].count()),\n            'null_count': int(df[col].isnull().sum()),\n            'unique_values': int(df[col].nunique())\n        }\n        \n        if df[col].dtype in ['int64', 'float64']:\n            col_info.update({\n                'mean': float(df[col].mean()) if not pd.isna(df[col].mean()) else None,\n                'std': float(df[col].std()) if not pd.isna(df[col].std()) else None,\n                'min': float(df[col].min()) if not pd.isna(df[col].min()) else None,\n                'max': float(df[col].max()) if not pd.isna(df[col].max()) else None,\n                'median': float(df[col].median()) if not pd.isna(df[col].median()) else None\n            })\n        elif df[col].dtype == 'object':\n            try:\n                top_values = df[col].value_counts().head(5).to_dict()\n                col_info['top_values'] = {str(k): int(v) for k, v in top_values.items()}\n            except:\n                col_info['top_values'] = {}\n        \n        summary['column_analysis'][col] = col_info\n    \n    return summary\n\n# Generate summary\nsummary = create_data_summary(df)\nprint(f\"Summary created for dataset with {summary['dataset_info']['shape'][0]} rows and {summary['dataset_info']['shape'][1]} columns\")\n\n# 2. Export options\n\n# Option A: Export as JSON (for small datasets)\nprint(\"\\nExport Options:\")\nprint(\"1. JSON Summary (copy the output below):\")\nprint(\"-\" * 40)\nprint(json.dumps(summary, indent=2))\n\n# Option B: Create downloadable CSV data (first 1000 rows)\nsample_data = df.head(1000)\ncsv_data = sample_data.to_csv(index=False)\nprint(f\"\\n2. CSV Data Preview (first 100 chars):\")\nprint(csv_data[:100] + \"...\")\n\n# Option C: Generate code to recreate the dataset\nprint(\"\\n3. Python code to recreate dataset:\")\nprint(\"-\" * 40)\nprint(\"import pandas as pd\")\nprint(\"import numpy as np\")\nprint()\n\n# Generate sample data creation code\nfor col in df.columns[:5]:  # Limit to first 5 columns\n    if df[col].dtype in ['int64', 'float64']:\n        print(f\"# {col}: numeric column\")\n        print(f\"# Range: {df[col].min():.2f} to {df[col].max():.2f}\")\n    elif df[col].dtype == 'object':\n        unique_vals = df[col].unique()[:5]\n        print(f\"# {col}: categorical column\")\n        print(f\"# Sample values: {list(unique_vals)}\")\n\nprint()\nprint(\"# Recreate similar dataset structure:\")\nprint(\"sample_df = pd.DataFrame({\")\nfor i, col in enumerate(df.columns[:3]):\n    if df[col].dtype in ['int64', 'float64']:\n        print(f\"    '{col}': np.random.normal({df[col].mean():.2f}, {df[col].std():.2f}, 100),\")\n    else:\n        unique_vals = df[col].dropna().unique()[:3]\n        print(f\"    '{col}': np.random.choice({list(unique_vals)}, 100),\")\nprint(\"})\")\n\n# 4. Data quality report\nprint(\"\\n4. Data Quality Report:\")\nprint(\"-\" * 25)\nquality_score = 0\ntotal_checks = 0\n\n# Check 1: Missing data\nmissing_pct = (df.isnull().sum().sum() / (df.shape[0] * df.shape[1])) * 100\nif missing_pct < 5:\n    quality_score += 1\ntotal_checks += 1\nprint(f\"Missing data: {missing_pct:.1f}% {'✓' if missing_pct < 5 else '⚠'}\")\n\n# Check 2: Duplicate rows\ndup_pct = (df.duplicated().sum() / len(df)) * 100\nif dup_pct < 1:\n    quality_score += 1\ntotal_checks += 1\nprint(f\"Duplicate rows: {dup_pct:.1f}% {'✓' if dup_pct < 1 else '⚠'}\")\n\n# Check 3: Data types consistency\nconsistent_types = all(df[col].dtype != 'object' or df[col].nunique() / len(df) < 0.8 for col in df.columns)\nif consistent_types:\n    quality_score += 1\ntotal_checks += 1\nprint(f\"Data type consistency: {'✓' if consistent_types else '⚠'}\")\n\nprint(f\"\\nOverall Quality Score: {quality_score}/{total_checks} ({(quality_score/total_checks)*100:.0f}%)\")\n\nprint(\"\\nExport complete! Use the outputs above as needed.\")",requiredPackages:["pandas","numpy"]},{id:"hf_sentiment_analysis",name:"Sentiment Analysis + Data",description:"Analyze sentiment of text data from your database using DistilBERT",category:"hf",tags:["huggingface","sentiment","nlp","data-analysis"],code:'# Sentiment Analysis with Database Integration\n# Using Xenova/distilbert-base-uncased-finetuned-sst-2-english\n\nprint("🎭 Sentiment Analysis Demo")\nprint("=" * 40)\n\n# Load the sentiment analysis pipeline\npipeline = transformers.pipeline\nsentiment_pipe = await pipeline(\'sentiment-analysis\', \'Xenova/distilbert-base-uncased-finetuned-sst-2-english\')\n\n# Sample customer feedback data (you can replace with your own table)\nsample_feedback = [\n    "The product quality is excellent and delivery was fast!",\n    "Terrible customer service, very disappointed.",\n    "It\'s okay, nothing special but does the job.",\n    "Amazing experience! Will definitely buy again.",\n    "Poor quality, broke after two days of use.",\n    "Good value for money, satisfied with purchase.",\n    "Outstanding support team, very helpful!",\n    "The interface is confusing and hard to navigate."\n]\n\nprint("\\n📊 Analyzing customer feedback...")\nresults = []\n\nfor i, text in enumerate(sample_feedback, 1):\n    result = await sentiment_pipe(text)\n    sentiment = result[0]\n    \n    results.append({\n        \'id\': i,\n        \'text\': text[:50] + "..." if len(text) > 50 else text,\n        \'sentiment\': sentiment[\'label\'],\n        \'confidence\': sentiment[\'score\']\n    })\n    \n    emoji = "😊" if sentiment[\'label\'] == \'POSITIVE\' else "😞"\n    print(f"{i:2d}. {emoji} {sentiment[\'label\']:<8} ({sentiment[\'score\']:.1%}) | {text[:40]}...")\n\n# Convert to pandas for analysis\nimport pandas as pd\ndf = pd.DataFrame(results)\n\nprint("\\n📈 Sentiment Summary:")\nsentiment_counts = df[\'sentiment\'].value_counts()\nprint(f"  Positive: {sentiment_counts.get(\'POSITIVE\', 0)} ({sentiment_counts.get(\'POSITIVE\', 0)/len(df)*100:.1f}%)")\nprint(f"  Negative: {sentiment_counts.get(\'NEGATIVE\', 0)} ({sentiment_counts.get(\'NEGATIVE\', 0)/len(df)*100:.1f}%)")\n\nprint(f"\\n🎯 Average Confidence: {df[\'confidence\'].mean():.1%}")\nprint(f"📝 Total Feedback Analyzed: {len(df)}")\n\n# Display the DataFrame\nprint("\\n📊 Detailed Results:")\ndf',requiredPackages:["transformers-js-py","pandas"]},{id:"hf_advanced_ml_pipeline",name:"ML Pipeline",description:"Fetch web data, analyze with HuggingFace models, and build ML classifiers with scikit-learn",category:"hf",tags:["huggingface","scikit-learn","requests","web-scraping","machine-learning","pipeline"],code:'# ML Pipeline: Web Data + HuggingFace + Scikit-Learn\n    # Demonstrates fetching data, NLP analysis, and traditional ML integration\n    \n    print(" Advanced ML Pipeline Demo")\n    print("=" * 50)\n    \n    # Step 1: Install required packages and setup\n    print(" Setting up packages...")\n    try:\n        # Check if requests is available, install if needed\n        import requests\n        print("✅ requests available")\n    except ImportError:\n        print("📥 Installing requests...")\n        await micropip.install(\'requests\')\n        import requests\n        print("✅ requests installed")\n    \n    try:\n        from sklearn.ensemble import RandomForestClassifier\n        from sklearn.model_selection import train_test_split\n        from sklearn.metrics import classification_report, accuracy_score\n        from sklearn.preprocessing import StandardScaler\n        print("✅ scikit-learn available")\n    except ImportError:\n        print("📥 Installing scikit-learn...")\n        await micropip.install(\'scikit-learn\')\n        from sklearn.ensemble import RandomForestClassifier\n        from sklearn.model_selection import train_test_split\n        from sklearn.metrics import classification_report, accuracy_score\n        from sklearn.preprocessing import StandardScaler\n        print("✅ scikit-learn installed")\n    \n    import pandas as pd\n    import numpy as np\n    import json\n    \n    # Step 2: Simulate fetching news articles (replace with real API)\n    print("\\n📰 Fetching sample news data...")\n    \n    # Sample news articles (in real scenario, you\'d fetch from news API)\n    sample_news = [\n        # Business articles\n        {\n            "title": "Stock Market Reaches New Highs Amid Economic Recovery",\n            "content": "The stock market surged today as investors showed confidence in the economic recovery. Tech stocks led the gains with Apple and Microsoft posting strong quarterly results.",\n            "category": "business"\n        },\n        {\n            "title": "Federal Reserve Announces Interest Rate Decision",\n            "content": "The Federal Reserve maintained interest rates at current levels, citing steady economic growth. Markets responded positively to the announcement with moderate gains across sectors.",\n            "category": "business"\n        },\n        {\n            "title": "Major Merger Creates Banking Giant",\n            "content": "Two of the nation\'s largest banks announced a merger worth $50 billion. The combined entity will become the second-largest financial institution in the country.",\n            "category": "business"\n        },\n        # Science articles\n        {\n            "title": "Scientists Discover New Species in Amazon Rainforest", \n            "content": "Researchers have identified a new species of colorful frog in the Amazon basin. The discovery highlights the rich biodiversity of the rainforest and the urgent need for conservation.",\n            "category": "science"\n        },\n        {\n            "title": "Breakthrough in Quantum Computing Achieved",\n            "content": "Scientists have successfully demonstrated quantum supremacy with a new quantum processor. This achievement could revolutionize computing and solve complex problems impossible for classical computers.",\n            "category": "science"\n        },\n        {\n            "title": "Mars Rover Finds Evidence of Ancient Water",\n            "content": "NASA\'s latest Mars rover has discovered mineral deposits that could only form in the presence of water. This finding supports theories about Mars having a wet past billions of years ago.",\n            "category": "science"\n        },\n        # Sports articles\n        {\n            "title": "Championship Game Breaks Viewership Records",\n            "content": "Last night\'s championship game attracted over 100 million viewers, making it the most-watched sporting event of the year. The thrilling overtime finish kept fans on the edge of their seats.",\n            "category": "sports"\n        },\n        {\n            "title": "Olympic Athlete Sets New World Record",\n            "content": "In a stunning performance, the young athlete shattered the previous world record by over two seconds. This achievement marks a new era in the sport.",\n            "category": "sports"\n        },\n        {\n            "title": "Team Wins First Championship in 50 Years",\n            "content": "The underdog team completed their miracle season by winning their first championship in five decades. Fans celebrated in the streets as history was made.",\n            "category": "sports"\n        },\n        # Technology articles\n        {\n            "title": "New AI Model Revolutionizes Medical Diagnosis",\n            "content": "A groundbreaking artificial intelligence model developed by researchers can now diagnose rare diseases with 95% accuracy. This breakthrough could transform healthcare delivery worldwide.",\n            "category": "technology"\n        },\n        {\n            "title": "Major Tech Company Unveils Revolutionary Smartphone",\n            "content": "The new smartphone features breakthrough battery technology that lasts up to a week on a single charge. Industry experts predict this could change mobile computing forever.",\n            "category": "technology"\n        },\n        {\n            "title": "Cybersecurity Firm Discovers Major Vulnerability",\n            "content": "Security researchers have uncovered a critical vulnerability affecting millions of devices worldwide. Companies are rushing to patch their systems before hackers can exploit the flaw.",\n            "category": "technology"\n        },\n        # Politics articles\n        {\n            "title": "Climate Summit Reaches Historic Agreement",\n            "content": "World leaders at the climate summit have agreed to ambitious new targets for carbon reduction. The agreement includes binding commitments and substantial funding for renewable energy projects.",\n            "category": "politics"\n        },\n        {\n            "title": "New Healthcare Bill Passes Congress",\n            "content": "After months of debate, Congress has passed comprehensive healthcare reform. The bill promises to expand coverage to millions of uninsured Americans.",\n            "category": "politics"\n        },\n        {\n            "title": "International Trade Deal Signed",\n            "content": "Representatives from multiple nations signed a historic trade agreement today. The deal is expected to boost economic growth and create thousands of new jobs.",\n            "category": "politics"\n        },\n        # Entertainment articles\n        {\n            "title": "Hollywood Blockbuster Breaks Box Office Records",\n            "content": "The latest superhero movie has shattered opening weekend records, earning over $300 million globally. Critics praise the film\'s stunning visual effects and compelling storyline.",\n            "category": "entertainment"\n        },\n        {\n            "title": "Music Festival Announces Star-Studded Lineup",\n            "content": "The annual music festival revealed its lineup featuring top artists from around the world. Tickets sold out within minutes of going on sale.",\n            "category": "entertainment"\n        },\n        {\n            "title": "Streaming Service Wins Multiple Awards",\n            "content": "The popular streaming platform dominated the awards ceremony, taking home prizes in multiple categories. Their original content continues to reshape the entertainment industry.",\n            "category": "entertainment"\n        }\n    ]\n    \n    print(f"Loaded {len(sample_news)} sample articles")\n    \n    # Step 3: Use HuggingFace for NLP analysis\n    print("\\n🤗 Analyzing articles with HuggingFace models...")\n    \n    # Load multiple HF pipelines\n    pipeline = transformers.pipeline\n    \n    # Sentiment analysis\n    print("  Loading sentiment analysis...")\n    sentiment_pipe = await pipeline(\'sentiment-analysis\', \'Xenova/distilbert-base-uncased-finetuned-sst-2-english\')\n    \n    # Feature extraction - skip for now due to format issues\n    # We\'ll use other features instead\n    print("  Skipping embeddings (using text features instead)...")\n    \n    # Zero-shot classification\n    print("  Loading zero-shot classifier...")\n    classifier_pipe = await pipeline(\'zero-shot-classification\', \'Xenova/distilbert-base-uncased-mnli\')\n    \n    # Categories for classification\n    hf_categories = ["finance", "science", "sports", "technology", "politics", "entertainment"]\n    \n    print("All HuggingFace models loaded!")\n    \n    # Step 4: Process articles with HF models\n    print("\\n🔄 Processing articles...")\n    processed_articles = []\n    \n    for i, article in enumerate(sample_news):\n        print(f"  Processing article {i+1}/{len(sample_news)}: \'{article[\'title\'][:50]}...\'")\n        \n        text = f"{article[\'title\']} {article[\'content\']}"\n        \n        # Sentiment analysis\n        sentiment_result = await sentiment_pipe(text)\n        sentiment = sentiment_result[0]\n        \n        # Calculate text-based features instead of embeddings\n        # Count words by category keywords\n        tech_words = [\'tech\', \'technology\', \'AI\', \'software\', \'digital\', \'computer\', \'data\']\n        business_words = [\'market\', \'stock\', \'finance\', \'economy\', \'investor\', \'company\', \'business\']\n        science_words = [\'research\', \'scientist\', \'study\', \'discovery\', \'species\', \'medical\']\n        \n        text_lower = text.lower()\n        tech_score = sum(1 for word in tech_words if word.lower() in text_lower)\n        business_score = sum(1 for word in business_words if word.lower() in text_lower)\n        science_score = sum(1 for word in science_words if word.lower() in text_lower)\n        \n        # Zero-shot classification\n        classification_result = await classifier_pipe(text, hf_categories)\n        predicted_category = classification_result[\'labels\'][0]\n        category_confidence = classification_result[\'scores\'][0]\n        \n        processed_articles.append({\n            \'title\': article[\'title\'],\n            \'content\': article[\'content\'][:100] + "..." if len(article[\'content\']) > 100 else article[\'content\'],\n            \'true_category\': article[\'category\'],\n            \'predicted_category\': predicted_category,\n            \'category_confidence\': category_confidence,\n            \'sentiment_label\': sentiment[\'label\'],\n            \'sentiment_score\': sentiment[\'score\'],\n            \'tech_score\': tech_score,\n            \'business_score\': business_score,\n            \'science_score\': science_score,\n            \'text_length\': len(text),\n            \'word_count\': len(text.split())\n        })\n    \n    print("✅ All articles processed!")\n    \n    # Step 5: Create dataset for machine learning\n    print("\\nCreating ML dataset...")\n    \n    # Create DataFrame\n    df = pd.DataFrame(processed_articles)\n    \n    # Extract features for ML\n    features_df = pd.DataFrame({\n        \'sentiment_score\': df[\'sentiment_score\'],\n        \'category_confidence\': df[\'category_confidence\'], \n        \'text_length\': df[\'text_length\'],\n        \'word_count\': df[\'word_count\'],\n        \'sentiment_positive\': (df[\'sentiment_label\'] == \'POSITIVE\').astype(int),\n        \'tech_score\': df[\'tech_score\'],\n        \'business_score\': df[\'business_score\'],\n        \'science_score\': df[\'science_score\']\n    })\n    \n    print(f" Created feature matrix: {features_df.shape}")\n    \n    # Step 6: Train ML classifier to predict true category\n    print("\\n Training scikit-learn classifier...")\n    \n    # Prepare data\n    X = features_df.values\n    y = df[\'true_category\'].values\n    \n    # Split data\n    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42, stratify=y)\n    \n    # Scale features\n    scaler = StandardScaler()\n    X_train_scaled = scaler.fit_transform(X_train)\n    X_test_scaled = scaler.transform(X_test)\n    \n    # Train Random Forest\n    rf_classifier = RandomForestClassifier(n_estimators=100, random_state=42)\n    rf_classifier.fit(X_train_scaled, y_train)\n    \n    # Make predictions\n    y_pred = rf_classifier.predict(X_test_scaled)\n    \n    # Evaluate\n    accuracy = accuracy_score(y_test, y_pred)\n    print(f" Random Forest Accuracy: {accuracy:.2%}")\n    \n    # Step 7: Compare HuggingFace vs Scikit-Learn predictions\n    print("\\n Model Comparison Analysis:")\n    \n    # Create comparison DataFrame\n    comparison_df = df[[\'title\', \'true_category\', \'predicted_category\', \'category_confidence\']].copy()\n    \n    # Add scikit-learn predictions for full dataset\n    X_full_scaled = scaler.transform(features_df.values)\n    sklearn_predictions = rf_classifier.predict(X_full_scaled)\n    sklearn_probabilities = rf_classifier.predict_proba(X_full_scaled)\n    \n    comparison_df[\'sklearn_category\'] = sklearn_predictions\n    comparison_df[\'sklearn_confidence\'] = np.max(sklearn_probabilities, axis=1)\n    \n    # Calculate accuracies\n    hf_accuracy = (comparison_df[\'predicted_category\'] == comparison_df[\'true_category\']).mean()\n    sklearn_accuracy = (comparison_df[\'sklearn_category\'] == comparison_df[\'true_category\']).mean()\n    \n    print(f"HuggingFace Zero-Shot Accuracy: {hf_accuracy:.2%}")\n    print(f"Scikit-Learn RF Accuracy: {sklearn_accuracy:.2%}")\n    \n    # Step 8: Feature importance analysis\n    print("\\n🔍 Feature Importance Analysis:")\n    feature_names = features_df.columns.tolist()\n    importances = rf_classifier.feature_importances_\n    \n    feature_importance_df = pd.DataFrame({\n        \'feature\': feature_names,\n        \'importance\': importances\n    }).sort_values(\'importance\', ascending=False)\n    \n    print("Top 5 most important features:")\n    for idx, row in feature_importance_df.head().iterrows():\n        print(f"  {row[\'feature\']}: {row[\'importance\']:.3f}")\n    \n    # Step 9: Final results and insights\n    print("\\n Pipeline Results Summary:")\n    print("=" * 40)\n    print(f" Articles processed: {len(sample_news)}")\n    print(f" Sentiment distribution:")\n    sentiment_counts = df[\'sentiment_label\'].value_counts()\n    for sentiment, count in sentiment_counts.items():\n        print(f"   {sentiment}: {count} ({count/len(df)*100:.1f}%)")\n    \n    print(f"\\nCategory prediction comparison:")\n    print(f"   HuggingFace accuracy: {hf_accuracy:.1%}")\n    print(f"   Scikit-Learn accuracy: {sklearn_accuracy:.1%}")\n    \n    print(f"\\n ML Model Performance:")\n    print(f"   Features used: {features_df.shape[1]}")\n    print(f"   Training samples: {len(X_train)}")\n    print(f"   Test accuracy: {accuracy:.1%}")\n    \n    # Display detailed results\n    print("\\n Detailed Article Analysis:")\n    display_df = comparison_df[[\'title\', \'true_category\', \'predicted_category\', \'sklearn_category\']].copy()\n    display_df.columns = [\'Article Title\', \'True Category\', \'HF Prediction\', \'SKLearn Prediction\']\n    \n    print("\\n Use Cases for this Pipeline:")\n    print("  • News article classification and routing")\n    print("  • Content recommendation systems") \n    print("  • Automated content tagging")\n    print("  • Market sentiment analysis")\n    print("  • Research paper categorization")\n    print("  • Social media content analysis")\n    \n    display_df',requiredPackages:["transformers-js-py","pandas","numpy","scikit-learn","requests"]},{id:"hf_text_generation",name:"Story Generator",description:"Generate creative stories and text using Llama2.c tiny model",category:"hf",tags:["huggingface","text-generation","creative","stories"],code:'# Story Generator using Llama2.c\n# Using Xenova/llama2.c-stories42M - lightweight story generation model\n\nprint("📝 AI Story Generator")\nprint("=" * 35)\n\n# Load text generation pipeline\npipeline = transformers.pipeline\ngenerator = await pipeline(\'text-generation\', \'Xenova/llama2.c-stories42M\')\n\n# Story prompts to try\nstory_prompts = [\n    "Once upon a time, in a magical forest,",\n    "The old wizard opened his spellbook and",\n    "In the year 2150, robots discovered",\n    "The detective found a mysterious clue",\n    "Deep in the ocean, mermaids were"\n]\n\nprint("🎨 Generating stories from different prompts...")\nprint("=" * 50)\n\ngenerated_stories = []\n\nfor i, prompt in enumerate(story_prompts, 1):\n    print(f"\\n{i}. 📖 Prompt: \'{prompt}\'")\n    print("   🤖 Generated story:")\n    \n    # Generate story continuation\n    result = await generator(prompt, {\n        \'max_length\': 80,\n        \'temperature\': 0.8,\n        \'do_sample\': True,\n        \'top_p\': 0.9\n    })\n    \n    generated_text = result[0][\'generated_text\']\n    story_continuation = generated_text[len(prompt):].strip()\n    \n    print(f"   \'{prompt} {story_continuation}\'")\n    \n    generated_stories.append({\n        \'prompt\': prompt,\n        \'full_story\': generated_text,\n        \'continuation\': story_continuation,\n        \'word_count\': len(generated_text.split())\n    })\n\n# Create analysis of generated content\nimport pandas as pd\ndf = pd.DataFrame(generated_stories)\n\nprint("\\n\\n📊 Story Generation Analysis:")\nprint(f"📝 Total stories generated: {len(df)}")\nprint(f"📏 Average story length: {df[\'word_count\'].mean():.1f} words")\nprint(f"📈 Longest story: {df[\'word_count\'].max()} words")\nprint(f"📉 Shortest story: {df[\'word_count\'].min()} words")\n\nprint("\\n🎯 Tips for better generation:")\nprint("  • Adjust temperature (0.1-1.0) for creativity vs coherence")\nprint("  • Use top_p for nucleus sampling")\nprint("  • Increase max_length for longer stories")\n\n# Display the stories DataFrame\nprint("\\n📚 All Generated Stories:")\ndf[[\'prompt\', \'word_count\']]',requiredPackages:["transformers-js-py","pandas"]},{id:"hf_zero_shot_classification",name:"Text Classifier",description:"Classify any text into custom categories without training data",category:"hf",tags:["huggingface","classification","zero-shot","categories"],code:'# Zero-Shot Text Classification\n# Using Xenova/distilbert-base-uncased-mnli for flexible classification\n\nprint("🏷️ Text Classifier")\nprint("=" * 30)\n\n# Load zero-shot classification pipeline\npipeline = transformers.pipeline\nclassifier = await pipeline(\'zero-shot-classification\', \'Xenova/distilbert-base-uncased-mnli\')\n\n# Sample texts to classify (could be from your database)\nsample_texts = [\n    "The new iPhone has amazing camera quality and great battery life",\n    "Bitcoin price surged 15% after the Fed announcement",\n    "Scientists discover new species in Amazon rainforest",\n    "Manchester United wins 3-1 against Liverpool",\n    "New AI model breaks language understanding records",\n    "Netflix releases trailer for upcoming sci-fi series",\n    "Healthy eating tips for busy professionals",\n    "Real estate market shows signs of recovery"\n]\n\n# Define custom categories for classification\ncategories = {\n    "Business Topics": ["technology", "finance", "business", "economy"],\n    "Science & Research": ["science", "research", "health", "environment"],\n    "Entertainment": ["sports", "movies", "entertainment", "gaming"],\n    "Lifestyle": ["food", "travel", "lifestyle", "fitness"]\n}\n\nprint("📊 Classifying texts into custom categories...")\nprint("Categories:", list(categories.keys()))\nprint("=" * 50)\n\nclassification_results = []\n\nfor i, text in enumerate(sample_texts, 1):\n    print(f"\\n{i}. 📝 Text: \'{text[:60]}...\'")\n    \n    # Classify against all category labels\n    all_labels = [label for cat_labels in categories.values() for label in cat_labels]\n    result = await classifier(text, all_labels)\n    \n    # Get top 3 predictions\n    top_predictions = list(zip(result[\'labels\'][:3], result[\'scores\'][:3]))\n    \n    # Find which main category this belongs to\n    top_label = result[\'labels\'][0]\n    main_category = None\n    for cat_name, cat_labels in categories.items():\n        if top_label in cat_labels:\n            main_category = cat_name\n            break\n    \n    print(f"   🎯 Main Category: {main_category}")\n    print(f"   📊 Top predictions:")\n    for label, score in top_predictions:\n        print(f"      {label}: {score:.1%}")\n    \n    classification_results.append({\n        \'text\': text[:50] + "..." if len(text) > 50 else text,\n        \'main_category\': main_category,\n        \'top_label\': top_label,\n        \'confidence\': result[\'scores\'][0],\n        \'all_predictions\': dict(zip(result[\'labels\'][:5], result[\'scores\'][:5]))\n    })\n\n# Analysis of classification results\nimport pandas as pd\ndf = pd.DataFrame(classification_results)\n\nprint("\\n\\n📈 Classification Summary:")\ncategory_counts = df[\'main_category\'].value_counts()\nfor category, count in category_counts.items():\n    print(f"  {category}: {count} texts ({count/len(df)*100:.1f}%)")\n\nprint(f"\\n🎯 Average Confidence: {df[\'confidence\'].mean():.1%}")\nprint(f"🔍 High Confidence (>80%): {sum(df[\'confidence\'] > 0.8)} texts")\n\nprint("\\n💡 Use Cases:")\nprint("  • Customer support ticket routing")\nprint("  • Content categorization")  \nprint("  • News article classification")\nprint("  • Social media monitoring")\n\n# Display results\ndf[[\'text\', \'main_category\', \'confidence\']]',requiredPackages:["transformers-js-py","pandas"]},{id:"hf_question_answering",name:"Q&A System",description:"Answer questions based on your document content using BERT",category:"hf",tags:["huggingface","question-answering","information-extraction"],code:'# Question Answering System\n# Using Xenova/distilbert-base-cased-distilled-squad for document Q&A\n\nprint("Question Answering System")\nprint("=" * 40)\n\n# Load question-answering pipeline\npipeline = transformers.pipeline\nqa_pipe = await pipeline(\'question-answering\', \'Xenova/distilbert-base-cased-distilled-squad\')\n\n# Sample document context (replace with your actual documents/data)\ncompany_context = """\nDataKit is a modern data analysis platform that combines the power of SQL and Python. \nBuilt on DuckDB, it provides lightning-fast analytical queries on large datasets. \nThe platform supports multiple data formats including CSV, JSON, Parquet, and Excel files.\nDataKit features an integrated notebook environment where users can seamlessly switch \nbetween SQL queries and Python data analysis. The platform now includes Hugging Face \ntransformers for advanced NLP capabilities, enabling sentiment analysis, text generation, \nand document question answering directly in the workflow. DataKit is designed for \ndata scientists, analysts, and researchers who need powerful yet user-friendly tools.\nThe platform runs entirely in the browser using WebAssembly, requiring no server setup.\n"""\n\n# Questions to ask about the context\nquestions = [\n    "What database engine does DataKit use?",\n    "What file formats does DataKit support?",\n    "Who is DataKit designed for?",\n    "Does DataKit require server setup?",\n    "What NLP capabilities does DataKit include?",\n    "Where does DataKit run?",\n    "What can users do in the notebook environment?"\n]\n\nprint("📄 Document Context Preview:")\nprint(f"\'{company_context[:100]}...\'")\nprint(f"📏 Context length: {len(company_context.split())} words")\n\nprint("\\n🔍 Asking questions about the document...")\nprint("=" * 50)\n\nqa_results = []\n\nfor i, question in enumerate(questions, 1):\n    print(f"\\n{i}. ❓ Q: {question}")\n    \n    # Get answer from the context\n    result = await qa_pipe({\n        \'question\': question,\n        \'context\': company_context\n    })\n    \n    answer = result[\'answer\']\n    confidence = result[\'score\']\n    \n    # Determine confidence level\n    conf_emoji = "🎯" if confidence > 0.8 else "🤔" if confidence > 0.5 else "❓"\n    conf_level = "High" if confidence > 0.8 else "Medium" if confidence > 0.5 else "Low"\n    \n    print(f"   {conf_emoji} A: {answer}")\n    print(f"   📊 Confidence: {confidence:.1%} ({conf_level})")\n    \n    qa_results.append({\n        \'question\': question,\n        \'answer\': answer,  \n        \'confidence\': confidence,\n        \'confidence_level\': conf_level\n    })\n\n# Analysis of Q&A performance\nimport pandas as pd\ndf = pd.DataFrame(qa_results)\n\nprint("\\n\\n📈 Q&A System Performance:")\nprint(f"❓ Total questions answered: {len(df)}")\nprint(f"🎯 High confidence answers (>80%): {sum(df[\'confidence\'] > 0.8)}")\nprint(f"🤔 Medium confidence answers (50-80%): {sum((df[\'confidence\'] > 0.5) & (df[\'confidence\'] <= 0.8))}")\nprint(f"❓ Low confidence answers (<50%): {sum(df[\'confidence\'] <= 0.5)}")\nprint(f"📊 Average confidence: {df[\'confidence\'].mean():.1%}")\n\nprint("\\n💡 Tips for better Q&A:")\nprint("  • Provide clear, detailed context")\nprint("  • Ask specific, direct questions")\nprint("  • Context should contain the answer information")\nprint("  • Longer contexts may reduce accuracy")\n\n# Display all Q&A pairs\nprint("\\n📋 Complete Q&A Results:")\ndf[[\'question\', \'answer\', \'confidence_level\']]',requiredPackages:["transformers-js-py","pandas"]},{id:"hf_feature_extraction",name:" Text Feature Extraction",description:"Extract semantic features from text and perform similarity analysis",category:"hf",tags:["huggingface","feature-extraction","embeddings","similarity"],code:'# Text Feature Extraction & Similarity Analysis\n# Using Xenova/all-MiniLM-L6-v2 for sentence embeddings\n\nprint("🧠 Text Feature Extraction & Similarity Analysis")\nprint("=" * 50)\n\n# Load feature extraction pipeline\npipeline = transformers.pipeline\nfeature_extractor = await pipeline(\'feature-extraction\', \'Xenova/all-MiniLM-L6-v2\')\n\n# Sample product descriptions (replace with your text data)\nproduct_descriptions = [\n    "High-quality wireless headphones with noise cancellation",\n    "Bluetooth earbuds with excellent sound quality", \n    "Professional gaming keyboard with RGB lighting",\n    "Mechanical keyboard for coding and gaming",\n    "Lightweight laptop for business and travel",\n    "Powerful desktop computer for video editing",\n    "Smartphone with advanced camera features",\n    "Digital camera for professional photography",\n    "Fitness tracker with heart rate monitor",\n    "Smartwatch with health monitoring features"\n]\n\nprint("📝 Extracting features from product descriptions...")\nprint(f"🔢 Processing {len(product_descriptions)} items...")\n\n# Extract embeddings for all descriptions\nembeddings = []\nfor i, description in enumerate(product_descriptions):\n    print(f"  {i+1:2d}. Processing: \'{description[:40]}...\'")\n    \n    # Get embedding (feature vector)\n    embedding = await feature_extractor(description)\n    # Extract the pooled embedding (mean pooling)\n    import numpy as np\n    embedding_array = np.array(embedding[0])\n    # Ensure numeric type and handle nested arrays\n    if embedding_array.ndim > 2:\n        embedding_array = embedding_array[0]\n    pooled_embedding = np.mean(embedding_array.astype(float), axis=0)\n    embeddings.append(pooled_embedding)\n\nembeddings = np.array(embeddings)\nprint(f"✅ Extracted embeddings shape: {embeddings.shape}")\n\n# Calculate similarity matrix\nprint("\\n🔍 Calculating similarity matrix...")\nfrom sklearn.metrics.pairwise import cosine_similarity\nsimilarity_matrix = cosine_similarity(embeddings)\n\n# Find most similar pairs\nprint("\\n🎯 Most Similar Product Pairs:")\nimport pandas as pd\n\nsimilarities = []\nfor i in range(len(product_descriptions)):\n    for j in range(i+1, len(product_descriptions)):\n        similarities.append({\n            \'product_1\': product_descriptions[i][:30] + "...",\n            \'product_2\': product_descriptions[j][:30] + "...",\n            \'similarity\': similarity_matrix[i][j],\n            \'index_1\': i,\n            \'index_2\': j\n        })\n\n# Sort by similarity and show top 5\nsimilarities_df = pd.DataFrame(similarities)\ntop_similar = similarities_df.nlargest(5, \'similarity\')\n\nfor idx, row in top_similar.iterrows():\n    print(f"  📊 {row[\'similarity\']:.1%} | {row[\'product_1\']} ↔ {row[\'product_2\']}")\n\n# Find products similar to a query\nprint("\\n🔎 Query-based Similarity Search:")\nquery = "wireless audio device"\nprint(f"Query: \'{query}\'")\n\n# Get query embedding\nquery_embedding = await feature_extractor(query)\nquery_array = np.array(query_embedding[0])\nif query_array.ndim > 2:\n    query_array = query_array[0]\nquery_pooled = np.mean(query_array.astype(float), axis=0).reshape(1, -1)\n\n# Calculate similarities to query\nquery_similarities = cosine_similarity(query_pooled, embeddings)[0]\n\n# Create results dataframe\nresults_df = pd.DataFrame({\n    \'product\': [desc[:40] + "..." if len(desc) > 40 else desc for desc in product_descriptions],\n    \'similarity_to_query\': query_similarities\n}).sort_values(\'similarity_to_query\', ascending=False)\n\nprint("\\nTop 3 matches:")\nfor idx, row in results_df.head(3).iterrows():\n    print(f"  🎯 {row[\'similarity_to_query\']:.1%} | {row[\'product\']}")\n\n# Clustering analysis\nprint("\\n🔬 Clustering Analysis:")\nfrom sklearn.cluster import KMeans\n\n# Perform k-means clustering\nn_clusters = 3\nkmeans = KMeans(n_clusters=n_clusters, random_state=42)\nclusters = kmeans.fit_predict(embeddings)\n\n# Show cluster assignments\ncluster_df = pd.DataFrame({\n    \'product\': product_descriptions,\n    \'cluster\': clusters\n})\n\nfor cluster_id in range(n_clusters):\n    cluster_products = cluster_df[cluster_df[\'cluster\'] == cluster_id][\'product\'].tolist()\n    print(f"\\n  📦 Cluster {cluster_id + 1}:")\n    for product in cluster_products:\n        print(f"    • {product}")\n\nprint("\\n💡 Use Cases:")\nprint("  • Product recommendation systems")\nprint("  • Document similarity search")\nprint("  • Content deduplication")\nprint("  • Semantic search engines")\n\n# Display final results\nprint("\\n📊 Similarity Matrix (first 5x5):")\nsimilarity_df = pd.DataFrame(\n    similarity_matrix[:5, :5], \n    columns=[f"P{i+1}" for i in range(5)],\n    index=[f"P{i+1}" for i in range(5)]\n)\nsimilarity_df.round(3)',requiredPackages:["transformers-js-py","pandas","numpy","scikit-learn"]}];function fBe(e){const t=e.toLowerCase();return EZ.filter(n=>n.name.toLowerCase().includes(t)||n.description.toLowerCase().includes(t)||n.tags.some(r=>r.toLowerCase().includes(t)))}const mBe=e=>({data_analysis:{icon:ko,label:e("notebooks.templates.categories.dataAnalysis",{defaultValue:"Data Analysis"}),color:"text-blue-400"},visualization:{icon:ko,label:e("notebooks.templates.categories.visualization",{defaultValue:"Visualization"}),color:"text-green-400"},ml:{icon:jW,label:e("notebooks.templates.categories.machineLearning",{defaultValue:"Machine Learning"}),color:"text-purple-400"},hf:{icon:null,label:e("notebooks.templates.categories.huggingFace",{defaultValue:"Hugging Face"}),color:"text-orange-400"},stats:{icon:phe,label:e("notebooks.templates.categories.statistics",{defaultValue:"Statistics"}),color:"text-orange-400"},utils:{icon:qs,label:e("notebooks.templates.categories.utilities",{defaultValue:"Utilities"}),color:"text-gray-400"}}),pBe=()=>{const{t:e}=Ze(),{createCell:t,setActiveCellId:n}=Ia(),[r,a]=v.useState(""),[s,i]=v.useState(null),[l,c]=v.useState(null),h=(()=>{let b=EZ;return r.trim()&&(b=fBe(r)),s&&(b=b.filter(x=>x.category===s)),b})(),m=mBe(e),p=Object.keys(m).reduce((b,x)=>{const R=h.filter(A=>A.category===x);return R.length>0&&(b[x]=R),b},{}),g=b=>{const x="# ".concat(b.name,"\n\n").concat(b.description,"\n\n").concat(b.requiredPackages?"**".concat(e("notebooks.templates.requiredPackages",{defaultValue:"Required packages"}),":** ").concat(b.requiredPackages.join(", "),"\n"):"","\n\n").concat(e("notebooks.templates.runCodeBelow",{defaultValue:"Run the code cell below to execute this template."}),".");t("markdown",x);const R=t("code",b.code);n(R)},T=b=>H(null,null,function*(){try{yield navigator.clipboard.writeText(b.code)}catch(x){}}),y=Object.keys(m);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsx(Xn,{className:"w-5 h-5 text-primary"}),o.jsx("h3",{className:"font-medium text-white",children:e("notebooks.templates.title",{defaultValue:"Templates"})})]}),o.jsxs("div",{className:"relative mb-3",children:[o.jsx(Qi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-white/50"}),o.jsx("input",{type:"text",placeholder:e("notebooks.templates.searchPlaceholder",{defaultValue:"Search templates..."}),className:"w-full pl-10 pr-4 py-2 bg-background border border-white/10 rounded text-sm text-white placeholder:text-white/50 focus:outline-none focus:border-primary/50",value:r,onChange:b=>a(b.target.value)})]}),o.jsxs("div",{className:"flex flex-wrap gap-1",children:[o.jsx("button",{className:"text-xs px-2 py-1 rounded transition-colors ".concat(s===null?"bg-primary/20 text-primary":"bg-white/10 text-white/70 hover:bg-white/20"),onClick:()=>i(null),children:e("notebooks.templates.filters.all",{defaultValue:"All"})}),y.map(b=>{const x=m[b];return o.jsx("button",{className:"text-xs px-2 py-1 rounded transition-colors flex items-center gap-1 ".concat(s===b?"bg-primary/20 text-primary":"bg-white/10 text-white/70 hover:bg-white/20"),onClick:()=>i(s===b?null:b),children:x.label},b)})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:h.length===0?o.jsxs("div",{className:"p-4 text-center",children:[o.jsx(Xn,{className:"w-8 h-8 text-white/30 mx-auto mb-2"}),o.jsx("p",{className:"text-sm text-white/60",children:r?e("notebooks.templates.noTemplatesFound",{defaultValue:"No templates found"}):e("notebooks.templates.noTemplatesAvailable",{defaultValue:"No templates available"})})]}):o.jsx("div",{className:"space-y-4 p-2",children:Object.entries(p).map(([b,x])=>{const R=m[b],A=R==null?void 0:R.icon;return o.jsxs("div",{className:"space-y-2",children:[s===null&&o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[A&&o.jsx(A,{className:"w-4 h-4 ".concat(R.color)}),o.jsx("h4",{className:"font-medium text-white text-sm",children:R.label}),o.jsx("div",{className:"flex-1 h-px bg-white/10"}),o.jsx("span",{className:"text-xs text-white/50",children:x.length})]}),x.map(w=>o.jsxs("div",{className:"bg-white/5 rounded-lg overflow-hidden hover:bg-white/10 transition-colors",children:[o.jsxs("div",{className:"p-3",children:[o.jsxs("div",{className:"flex items-start justify-between mb-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h5",{className:"font-medium text-white text-sm mb-1",children:w.name}),o.jsx("p",{className:"text-xs text-white/60 line-clamp-2",children:w.description})]}),o.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[o.jsx(je,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>T(w),title:e("notebooks.templates.copyToClipboard",{defaultValue:"Copy to clipboard"}),children:o.jsx(gi,{className:"w-3 h-3"})}),o.jsxs(je,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs",onClick:()=>g(w),children:[o.jsx($l,{className:"w-3 h-3 mr-1"}),e("notebooks.templates.use",{defaultValue:"Use"})]})]})]}),w.requiredPackages&&w.requiredPackages.length>0&&o.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[o.jsx(Dl,{className:"w-3 h-3 text-secondary"}),o.jsxs("span",{className:"text-xs text-white/60",children:[e("notebooks.templates.requires",{defaultValue:"Requires"}),":"," ",w.requiredPackages.join(", ")]})]}),o.jsxs("button",{className:"flex items-center gap-1 text-xs text-white/50 hover:text-white/70 transition-colors",onClick:()=>c(l===w.id?null:w.id),children:[o.jsx(nr,{className:"w-3 h-3 transition-transform ".concat(l===w.id?"rotate-90":"")}),o.jsx(B0,{className:"w-3 h-3"}),l===w.id?e("notebooks.templates.hideCode",{defaultValue:"Hide"}):e("notebooks.templates.showCode",{defaultValue:"Show"})," ",e("notebooks.templates.code",{defaultValue:"code"})]})]}),l===w.id&&o.jsx("div",{className:"border-t border-white/10 bg-black/20",children:o.jsx("pre",{className:"text-xs text-white/80 p-3 overflow-x-auto max-h-64 overflow-y-auto",children:o.jsx("code",{children:w.code})})})]},w.id))]},b)})})}),o.jsx("div",{className:"border-t border-white/10 p-3",children:o.jsxs("div",{className:"flex items-center justify-between text-xs text-white/50",children:[o.jsxs("span",{children:[e("notebooks.templates.templateCount",{defaultValue:"{{count}} templates",count:h.length}),s&&" ".concat(e("notebooks.templates.inCategory",{defaultValue:"in"})," ").concat(m[s].label)]}),r&&o.jsx("button",{onClick:()=>a(""),className:"text-primary hover:text-primary/80 transition-colors",children:e("notebooks.templates.clearSearch",{defaultValue:"Clear search"})})]})})]})},gBe=e=>({int:hu,float:hu,str:Kh,bool:zW,list:hh,tuple:hh,dict:uO,DataFrame:Xs,Series:hh,ndarray:uO,datetime:Fl,date:Fl,function:Xn,method:Xn,module:Xn,NoneType:Xn})[e]||Jr,Ty=(e,t)=>{if(e==null)return"None";if(typeof e=="string")return e.length>50?'"'.concat(e.substring(0,50),'..."'):'"'.concat(e,'"');if(typeof e=="boolean")return e?"True":"False";if(typeof e=="number")return String(e);if(Array.isArray(e))return e.length===0?"[]":e.length<=3?"[".concat(e.map(n=>Ty(n)).join(", "),"]"):"[".concat(Ty(e[0],typeof e[0]),", ... (").concat(e.length," items)]");if(typeof e=="object"){const n=Object.keys(e);if(n.length===0)return"{}";if(n.length<=2){const r=n.map(a=>"".concat(a,": ").concat(Ty(e[a],typeof e[a])));return"{".concat(r.join(", "),"}")}return"{".concat(n[0],": ..., ... (").concat(n.length," keys)}")}return String(e)},mz=()=>{const{t:e}=Ze(),{pyodide:t,globalVariables:n,refreshVariables:r,clearPythonNamespace:a}=Ia(),[s,i]=v.useState(""),[l,c]=v.useState(new Set),[u,h]=v.useState(!1),[m,p]=v.useState(new Set),g=N=>{const{type:I,size:D,shape:M,dtype:O}=N;if(I==="DataFrame")return e("notebooks.variableInspector.dataFrameDescription",{defaultValue:"DataFrame with {{rows}} rows and {{columns}} columns",rows:(M==null?void 0:M[0])||"?",columns:(M==null?void 0:M[1])||"?"});if(I==="Series")return e("notebooks.variableInspector.seriesDescription",{defaultValue:"Series with {{size}} elements{{dtype}}",size:D||"?",dtype:O?" (".concat(O,")"):""});if(I==="ndarray"){const L=M?"(".concat(M.join(", "),")"):"(?)";return e("notebooks.variableInspector.arrayDescription",{defaultValue:"Array with shape {{shape}}{{dtype}}",shape:L,dtype:O?" (".concat(O,")"):""})}return I==="list"&&D!==void 0?e("notebooks.variableInspector.listDescription",{defaultValue:"List with {{size}} elements",size:D}):I==="dict"&&D!==void 0?e("notebooks.variableInspector.dictDescription",{defaultValue:"Dictionary with {{size}} keys",size:D}):I};v.useEffect(()=>{t.isInitialized&&r()},[t.isInitialized,r]);const T=Object.entries(n).filter(([N])=>!N.startsWith("_")).map(([N,I])=>{var k;let D=typeof I,M,O,L;return I&&typeof I=="object"&&(I.__class__&&(D=I.__class__.__name__||D),D==="DataFrame"&&(O=I.shape||[I.length,(k=I.columns)==null?void 0:k.length],M=O[0]*O[1]),D==="Series"&&(M=I.length,L=I.dtype),D==="ndarray"&&(O=I.shape,M=I.size,L=I.dtype),Array.isArray(I)?(D="list",M=I.length):D==="object"&&!I.__class__&&(D="dict",M=Object.keys(I).length)),{name:N,type:D,value:I,size:M,shape:O,dtype:L,description:g({type:D,size:M,shape:O,dtype:L})}}).sort((N,I)=>N.name.localeCompare(I.name)),y=T.filter(N=>{const I=s===""||N.name.toLowerCase().includes(s.toLowerCase())||N.type.toLowerCase().includes(s.toLowerCase()),D=m.size===0||m.has(N.type);return I&&D}),b=[...new Set(T.map(N=>N.type))].sort(),x=()=>H(null,null,function*(){h(!0);try{yield r()}finally{h(!1)}}),R=()=>H(null,null,function*(){confirm(e("notebooks.variableInspector.confirmClear",{defaultValue:"Are you sure you want to clear the Python namespace? This will remove all variables."}))&&(yield a())}),A=N=>{const I=new Set(l);I.has(N)?I.delete(N):I.add(N),c(I)},w=N=>{const I=new Set(m);I.has(N)?I.delete(N):I.add(N),p(I)},_=N=>H(null,null,function*(){try{yield navigator.clipboard.writeText(N)}catch(I){}});return t.isInitialized?o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Jr,{className:"w-5 h-5 text-primary"}),o.jsx("h3",{className:"font-medium text-white",children:e("notebooks.variableInspector.title",{defaultValue:"Variables"})})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(je,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:x,disabled:u,title:e("notebooks.variableInspector.refreshVariables",{defaultValue:"Refresh variables"}),children:o.jsx(ma,{className:"w-3 h-3 ".concat(u?"animate-spin":"")})}),o.jsx(je,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-red-400 hover:text-red-300",onClick:R,title:e("notebooks.variableInspector.clearNamespace",{defaultValue:"Clear namespace"}),children:o.jsx(Hl,{className:"w-3 h-3"})})]})]}),o.jsxs("div",{className:"relative mb-3",children:[o.jsx(Qi,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-white/50"}),o.jsx("input",{type:"text",placeholder:e("notebooks.variableInspector.searchPlaceholder",{defaultValue:"Search variables..."}),className:"w-full pl-10 pr-4 py-2 bg-background border border-white/10 rounded text-sm text-white placeholder:text-white/50 focus:outline-none focus:border-primary/50",value:s,onChange:N=>i(N.target.value)})]}),b.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:b.map(N=>o.jsx("button",{className:"text-xs px-2 py-1 rounded transition-colors ".concat(m.has(N)?"bg-primary/20 text-primary":"bg-white/10 text-white/70 hover:bg-white/20"),onClick:()=>w(N),children:N},N))}),o.jsx("div",{className:"mt-2 text-xs text-white/60",children:e("notebooks.variableInspector.variableCount",{defaultValue:"{{filtered}} of {{total}} variables",filtered:y.length,total:T.length})})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:y.length===0?o.jsxs("div",{className:"p-4 text-center",children:[o.jsx(Jr,{className:"w-8 h-8 text-white/30 mx-auto mb-2"}),o.jsx("p",{className:"text-sm text-white/60",children:T.length===0?e("notebooks.variableInspector.noVariables",{defaultValue:"No variables in namespace"}):e("notebooks.variableInspector.noMatches",{defaultValue:"No variables match your search"})}),T.length===0&&o.jsx("p",{className:"text-xs text-white/40 mt-1",children:e("notebooks.variableInspector.executeCode",{defaultValue:"Execute some Python code to see variables here"})})]}):o.jsx("div",{className:"space-y-1 p-2",children:y.map(N=>{var M,O;const I=gBe(N.type),D=l.has(N.name);return o.jsxs("div",{className:"bg-white/5 rounded-lg overflow-hidden hover:bg-white/10 transition-colors",children:[o.jsxs("div",{className:"p-3",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[o.jsx(I,{className:"w-4 h-4 text-secondary mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("span",{className:"font-medium text-white text-sm font-mono",children:N.name}),o.jsx("span",{className:"text-xs bg-white/10 text-white/70 px-2 py-0.5 rounded",children:N.type})]}),o.jsx("p",{className:"text-xs text-white/60 mb-1",children:N.description}),o.jsx("div",{className:"text-xs text-white/70 font-mono",children:Ty(N.value,N.type)})]})]}),o.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[o.jsx(je,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>_(N.name),title:e("notebooks.variableInspector.copyVariableName",{defaultValue:"Copy variable name"}),children:o.jsx(gi,{className:"w-3 h-3"})}),(N.type==="DataFrame"||N.type==="dict"||N.type==="list")&&o.jsx(je,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>A(N.name),title:D?e("notebooks.variableInspector.collapse",{defaultValue:"Collapse"}):e("notebooks.variableInspector.expand",{defaultValue:"Expand"}),children:D?o.jsx(br,{className:"w-3 h-3"}):o.jsx(nr,{className:"w-3 h-3"})})]})]}),(N.size!==void 0||N.shape||N.dtype)&&o.jsxs("div",{className:"flex flex-wrap gap-2 mt-2 text-xs text-white/50",children:[N.shape&&o.jsx("span",{children:e("notebooks.variableInspector.shape",{defaultValue:"Shape: ({{shape}})",shape:N.shape.join(", ")})}),N.size!==void 0&&!N.shape&&o.jsx("span",{children:e("notebooks.variableInspector.size",{defaultValue:"Size: {{size}}",size:N.size})}),N.dtype&&o.jsx("span",{children:e("notebooks.variableInspector.dtype",{defaultValue:"DType: {{dtype}}",dtype:N.dtype})})]})]}),D&&o.jsx("div",{className:"border-t border-white/10 bg-black/20 p-3",children:o.jsxs("div",{className:"text-xs text-white/70 space-y-1",children:[N.type==="DataFrame"&&N.value&&o.jsxs("div",{children:[o.jsx("div",{className:"text-white/50 mb-1",children:e("notebooks.variableInspector.dataFrameInfo",{defaultValue:"DataFrame Info:"})}),o.jsxs("div",{className:"font-mono bg-black/30 p-2 rounded",children:[e("notebooks.variableInspector.dataFrameColumns",{defaultValue:"Columns: {{columns}}",columns:((M=N.value.columns)==null?void 0:M.join(", "))||"N/A"}),o.jsx("br",{}),e("notebooks.variableInspector.dataFrameIndex",{defaultValue:"Index: {{count}} entries",count:((O=N.value.index)==null?void 0:O.length)||0}),o.jsx("br",{}),e("notebooks.variableInspector.memoryUsage",{defaultValue:"Memory usage: ~{{size}} KB",size:N.size?Math.round(N.size*8/1024):"?"})]})]}),(N.type==="dict"||N.type==="list")&&o.jsxs("div",{children:[o.jsx("div",{className:"text-white/50 mb-1",children:e("notebooks.variableInspector.contents",{defaultValue:"Contents:"})}),o.jsx("div",{className:"font-mono bg-black/30 p-2 rounded max-h-32 overflow-y-auto",children:o.jsx("pre",{children:JSON.stringify(N.value,null,2)})})]})]})})]},N.name)})})}),T.length>0&&o.jsx("div",{className:"border-t border-white/10 p-3",children:o.jsxs("div",{className:"flex items-center gap-1 text-xs text-white/50",children:[o.jsx(jo,{className:"w-3 h-3"}),o.jsx("span",{children:e("notebooks.variableInspector.copyTip",{defaultValue:"Click variable names to copy them to your clipboard"})})]})})]}):o.jsx("div",{className:"h-full flex items-center justify-center p-4",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Jr,{className:"w-12 h-12 text-white/50 mx-auto mb-3"}),o.jsx("p",{className:"text-white/70",children:e("notebooks.variableInspector.pythonNotInitialized",{defaultValue:"Python not initialized"})}),o.jsx("p",{className:"text-sm text-white/50",children:e("notebooks.variableInspector.initializePython",{defaultValue:"Initialize Python to inspect variables"})})]})})};class EBe extends v.Component{constructor(n){super(n);Kt(this,"handleRetry",()=>{this.setState({hasError:!1,error:void 0})});this.state={hasError:!1}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,r){}render(){return this.state.hasError?o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsxs("div",{className:"text-center p-8 max-w-md",children:[o.jsx("div",{className:"mb-6 flex justify-center",children:o.jsx("div",{className:"w-16 h-16 bg-red-500/10 rounded-full flex items-center justify-center",children:o.jsx(Ma,{className:"w-8 h-8 text-red-500"})})}),o.jsx("h3",{className:"text-lg font-heading font-medium text-white mb-2",children:"Something went wrong"}),o.jsx("p",{className:"text-white/70 mb-4",children:"The notebook encountered an unexpected error. Please try again."}),this.state.error&&o.jsxs("details",{className:"text-left mb-4 bg-red-500/10 p-3 rounded border border-red-500/20",children:[o.jsx("summary",{className:"text-sm text-red-400 cursor-pointer mb-2",children:"Error Details"}),o.jsx("pre",{className:"text-xs text-red-300 whitespace-pre-wrap overflow-x-auto",children:this.state.error.message})]}),o.jsxs(je,{onClick:this.handleRetry,variant:"primary",className:"gap-2",children:[o.jsx(ma,{size:16}),"Try Again"]})]})}):this.props.children}}const TBe=()=>[],pz=260,gz=50,Ez=400,yBe=()=>{var ct;const{t:e}=Ze(),{pyodide:t,cells:n,activeCellId:r,isExecuting:a,currentScript:s,savedScripts:i,showScriptHistory:l,showPackageManager:c,showVariableInspector:u,showTemplates:h,initializePython:m,createCell:p,executeCell:g,executeAllCells:T,setActiveCellId:y,toggleScriptHistory:b,togglePackageManager:x,toggleTemplates:R,createNewScript:A,toggleVariableInspector:w}=Ia(),{isInitialized:_}=Dt(),{pendingNotebookCode:N,setPendingNotebookCode:I}=ut(),{initializeFileNotebook:D,updateLastExecutedAt:M,activeFile:O}=Oje(),[L,k]=v.useState(!1),[F,U]=v.useState("none"),[B,j]=v.useState(!1),[G,K]=v.useState(!1),[J,$]=v.useState(!1),X=v.useRef(null),Z=v.useRef(null),V=v.useRef(null),te=v.useRef(null),ae=v.useRef(null),{containerRef:ne,leftPanelWidth:ce,rightPanelWidth:ie,isResizingLeft:W,isResizingRight:Q,startLeftPanelResize:se,startRightPanelResize:z}=Nje({leftPanel:{storageKey:"datakit-scripts-left-panel-width",defaultWidth:pz,minWidth:gz,maxWidth:Ez},rightPanel:{storageKey:"datakit-scripts-right-panel-width",defaultWidth:pz,minWidth:gz,maxWidth:Ez}}),{showSaveDialog:xe,showSaveConfirm:le,saveStatus:pe,handleSaveScript:_e,handleCreateNewNotebook:re,handleNotebookSwitch:Se,handleSaveAndContinue:$e,handleDiscardAndContinue:qe,handleSaveDialogComplete:Je,handleCloseSaveDialog:lt,handleCloseSaveConfirm:at,handleUpdateNotebook:ot}=lJ({closeMenus:()=>{K(!1),$(!1)}});v.useEffect(()=>{!t.isInitialized&&!t.isInitializing&&!t.error&&m().then(()=>{}).catch(Te=>{})},[]),v.useEffect(()=>{O&&(!O.notebookState||!O.notebookState.cells)?D():!O&&n.length===0&&!s&&(A("Untitled Notebook"),setTimeout(()=>{const Te=TBe();Ia.setState({cells:Te}),Ia.getState().updateLastSavedState()},50))},[O==null?void 0:O.id,(ct=O==null?void 0:O.notebookState)==null?void 0:ct.cells,D,A,n.length,s]),v.useEffect(()=>{if(N&&t.isInitialized){const Te=p("code");Te&&(Ia.setState(Oe=>({cells:Oe.cells.map(de=>de.id===Te?he(q({},de),{source:N}):de)})),I(null),y(Te))}},[N,t.isInitialized,p,I,y]);const{handlePanelToggle:st}=Cje({panelStates:{notebooks:l,schema:L,templates:h,packages:c,variables:u},panelToggles:{notebooks:b,schema:()=>k(!L),templates:R,packages:x,variables:w}});v.useEffect(()=>{const Te=Oe=>{X.current&&!X.current.contains(Oe.target)&&j(!1),Z.current&&!Z.current.contains(Oe.target)&&K(!1),V.current&&!V.current.contains(Oe.target)&&$(!1)};return document.addEventListener("mousedown",Te),()=>document.removeEventListener("mousedown",Te)},[]);const oe=()=>{switch(pe){case"saving":return o.jsxs("div",{className:"flex items-center gap-1 text-xs text-blue-400",children:[o.jsx(du,{size:12,className:"animate-spin"}),o.jsx("span",{children:e("notebooks.workspace.status.saving")})]});case"saved":return o.jsx("div",{className:"flex items-center gap-1 text-xs text-green-400",children:o.jsx("span",{children:e("notebooks.workspace.status.saved")})});case"unsaved":return o.jsxs("div",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[o.jsx(Cn,{size:12}),o.jsx("span",{children:e("notebooks.workspace.status.unsaved",{defaultValue:"Unsaved"})})]});default:return null}};wje({onExecuteCell:()=>H(null,null,function*(){r&&(yield g(r),M())}),onExecuteAll:()=>H(null,null,function*(){yield T(),M()}),onSave:_e,onEscape:()=>F!=="none"&&U("none"),canExecuteCell:!!r,canSave:!0});const ue=()=>H(null,null,function*(){try{const Te=(s==null?void 0:s.name)||"DataKit_Notebook";yield Pje(n,Te)}catch(Te){alert(Te instanceof Error?Te.message:"Export failed")}finally{j(!1)}}),Ee=()=>H(null,null,function*(){try{const Te=(s==null?void 0:s.name)||"DataKit_Notebook";yield Uje(n,Te)}catch(Te){alert(Te instanceof Error?Te.message:"Export failed")}finally{j(!1)}});if(!t.isInitialized)return t.error?o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsxs("div",{className:"text-center p-8 max-w-md",children:[o.jsx("div",{className:"mb-6 flex justify-center",children:o.jsx("div",{className:"w-16 h-16 bg-red-500/10 rounded-full flex items-center justify-center",children:o.jsx(Ma,{className:"w-8 h-8 text-red-500"})})}),o.jsx("h3",{className:"text-lg font-heading font-medium text-white mb-2",children:e("notebooks.workspace.errors.pythonInitFailed")}),o.jsx("p",{className:"text-white/70 mb-4",children:t.error}),o.jsx(je,{onClick:m,variant:"primary",children:e("notebooks.workspace.actions.retryInit")})]})}):o.jsx("div",{className:"h-full flex items-center justify-center",children:o.jsxs("div",{className:"text-center p-8 max-w-md",children:[o.jsx("h3",{className:"text-lg font-heading font-medium text-white mb-2",children:t.isInitializing?e("notebooks.workspace.status.initializing"):e("notebooks.workspace.status.notReady")}),o.jsx("p",{className:"text-white/70 mb-4",children:t.isInitializing?"":e("notebooks.workspace.status.preparing")}),o.jsx("div",{className:"text-sm text-white/60",children:o.jsxs("div",{className:"flex items-center justify-center gap-2",children:[o.jsx(Dl,{className:"w-4 h-4 text-secondary"}),o.jsx("span",{children:e("notebooks.workspace.status.loadingPackages")})]})})]})});const Le=()=>h?o.jsx(pBe,{}):c?o.jsx(hBe,{}):l?o.jsx(uBe,{}):L&&_?o.jsx(mQ,{onInsertQuery:()=>{}}):o.jsx(mz,{}),ke=()=>o.jsx(mz,{}),Ge=h||c||l||L||u,tt=u;return F!=="none"?o.jsxs("div",{className:"w-full h-full flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between p-2 bg-darkNav border-b border-white/10",children:[o.jsx("h3",{className:"text-sm font-medium",children:F==="editor"?"Python Editor (Fullscreen)":"Results (Fullscreen)"}),o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>U("none"),title:"Exit Full Screen",children:o.jsx(fO,{size:16})})]}),o.jsx("div",{className:"flex-1 overflow-hidden"})]}):o.jsx(EBe,{children:o.jsxs("div",{ref:ne,className:"h-full w-full flex overflow-hidden relative border-t border-white/10",children:[(W||Q)&&o.jsx("div",{className:"absolute inset-0 z-50",style:{cursor:"col-resize"}}),o.jsxs("div",{ref:te,className:"flex-shrink-0 overflow-hidden bg-darkNav border-r border-white/10 relative ".concat(W?"":"transition-all duration-200"),style:{width:Ge?"".concat(ce,"px"):"0px"},children:[o.jsx("div",{className:"h-full w-full",children:Le()}),Ge&&o.jsx("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize bg-transparent ".concat(W?"bg-primary/50":"hover:bg-primary/30 transition-colors"),onMouseDown:se,style:{width:"5px",right:"-2px"},children:W&&o.jsx("div",{className:"absolute inset-0 bg-primary/50"})})]}),o.jsxs("div",{className:"flex-grow flex flex-col min-w-0 overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between p-2 bg-darkNav border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ut,{content:"Notebooks",placement:"right",children:o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8 ".concat(l?"bg-primary/20 text-primary":""),onClick:()=>st("notebooks"),children:o.jsx(VW,{size:16})})}),o.jsx(Ut,{content:"Templates",placement:"bottom",children:o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8 ".concat(h?"bg-primary/20 text-primary":""),onClick:()=>st("templates"),children:o.jsx(Xn,{size:16})})}),o.jsx(Ut,{content:"Schema Browser",placement:"bottom",children:o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8 ".concat(L?"bg-primary/20 text-primary":""),onClick:()=>st("schema"),children:o.jsx(Xs,{size:16})})}),o.jsx(Ut,{content:"Package Manager",placement:"bottom",children:o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8 ".concat(c?"bg-primary/20 text-primary":""),onClick:()=>st("packages"),children:o.jsx(Dl,{size:16})})}),o.jsx("div",{className:"w-px h-6 bg-white/10"}),o.jsxs("div",{className:"relative",ref:Z,children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[o.jsx("button",{className:"text-sm font-medium text-white max-w-42 truncate hover:bg-white/10 rounded px-2 py-1 transition-colors cursor-pointer",onClick:()=>$(!J),title:"Edit notebook details",children:(s==null?void 0:s.name)||"Untitled Notebook"}),o.jsxs("div",{className:"ml-1 flex items-center gap-1",children:[oe(),o.jsx("button",{className:"opacity-50 hover:opacity-100 transition-opacity p-1.5 hover:bg-white/10 rounded",onClick:_e,disabled:pe==="saving",title:"Save notebook",children:o.jsx(Pr,{size:14})})]}),o.jsxs("button",{className:"flex flex-col items-center hover:bg-white/10 rounded p-1 transition-colors cursor-pointer",onClick:()=>K(!G),title:"Notebook selector",children:[o.jsx($0,{className:"w-4 h-3 text-white/50 -mb-0.5"}),o.jsx(br,{className:"w-4 h-3 text-white/50"})]})]}),G&&o.jsxs("div",{className:"absolute left-0 top-full mt-1 bg-black border border-white/10 rounded shadow-xl z-50 min-w-64 max-h-80 overflow-y-auto",children:[o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm text-white/80 hover:bg-white/10 flex items-center gap-2 border-b border-white/10",onClick:re,children:[o.jsx(ru,{className:"w-4 h-4"}),e("notebooks.workspace.actions.newNotebook")]}),i.length>0?i.map(Te=>o.jsxs("button",{className:"w-full px-3 py-2 text-left text-sm hover:bg-white/10 flex items-center justify-between ".concat((s==null?void 0:s.id)===Te.id?"bg-primary/20 text-primary":"text-white/80"),onClick:()=>Se(Te.id),children:[o.jsx("div",{className:"flex items-center gap-2 min-w-0",children:o.jsx("span",{className:"truncate",children:Te.name})}),(s==null?void 0:s.id)===Te.id&&o.jsx("span",{className:"text-xs bg-primary/30 px-1.5 py-0.5 rounded flex-shrink-0",children:"Current"})]},Te.id)):o.jsx("div",{className:"px-3 py-4 text-center text-sm text-white/50",children:e("notebooks.workspace.noSavedNotebooks")})]}),J&&o.jsx("div",{ref:V,className:"absolute left-0 top-full mt-1 z-50",children:o.jsx(Lje,{isOpen:J,onClose:()=>$(!1),script:s,onUpdate:ot})})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Ut,{content:"Add New Code Cell",placement:"bottom",children:o.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>p("code"),className:"h-8",children:[o.jsx(ru,{size:14,className:"mr-1"}),o.jsx("span",{children:"Code"})]})}),o.jsx(Ut,{content:"Add New Text Cell",placement:"bottom",children:o.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>p("markdown"),className:"h-8",children:[o.jsx(ru,{size:14,className:"mr-1"}),o.jsx("span",{children:"Text"})]})}),o.jsx(Ut,{content:"Execute All Cells (⌘+Shift+Enter)",placement:"bottom",children:o.jsxs(je,{variant:"primary",size:"sm",onClick:T,disabled:a||n.length===0,className:"h-8 gap-2",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx($l,{size:14,className:"mr-1"}),o.jsx("span",{children:"Run All"})]}),o.jsxs("div",{className:"flex items-center text-[11px] opacity-60 bg-white/10 px-1.5 py-0.5 rounded",children:[o.jsx(NL,{size:11,className:"mr-0.5"}),o.jsx("span",{className:"leading-none",children:"⇧↵"})]})]})}),o.jsxs("div",{className:"relative",ref:X,children:[o.jsx(je,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Te=>{Te.stopPropagation(),j(!B)},children:o.jsx(Hr,{size:16})}),B&&o.jsxs("div",{className:"absolute right-0 top-full mt-1 bg-black border border-white/10 rounded shadow-xl z-50 min-w-48",children:[o.jsx("button",{className:"w-full px-3 py-2 text-left text-xs text-white/80 hover:bg-white/10 flex items-center gap-2 rounded-t",onClick:Ee,children:"Download as PDF"}),o.jsx("button",{className:"w-full px-3 py-2 text-left text-xs text-white/80 hover:bg-white/10 flex items-center gap-2 rounded-b",onClick:ue,children:"Download as Jupyter Notebook"})]})]})]})]}),o.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-visible p-8 space-y-0",children:[n.map((Te,Oe)=>o.jsxs(Ht.Fragment,{children:[o.jsx(lBe,{cell:Te,isActive:Te.id===r,onActivate:()=>y(Te.id),cellNumber:Oe+1}),o.jsx(fz,{insertIndex:Oe+1,isLastCell:Oe===n.length-1})]},Te.id)),n.length===0&&o.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[400px] text-center",children:[o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:"Empty Notebook"}),o.jsx("p",{className:"text-white/60 max-w-md leading-relaxed",children:"Start by creating your first cell. You can add code cells to run Python code or text cells for documentation."})]}),o.jsx(fz,{insertIndex:0,isLastCell:!0})]})]})})]}),o.jsxs("div",{ref:ae,className:"flex-shrink-0 overflow-hidden bg-darkNav border-l border-white/10 relative ".concat(Q?"":"transition-all duration-200"),style:{width:tt?"".concat(ie,"px"):"0px"},children:[o.jsx("div",{className:"h-full w-full",children:ke()}),tt&&o.jsx("div",{className:"absolute top-0 left-0 w-1 h-full cursor-col-resize bg-transparent ".concat(Q?"bg-primary/50":"hover:bg-primary/30 transition-colors"),onMouseDown:z,style:{width:"5px",left:"-2px"},children:Q&&o.jsx("div",{className:"absolute inset-0 bg-primary/50"})})]}),o.jsx(cJ,{isOpen:xe,title:"Save Notebook",placeholder:"Enter Notebook name",initialValue:(s==null?void 0:s.name)||"",onSave:Je,onClose:lt}),o.jsx(uJ,{isOpen:le,onClose:at,onSave:$e,onDiscard:qe,saveButtonText:"Save and Switch"})]})})},xBe=()=>o.jsx("div",{className:"h-full w-full",children:o.jsx(yBe,{})}),ff=({title:e="DataKit",description:t="Your data, your choice. Process locally for complete privacy or leverage cloud when you need to collaborate. The modern data analysis platform that adapts to you.",keywords:n="data, visualization, sql",url:r=window.location.href,type:a="website",siteName:s="DataKit - The data platform that works your way",author:i="Amin Khorrami",locale:l="en_US",themeColor:c="#000000",appleTouchIcon:u="/datakit.png",favicon:h="/favicon.ico",publishedTime:m,modifiedTime:p,category:g,tags:T=[]})=>{const y="".concat(e," | The data platform that works your way"),b="/datakit.png";return o.jsxs(Fne,{children:[o.jsx("title",{children:y}),o.jsx("meta",{name:"description",content:t}),o.jsx("meta",{name:"keywords",content:n}),o.jsx("meta",{name:"author",content:i}),o.jsx("meta",{name:"robots",content:"index, follow"}),o.jsx("meta",{name:"language",content:"English"}),o.jsx("meta",{name:"revisit-after",content:"7 days"}),o.jsx("meta",{name:"rating",content:"General"}),o.jsx("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),o.jsx("meta",{name:"theme-color",content:c}),o.jsx("meta",{name:"mobile-web-app-capable",content:"yes"}),o.jsx("meta",{name:"apple-mobile-web-app-capable",content:"yes"}),o.jsx("meta",{name:"apple-mobile-web-app-status-bar-style",content:"default"}),o.jsx("meta",{name:"apple-mobile-web-app-title",content:e}),o.jsx("link",{rel:"icon",href:h}),o.jsx("link",{rel:"apple-touch-icon",href:u}),o.jsx("link",{rel:"canonical",href:r}),o.jsx("meta",{property:"og:title",content:y}),o.jsx("meta",{property:"og:description",content:t}),o.jsx("meta",{property:"og:image",content:b}),o.jsx("meta",{property:"og:image:width",content:"1200"}),o.jsx("meta",{property:"og:image:height",content:"630"}),o.jsx("meta",{property:"og:image:alt",content:t}),o.jsx("meta",{property:"og:url",content:r}),o.jsx("meta",{property:"og:type",content:a}),o.jsx("meta",{property:"og:site_name",content:s}),o.jsx("meta",{property:"og:locale",content:l}),m&&o.jsx("meta",{property:"article:published_time",content:m}),p&&o.jsx("meta",{property:"article:modified_time",content:p}),i&&o.jsx("meta",{property:"article:author",content:i}),g&&o.jsx("meta",{property:"article:section",content:g}),T.map((x,R)=>o.jsx("meta",{property:"article:tag",content:x},R)),o.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),o.jsx("meta",{name:"twitter:title",content:y}),o.jsx("meta",{name:"twitter:description",content:t}),o.jsx("meta",{name:"twitter:image",content:b}),o.jsx("meta",{name:"twitter:image:alt",content:t}),o.jsx("meta",{name:"twitter:creator",content:"@yourtwitterhandle"}),o.jsx("meta",{name:"twitter:site",content:"@yourtwitterhandle"}),o.jsx("meta",{name:"application-name",content:s}),o.jsx("meta",{name:"msapplication-TileColor",content:c}),o.jsx("meta",{name:"msapplication-config",content:"/browserconfig.xml"}),o.jsx("meta",{httpEquiv:"X-Content-Type-Options",content:"nosniff"}),o.jsx("meta",{httpEquiv:"X-Frame-Options",content:"DENY"}),o.jsx("meta",{httpEquiv:"X-XSS-Protection",content:"1; mode=block"}),o.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebApplication",name:s,description:t,url:r,applicationCategory:"BusinessApplication",operatingSystem:"Web Browser",author:{"@type":"Person",name:i},image:b})})]})},SBe=({currentMode:e,onModeChange:t,className:n})=>{const{t:r}=Ze(),a=[{value:"preview",label:r("viewMode.preview.label",{defaultValue:"Preview"}),icon:o.jsx(Jr,{size:16}),description:r("viewMode.preview.description",{defaultValue:"View and explore your data"})},{value:"query",label:r("viewMode.query.label",{defaultValue:"SQL"}),icon:o.jsx(B0,{size:16}),description:r("viewMode.query.description",{defaultValue:"Query with SQL"})},{value:"notebook",label:r("viewMode.notebook.label",{defaultValue:"Notebook"}),icon:o.jsx(Xn,{size:16}),description:r("viewMode.notebook.description",{defaultValue:"Analyze with Jupyter notebook"})}];return o.jsx("div",{className:Qe("relative flex items-center justify-center",n),children:o.jsx(me.div,{initial:{opacity:0,scale:.95,y:-5},animate:{opacity:1,scale:1,y:0},transition:{duration:.25,ease:[.23,1,.32,1],scale:{duration:.2},opacity:{duration:.15}},className:"responsive-view-selector flex items-center gap-0.5 bg-black/60 backdrop-blur-sm border border-white/20 rounded-lg p-0.5 shadow-xl shadow-black/50",children:a.map(s=>o.jsxs(me.button,{onClick:()=>t(s.value),disabled:!1,className:Qe("responsive-view-mode-button relative group flex items-center rounded-md transition-all duration-200 cursor-pointer gap-1.5 px-3 py-1.5 text-xs border",e===s.value?"text-white border-primary/40 bg-primary/5":"text-white/50 hover:text-white/70 border-transparent hover:border-white/20 hover:bg-white/5"),whileHover:{scale:1.02},whileTap:{scale:.98},children:[e===s.value&&o.jsx(me.div,{layoutId:"activeMode",className:"absolute inset-0 rounded-md bg-gradient-to-r from-primary/30 via-primary/25 to-primary/20 border border-primary/50 shadow-lg shadow-primary/20",transition:{type:"spring",duration:.4,bounce:.15}}),o.jsx("span",{className:Qe("relative z-10",e===s.value?"text-white":""),children:s.icon}),o.jsx("span",{className:Qe("button-text relative z-10 font-medium",e===s.value?"text-white":""),children:s.label})]},s.value))})})},bBe=()=>{const{setActiveTab:e}=ut(),{executeQuery:t}=Dt(),n=v.useCallback((s,i=!0)=>H(null,null,function*(){try{return i&&e("query"),{success:!0,result:yield t(s),message:"Query executed successfully"}}catch(l){const c=l instanceof Error?l.message:"Unknown error occurred";return{success:!1,error:c,message:"Failed to execute query: ".concat(c)}}}),[t,e]),r=v.useCallback(s=>H(null,null,function*(){try{const i=s.trim().endsWith(";")?s.slice(0,-1)+" LIMIT 10;":s+" LIMIT 10";return{success:!0,result:yield t(i),previewSQL:i,message:"Preview generated successfully (limited to 10 rows)"}}catch(i){const l=i instanceof Error?i.message:"Unknown error occurred";return{success:!1,error:l,message:"Failed to preview query: ".concat(l)}}}),[t]),a=v.useCallback(s=>H(null,null,function*(){try{const i=s.trim().endsWith(";")?s.slice(0,-1)+" LIMIT 0;":s+" LIMIT 0";return yield t(i),{isValid:!0,message:"SQL syntax is valid"}}catch(i){const l=i instanceof Error?i.message:"Unknown error occurred";return{isValid:!1,error:l,message:"SQL syntax error: ".concat(l)}}}),[t]);return{executeAIGeneratedSQL:n,previewSQL:r,validateSQL:a}};class TZ{constructor(t="datakit-smart"){Kt(this,"model");this.model=t}getApiHeaders(){return{}}validateApiKey(){return H(this,null,function*(){try{const t=yield xt.get("/credits/remaining",{headers:this.getApiHeaders()});return t.creditsRemaining>0||t.creditsRemaining===-1}catch(t){return!1}})}checkCredits(t){return H(this,null,function*(){try{return yield xt.post("/ai/chat/completions/check",{model:this.model,messages:[{role:"user",content:"test"}],max_tokens:100},{headers:this.getApiHeaders()})}catch(n){throw n}})}generateCompletion(t,n){return H(this,null,function*(){var r,a,s,i,l;try{const c={model:this.model,messages:t.map(h=>({role:h.role,content:h.content})),max_tokens:(n==null?void 0:n.maxTokens)||2e4,temperature:(n==null?void 0:n.temperature)||.1,stream:(n==null?void 0:n.stream)||!1},u=yield xt.post("/ai/chat/completions",c,{headers:this.getApiHeaders()});return{content:((s=(a=(r=u.choices)==null?void 0:r[0])==null?void 0:a.message)==null?void 0:s.content)||"",usage:u.usage?{promptTokens:u.usage.prompt_tokens||0,completionTokens:u.usage.completion_tokens||0,totalTokens:u.usage.total_tokens||0}:void 0,model:u.model||this.model,finishReason:(l=(i=u.choices)==null?void 0:i[0])==null?void 0:l.finish_reason,_datakit:u._datakit}}catch(c){throw c}})}generateStreamCompletion(t,n,r){return H(this,null,function*(){var a,s,i,l;try{const c={model:this.model,messages:t.map(y=>({role:y.role,content:y.content})),max_tokens:(r==null?void 0:r.maxTokens)||2e3,temperature:(r==null?void 0:r.temperature)||.1,stream:!0},h=(a=(yield xt.stream("/ai/chat/completions",c,{headers:this.getApiHeaders()})).body)==null?void 0:a.getReader();if(!h)throw new Error("No reader available");const m=new TextDecoder;let p="",g,T;try{for(;;){const{done:y,value:b}=yield h.read();if(y){n({content:p,done:!0,usage:g,_datakit:T});break}const R=m.decode(b).split("\n").filter(A=>A.trim().startsWith("data: "));for(const A of R){const w=A.replace("data: ","");if(w.trim()==="[DONE]"){n({content:p,done:!0,usage:g,_datakit:T});return}try{const _=JSON.parse(w);(l=(i=(s=_.choices)==null?void 0:s[0])==null?void 0:i.delta)!=null&&l.content?(p+=_.choices[0].delta.content,n({content:p,done:!1})):_.usage?g={promptTokens:_.usage.prompt_tokens||0,completionTokens:_.usage.completion_tokens||0}:_._datakit&&(T=_._datakit)}catch(_){continue}}}}finally{h.releaseLock()}}catch(c){throw c}})}generateSQL(t){return H(this,null,function*(){const n=mu(t.context),r=Jh(t.prompt,t.context,{includeExplanation:t.includeExplanation,maxRows:t.maxRows}),a=[{role:"system",content:n},{role:"user",content:r}],s=yield this.generateCompletion(a,{temperature:.1}),i=this.extractSQL(s.content),l=this.extractExplanation(s.content);return{sql:i,explanation:l,confidence:.9,warnings:this.extractWarnings(s.content)}})}analyzeData(t){return H(this,null,function*(){const n=Zh(t.prompt,t.context,t.data),r=[{role:"system",content:"You are a data analyst expert. Provide clear, actionable insights with specific recommendations."},{role:"user",content:n}],a=yield this.generateCompletion(r,{temperature:.3});return{analysis:a.content,insights:this.extractInsights(a.content),suggestions:this.extractSuggestions(a.content)}})}extractSQL(t){const n=t.match(/```sql\n([\s\S]*?)\n```/i);if(n)return n[1].trim();const a=t.split("\n").filter(s=>/^\s*(SELECT|WITH|INSERT|UPDATE|DELETE|CREATE)/i.test(s.trim()));return a.length>0?a.join("\n").trim():t.trim()}extractExplanation(t){const n=t.match(new RegExp("explanation:?\\s*(.*?)(?=\\n\\n|\\n```|$)","is"));if(n)return n[1].trim();const r=t.replace(/```sql[\s\S]*?```/gi,"").trim();if(r&&r!==t.trim())return r}extractWarnings(t){const n=[];return[/warning:?\s*(.*?)(?=\n|$)/gi,/note:?\s*(.*?)(?=\n|$)/gi,/performance:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}extractInsights(t){const n=[],r=t.split("\n").filter(a=>a.trim());for(const a of r)(a.includes("trend")||a.includes("pattern"))&&n.push({type:"trend",title:"Data Trend",description:a.trim(),confidence:.8});return n}extractSuggestions(t){const n=[];return[/recommendation:?\s*(.*?)(?=\n|$)/gi,/suggest:?\s*(.*?)(?=\n|$)/gi,/consider:?\s*(.*?)(?=\n|$)/gi].forEach(a=>{let s;for(;(s=a.exec(t))!==null;)n.push(s[1].trim())}),n}calculateCost(t){let n,r;this.model==="datakit-smart"?(n=.3,r=1.5):this.model==="datakit-fast"?(n=.08,r=.4):(n=.3,r=1.5);const a=t.promptTokens/1e3*n,s=t.completionTokens/1e3*r;return a+s}getRemainingCredits(){return H(this,null,function*(){try{return(yield xt.get("/credits/remaining",{headers:this.getApiHeaders()})).creditsRemaining}catch(t){throw t}})}getCreditStats(){return H(this,null,function*(){try{return yield xt.get("/credits/stats",{headers:this.getApiHeaders()})}catch(t){throw t}})}}const vBe=Object.freeze(Object.defineProperty({__proto__:null,DataKitProvider:TZ},Symbol.toStringTag,{value:"Module"})),ABe=()=>{const[e,t]=v.useState(!1),{activeProvider:n,activeModel:r,apiKeys:a,autoExecuteSQL:s,currentConversation:i,addMessageToConversation:l,setProcessing:c,addQueryToHistory:u,currentResponse:h,streamingResponse:m,setCurrentResponse:p,setStreamingResponse:g,setCurrentTokenUsage:T,setVisualizationTokenUsage:y,setCurrentError:b,multiTableContexts:x,setActiveFileConversation:R,addMessageToFileConversation:A}=ys(),{executeQuery:w,executePaginatedQuery:_}=Dt(),{executeAIGeneratedSQL:N,previewSQL:I,validateSQL:D}=bBe(),M=ut(X0),O=ut(d7),L=ut(kr),{isAuthenticated:k}=ea(),F=ut(ae=>{const ne=kr(ae),ce=ae.emptyStateViewMode;return(ne==null?void 0:ne.viewMode)||ce});v.useEffect(()=>{L!=null&&L.id?R(L.id):R(null)},[L==null?void 0:L.id,R]),v.useEffect(()=>{for(const[ae,ne]of a)ne&&ae!=="datakit"&&Dn.setApiKey(ae,ne,r||void 0);if(k&&r&&(r==="datakit-smart"||r==="datakit-fast")){const ae=new TZ(r);Dn.setProvider("datakit",ae)}},[a,r,k]);const U=v.useCallback(()=>H(null,null,function*(){if(!M||!O)return null;try{const ae=yield w('DESCRIBE "'.concat(M,'"')),ne=ae?ae.toArray().map(ce=>({name:ce.column_name||ce.name||"",type:ce.column_type||ce.type||""})):[];return{tableName:M,schema:ne,rowCount:O.rowCount,description:"".concat(O.fileType," file with ").concat(O.columnCount," columns")}}catch(ae){return{tableName:M,schema:[],rowCount:O.rowCount,description:"".concat(O.fileType," file with ").concat(O.columnCount," columns")}}}),[M,O,w]),B=v.useCallback(()=>H(null,null,function*(){const ae=x.filter(ce=>ce.isSelected);return ae.length===0?null:{tables:yield Promise.all(ae.map(ce=>H(null,null,function*(){try{const ie=yield w('DESCRIBE "'.concat(ce.tableName,'"')),W=ie?ie.toArray().map(Q=>({name:Q.column_name||Q.name||"",type:Q.column_type||Q.type||""})):ce.schema;return{tableName:ce.tableName,schema:W,rowCount:ce.rowCount,description:ce.description}}catch(ie){return{tableName:ce.tableName,schema:ce.schema,rowCount:ce.rowCount,description:ce.description}}})))}}),[x,w]),j=v.useCallback(ae=>{const ne=ae.toLowerCase();return ne.includes("chart")||ne.includes("graph")||ne.includes("plot")?{type:"visualization",confidence:.8,explanation:"Request appears to be asking for a visualization"}:ne.includes("analyze")||ne.includes("pattern")||ne.includes("insight")?{type:"analysis",confidence:.9,explanation:"Request appears to be asking for data analysis"}:ne.includes("show")||ne.includes("get")||ne.includes("find")?{type:"query",confidence:.7,explanation:"Request appears to be asking for data retrieval"}:{type:"query",confidence:.6,explanation:"Default interpretation as data query"}},[]),G=v.useCallback(ae=>{const ne=[],ce=ae.match(/```sql\s*\n([\s\S]*?)\n\s*```/gi)||ae.match(/```\s*\n([\s\S]*?)\n\s*```/gi);if(ce&&ce.forEach(ie=>{const W=ie.replace(/```(?:sql)?\s*\n?/gi,"").replace(/\n?\s*```/gi,"").trim();W&&W.length>5&&/^\s*(SELECT|WITH|INSERT|UPDATE|DELETE|CREATE|SUMMARIZE|DESCRIBE|PRAGMA|SHOW|EXPLAIN|ALTER|DROP)/i.test(W)&&ne.push(W)}),ne.length===0){const ie=ae.split("\n");let W=!1,Q=[];for(const se of ie)if(/^\s*(SELECT|WITH|INSERT|UPDATE|DELETE|CREATE|SUMMARIZE|DESCRIBE|PRAGMA|SHOW|EXPLAIN|ALTER|DROP)/i.test(se.trim()))W=!0,Q=[se];else if(W)if(se.trim()===""||/^This query|^The query|^This will|^The result/i.test(se.trim())||/^\d+\./.test(se.trim())||se.trim().endsWith(";")&&!se.includes("SELECT")&&!se.includes("FROM")){if(Q.length>0){const z=Q.join("\n").trim();z.length>10&&ne.push(z)}W=!1,Q=[]}else Q.push(se);if(W&&Q.length>0){const se=Q.join("\n").trim();se.length>10&&ne.push(se)}}return ne},[]),K=v.useCallback(ae=>{const ne=[],ce=ae.match(/```python\s*\n([\s\S]*?)\n\s*```/gi)||[];return ce&&ce.forEach(ie=>{const W=ie.replace(/```python\s*\n?/gi,"").replace(/\n?\s*```/gi,"").trim();W&&W.length>5&&ne.push(W)}),ne.length===0&&(ae.match(/```\s*\n([\s\S]*?)\n\s*```/gi)||[]).forEach(W=>{const Q=W.replace(/```\s*\n?/gi,"").replace(/\n?\s*```/gi,"").trim();Q&&Q.length>5&&/import |from |def |class |if __name__|print\(|\.iloc|\.loc|pd\.|np\.|plt\.|sql\(|await sql/i.test(Q)&&ne.push(Q)}),ne},[]),J=v.useCallback(ae=>H(null,null,function*(){const ne=yield U();if(!ne)throw new Error("No data context available");if(!Dn.isProviderReady(n))throw n==="datakit"?new Error("Please sign in to use DataKit AI"):new Error("AI provider ".concat(n," not configured"));return yield Dn.generateSQL(n,ae,ne)}),[n,U]),$=v.useCallback((ae,ne)=>H(null,null,function*(){const ce=yield U();if(!ce)throw new Error("No data context available");if(!Dn.isProviderReady(n))throw n==="datakit"?new Error("Please sign in to use DataKit AI"):new Error("AI provider ".concat(n," not configured"));return yield Dn.analyzeData(n,ae,ce,ne)}),[n,U]),X=v.useCallback(ae=>H(null,null,function*(){if(!ae.trim())throw new Error("Prompt cannot be empty");t(!0),c(!0),g(""),T(null),y(null),b(null);const ne=Date.now();try{const ce=yield B();if(!ce||ce.tables.length===0)throw new Error("No data context available");const Q={role:"system",content:F==="notebook"?WEe(ce):YEe(ce)},se={role:"user",content:ae},z=[Q,...i,se];let xe="";yield Dn.generateCompletionStream(n,z,le=>{if(!le.done)g(le.content),xe=le.content;else{const pe=Date.now()-ne;L!=null&&L.id?(A(L.id,se),A(L.id,{role:"assistant",content:xe})):(l(se),l({role:"assistant",content:xe}));const _e={id:Date.now().toString(),prompt:ae,model:r||"unknown",provider:n,response:xe,timestamp:new Date,executionTime:pe,tokens:le.usage,cost:le.usage?Dn.calculateCost(n,le.usage):0};if(u(_e),p(xe),g(""),le.usage&&T({input:le.usage.promptTokens,output:le.usage.completionTokens}),n==="datakit"&&le._datakit){const re=le._datakit}if(s){const re=G(xe);if(re.length>0){const Se=re[0];Se&&Se.length>20&&!Se.endsWith("SELECT")&&te(Se)}}}},{temperature:.1,maxTokens:8e3})}catch(ce){const ie=ce instanceof Error?ce.message:"Unknown error occurred",W={id:Date.now().toString(),prompt:ae,model:r||"unknown",provider:n,error:ie,timestamp:new Date,executionTime:Date.now()-ne};throw u(W),b(ie),ce}finally{t(!1),c(!1)}}),[n,r,L,i,l,A,B,u,c,p,g,T,b,s,G,F]),Z=v.useCallback((ae,ne=!0)=>H(null,null,function*(){return yield N(ae,ne)}),[N]),V=v.useCallback(()=>!n||!r?!1:n==="datakit"?k:n==="local"?Dn.isLocalModelLoaded():a.has(n)&&!!a.get(n),[n,a,r,k]),te=v.useCallback(ae=>H(null,null,function*(){try{const ne=yield _(ae,1,100);if(ne&&ne.data&&ne.data.length>=0){const ce=window.__queryResultsOverlayHandler;if(ce&&typeof ce=="function"&&ce(ne,ae,ne.queryTime||0))return;const{setQueryResults:ie}=ys.getState(),W=ne.columns||(ne.data.length>0?Object.keys(ne.data[0]):[]),Q=ne.totalRows||ne.data.length,se=ne.totalPages||Math.ceil(Q/100);ie({data:ne.data,columns:W,totalRows:Q,totalPages:se,currentPage:ne.page||1,rowsPerPage:ne.pageSize||100,isLoading:!1,error:null,executedSQL:ae})}else{const{setQueryResults:ce}=ys.getState();ce({data:null,columns:null,totalRows:0,totalPages:0,currentPage:1,rowsPerPage:100,isLoading:!1,error:"No data returned from query"})}}catch(ne){const{setQueryResults:ce}=ys.getState();ce({data:null,columns:null,totalRows:0,totalPages:0,currentPage:1,rowsPerPage:100,isLoading:!1,error:ne instanceof Error?ne.message:"Unknown error occurred"})}}),[_]);return{isExecuting:e,currentResponse:h,streamingResponse:m,canExecute:V(),isLoading:e,executeAIQueryStream:X,executeGeneratedSQL:Z,generateSQL:J,analyzeData:$,detectIntent:j,previewSQL:I,validateSQL:D,handleRunSQL:te,extractSQLQueries:G,extractPythonQueries:K,clearResponse:()=>{p(null),g(""),b(null)}}};class yZ{constructor(){Kt(this,"STORAGE_KEY","datakit-local-models");Kt(this,"MAX_STORAGE_GB",10);Kt(this,"downloadCallbacks",new Map)}getStorageInfo(){return H(this,null,function*(){const t=this.getDownloadedModels(),n=t.reduce((a,s)=>a+s.size*1024*1024,0);let r;if("storage"in navigator&&"estimate"in navigator.storage)try{const a=yield navigator.storage.estimate();a.quota&&a.usage&&(r=a.quota-a.usage)}catch(a){}return{totalModels:t.length,totalSizeBytes:n,availableSpace:r,models:t.map(a=>({modelId:a.id,sizeBytes:a.size*1024*1024,lastUsed:new Date(a.lastUsed||Date.now()),downloadDate:new Date(a.downloadDate||Date.now())}))}})}canDownloadModel(t){return H(this,null,function*(){const n=yield this.getStorageInfo(),r=t*1024*1024,a=this.MAX_STORAGE_GB*1024*1024*1024;return n.totalSizeBytes+r>a?{canDownload:!1,reason:"Would exceed storage limit of ".concat(this.MAX_STORAGE_GB,"GB. Consider removing unused models.")}:n.availableSpace&&n.availableSpace<r*1.2?{canDownload:!1,reason:"Insufficient browser storage space. Try clearing cache or removing other data."}:{canDownload:!0}})}markModelDownloaded(t){const n=this.getDownloadedModels(),r=n.findIndex(s=>s.id===t.id),a=he(q({},t),{isDownloaded:!0,downloadDate:new Date().toISOString(),lastUsed:new Date().toISOString()});r>=0?n[r]=a:n.push(a),this.saveDownloadedModels(n)}markModelUsed(t){const n=this.getDownloadedModels(),r=n.find(a=>a.id===t);r&&(r.lastUsed=new Date().toISOString(),this.saveDownloadedModels(n))}removeModel(t){const r=this.getDownloadedModels().filter(a=>a.id!==t);this.saveDownloadedModels(r)}getDownloadedModels(){try{const t=localStorage.getItem(this.STORAGE_KEY);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n:[]}catch(t){return[]}}isModelDownloaded(t){return this.getDownloadedModels().some(r=>r.id===t&&r.isDownloaded)}getDownloadedModel(t){return this.getDownloadedModels().find(r=>r.id===t)}cleanupOldModels(t=2e3){return H(this,null,function*(){const n=this.getDownloadedModels(),r=t*1024*1024,a=n.filter(l=>l.lastUsed).sort((l,c)=>new Date(l.lastUsed).getTime()-new Date(c.lastUsed).getTime()),s=[];let i=0;for(const l of a){if(i>=r)break;this.removeModel(l.id),s.push(l.name),i+=l.size*1024*1024}return s})}onDownloadProgress(t,n){this.downloadCallbacks.set(t,n)}removeDownloadCallback(t){this.downloadCallbacks.delete(t)}emitProgress(t){const n=this.downloadCallbacks.get(t.modelId);n&&n(t)}startDownload(t){return H(this,null,function*(){const n=yield this.canDownloadModel(t.size);if(!n.canDownload)throw this.emitProgress({modelId:t.id,progress:0,stage:"error",message:n.reason||"Cannot download model",error:n.reason}),new Error(n.reason);this.emitProgress({modelId:t.id,progress:0,stage:"downloading",message:"Starting download..."})})}handleDownloadComplete(t){this.markModelDownloaded(t),this.emitProgress({modelId:t.id,progress:100,stage:"ready",message:"Model ready for use"})}handleDownloadError(t,n){this.emitProgress({modelId:t,progress:0,stage:"error",message:"Download failed",error:n})}getRecommendedCleanup(){const t=this.getDownloadedModels(),n=new Date;return n.setMonth(n.getMonth()-1),t.filter(r=>r.lastUsed&&new Date(r.lastUsed)<n).sort((r,a)=>new Date(r.lastUsed).getTime()-new Date(a.lastUsed).getTime())}saveDownloadedModels(t){try{localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t))}catch(n){}}clearAllModels(){localStorage.removeItem(this.STORAGE_KEY)}exportSettings(){const t=this.getDownloadedModels();return JSON.stringify({version:"1.0",timestamp:new Date().toISOString(),models:t.map(n=>({id:n.id,name:n.name,size:n.size,downloadDate:n.downloadDate,lastUsed:n.lastUsed}))},null,2)}importSettings(t){try{const n=JSON.parse(t);if(n.version==="1.0"&&Array.isArray(n.models)){const r=this.getDownloadedModels(),a=n.models.filter(s=>!r.some(i=>i.id===s.id));a.length>0&&this.saveDownloadedModels([...r,...a])}}catch(n){throw new Error("Invalid settings format")}}}const ks=new yZ,RBe=Object.freeze(Object.defineProperty({__proto__:null,ModelManager:yZ,modelManager:ks},Symbol.toStringTag,{value:"Module"})),bS="/assets/openai-DaV4KpBm.webp",ac="/assets/anthropic-2BQxoj0R.webp",eP="/assets/groq-DW9sPbI0.png",NBe="/assets/datakitShort-BWI5es8J.png",tP="/assets/ollama-Ax8Aikju.webp",_Be=({onClose:e})=>{const{t}=Ze(),[n,r]=v.useState([]),[a,s]=v.useState([]),[i,l]=v.useState(null),[c,u]=v.useState(new Map),[h,m]=v.useState(null),[p,g]=v.useState(!0),{setActiveModel:T,setActiveProvider:y}=ys();v.useEffect(()=>{b()},[]);const b=()=>H(null,null,function*(){g(!0);try{const M=yield Dn.isWebGPUSupported();m(M);const O=Dn.getAvailableLocalModels();r(O);const L=ks.getDownloadedModels();s(L);const k=yield ks.getStorageInfo();l(k)}catch(M){}finally{g(!1)}}),x=M=>H(null,null,function*(){try{const O={id:M.id,name:M.name,provider:"local",type:"chat",contextWindow:4096,capabilities:M.capabilities||["sql","analysis"],requiresApiKey:!1,isLocal:!0,size:M.size,quantization:"4bit"};ks.onDownloadProgress(M.id,L=>{u(k=>new Map(k.set(M.id,L))),L.stage==="ready"&&b()}),yield ks.startDownload(O),yield Dn.loadLocalModel(M.id,L=>{ks.emitProgress({modelId:M.id,progress:L,stage:L<100?"downloading":"loading",message:L<100?"Downloading... ".concat(L.toFixed(1),"%"):"Loading model..."})}),ks.handleDownloadComplete(O)}catch(O){const L=O instanceof Error?O.message:"Download failed";ks.handleDownloadError(M.id,L)}}),R=M=>{confirm(t("ai.localModels.deleteConfirm",{defaultValue:"Are you sure you want to delete this model? This cannot be undone."}))&&(ks.removeModel(M),Dn.getLoadedLocalModel()===M&&Dn.unloadLocalModel(),b())},A=M=>H(null,null,function*(){try{Dn.getLoadedLocalModel()!==M&&(yield Dn.loadLocalModel(M)),y("local"),T(M),ks.markModelUsed(M),e&&e()}catch(O){}}),w=M=>{if(M===0)return"0 B";const O=1024,L=["B","KB","MB","GB"],k=Math.floor(Math.log(M)/Math.log(O));return parseFloat((M/Math.pow(O,k)).toFixed(1))+" "+L[k]},_=M=>M>=1024?"".concat((M/1024).toFixed(1)," GB"):"".concat(M," MB"),N=M=>c.get(M)||null,I=M=>a.some(O=>O.id===M),D=Dn.getLoadedLocalModel();return p?o.jsxs("div",{className:"p-6 text-center",children:[o.jsx(Hn,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-primary"}),o.jsx("p",{className:"text-white/70",children:t("ai.localModels.loading",{defaultValue:"Loading local models..."})})]}):o.jsxs("div",{className:"p-6 max-h-[80vh] overflow-y-auto",children:[o.jsxs("div",{className:"mb-6",children:[o.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:t("ai.localModels.title",{defaultValue:"Local AI Models"})}),o.jsx("p",{className:"text-sm text-white/70",children:t("ai.localModels.description",{defaultValue:"Run AI models locally in your browser with complete privacy"})})]}),o.jsxs("div",{className:Qe("mb-6 p-4 rounded-lg border",h?"bg-green-500/10 border-green-500/30":"bg-red-500/10 border-red-500/30"),children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h?o.jsx(Zr,{className:"h-4 w-4 text-green-400"}):o.jsx(Cn,{className:"h-4 w-4 text-red-400"}),o.jsxs("span",{className:"text-sm font-medium text-white",children:[t("ai.localModels.webgpu.title",{defaultValue:"WebGPU"})," ",h?t("ai.localModels.webgpu.supported",{defaultValue:"Supported"}):t("ai.localModels.webgpu.notSupported",{defaultValue:"Not Supported"})]})]}),o.jsx("p",{className:"text-xs text-white/70",children:h?t("ai.localModels.webgpu.supportedDesc",{defaultValue:"Your browser supports WebGPU acceleration for faster local AI inference."}):t("ai.localModels.webgpu.notSupportedDesc",{defaultValue:"WebGPU is required for local models. Please use Chrome 113+, Edge 113+, or Firefox 110+."})})]}),i&&o.jsxs("div",{className:"mb-6 p-4 bg-white/5 border border-white/10 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(hO,{className:"h-4 w-4 text-white/60"}),o.jsx("span",{className:"text-sm font-medium text-white",children:t("ai.localModels.storage.title",{defaultValue:"Storage Usage"})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-white/60",children:t("ai.localModels.storage.downloadedModels",{defaultValue:"Downloaded Models:"})}),o.jsx("span",{className:"text-white ml-2",children:i.totalModels})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-white/60",children:t("ai.localModels.storage.storageUsed",{defaultValue:"Storage Used:"})}),o.jsx("span",{className:"text-white ml-2",children:w(i.totalSizeBytes)})]})]})]}),o.jsxs("div",{className:"mb-6",children:[o.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-2",children:[o.jsx(Hr,{className:"h-4 w-4"}),t("ai.localModels.availableModels",{defaultValue:"Available Models"})]}),o.jsx("div",{className:"space-y-3",children:n.map(M=>{const O=N(M.id),L=I(M.id),k=D===M.id;return o.jsx("div",{className:"p-4 bg-white/5 border border-white/10 rounded-lg",children:o.jsxs("div",{className:"flex items-start justify-between mb-2",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h5",{className:"text-sm font-medium text-white",children:M.name}),k&&o.jsx("span",{className:"text-xs bg-primary/20 text-primary px-2 py-0.5 rounded",children:t("ai.localModels.active",{defaultValue:"Active"})})]}),o.jsx("p",{className:"text-xs text-white/60 mb-2",children:M.description}),o.jsxs("div",{className:"flex items-center gap-4 text-xs text-white/50",children:[o.jsxs("span",{children:[t("ai.localModels.size",{defaultValue:"Size"}),": ",_(M.size)]}),o.jsxs("span",{children:[t("ai.localModels.capabilities",{defaultValue:"Capabilities"}),": ",M.capabilities.join(", ")]})]})]}),o.jsx("div",{className:"flex items-center gap-2",children:O&&O.stage!=="ready"?o.jsxs("div",{className:"text-xs text-white/70",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(Hn,{className:"h-3 w-3 animate-spin"}),o.jsx("span",{children:O.message})]}),o.jsx("div",{className:"w-20 h-1 bg-white/20 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:"".concat(O.progress,"%")}})})]}):L?o.jsx(je,{variant:"primary",size:"sm",onClick:()=>A(M.id),className:"h-7",children:k?t("ai.localModels.current",{defaultValue:"Current"}):t("ai.localModels.useModel",{defaultValue:"Use Model"})}):h?o.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>x(M),className:"h-7",children:[o.jsx(Hr,{className:"h-3 w-3 mr-1"}),t("ai.localModels.download",{defaultValue:"Download"})]}):o.jsx("span",{className:"text-xs text-red-400",children:t("ai.localModels.webgpuRequired",{defaultValue:"WebGPU Required"})})})]})},M.id)})})]}),a.length>0&&o.jsxs("div",{children:[o.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-2",children:[o.jsx(H0,{className:"h-4 w-4"}),t("ai.localModels.downloadedModels",{defaultValue:"Downloaded Models"})]}),o.jsx("div",{className:"space-y-3",children:a.map(M=>{const O=D===M.id;return o.jsx("div",{className:"p-4 bg-white/5 border border-white/10 rounded-lg",children:o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h5",{className:"text-sm font-medium text-white",children:M.name}),O&&o.jsx("span",{className:"text-xs bg-primary/20 text-primary px-2 py-0.5 rounded",children:t("ai.localModels.active",{defaultValue:"Active"})})]}),o.jsxs("div",{className:"flex items-center gap-4 text-xs text-white/50",children:[o.jsxs("span",{children:[t("ai.localModels.size",{defaultValue:"Size"}),": ",_(M.size)]}),M.lastUsed&&o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(du,{className:"h-3 w-3"}),t("ai.localModels.lastUsed",{defaultValue:"Last used"}),": ",new Date(M.lastUsed).toLocaleDateString()]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(je,{variant:"primary",size:"sm",onClick:()=>A(M.id),className:"h-7",disabled:O,children:O?t("ai.localModels.current",{defaultValue:"Current"}):t("ai.localModels.useModel",{defaultValue:"Use Model"})}),o.jsx(je,{variant:"ghost",size:"sm",onClick:()=>R(M.id),className:"h-7 text-red-400 hover:text-red-300",children:o.jsx(Hl,{className:"h-3 w-3"})})]})]})},M.id)})})]}),o.jsxs("div",{className:"mt-6 pt-4 border-t border-white/10 flex justify-between items-center",children:[o.jsxs(je,{variant:"ghost",size:"sm",onClick:b,className:"h-7",children:[o.jsx(ma,{className:"h-3 w-3 mr-1"}),t("ai.localModels.refresh",{defaultValue:"Refresh"})]}),e&&o.jsx(je,{variant:"primary",onClick:e,children:t("ai.localModels.done",{defaultValue:"Done"})})]})]})},wBe=({baseUrl:e="http://localhost:11434",onModelSelect:t,selectedModel:n})=>{const{t:r}=Ze(),[a,s]=v.useState([]),[i,l]=v.useState(!1),[c,u]=v.useState(!1),[h,m]=v.useState(null),[p,g]=v.useState(new Set),[T,y]=v.useState(new Map),[b,x]=v.useState(!1),{apiKeys:R,setApiKey:A}=ys();v.useEffect(()=>{w()},[e]);const w=()=>H(null,null,function*(){l(!0),m(null);try{A("ollama",e);const I=yield Dn.validateApiKey("ollama");if(u(I),I){const D=yield Dn.getOllamaModels();s(D)}else m(r("ai.ollama.connectionFailed",{defaultValue:"Cannot connect to Ollama at ".concat(e,". Make sure Ollama is running."),baseUrl:e}))}catch(I){u(!1),m(I instanceof Error?I.message:"Failed to connect to Ollama at ".concat(e)),s([])}finally{l(!1)}}),_=I=>(I/1073741824).toFixed(1)+" GB",N=I=>new Date(I).toLocaleDateString();return i?o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(Hn,{className:"h-8 w-8 animate-spin text-primary mb-4"}),o.jsx("p",{className:"text-white/70",children:r("ai.ollama.connecting",{defaultValue:"Connecting to Ollama..."})})]}):c?o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center gap-3 p-3 bg-green-500/10 border border-green-500/30 rounded-lg",children:[o.jsx(Zr,{className:"h-4 w-4 text-green-400"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-sm font-medium text-white",children:r("ai.ollama.connected",{defaultValue:"Connected to Ollama"})}),o.jsx("p",{className:"text-xs text-white/70",children:e})]}),o.jsx(je,{onClick:w,variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:o.jsx(ma,{className:"h-3 w-3"})})]}),o.jsxs("div",{children:[o.jsx("div",{className:"flex items-center justify-between mb-4",children:o.jsx("h4",{className:"text-sm font-medium text-white",children:r("ai.ollama.installedModels",{defaultValue:"Installed Models ({count})",count:a.length})})}),a.length===0?o.jsxs("div",{className:"text-center py-8",children:[o.jsx($y,{className:"h-8 w-8 text-white/30 mx-auto mb-3"}),o.jsx("p",{className:"text-sm text-white/70 mb-2",children:r("ai.ollama.noModels",{defaultValue:"No models installed"})}),o.jsx("p",{className:"text-xs text-white/50",children:r("ai.ollama.pullModelToStart",{defaultValue:"Pull a model below to get started"})})]}):o.jsx("div",{className:"space-y-2",children:a.map(I=>o.jsx("div",{className:"p-3 rounded-lg border transition-all duration-200 cursor-pointer ".concat(n===I.name?"border-primary/50 bg-primary/10":"border-white/10 bg-white/5 hover:bg-white/10"),onClick:()=>t==null?void 0:t(I.name),children:o.jsx("div",{className:"flex items-center justify-between",children:o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("p",{className:"text-sm font-medium text-white truncate",children:I.name}),n===I.name&&o.jsx(Zr,{className:"h-3 w-3 text-primary flex-shrink-0"})]}),o.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[o.jsx("span",{className:"text-xs text-white/60",children:_(I.size)}),o.jsx("span",{className:"text-xs text-white/60",children:N(I.modified_at)})]})]})})},I.digest))})]}),o.jsx("div",{className:"p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx($y,{className:"h-4 w-4 text-blue-400 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"text-xs text-white/70",children:[o.jsx("p",{className:"mb-1",children:r("ai.ollama.privacyNote",{defaultValue:"Models run entirely on your machine for complete privacy."})}),o.jsxs("p",{children:[r("ai.ollama.needMoreModels",{defaultValue:"Need more models? Visit"})," ",o.jsxs("a",{href:"https://ollama.com/library",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline inline-flex items-center gap-1",children:[r("ai.ollama.ollamaLibrary",{defaultValue:"Ollama Library"}),o.jsx(qi,{className:"h-3 w-3"})]})]})]})]})})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-3 p-4 bg-red-500/10 border border-red-500/30 rounded-lg",children:[o.jsx(Cn,{className:"h-5 w-5 text-red-400 flex-shrink-0"}),o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-sm font-medium text-white",children:r("ai.ollama.connectionFailedTitle",{defaultValue:"Connection Failed"})}),o.jsx("p",{className:"text-xs text-white/70 mt-1",children:h||r("ai.ollama.cannotConnect",{defaultValue:"Cannot connect to Ollama"})})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-sm font-medium text-white",children:r("ai.ollama.howToFix",{defaultValue:"How to fix this:"})}),o.jsxs("ul",{className:"text-xs text-white/70 space-y-2",children:[o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx(bA,{className:"h-1 w-1 mt-1.5 flex-shrink-0"}),o.jsxs("span",{children:[r("ai.ollama.installStep",{defaultValue:"Install Ollama from"})," ",o.jsx("a",{href:"https://ollama.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"ollama.com"})]})]}),o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx(bA,{className:"h-1 w-1 mt-1.5 flex-shrink-0"}),o.jsx("code",{className:"bg-white/10 px-1 rounded",children:r("ai.ollama.runCommand",{defaultValue:"Run"})}),o.jsxs("span",{children:[" ",r("ai.ollama.inTerminal",{defaultValue:"in terminal"})]})]}),o.jsxs("li",{className:"flex items-start gap-2",children:[o.jsx(bA,{className:"h-1 w-1 mt-1.5 flex-shrink-0"}),o.jsx("span",{children:r("ai.ollama.makeSureRunning",{defaultValue:"Make sure it's running on {baseUrl}",baseUrl:e})})]})]}),o.jsxs("div",{className:"mt-3 p-2 rounded-lg",children:[o.jsx("p",{className:"text-xs font-medium mb-1",children:r("ai.ollama.browserCompatibility",{defaultValue:"Browser Compatibility Note:"})}),o.jsx("a",{href:"https://firefox.com",target:"_blank",rel:"noopener noreferrer",children:o.jsx("p",{className:"text-xs text-white/60",children:r("ai.ollama.firefoxNote",{defaultValue:"If connection still fails, try using Firefox as it has better support for localhost connections from HTTPS sites."})})})]})]}),o.jsxs(je,{onClick:w,variant:"outline",size:"sm",className:"w-full",children:[o.jsx(ma,{className:"h-4 w-4 mr-2"}),r("ai.ollama.tryAgain",{defaultValue:"Try Again"})]})]})},xZ=({isOpen:e,onClose:t})=>{const{t:n}=Ze(),r={ollama:{name:"Ollama",icon:o.jsx("img",{src:tP,className:"h-4 w-4"}),color:"blue",description:n("ai.apiKey.providers.ollama.description",{defaultValue:"Local Ollama server - runs models on your machine"}),websiteUrl:"https://ollama.com",helpText:n("ai.apiKey.providers.ollama.helpText",{defaultValue:"Run AI models locally with complete privacy. Requires Ollama to be running at http://localhost:11434"}),keyFormat:"http://localhost:11434",isUrlInput:!0,provider:"local"},openai:{name:"OpenAI",icon:o.jsx("img",{src:bS,className:"h-5 w-5"}),color:"blue",description:n("ai.apiKey.providers.openai.description",{defaultValue:"GPT-4o and GPT-4o Mini models"}),websiteUrl:"https://platform.openai.com/api-keys",helpText:n("ai.apiKey.providers.openai.helpText",{defaultValue:"Most capable models for complex reasoning and analysis."}),keyFormat:"sk-..."},anthropic:{name:"Anthropic",icon:o.jsx("img",{src:ac,className:"h-4 w-4"}),color:"blue",description:n("ai.apiKey.providers.anthropic.description",{defaultValue:"Claude 4.5 Sonnet and smaller models"}),websiteUrl:"https://console.anthropic.com/",helpText:n("ai.apiKey.providers.anthropic.helpText",{defaultValue:"Excellent for detailed analysis and explanations. Free credits for new users."}),keyFormat:"sk-ant-..."},groq:{name:"Groq",icon:o.jsx("img",{src:eP,className:"h-4 w-4"}),color:"blue",description:n("ai.apiKey.providers.groq.description",{defaultValue:"Ultra-fast Llama 3.1 models with free tier"}),websiteUrl:"https://console.groq.com/keys",helpText:n("ai.apiKey.providers.groq.helpText",{defaultValue:"Fastest inference speed, perfect for trying AI features. Completely free to start."}),keyFormat:"gsk_..."}},[a,s]=v.useState("openai"),[i,l]=v.useState(new Map),[c,u]=v.useState(new Map),{isAuthenticated:h}=ea(),m=xi(),{apiKeys:p,activeModel:g,setActiveProvider:T,setActiveModel:y,autoExecuteSQL:b,showCostEstimates:x,setApiKey:R,updateSettings:A}=ys();Ht.useEffect(()=>{const M=new Map;for(const[O,L]of p)M.set(O,L);l(M)},[p]);const w=(M,O)=>{l(new Map(i.set(M,O)))},_=M=>{u(new Map(c.set(M,!c.get(M))))},N=()=>{for(const[M,O]of i)O.trim()&&(R(M,O.trim()),T(M));t()},I=()=>{t(),m("/settings#ai")},D=(M,O)=>{const L=r[M].color;switch(O){case"bg":return"bg-".concat(L,"-500/10");case"border":return"border-".concat(L,"-500/30");case"text":return"text-".concat(L,"-500");default:return""}};return o.jsx(At,{children:e&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"fixed inset-0 z-50 flex items-center justify-center px-4 backdrop-blur-sm bg-black/60",onClick:t,children:o.jsxs(me.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{delay:.1,duration:.2},className:"w-full max-w-4xl h-[85vh] bg-black border border-white/20 rounded-lg shadow-xl shadow-black/30 overflow-hidden flex",onClick:M=>M.stopPropagation(),children:[o.jsxs("div",{className:"w-64 bg-gradient-to-b from-darkNav to-black border-r border-white/10 flex flex-col",children:[o.jsxs("div",{className:"p-4 border-b border-white/10",children:[o.jsx("h2",{className:"text-lg font-heading font-medium text-white",children:n("ai.apiKey.configuration",{defaultValue:"Configuration"})}),o.jsx("p",{className:"text-xs text-white/60 mt-1",children:n("ai.apiKey.configureDescription",{defaultValue:"Configure AI providers and settings"})})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsx("div",{className:"p-2",children:Object.keys(r).map(M=>{const O=r[M],L=p.has(M)&&!!p.get(M);return o.jsxs("button",{onClick:()=>s(M),className:Qe("w-full text-left p-3 rounded-lg mb-1 transition-all duration-200 group relative",a===M?"".concat(D(M,"bg")," ").concat(D(M,"border")," border text-white"):"text-white/70 hover:text-white hover:bg-white/5 border border-transparent"),children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("div",{className:Qe("h-8 w-8 rounded-md flex items-center justify-center mr-3 border",a===M?"".concat(D(M,"border")," ").concat(D(M,"text")):"bg-white/5 border-white/10 text-white/60"),children:O.icon}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("p",{className:"text-sm font-medium truncate",children:O.name}),L&&o.jsx(Zr,{className:"ml-2 h-3 w-3 text-green-400"})]}),o.jsx("p",{className:"text-xs mt-0.5 truncate opacity-80",children:M==="local"||M==="ollama"?n("ai.apiKey.providerTypes.local",{defaultValue:"Local"}):n("ai.apiKey.providerTypes.cloudApi",{defaultValue:"Cloud API"})})]})]}),a===M&&o.jsx(me.div,{layoutId:"activeProvider",className:Qe("absolute left-0 top-1/2 transform -translate-y-1/2 w-1 h-8 rounded-r","bg-".concat(O.color,"-500")),transition:{type:"spring",stiffness:300,damping:30}})]},M)})})})]}),o.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[o.jsx("div",{className:"p-4 border-b border-white/10 bg-gradient-to-r from-background/50 to-background/30",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center",children:[o.jsx("div",{className:Qe("h-8 w-8 rounded-md flex items-center justify-center mr-3 border","".concat(D(a,"border")," ").concat(D(a,"text"))),children:r[a].icon}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-white",children:r[a].name}),o.jsx("p",{className:"text-sm text-white/70",children:r[a].description})]})]}),o.jsx(je,{variant:"ghost",size:"sm",onClick:t,className:"h-8 w-8 p-0 rounded-full text-white/70 hover:text-white hover:bg-white/10",children:o.jsx(ur,{className:"h-4 w-4"})})]})}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:a==="local"?o.jsx(_Be,{}):a==="ollama"?o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-sm font-medium text-white mb-3",children:n("ai.apiKey.serverConfiguration",{defaultValue:"Server Configuration"})}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/80 mb-2",children:n("ai.apiKey.ollamaServerUrl",{defaultValue:"Ollama Server URL"})}),o.jsx("input",{type:"text",value:i.get("ollama")||"",onChange:M=>w("ollama",M.target.value),placeholder:"http://localhost:11434",className:"w-full px-3 py-2 bg-white/5 border border-white/10 rounded-lg text-white placeholder-white/40 focus:outline-none focus:border-primary/50"}),o.jsx("p",{className:"text-xs text-white/60 mt-1",children:n("ai.apiKey.ollamaServerUrlDescription",{defaultValue:"The URL where your Ollama server is running"})})]})]}),o.jsx(wBe,{baseUrl:i.get("ollama")||"http://localhost:11434",selectedModel:g||Dn.getOllamaModel()||void 0,onModelSelect:M=>{Dn.setOllamaModel(M),y(M)}})]}):o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-sm font-medium text-white mb-3",children:n("ai.apiKey.apiKeyConfiguration",{defaultValue:"API Key Configuration"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/80 mb-2",children:a==="ollama"?n("ai.apiKey.ollamaServerUrl",{defaultValue:"Ollama Server URL"}):n("ai.apiKey.apiKey",{defaultValue:"API Key"})}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:a==="ollama"||c.get(a)?"text":"password",value:i.get(a)||"",onChange:M=>w(a,M.target.value),placeholder:a==="ollama"?"http://localhost:11434":n("ai.apiKey.enterApiKeyPlaceholder",{provider:r[a].name,defaultValue:"Enter your {{provider}} API key"}),className:"w-full px-3 py-2 pr-20 bg-white/5 border border-white/10 rounded-lg text-white placeholder-white/40 focus:outline-none focus:border-primary/50"}),a!=="ollama"&&o.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1",children:o.jsx(je,{variant:"ghost",size:"sm",onClick:()=>_(a),className:"h-6 w-6 p-0",children:c.get(a)?o.jsx(wL,{className:"h-3 w-3"}):o.jsx(Jr,{className:"h-3 w-3"})})})]})]}),!h&&o.jsx("div",{className:"bg-primary/10 border border-primary/30 rounded-lg p-4 mt-4",children:o.jsx("div",{className:"flex items-start gap-3",children:o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-sm font-medium text-white mb-1",children:n("ai.apiKey.skipApiKeysTitle",{defaultValue:"Skip the API keys with DataKit credits"})}),o.jsx("p",{className:"text-xs text-white/70 mb-3",children:n("ai.apiKey.skipApiKeysDescription",{defaultValue:"Get instant access to powerful AI models without managing API keys. Credits included with your account."})}),o.jsx(je,{variant:"outline",size:"sm",onClick:I,className:"h-7 bg-primary/20 hover:bg-primary/30 border-primary/50 text-primary",children:n("ai.apiKey.signInToGetStarted",{defaultValue:"Sign in to get started"})})]})})}),r[a].websiteUrl&&o.jsx("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:o.jsx("div",{className:"flex items-start gap-3",children:o.jsxs("div",{className:"flex-1",children:[o.jsx("p",{className:"text-sm text-white/80 mb-2",children:r[a].helpText}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsxs(je,{variant:"ghost",size:"sm",onClick:()=>window.open(r[a].websiteUrl,"_blank"),className:"h-7",children:[o.jsx(qi,{className:"h-3 w-3 mr-1"}),n("ai.apiKey.getApiKey",{defaultValue:"Get API Key"})]})})]})})})]})]}),o.jsxs("div",{className:"border-t border-white/10 pt-6",children:[o.jsxs("h4",{className:"text-sm font-medium text-white mb-3 flex items-center gap-2",children:[o.jsx(qs,{className:"h-4 w-4"}),n("ai.apiKey.generalSettings",{defaultValue:"General Settings"})]}),o.jsx("div",{className:"space-y-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-sm text-white/80",children:n("ai.apiKey.autoExecuteSQL",{defaultValue:"Auto-execute generated SQL"})}),o.jsx("p",{className:"text-xs text-white/60",children:n("ai.apiKey.autoExecuteSQLDescription",{defaultValue:"Automatically run SQL queries generated by AI"})})]}),o.jsx("button",{onClick:()=>A({autoExecuteSQL:!b}),className:Qe("relative inline-flex h-5 w-9 items-center rounded-full transition-colors",b?"bg-primary":"bg-white/20"),children:o.jsx("span",{className:Qe("inline-block h-3 w-3 transform rounded-full bg-white transition-transform",b?"translate-x-5":"translate-x-1")})})]})})]})]})}),o.jsx("div",{className:"p-4 border-t border-white/10 bg-darkNav/30",children:o.jsxs("div",{className:"flex justify-end gap-3",children:[o.jsx(je,{variant:"ghost",onClick:t,children:n("common.cancel",{defaultValue:"Cancel"})}),o.jsx(je,{variant:"outline",onClick:N,children:n("ai.apiKey.saveConfiguration",{defaultValue:"Save Configuration"})})]})})]})]})})})},YC={datakit:o.jsx("img",{src:NBe,className:"h-4 w-4"}),openai:o.jsx("img",{src:bS,className:"h-4 w-4"}),anthropic:o.jsx("img",{src:ac,className:"h-4 w-4"}),groq:o.jsx("img",{src:eP,className:"h-4 w-4"}),local:o.jsx(H0,{className:"h-4 w-4"}),ollama:o.jsx("img",{src:tP,className:"h-4 w-4"})},CBe=({compact:e=!1})=>{const{t}=Ze(),[n,r]=v.useState(!1),[a,s]=v.useState([]),i=v.useRef(null),[l,c]=v.useState(!1),[u,h]=v.useState("signup"),[m,p]=v.useState(!1),{isAuthenticated:g,user:T}=ea();xi();const{activeProvider:y,activeModel:b,availableModels:x,localModels:R,apiKeys:A,setActiveProvider:w,setActiveModel:_,updateOllamaModels:N}=ys();v.useEffect(()=>{const U=ks.getDownloadedModels();s(U),H(null,null,function*(){try{if(A.has("ollama")||y==="ollama"){const j=A.get("ollama")||"http://localhost:11434";if(Dn.setApiKey("ollama",j),yield Dn.validateApiKey("ollama")){const K=yield Dn.getOllamaModels();K&&K.length>0&&N(K)}}}catch(j){}})},[n,A,y,N]),v.useEffect(()=>{const U=B=>{i.current&&!i.current.contains(B.target)&&r(!1)};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);const D=(()=>{if(!b)return null;for(const[U,B]of x){const j=B.find(G=>G.id===b);if(j)return j}return R.find(U=>U.id===b)||null})(),M=U=>g?U==="local"||U==="ollama"||U==="datakit"?g:A.has(U)&&!!A.get(U):!1,O=U=>{h(U),c(!0)},L=()=>{r(!1),p(!0)},k=(U,B)=>H(null,null,function*(){if(!g){r(!1),O("signup");return}if(w(U),_(B),r(!1),U!=="datakit"&&U==="local")try{Dn.getLoadedLocalModel()!==B&&(yield Dn.loadLocalModel(B),ks.markModelUsed(B))}catch(j){}}),F=()=>{r(!1),O("signup")};return o.jsxs("div",{className:"relative",ref:i,children:[o.jsxs("button",{onClick:()=>r(!n),className:Qe("flex items-center gap-1.5 px-2 py-1 rounded border transition-all duration-200 text-xs",e?"text-xs min-w-0":"space-x-2 p-2",D&&M(y)?"bg-white/5 border-white/20 text-white/90 hover:bg-white/10":"bg-white/5 border-white/10 text-white/60 hover:bg-white/10",n&&"ring-1 ring-primary/30"),children:[D?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Qe(e?"h-3 w-3":"h-4 w-4","rounded flex items-center justify-center flex-shrink-0",M(y)?"text-white/80":"text-white/40"),children:Ht.cloneElement(YC[y],{className:e?"h-3 w-3":"h-4 w-4"})}),o.jsx("span",{className:Qe("font-medium truncate",e?"text-xs max-w-20":"text-sm max-w-32"),children:e?y==="datakit"?D.id==="datakit-smart"?"Smart":D.id==="datakit-fast"?"Fast":D.name.split(" ")[0]:D.name.includes("GPT")?D.name.replace("GPT-","GPT"):D.name.includes("Claude")?D.name.replace("Claude ",""):D.name.includes("Llama")?D.name.split(" ")[0]+" "+D.name.split(" ")[1]:D.name.split(" ")[0]:D.name})]}):o.jsxs(o.Fragment,{children:[o.jsx(H0,{className:Qe(e?"h-3 w-3":"h-4 w-4","text-white/40 flex-shrink-0")}),o.jsx("span",{className:e?"text-xs":"text-sm",children:e?t("ai.modelSelector.model",{defaultValue:"Model"}):t("ai.modelSelector.selectModel",{defaultValue:"Select Model"})})]}),o.jsx(br,{className:Qe(e?"h-3 w-3":"h-4 w-4","text-white/60 transition-transform flex-shrink-0",n&&"rotate-180")})]}),o.jsx(At,{children:n&&o.jsx(me.div,{initial:{opacity:0,y:-10,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-10,scale:.95},transition:{duration:.2},className:Qe("absolute top-full mt-2 bg-black border border-white/10 rounded-lg shadow-xl shadow-black/30 z-50 max-h-96 overflow-y-auto",e?"w-72 right-0":"w-80 left-0"),children:o.jsxs("div",{className:e?"p-2":"p-3",children:[!e&&o.jsx("div",{className:"text-xs font-medium text-white/60 uppercase tracking-wider mb-3",children:t("ai.modelSelector.title",{defaultValue:"Select AI Model"})}),o.jsxs("div",{className:e?"space-y-2":"space-y-3",children:[Array.from(x.entries()).filter(([U])=>U==="datakit").map(([U,B])=>o.jsxs("div",{children:[o.jsxs("div",{className:Qe("text-xs font-medium text-white/50 flex items-center",e?"mb-1":"mb-2"),children:[Ht.cloneElement(YC[U],{className:e?"h-3 w-3":"h-4 w-4"}),o.jsx("span",{className:e?"ml-1.5 capitalize":"ml-2 capitalize",children:t("ai.providers.datakit",{defaultValue:"DataKit"})}),!e&&o.jsx("span",{className:"ml-2 text-xs bg-primary/20 text-primary px-2 py-0.5 rounded",children:t("ai.modelSelector.claudeModels",{defaultValue:"Claude Sonnet 4.5 & 4"})}),!e&&!g&&o.jsxs("span",{className:"ml-2 text-yellow-500 text-xs",children:["(",t("ai.modelSelector.signInRequired",{defaultValue:"Sign in required"}),")"]})]}),o.jsx("div",{className:"space-y-1",children:B.map(j=>{var G,K;return o.jsx("button",{onClick:()=>k(U,j.id),disabled:!g||!M(U),className:Qe("w-full text-left rounded border transition-all duration-200",e?"p-1.5":"p-2",b===j.id?"bg-primary/10 border-primary/30":g&&M(U)?"border-transparent hover:bg-white/5 hover:border-white/10":"border-transparent opacity-50 cursor-not-allowed"),children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:Qe("font-medium text-white flex items-center gap-1.5",e?"text-xs":"text-sm"),children:[o.jsx("span",{children:e?U==="datakit"?j.id==="datakit-smart"?"Smart":j.id==="datakit-fast"?"Fast":j.name.split(" ")[0]:j.name.includes("GPT")?j.name.replace("GPT-","GPT"):j.name.includes("Claude")?j.name.replace("Claude ",""):j.name.includes("Llama")?j.name.split(" ")[0]+" "+j.name.split(" ")[1]:j.name.split(" ")[0]:j.name}),U==="datakit"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("img",{src:ac,className:"h-2 w-2 opacity-60",alt:"Anthropic"}),o.jsx("span",{className:Qe("text-white/50 font-normal",e?"text-[10px]":"text-xs"),children:j.id==="datakit-smart"?"Claude 4.5":j.id==="datakit-fast"?"Claude 4":""})]})]}),!e&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"text-xs text-white/60",children:[(j==null?void 0:j.contextWindow)&&"".concat((K=(G=j==null?void 0:j.contextWindow)==null?void 0:G.toLocaleString)==null?void 0:K.call(G)," tokens"),(j==null?void 0:j.costPer1kTokens)&&o.jsx("span",{className:"ml-2",children:U==="datakit"?t("ai.modelSelector.creditsPerToken",{cost:j.costPer1kTokens.input.toFixed(2),defaultValue:"{{cost}} credits/1K tokens"}):t("ai.modelSelector.dollarsPerToken",{cost:j.costPer1kTokens.input.toFixed(3),defaultValue:"${{cost}}/1K"})})]}),o.jsx("div",{className:"text-xs text-white/40 mt-1",children:U==="datakit"?j.description:j.capabilities.join(", ")})]})]}),o.jsx("div",{className:"flex items-center gap-1",children:b===j.id&&o.jsx(Pr,{className:Qe("text-primary flex-shrink-0",e?"h-3 w-3":"h-4 w-4")})})]})},j.id)})}),!e&&U==="datakit"&&!g&&o.jsxs("div",{className:"mt-2 p-3 bg-primary/5 border border-primary/20 rounded-lg",children:[o.jsx("div",{className:"text-sm text-white/70 mb-2",children:t("ai.modelSelector.signUpCredits",{defaultValue:"Sign up to use DataKit credits"})}),o.jsx("div",{className:"text-xs text-white/50 mb-3",children:t("ai.modelSelector.noApiKeysNeeded",{defaultValue:"No API keys needed. Credits included with your account."})}),o.jsx("button",{onClick:F,className:"w-full px-3 py-2 bg-primary/20 hover:bg-primary/30 border border-primary/50 rounded-lg text-sm font-medium text-primary transition-all duration-200",children:t("ai.modelSelector.signUpButton",{defaultValue:"Sign up to get started"})})]}),!e&&U==="datakit"&&g&&(T==null?void 0:T.credits)&&o.jsx("div",{className:"mt-2 p-2 bg-background/10 border border-white/10 rounded",children:o.jsx("div",{className:"text-xs text-white/60",children:t("ai.modelSelector.creditsRemaining",{count:T.credits.remaining,defaultValue:"Credits remaining: {{count}}"})})})]},U)),g&&o.jsx("div",{className:Qe("border-t border-white/10 pt-3",e?"mt-2":"mt-4"),children:o.jsxs("div",{className:"mb-3",children:[o.jsx("div",{className:Qe("text-xs font-medium text-white/70",e?"mb-0.5":"mb-1"),children:t("ai.modelSelector.useYourOwnModels",{defaultValue:"Use Your Own Models"})}),o.jsx("div",{className:"text-xs text-white/50 mb-2",children:t("ai.modelSelector.configureApiKeys",{defaultValue:"Configure API keys for external providers"})}),o.jsxs("button",{onClick:L,className:"flex items-center gap-1 px-2 py-1 bg-white/5 hover:bg-white/10 border border-white/10 hover:border-white/20 rounded text-xs text-white/60 hover:text-white transition-all",children:[o.jsx(qs,{className:"h-2.5 w-2.5"}),o.jsx("span",{children:t("ai.modelSelector.configure",{defaultValue:"Configure"})})]})]})}),Array.from(x.entries()).filter(([U])=>U!=="datakit").map(([U,B])=>o.jsxs("div",{children:[o.jsxs("div",{className:Qe("text-xs font-medium text-white/50 flex items-center",e?"mb-1":"mb-2"),children:[Ht.cloneElement(YC[U],{className:e?"h-3 w-3":"h-4 w-4"}),o.jsx("span",{className:e?"ml-1.5 capitalize":"ml-2 capitalize",children:t("ai.providers.".concat(U),{defaultValue:U.charAt(0).toUpperCase()+U.slice(1)})}),!e&&!g&&o.jsxs("span",{className:"ml-2 text-yellow-500 text-xs",children:["(",t("ai.modelSelector.signInRequired",{defaultValue:"Sign in required"}),")"]}),!e&&g&&!M(U)&&U!=="local"&&U!=="ollama"&&o.jsxs("span",{className:"ml-2 text-yellow-500 text-xs",children:["(",t("ai.modelSelector.apiKeyRequired",{defaultValue:"API key required"}),")"]})]}),o.jsx("div",{className:"space-y-1",children:B.map(j=>{var G,K;return o.jsx("button",{onClick:()=>k(U,j.id),disabled:!g||!M(U),className:Qe("w-full text-left rounded border transition-all duration-200",e?"p-1.5":"p-2",b===j.id?"bg-primary/10 border-primary/30":g&&M(U)?"border-transparent hover:bg-white/5 hover:border-white/10":"border-transparent opacity-50 cursor-not-allowed"),children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:Qe("font-medium text-white flex items-center gap-1.5",e?"text-xs":"text-sm"),children:o.jsx("span",{children:e?j.name.includes("GPT")?j.name.replace("GPT-","GPT"):j.name.includes("Claude")?j.name.replace("Claude ",""):j.name.includes("Llama")?j.name.split(" ")[0]+" "+j.name.split(" ")[1]:j.name.split(" ")[0]:j.name})}),!e&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"text-xs text-white/60",children:[(j==null?void 0:j.contextWindow)&&"".concat((K=(G=j==null?void 0:j.contextWindow)==null?void 0:G.toLocaleString)==null?void 0:K.call(G)," tokens"),(j==null?void 0:j.costPer1kTokens)&&o.jsx("span",{className:"ml-2",children:t("ai.modelSelector.dollarsPerToken",{cost:j.costPer1kTokens.input.toFixed(3),defaultValue:"${{cost}}/1K"})})]}),o.jsx("div",{className:"text-xs text-white/40 mt-1",children:j.capabilities.join(", ")})]})]}),o.jsx("div",{className:"flex items-center gap-1",children:b===j.id&&o.jsx(Pr,{className:Qe("text-primary flex-shrink-0",e?"h-3 w-3":"h-4 w-4")})})]})},j.id)})})]},U))]})]})})}),o.jsx(Vl,{isOpen:l,onClose:()=>c(!1),defaultMode:u,onLoginSuccess:()=>w("datakit")}),o.jsx(xZ,{isOpen:m,onClose:()=>p(!1)})]})},SZ=({error:e,onDismiss:t,onRetry:n,className:r=""})=>{const{t:a}=Ze();if(!e)return null;const i=(l=>l.includes("model")&&l.includes("not selected")?{title:a("ai.error.noModel.title",{defaultValue:"No Model Selected"}),message:a("ai.error.noModel.message",{defaultValue:"Please select an AI model from the dropdown to continue."}),type:"warning"}:l.includes("file")||l.includes("table")||l.includes("data")?{title:a("ai.error.noData.title",{defaultValue:"No Data Available"}),message:a("ai.error.noData.message",{defaultValue:"Please add a table to the context to ask questions about it."}),type:"warning"}:l.includes("authentication")||l.includes("unauthorized")?{title:a("ai.error.auth.title",{defaultValue:"Authentication Required"}),message:a("ai.error.auth.message",{defaultValue:"Please sign in or configure your API keys to use AI models."}),type:"error"}:l.includes("rate limit")||l.includes("quota")?{title:a("ai.error.rateLimit.title",{defaultValue:"Rate Limit Exceeded"}),message:a("ai.error.rateLimit.message",{defaultValue:"You've reached the rate limit. Please try again later or upgrade your plan."}),type:"warning"}:l.includes("network")||l.includes("connection")?{title:a("ai.error.connection.title",{defaultValue:"Connection Error"}),message:a("ai.error.connection.message",{defaultValue:"Unable to connect to the AI service. Please check your internet connection."}),type:"error"}:l.includes("Binder Error")||l.includes("COUNT(DISTINCT")||l.includes("No function matches")?{title:"SQL Query Error",message:l,type:"error"}:{title:a("ai.error.generic.title",{defaultValue:"Something went wrong"}),message:l,type:"error"})(e);return o.jsx(At,{children:o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:"overflow-hidden ".concat(r),children:o.jsxs("div",{className:"p-3 rounded-lg border flex items-start gap-3 ".concat(i.type==="warning"?"bg-blue-500/10 border-blue-500/20 text-blue-200":"bg-red-500/10 border-red-500/20 text-red-200"),children:[o.jsx(Cn,{className:"w-4 h-4 mt-0.5 flex-shrink-0 ".concat(i.type==="warning"?"text-blue-400":"text-red-400")}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h4",{className:"font-medium text-sm mb-1",children:i.title}),o.jsx("p",{className:"text-xs opacity-90 leading-relaxed",children:i.message})]}),o.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[n&&o.jsx("button",{onClick:n,className:"p-1 hover:bg-white/10 rounded transition-colors",title:a("ai.error.retry",{defaultValue:"Retry"}),children:o.jsx(ma,{className:"w-3 h-3"})}),t&&o.jsx("button",{onClick:t,className:"p-1 hover:bg-white/10 rounded transition-colors",title:a("ai.error.dismiss",{defaultValue:"Dismiss"}),children:o.jsx(ur,{className:"w-3 h-3"})})]})]})})})};function IBe(e,t,n){const r=t/Math.max(n-1,1);return r===0?"initial":r===1?"complete":r>.7?"finalizing":"processing"}function bZ(e){const t=/\*\*STATUS:\*\*\s*([^\n]+)/g,n=Array.from(e.matchAll(t));return n.map((r,a)=>({text:r[1].trim(),timestamp:Date.now()+a*100,phase:IBe(r[1],a,n.length)}))}function vZ(e){const t=e.includes("```sql"),n=e.includes("```python"),r=t||n,a=(e.match(/\*\*STATUS:\*\*/g)||[]).length;if(r)return 100;if(a>=3)return 75;if(a>=2)return 50;if(a>=1)return 25;const s=e.length;return s>1e3?60:s>500?40:s>100?20:10}function OBe(e){const t=new Map,n=/\*\*([A-Z_]+):\*\*\s*([^\n]+)/g;let r;for(;(r=n.exec(e))!==null;){const a=r[1].toLowerCase(),s=r[2].trim();t.set(a,s)}return t}function AZ(e){var i;const t=OBe(e),n=bZ(e),r={content:e,insight:t.get("insight")||t.get("insight_title"),summary:t.get("summary")||t.get("query_description"),expectedResults:t.get("expected_results"),chartSuggestion:t.get("chart_suggestion"),status:n.length>0?n[n.length-1].text:void 0,statusSequence:n,progress:vZ(e)},a=/```(\w+)?\n([\s\S]*?)```/g;let s;for(;(s=a.exec(e))!==null;){const l=(i=s[1])==null?void 0:i.toLowerCase(),c=s[2].trim();l==="sql"||!l&&c.match(/^(SELECT|INSERT|UPDATE|DELETE|CREATE)/i)?r.sqlQuery=c:(l==="python"||!l&&c.match(/^(import |from |def |class |print)/))&&(r.pythonCode=c)}return r}function LBe(e){const t=bZ(e),n=vZ(e);if(t.length===0)return{status:"Processing your request",progress:n,phase:"initial"};const r=t[t.length-1];return{status:r.text,progress:n,phase:r.phase}}function MBe(e){e.toLowerCase();const t={exploration:/\b(show|display|list|find|what|which|where)\b/,aggregation:/\b(count|sum|average|mean|median|group|total|max|min)\b/,visualization:/\b(chart|graph|plot|visuali[sz]e|diagram|distribution)\b/,transformation:/\b(transform|convert|clean|format|rename|modify)\b/};let n={type:"general",confidence:0};for(const[r,a]of Object.entries(t)){const s=e.match(a);if(s){const i=s.length/(e.split(/\s+/).length/10);i>n.confidence&&(n={type:r,confidence:Math.min(i,1)})}}return n.confidence>0?n:{type:"general",confidence:.5}}const DBe=({query:e,responseText:t})=>{const[n,r]=v.useState(!1),[a,s]=v.useState(!1),[i,l]=v.useState(!1),[c,u]=v.useState(null),{setPendingQuery:h,changeViewMode:m}=ut(),{executePaginatedQuery:p,isLoading:g}=Dt(),{setCurrentPrompt:T}=ys(),y=v.useMemo(()=>AZ(t||""),[t]),b=y.insight,x=y.expectedResults,A=v.useRef("card-".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))).current;v.useEffect(()=>{const M=()=>{const L=window.__activeQueryCardId===A;i!==L&&l(L)};return M(),window.addEventListener("queryCardActiveChange",M),()=>{window.removeEventListener("queryCardActiveChange",M)}},[A,i]),v.useEffect(()=>()=>{window.__activeQueryCardId===A&&(delete window.__activeQueryCardId,window.dispatchEvent(new CustomEvent("queryCardActiveChange")))},[A]);const w=v.useCallback(()=>H(null,null,function*(){try{yield navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)}catch(M){}}),[e]),_=v.useCallback(()=>{const M=window.__closeOverlay;M&&typeof M=="function"&&M(),h(e),setTimeout(()=>{m("query")},50)},[e,h,m]),N=v.useCallback(M=>M.includes("COUNT(DISTINCT")&&M.includes("argument types")?"DuckDB only supports COUNT(DISTINCT single_column). For multiple columns, try: COUNT(*) FROM (SELECT DISTINCT col1, col2 FROM table)":M.includes("Binder Error")?"This appears to be a SQL syntax error. Please check your column names and table structure.":M.includes("No function matches")?"The function you're trying to use may not be supported in DuckDB or has incorrect parameters.":M.includes("does not exist")?"The table or column referenced in your query doesn't exist. Please check the table structure.":"There was an error executing this SQL query. You can ask the AI to fix it or try modifying the query manually.",[]),I=v.useCallback(()=>H(null,null,function*(){if(i){const M=window.__closeDraggableResults;M&&typeof M=="function"&&M(),l(!1)}else try{u(null);const M=yield p(e,1,1e3);if(M){window.__activeQueryCardId=A,window.dispatchEvent(new CustomEvent("queryCardActiveChange"));const O=[" ",...M.columns],L=M.data.map((U,B)=>[B+1,...M.columns.map(j=>U[j]||"")]),k={data:[O,...L],columnTypes:M.columns.map(U=>({name:U,type:"VARCHAR"})),metadata:{rowCount:M.totalRows||M.data.length,columnCount:M.columns.length,executionTime:M.queryTime||0,query:e.substring(0,200)+(e.length>200?"...":"")}},F=window.__showDraggableResults;F&&typeof F=="function"?(F(k),l(!0)):u("Query results display not available")}}catch(M){const O=M instanceof Error?M.message:"Failed to execute query";u(O)}}),[i,e,A,p]),D=v.useCallback(()=>{if(!c)return;const M=N(c),O="I have a SQL query that's producing an error. Can you help me fix it?\n\n**Query:**\n```sql\n".concat(e,"\n```\n\n**Error:**\n").concat(c,"\n\n**Suggested Fix:**\n").concat(M,"\n\nPlease provide a corrected version of this SQL query that follows proper DuckDB syntax. Make sure to:\n1. Fix the specific error mentioned above\n2. Use proper DuckDB function syntax\n3. Ensure all column names and table references are correct\n4. Include a brief explanation of what was wrong and how you fixed it");T(O),u(null)},[c,e,N,T]);return o.jsxs(me.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.4,ease:"easeOut"},className:"space-y-3",children:[b&&o.jsxs(me.div,{initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.4,ease:"easeOut"},className:"space-y-2",children:[o.jsx("div",{className:"text-sm font-semibold bg-gradient-to-r from-white/90 via-blue-300 via-blue-400 via-blue-300 to-white/90 bg-clip-text text-transparent",style:{backgroundSize:"200% 200%",animation:"gradientFlow 4s ease-in-out infinite"},children:b}),x&&o.jsx(o.Fragment,{children:o.jsx("p",{className:"text-xs text-white/50 leading-relaxed",children:x})})]}),o.jsx("div",{className:"border-t border-white/10 pt-3",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{onClick:I,disabled:g,className:"flex items-center justify-center gap-2 px-4 py-3 rounded-lg text-sm font-semibold transition-all duration-200 flex-1 group ".concat(g?"bg-gradient-to-r from-gray-600/8 via-gray-500/12 to-gray-600/8 border border-gray-500/20 opacity-50 cursor-not-allowed":i?"bg-gradient-to-r from-red-600/8 via-red-500/12 to-red-600/8 hover:from-red-600/15 hover:via-red-500/18 hover:to-red-600/15 border border-red-500/20 hover:border-red-500/30":"bg-gradient-to-r from-blue-600/8 via-blue-500/12 to-blue-600/8 hover:from-blue-600/15 hover:via-blue-500/18 hover:to-blue-600/15 border border-blue-500/20 hover:border-blue-500/30"),children:[g?o.jsx(ma,{className:"h-4 w-4 text-gray-400 animate-spin"}):i?o.jsx(wL,{className:"h-4 w-4 text-red-300"}):o.jsx(Jr,{className:"h-4 w-4 text-blue-300"}),o.jsx("span",{className:"bg-gradient-to-r bg-clip-text text-transparent transition-all duration-200 ".concat(g?"from-gray-300 via-gray-200 to-gray-300":i?"from-red-100 via-white to-red-100 group-hover:from-white group-hover:via-red-50 group-hover:to-white":"from-blue-200 via-blue-100 to-blue-200 group-hover:from-blue-100 group-hover:via-white group-hover:to-blue-100"),children:g?"Loading...":i?"Hide Results":"View Results"})]}),o.jsxs("button",{onClick:_,className:"flex items-center gap-1.5 px-2.5 py-2 rounded-md transition-colors bg-white/5 text-white/60 border border-white/20 hover:bg-white/10 hover:text-white/80 hover:border-white/30",children:[o.jsx(PL,{className:"h-3 w-3"}),o.jsx("span",{className:"text-xs font-medium",children:"Edit Query"})]})]})}),c&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(SZ,{error:c,onDismiss:()=>u(null),onRetry:I,suggestion:c?N(c):void 0}),o.jsxs(me.button,{onClick:D,className:"w-full flex items-center justify-center gap-2 px-3 py-2 bg-gradient-to-r from-primary/20 to-primary/10 hover:from-primary/30 hover:to-primary/20 border border-primary/30 rounded-lg text-white text-sm font-medium transition-all duration-200 hover:scale-[1.02]",whileHover:{scale:1.02},whileTap:{scale:.98},initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{duration:.3,delay:.1},children:[o.jsx(LL,{className:"h-4 w-4"}),o.jsx("span",{children:"Ask AI to Fix This"})]})]}),o.jsxs("div",{className:"border-t border-white/10 pt-3",children:[o.jsxs("button",{onClick:()=>s(!a),className:"w-full flex items-center justify-between p-2 hover:bg-white/5 rounded transition-colors",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(RL,{className:"h-3 w-3 text-white/60"}),o.jsx("span",{className:"text-xs font-medium text-white/70",children:"View SQL Query"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(At,{children:a&&o.jsx(me.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},className:"flex items-center gap-1 mr-2",onClick:M=>M.stopPropagation(),children:o.jsx(Ut,{content:n?"Copied!":"Copy SQL",placement:"bottom",children:o.jsx("button",{onClick:w,className:"p-1 hover:bg-white/10 rounded transition-colors cursor-pointer",children:o.jsx(At,{mode:"wait",children:n?o.jsx(Pr,{className:"h-3 w-3 text-green-400"}):o.jsx(gi,{className:"h-3 w-3 text-white/60 hover:text-white/80"})})})})})}),o.jsx(me.div,{animate:{rotate:a?180:0},transition:{duration:.2},children:o.jsx(br,{className:"h-3 w-3 text-white/60"})})]})]}),o.jsx(At,{children:a&&o.jsx(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:[.4,0,.2,1]},className:"mt-2",children:o.jsx("div",{className:"rounded overflow-hidden border border-white/10",children:o.jsx(xQ,{height:"auto",defaultLanguage:"sql",value:e,theme:"vs-dark",options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,tabSize:2,fontSize:12,fontFamily:"JetBrains Mono, monospace",lineNumbers:"off",glyphMargin:!1,folding:!1,contextmenu:!1,quickSuggestions:!1,suggest:{preview:!1},parameterHints:{enabled:!1},scrollbar:{vertical:"hidden",horizontal:"auto"},overviewRulerLanes:0,hideCursorInOverviewRuler:!0,renderLineHighlight:"none",selectionHighlight:!1,occurrencesHighlight:!1,fixedOverflowWidgets:!0},onMount:M=>{const O=M.getModel();if(O){const L=O.getLineCount(),U=Math.max(L*14+12,50),B=M.getContainerDomNode();B&&(B.style.height="".concat(U,"px"),M.layout())}}})})})})]})]})},PBe=Ht.memo(DBe),kBe=({code:e,index:t,onSendToNotebook:n})=>{const{t:r}=Ze(),[a,s]=v.useState(!0),[i,l]=v.useState(!1),c=()=>H(null,null,function*(){try{yield navigator.clipboard.writeText(e),l(!0),setTimeout(()=>l(!1),2e3)}catch(T){}}),u=()=>{n(e)},m=e.trim().split("\n");m.length>1;const p=m.length>8,g=p&&!a?m.slice(0,6):m;return o.jsxs("div",{className:"bg-gradient-to-br from-blue-500/5 to-blue-600/5 border border-blue-500/20 rounded-lg overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-blue-500/10 border-b border-blue-500/20",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-2 h-2 bg-blue-400 rounded-full"}),o.jsx("span",{className:"text-xs font-medium text-blue-300",children:r("ai.pythonCard.title",{defaultValue:"Python Code"})}),t>0&&o.jsxs("span",{className:"text-xs text-blue-400/60",children:["#",t+1]})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(Ut,{content:r("ai.pythonCard.copyCode",{defaultValue:"Copy code"}),placement:"bottom",children:o.jsx("button",{onClick:c,className:"p-1 hover:bg-blue-500/20 rounded transition-colors",children:i?o.jsx(Pr,{className:"h-3 w-3 text-green-400"}):o.jsx(gi,{className:"h-3 w-3 text-blue-300"})})}),p&&o.jsx(Ut,{content:a?r("ai.pythonCard.collapse",{defaultValue:"Collapse"}):r("ai.pythonCard.expand",{defaultValue:"Expand"}),placement:"bottom",children:o.jsx("button",{onClick:()=>s(!a),className:"p-1 hover:bg-blue-500/20 rounded transition-colors",children:a?o.jsx($0,{className:"h-3 w-3 text-blue-300"}):o.jsx(br,{className:"h-3 w-3 text-blue-300"})})})]})]}),o.jsx("div",{className:"p-3",children:o.jsx("pre",{className:"text-xs text-white/85 font-mono whitespace-pre-wrap leading-relaxed",children:o.jsxs("code",{children:[g.join("\n"),p&&!a&&o.jsxs("span",{className:"text-blue-400/60",children:["\\n... (",r("ai.pythonCard.moreLines",{defaultValue:"{{count}} more lines",count:m.length-6}),")"]})]})})}),o.jsx("div",{className:"flex items-center gap-2 px-3 py-2 bg-black/20 border-t border-blue-500/20",children:o.jsx(Ut,{content:r("ai.pythonCard.sendToNotebook",{defaultValue:"Send to active notebook"}),placement:"top",children:o.jsxs(je,{onClick:u,size:"sm",variant:"outline",className:"h-7 px-2 text-xs border-blue-500/30 hover:border-blue-400/50 hover:bg-blue-500/10 text-blue-300 hover:text-blue-200 flex items-center gap-1.5",children:[o.jsx(ofe,{className:"h-3 w-3"}),o.jsx("span",{children:r("ai.pythonCard.sendToNotebookButton",{defaultValue:"Send to Notebook"})}),o.jsx(rhe,{className:"h-3 w-3"})]})})})]})},jBe=({status:e,progress:t=0,phase:n="initial",isVisible:r,compact:a=!1})=>{const s=l=>{const c=(l+1)*25;return t>=c?"complete":t>c-25&&t<c?"active":"pending"},i=l=>{switch(l){case"complete":return"bg-primary/80";case"active":return"bg-primary/60 animate-pulse";case"pending":return"bg-white/20"}};return r?a?o.jsxs(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex items-center gap-2 text-xs text-white/60",children:[o.jsx("div",{className:"flex gap-0.5",children:[0,1,2,3].map(l=>o.jsx("div",{className:"w-1 h-1 rounded-full transition-all ".concat(i(s(l)))},l))}),o.jsx("span",{children:e})]}):o.jsx(At,{children:r&&o.jsxs(me.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeOut"},className:"flex items-center gap-3 px-3 py-2 rounded-lg transition-colors ".concat(n==="complete"?"bg-primary/5 border border-primary/20":"bg-white/5 border border-white/10"),children:[o.jsx("div",{className:"flex items-center gap-1",children:[0,1,2,3].map(l=>o.jsx(me.div,{initial:{scale:0},animate:{scale:s(l)!=="pending"?1:.8},transition:{duration:.2,delay:l*.05},className:"w-1.5 h-1.5 rounded-full transition-colors duration-300 ".concat(i(s(l)))},l))}),o.jsx("span",{className:"font-medium transition-all duration-300 ".concat(n==="complete"?"text-primary/90 text-xs":n==="finalizing"?"text-white/80 text-sm":n==="processing"?"text-white/80 text-sm font-semibold":"text-white/70 text-xs"),children:e})]})}):null},UBe=({pills:e,compact:t=!1})=>{if(e.length===0)return null;const n=r=>{const a=r.toLowerCase();return a.includes("ready")||a.includes("complete")?"bg-primary/20 border-primary/30 text-primary":a.includes("optimiz")||a.includes("final")?"bg-blue-500/20 border-blue-500/30 text-blue-400":a.includes("explor")||a.includes("analyz")?"bg-purple-500/20 border-purple-500/30 text-purple-400":a.includes("aggregat")||a.includes("transform")?"bg-amber-500/20 border-amber-500/30 text-amber-400":a.includes("visual")?"bg-green-500/20 border-green-500/30 text-green-400":"bg-white/10 border-white/20 text-white/60"};return t?o.jsx("div",{className:"inline-flex items-center gap-1",children:e.slice(0,3).map((r,a)=>o.jsx(me.span,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,delay:a*.05},className:"inline-block px-2 py-0.5 text-[10px] font-medium rounded-full border ".concat(n(r)),children:r},r))}):o.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:o.jsx(At,{mode:"popLayout",children:e.map((r,a)=>o.jsx(me.div,{layout:!0,initial:{opacity:0,scale:.8,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8,y:-10},transition:{duration:.3,delay:a*.05,layout:{type:"spring",damping:20,stiffness:300}},className:"px-2.5 py-1 text-xs font-medium rounded-lg border backdrop-blur-sm ".concat(n(r)),children:r},r))})})},FBe=({content:e,className:t=""})=>o.jsx(qJ,{className:"prose prose-invert max-w-none ".concat(t),remarkPlugins:[gZ],components:{h1:({children:n})=>o.jsx("h1",{className:"text-lg font-semibold text-white mb-3 border-b border-white/20 pb-1",children:n}),h2:({children:n})=>o.jsx("h2",{className:"text-base font-semibold text-white mb-2",children:n}),h3:({children:n})=>o.jsx("h3",{className:"text-sm font-medium text-white/90 mb-2",children:n}),p:({children:n})=>o.jsx("p",{className:"text-sm text-white/80 leading-relaxed mb-3",children:n}),ul:({children:n})=>o.jsx("ul",{className:"list-disc list-inside text-sm text-white/80 space-y-1 mb-3 ml-2",children:n}),ol:({children:n})=>o.jsx("ol",{className:"list-decimal list-inside text-sm text-white/80 space-y-1 mb-3 ml-2",children:n}),li:({children:n})=>o.jsx("li",{className:"text-white/80",children:n}),strong:({children:n})=>o.jsx("strong",{className:"font-semibold text-white",children:n}),code:({children:n,className:r})=>r?o.jsx("code",{className:"block bg-white/5 text-white/90 p-3 rounded text-xs font-mono overflow-x-auto",children:n}):o.jsx("code",{className:"bg-white/10 text-white/90 px-1.5 py-0.5 rounded text-xs font-mono",children:n}),blockquote:({children:n})=>o.jsx("blockquote",{className:"border-l-2 border-blue-400/50 pl-3 text-white/70 italic mb-3",children:n}),table:({children:n})=>o.jsx("div",{className:"overflow-x-auto mb-3",children:o.jsx("table",{className:"min-w-full text-xs text-white/80 border border-white/20",children:n})}),th:({children:n})=>o.jsx("th",{className:"px-2 py-1 bg-white/10 border border-white/20 font-medium text-white",children:n}),td:({children:n})=>o.jsx("td",{className:"px-2 py-1 border border-white/20",children:n}),a:({children:n,href:r})=>o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 underline",children:n})},children:e});function $Be(e,t,n){const[r,a]=v.useState({currentStatus:"",progress:0,phase:"initial",hasCode:!1,queryIntent:{type:"general",confidence:.5}}),s=v.useMemo(()=>n?MBe(n):{type:"general",confidence:.5},[n]);return v.useEffect(()=>{if(!e){a(t?{currentStatus:"Understanding your request",progress:10,phase:"initial",hasCode:!1,queryIntent:s}:{currentStatus:"",progress:0,phase:"initial",hasCode:!1,queryIntent:s});return}const i=AZ(e),l=LBe(e);a({currentStatus:l.status,progress:l.progress,phase:l.phase,insight:i.insight,summary:i.summary,hasCode:!!(i.sqlQuery||i.pythonCode),queryIntent:s})},[e,t,s]),r}function BBe(e){const{phase:t,queryIntent:n,progress:r}=e,a=[];if(n.confidence>.7)switch(n.type){case"aggregation":a.push("aggregating");break;case"visualization":a.push("visualizing");break;case"exploration":a.push("exploring");break;case"transformation":a.push("transforming");break}return(t==="processing"||t==="finalizing")&&(r>50&&a.push("optimizing"),r>75&&a.push("finalizing")),e.hasCode&&a.push("ready"),a}const Tz=(e,t,n,r,a,s)=>{if(!e.trim())return null;if(s){if(!a||a.length===0||a.filter(l=>l.isSelected).length===0)return"No tables selected for AI context"}else if(!t)return"No file or table loaded";return!n||!r?"model not selected":null},HBe=e=>[{title:e("ai.prompts.suggestions.exploreData.title"),prompt:e("ai.prompts.suggestions.exploreData.prompt")},{title:e("ai.prompts.suggestions.findPatterns.title"),prompt:e("ai.prompts.suggestions.findPatterns.prompt")},{title:e("ai.prompts.suggestions.dataQuality.title"),prompt:e("ai.prompts.suggestions.dataQuality.prompt")},{title:e("ai.prompts.suggestions.quickStats.title"),prompt:e("ai.prompts.suggestions.quickStats.prompt")}],VBe=({isOpen:e,onClose:t,width:n=400,onWidthChange:r})=>{const{t:a}=Ze(),[s,i]=v.useState(""),[l,c]=v.useState(!0),[u,h]=v.useState(!1),[m,p]=v.useState(!1),[g,T]=v.useState("signup"),[y,b]=v.useState(!1),[x,R]=v.useState(!1),A=v.useRef(null),w=v.useRef(null),_=v.useRef(null),N=ut(kr),I=ut(X0),{registeredTables:D,getTableSchema:M}=Dt(),{isAuthenticated:O,isLoading:L}=ea(),k=ut(Te=>{const Oe=kr(Te),de=Te.emptyStateViewMode;return(Oe==null?void 0:Oe.viewMode)||de}),{createCell:F,setActiveCellId:U}=Ia(),{isProcessing:B,clearConversation:j,clearFileConversation:G,setQueryResults:K,currentConversation:J,currentError:$,setCurrentError:X,activeProvider:Z,activeModel:V,apiKeys:te,multiTableContexts:ae,streamingResponse:ne,addTableContext:ce,clearTableContexts:ie,currentPrompt:W,setCurrentPrompt:Q}=ys(),{executeAIQueryStream:se,canExecute:z,extractSQLQueries:xe,extractPythonQueries:le}=ABe(),pe=$Be(ne,B,W||s),_e=BBe(pe),re=v.useMemo(()=>!I||!N?null:{tableName:I,rowCount:N.rowCount,description:N.fileName||I,fileId:N.id},[I,N==null?void 0:N.id,N==null?void 0:N.rowCount,N==null?void 0:N.fileName]);v.useEffect(()=>{if(!re)return;H(null,null,function*(){ie();try{const Oe=yield M(re.tableName);Oe&&ce({tableName:re.tableName,schema:Oe,rowCount:re.rowCount,description:re.description})}catch(Oe){}})},[re,M,ce,ie]),v.useEffect(()=>{w.current&&!x&&(w.current.scrollTop=w.current.scrollHeight)},[J,ne,x]),v.useEffect(()=>{B&&R(!1)},[B]),v.useEffect(()=>{var Te;W&&W!==s&&(i(W),Q(""),(Te=A.current)==null||Te.focus())},[W,s,Q]),v.useEffect(()=>{A.current&&(A.current.style.height="auto",A.current.style.height="".concat(Math.min(A.current.scrollHeight,120),"px"))},[s]);const Se=v.useMemo(()=>({prompt:s,tableName:I,activeProvider:Z,activeModel:V,multiTableContexts:ae,hasRegisteredTables:D.size>0}),[s,I,Z,V,ae,D.size]);v.useEffect(()=>{const Te=Tz(Se.prompt,Se.tableName,Se.activeProvider,Se.activeModel,Se.multiTableContexts,Se.hasRegisteredTables);X(Te)},[Se,X]);const $e=()=>O?Z==="datakit"||Z==="local"||Z==="ollama"?O:O&&te.has(Z)&&!!te.get(Z):!1,qe=v.useMemo(()=>!$e(),[O,Z,te]),Je=v.useMemo(()=>s.length===0&&J.length===0&&O,[s.length,J.length,O]);v.useEffect(()=>{c(Je)},[Je]);const lt=()=>{const Te=D.size>0,Oe=Tz(s,I,Z,V,ae,Te);return Oe?(X(Oe),!1):z?!0:(X(Z==="datakit"?"authentication required":"AI provider ".concat(Z," not configured")),!1)},at=Te=>H(null,null,function*(){if(Te==null||Te.preventDefault(),!(!s.trim()||B)&&lt())try{yield se(s),i("")}catch(Oe){const de=Oe instanceof Error?Oe.message:"Unknown error occurred";X(de)}}),ot=Te=>{Te.key==="Enter"&&!Te.shiftKey&&(Te.preventDefault(),at())},st=Te=>{var Oe;i(Te),(Oe=A.current)==null||Oe.focus()},oe=()=>{var Te;N!=null&&N.id?G(N.id):j(),K(null),i(""),c(!0),X(null),(Te=A.current)==null||Te.focus()},ue=Te=>{T(Te),p(!0)},Ee=()=>{if(!O){ue("login");return}h(!0)},Le=v.useCallback(Te=>H(null,null,function*(){try{const{changeViewMode:Oe}=ut.getState();Oe("notebook");const de=F("code",Te);U(de),t()}catch(Oe){X("Failed to send code to notebook")}}),[F,U,t,X]),ke=Te=>{b(!0);const Oe=Te.clientX,de=n,Ae=Ie=>{const Ke=Oe-Ie.clientX,it=Math.max(400,Math.min(600,de+Ke));r==null||r(it)},we=()=>{b(!1),document.removeEventListener("mousemove",Ae),document.removeEventListener("mouseup",we),document.body.style.cursor="default",document.body.style.userSelect="auto"};document.addEventListener("mousemove",Ae),document.addEventListener("mouseup",we),document.body.style.cursor="ew-resize",document.body.style.userSelect="none"},Ge=v.useCallback(Te=>xe(Te),[xe]),tt=v.useCallback(Te=>le(Te),[le]),ct=v.useMemo(()=>{if(J.length===0&&!ne&&!B&&O)return o.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:o.jsxs("div",{className:"text-center",children:[o.jsxs("div",{className:"relative mb-4",children:[o.jsx(LL,{className:"h-12 w-12 mx-auto text-white/20"}),o.jsx("div",{className:"absolute inset-0 h-12 w-12 mx-auto bg-gradient-to-r from-primary/20 to-blue-400/20 rounded-lg blur-xl"})]}),o.jsx("p",{className:"text-white/50 text-sm",children:a("ai.assistant.welcome",{defaultValue:"Ask me anything about your file"})})]})});const Te=[];return Te.push(...J.map((Oe,de)=>{const Ae=Oe.role==="assistant"?Ge(Oe.content):[],we=Ae.length>0,Ie="message-".concat(de,"-").concat(Oe.content.slice(0,20).replace(/\s+/g,"-"));return o.jsx("div",{className:we?"w-full":"flex ".concat(Oe.role==="user"?"justify-end":"justify-start"),children:we?o.jsx("div",{className:"ml-1 -mr-4 bg-gradient-to-br from-white/8 to-white/4 border border-white/15 text-white/90 shadow-sm rounded-lg p-4",style:{width:"".concat(n*.75,"px"),minWidth:"".concat(n*.75,"px")},children:o.jsx(PBe,{query:Ae[0],index:0,responseId:"sidebar-".concat(de),isPrimary:!0,responseText:Oe.content,activeFile:N},"sql-card-".concat(de,"-").concat(Ae[0].slice(0,30).replace(/\s+/g,"-")))}):o.jsx("div",{className:"".concat(Oe.role==="user"?"max-w-[85%]":"max-w-[98%]"," p-3 rounded-lg ").concat(Oe.role==="user"?"bg-gradient-to-br from-slate-600 to-slate-700 text-white shadow-lg shadow-black/20 border border-slate-500/40":"bg-gradient-to-br from-white/8 to-white/4 border border-white/15 text-white/90 shadow-sm"),children:Oe.role==="assistant"?o.jsx("div",{className:"space-y-3",children:(()=>{const Ke=tt(Oe.content);return Ke.length===0?o.jsx("div",{className:"text-sm leading-relaxed",children:o.jsx(FBe,{content:Oe.content,className:"text-white/90"})}):o.jsx(kBe,{code:Ke[0],index:0,onSendToNotebook:Le,activeFile:N},"primary-python-".concat(de))})()}):o.jsx("p",{className:"text-sm",children:Oe.content})})},Ie)})),B&&Te.push(o.jsx("div",{className:"flex justify-start",children:o.jsxs("div",{className:"max-w-[98%] p-3 rounded-lg bg-gradient-to-br from-white/8 to-white/4 border border-white/15 text-white/90 shadow-sm",children:[o.jsx(jBe,{status:pe.currentStatus,progress:pe.progress,phase:pe.phase,isVisible:!0,compact:!0}),_e.length>0&&o.jsx("div",{className:"mt-2",children:o.jsx(UBe,{pills:_e,compact:!0})})]})},"status-indicator")),Te},[J,n,N,Ge,tt,Le,a,ne,B,pe,_e]);return o.jsxs(o.Fragment,{children:[o.jsx(At,{children:e&&o.jsxs(me.div,{ref:_,initial:{x:n},animate:{x:0},exit:{x:n},transition:{duration:.3,ease:"easeInOut"},className:"fixed top-0 right-0 h-full bg-background border-l border-white/10 z-40 flex flex-col",style:{width:n},children:[o.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-1 cursor-ew-resize hover:bg-primary/20 transition-colors ".concat(y?"bg-primary/50":""),onMouseDown:ke}),o.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-6 cursor-ew-resize z-50",onMouseDown:ke}),o.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-white/10",children:[o.jsx("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:o.jsx("h3",{className:"text-sm font-medium text-white truncate",children:a("ai.assistant.title",{defaultValue:"Assistant"})})}),o.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[o.jsx("div",{className:qe?"opacity-50 pointer-events-none":"",children:o.jsx(CBe,{compact:!0})}),o.jsx(Ut,{content:a("ai.prompts.actions.startNewChat"),placement:"bottom",children:o.jsx("button",{onClick:oe,disabled:qe||B,className:"p-1 rounded transition-all ".concat(qe||B?"opacity-50 cursor-not-allowed":"hover:bg-white/10 text-white/70 hover:text-white"),children:o.jsx(ma,{className:"h-3.5 w-3.5"})})}),o.jsx("button",{onClick:t,className:"p-1 hover:bg-white/10 rounded transition-colors text-white/70 hover:text-white",children:o.jsx(ur,{className:"h-3.5 w-3.5"})})]})]}),o.jsxs("div",{ref:w,className:"flex-1 overflow-y-auto p-4 space-y-6 relative",children:[k==="notebook"&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"fixed inset-0 z-10 flex items-center justify-center bg-background/30 pointer-events-none",style:{position:"absolute",top:0,left:0,right:0,bottom:0},children:o.jsxs("div",{className:"text-center px-4",children:[o.jsx("p",{className:"text-white/80 text-sm font-medium mb-1",children:"Coming Soon"}),o.jsx("p",{className:"text-white/60 text-xs",children:"Soon you can write your Python cells with help of DataKit Assistant"})]})}),o.jsxs("div",{className:k==="notebook"?"opacity-20 pointer-events-none":"",children:[!O&&o.jsxs("div",{className:"space-y-3 mb-6",children:[o.jsx("div",{className:"text-center mb-4",children:o.jsxs("p",{className:"text-xs text-white/70 font-medium mb-2",children:[o.jsx("span",{className:"text-white/90",children:"DataKit Assistant"})," models only see your tables structure, not your actual data"]})}),L?o.jsx("div",{className:"flex justify-center py-8",children:o.jsx(TO,{size:"md"})}):o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx(je,{onClick:()=>ue("signup"),variant:"outline",size:"md",className:"w-full text-sm font-medium py-3 h-auto bg-white text-black hover:bg-white/90 hover:text-black border-white",children:a("ai.prompts.setup.signUpCredits")}),o.jsxs(je,{onClick:Ee,variant:"outline",className:"w-full flex items-center justify-between px-4 py-3 text-sm group hover:bg-white/8 h-auto border border-white/20 hover:border-white/30 bg-white/5 transition-all duration-200",children:[o.jsxs("div",{className:"flex flex-col items-start gap-1",children:[o.jsx("span",{className:"font-semibold text-white text-left",children:"Login or Bring Your Own Model"}),o.jsx("span",{className:"text-xs text-white/60 text-left font-medium",children:"Connect your AI provider"})]}),o.jsxs("div",{className:"flex items-center gap-1.5 opacity-50 group-hover:opacity-70 transition-opacity",children:[o.jsx("img",{src:bS,className:"h-4 w-4",alt:"OpenAI"}),o.jsx("img",{src:ac,className:"h-4 w-4",alt:"Anthropic"}),o.jsx("img",{src:tP,className:"h-4 w-4",alt:"Ollama"})]})]})]})]}),l?o.jsxs("div",{className:"space-y-3",children:[o.jsxs("p",{className:"text-xs text-white/50 mb-3",children:[a("ai.prompts.suggestions.title"),":"]}),HBe(a).map((Te,Oe)=>o.jsxs("button",{onClick:()=>!qe&&st(Te.prompt),disabled:qe,className:"w-full text-left p-3 border rounded-lg transition-all cursor-pointer ".concat(qe?"bg-white/3 border-white/5 cursor-not-allowed opacity-50":"bg-white/5 hover:bg-white/10 border-white/10 hover:border-white/20 group"),children:[o.jsx("div",{className:"font-medium text-sm text-white/90 mb-1",children:Te.title}),o.jsx("div",{className:"text-xs ".concat(qe?"text-white/40":"text-white/60 group-hover:text-white/70"),children:Te.prompt})]},Oe))]}):o.jsx("div",{className:"space-y-6",children:ct})]})]}),o.jsx("div",{className:"border-t border-white/10 p-2 sm:p-4 ".concat(k==="notebook"?"opacity-20 pointer-events-none":""),children:o.jsxs("form",{onSubmit:at,className:"space-y-3",children:[N&&I&&o.jsx("div",{className:"relative mb-2",children:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-gradient-to-r from-primary/15 to-gray-500/5 border-l-2 border-l-primary/60 border-y border-r border-white/10 rounded-lg max-w-[75%] group hover:from-primary/20 hover:to-gray-500/8 transition-all duration-200",children:[o.jsx("div",{className:"flex-shrink-0",children:(()=>{const Te=N.fileExtension,Oe={size:14,strokeWidth:1.5};switch(Te){case"csv":case"excel":case"xlsx":case"xls":return o.jsx(CL,he(q({},Oe),{className:"text-emerald-400"}));case"json":return o.jsx(kW,he(q({},Oe),{className:"text-amber-400"}));case"parquet":return o.jsx(Dl,he(q({},Oe),{className:"text-cyan-400"}));case"txt":return o.jsx(Xn,he(q({},Oe),{className:"text-slate-400"}));case"duckdb":return o.jsx(Xs,he(q({},Oe),{className:"text-violet-400"}));case"remote":return o.jsx(dh,he(q({},Oe),{className:"text-blue-400"}));case"query":return o.jsx(GW,he(q({},Oe),{className:"text-blue-400"}));default:return o.jsx(Xn,he(q({},Oe),{className:"text-white/50"}))}})()}),o.jsx("div",{className:"min-w-0 flex-1",children:o.jsx("span",{className:"text-sm text-white/90 font-medium truncate block",children:I})})]})}),o.jsxs("div",{className:"relative",children:[o.jsx("textarea",{ref:A,value:s,onChange:Te=>i(Te.target.value),onKeyDown:ot,placeholder:"Ask about your file",className:"w-full px-3 py-2 sm:px-4 sm:py-3 bg-white/5 border border-white/10 rounded-lg text-white placeholder-white/40 resize-none focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary/50 transition-all text-sm sm:text-base",rows:2,disabled:B||!O||L}),o.jsxs("div",{className:"absolute bottom-3 right-2 flex items-center gap-1 sm:gap-2",children:[o.jsxs("div",{className:"hidden sm:flex items-center gap-1 text-xs text-white/40 bg-black/30 px-2 py-1 rounded border border-white/10",children:[o.jsx(NL,{className:"h-3 w-3"}),o.jsx("span",{children:"↵"})]}),o.jsx("button",{type:"submit",disabled:!s.trim()||!z||B||!O||L,className:"p-2 rounded-md transition-all ".concat(s.trim()&&z&&!B&&O&&!L?"bg-primary text-white hover:bg-primary/80":"bg-white/10 text-white/30 cursor-not-allowed"),children:o.jsx(Eme,{className:"h-4 w-4"})})]})]}),o.jsx(SZ,{error:$,onDismiss:()=>X(null),onRetry:()=>{X(null),s.trim()&&at()}})]})})]})}),o.jsx(xZ,{isOpen:u,onClose:()=>h(!1)}),o.jsx(Vl,{isOpen:m,onClose:()=>p(!1),defaultMode:g})]})},GBe=({processFile:e,addFile:t,analytics:n})=>{v.useEffect(()=>{const r=a=>{var l,c;if(["https://datakit.studio","http://localhost:5174"].some(u=>{if(u.includes("*")){const h=u.replace("*","");return a.origin.endsWith(h)}return a.origin===u})){if(a.data.type==="DEMO_READY"){(l=a.source)==null||l.postMessage({type:"DATAKIT_READY",message:"DataKit ready to receive files"},a.origin);return}if(a.data.type==="FILE_DROP"){const{file:u}=a.data,h=atob(u.data),m=new Uint8Array(h.length);for(let g=0;g<h.length;g++)m[g]=h.charCodeAt(g);const p=new File([m],u.name,{type:u.type});e(p,g=>{t(g),n.trackFileUpload(g)}),(c=a.source)==null||c.postMessage({type:"FILE_PROCESSED",fileName:u.name,success:!0},a.origin)}}};return window.addEventListener("message",r),()=>window.removeEventListener("message",r)},[e,t,n])},zBe=({processFile:e,addFile:t,analytics:n})=>{v.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("demo");if(a&&a.includes(".csv")){const s="id,name,value\\n1,Sample,100\\n2,Demo,200",i=new File([s],a,{type:"text/csv"});e(i,l=>{t(l),n.trackFileUpload(l)})}},[e,t,n])},qBe=e=>{const t=q0(),n=v.useRef("");v.useEffect(()=>{n.current&&n.current!==e&&t.trackTabChange(n.current,e),n.current=e},[e,t])},YBe=()=>{const{setIsInIframe:e,setSidebarCollapsed:t}=ut();v.useEffect(()=>{const r=(()=>{try{return window.self!==window.top}catch(a){return!0}})();e(r),r&&t(!0)},[e,t])},WBe=()=>{const e=q0(),{processFile:t}=KW(),n=ut(d7),r=ut(Jge),a=ut(Zge),s=ut(eEe),{activeTab:i,jsonViewMode:l,setActiveTab:c,setJsonViewMode:u,addFile:h,isInIframe:m}=ut();YBe(),qBe(i),GBe({processFile:t,addFile:h,analytics:e}),zBe({processFile:t,addFile:h,analytics:e});const p=T=>{h(T),e.trackFileUpload(T)},g=r?"Feedback provided while working with: ".concat(r," (").concat(a===tr.JSON?"JSON":"CSV",", ").concat((n==null?void 0:n.rowCount)||0," rows)"):void 0;return{activeFileInfo:n,fileName:r,sourceType:a,jsonSchema:s,activeTab:i,jsonViewMode:l,isInIframe:m,setActiveTab:c,setJsonViewMode:u,feedbackContext:g,handleDataLoad:p}},XBe=()=>{const[e,t]=v.useState(!1),[n,r]=v.useState(null),{addFile:a,ensureTempFolder:s}=xs(),i=v.useCallback(m=>{r(m),t(!0)},[]),l=v.useCallback(()=>{t(!1),delete window.__activeQueryCardId,window.dispatchEvent(new CustomEvent("queryCardActiveChange")),setTimeout(()=>r(null),250)},[]),c=v.useCallback(m=>H(null,null,function*(){if(!(n!=null&&n.data)||n.data.length<2)throw new Error("No valid results to save");const{data:p}=n,g=p[0].slice(1),T=p.slice(1),y=g.map(x=>'"'.concat(x,'" VARCHAR')).join(", "),b='CREATE TABLE "'.concat(m,'" (').concat(y,")");try{const{executeQuery:x}=Dt.getState();yield x(b);const R=1e3;for(let I=0;I<T.length;I+=R){const M=T.slice(I,I+R).map(L=>"(".concat(L.slice(1).map(k=>k==null?"NULL":typeof k=="string"?"'".concat(k.replace(/'/g,"''"),"'"):k).join(", "),")")).join(", "),O='INSERT INTO "'.concat(m,'" VALUES ').concat(M);yield x(O)}const A=Dt.getState(),w=new Map(A.registeredTables);w.set(m,'"'.concat(m,'"')),Dt.setState({registeredTables:w,lastTableRefresh:Date.now()});const _=s(),N=new File([""],"".concat(m,".sql"),{type:"text/sql"});a(N,{fileType:"query",isLoaded:!0,tableName:m,size:0,lastModified:Date.now()},_),l()}catch(x){throw x}}),[n,l,a,s]),u=v.useCallback((m="csv")=>{if(!(n!=null&&n.data))return;const{data:p}=n;let g,T,y;if(m==="csv")g=p.map(A=>A.map(w=>{const _=String(w||"");return _.includes(",")||_.includes('"')||_.includes("\n")?'"'.concat(_.replace(/"/g,'""'),'"'):_}).join(",")).join("\n"),T="query_results_".concat(new Date().toISOString().slice(0,19).replace(/:/g,"-"),".csv"),y="text/csv";else{const A=p[0],_=p.slice(1).map(N=>{const I={};return A.forEach((D,M)=>{I[D]=N[M]}),I});g=JSON.stringify(_,null,2),T="query_results_".concat(new Date().toISOString().slice(0,19).replace(/:/g,"-"),".json"),y="application/json"}const b=new Blob([g],{type:y}),x=URL.createObjectURL(b),R=document.createElement("a");R.href=x,R.download=T,document.body.appendChild(R),R.click(),document.body.removeChild(R),URL.revokeObjectURL(x)},[n]),h=v.useCallback(()=>{if(!(n!=null&&n.data))return;const m=n.data.map(p=>p.join("	")).join("\n");navigator.clipboard.writeText(m)},[n]);return{isDraggableOpen:e,draggableResults:n,showDraggableResults:i,closeDraggableResults:l,handleKeepDraggableResults:c,handleExportDraggableResults:u,handleCopyDraggableResults:h}};var WC,yz;function KBe(){if(yz)return WC;yz=1;var e=O9(),t=0;function n(r){var a=++t;return e(r)+a}return WC=n,WC}var QBe=KBe();const JBe=ir(QBe),Lo=11102230246251565e-32,Sa=134217729,ZBe=(3+8*Lo)*Lo;function XC(e,t,n,r,a){let s,i,l,c,u=t[0],h=r[0],m=0,p=0;h>u==h>-u?(s=u,u=t[++m]):(s=h,h=r[++p]);let g=0;if(m<e&&p<n)for(h>u==h>-u?(i=u+s,l=s-(i-u),u=t[++m]):(i=h+s,l=s-(i-h),h=r[++p]),s=i,l!==0&&(a[g++]=l);m<e&&p<n;)h>u==h>-u?(i=s+u,c=i-s,l=s-(i-c)+(u-c),u=t[++m]):(i=s+h,c=i-s,l=s-(i-c)+(h-c),h=r[++p]),s=i,l!==0&&(a[g++]=l);for(;m<e;)i=s+u,c=i-s,l=s-(i-c)+(u-c),u=t[++m],s=i,l!==0&&(a[g++]=l);for(;p<n;)i=s+h,c=i-s,l=s-(i-c)+(h-c),h=r[++p],s=i,l!==0&&(a[g++]=l);return(s!==0||g===0)&&(a[g++]=s),g}function eHe(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function Wg(e){return new Float64Array(e)}const tHe=(3+16*Lo)*Lo,nHe=(2+12*Lo)*Lo,rHe=(9+64*Lo)*Lo*Lo,Ud=Wg(4),xz=Wg(8),Sz=Wg(12),bz=Wg(16),$a=Wg(4);function aHe(e,t,n,r,a,s,i){let l,c,u,h,m,p,g,T,y,b,x,R,A,w,_,N,I,D;const M=e-a,O=n-a,L=t-s,k=r-s;w=M*k,p=Sa*M,g=p-(p-M),T=M-g,p=Sa*k,y=p-(p-k),b=k-y,_=T*b-(w-g*y-T*y-g*b),N=L*O,p=Sa*L,g=p-(p-L),T=L-g,p=Sa*O,y=p-(p-O),b=O-y,I=T*b-(N-g*y-T*y-g*b),x=_-I,m=_-x,Ud[0]=_-(x+m)+(m-I),R=w+x,m=R-w,A=w-(R-m)+(x-m),x=A-N,m=A-x,Ud[1]=A-(x+m)+(m-N),D=R+x,m=D-R,Ud[2]=R-(D-m)+(x-m),Ud[3]=D;let F=eHe(4,Ud),U=nHe*i;if(F>=U||-F>=U||(m=e-M,l=e-(M+m)+(m-a),m=n-O,u=n-(O+m)+(m-a),m=t-L,c=t-(L+m)+(m-s),m=r-k,h=r-(k+m)+(m-s),l===0&&c===0&&u===0&&h===0)||(U=rHe*i+ZBe*Math.abs(F),F+=M*h+k*l-(L*u+O*c),F>=U||-F>=U))return F;w=l*k,p=Sa*l,g=p-(p-l),T=l-g,p=Sa*k,y=p-(p-k),b=k-y,_=T*b-(w-g*y-T*y-g*b),N=c*O,p=Sa*c,g=p-(p-c),T=c-g,p=Sa*O,y=p-(p-O),b=O-y,I=T*b-(N-g*y-T*y-g*b),x=_-I,m=_-x,$a[0]=_-(x+m)+(m-I),R=w+x,m=R-w,A=w-(R-m)+(x-m),x=A-N,m=A-x,$a[1]=A-(x+m)+(m-N),D=R+x,m=D-R,$a[2]=R-(D-m)+(x-m),$a[3]=D;const B=XC(4,Ud,4,$a,xz);w=M*h,p=Sa*M,g=p-(p-M),T=M-g,p=Sa*h,y=p-(p-h),b=h-y,_=T*b-(w-g*y-T*y-g*b),N=L*u,p=Sa*L,g=p-(p-L),T=L-g,p=Sa*u,y=p-(p-u),b=u-y,I=T*b-(N-g*y-T*y-g*b),x=_-I,m=_-x,$a[0]=_-(x+m)+(m-I),R=w+x,m=R-w,A=w-(R-m)+(x-m),x=A-N,m=A-x,$a[1]=A-(x+m)+(m-N),D=R+x,m=D-R,$a[2]=R-(D-m)+(x-m),$a[3]=D;const j=XC(B,xz,4,$a,Sz);w=l*h,p=Sa*l,g=p-(p-l),T=l-g,p=Sa*h,y=p-(p-h),b=h-y,_=T*b-(w-g*y-T*y-g*b),N=c*u,p=Sa*c,g=p-(p-c),T=c-g,p=Sa*u,y=p-(p-u),b=u-y,I=T*b-(N-g*y-T*y-g*b),x=_-I,m=_-x,$a[0]=_-(x+m)+(m-I),R=w+x,m=R-w,A=w-(R-m)+(x-m),x=A-N,m=A-x,$a[1]=A-(x+m)+(m-N),D=R+x,m=D-R,$a[2]=R-(D-m)+(x-m),$a[3]=D;const G=XC(j,Sz,4,$a,bz);return bz[G-1]}function XT(e,t,n,r,a,s){const i=(t-s)*(n-a),l=(e-a)*(r-s),c=i-l,u=Math.abs(i+l);return Math.abs(c)>=tHe*u?c:-aHe(e,t,n,r,a,s,u)}const vz=Math.pow(2,-52),KT=new Uint32Array(512);class v0{static from(t,n=cHe,r=uHe){const a=t.length,s=new Float64Array(a*2);for(let i=0;i<a;i++){const l=t[i];s[2*i]=n(l),s[2*i+1]=r(l)}return new v0(s)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:r,_hullTri:a,_hullHash:s}=this,i=t.length>>1;let l=1/0,c=1/0,u=-1/0,h=-1/0;for(let M=0;M<i;M++){const O=t[2*M],L=t[2*M+1];O<l&&(l=O),L<c&&(c=L),O>u&&(u=O),L>h&&(h=L),this._ids[M]=M}const m=(l+u)/2,p=(c+h)/2;let g,T,y;for(let M=0,O=1/0;M<i;M++){const L=KC(m,p,t[2*M],t[2*M+1]);L<O&&(g=M,O=L)}const b=t[2*g],x=t[2*g+1];for(let M=0,O=1/0;M<i;M++){if(M===g)continue;const L=KC(b,x,t[2*M],t[2*M+1]);L<O&&L>0&&(T=M,O=L)}let R=t[2*T],A=t[2*T+1],w=1/0;for(let M=0;M<i;M++){if(M===g||M===T)continue;const O=oHe(b,x,R,A,t[2*M],t[2*M+1]);O<w&&(y=M,w=O)}let _=t[2*y],N=t[2*y+1];if(w===1/0){for(let L=0;L<i;L++)this._dists[L]=t[2*L]-t[0]||t[2*L+1]-t[1];ih(this._ids,this._dists,0,i-1);const M=new Uint32Array(i);let O=0;for(let L=0,k=-1/0;L<i;L++){const F=this._ids[L],U=this._dists[F];U>k&&(M[O++]=F,k=U)}this.hull=M.subarray(0,O),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(XT(b,x,R,A,_,N)<0){const M=T,O=R,L=A;T=y,R=_,A=N,y=M,_=O,N=L}const I=lHe(b,x,R,A,_,N);this._cx=I.x,this._cy=I.y;for(let M=0;M<i;M++)this._dists[M]=KC(t[2*M],t[2*M+1],I.x,I.y);ih(this._ids,this._dists,0,i-1),this._hullStart=g;let D=3;r[g]=n[y]=T,r[T]=n[g]=y,r[y]=n[T]=g,a[g]=0,a[T]=1,a[y]=2,s.fill(-1),s[this._hashKey(b,x)]=g,s[this._hashKey(R,A)]=T,s[this._hashKey(_,N)]=y,this.trianglesLen=0,this._addTriangle(g,T,y,-1,-1,-1);for(let M=0,O,L;M<this._ids.length;M++){const k=this._ids[M],F=t[2*k],U=t[2*k+1];if(M>0&&Math.abs(F-O)<=vz&&Math.abs(U-L)<=vz||(O=F,L=U,k===g||k===T||k===y))continue;let B=0;for(let $=0,X=this._hashKey(F,U);$<this._hashSize&&(B=s[(X+$)%this._hashSize],!(B!==-1&&B!==r[B]));$++);B=n[B];let j=B,G;for(;G=r[j],XT(F,U,t[2*j],t[2*j+1],t[2*G],t[2*G+1])>=0;)if(j=G,j===B){j=-1;break}if(j===-1)continue;let K=this._addTriangle(j,k,r[j],-1,-1,a[j]);a[k]=this._legalize(K+2),a[j]=K,D++;let J=r[j];for(;G=r[J],XT(F,U,t[2*J],t[2*J+1],t[2*G],t[2*G+1])<0;)K=this._addTriangle(J,k,G,a[k],-1,a[J]),a[k]=this._legalize(K+2),r[J]=J,D--,J=G;if(j===B)for(;G=n[j],XT(F,U,t[2*G],t[2*G+1],t[2*j],t[2*j+1])<0;)K=this._addTriangle(G,k,j,-1,a[j],a[G]),this._legalize(K+2),a[G]=K,r[j]=j,D--,j=G;this._hullStart=n[k]=j,r[j]=n[J]=k,r[k]=J,s[this._hashKey(F,U)]=k,s[this._hashKey(t[2*j],t[2*j+1])]=j}this.hull=new Uint32Array(D);for(let M=0,O=this._hullStart;M<D;M++)this.hull[M]=O,O=r[O];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(sHe(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:r,coords:a}=this;let s=0,i=0;for(;;){const l=r[t],c=t-t%3;if(i=c+(t+2)%3,l===-1){if(s===0)break;t=KT[--s];continue}const u=l-l%3,h=c+(t+1)%3,m=u+(l+2)%3,p=n[i],g=n[t],T=n[h],y=n[m];if(iHe(a[2*p],a[2*p+1],a[2*g],a[2*g+1],a[2*T],a[2*T+1],a[2*y],a[2*y+1])){n[t]=y,n[l]=p;const x=r[m];if(x===-1){let A=this._hullStart;do{if(this._hullTri[A]===m){this._hullTri[A]=t;break}A=this._hullPrev[A]}while(A!==this._hullStart)}this._link(t,x),this._link(l,r[i]),this._link(i,m);const R=u+(l+1)%3;s<KT.length&&(KT[s++]=R)}else{if(s===0)break;t=KT[--s]}}return i}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,a,s,i){const l=this.trianglesLen;return this._triangles[l]=t,this._triangles[l+1]=n,this._triangles[l+2]=r,this._link(l,a),this._link(l+1,s),this._link(l+2,i),this.trianglesLen+=3,l}}function sHe(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function KC(e,t,n,r){const a=e-n,s=t-r;return a*a+s*s}function iHe(e,t,n,r,a,s,i,l){const c=e-i,u=t-l,h=n-i,m=r-l,p=a-i,g=s-l,T=c*c+u*u,y=h*h+m*m,b=p*p+g*g;return c*(m*b-y*g)-u*(h*b-y*p)+T*(h*g-m*p)<0}function oHe(e,t,n,r,a,s){const i=n-e,l=r-t,c=a-e,u=s-t,h=i*i+l*l,m=c*c+u*u,p=.5/(i*u-l*c),g=(u*h-l*m)*p,T=(i*m-c*h)*p;return g*g+T*T}function lHe(e,t,n,r,a,s){const i=n-e,l=r-t,c=a-e,u=s-t,h=i*i+l*l,m=c*c+u*u,p=.5/(i*u-l*c),g=e+(u*h-l*m)*p,T=t+(i*m-c*h)*p;return{x:g,y:T}}function ih(e,t,n,r){if(r-n<=20)for(let a=n+1;a<=r;a++){const s=e[a],i=t[s];let l=a-1;for(;l>=n&&t[e[l]]>i;)e[l+1]=e[l--];e[l+1]=s}else{const a=n+r>>1;let s=n+1,i=r;Zm(e,a,s),t[e[n]]>t[e[r]]&&Zm(e,n,r),t[e[s]]>t[e[r]]&&Zm(e,s,r),t[e[n]]>t[e[s]]&&Zm(e,n,s);const l=e[s],c=t[l];for(;;){do s++;while(t[e[s]]<c);do i--;while(t[e[i]]>c);if(i<s)break;Zm(e,s,i)}e[n+1]=e[i],e[i]=l,r-s+1>=i-n?(ih(e,t,s,r),ih(e,t,n,i-1)):(ih(e,t,n,i-1),ih(e,t,s,r))}}function Zm(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function cHe(e){return e[0]}function uHe(e){return e[1]}const Az=1e-6;class Jc{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+="M".concat(this._x0=this._x1=+t,",").concat(this._y0=this._y1=+n)}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+="L".concat(this._x1=+t,",").concat(this._y1=+n)}arc(t,n,r){t=+t,n=+n,r=+r;const a=t+r,s=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+="M".concat(a,",").concat(s):(Math.abs(this._x1-a)>Az||Math.abs(this._y1-s)>Az)&&(this._+="L"+a+","+s),r&&(this._+="A".concat(r,",").concat(r,",0,1,1,").concat(t-r,",").concat(n,"A").concat(r,",").concat(r,",0,1,1,").concat(this._x1=a,",").concat(this._y1=s))}rect(t,n,r,a){this._+="M".concat(this._x0=this._x1=+t,",").concat(this._y0=this._y1=+n,"h").concat(+r,"v").concat(+a,"h").concat(-r,"Z")}value(){return this._||null}}class y1{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class dHe{constructor(t,[n,r,a,s]=[0,0,960,500]){if(!((a=+a)>=(n=+n))||!((s=+s)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=a,this.xmin=n,this.ymax=s,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:r},vectors:a}=this;let s,i;const l=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let y=0,b=0,x=r.length,R,A;y<x;y+=3,b+=2){const w=r[y]*2,_=r[y+1]*2,N=r[y+2]*2,I=t[w],D=t[w+1],M=t[_],O=t[_+1],L=t[N],k=t[N+1],F=M-I,U=O-D,B=L-I,j=k-D,G=(F*j-U*B)*2;if(Math.abs(G)<1e-9){if(s===void 0){s=i=0;for(const J of n)s+=t[J*2],i+=t[J*2+1];s/=n.length,i/=n.length}const K=1e9*Math.sign((s-I)*j-(i-D)*B);R=(I+L)/2-K*j,A=(D+k)/2+K*B}else{const K=1/G,J=F*F+U*U,$=B*B+j*j;R=I+(j*J-U*$)*K,A=D+(F*$-B*J)*K}l[b]=R,l[b+1]=A}let c=n[n.length-1],u,h=c*4,m,p=t[2*c],g,T=t[2*c+1];a.fill(0);for(let y=0;y<n.length;++y)c=n[y],u=h,m=p,g=T,h=c*4,p=t[2*c],T=t[2*c+1],a[u+2]=a[h]=g-T,a[u+3]=a[h+1]=p-m}render(t){const n=t==null?t=new Jc:void 0,{delaunay:{halfedges:r,inedges:a,hull:s},circumcenters:i,vectors:l}=this;if(s.length<=1)return null;for(let h=0,m=r.length;h<m;++h){const p=r[h];if(p<h)continue;const g=Math.floor(h/3)*2,T=Math.floor(p/3)*2,y=i[g],b=i[g+1],x=i[T],R=i[T+1];this._renderSegment(y,b,x,R,t)}let c,u=s[s.length-1];for(let h=0;h<s.length;++h){c=u,u=s[h];const m=Math.floor(a[u]/3)*2,p=i[m],g=i[m+1],T=c*4,y=this._project(p,g,l[T+2],l[T+3]);y&&this._renderSegment(p,g,y[0],y[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new Jc:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const r=n==null?n=new Jc:void 0,a=this._clip(t);if(a===null||!a.length)return;n.moveTo(a[0],a[1]);let s=a.length;for(;a[0]===a[s-2]&&a[1]===a[s-1]&&s>1;)s-=2;for(let i=2;i<s;i+=2)(a[i]!==a[i-2]||a[i+1]!==a[i-1])&&n.lineTo(a[i],a[i+1]);return n.closePath(),r&&r.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){const a=this.cellPolygon(n);a&&(a.index=n,yield a)}}cellPolygon(t){const n=new y1;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,a,s){let i;const l=this._regioncode(t,n),c=this._regioncode(r,a);l===0&&c===0?(s.moveTo(t,n),s.lineTo(r,a)):(i=this._clipSegment(t,n,r,a,l,c))&&(s.moveTo(i[0],i[1]),s.lineTo(i[2],i[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){const n=this._clip(t);if(n)for(const r of this.delaunay.neighbors(t)){const a=this._clip(r);if(a){e:for(let s=0,i=n.length;s<i;s+=2)for(let l=0,c=a.length;l<c;l+=2)if(n[s]===a[l]&&n[s+1]===a[l+1]&&n[(s+2)%i]===a[(l+c-2)%c]&&n[(s+3)%i]===a[(l+c-1)%c]){yield r;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:r,halfedges:a,triangles:s}}=this,i=r[t];if(i===-1)return null;const l=[];let c=i;do{const u=Math.floor(c/3);if(l.push(n[u*2],n[u*2+1]),c=c%3===2?c-2:c+1,s[c]!==t)break;c=a[c]}while(c!==i&&c!==-1);return l}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:r}=this,a=t*4;return this._simplify(r[a]||r[a+1]?this._clipInfinite(t,n,r[a],r[a+1],r[a+2],r[a+3]):this._clipFinite(t,n))}_clipFinite(t,n){const r=n.length;let a=null,s,i,l=n[r-2],c=n[r-1],u,h=this._regioncode(l,c),m,p=0;for(let g=0;g<r;g+=2)if(s=l,i=c,l=n[g],c=n[g+1],u=h,h=this._regioncode(l,c),u===0&&h===0)m=p,p=0,a?a.push(l,c):a=[l,c];else{let T,y,b,x,R;if(u===0){if((T=this._clipSegment(s,i,l,c,u,h))===null)continue;[y,b,x,R]=T}else{if((T=this._clipSegment(l,c,s,i,h,u))===null)continue;[x,R,y,b]=T,m=p,p=this._edgecode(y,b),m&&p&&this._edge(t,m,p,a,a.length),a?a.push(y,b):a=[y,b]}m=p,p=this._edgecode(x,R),m&&p&&this._edge(t,m,p,a,a.length),a?a.push(x,R):a=[x,R]}if(a)m=p,p=this._edgecode(a[0],a[1]),m&&p&&this._edge(t,m,p,a,a.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return a}_clipSegment(t,n,r,a,s,i){const l=s<i;for(l&&([t,n,r,a,s,i]=[r,a,t,n,i,s]);;){if(s===0&&i===0)return l?[r,a,t,n]:[t,n,r,a];if(s&i)return null;let c,u,h=s||i;h&8?(c=t+(r-t)*(this.ymax-n)/(a-n),u=this.ymax):h&4?(c=t+(r-t)*(this.ymin-n)/(a-n),u=this.ymin):h&2?(u=n+(a-n)*(this.xmax-t)/(r-t),c=this.xmax):(u=n+(a-n)*(this.xmin-t)/(r-t),c=this.xmin),s?(t=c,n=u,s=this._regioncode(t,n)):(r=c,a=u,i=this._regioncode(r,a))}}_clipInfinite(t,n,r,a,s,i){let l=Array.from(n),c;if((c=this._project(l[0],l[1],r,a))&&l.unshift(c[0],c[1]),(c=this._project(l[l.length-2],l[l.length-1],s,i))&&l.push(c[0],c[1]),l=this._clipFinite(t,l))for(let u=0,h=l.length,m,p=this._edgecode(l[h-2],l[h-1]);u<h;u+=2)m=p,p=this._edgecode(l[u],l[u+1]),m&&p&&(u=this._edge(t,m,p,l,u),h=l.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(l=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return l}_edge(t,n,r,a,s){for(;n!==r;){let i,l;switch(n){case 5:n=4;continue;case 4:n=6,i=this.xmax,l=this.ymin;break;case 6:n=2;continue;case 2:n=10,i=this.xmax,l=this.ymax;break;case 10:n=8;continue;case 8:n=9,i=this.xmin,l=this.ymax;break;case 9:n=1;continue;case 1:n=5,i=this.xmin,l=this.ymin;break}(a[s]!==i||a[s+1]!==l)&&this.contains(t,i,l)&&(a.splice(s,0,i,l),s+=2)}return s}_project(t,n,r,a){let s=1/0,i,l,c;if(a<0){if(n<=this.ymin)return null;(i=(this.ymin-n)/a)<s&&(c=this.ymin,l=t+(s=i)*r)}else if(a>0){if(n>=this.ymax)return null;(i=(this.ymax-n)/a)<s&&(c=this.ymax,l=t+(s=i)*r)}if(r>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/r)<s&&(l=this.xmax,c=n+(s=i)*a)}else if(r<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/r)<s&&(l=this.xmin,c=n+(s=i)*a)}return[l,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const r=(n+2)%t.length,a=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[a]||t[n+1]===t[r+1]&&t[r+1]===t[a+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}}const hHe=2*Math.PI,Fd=Math.pow;function fHe(e){return e[0]}function mHe(e){return e[1]}function pHe(e){const{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){const a=2*t[r],s=2*t[r+1],i=2*t[r+2];if((n[i]-n[a])*(n[s+1]-n[a+1])-(n[s]-n[a])*(n[i+1]-n[a+1])>1e-10)return!1}return!0}function gHe(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class vS{static from(t,n=fHe,r=mHe,a){return new vS("length"in t?EHe(t,n,r,a):Float64Array.from(THe(t,n,r,a)))}constructor(t){this._delaunator=new v0(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&pHe(t)){this.collinear=Int32Array.from({length:n.length/2},(p,g)=>g).sort((p,g)=>n[2*p]-n[2*g]||n[2*p+1]-n[2*g+1]);const c=this.collinear[0],u=this.collinear[this.collinear.length-1],h=[n[2*c],n[2*c+1],n[2*u],n[2*u+1]],m=1e-8*Math.hypot(h[3]-h[1],h[2]-h[0]);for(let p=0,g=n.length/2;p<g;++p){const T=gHe(n[2*p],n[2*p+1],m);n[2*p]=T[0],n[2*p+1]=T[1]}this._delaunator=new v0(n)}else delete this.collinear;const r=this.halfedges=this._delaunator.halfedges,a=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,i=this.inedges.fill(-1),l=this._hullIndex.fill(-1);for(let c=0,u=r.length;c<u;++c){const h=s[c%3===2?c-2:c+1];(r[c]===-1||i[h]===-1)&&(i[h]=c)}for(let c=0,u=a.length;c<u;++c)l[a[c]]=c;a.length<=2&&a.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=a[0],i[a[0]]=1,a.length===2&&(i[a[1]]=0,this.triangles[1]=a[1],this.triangles[2]=a[1]))}voronoi(t){return new dHe(this,t)}*neighbors(t){const{inedges:n,hull:r,_hullIndex:a,halfedges:s,triangles:i,collinear:l}=this;if(l){const m=l.indexOf(t);m>0&&(yield l[m-1]),m<l.length-1&&(yield l[m+1]);return}const c=n[t];if(c===-1)return;let u=c,h=-1;do{if(yield h=i[u],u=u%3===2?u-2:u+1,i[u]!==t)return;if(u=s[u],u===-1){const m=r[(a[t]+1)%r.length];m!==h&&(yield m);return}}while(u!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const a=r;let s;for(;(s=this._step(r,t,n))>=0&&s!==r&&s!==a;)r=s;return s}_step(t,n,r){const{inedges:a,hull:s,_hullIndex:i,halfedges:l,triangles:c,points:u}=this;if(a[t]===-1||!u.length)return(t+1)%(u.length>>1);let h=t,m=Fd(n-u[t*2],2)+Fd(r-u[t*2+1],2);const p=a[t];let g=p;do{let T=c[g];const y=Fd(n-u[T*2],2)+Fd(r-u[T*2+1],2);if(y<m&&(m=y,h=T),g=g%3===2?g-2:g+1,c[g]!==t)break;if(g=l[g],g===-1){if(g=s[(i[t]+1)%s.length],g!==T&&Fd(n-u[g*2],2)+Fd(r-u[g*2+1],2)<m)return g;break}}while(g!==p);return h}render(t){const n=t==null?t=new Jc:void 0,{points:r,halfedges:a,triangles:s}=this;for(let i=0,l=a.length;i<l;++i){const c=a[i];if(c<i)continue;const u=s[i]*2,h=s[c]*2;t.moveTo(r[u],r[u+1]),t.lineTo(r[h],r[h+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const r=t==null?t=new Jc:void 0,{points:a}=this;for(let s=0,i=a.length;s<i;s+=2){const l=a[s],c=a[s+1];t.moveTo(l+n,c),t.arc(l,c,n,0,hHe)}return r&&r.value()}renderHull(t){const n=t==null?t=new Jc:void 0,{hull:r,points:a}=this,s=r[0]*2,i=r.length;t.moveTo(a[s],a[s+1]);for(let l=1;l<i;++l){const c=2*r[l];t.lineTo(a[c],a[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new y1;return this.renderHull(t),t.value()}renderTriangle(t,n){const r=n==null?n=new Jc:void 0,{points:a,triangles:s}=this,i=s[t*=3]*2,l=s[t+1]*2,c=s[t+2]*2;return n.moveTo(a[i],a[i+1]),n.lineTo(a[l],a[l+1]),n.lineTo(a[c],a[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new y1;return this.renderTriangle(t,n),n.value()}}function EHe(e,t,n,r){const a=e.length,s=new Float64Array(a*2);for(let i=0;i<a;++i){const l=e[i];s[i*2]=t.call(r,l,i,e),s[i*2+1]=n.call(r,l,i,e)}return s}function*THe(e,t,n,r){let a=0;for(const s of e)yield t.call(r,s,a,e),yield n.call(r,s,a,e),++a}function A0(){return A0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A0.apply(null,arguments)}function RZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var ms={xDomain:[0,1],yDomain:[0,1],layers:["links","cells","points","bounds"],enableLinks:!1,linkLineWidth:1,linkLineColor:"#bbbbbb",enableCells:!0,cellLineWidth:2,cellLineColor:"#000000",pointSize:4,pointColor:"#666666",role:"img"},nP=function(e){return[e.x,e.y]},Xg=tK,NZ="cursor",_Z="top",yHe=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?nP:n,a=e.margin,s=a===void 0?Xg:a;return t.map(function(i){var l=r(i),c=l[0],u=l[1];return[c+s.left,u+s.top]})},xHe=function(e){var t=e.points,n=e.width,r=e.height,a=e.margin,s=a===void 0?Xg:a,i=e.debug,l=vS.from(t),c=i?l.voronoi([0,0,s.left+n+s.right,s.top+r+s.bottom]):void 0;return{points:t,delaunay:l,voronoi:c}},rP=function(e){var t=e.points,n=e.getNodePosition,r=n===void 0?nP:n,a=e.width,s=e.height,i=e.margin,l=i===void 0?Xg:i,c=e.debug;return v.useMemo(function(){return xHe({points:yHe({points:t,margin:l,getNodePosition:r}),width:a,height:s,margin:l,debug:c})},[r,t,a,s,l,c])},SHe=function(e){var t=e.data,n=e.width,r=e.height,a=e.xDomain,s=e.yDomain,i=v.useMemo(function(){return Eg().domain(a).range([0,n])},[a,n]),l=v.useMemo(function(){return Eg().domain(s).range([0,r])},[s,r]),c=v.useMemo(function(){return t.map(function(u){return{x:i(u.x),y:l(u.y),data:u}})},[t,i,l]);return v.useMemo(function(){var u=vS.from(c.map(function(m){return[m.x,m.y]})),h=u.voronoi([0,0,n,r]);return{points:c,delaunay:u,voronoi:h}},[c,n,r])},bHe=function(e){var t=e.points,n=e.delaunay,r=e.voronoi;return v.useMemo(function(){return{points:t,delaunay:n,voronoi:r}},[t,n,r])},vHe=function(e){var t=e.elementRef,n=e.nodes,r=e.getNodePosition,a=r===void 0?nP:r,s=e.delaunay,i=e.setCurrent,l=e.margin,c=l===void 0?Xg:l,u=e.detectionRadius,h=u===void 0?1/0:u,m=e.isInteractive,p=m===void 0||m,g=e.onMouseEnter,T=e.onMouseMove,y=e.onMouseLeave,b=e.onMouseDown,x=e.onMouseUp,R=e.onClick,A=e.onDoubleClick,w=e.onTouchStart,_=e.onTouchMove,N=e.onTouchEnd,I=e.enableTouchCrosshair,D=I!==void 0&&I,M=e.tooltip,O=e.tooltipPosition,L=O===void 0?NZ:O,k=e.tooltipAnchor,F=k===void 0?_Z:k,U=v.useState(null),B=U[0],j=U[1],G=v.useRef(null);v.useEffect(function(){G.current=B},[G,B]);var K=v.useCallback(function(le){if(!t.current||n.length===0)return null;var pe=ou(t.current,le),_e=pe[0],re=pe[1],Se=s.find(_e,re),$e=Se!==void 0?n[Se]:null;if($e&&h!==1/0){var qe=a($e),Je=qe[0],lt=qe[1];rK(_e,re,Je+c.left,lt+c.top)>h&&(Se=null,$e=null)}return Se===null||$e===null?null:[Se,$e]},[t,s,n,a,c,h]),J=Zs(),$=J.showTooltipAt,X=J.showTooltipFromEvent,Z=J.hideTooltip,V=v.useMemo(function(){if(M)return L==="cursor"?function(le,pe){X(M(le),pe,F)}:function(le){var pe=a(le),_e=pe[0],re=pe[1];$(M(le),[_e+c.left,re+c.top],F)}},[$,X,M,L,F,a,c]),te=v.useCallback(function(le){var pe=K(le);if(j(pe),i==null||i(pe?pe[1]:null),pe){var _e=pe[1];V==null||V(_e,le),g==null||g(pe[1],le)}},[K,j,i,V,g]),ae=v.useCallback(function(le){var pe=K(le);if(j(pe),pe){var _e=pe[0],re=pe[1];if(i==null||i(re),V==null||V(re,le),G.current){var Se=G.current,$e=Se[0],qe=Se[1];_e!==$e?y==null||y(qe,le):T==null||T(re,le)}else g==null||g(re,le)}else i==null||i(null),Z==null||Z(),G.current&&(y==null||y(G.current[1],le))},[K,j,i,G,g,T,y,V,Z]),ne=v.useCallback(function(le){j(null),i==null||i(null),Z(),y&&G.current&&y(G.current[1],le)},[j,i,G,Z,y]),ce=v.useCallback(function(le){var pe=K(le);j(pe),pe&&(b==null||b(pe[1],le))},[K,j,b]),ie=v.useCallback(function(le){var pe=K(le);j(pe),pe&&(x==null||x(pe[1],le))},[K,j,x]),W=v.useCallback(function(le){var pe=K(le);j(pe),pe&&(R==null||R(pe[1],le))},[K,j,R]),Q=v.useCallback(function(le){var pe=K(le);j(pe),pe&&(A==null||A(pe[1],le))},[K,j,A]),se=v.useCallback(function(le){var pe=K(le);D&&(j(pe),i==null||i(pe?pe[1]:null)),pe&&(w==null||w(pe[1],le))},[K,j,i,D,w]),z=v.useCallback(function(le){var pe=K(le);D&&(j(pe),i==null||i(pe?pe[1]:null)),pe&&(_==null||_(pe[1],le))},[K,j,i,D,_]),xe=v.useCallback(function(le){D&&(j(null),i==null||i(null)),N&&G.current&&N(G.current[1],le)},[D,j,i,N,G]);return{current:B,handleMouseEnter:p?te:void 0,handleMouseMove:p?ae:void 0,handleMouseLeave:p?ne:void 0,handleMouseDown:p?ce:void 0,handleMouseUp:p?ie:void 0,handleClick:p?W:void 0,handleDoubleClick:p?Q:void 0,handleTouchStart:p?se:void 0,handleTouchMove:p?z:void 0,handleTouchEnd:p?xe:void 0}},AHe=["theme"],RHe=function(e){var t=e.data,n=e.width,r=e.height,a=e.margin,s=e.layers,i=s===void 0?ms.layers:s,l=e.xDomain,c=l===void 0?ms.xDomain:l,u=e.yDomain,h=u===void 0?ms.yDomain:u,m=e.enableLinks,p=m===void 0?ms.enableLinks:m,g=e.linkLineWidth,T=g===void 0?ms.linkLineWidth:g,y=e.linkLineColor,b=y===void 0?ms.linkLineColor:y,x=e.enableCells,R=x===void 0?ms.enableCells:x,A=e.cellLineWidth,w=A===void 0?ms.cellLineWidth:A,_=e.cellLineColor,N=_===void 0?ms.cellLineColor:_,I=e.enablePoints,D=I===void 0?ms.enableCells:I,M=e.pointSize,O=M===void 0?ms.pointSize:M,L=e.pointColor,k=L===void 0?ms.pointColor:L,F=e.role,U=F===void 0?ms.role:F,B=e.forwardedRef,j=zo(n,r,a),G=j.outerWidth,K=j.outerHeight,J=j.margin,$=j.innerWidth,X=j.innerHeight,Z=SHe({data:t,width:$,height:X,xDomain:c,yDomain:h}),V=Z.points,te=Z.delaunay,ae=Z.voronoi,ne={links:null,cells:null,points:null,bounds:null};p&&i.includes("links")&&(ne.links=o.jsx("path",{stroke:b,strokeWidth:T,fill:"none",d:te.render()},"links")),R&&i.includes("cells")&&(ne.cells=o.jsx("path",{d:ae.render(),fill:"none",stroke:N,strokeWidth:w},"cells")),D&&i.includes("points")&&(ne.points=o.jsx("path",{stroke:"none",fill:k,d:te.renderPoints(void 0,O/2)},"points")),i.includes("bounds")&&(ne.bounds=o.jsx("path",{fill:"none",stroke:N,strokeWidth:w,d:ae.renderBounds()},"bounds"));var ce=bHe({points:V,delaunay:te,voronoi:ae});return o.jsx(Vg,{width:G,height:K,margin:J,role:U,ref:B,children:i.map(function(ie,W){return ne[ie]!==void 0?ne[ie]:typeof ie=="function"?o.jsx(v.Fragment,{children:v.createElement(ie,ce)},W):null})})},NHe=v.forwardRef(function(e,t){var n=e.theme,r=RZ(e,AHe);return o.jsx(Vo,{isInteractive:!1,animate:!1,theme:n,children:o.jsx(RHe,A0({},r,{forwardedRef:t}))})}),_He=["defaultWidth","defaultHeight","onResize","debounceResize"];v.forwardRef(function(e,t){var n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=RZ(e,_He);return o.jsx(Go,{defaultWidth:n,defaultHeight:r,onResize:a,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(NHe,A0({},i,{width:c,height:u,ref:t}))}})});var wZ=function(e){var t=e.nodes,n=e.width,r=e.height,a=e.margin,s=a===void 0?Xg:a,i=e.getNodePosition,l=e.setCurrent,c=e.onMouseEnter,u=e.onMouseMove,h=e.onMouseLeave,m=e.onMouseDown,p=e.onMouseUp,g=e.onClick,T=e.onDoubleClick,y=e.onTouchStart,b=e.onTouchMove,x=e.onTouchEnd,R=e.enableTouchCrosshair,A=R!==void 0&&R,w=e.detectionRadius,_=w===void 0?1/0:w,N=e.tooltip,I=e.tooltipPosition,D=I===void 0?NZ:I,M=e.tooltipAnchor,O=M===void 0?_Z:M,L=e.debug,k=v.useRef(null),F=rP({points:t,getNodePosition:i,width:n,height:r,margin:s,debug:L}),U=F.delaunay,B=F.voronoi,j=vHe({elementRef:k,nodes:t,delaunay:U,margin:s,detectionRadius:_,setCurrent:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:h,onMouseDown:m,onMouseUp:p,onClick:g,onDoubleClick:T,onTouchStart:y,onTouchMove:b,onTouchEnd:x,enableTouchCrosshair:A,tooltip:N,tooltipPosition:D,tooltipAnchor:O}),G=j.current,K=j.handleMouseEnter,J=j.handleMouseMove,$=j.handleMouseLeave,X=j.handleMouseDown,Z=j.handleMouseUp,V=j.handleClick,te=j.handleDoubleClick,ae=j.handleTouchStart,ne=j.handleTouchMove,ce=j.handleTouchEnd,ie=v.useMemo(function(){if(L&&B)return B.render()},[L,B]);return o.jsxs("g",{ref:k,transform:"translate("+-s.left+","+-s.top+")",children:[L&&B&&o.jsxs(o.Fragment,{children:[o.jsx("path",{d:ie,stroke:"red",strokeWidth:1,opacity:.75}),_<1/0&&o.jsx("path",{stroke:"red",strokeWidth:.35,fill:"none",d:U.renderPoints(void 0,_)}),G&&o.jsx("path",{fill:"pink",opacity:.35,d:B.renderCell(G[0])})]}),o.jsx("rect",{"data-ref":"mesh-interceptor",width:s.left+n+s.right,height:s.top+r+s.bottom,fill:"red",opacity:0,style:{cursor:"auto"},onMouseEnter:K,onMouseMove:J,onMouseLeave:$,onMouseDown:X,onMouseUp:Z,onTouchStart:ae,onTouchMove:ne,onTouchEnd:ce,onClick:V,onDoubleClick:te})]})},CZ=function(e,t){e.save(),e.globalAlpha=.75,e.beginPath(),t.render(e),e.strokeStyle="red",e.lineWidth=1,e.stroke(),e.restore()},IZ=function(e,t,n){e.save(),e.globalAlpha=.35,e.beginPath(),t.renderCell(n,e),e.fillStyle="pink",e.fill(),e.restore()};function Da(){return Da=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Da.apply(null,arguments)}function AS(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Rz,No={xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},curve:"linear",colors:{scheme:"nivo"},lineWidth:2,layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],enablePoints:!0,pointSize:6,pointColor:{from:"series.color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,enableGridX:!0,enableGridY:!0,legends:[],isInteractive:!0,tooltip:v.memo(function(e){var t=e.point;return o.jsx(Tx,{id:o.jsxs("span",{children:["x: ",o.jsx("strong",{children:t.data.xFormatted}),", y:"," ",o.jsx("strong",{children:t.data.yFormatted})]}),enableChip:!0,color:t.seriesColor})}),sliceTooltip:v.memo(function(e){var t=e.slice,n=e.axis,r=_n(),a=n==="x"?"y":"x";return o.jsx(U9,{rows:t.points.map(function(s){return[o.jsx(j9,{color:s.seriesColor,style:r.tooltip.chip},"chip"),s.seriesId,o.jsx("span",{style:r.tooltip.tableCellValue,children:s.data[a+"Formatted"]},"value")]})})}),debugMesh:!1,renderWrapper:!0},Qt=Da({},No,{defs:[],fill:[],enablePointLabel:!1,pointLabel:"data.yFormatted",areaBlendMode:"normal",axisTop:null,axisRight:null,axisBottom:ns,axisLeft:ns,useMesh:!1,enableSlices:!1,debugSlices:!1,enableCrosshair:!0,crosshairType:"bottom-left",enableTouchCrosshair:!1,initialHiddenIds:[],animate:!0,motionConfig:"gentle",role:"img",isFocusable:!1}),mr=Da({},No,{pixelRatio:typeof window!="undefined"&&(Rz=window.devicePixelRatio)!=null?Rz:1,axisTop:null,axisRight:null,axisBottom:ns,axisLeft:ns});function wHe(e){return v.useMemo(function(){return DM().defined(function(t){return t.x!==null&&t.y!==null}).x(function(t){return t.x}).y(function(t){return t.y}).curve(eK(e))},[e])}function CHe(e){var t=e.curve,n=e.yScale,r=e.areaBaselineValue;return v.useMemo(function(){return iSe().defined(function(a){return a.x!==null&&a.y!==null}).x(function(a){return a.x}).y1(function(a){return a.y}).curve(eK(t)).y0(n(r))},[t,n,r])}var IHe=function(e){var t=e.componentId,n=e.enableSlices,r=e.points,a=e.width,s=e.height;return v.useMemo(function(){if(n==="x"){var i=new Map;return r.forEach(function(c){c.data.x!==null&&c.data.y!==null&&(i.has(c.x)?i.get(c.x).push(c):i.set(c.x,[c]))}),Array.from(i.entries()).sort(function(c,u){return c[0]-u[0]}).map(function(c,u,h){var m,p,g=c[0],T=c[1],y=h[u-1],b=h[u+1];return m=y?g-(g-y[0])/2:g,p=b?g-m+(b[0]-g)/2:a-m,{id:"slice:"+t+":"+g,x0:m,x:g,y0:0,y:0,width:p,height:s,points:T.reverse()}})}if(n==="y"){var l=new Map;return r.forEach(function(c){c.data.x!==null&&c.data.y!==null&&(l.has(c.y)?l.get(c.y).push(c):l.set(c.y,[c]))}),Array.from(l.entries()).sort(function(c,u){return c[0]-u[0]}).map(function(c,u,h){var m,p,g=c[0],T=c[1],y=h[u-1],b=h[u+1];return m=y?g-(g-y[0])/2:g,p=b?g-m+(b[0]-g)/2:s-m,{id:g,x0:0,x:0,y0:m,y:g,width:a,height:p,points:T.reverse()}})}return[]},[t,n,s,r,a])},OHe="line",OZ=function(e){var t=e.data,n=e.xScale,r=n===void 0?No.xScale:n,a=e.xFormat,s=e.yScale,i=s===void 0?No.yScale:s,l=e.yFormat,c=e.width,u=e.height,h=e.colors,m=h===void 0?No.colors:h,p=e.curve,g=p===void 0?No.curve:p,T=e.areaBaselineValue,y=T===void 0?No.areaBaselineValue:T,b=e.pointColor,x=b===void 0?No.pointColor:b,R=e.pointBorderColor,A=R===void 0?No.pointBorderColor:R,w=e.enableSlices,_=w===void 0?Qt.enableSlices:w,N=e.initialHiddenIds,I=N===void 0?Qt.initialHiddenIds:N,D=v.useState(JBe(OHe))[0],M=ql(a),O=ql(l),L=iS(m,"id"),k=_n(),F=Ks(x,k),U=Ks(A,k),B=v.useState(I!=null?I:[]),j=B[0],G=B[1],K=v.useMemo(function(){return BK(t.filter(function(ie){return j.indexOf(ie.id)===-1}),r,i,c,u)},[t,j,r,i,c,u]),J=K.xScale,$=K.yScale,X=K.series,Z=v.useMemo(function(){var ie=t.map(function(Q){return{id:Q.id,label:""+Q.id,color:L(Q)}}),W=ie.map(function(Q){return Da({},X.find(function(se){return se.id===Q.id}),{color:Q.color})}).filter(function(Q){return!!Q.id});return{legendData:ie.map(function(Q){return Da({},Q,{hidden:!W.find(function(se){return se.id===Q.id})})}).reverse(),series:W}},[t,X,L]),V=Z.legendData,te=Z.series,ae=v.useCallback(function(ie){G(function(W){return W.indexOf(ie)>-1?W.filter(function(Q){return Q!==ie}):[].concat(W,[ie])})},[]),ne=function(ie){var W=ie.series,Q=ie.getPointColor,se=ie.getPointBorderColor,z=ie.formatX,xe=ie.formatY;return v.useMemo(function(){return W.reduce(function(le,pe,_e){return[].concat(le,pe.data.filter(function(re){return re.position.x!==null&&re.position.y!==null}).map(function(re,Se){var $e={id:pe.id+"."+Se,indexInSeries:Se,absIndex:le.length+Se,seriesIndex:_e,seriesId:pe.id,seriesColor:pe.color,x:re.position.x,y:re.position.y,data:Da({},re.data,{xFormatted:z(re.data.x),yFormatted:xe(re.data.y)})};return $e.color=Q({series:pe,point:$e}),$e.borderColor=se($e),$e}))},[])},[W,Q,se,z,xe])}({series:te,getPointColor:F,getPointBorderColor:U,formatX:M,formatY:O}),ce=IHe({componentId:D,enableSlices:_,points:ne,width:c,height:u});return{legendData:V,toggleSeries:ae,lineGenerator:wHe(g),areaGenerator:CHe({curve:g,yScale:$,areaBaselineValue:y}),getColor:L,series:te,xScale:J,yScale:$,slices:ce,points:ne}},LHe=function(e){var t=e.areaBlendMode,n=e.areaOpacity,r=e.color,a=e.fill,s=e.path,i=Pa(),l=i.animate,c=i.config,u=cD(s),h=Ji({color:r,config:c,immediate:!l});return o.jsx(Vn.path,{d:u,fill:a||h.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:t}})},MHe=v.memo(function(e){var t=e.areaGenerator,n=e.areaOpacity,r=e.areaBlendMode,a=e.series.slice(0).reverse();return o.jsx("g",{children:a.map(function(s){return o.jsx(LHe,Da({path:t(s.data.map(function(i){return i.position}))},Da({areaOpacity:n,areaBlendMode:r},s)),""+s.id)})})}),DHe=v.memo(function(e){var t=e.lineGenerator,n=e.points,r=e.color,a=e.thickness,s=v.useMemo(function(){return t(n)},[t,n]),i=cD(s);return o.jsx(Vn.path,{d:i,fill:"none",strokeWidth:a,stroke:r})}),PHe=v.memo(function(e){var t=e.series,n=e.lineGenerator,r=e.lineWidth;return o.jsx(o.Fragment,{children:t.slice(0).reverse().map(function(a){var s=a.id,i=a.data,l=a.color;return o.jsx(DHe,{points:i.map(function(c){return c.position}),lineGenerator:n,color:l,thickness:r},s)})})}),kHe=v.memo(function(e){var t=e.slice,n=e.slices,r=e.axis,a=e.debug,s=e.tooltip,i=e.isCurrent,l=e.setCurrent,c=e.onMouseEnter,u=e.onMouseMove,h=e.onMouseLeave,m=e.onMouseDown,p=e.onMouseUp,g=e.onClick,T=e.onDoubleClick,y=e.onTouchStart,b=e.onTouchMove,x=e.onTouchEnd,R=Zs(),A=R.showTooltipFromEvent,w=R.hideTooltip,_=v.useCallback(function(B){A(v.createElement(s,{slice:t,axis:r}),B,"right"),l(t),c==null||c(t,B)},[A,s,t,r,l,c]),N=v.useCallback(function(B){A(v.createElement(s,{slice:t,axis:r}),B,"right"),u==null||u(t,B)},[A,s,t,r,u]),I=v.useCallback(function(B){w(),l(null),h==null||h(t,B)},[w,l,h,t]),D=v.useCallback(function(B){m==null||m(t,B)},[t,m]),M=v.useCallback(function(B){p==null||p(t,B)},[t,p]),O=v.useCallback(function(B){g==null||g(t,B)},[t,g]),L=v.useCallback(function(B){T==null||T(t,B)},[t,T]),k=v.useCallback(function(B){A(v.createElement(s,{slice:t,axis:r}),B,"right"),l(t),y==null||y(t,B)},[r,y,l,A,t,s]),F=v.useCallback(function(B){var j=B.touches[0],G=document.elementFromPoint(j.clientX,j.clientY),K=G==null?void 0:G.getAttribute("data-ref");if(K){var J=n.find(function($){return $.id===K});J&&(A(v.createElement(s,{slice:J,axis:r}),B,"right"),l(J))}b==null||b(t,B)},[r,b,l,A,t,n,s]),U=v.useCallback(function(B){w(),l(null),x==null||x(t,B)},[w,l,x,t]);return o.jsx("rect",{x:t.x0,y:t.y0,width:t.width,height:t.height,stroke:"red",strokeWidth:a?1:0,strokeOpacity:.75,fill:"red",fillOpacity:i&&a?.35:0,onMouseEnter:_,onMouseMove:N,onMouseLeave:I,onMouseDown:D,onMouseUp:M,onClick:O,onDoubleClick:L,onTouchStart:k,onTouchMove:F,onTouchEnd:U,"data-ref":t.id})}),jHe=v.memo(function(e){var t=e.slices,n=e.axis,r=e.debug,a=e.tooltip,s=e.current,i=e.setCurrent,l=e.onMouseEnter,c=e.onMouseMove,u=e.onMouseLeave,h=e.onMouseDown,m=e.onMouseUp,p=e.onClick,g=e.onDoubleClick,T=e.onTouchStart,y=e.onTouchMove,b=e.onTouchEnd;return o.jsx(o.Fragment,{children:t.map(function(x){return o.jsx(kHe,{slice:x,slices:t,axis:n,debug:r,tooltip:a,setCurrent:i,isCurrent:s!==null&&s.id===x.id,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onMouseDown:h,onMouseUp:m,onClick:p,onDoubleClick:g,onTouchStart:T,onTouchMove:y,onTouchEnd:b},x.id)})})}),UHe=v.memo(function(e){var t=e.points,n=e.symbol,r=e.size,a=e.borderWidth,s=e.enableLabel,i=e.label,l=e.labelYOffset,c=e.isFocusable,u=e.setCurrentPoint,h=e.tooltip,m=e.margin,p=e.ariaLabel,g=e.ariaLabelledBy,T=e.ariaDescribedBy,y=e.ariaHidden,b=e.ariaDisabled,x=jNe(i),R=Zs(),A=R.showTooltipAt,w=R.hideTooltip,_=t.slice(0).sort(function(N,I){return N.indexInSeries-I.indexInSeries}).sort(function(N,I){return I.seriesIndex-N.seriesIndex}).map(function(N){return{id:N.id,x:N.x,y:N.y,datum:N.data,fill:N.color,stroke:N.borderColor,label:s?x(N):null,ariaLabel:p?p(N):void 0,ariaLabelledBy:g?g(N):void 0,ariaDescribedBy:T?T(N):void 0,ariaHidden:y?y(N):void 0,ariaDisabled:b?b(N):void 0,onFocus:c?function(){u(N),A(v.createElement(h,{point:N}),[m.left+N.x,m.top+N.y],"top")}:void 0,onBlur:c?function(){u(null),w()}:void 0}});return o.jsx("g",{children:_.map(function(N){return o.jsx(MNe,{x:N.x,y:N.y,datum:N.datum,symbol:n,size:r,color:N.fill,borderWidth:a,borderColor:N.stroke,label:N.label,labelYOffset:l,ariaLabel:N.ariaLabel,ariaLabelledBy:N.ariaLabelledBy,ariaDescribedBy:N.ariaDescribedBy,ariaHidden:N.ariaHidden,ariaDisabled:N.ariaDisabled,isFocusable:c,onFocus:N.onFocus,onBlur:N.onBlur,testId:"line.point."+N.id},N.id)})})}),FHe=v.memo(function(e){var t=e.points,n=e.width,r=e.height,a=e.margin,s=e.setCurrent,i=e.onMouseEnter,l=e.onMouseMove,c=e.onMouseLeave,u=e.onMouseDown,h=e.onMouseUp,m=e.onClick,p=e.onDoubleClick,g=e.onTouchStart,T=e.onTouchMove,y=e.onTouchEnd,b=e.tooltip,x=e.debug,R=e.enableTouchCrosshair,A=Zs(),w=A.showTooltipAt,_=A.hideTooltip,N=v.useCallback(function(j,G){w(v.createElement(b,{point:j}),[j.x+a.left,j.y+a.top],"top"),i==null||i(j,G)},[w,b,i,a]),I=v.useCallback(function(j,G){w(v.createElement(b,{point:j}),[j.x+a.left,j.y+a.top],"top"),l==null||l(j,G)},[w,b,a.left,a.top,l]),D=v.useCallback(function(j,G){_(),c==null||c(j,G)},[_,c]),M=v.useCallback(function(j,G){u==null||u(j,G)},[u]),O=v.useCallback(function(j,G){h==null||h(j,G)},[h]),L=v.useCallback(function(j,G){m==null||m(j,G)},[m]),k=v.useCallback(function(j,G){p==null||p(j,G)},[p]),F=v.useCallback(function(j,G){w(v.createElement(b,{point:j}),[j.x+a.left,j.y+a.top],"top"),g==null||g(j,G)},[a.left,a.top,g,w,b]),U=v.useCallback(function(j,G){w(v.createElement(b,{point:j}),[j.x+a.left,j.y+a.top],"top"),T==null||T(j,G)},[a.left,a.top,T,w,b]),B=v.useCallback(function(j,G){_(),y==null||y(j,G)},[y,_]);return o.jsx(wZ,{nodes:t,width:n,height:r,setCurrent:s,onMouseEnter:N,onMouseMove:I,onMouseLeave:D,onMouseDown:M,onMouseUp:O,onClick:L,onDoubleClick:k,onTouchStart:F,onTouchMove:U,onTouchEnd:B,enableTouchCrosshair:R,debug:x})}),$He=["isInteractive","animate","motionConfig","theme","renderWrapper"];function BHe(e){var t=e.data,n=e.xScale,r=n===void 0?Qt.xScale:n,a=e.xFormat,s=e.yScale,i=s===void 0?Qt.yScale:s,l=e.yFormat,c=e.curve,u=c===void 0?Qt.curve:c,h=e.margin,m=e.width,p=e.height,g=e.colors,T=g===void 0?Qt.colors:g,y=e.lineWidth,b=y===void 0?Qt.lineWidth:y,x=e.layers,R=x===void 0?Qt.layers:x,A=e.enableArea,w=A===void 0?Qt.enableArea:A,_=e.areaBaselineValue,N=_===void 0?Qt.areaBaselineValue:_,I=e.areaOpacity,D=I===void 0?Qt.areaOpacity:I,M=e.areaBlendMode,O=M===void 0?Qt.areaBlendMode:M,L=e.enablePoints,k=L===void 0?Qt.enablePoints:L,F=e.pointSymbol,U=e.pointSize,B=U===void 0?Qt.pointSize:U,j=e.pointColor,G=j===void 0?Qt.pointColor:j,K=e.pointBorderWidth,J=K===void 0?Qt.pointBorderWidth:K,$=e.pointBorderColor,X=$===void 0?Qt.pointBorderColor:$,Z=e.enablePointLabel,V=Z===void 0?Qt.enablePointLabel:Z,te=e.pointLabel,ae=te===void 0?Qt.pointLabel:te,ne=e.pointLabelYOffset,ce=e.enableGridX,ie=ce===void 0?Qt.enableGridX:ce,W=e.gridXValues,Q=e.enableGridY,se=Q===void 0?Qt.enableGridY:Q,z=e.gridYValues,xe=e.axisTop,le=e.axisRight,pe=e.axisBottom,_e=pe===void 0?Qt.axisBottom:pe,re=e.axisLeft,Se=re===void 0?Qt.axisLeft:re,$e=e.defs,qe=$e===void 0?Qt.defs:$e,Je=e.fill,lt=Je===void 0?Qt.fill:Je,at=e.markers,ot=e.legends,st=ot===void 0?Qt.legends:ot,oe=e.isInteractive,ue=oe===void 0?Qt.isInteractive:oe,Ee=e.useMesh,Le=Ee===void 0?Qt.useMesh:Ee,ke=e.debugMesh,Ge=ke===void 0?Qt.debugMesh:ke,tt=e.onMouseEnter,ct=e.onMouseMove,Te=e.onMouseLeave,Oe=e.onMouseDown,de=e.onMouseUp,Ae=e.onClick,we=e.onDoubleClick,Ie=e.onTouchStart,Ke=e.onTouchMove,it=e.onTouchEnd,De=e.tooltip,nt=De===void 0?Qt.tooltip:De,Pt=e.enableSlices,pt=Pt===void 0?Qt.enableSlices:Pt,Bt=e.debugSlices,un=Bt===void 0?Qt.debugSlices:Bt,_t=e.sliceTooltip,et=_t===void 0?Qt.sliceTooltip:_t,We=e.enableCrosshair,yt=We===void 0?Qt.enableCrosshair:We,Yt=e.crosshairType,tn=Yt===void 0?Qt.crosshairType:Yt,In=e.enableTouchCrosshair,ga=In===void 0?Qt.enableTouchCrosshair:In,Ur=e.role,Pn=Ur===void 0?Qt.role:Ur,dr=e.ariaLabel,kn=e.ariaLabelledBy,dt=e.ariaDescribedBy,kt=e.isFocusable,jn=kt===void 0?Qt.isFocusable:kt,Gn=e.pointAriaLabel,Wt=e.pointAriaLabelledBy,wt=e.pointAriaDescribedBy,Ct=e.pointAriaHidden,Vt=e.pointAriaDisabled,On=e.initialHiddenIds,gn=On===void 0?Qt.initialHiddenIds:On,zt=e.forwardedRef,pn=zo(m,p,h),ei=pn.margin,or=pn.innerWidth,Ar=pn.innerHeight,hr=pn.outerWidth,ro=pn.outerHeight,zn=OZ({data:t,xScale:r,xFormat:a,yScale:i,yFormat:l,width:or,height:Ar,colors:T,curve:u,areaBaselineValue:N,pointColor:G,pointBorderColor:X,enableSlices:pt,initialHiddenIds:gn}),As=zn.legendData,Tt=zn.toggleSeries,Rs=zn.lineGenerator,sc=zn.areaGenerator,ic=zn.series,sa=zn.xScale,oc=zn.yScale,Qg=zn.slices,Wo=zn.points,mf=v.useState(null),ao=mf[0],pf=mf[1],Ua=v.useState(null),so=Ua[0],gf=Ua[1],Ea={grid:null,markers:null,axes:null,areas:null,crosshair:null,lines:null,points:null,slices:null,mesh:null,legends:null};R.includes("grid")&&(ie||se)&&(Ea.grid=o.jsx(bD,{width:or,height:Ar,xScale:ie?sa:null,yScale:se?oc:null,xValues:W,yValues:z},"grid")),R.includes("markers")&&Array.isArray(at)&&at.length>0&&(Ea.markers=o.jsx(lD,{markers:at,width:or,height:Ar,xScale:sa,yScale:oc},"markers")),R.includes("axes")&&(Ea.axes=o.jsx(SD,{xScale:sa,yScale:oc,width:or,height:Ar,top:xe,right:le,bottom:_e,left:Se},"axes")),R.includes("lines")&&(Ea.lines=o.jsx(PHe,{series:ic,lineGenerator:Rs,lineWidth:b},"lines")),R.includes("legends")&&st.length>0&&(Ea.legends=o.jsx(v.Fragment,{children:st.map(function(Si,bi){return o.jsx(oS,Da({},Si,{containerWidth:or,containerHeight:Ar,data:Si.data||As,toggleSerie:Si.toggleSerie?Tt:void 0}),bi)})},"legends"));var Xo=hD(qe,ic,lt);w&&(Ea.areas=o.jsx(MHe,{areaGenerator:sc,areaOpacity:D,areaBlendMode:O,series:ic},"areas")),ue&&pt!==!1&&(Ea.slices=o.jsx(jHe,{slices:Qg,axis:pt,debug:un,tooltip:et,current:so,setCurrent:gf,onMouseEnter:tt,onMouseMove:ct,onMouseLeave:Te,onMouseDown:Oe,onMouseUp:de,onClick:Ae,onDoubleClick:we,onTouchStart:Ie,onTouchMove:Ke,onTouchEnd:it},"slices")),k&&(Ea.points=o.jsx(UHe,{points:Wo,symbol:F,size:B,borderWidth:J,enableLabel:V,label:ae,labelYOffset:ne,isFocusable:jn,setCurrentPoint:pf,tooltip:nt,margin:ei,ariaLabel:Gn,ariaLabelledBy:Wt,ariaDescribedBy:wt,ariaHidden:Ct,ariaDisabled:Vt},"points")),ue&&yt&&(ao!==null&&(Ea.crosshair=o.jsx(FO,{width:or,height:Ar,x:ao.x,y:ao.y,type:tn},"crosshair")),so!==null&&pt&&(Ea.crosshair=o.jsx(FO,{width:or,height:Ar,x:so.x,y:so.y,type:pt},"crosshair"))),ue&&Le&&pt===!1&&(Ea.mesh=o.jsx(FHe,{points:Wo,width:or,height:Ar,margin:ei,setCurrent:pf,onMouseEnter:tt,onMouseMove:ct,onMouseLeave:Te,onMouseDown:Oe,onMouseUp:de,onClick:Ae,onDoubleClick:we,onTouchStart:Ie,onTouchMove:Ke,onTouchEnd:it,tooltip:nt,enableTouchCrosshair:ga,debug:Ge},"mesh"));var Jg=Da({},e,{innerWidth:or,innerHeight:Ar,series:ic,slices:Qg,points:Wo,xScale:sa,yScale:oc,lineGenerator:Rs,areaGenerator:sc,currentPoint:ao,setCurrentPoint:pf,currentSlice:so,setCurrentSlice:gf});return o.jsx(Vg,{defs:Xo,width:hr,height:ro,margin:ei,role:Pn,ariaLabel:dr,ariaLabelledBy:kn,ariaDescribedBy:dt,isFocusable:jn,ref:zt,children:R.map(function(Si,bi){return typeof Si=="function"?o.jsx(v.Fragment,{children:Si(Jg)},bi):Ea[Si]})})}var HHe=v.forwardRef(function(e,t){var n=e.isInteractive,r=n===void 0?Qt.isInteractive:n,a=e.animate,s=a===void 0?Qt.animate:a,i=e.motionConfig,l=i===void 0?Qt.motionConfig:i,c=e.theme,u=e.renderWrapper,h=AS(e,$He);return o.jsx(Vo,{animate:s,isInteractive:r,motionConfig:l,renderWrapper:u,theme:c,children:o.jsx(BHe,Da({isInteractive:r},h,{forwardedRef:t}))})}),VHe=["defaultWidth","defaultHeight","onResize","debounceResize"],GHe=v.forwardRef(function(e,t){var n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=AS(e,VHe);return o.jsx(Go,{defaultWidth:n,defaultHeight:r,onResize:a,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(HHe,Da({width:c,height:u},i,{ref:t}))}})}),zHe=["isInteractive","renderWrapper","theme"],qHe=function(e){var t=e.width,n=e.height,r=e.margin,a=e.pixelRatio,s=a===void 0?mr.pixelRatio:a,i=e.data,l=e.xScale,c=l===void 0?mr.xScale:l,u=e.xFormat,h=e.yScale,m=h===void 0?mr.yScale:h,p=e.yFormat,g=e.curve,T=g===void 0?mr.curve:g,y=e.layers,b=y===void 0?mr.layers:y,x=e.colors,R=x===void 0?mr.colors:x,A=e.lineWidth,w=A===void 0?mr.lineWidth:A,_=e.enableArea,N=_===void 0?mr.enableArea:_,I=e.areaBaselineValue,D=I===void 0?mr.areaBaselineValue:I,M=e.areaOpacity,O=M===void 0?mr.areaOpacity:M,L=e.enablePoints,k=L===void 0?mr.enablePoints:L,F=e.pointSize,U=F===void 0?mr.pointSize:F,B=e.pointColor,j=B===void 0?mr.pointColor:B,G=e.pointBorderWidth,K=G===void 0?mr.pointBorderWidth:G,J=e.pointBorderColor,$=J===void 0?mr.pointBorderColor:J,X=e.enableGridX,Z=X===void 0?mr.enableGridX:X,V=e.gridXValues,te=e.enableGridY,ae=te===void 0?mr.enableGridY:te,ne=e.gridYValues,ce=e.axisTop,ie=e.axisRight,W=e.axisBottom,Q=W===void 0?mr.axisBottom:W,se=e.axisLeft,z=se===void 0?mr.axisLeft:se,xe=e.legends,le=xe===void 0?mr.legends:xe,pe=e.isInteractive,_e=pe===void 0?mr.isInteractive:pe,re=e.debugMesh,Se=re===void 0?mr.debugMesh:re,$e=e.onMouseLeave,qe=e.onMouseDown,Je=e.onMouseUp,lt=e.onClick,at=e.onDoubleClick,ot=e.tooltip,st=ot===void 0?mr.tooltip:ot,oe=e.role,ue=e.forwardedRef,Ee=v.useRef(null),Le=zo(t,n,r),ke=Le.margin,Ge=Le.innerWidth,tt=Le.innerHeight,ct=Le.outerWidth,Te=Le.outerHeight,Oe=_n(),de=v.useState(null),Ae=de[0],we=de[1],Ie=OZ({data:i,xScale:c,xFormat:u,yScale:m,yFormat:p,width:Ge,height:tt,colors:R,curve:T,areaBaselineValue:D,pointColor:j,pointBorderColor:$}),Ke=Ie.lineGenerator,it=Ie.areaGenerator,De=Ie.series,nt=Ie.xScale,Pt=Ie.yScale,pt=Ie.points,Bt=v.useMemo(function(){return{innerWidth:Ge,innerHeight:tt,series:De,points:pt,xScale:nt,yScale:Pt,lineWidth:w,lineGenerator:Ke,areaGenerator:it,currentPoint:Ae,setCurrentPoint:we}},[Ge,tt,De,pt,nt,Pt,w,Ke,it,Ae,we]),un=rP({points:pt,width:Ge,height:tt,debug:Se}),_t=un.delaunay,et=un.voronoi;v.useEffect(function(){if(Ee.current!==null){Ee.current.width=ct*s,Ee.current.height=Te*s;var dt=Ee.current.getContext("2d");dt.scale(s,s),dt.fillStyle=Oe.background,dt.fillRect(0,0,ct,Te),dt.translate(ke.left,ke.top),b.forEach(function(kt){var jn;typeof kt=="function"&&kt(dt,Bt);var Gn=(jn=Oe.grid.line.strokeWidth)!=null?jn:0;if(kt==="grid"&&typeof Gn!="string"&&Gn>0&&(dt.lineWidth=Gn,dt.strokeStyle=Oe.grid.line.stroke,Z&&Bh(dt,{width:Ge,height:tt,scale:nt,axis:"x",values:V}),ae&&Bh(dt,{width:Ge,height:tt,scale:Pt,axis:"y",values:ne})),kt==="axes"&&vD(dt,{xScale:nt,yScale:Pt,width:Ge,height:tt,top:ce,right:ie,bottom:Q,left:z,theme:Oe}),kt==="areas"&&N===!0){dt.save(),dt.globalAlpha=O,it.context(dt);for(var Wt=De.length-1;Wt>=0;Wt--)dt.fillStyle=De[Wt].color,dt.beginPath(),it(De[Wt].data.map(function(Ct){return Ct.position})),dt.fill();dt.restore()}if(kt==="lines"&&(Ke.context(dt),De.forEach(function(Ct){dt.strokeStyle=Ct.color,dt.lineWidth=w,dt.beginPath(),Ke(Ct.data.map(function(Vt){return Vt.position})),dt.stroke()})),kt==="points"&&k===!0&&U>0&&pt.forEach(function(Ct){dt.fillStyle=Ct.color,dt.beginPath(),dt.arc(Ct.x,Ct.y,U/2,0,2*Math.PI),dt.fill(),K>0&&(dt.strokeStyle=Ct.borderColor,dt.lineWidth=K,dt.stroke())}),kt==="mesh"&&Se===!0&&et!==void 0&&(CZ(dt,et),Ae&&IZ(dt,et,Ae.absIndex)),kt==="legends"){var wt=De.map(function(Ct){return{id:Ct.id,label:Ct.id,color:Ct.color}}).reverse();le.forEach(function(Ct){lS(dt,Da({},Ct,{data:Ct.data||wt,containerWidth:Ge,containerHeight:tt,theme:Oe}))})}})}},[Ee,Ge,ct,tt,Te,ke.left,ke.top,s,b,Oe,Ke,De,nt,Pt,Z,V,ae,ne,ce,ie,Q,z,le,pt,k,U,K,Ae,Bt,Se,N,it,O,w,et]);var We=v.useCallback(function(dt){if(!Ee.current)return null;var kt=ou(Ee.current,dt),jn=kt[0],Gn=kt[1];if(!dD(ke.left,ke.top,Ge,tt,jn,Gn))return null;var Wt=_t.find(jn-ke.left,Gn-ke.top);return pt[Wt]},[Ee,ke,Ge,tt,_t,pt]),yt=Zs(),Yt=yt.showTooltipFromEvent,tn=yt.hideTooltip,In=v.useCallback(function(dt){var kt=We(dt);we(kt),kt?Yt(v.createElement(st,{point:kt}),dt):tn()},[We,we,Yt,tn,st]),ga=v.useCallback(function(dt){tn(),we(null),Ae&&($e==null||$e(Ae,dt))},[tn,we,$e,Ae]),Ur=v.useCallback(function(dt){if(qe){var kt=We(dt);kt&&qe(kt,dt)}},[We,qe]),Pn=v.useCallback(function(dt){if(Je){var kt=We(dt);kt&&Je(kt,dt)}},[We,Je]),dr=v.useCallback(function(dt){if(lt){var kt=We(dt);kt&&lt(kt,dt)}},[We,lt]),kn=v.useCallback(function(dt){if(at){var kt=We(dt);kt&&at(kt,dt)}},[We,at]);return o.jsx("canvas",{ref:sS(Ee,ue),width:ct*s,height:Te*s,style:{width:ct,height:Te,cursor:_e?"auto":"normal"},onMouseEnter:_e?In:void 0,onMouseMove:_e?In:void 0,onMouseLeave:_e?ga:void 0,onMouseDown:_e?Ur:void 0,onMouseUp:_e?Pn:void 0,onClick:_e?dr:void 0,onDoubleClick:_e?kn:void 0,role:oe})},YHe=v.forwardRef(function(e,t){var n=e.isInteractive,r=e.renderWrapper,a=e.theme,s=AS(e,zHe);return o.jsx(Vo,{isInteractive:n,renderWrapper:r,theme:a,animate:!1,children:o.jsx(qHe,Da({},s,{forwardedRef:t}))})}),WHe=["defaultWidth","defaultHeight","onResize","debounceResize"];v.forwardRef(function(e,t){var n=e.defaultWidth;e.defaultHeight;var r=e.onResize,a=e.debounceResize,s=AS(e,WHe);return o.jsx(Go,{defaultWidth:n,defaultHeight:n,onResize:r,debounceResize:a,children:function(i){var l=i.width,c=i.height;return o.jsx(YHe,Da({width:l,height:c},s,{ref:t}))}})});function Rn(){return Rn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rn.apply(null,arguments)}var XHe={pointerEvents:"none"},KHe=function(e){var t=e.label,n=e.style,r=_n();return o.jsx(Vn.g,{transform:n.transform,opacity:n.progress,style:XHe,children:o.jsx(cf,{textAnchor:"middle",dominantBaseline:"central",style:Rn({},r.labels.text,{fill:n.textColor}),children:t})})},LZ=function(e){var t=e%(2*Math.PI);return t<0&&(t+=2*Math.PI),t},MZ=function(e,t){return e.filter(function(n){return Math.abs(Hg(n.arc.endAngle-n.arc.startAngle))>=t})},QHe={startAngle:{enter:function(e){return Rn({},e,{endAngle:e.startAngle})},update:function(e){return e},leave:function(e){return Rn({},e,{startAngle:e.endAngle})}},middleAngle:{enter:function(e){var t=e.startAngle+(e.endAngle-e.startAngle)/2;return Rn({},e,{startAngle:t,endAngle:t})},update:function(e){return e},leave:function(e){var t=e.startAngle+(e.endAngle-e.startAngle)/2;return Rn({},e,{startAngle:t,endAngle:t})}},endAngle:{enter:function(e){return Rn({},e,{startAngle:e.endAngle})},update:function(e){return e},leave:function(e){return Rn({},e,{endAngle:e.startAngle})}},innerRadius:{enter:function(e){return Rn({},e,{outerRadius:e.innerRadius})},update:function(e){return e},leave:function(e){return Rn({},e,{innerRadius:e.outerRadius})}},centerRadius:{enter:function(e){var t=e.innerRadius+(e.outerRadius-e.innerRadius)/2;return Rn({},e,{innerRadius:t,outerRadius:t})},update:function(e){return e},leave:function(e){var t=e.innerRadius+(e.outerRadius-e.innerRadius)/2;return Rn({},e,{innerRadius:t,outerRadius:t})}},outerRadius:{enter:function(e){return Rn({},e,{innerRadius:e.outerRadius})},update:function(e){return e},leave:function(e){return Rn({},e,{outerRadius:e.innerRadius})}},pushIn:{enter:function(e){return Rn({},e,{innerRadius:e.innerRadius-e.outerRadius+e.innerRadius,outerRadius:e.innerRadius})},update:function(e){return e},leave:function(e){return Rn({},e,{innerRadius:e.outerRadius,outerRadius:e.outerRadius+e.outerRadius-e.innerRadius})}},pushOut:{enter:function(e){return Rn({},e,{innerRadius:e.outerRadius,outerRadius:e.outerRadius+e.outerRadius-e.innerRadius})},update:function(e){return e},leave:function(e){return Rn({},e,{innerRadius:e.innerRadius-e.outerRadius+e.innerRadius,outerRadius:e.innerRadius})}}},DZ=function(e,t){return v.useMemo(function(){var n=QHe[e];return{enter:function(r){return Rn({progress:0},n.enter(r.arc),t?t.enter(r):{})},update:function(r){return Rn({progress:1},n.update(r.arc),t?t.update(r):{})},leave:function(r){return Rn({progress:0},n.leave(r.arc),t?t.leave(r):{})}}},[e,t])},PZ=function(e,t){var n=NNe(e)-Math.PI/2,r=e.innerRadius+(e.outerRadius-e.innerRadius)*t;return iu(n,r)},JHe=function(e){return function(t,n,r,a){return Gl([t,n,r,a],function(s,i,l,c){var u=PZ({startAngle:s,endAngle:i,innerRadius:l,outerRadius:c},e);return"translate("+u.x+","+u.y+")"})}},ZHe=function(e,t,n,r){t===void 0&&(t=.5),n===void 0&&(n="innerRadius");var a=Pa(),s=a.animate,i=a.config,l=DZ(n,r);return{transition:tc(e,{keys:function(c){return c.id},initial:l.update,from:l.enter,enter:l.update,update:l.update,leave:l.leave,config:i,immediate:!s}),interpolate:JHe(t)}},eVe=function(e){var t=e.data,n=e.offset,r=n===void 0?.5:n,a=e.skipAngle,s=a===void 0?0:a,i=e.computeExtraProps,l=i===void 0?function(){return{}}:i;return v.useMemo(function(){return MZ(t,s).map(function(c){var u=PZ(c.arc,r);return Rn({},l(c),{x:u.x,y:u.y,data:c})})},[t,r,s,l])},tVe=function(e){var t=e.center,n=e.data,r=e.transitionMode,a=e.label,s=e.radiusOffset,i=e.skipAngle,l=e.skipRadius,c=e.textColor,u=e.component,h=u===void 0?KHe:u,m=Gi(a),p=_n(),g=Ks(c,p),T=v.useMemo(function(){return n.filter(function(A){var w=Math.abs(Hg(A.arc.endAngle-A.arc.startAngle)),_=Math.abs(A.arc.outerRadius-A.arc.innerRadius);return w>=i&&_>=l})},[n,i,l]),y=ZHe(T,s,r),b=y.transition,x=y.interpolate,R=h;return o.jsx("g",{transform:"translate("+t[0]+","+t[1]+")",children:b(function(A,w){return v.createElement(R,{key:w.id,datum:w,label:m(w),style:{progress:A.progress,transform:x(A.startAngle,A.endAngle,A.innerRadius,A.outerRadius),textColor:g(w)}})})})},nVe=function(e,t,n){xu(e,n.labels.text),e.textAlign="center",e.textBaseline="middle",t.forEach(function(r){Su(e,Rn({},n.labels.text,{fill:r.textColor}),String(r.label),r.x,r.y)})},rVe=function(e){var t=e.data,n=e.offset,r=e.skipAngle,a=e.label,s=e.textColor,i=Gi(a),l=_n(),c=Ks(s,l),u=v.useCallback(function(h){return{label:i(h),textColor:c(h)}},[i,c]);return eVe({data:t,offset:n,skipAngle:r,computeExtraProps:u})},aVe=function(e){var t=e.label,n=e.style,r=_n();return o.jsxs(Vn.g,{opacity:n.opacity,children:[o.jsx(Vn.path,{fill:"none",stroke:n.linkColor,strokeWidth:n.thickness,d:n.path}),o.jsx(cf,{transform:n.textPosition,textAnchor:n.textAnchor,dominantBaseline:"central",style:Rn({},r.labels.text,{fill:n.textColor}),children:t})]})},sVe=function(e){var t=LZ(e.startAngle+(e.endAngle-e.startAngle)/2-Math.PI/2);return t<Math.PI/2||t>1.5*Math.PI?"start":"end"},aP=function(e,t,n,r){var a,s,i=LZ(e.startAngle+(e.endAngle-e.startAngle)/2-Math.PI/2),l=iu(i,e.outerRadius+t),c=iu(i,e.outerRadius+t+n);return i<Math.PI/2||i>1.5*Math.PI?(a="after",s={x:c.x+r,y:c.y}):(a="before",s={x:c.x-r,y:c.y}),{side:a,points:[l,c,s]}},iVe=DM().x(function(e){return e.x}).y(function(e){return e.y}),oVe=function(e,t,n,r,a,s,i){return Gl([e,t,n,r,a,s,i],function(l,c,u,h,m,p,g){var T=aP({startAngle:l,endAngle:c,outerRadius:h},m,p,g).points;return iVe(T)})},lVe=function(e,t,n,r){return Gl([e,t,n,r],function(a,s,i,l){return sVe({startAngle:a,endAngle:s})})},cVe=function(e,t,n,r,a,s,i,l){return Gl([e,t,n,r,a,s,i,l],function(c,u,h,m,p,g,T,y){var b=aP({startAngle:c,endAngle:u,outerRadius:m},p,g,T),x=b.points,R=b.side,A=x[2];return R==="before"?A.x-=y:A.x+=y,"translate("+A.x+","+A.y+")"})},uVe=function(e){var t=e.data,n=e.offset,r=n===void 0?0:n,a=e.diagonalLength,s=e.straightLength,i=e.skipAngle,l=i===void 0?0:i,c=e.textOffset,u=e.linkColor,h=e.textColor,m=Pa(),p=m.animate,g=m.config,T=_n(),y=Ks(u,T),b=Ks(h,T),x=function(A,w){return v.useMemo(function(){return MZ(A,w)},[A,w])}(t,l),R=function(A){var w=A.offset,_=A.diagonalLength,N=A.straightLength,I=A.textOffset,D=A.getLinkColor,M=A.getTextColor;return v.useMemo(function(){return{enter:function(O){return{startAngle:O.arc.startAngle,endAngle:O.arc.endAngle,innerRadius:O.arc.innerRadius,outerRadius:O.arc.outerRadius,offset:w,diagonalLength:0,straightLength:0,textOffset:I,linkColor:D(O),textColor:M(O),opacity:0}},update:function(O){return{startAngle:O.arc.startAngle,endAngle:O.arc.endAngle,innerRadius:O.arc.innerRadius,outerRadius:O.arc.outerRadius,offset:w,diagonalLength:_,straightLength:N,textOffset:I,linkColor:D(O),textColor:M(O),opacity:1}},leave:function(O){return{startAngle:O.arc.startAngle,endAngle:O.arc.endAngle,innerRadius:O.arc.innerRadius,outerRadius:O.arc.outerRadius,offset:w,diagonalLength:0,straightLength:0,textOffset:I,linkColor:D(O),textColor:M(O),opacity:0}}}},[_,N,I,D,M,w])}({offset:r,diagonalLength:a,straightLength:s,textOffset:c,getLinkColor:y,getTextColor:b});return{transition:tc(x,{keys:function(A){return A.id},initial:R.update,from:R.enter,enter:R.update,update:R.update,leave:R.leave,config:g,immediate:!p}),interpolateLink:oVe,interpolateTextAnchor:lVe,interpolateTextPosition:cVe}},dVe=function(e){var t=e.center,n=e.data,r=e.label,a=e.skipAngle,s=e.offset,i=e.diagonalLength,l=e.straightLength,c=e.strokeWidth,u=e.textOffset,h=e.textColor,m=e.linkColor,p=e.component,g=p===void 0?aVe:p,T=Gi(r),y=uVe({data:n,skipAngle:a,offset:s,diagonalLength:i,straightLength:l,textOffset:u,linkColor:m,textColor:h}),b=y.transition,x=y.interpolateLink,R=y.interpolateTextAnchor,A=y.interpolateTextPosition,w=g;return o.jsx("g",{transform:"translate("+t[0]+","+t[1]+")",children:b(function(_,N){return v.createElement(w,{key:N.id,datum:N,label:T(N),style:Rn({},_,{thickness:c,path:x(_.startAngle,_.endAngle,_.innerRadius,_.outerRadius,_.offset,_.diagonalLength,_.straightLength),textAnchor:R(_.startAngle,_.endAngle,_.innerRadius,_.outerRadius),textPosition:A(_.startAngle,_.endAngle,_.innerRadius,_.outerRadius,_.offset,_.diagonalLength,_.straightLength,_.textOffset)})})})})},hVe=function(e,t,n,r){e.textBaseline="middle",xu(e,n.labels.text),t.forEach(function(a){e.textAlign=JX.canvas.align[a.textAnchor],Su(e,Rn({},n.labels.text,{fill:a.textColor}),String(a.label),a.x,a.y),e.beginPath(),e.strokeStyle=a.linkColor,e.lineWidth=r,a.points.forEach(function(s,i){i===0?e.moveTo(s.x,s.y):e.lineTo(s.x,s.y)}),e.stroke()})},fVe=function(e){var t=e.data,n=e.skipAngle,r=n===void 0?0:n,a=e.offset,s=a===void 0?.5:a,i=e.diagonalLength,l=e.straightLength,c=e.computeExtraProps,u=c===void 0?function(){return{}}:c,h=v.useMemo(function(){return t.filter(function(m){return Math.abs(Hg(m.arc.endAngle-m.arc.startAngle))>=r}).map(function(m){return Rn({},aP(m.arc,s,i,l),{data:m})})},[t,r,s,i,l]);return v.useMemo(function(){return h.map(function(m){return Rn({},u(m),m)})},[h,u])},mVe=function(e){var t=e.data,n=e.skipAngle,r=e.offset,a=e.diagonalLength,s=e.straightLength,i=e.textOffset,l=i===void 0?0:i,c=e.label,u=e.linkColor,h=e.textColor,m=Gi(c),p=_n(),g=Ks(u,p),T=Ks(h,p),y=v.useCallback(function(b){var x,R={x:b.points[2].x,y:b.points[2].y};return b.side==="before"?(R.x-=l,x="end"):(R.x+=l,x="start"),Rn({},R,{label:m(b.data),linkColor:g(b.data),textAnchor:x,textColor:T(b.data)})},[m,g,T,l]);return fVe({data:t,skipAngle:n,offset:r,diagonalLength:a,straightLength:s,computeExtraProps:y})},pVe=function(e){var t=e.datum,n=e.style,r=e.onClick,a=e.onMouseEnter,s=e.onMouseMove,i=e.onMouseLeave,l=v.useCallback(function(m){return r==null?void 0:r(t,m)},[r,t]),c=v.useCallback(function(m){return a==null?void 0:a(t,m)},[a,t]),u=v.useCallback(function(m){return s==null?void 0:s(t,m)},[s,t]),h=v.useCallback(function(m){return i==null?void 0:i(t,m)},[i,t]);return o.jsx(Vn.path,{d:n.path,opacity:n.opacity,fill:t.fill||n.color,stroke:n.borderColor,strokeWidth:n.borderWidth,onClick:r?l:void 0,onMouseEnter:a?c:void 0,onMouseMove:s?u:void 0,onMouseLeave:i?h:void 0,"data-testid":"arc."+t.id})},gVe=function(e,t,n,r,a){return Gl([e,t,n,r],function(s,i,l,c){return a({startAngle:s,endAngle:i,innerRadius:Math.max(0,l),outerRadius:Math.max(0,c)})})},EVe=function(e,t,n){t===void 0&&(t="innerRadius");var r=Pa(),a=r.animate,s=r.config,i=DZ(t,n);return{transition:tc(e,{keys:function(l){return l.id},initial:i.update,from:i.enter,enter:i.update,update:i.update,leave:i.leave,config:s,immediate:!a}),interpolate:gVe}},TVe=function(e){var t=e.center,n=e.data,r=e.arcGenerator,a=e.borderWidth,s=e.borderColor,i=e.onClick,l=e.onMouseEnter,c=e.onMouseMove,u=e.onMouseLeave,h=e.transitionMode,m=e.component,p=m===void 0?pVe:m,g=_n(),T=Ks(s,g),y=EVe(n,h,{enter:function(A){return{opacity:0,color:A.color,borderColor:T(A)}},update:function(A){return{opacity:1,color:A.color,borderColor:T(A)}},leave:function(A){return{opacity:0,color:A.color,borderColor:T(A)}}}),b=y.transition,x=y.interpolate,R=p;return o.jsx("g",{transform:"translate("+t[0]+","+t[1]+")",children:b(function(A,w){return v.createElement(R,{key:w.id,datum:w,style:Rn({},A,{borderWidth:a,path:x(A.startAngle,A.endAngle,A.innerRadius,A.outerRadius,r)}),onClick:i,onMouseEnter:l,onMouseMove:c,onMouseLeave:u})})})},yVe=function(e,t,n,r,a,s){s===void 0&&(s=!0);var i=[],l=iu(Ws(r),n);i.push([l.x,l.y]);var c=iu(Ws(a),n);i.push([c.x,c.y]);for(var u=Math.round(Math.min(r,a));u<=Math.round(Math.max(r,a));u++)if(u%90==0){var h=iu(Ws(u),n);i.push([h.x,h.y])}i=i.map(function(b){var x=b[0],R=b[1];return[e+x,t+R]}),s&&i.push([e,t]);var m=i.map(function(b){return b[0]}),p=i.map(function(b){return b[1]}),g=Math.min.apply(Math,m),T=Math.max.apply(Math,m),y=Math.min.apply(Math,p);return{points:i,x:g,y,width:T-g,height:Math.max.apply(Math,p)-y}},xVe=function(e,t,n,r,a,s){var i=rK(a,s,e,t);return i<n&&i>r},SVe=function(e,t,n,r,a,s,i){if(xVe(e,t,n,r,s,i)){var l=UNe(s,i,e,t);return a.find(function(c){var u=c.startAngle,h=c.endAngle;return l>=u&&l<h})}},bVe=function(e){var t=e===void 0?{}:e,n=t.cornerRadius,r=n===void 0?0:n,a=t.padAngle,s=a===void 0?0:a;return v.useMemo(function(){return sSe().innerRadius(function(i){return i.innerRadius}).outerRadius(function(i){return i.outerRadius}).cornerRadius(r).padAngle(s)},[r,s])};function Qs(){return Qs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Qs.apply(null,arguments)}function Kg(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Nz,vVe=function(e){var t=e.width,n=e.height,r=e.legends,a=e.data,s=e.toggleSerie;return o.jsx(o.Fragment,{children:r.map(function(i,l){var c;return o.jsx(oS,Qs({},i,{containerWidth:t,containerHeight:n,data:(c=i.data)!=null?c:a,toggleSerie:i.toggleSerie?s:void 0}),l)})})},Xe={id:"id",value:"value",sortByValue:!1,innerRadius:0,padAngle:0,cornerRadius:0,layers:["arcs","arcLinkLabels","arcLabels","legends"],startAngle:0,endAngle:360,fit:!0,activeInnerRadiusOffset:0,activeOuterRadiusOffset:0,borderWidth:0,borderColor:{from:"color",modifiers:[["darker",1]]},enableArcLabels:!0,arcLabel:"formattedValue",arcLabelsSkipAngle:0,arcLabelsSkipRadius:0,arcLabelsRadiusOffset:.5,arcLabelsTextColor:{theme:"labels.text.fill"},enableArcLinkLabels:!0,arcLinkLabel:"id",arcLinkLabelsSkipAngle:0,arcLinkLabelsOffset:0,arcLinkLabelsDiagonalLength:16,arcLinkLabelsStraightLength:24,arcLinkLabelsThickness:1,arcLinkLabelsTextOffset:6,arcLinkLabelsTextColor:{theme:"labels.text.fill"},arcLinkLabelsColor:{theme:"axis.ticks.line.stroke"},colors:{scheme:"nivo"},defs:[],fill:[],isInteractive:!0,animate:!0,motionConfig:"gentle",transitionMode:"innerRadius",tooltip:function(e){var t=e.datum;return o.jsx(Tx,{id:t.id,value:t.formattedValue,enableChip:!0,color:t.color})},legends:[],role:"img",pixelRatio:typeof window!="undefined"&&(Nz=window.devicePixelRatio)!=null?Nz:1},AVe=["points"],kZ=function(e){var t=e.data,n=e.id,r=n===void 0?Xe.id:n,a=e.value,s=a===void 0?Xe.value:a,i=e.valueFormat,l=e.colors,c=l===void 0?Xe.colors:l,u=Gi(r),h=Gi(s),m=ql(i),p=iS(c,"id");return v.useMemo(function(){return t.map(function(g){var T,y=u(g),b=h(g),x={id:y,label:(T=g.label)!=null?T:y,hidden:!1,value:b,formattedValue:m(b),data:g};return Qs({},x,{color:p(x)})})},[t,u,h,m,p])},RVe=function(e){var t=e.data,n=e.startAngle,r=e.endAngle,a=e.innerRadius,s=e.outerRadius,i=e.padAngle,l=e.sortByValue,c=e.activeId,u=e.activeInnerRadiusOffset,h=e.activeOuterRadiusOffset,m=e.hiddenIds,p=e.forwardLegendData,g=v.useMemo(function(){var x=cSe().value(function(R){return R.value}).startAngle(Ws(n)).endAngle(Ws(r)).padAngle(Ws(i));return l||x.sortValues(null),x},[n,r,i,l]),T=v.useMemo(function(){var x=t.filter(function(R){return!m.includes(R.id)});return{dataWithArc:g(x).map(function(R){var A=Math.abs(R.endAngle-R.startAngle);return Qs({},R.data,{arc:{index:R.index,startAngle:R.startAngle,endAngle:R.endAngle,innerRadius:c===R.data.id?a-u:a,outerRadius:c===R.data.id?s+h:s,thickness:s-a,padAngle:R.padAngle,angle:A,angleDeg:Hg(A)}})}),legendData:t.map(function(R){return{id:R.id,label:R.label,color:R.color,hidden:m.includes(R.id),data:R}})}},[g,t,m,c,a,u,s,h]),y=T.legendData,b=v.useRef(p);return v.useEffect(function(){typeof b.current=="function"&&b.current(y)},[b,y]),T},NVe=function(e){var t=e.activeId,n=e.onActiveIdChange,r=e.defaultActiveId,a=t!==void 0,s=v.useState(a||r===void 0?null:r),i=s[0],l=s[1];return{activeId:a?t:i,setActiveId:v.useCallback(function(c){n&&n(c),a||l(c)},[a,n,l])}},jZ=function(e){var t=e.data,n=e.width,r=e.height,a=e.innerRadius,s=a===void 0?Xe.innerRadius:a,i=e.startAngle,l=i===void 0?Xe.startAngle:i,c=e.endAngle,u=c===void 0?Xe.endAngle:c,h=e.padAngle,m=h===void 0?Xe.padAngle:h,p=e.sortByValue,g=p===void 0?Xe.sortByValue:p,T=e.cornerRadius,y=T===void 0?Xe.cornerRadius:T,b=e.fit,x=b===void 0?Xe.fit:b,R=e.activeInnerRadiusOffset,A=R===void 0?Xe.activeInnerRadiusOffset:R,w=e.activeOuterRadiusOffset,_=w===void 0?Xe.activeOuterRadiusOffset:w,N=e.activeId,I=e.onActiveIdChange,D=e.defaultActiveId,M=e.forwardLegendData,O=NVe({activeId:N,onActiveIdChange:I,defaultActiveId:D}),L=O.activeId,k=O.setActiveId,F=v.useState([]),U=F[0],B=F[1],j=v.useMemo(function(){var J,$=Math.min(n,r)/2,X=$*Math.min(s,1),Z=n/2,V=r/2;if(x){var te=yVe(Z,V,$,l-90,u-90),ae=te.points,ne=Kg(te,AVe),ce=Math.min(n/ne.width,r/ne.height),ie={width:ne.width*ce,height:ne.height*ce};ie.x=(n-ie.width)/2,ie.y=(r-ie.height)/2,Z=(Z-ne.x)/ne.width*ne.width*ce+ie.x,V=(V-ne.y)/ne.height*ne.height*ce+ie.y,J={box:ne,ratio:ce,points:ae},$*=ce,X*=ce}return{centerX:Z,centerY:V,radius:$,innerRadius:X,debug:J}},[n,r,s,l,u,x]),G=RVe({data:t,startAngle:l,endAngle:u,innerRadius:j.innerRadius,outerRadius:j.radius,padAngle:m,sortByValue:g,activeId:L,activeInnerRadiusOffset:A,activeOuterRadiusOffset:_,hiddenIds:U,forwardLegendData:M}),K=v.useCallback(function(J){B(function($){return $.indexOf(J)>-1?$.filter(function(X){return X!==J}):[].concat($,[J])})},[]);return Qs({arcGenerator:bVe({cornerRadius:y,padAngle:Ws(m)}),activeId:L,setActiveId:k,toggleSerie:K},G,j)},_Ve=function(e){var t=e.dataWithArc,n=e.arcGenerator,r=e.centerX,a=e.centerY,s=e.radius,i=e.innerRadius;return v.useMemo(function(){return{dataWithArc:t,arcGenerator:n,centerX:r,centerY:a,radius:s,innerRadius:i}},[t,n,r,a,s,i])},wVe=function(e){var t=e.center,n=e.data,r=e.arcGenerator,a=e.borderWidth,s=e.borderColor,i=e.isInteractive,l=e.onClick,c=e.onMouseEnter,u=e.onMouseMove,h=e.onMouseLeave,m=e.setActiveId,p=e.tooltip,g=e.transitionMode,T=Zs(),y=T.showTooltipFromEvent,b=T.hideTooltip,x=v.useMemo(function(){if(i)return function(_,N){l==null||l(_,N)}},[i,l]),R=v.useMemo(function(){if(i)return function(_,N){y(v.createElement(p,{datum:_}),N),m(_.id),c==null||c(_,N)}},[i,y,m,c,p]),A=v.useMemo(function(){if(i)return function(_,N){y(v.createElement(p,{datum:_}),N),u==null||u(_,N)}},[i,y,u,p]),w=v.useMemo(function(){if(i)return function(_,N){b(),m(null),h==null||h(_,N)}},[i,b,m,h]);return o.jsx(TVe,{center:t,data:n,arcGenerator:r,borderWidth:a,borderColor:s,transitionMode:g,onClick:x,onMouseEnter:R,onMouseMove:A,onMouseLeave:w})},CVe=["isInteractive","animate","motionConfig","theme","renderWrapper"],IVe=function(e){var t=e.data,n=e.id,r=n===void 0?Xe.id:n,a=e.value,s=a===void 0?Xe.value:a,i=e.valueFormat,l=e.sortByValue,c=l===void 0?Xe.sortByValue:l,u=e.layers,h=u===void 0?Xe.layers:u,m=e.startAngle,p=m===void 0?Xe.startAngle:m,g=e.endAngle,T=g===void 0?Xe.endAngle:g,y=e.padAngle,b=y===void 0?Xe.padAngle:y,x=e.fit,R=x===void 0?Xe.fit:x,A=e.innerRadius,w=A===void 0?Xe.innerRadius:A,_=e.cornerRadius,N=_===void 0?Xe.cornerRadius:_,I=e.activeInnerRadiusOffset,D=I===void 0?Xe.activeInnerRadiusOffset:I,M=e.activeOuterRadiusOffset,O=M===void 0?Xe.activeOuterRadiusOffset:M,L=e.width,k=e.height,F=e.margin,U=e.colors,B=U===void 0?Xe.colors:U,j=e.borderWidth,G=j===void 0?Xe.borderWidth:j,K=e.borderColor,J=K===void 0?Xe.borderColor:K,$=e.enableArcLabels,X=$===void 0?Xe.enableArcLabels:$,Z=e.arcLabel,V=Z===void 0?Xe.arcLabel:Z,te=e.arcLabelsSkipAngle,ae=te===void 0?Xe.arcLabelsSkipAngle:te,ne=e.arcLabelsSkipRadius,ce=ne===void 0?Xe.arcLabelsSkipRadius:ne,ie=e.arcLabelsTextColor,W=ie===void 0?Xe.arcLabelsTextColor:ie,Q=e.arcLabelsRadiusOffset,se=Q===void 0?Xe.arcLabelsRadiusOffset:Q,z=e.arcLabelsComponent,xe=e.enableArcLinkLabels,le=xe===void 0?Xe.enableArcLinkLabels:xe,pe=e.arcLinkLabel,_e=pe===void 0?Xe.arcLinkLabel:pe,re=e.arcLinkLabelsSkipAngle,Se=re===void 0?Xe.arcLinkLabelsSkipAngle:re,$e=e.arcLinkLabelsOffset,qe=$e===void 0?Xe.arcLinkLabelsOffset:$e,Je=e.arcLinkLabelsDiagonalLength,lt=Je===void 0?Xe.arcLinkLabelsDiagonalLength:Je,at=e.arcLinkLabelsStraightLength,ot=at===void 0?Xe.arcLinkLabelsStraightLength:at,st=e.arcLinkLabelsThickness,oe=st===void 0?Xe.arcLinkLabelsThickness:st,ue=e.arcLinkLabelsTextOffset,Ee=ue===void 0?Xe.arcLinkLabelsTextOffset:ue,Le=e.arcLinkLabelsTextColor,ke=Le===void 0?Xe.arcLinkLabelsTextColor:Le,Ge=e.arcLinkLabelsColor,tt=Ge===void 0?Xe.arcLinkLabelsColor:Ge,ct=e.arcLinkLabelComponent,Te=e.defs,Oe=Te===void 0?Xe.defs:Te,de=e.fill,Ae=de===void 0?Xe.fill:de,we=e.isInteractive,Ie=we===void 0?Xe.isInteractive:we,Ke=e.onClick,it=e.onMouseEnter,De=e.onMouseMove,nt=e.onMouseLeave,Pt=e.tooltip,pt=Pt===void 0?Xe.tooltip:Pt,Bt=e.activeId,un=e.onActiveIdChange,_t=e.defaultActiveId,et=e.transitionMode,We=et===void 0?Xe.transitionMode:et,yt=e.legends,Yt=yt===void 0?Xe.legends:yt,tn=e.forwardLegendData,In=e.role,ga=In===void 0?Xe.role:In,Ur=e.forwardedRef,Pn=zo(L,k,F),dr=Pn.outerWidth,kn=Pn.outerHeight,dt=Pn.margin,kt=Pn.innerWidth,jn=Pn.innerHeight,Gn=kZ({data:t,id:r,value:s,valueFormat:i,colors:B}),Wt=jZ({data:Gn,width:kt,height:jn,fit:R,innerRadius:w,startAngle:p,endAngle:T,padAngle:b,sortByValue:c,cornerRadius:N,activeInnerRadiusOffset:D,activeOuterRadiusOffset:O,activeId:Bt,onActiveIdChange:un,defaultActiveId:_t,forwardLegendData:tn}),wt=Wt.dataWithArc,Ct=Wt.legendData,Vt=Wt.arcGenerator,On=Wt.centerX,gn=Wt.centerY,zt=Wt.radius,pn=Wt.innerRadius,ei=Wt.setActiveId,or=Wt.toggleSerie,Ar=hD(Oe,wt,Ae),hr={arcs:null,arcLinkLabels:null,arcLabels:null,legends:null};h.includes("arcs")&&(hr.arcs=o.jsx(wVe,{center:[On,gn],data:wt,arcGenerator:Vt,borderWidth:G,borderColor:J,isInteractive:Ie,onClick:Ke,onMouseEnter:it,onMouseMove:De,onMouseLeave:nt,setActiveId:ei,tooltip:pt,transitionMode:We},"arcs")),le&&h.includes("arcLinkLabels")&&(hr.arcLinkLabels=o.jsx(dVe,{center:[On,gn],data:wt,label:_e,skipAngle:Se,offset:qe,diagonalLength:lt,straightLength:ot,strokeWidth:oe,textOffset:Ee,textColor:ke,linkColor:tt,component:ct},"arcLinkLabels")),X&&h.includes("arcLabels")&&(hr.arcLabels=o.jsx(tVe,{center:[On,gn],data:wt,label:V,radiusOffset:se,skipAngle:ae,skipRadius:ce,textColor:W,transitionMode:We,component:z},"arcLabels")),Yt.length>0&&h.includes("legends")&&(hr.legends=o.jsx(vVe,{width:kt,height:jn,data:Ct,legends:Yt,toggleSerie:or},"legends"));var ro=_Ve({dataWithArc:wt,arcGenerator:Vt,centerX:On,centerY:gn,radius:zt,innerRadius:pn});return o.jsx(Vg,{width:dr,height:kn,margin:dt,defs:Ar,role:ga,ref:Ur,children:h.map(function(zn,As){return hr[zn]!==void 0?hr[zn]:typeof zn=="function"?o.jsx(v.Fragment,{children:v.createElement(zn,ro)},As):null})})},OVe=v.forwardRef(function(e,t){var n=e.isInteractive,r=n===void 0?Xe.isInteractive:n,a=e.animate,s=a===void 0?Xe.animate:a,i=e.motionConfig,l=i===void 0?Xe.motionConfig:i,c=e.theme,u=e.renderWrapper,h=Kg(e,CVe);return o.jsx(Vo,{animate:s,isInteractive:r,motionConfig:l,renderWrapper:u,theme:c,children:o.jsx(IVe,Qs({isInteractive:r},h,{forwardedRef:t}))})}),LVe=["defaultWidth","defaultHeight","onResize","debounceResize"],MVe=v.forwardRef(function(e,t){var n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=Kg(e,LVe);return o.jsx(Go,{defaultWidth:n,defaultHeight:r,onResize:a,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(OVe,Qs({width:c,height:u},i,{ref:t}))}})}),DVe=["isInteractive","theme","renderWrapper"],PVe=function(e){var t=e.data,n=e.id,r=n===void 0?Xe.id:n,a=e.value,s=a===void 0?Xe.value:a,i=e.valueFormat,l=e.sortByValue,c=l===void 0?Xe.sortByValue:l,u=e.startAngle,h=u===void 0?Xe.startAngle:u,m=e.endAngle,p=m===void 0?Xe.endAngle:m,g=e.padAngle,T=g===void 0?Xe.padAngle:g,y=e.fit,b=y===void 0?Xe.fit:y,x=e.innerRadius,R=x===void 0?Xe.innerRadius:x,A=e.cornerRadius,w=A===void 0?Xe.cornerRadius:A,_=e.activeInnerRadiusOffset,N=_===void 0?Xe.activeInnerRadiusOffset:_,I=e.activeOuterRadiusOffset,D=I===void 0?Xe.activeOuterRadiusOffset:I,M=e.width,O=e.height,L=e.margin,k=e.pixelRatio,F=k===void 0?Xe.pixelRatio:k,U=e.colors,B=U===void 0?Xe.colors:U,j=e.borderWidth,G=j===void 0?Xe.borderWidth:j,K=e.borderColor,J=K===void 0?Xe.borderColor:K,$=e.enableArcLabels,X=$===void 0?Xe.enableArcLabels:$,Z=e.arcLabel,V=Z===void 0?Xe.arcLabel:Z,te=e.arcLabelsSkipAngle,ae=te===void 0?Xe.arcLabelsSkipAngle:te,ne=e.arcLabelsTextColor,ce=ne===void 0?Xe.arcLabelsTextColor:ne,ie=e.arcLabelsRadiusOffset,W=ie===void 0?Xe.arcLabelsRadiusOffset:ie,Q=e.enableArcLinkLabels,se=Q===void 0?Xe.enableArcLinkLabels:Q,z=e.arcLinkLabel,xe=z===void 0?Xe.arcLinkLabel:z,le=e.arcLinkLabelsSkipAngle,pe=le===void 0?Xe.arcLinkLabelsSkipAngle:le,_e=e.arcLinkLabelsOffset,re=_e===void 0?Xe.arcLinkLabelsOffset:_e,Se=e.arcLinkLabelsDiagonalLength,$e=Se===void 0?Xe.arcLinkLabelsDiagonalLength:Se,qe=e.arcLinkLabelsStraightLength,Je=qe===void 0?Xe.arcLinkLabelsStraightLength:qe,lt=e.arcLinkLabelsThickness,at=lt===void 0?Xe.arcLinkLabelsThickness:lt,ot=e.arcLinkLabelsTextOffset,st=ot===void 0?Xe.arcLinkLabelsTextOffset:ot,oe=e.arcLinkLabelsTextColor,ue=oe===void 0?Xe.arcLinkLabelsTextColor:oe,Ee=e.arcLinkLabelsColor,Le=Ee===void 0?Xe.arcLinkLabelsColor:Ee,ke=e.isInteractive,Ge=ke===void 0?Xe.isInteractive:ke,tt=e.onClick,ct=e.onMouseMove,Te=e.tooltip,Oe=Te===void 0?Xe.tooltip:Te,de=e.activeId,Ae=e.onActiveIdChange,we=e.defaultActiveId,Ie=e.legends,Ke=Ie===void 0?Xe.legends:Ie,it=e.forwardLegendData,De=e.role,nt=e.forwardedRef,Pt=v.useRef(null),pt=_n(),Bt=zo(M,O,L),un=Bt.margin,_t=Bt.innerWidth,et=Bt.innerHeight,We=Bt.outerWidth,yt=Bt.outerHeight,Yt=kZ({data:t,id:r,value:s,valueFormat:i,colors:B}),tn=jZ({data:Yt,width:_t,height:et,fit:b,innerRadius:R,startAngle:h,endAngle:p,padAngle:T,sortByValue:c,cornerRadius:w,activeInnerRadiusOffset:N,activeOuterRadiusOffset:D,activeId:de,onActiveIdChange:Ae,defaultActiveId:we,forwardLegendData:it}),In=tn.dataWithArc,ga=tn.arcGenerator,Ur=tn.centerX,Pn=tn.centerY,dr=tn.radius,kn=tn.innerRadius,dt=tn.setActiveId,kt=Ks(J,pt),jn=rVe({data:In,label:V,skipAngle:ae,offset:W,textColor:ce}),Gn=mVe({data:In,skipAngle:pe,offset:re,diagonalLength:$e,straightLength:Je,label:xe,linkColor:Le,textOffset:st,textColor:ue});v.useEffect(function(){if(Pt.current){Pt.current.width=We*F,Pt.current.height=yt*F;var zt=Pt.current.getContext("2d");zt.scale(F,F),zt.fillStyle=pt.background,zt.fillRect(0,0,We,yt),zt.save(),zt.translate(un.left,un.top),ga.context(zt),zt.save(),zt.translate(Ur,Pn),In.forEach(function(pn){zt.beginPath(),zt.fillStyle=pn.color,zt.strokeStyle=kt(pn),zt.lineWidth=G,ga(pn.arc),zt.fill(),G>0&&zt.stroke()}),se===!0&&hVe(zt,Gn,pt,at),X===!0&&nVe(zt,jn,pt),zt.restore(),Ke.forEach(function(pn){lS(zt,Qs({},pn,{data:In,containerWidth:_t,containerHeight:et,theme:pt}))})}},[Pt,_t,et,We,yt,un.top,un.left,F,Ur,Pn,ga,In,G,kt,X,jn,se,Gn,at,Ke,pt]);var Wt=v.useMemo(function(){return In.map(function(zt){return Qs({id:zt.id},zt.arc)})},[In]),wt=function(zt){if(!Pt.current)return null;var pn=ou(Pt.current,zt),ei=pn[0],or=pn[1],Ar=SVe(un.left+Ur,un.top+Pn,dr,kn,Wt,ei,or);return Ar?In.find(function(hr){return hr.id===Ar.id}):null},Ct=Zs(),Vt=Ct.showTooltipFromEvent,On=Ct.hideTooltip,gn=function(zt){var pn=wt(zt);pn?(ct==null||ct(pn,zt),dt(pn.id),Vt(v.createElement(Oe,{datum:pn}),zt)):(dt(null),On())};return o.jsx("canvas",{ref:sS(Pt,nt),width:We*F,height:yt*F,style:{width:We,height:yt,cursor:Ge?"auto":"normal"},onMouseEnter:Ge?gn:void 0,onMouseMove:Ge?gn:void 0,onMouseLeave:Ge?function(){On()}:void 0,onClick:Ge?function(zt){if(tt){var pn=wt(zt);pn&&tt(pn,zt)}}:void 0,role:De})},kVe=v.forwardRef(function(e,t){var n=e.isInteractive,r=n===void 0?Xe.isInteractive:n,a=e.theme,s=e.renderWrapper,i=Kg(e,DVe);return o.jsx(Vo,{isInteractive:r,renderWrapper:s,theme:a,children:o.jsx(PVe,Qs({isInteractive:r},i,{forwardedRef:t}))})}),jVe=["defaultWidth","defaultHeight","onResize","debounceResize"];v.forwardRef(function(e,t){var n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=Kg(e,jVe);return o.jsx(Go,{defaultWidth:n,defaultHeight:r,onResize:a,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(kVe,Qs({width:c,height:u},i,{ref:t}))}})});function vs(){return vs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vs.apply(null,arguments)}function RS(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var UVe=function(e){if(typeof e=="function")return e;if(e1(e))return function(){return e};if(function(n){return rS(n)}(e)){if(!B9(e.key))throw new Error("symbolSize is invalid, key should be a string pointing to the property to use to determine node size");if(!Array.isArray(e.values)||e.values.length!==2)throw new Error("symbolSize is invalid, values spec should be an array containing two values, min and max");if(!Array.isArray(e.sizes)||e.sizes.length!==2)throw new Error("symbolSize is invalid, sizes spec should be an array containing two values, min and max");var t=Eg().domain([e.values[0],e.values[1]]).range([e.sizes[0],e.sizes[1]]);return function(n){return t(Ti(n,e.key))}}throw new Error("nodeSize is invalid, it should be either a function, a number or an object")},UZ=function(e){var t,n=e.data,r=e.xScaleSpec,a=e.xFormat,s=e.yScaleSpec,i=e.yFormat,l=e.width,c=e.height,u=e.nodeId,h=e.nodeSize,m=e.colors,p=v.useMemo(function(){return BK(n,r,s,l,c)},[n,r,s,l,c]),g=p.series,T=p.xScale,y=p.yScale,b=ql(a),x=ql(i),R=Gi(u),A=v.useMemo(function(){return function(N){var I=N.series,D=N.formatX,M=N.formatY,O=N.getNodeId,L=[];return I.forEach(function(k){k.data.forEach(function(F,U){var B={index:L.length,serieIndex:U,serieId:k.id,x:F.position.x,xValue:F.data.x,formattedX:D(F.data.x),y:F.position.y,yValue:F.data.y,formattedY:M(F.data.y),data:F.data};L.push(vs({},B,{id:O(B)}))})}),L}({series:g,formatX:b,formatY:x,getNodeId:R})},[g,b,x,R]),w=v.useMemo(function(){return UVe(t)},[t=h]),_=iS(m,"serieId");return{xScale:T,yScale:y,nodes:v.useMemo(function(){return A.map(function(N){return vs({},N,{size:w(N),color:_({serieId:N.serieId})})})},[A,w,_]),legendData:v.useMemo(function(){return g.map(function(N){return{id:N.id,label:N.id,color:_({serieId:N.id})}})},[g,_])}},FZ=function(e,t){return AD({data:e,annotations:t,getPosition:function(n){return{x:n.x,y:n.y}},getDimensions:function(n){return{size:n.size,width:n.size,height:n.size}}})},FVe=function(e){return e/2},$Z={xScale:{type:"linear",min:0,max:"auto"},yScale:{type:"linear",min:0,max:"auto"},enableGridX:!0,enableGridY:!0,axisTop:null,axisRight:null,axisBottom:{},axisLeft:{},nodeId:function(e){return e.serieId+"."+e.index},nodeSize:9,nodeComponent:function(e){var t=e.node,n=e.style,r=e.blendMode,a=e.isInteractive,s=e.onMouseEnter,i=e.onMouseMove,l=e.onMouseLeave,c=e.onMouseDown,u=e.onMouseUp,h=e.onClick,m=e.onDoubleClick,p=v.useCallback(function(A){return s==null?void 0:s(t,A)},[t,s]),g=v.useCallback(function(A){return i==null?void 0:i(t,A)},[t,i]),T=v.useCallback(function(A){return l==null?void 0:l(t,A)},[t,l]),y=v.useCallback(function(A){return c==null?void 0:c(t,A)},[t,c]),b=v.useCallback(function(A){return u==null?void 0:u(t,A)},[t,u]),x=v.useCallback(function(A){return h==null?void 0:h(t,A)},[t,h]),R=v.useCallback(function(A){return m==null?void 0:m(t,A)},[t,m]);return o.jsx(Vn.circle,{cx:n.x,cy:n.y,r:n.size.to(FVe),fill:n.color,style:{mixBlendMode:r},onMouseEnter:a?p:void 0,onMouseMove:a?g:void 0,onMouseLeave:a?T:void 0,onMouseDown:a?y:void 0,onMouseUp:a?b:void 0,onClick:a?x:void 0,onDoubleClick:a?R:void 0})},colors:{scheme:"nivo"},isInteractive:!0,debugMesh:!1,tooltip:function(e){var t=e.node;return o.jsx(Tx,{id:t.serieId,value:"x: "+t.formattedX+", y: "+t.formattedY,enableChip:!0,color:t.color})},markers:[],legends:[],annotations:[]},cr=vs({},$Z,{blendMode:"normal",layers:["grid","axes","nodes","markers","mesh","legends","annotations"],role:"img",useMesh:!0,animate:!0,motionConfig:"default"}),ba=vs({},$Z,{layers:["grid","axes","nodes","mesh","legends","annotations"],pixelRatio:typeof window!="undefined"&&window.devicePixelRatio||1,renderNode:function(e,t){e.beginPath(),e.arc(t.x,t.y,t.size/2,0,2*Math.PI),e.fillStyle=t.color,e.fill()}}),$Ve=function(e){var t=e.nodes,n=e.annotations,r=FZ(t,n);return o.jsx(o.Fragment,{children:r.map(function(a,s){return o.jsx(ZK,vs({},a),s)})})},BVe=function(e){return e.id},QC=function(e){return{x:e.x,y:e.y,size:e.size,color:e.color}},HVe=function(e){return{x:e.x,y:e.y,size:0,color:e.color}},VVe=function(e){var t=e.nodes,n=e.nodeComponent,r=e.isInteractive,a=e.onMouseEnter,s=e.onMouseMove,i=e.onMouseLeave,l=e.onMouseDown,c=e.onMouseUp,u=e.onClick,h=e.onDoubleClick,m=e.tooltip,p=e.blendMode,g=Pa(),T=g.animate,y=g.config,b=tc(t,{keys:BVe,from:QC,enter:QC,update:QC,leave:HVe,config:y,immediate:!T}),x=Zs(),R=x.showTooltipFromEvent,A=x.hideTooltip,w=v.useCallback(function(L,k){R(v.createElement(m,{node:L}),k),a==null||a(L,k)},[m,R,a]),_=v.useCallback(function(L,k){R(v.createElement(m,{node:L}),k),s==null||s(L,k)},[m,R,s]),N=v.useCallback(function(L,k){A(),i==null||i(L,k)},[A,i]),I=v.useCallback(function(L,k){return l==null?void 0:l(L,k)},[l]),D=v.useCallback(function(L,k){return c==null?void 0:c(L,k)},[c]),M=v.useCallback(function(L,k){return u==null?void 0:u(L,k)},[u]),O=v.useCallback(function(L,k){return h==null?void 0:h(L,k)},[h]);return o.jsx(o.Fragment,{children:b(function(L,k){return v.createElement(n,{node:k,style:L,blendMode:p,isInteractive:r,onMouseEnter:r?w:void 0,onMouseMove:r?_:void 0,onMouseLeave:r?N:void 0,onMouseDown:r?I:void 0,onMouseUp:r?D:void 0,onClick:r?M:void 0,onDoubleClick:r?O:void 0})})})},GVe=function(e){var t=e.nodes,n=e.width,r=e.height,a=e.onMouseEnter,s=e.onMouseMove,i=e.onMouseLeave,l=e.onMouseDown,c=e.onMouseUp,u=e.onClick,h=e.onDoubleClick,m=e.tooltip,p=e.debug,g=Zs(),T=g.showTooltipFromEvent,y=g.hideTooltip,b=v.useCallback(function(I,D){T(v.createElement(m,{node:I}),D),a==null||a(I,D)},[T,m,a]),x=v.useCallback(function(I,D){T(v.createElement(m,{node:I}),D),s==null||s(I,D)},[T,m,s]),R=v.useCallback(function(I,D){y(),i==null||i(I,D)},[y,i]),A=v.useCallback(function(I,D){l==null||l(I,D)},[l]),w=v.useCallback(function(I,D){c==null||c(I,D)},[c]),_=v.useCallback(function(I,D){u==null||u(I,D)},[u]),N=v.useCallback(function(I,D){h==null||h(I,D)},[h]);return o.jsx(wZ,{nodes:t,width:n,height:r,onMouseEnter:b,onMouseMove:x,onMouseLeave:R,onMouseDown:A,onMouseUp:w,onClick:_,onDoubleClick:N,debug:p})},zVe=["isInteractive","animate","motionConfig","theme","renderWrapper"],qVe=function(e){var t=e.data,n=e.xScale,r=n===void 0?cr.xScale:n,a=e.xFormat,s=e.yScale,i=s===void 0?cr.yScale:s,l=e.yFormat,c=e.width,u=e.height,h=e.margin,m=e.layers,p=m===void 0?cr.layers:m,g=e.colors,T=g===void 0?cr.colors:g,y=e.blendMode,b=y===void 0?cr.blendMode:y,x=e.nodeId,R=x===void 0?cr.nodeId:x,A=e.nodeSize,w=A===void 0?cr.nodeSize:A,_=e.nodeComponent,N=_===void 0?cr.nodeComponent:_,I=e.enableGridX,D=I===void 0?cr.enableGridX:I,M=e.enableGridY,O=M===void 0?cr.enableGridY:M,L=e.gridXValues,k=e.gridYValues,F=e.axisTop,U=e.axisRight,B=e.axisBottom,j=B===void 0?cr.axisBottom:B,G=e.axisLeft,K=G===void 0?cr.axisLeft:G,J=e.annotations,$=J===void 0?cr.annotations:J,X=e.isInteractive,Z=X===void 0?cr.isInteractive:X,V=e.useMesh,te=V===void 0?cr.useMesh:V,ae=e.debugMesh,ne=ae===void 0?cr.debugMesh:ae,ce=e.onMouseEnter,ie=e.onMouseMove,W=e.onMouseLeave,Q=e.onMouseDown,se=e.onMouseUp,z=e.onClick,xe=e.onDoubleClick,le=e.tooltip,pe=le===void 0?cr.tooltip:le,_e=e.markers,re=_e===void 0?cr.markers:_e,Se=e.legends,$e=Se===void 0?cr.legends:Se,qe=e.role,Je=qe===void 0?cr.role:qe,lt=e.ariaLabel,at=e.ariaLabelledBy,ot=e.ariaDescribedBy,st=e.forwardedRef,oe=zo(c,u,h),ue=oe.margin,Ee=oe.innerWidth,Le=oe.innerHeight,ke=oe.outerWidth,Ge=oe.outerHeight,tt=UZ({data:t,xScaleSpec:r,xFormat:a,yScaleSpec:i,yFormat:l,width:Ee,height:Le,nodeId:R,nodeSize:w,colors:T}),ct=tt.xScale,Te=tt.yScale,Oe=tt.nodes,de=tt.legendData,Ae=v.useMemo(function(){return{xScale:ct,yScale:Te,nodes:Oe,margin:ue,innerWidth:Ee,innerHeight:Le,outerWidth:ke,outerHeight:Ge}},[ct,Te,Oe,ue,Ee,Le,ke,Ge]),we={grid:null,axes:null,nodes:null,markers:null,mesh:null,annotations:null,legends:null};return p.includes("grid")&&(we.grid=o.jsx(bD,{width:Ee,height:Le,xScale:D?ct:null,yScale:O?Te:null,xValues:L,yValues:k},"grid")),p.includes("axes")&&(we.axes=o.jsx(SD,{xScale:ct,yScale:Te,width:Ee,height:Le,top:F,right:U,bottom:j,left:K},"axes")),p.includes("nodes")&&(we.nodes=o.jsx(VVe,{nodes:Oe,nodeComponent:N,isInteractive:Z,tooltip:pe,blendMode:b,onMouseEnter:ce,onMouseMove:ie,onMouseLeave:W,onMouseDown:Q,onMouseUp:se,onClick:z,onDoubleClick:xe},"nodes")),p.includes("markers")&&(we.markers=o.jsx(lD,{markers:re,width:Ee,height:Le,xScale:ct,yScale:Te},"markers")),p.includes("mesh")&&Z&&te&&(we.mesh=o.jsx(GVe,{nodes:Oe,width:Ee,height:Le,onMouseEnter:ce,onMouseMove:ie,onMouseLeave:W,onMouseDown:Q,onMouseUp:se,onClick:z,onDoubleClick:xe,tooltip:pe,debug:ne},"mesh")),p.includes("annotations")&&(we.annotations=o.jsx($Ve,{nodes:Oe,annotations:$},"annotations")),p.includes("legends")&&(we.legends=$e.map(function(Ie,Ke){return o.jsx(oS,vs({},Ie,{containerWidth:Ee,containerHeight:Le,data:de}),Ke)})),o.jsx(Vg,{width:ke,height:Ge,margin:ue,role:Je,ariaLabel:lt,ariaLabelledBy:at,ariaDescribedBy:ot,ref:st,children:p.map(function(Ie,Ke){if(typeof Ie=="string"&&we[Ie]!==void 0)return we[Ie];if(typeof Ie=="function")return o.jsx(v.Fragment,{children:v.createElement(Ie,Ae)},Ke);throw new Error("Unknown layer ("+Ie+")")})})},YVe=v.forwardRef(function(e,t){var n=e.isInteractive,r=n===void 0?cr.isInteractive:n,a=e.animate,s=a===void 0?cr.animate:a,i=e.motionConfig,l=i===void 0?cr.motionConfig:i,c=e.theme,u=e.renderWrapper,h=RS(e,zVe);return o.jsx(Vo,{animate:s,isInteractive:r,motionConfig:l,renderWrapper:u,theme:c,children:o.jsx(qVe,vs({},h,{isInteractive:r,forwardedRef:t}))})}),WVe=["defaultWidth","defaultHeight","onResize","debounceResize"],XVe=v.forwardRef(function(e,t){var n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=RS(e,WVe);return o.jsx(Go,{defaultWidth:n,defaultHeight:r,onResize:a,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(YVe,vs({},i,{width:c,height:u,ref:t}))}})}),KVe=["isInteractive","renderWrapper","theme"],QVe=function(e){var t=e.data,n=e.xScale,r=n===void 0?ba.xScale:n,a=e.xFormat,s=e.yScale,i=s===void 0?ba.yScale:s,l=e.yFormat,c=e.width,u=e.height,h=e.margin,m=e.pixelRatio,p=m===void 0?ba.pixelRatio:m,g=e.layers,T=g===void 0?ba.layers:g,y=e.colors,b=y===void 0?ba.colors:y,x=e.nodeId,R=x===void 0?cr.nodeId:x,A=e.nodeSize,w=A===void 0?ba.nodeSize:A,_=e.renderNode,N=_===void 0?ba.renderNode:_,I=e.enableGridX,D=I===void 0?ba.enableGridX:I,M=e.gridXValues,O=e.enableGridY,L=O===void 0?ba.enableGridY:O,k=e.gridYValues,F=e.axisTop,U=e.axisRight,B=e.axisBottom,j=B===void 0?ba.axisBottom:B,G=e.axisLeft,K=G===void 0?ba.axisLeft:G,J=e.annotations,$=J===void 0?ba.annotations:J,X=e.isInteractive,Z=X===void 0?ba.isInteractive:X,V=e.debugMesh,te=V===void 0?ba.debugMesh:V,ae=e.onMouseEnter,ne=e.onMouseMove,ce=e.onMouseLeave,ie=e.onMouseDown,W=e.onMouseUp,Q=e.onClick,se=e.onDoubleClick,z=e.tooltip,xe=z===void 0?ba.tooltip:z,le=e.legends,pe=le===void 0?ba.legends:le,_e=e.role,re=e.forwardedRef,Se=v.useRef(null),$e=_n(),qe=v.useState(null),Je=qe[0],lt=qe[1],at=zo(c,u,h),ot=at.margin,st=at.innerWidth,oe=at.innerHeight,ue=at.outerWidth,Ee=at.outerHeight,Le=UZ({data:t,xScaleSpec:r,xFormat:a,yScaleSpec:i,yFormat:l,width:st,height:oe,nodeId:R,nodeSize:w,colors:b}),ke=Le.xScale,Ge=Le.yScale,tt=Le.nodes,ct=Le.legendData,Te=FZ(tt,$),Oe=rP({points:tt,width:st,height:oe,debug:te}),de=Oe.delaunay,Ae=Oe.voronoi,we=v.useMemo(function(){return{xScale:ke,yScale:Ge,nodes:tt,margin:ot,innerWidth:st,innerHeight:oe,outerWidth:ue,outerHeight:Ee}},[ke,Ge,tt,ot,st,oe,ue,Ee]);v.useEffect(function(){if(Se.current){Se.current.width=ue*p,Se.current.height=Ee*p;var et=Se.current.getContext("2d");et.scale(p,p),et.fillStyle=$e.background,et.fillRect(0,0,ue,Ee),et.translate(ot.left,ot.top),T.forEach(function(We){if(We==="grid")et.lineWidth=$e.grid.line.strokeWidth,et.strokeStyle=$e.grid.line.stroke,D&&Bh(et,{width:st,height:oe,scale:ke,axis:"x",values:M}),L&&Bh(et,{width:st,height:oe,scale:Ge,axis:"y",values:k});else if(We==="annotations")eQ(et,{annotations:Te,theme:$e});else if(We==="axes")vD(et,{xScale:ke,yScale:Ge,width:st,height:oe,top:F,right:U,bottom:j,left:K,theme:$e});else if(We==="nodes")tt.forEach(function(yt){N(et,yt)});else if(We==="mesh")te&&(CZ(et,Ae),Je&&IZ(et,Ae,Je.index));else if(We==="legends")pe.forEach(function(yt){lS(et,vs({},yt,{data:ct,containerWidth:st,containerHeight:oe,theme:$e}))});else{if(typeof We!="function")throw new Error("Invalid layer: "+We);We(et,we)}})}},[Se,st,oe,ue,Ee,ot.top,ot.left,p,N,T,we,$e,ke,Ge,tt,D,M,L,k,F,U,j,K,pe,ct,te,Ae,Je,Te]);var Ie=Zs(),Ke=Ie.showTooltipFromEvent,it=Ie.hideTooltip,De=v.useCallback(function(et){var We=ou(Se.current,et),yt=We[0],Yt=We[1];if(!dD(ot.left,ot.top,st,oe,yt,Yt))return null;var tn=de.find(yt-ot.left,Yt-ot.top);return tt[tn]},[Se,ot,st,oe,de,tt]),nt=v.useCallback(function(et){var We=De(et);lt(We),We?(Ke(v.createElement(xe,{node:We}),et),Je&&Je.id!==We.id&&(ce==null||ce(Je,et),ae==null||ae(We,et)),Je||ae==null||ae(We,et),ne==null||ne(We,et)):(it(),Je&&(ce==null||ce(Je,et)))},[De,Je,lt,Ke,it,xe,ae,ne,ce]),Pt=v.useCallback(function(et){it(),lt(null),Je&&(ce==null||ce(Je,et))},[it,Je,lt,ce]),pt=v.useCallback(function(et){if(ie){var We=De(et);We&&ie(We,et)}},[De,ie]),Bt=v.useCallback(function(et){if(W){var We=De(et);We&&W(We,et)}},[De,W]),un=v.useCallback(function(et){if(Q){var We=De(et);We&&Q(We,et)}},[De,Q]),_t=v.useCallback(function(et){if(se){var We=De(et);We&&se(We,et)}},[De,se]);return o.jsx("canvas",{ref:sS(Se,re),width:ue*p,height:Ee*p,style:{width:ue,height:Ee,cursor:Z?"auto":"normal"},onMouseEnter:Z?nt:void 0,onMouseMove:Z?nt:void 0,onMouseLeave:Z?Pt:void 0,onMouseDown:Z?pt:void 0,onMouseUp:Z?Bt:void 0,onClick:Z?un:void 0,onDoubleClick:Z?_t:void 0,role:_e})},JVe=v.forwardRef(function(e,t){var n=e.isInteractive,r=e.renderWrapper,a=e.theme,s=RS(e,KVe);return o.jsx(Vo,{isInteractive:n,renderWrapper:r,theme:a,animate:!1,children:o.jsx(QVe,vs({},s,{isInteractive:n,forwardedRef:t}))})}),ZVe=["defaultWidth","defaultHeight","onResize","debounceResize"];v.forwardRef(function(e,t){var n=e.defaultWidth,r=e.defaultHeight,a=e.onResize,s=e.debounceResize,i=RS(e,ZVe);return o.jsx(Go,{defaultWidth:n,defaultHeight:r,onResize:a,debounceResize:s,children:function(l){var c=l.width,u=l.height;return o.jsx(JVe,vs({},i,{width:c,height:u,ref:t}))}})});function eGe(e){if(!e||e.toLowerCase().includes("none"))return{type:"none"};const t=e.toLowerCase().trim(),r=["bar","line","pie","scatter","area"].find(l=>t.includes(l));if(!r)return{type:"none"};const a=t.match(/x[=:]\s*([^,\s]+)/),s=t.match(/y[=:]\s*([^,\s]+)/),i=t.match(/color[=:]\s*([^,\s]+)/);return{type:r,xAxis:a==null?void 0:a[1],yAxis:s==null?void 0:s[1],colorBy:i==null?void 0:i[1],description:e}}function tGe(e,t){if(!e||e.length<2||!t||t.length<2)return{type:"none"};e[0].slice(1);const n=t.filter(s=>["INTEGER","DOUBLE","FLOAT","DECIMAL","BIGINT"].includes(s.type.toUpperCase())),r=t.filter(s=>["VARCHAR","TEXT","STRING"].includes(s.type.toUpperCase())),a=t.filter(s=>["DATE","DATETIME","TIMESTAMP"].includes(s.type.toUpperCase()));return a.length>0&&n.length>0?{type:"line",xAxis:a[0].name,yAxis:n[0].name,description:"Time series visualization"}:r.length>0&&n.length>0?{type:"bar",xAxis:r[0].name,yAxis:n[0].name,description:"Category comparison"}:n.length>=2?{type:"scatter",xAxis:n[0].name,yAxis:n[1].name,description:"Correlation analysis"}:r.length===1?{type:"pie",xAxis:r[0].name,description:"Distribution breakdown"}:{type:"none",description:"No suitable chart type detected"}}function nGe(e,t){if(!e||e.length<2||t.type==="none")return[];const n=e[0].slice(1),r=t.xAxis?n.indexOf(t.xAxis):-1,a=t.yAxis?n.indexOf(t.yAxis):-1,s=t.colorBy?n.indexOf(t.colorBy):-1;return r===-1?[]:e.slice(1).map((i,l)=>{const c={id:l,[t.xAxis]:i[r+1]};if(a!==-1&&t.yAxis){const u=i[a+1],h=parseFloat(u);c[t.yAxis]=isNaN(h)?1:h}return s!==-1&&t.colorBy&&(c[t.colorBy]=i[s+1]),c})}const rGe=({data:e,columnTypes:t,aiSuggestion:n,className:r=""})=>{const a=v.useMemo(()=>!e||e.length===0?[]:e[0].slice(1),[e]),s=v.useMemo(()=>t.filter(x=>["INTEGER","DOUBLE","FLOAT","DECIMAL","BIGINT"].includes(x.type.toUpperCase())).map(x=>x.name),[t]),i=v.useMemo(()=>t.filter(x=>["VARCHAR","TEXT","STRING","DATE","DATETIME","TIMESTAMP"].includes(x.type.toUpperCase())).map(x=>x.name),[t]),l=v.useMemo(()=>{if(n){const w=eGe(n);if(w&&w.type!=="none")return w}const x=tGe(e,t);if(x.type!=="none")return x;const R=i[0]||a[0],A=s[0]||a[1];return{type:"bar",xAxis:R,yAxis:A,description:"Default bar chart configuration"}},[e,t,n,i,s,a]),[c,u]=v.useState(l),h=v.useMemo(()=>nGe(e,c),[e,c]),m=[{type:"bar",icon:vhe,label:"Bar"},{type:"line",icon:She,label:"Line Chart"},{type:"pie",icon:UW,label:"Pie Chart"},{type:"scatter",icon:Nhe,label:"Scatter Plot"},{type:"area",icon:The,label:"Area Chart"}],p=x=>{u(R=>he(q({},R),{type:x}))},g=(x,R)=>{u(A=>he(q({},A),{[x]:R}))},T=v.useCallback(x=>{if(x===0)return"0";const R=Math.abs(x),A=x<0?"-":"";return R<1e-4&&R>0?x.toExponential(2):R>=1e9?"".concat(A).concat((R/1e9).toFixed(R>=1e10?0:1),"B"):R>=1e6?"".concat(A).concat((R/1e6).toFixed(R>=1e7?0:1),"M"):R>=1e3?"".concat(A).concat((R/1e3).toFixed(R>=1e4?0:1),"k"):R<1?x.toPrecision(3):R>=100?Math.round(x).toString():R>=10?x.toFixed(1):x.toFixed(2)},[]),y=v.useCallback((x="png")=>H(null,null,function*(){const R=document.querySelector(".chart-container");if(R)try{if(x==="svg"){const A=R.querySelector("svg");if(A){const w=new XMLSerializer().serializeToString(A),_=new Blob([w],{type:"image/svg+xml;charset=utf-8"}),N=URL.createObjectURL(_),I=document.createElement("a");I.href=N,I.download="chart_".concat(c.type,"_").concat(Date.now(),".svg"),document.body.appendChild(I),I.click(),document.body.removeChild(I),URL.revokeObjectURL(N)}}else(yield(yield fn(()=>import("./html2canvas.esm-Bc6Ti1ol.js"),[])).default(R,{backgroundColor:null,scale:2,useCORS:!0})).toBlob(_=>{if(_){const N=URL.createObjectURL(_),I=document.createElement("a");I.href=N,I.download="chart_".concat(c.type,"_").concat(Date.now(),".png"),document.body.appendChild(I),I.click(),document.body.removeChild(I),URL.revokeObjectURL(N)}})}catch(A){}}),[c.type]),b=()=>{if(!h||h.length===0||c.type==="none")return o.jsx("div",{className:"h-full flex items-center justify-center text-white/50",children:o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"mb-2",children:"No chart data available"}),o.jsx("p",{className:"text-sm",children:"Configure chart settings to visualize your data"})]})});const x=v.useMemo(()=>{if(!h||h.length===0)return!1;const A=h.reduce((w,_)=>{const N=String(_[c.xAxis||"id"]||"");return w+N.length},0)/h.length;return h.length>8||A>10},[h,c.xAxis]),R={data:h,theme:{background:"transparent",text:{fill:"#ffffff"},axis:{ticks:{text:{fill:"#ffffff"}},legend:{text:{fill:"#ffffff"}}},grid:{line:{stroke:"#374151"}},tooltip:{container:{background:"#1f2937",color:"#ffffff",border:"1px solid #374151"}}},margin:{top:50,right:110,bottom:x?90:70,left:70},valueFormat:A=>T(A)};switch(c.type){case"bar":return o.jsx(_D,he(q({},R),{keys:c.yAxis?[c.yAxis]:[],indexBy:c.xAxis||"id",colors:{scheme:"nivo"},padding:.3,valueScale:{type:"linear"},indexScale:{type:"band",round:!0},borderColor:{from:"color",modifiers:[["darker",1.6]]},axisTop:null,axisRight:null,axisLeft:{tickSize:5,tickPadding:5,tickRotation:0,format:T},axisBottom:{tickSize:5,tickPadding:5,tickRotation:x?-45:0,legend:c.xAxis,legendOffset:x?50:36,legendPosition:"middle"},labelSkipWidth:12,labelSkipHeight:12,labelTextColor:{from:"color",modifiers:[["darker",1.6]]}}));case"line":const A=[{id:c.yAxis||"series",data:h.map(N=>({x:N[c.xAxis||"id"],y:N[c.yAxis||"value"]||0}))}];return o.jsx(GHe,he(q({},R),{data:A,xScale:{type:"point"},yScale:{type:"linear",min:"auto",max:"auto"},axisTop:null,axisRight:null,axisLeft:{tickSize:5,tickPadding:5,tickRotation:0,format:T},axisBottom:{tickSize:5,tickPadding:5,tickRotation:x?-45:0,legend:c.xAxis,legendOffset:x?50:36,legendPosition:"middle"},pointSize:10,pointColor:{theme:"background"},pointBorderWidth:2,pointBorderColor:{from:"serieColor"},useMesh:!0}));case"pie":const w=h.map(N=>({id:N[c.xAxis||"id"],label:N[c.xAxis||"id"],value:N[c.yAxis||"value"]||1}));return o.jsx(MVe,he(q({},R),{data:w,innerRadius:.5,padAngle:.7,cornerRadius:3,activeOuterRadiusOffset:8,borderWidth:1,borderColor:{from:"color",modifiers:[["darker",.2]]},enableArcLinkLabels:!0,arcLinkLabelsSkipAngle:10,arcLinkLabelsTextColor:"#ffffff",arcLinkLabelsThickness:2,arcLinkLabelsColor:{from:"color"},arcLabelsTextColor:"#ffffff",valueFormat:T}));case"scatter":const _=[{id:"data",data:h.map(N=>({x:parseFloat(N[c.xAxis||"id"])||0,y:parseFloat(N[c.yAxis||"value"])||0}))}];return o.jsx(XVe,he(q({},R),{data:_,xScale:{type:"linear",min:"auto",max:"auto"},yScale:{type:"linear",min:"auto",max:"auto"},blendMode:"multiply",axisTop:null,axisRight:null,axisLeft:{tickSize:5,tickPadding:5,tickRotation:0,format:T},axisBottom:{tickSize:5,tickPadding:5,tickRotation:x?-45:0,format:T,legend:c.xAxis,legendOffset:x?50:36,legendPosition:"middle"}}));default:return o.jsx("div",{className:"h-full flex items-center justify-center text-white/50",children:o.jsx("p",{children:"Chart type not supported yet"})})}};return o.jsxs("div",{className:"h-full flex flex-col bg-background ".concat(r),children:[o.jsxs("div",{className:"flex-shrink-0 p-3 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsx("h3",{className:"text-sm font-medium text-white",children:"Chart Builder"}),o.jsx("div",{className:"flex gap-1",children:o.jsx(Ut,{placement:"bottom",content:"PNG",children:o.jsx("button",{onClick:()=>y("png"),className:"p-1 rounded transition-colors text-white/50 hover:text-white hover:bg-white/10",children:o.jsx(Hr,{className:"h-4 w-4"})})})})]}),o.jsxs("div",{className:"flex items-end gap-6",children:[o.jsxs("div",{className:"flex-shrink-0",children:[o.jsx("div",{className:"flex items-center gap-1 mb-1",children:o.jsx("span",{className:"text-xs font-medium text-white/70",children:"Chart Type"})}),o.jsx("div",{className:"flex gap-1",children:m.map(({type:x,icon:R,label:A})=>o.jsx(Ut,{placement:"bottom",content:A,children:o.jsx("button",{onClick:()=>p(x),className:"p-2 rounded transition-colors ".concat(c.type===x?"bg-primary/20 text-primary border border-primary/30":"text-white/50 hover:text-white hover:bg-white/10 border border-transparent"),children:o.jsx(R,{className:"h-4 w-4"})})},x))})]}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[o.jsx("span",{className:"text-xs font-medium text-white/70",children:"X Axis"}),o.jsx(Ut,{placement:"top",content:"Choose the column for horizontal axis (categories, dates, or labels)",children:o.jsx($5,{className:"h-3 w-3 text-white/40 hover:text-white/60 cursor-help"})})]}),o.jsxs("select",{value:c.xAxis||"",onChange:x=>g("xAxis",x.target.value),className:"w-full p-1 text-xs bg-white/5 border border-white/10 rounded text-white",children:[o.jsx("option",{value:"",children:"Select column"}),a.map(x=>o.jsx("option",{value:x,children:x},x))]})]}),c.type!=="pie"&&o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-1 mb-1",children:[o.jsx("span",{className:"text-xs font-medium text-white/70",children:"Y Axis"}),o.jsx(Ut,{placement:"top",content:"Choose the column for vertical axis (values, measurements, or counts)",children:o.jsx($5,{className:"h-3 w-3 text-white/40 hover:text-white/60 cursor-help"})})]}),o.jsxs("select",{value:c.yAxis||"",onChange:x=>g("yAxis",x.target.value),className:"w-full p-1 text-xs bg-white/5 border border-white/10 rounded text-white",children:[o.jsx("option",{value:"",children:"Select column"}),a.map(x=>o.jsxs("option",{value:x,children:[x,s.includes(x)?" (numeric)":""]},x))]})]})]}),n&&o.jsxs("div",{className:"mt-3 p-2 bg-primary/10 border border-primary/20 rounded text-xs",children:[o.jsx("span",{className:"text-primary/80",children:"AI Suggestion:"}),o.jsx("span",{className:"text-white/70 ml-1",children:n})]})]}),o.jsx("div",{className:"flex-1 p-4",children:o.jsx("div",{className:"chart-container h-full",children:b()})})]})},aGe=({isOpen:e,results:t,onClose:n,onKeep:r,onExport:a,onCopy:s,aiChartSuggestion:i})=>{const{t:l}=Ze(),[c,u]=v.useState(!1),[h,m]=v.useState({x:0,y:0}),[p,g]=v.useState({width:800,height:400}),[T,y]=v.useState(!1),[b,x]=v.useState(!1),[R,A]=v.useState(!1),[w,_]=v.useState(""),[N,I]=v.useState(!1),D=v.useRef(null),M=v.useRef(null),O=Ht.useMemo(()=>{if(!(t!=null&&t.data)||t.data.length<2)return{queryResults:[],columns:[]};const J=t.data[0].slice(1);return{queryResults:t.data.slice(1).map(X=>{const Z={};return J.forEach((V,te)=>{Z[V]=X[te+1]}),Z}),columns:J}},[t==null?void 0:t.data]),{columnTypes:L,formatCellValue:k}=LD({results:O.queryResults,columns:O.columns}),{getCellClass:F}=dS(L,!0,{animationActive:!1,gridData:(t==null?void 0:t.data)||[],animationMessage:[],activeWordIndex:-1});v.useEffect(()=>{if(e&&M.current){const J=M.current.getBoundingClientRect();m({x:Math.max(0,(J.width-p.width)/2),y:Math.max(0,(J.height-p.height)/2)})}},[e,p.width,p.height]);const U=v.useCallback(J=>{J.preventDefault(),y(!0);const $=J.clientX-h.x,X=J.clientY-h.y,Z=te=>{if(!M.current)return;const ae=M.current.getBoundingClientRect(),ne=Math.max(0,Math.min(ae.width-p.width,te.clientX-$)),ce=Math.max(0,Math.min(ae.height-p.height,te.clientY-X));m({x:ne,y:ce})},V=()=>{y(!1),document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",V)};document.addEventListener("mousemove",Z),document.addEventListener("mouseup",V)},[h,p]),B=v.useCallback(J=>{J.preventDefault(),J.stopPropagation(),x(!0);const $=J.clientX,X=J.clientY,Z=p.width,V=p.height,te=ne=>{if(!M.current)return;const ce=M.current.getBoundingClientRect(),ie=ne.clientX-$,W=ne.clientY-X,Q=Math.max(400,Math.min(ce.width-h.x,Z+ie)),se=Math.max(200,Math.min(ce.height-h.y,V+W));g({width:Q,height:se})},ae=()=>{x(!1),document.removeEventListener("mousemove",te),document.removeEventListener("mouseup",ae)};document.addEventListener("mousemove",te),document.addEventListener("mouseup",ae)},[p,h]),j=v.useCallback(()=>{if(M.current){if(c)g({width:800,height:400}),m({x:0,y:0});else{const J=M.current.getBoundingClientRect();g({width:J.width-40,height:J.height-40}),m({x:20,y:20})}u(!c)}},[c]),G=v.useCallback(()=>{A(!0),_("query_result_".concat(Date.now()))},[]),K=v.useCallback(()=>H(null,null,function*(){if(r&&w.trim())try{yield r(w.trim()),A(!1),n()}catch(J){}}),[r,w,n]);return v.useEffect(()=>{if(!e)return;const J=$=>{$.key==="Escape"?n():$.key==="f"&&($.metaKey||$.ctrlKey)&&($.preventDefault(),j())};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[e,n,j]),!e||!t?null:o.jsx("div",{ref:M,className:"fixed inset-0 z-50 pointer-events-none",children:o.jsx(At,{children:e&&o.jsxs(me.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2},className:"absolute pointer-events-auto",style:{left:h.x,top:h.y,width:p.width,height:p.height},children:[o.jsxs("div",{className:"w-full h-full bg-background border border-white/20 rounded-lg shadow-2xl flex flex-col overflow-hidden",children:[o.jsxs("div",{ref:D,onMouseDown:U,className:"flex items-center justify-between px-4 py-2 bg-white/5 border-b border-white/10 cursor-move ".concat(T?"cursor-grabbing":"cursor-grab"),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(dO,{className:"h-4 w-4 text-white/40"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-medium text-white",children:"Query Results"}),t.metadata&&o.jsxs("span",{className:"text-xs text-white/50",children:[t.metadata.rowCount," rows × ",t.metadata.columnCount," cols",t.metadata.executionTime&&o.jsxs("span",{className:"ml-1",children:["(",t.metadata.executionTime.toFixed(1),"ms)"]})]})]})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs("div",{className:"flex border border-white/20 rounded overflow-hidden",children:[o.jsx(Ut,{placement:"bottom",content:"Data grid view",children:o.jsx("button",{onClick:()=>I(!1),className:"p-1 transition-colors ".concat(N?"text-white/70 hover:bg-white/10":"bg-primary/20 text-primary"),children:o.jsx(uO,{className:"h-4 w-4"})})}),o.jsx(Ut,{placement:"bottom",content:"Chart view",children:o.jsx("button",{onClick:()=>I(!0),className:"p-1 transition-colors ".concat(N?"bg-primary/20 text-primary":"text-white/70 hover:bg-white/10"),children:o.jsx(ko,{className:"h-4 w-4"})})})]}),a&&o.jsx(Ut,{placement:"bottom",content:"Export results",children:o.jsx("button",{onClick:()=>a("csv"),className:"p-1 hover:bg-white/10 rounded transition-colors",children:o.jsx(Hr,{className:"h-4 w-4 text-white/70"})})}),r&&o.jsx(Ut,{placement:"bottom",content:"Save as table",children:o.jsx("button",{onClick:G,className:"p-1 hover:bg-white/10 rounded transition-colors",children:o.jsx(DL,{className:"h-4 w-4 text-white/70"})})}),o.jsx(Ut,{placement:"bottom",content:c?"Restore size":"Maximize",children:o.jsx("button",{onClick:j,className:"p-1 hover:bg-white/10 rounded transition-colors",children:c?o.jsx(Xfe,{className:"h-4 w-4 text-white/70"}):o.jsx(zfe,{className:"h-4 w-4 text-white/70"})})}),o.jsx(Ut,{placement:"bottom",content:"Close",children:o.jsx("button",{onClick:n,className:"p-1 hover:bg-white/10 rounded transition-colors",children:o.jsx(ur,{className:"h-4 w-4 text-white/70"})})})]})]}),o.jsx("div",{className:"flex-1 overflow-hidden",children:N?o.jsx(rGe,{data:t.data||[],columnTypes:t.columnTypes||[],aiSuggestion:i,className:"h-full"}):o.jsx(QL,{data:t.data||[],columnTypes:t.columnTypes||[],gridId:"draggable-results",isDataMode:!0,className:"h-full",rowHeight:32,estimatedColumnWidth:120,formatCellValue:k,getCellClass:F})}),o.jsx("div",{onMouseDown:B,className:"absolute bottom-0 right-0 w-4 h-4 cursor-se-resize ".concat(b?"bg-primary/30":"bg-white/10 hover:bg-white/20"," transition-colors"),style:{background:"linear-gradient(-45deg, transparent 30%, currentColor 30%, currentColor 40%, transparent 40%, transparent 60%, currentColor 60%, currentColor 70%, transparent 70%)"}})]}),o.jsx(At,{children:R&&o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:o.jsxs(me.div,{initial:{scale:.9},animate:{scale:1},exit:{scale:.9},className:"bg-background border border-white/20 rounded-lg p-6 shadow-xl",children:[o.jsx("h3",{className:"text-lg font-semibold text-white mb-4",children:"Save Results as Table"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/80 mb-2",children:"Table Name:"}),o.jsx("input",{type:"text",value:w,onChange:J=>_(J.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/20 rounded text-white focus:outline-none focus:ring-2 focus:ring-primary/50",autoFocus:!0})]}),o.jsxs("div",{className:"flex gap-2 justify-end",children:[o.jsx(je,{variant:"ghost",size:"sm",onClick:()=>A(!1),children:"Cancel"}),o.jsx(je,{variant:"outline",size:"sm",onClick:K,disabled:!w.trim(),children:"Save Table"})]})]})]})})})]})})})},sGe=()=>{var ne;const{t:e}=Ze(),{sourceType:t,jsonSchema:n,jsonViewMode:r,setJsonViewMode:a,handleDataLoad:s}=WBe(),i=ut(u7),l=ut(kr),{setIsRemoteModalOpen:c,setActiveProviderRemoteModal:u,showColumnStats:h,setShowColumnStats:m,changeViewMode:p,emptyStateViewMode:g,showAIAssistant:T,toggleAIAssistant:y,setShowAIAssistant:b,assistantSidebarWidth:x,setAssistantSidebarWidth:R}=ut(),{getParentChain:A,nodeMap:w}=xs(),{openPanel:_,analyzeFile:N}=Yc(),{isDraggableOpen:I,draggableResults:D,showDraggableResults:M,closeDraggableResults:O,handleKeepDraggableResults:L,handleExportDraggableResults:k,handleCopyDraggableResults:F}=XBe();v.useEffect(()=>(window.__showDraggableResults=M,window.__closeDraggableResults=O,()=>{delete window.__showDraggableResults,delete window.__closeDraggableResults}),[M,O]);const{columnStats:U,isLoading:B,triggerAnalysis:j}=v7({fileId:l==null?void 0:l.id,enabled:!0,manualTrigger:!0}),G=(l==null?void 0:l.viewMode)||g,K=v.useCallback(ce=>{p(ce)},[p]),J=v.useCallback(()=>{if(!l)return null;let ce=null;if(w.forEach(Q=>{Q.type==="file"&&Q.name===l.fileName&&(ce=Q)}),!ce)return[l.fileName];const W=A(ce.id).map(Q=>Q.name);return W.push(ce.name),W},[l,w,A]),$=ce=>{c(!0),u(ce)};v.useEffect(()=>{T||b(!0)},[]),v.useEffect(()=>{const ce=ie=>{(ie.metaKey||ie.ctrlKey)&&ie.key==="k"&&!ie.shiftKey&&!ie.altKey&&(ie.preventDefault(),y())};return document.addEventListener("keydown",ce),()=>document.removeEventListener("keydown",ce)},[y]);const X=v.useCallback(()=>{if(!l)return;const ce=l.tableName;_(),N(l.id,ce)},[l,_,N]),Z=v.useCallback(()=>{U.length>0?m(!h):(m(!0),j())},[U.length,h,m,j]),V=Qe("grid grid-cols-3 items-center px-6 py-3 min-h-[60px] gap-2","responsive-header",T&&"ai-assistant-open"),te={hidden:{opacity:0,y:20},visible:{opacity:1,y:0},exit:{opacity:0,y:-20}},ae=()=>{switch(G){case"preview":return i?o.jsx(MG,{}):o.jsx(a1,{onImportOptionClick:$});case"query":return o.jsx(sje,{});case"notebook":return o.jsx(xBe,{});default:return i?o.jsx(MG,{}):o.jsx(a1,{onImportOptionClick:$})}};return o.jsxs(o.Fragment,{children:[o.jsx(ff,{title:e("seo.title"),description:e("seo.description"),keywords:e("seo.keywords"),url:"/"}),o.jsxs(Kge,{onDataLoad:s,children:[o.jsxs("div",{className:"h-full flex flex-col bg-background relative transition-all duration-300",style:{marginRight:T?x:0},children:[o.jsxs(me.div,{className:V,initial:{opacity:0,y:-10},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},style:{"--sidebar-width":T?"".concat(x,"px"):"0px"},children:[o.jsx(me.div,{className:"flex justify-start items-center min-w-0",initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.3},children:i&&l&&o.jsx("div",{className:"responsive-breadcrumb flex items-center gap-1 text-sm min-w-0",children:(ne=J())==null?void 0:ne.map((ce,ie,W)=>o.jsxs(Ht.Fragment,{children:[o.jsx("span",{className:Qe("breadcrumb-part",ie===W.length-1?"breadcrumb-filename text-white/90 font-medium":"breadcrumb-folder text-white/50"),children:ce}),ie<W.length-1&&o.jsx(nr,{className:"h-3 w-3 text-white/30 flex-shrink-0"})]},ie))})}),o.jsx(me.div,{className:"flex justify-center",initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.3,delay:.1},children:o.jsx(SBe,{currentMode:G,onModeChange:K})}),o.jsx(me.div,{className:"flex justify-end min-w-0",initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{duration:.3,delay:.2},children:o.jsxs("div",{className:"responsive-buttons flex items-center gap-1.5 transition-all duration-300 min-w-0",children:[i&&l&&G==="preview"&&!l.isRemote&&o.jsx(Ut,{content:U.length>0?e(h?"dataGrid.stats.hideStats":"dataGrid.stats.showStats"):e("dataGrid.stats.columnStats"),placement:"bottom",children:o.jsxs(me.button,{onClick:Z,className:"relative group p-2 rounded-md bg-black/50 backdrop-blur-sm border border-white/10 transition-all duration-200 hover:border-white/20 cursor-pointer",whileHover:{scale:1.02},whileTap:{scale:.98},children:[h&&U.length>0&&o.jsx("div",{className:"absolute inset-0 rounded-md bg-gradient-to-r from-primary/25 via-primary/20 to-primary/15 border border-primary/30"}),B?o.jsxs("svg",{className:"w-4 h-4 text-primary animate-spin relative z-10",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}):o.jsx(ko,{className:"h-4 w-4 relative z-10 ".concat(h&&U.length>0?"text-white":"text-white/50 hover:text-white/70")})]})}),i&&l&&G==="preview"&&!l.isRemote&&o.jsx(Ut,{content:e("dataGrid.inspector"),placement:"bottom",children:o.jsx(me.button,{onClick:X,className:"relative group p-2 rounded-md bg-black/50 backdrop-blur-sm border border-white/10 transition-all duration-200 hover:border-white/20 cursor-pointer",whileHover:{scale:1.02},whileTap:{scale:.98},children:o.jsx(Qi,{className:"h-4 w-4 text-white/50 hover:text-white/70 relative z-10"})})}),o.jsxs(me.button,{onClick:y,className:Qe("responsive-button assistant-button relative group flex items-center rounded-md transition-all duration-200 cursor-pointer gap-1.5 px-3 py-1.5 text-xs border-2 font-semibold",T?"border-primary bg-primary/10":"border-white/20 hover:border-white/30 hover:bg-white/5"),whileHover:{scale:1.02},whileTap:{scale:.98},"data-tooltip":"Datakit Assistant (⌘K)",children:[T&&o.jsx(me.div,{layoutId:"activeAssistant",className:"absolute inset-0 rounded-md bg-gradient-to-r from-primary/30 via-primary/25 to-primary/20 border border-primary/50 shadow-lg shadow-primary/20",transition:{type:"spring",duration:.4,bounce:.15}}),o.jsxs("div",{className:"flex items-center gap-0.5 px-1.5 py-0.5 bg-white/10 rounded text-xs text-white/60 border border-white/20 relative z-10",children:[o.jsx("span",{children:"⌘"}),o.jsx("span",{className:"font-mono",children:"K"})]}),o.jsx("span",{className:Qe("button-text relative z-10 font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent",T&&"from-white to-gray-300"),children:"Datakit Assistant"})]})]})})]}),t===tr.JSON&&(n==null?void 0:n.isNested)&&G==="preview"&&o.jsx("div",{className:"flex justify-center pb-2",children:o.jsxs("div",{className:"border border-white/20 rounded-lg overflow-hidden bg-black/40 backdrop-blur-sm",children:[o.jsx("button",{className:"px-3 py-1 text-xs ".concat(r==="table"?"bg-primary text-white":"text-white/70 hover:text-white/90 hover:bg-white/10"," transition-colors"),onClick:()=>a("table"),children:e("dataGrid.jsonView.table")}),o.jsx("button",{className:"px-3 py-1 text-xs ".concat(r==="tree"?"bg-primary text-white":"text-white/70 hover:text-white/90 hover:bg-white/10"," transition-colors"),onClick:()=>a("tree"),children:e("dataGrid.jsonView.tree")})]})}),o.jsx("div",{className:"flex-1 overflow-hidden relative px-6 pb-6",children:o.jsx(At,{mode:"wait",children:o.jsx(me.div,{variants:te,initial:"hidden",animate:"visible",exit:"exit",transition:{duration:.2},className:"absolute inset-0 px-6 pb-6",children:ae()},"".concat(G,"-").concat((l==null?void 0:l.id)||"empty"))})})]}),o.jsx(VBe,{isOpen:T,onClose:()=>b(!1),width:x,onWidthChange:R}),o.jsx(aGe,{isOpen:I,results:D,onClose:O,onKeep:L,onExport:k,onCopy:F})]})]})},iGe=()=>{const{t:e}=Ze();return o.jsxs(o.Fragment,{children:[o.jsx(ff,{title:"".concat(e("privacy.title")," - ").concat(e("seo.title")),description:e("privacy.description")}),o.jsx("div",{className:"min-h-screen bg-black text-white p-8",children:o.jsxs("div",{className:"max-w-3xl mx-auto",children:[o.jsxs(die,{to:"/",className:"inline-flex items-center gap-2 text-white/60 hover:text-white transition-colors mb-8",children:[o.jsx(AL,{className:"w-4 h-4"}),e("privacy.backToDatakit")]}),o.jsx("h1",{className:"text-2xl font-bold mb-8",children:e("privacy.title")}),o.jsxs("div",{className:"space-y-6 text-white/80 leading-relaxed",children:[o.jsxs("section",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white mb-3",children:e("pages.privacy.dataStaysLocal.title",{defaultValue:"Your Data Stays Local"})}),o.jsx("p",{className:"mb-4",children:e("pages.privacy.dataStaysLocal.description",{defaultValue:"DataKit processes all your files locally in your browser. Your data never leaves your device. We don't upload, store, or have access to any of your files or their contents."})}),o.jsxs("div",{className:"border border-white rounded-lg p-4",children:[o.jsx("h3",{className:"font-medium text-white mb-2",children:e("pages.privacy.dataStaysLocal.aiModelsTitle",{defaultValue:"DataKit AI Models - Column Schema Only"})}),o.jsxs("p",{className:"text-sm text-white",children:[o.jsx("strong",{children:e("pages.privacy.dataStaysLocal.importantException",{defaultValue:"Important exception:"})})," ",e("pages.privacy.dataStaysLocal.aiModelsDescription",{defaultValue:"When you use DataKit's built-in AI models (powered by Anthropic's Claude), only your column names and data types are shared with our AI service to generate accurate SQL queries. Your actual data rows remain completely private and local to your browser."})]}),o.jsx("p",{className:"text-sm text-white mt-2",children:e("pages.privacy.dataStaysLocal.aiModelsExample",{defaultValue:'For example, if you have a CSV with columns like "customer_name", "order_date", "amount" - only these column names and their types (text, date, number) are sent to help the AI understand your data structure. The actual customer names, dates, and amounts stay in your browser.'})})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white mb-3",children:e("pages.privacy.analytics.title",{defaultValue:"Our Two-Tiered Analytics System"})}),o.jsx("p",{className:"mb-3",children:e("pages.privacy.analytics.description",{defaultValue:"We use a privacy-first approach with two levels of analytics:"})}),o.jsxs("div",{className:"bg-white/5 rounded-lg p-4 mb-4",children:[o.jsx("h3",{className:"font-medium text-white mb-2",children:e("pages.privacy.analytics.basic.title",{defaultValue:"Basic Analytics (Always Active, No Consent Required):"})}),o.jsxs("ul",{className:"space-y-1 text-sm",children:[o.jsxs("li",{children:["• ",e("pages.privacy.analytics.basic.pageViews",{defaultValue:"Page views and basic navigation"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.basic.performance",{defaultValue:"Performance metrics (query execution times, file load speeds)"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.basic.errorReports",{defaultValue:"Error reports (JavaScript errors to help us fix bugs)"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.basic.featureAccess",{defaultValue:"Feature access patterns (anonymous)"})]})]}),o.jsx("p",{className:"text-xs text-white/60 mt-2",children:e("pages.privacy.analytics.basic.note",{defaultValue:"These metrics help us understand app stability and performance without any personal data."})})]}),o.jsxs("div",{className:"bg-white/5 rounded-lg p-4 mb-4",children:[o.jsx("h3",{className:"font-medium text-white mb-2",children:e("pages.privacy.analytics.advanced.title",{defaultValue:"Advanced Analytics (With Your Consent):"})}),o.jsxs("ul",{className:"space-y-1 text-sm",children:[o.jsxs("li",{children:["• ",e("pages.privacy.analytics.advanced.detailedUsage",{defaultValue:"Detailed feature usage (which tabs you visit, chart types you create)"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.advanced.sessionRecordings",{defaultValue:"Session recordings (with sensitive data masked)"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.advanced.userJourney",{defaultValue:"User journey tracking"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.advanced.fileMetadata",{defaultValue:"File metadata (file types and sizes, not content)"})]})]})]}),o.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[o.jsx("h3",{className:"font-medium text-white mb-2",children:e("pages.privacy.analytics.neverCollect.title",{defaultValue:"What We Never Collect:"})}),o.jsxs("ul",{className:"space-y-1 text-sm",children:[o.jsxs("li",{children:["• ",e("pages.privacy.analytics.neverCollect.files",{defaultValue:"Your uploaded files or their content (actual data rows)"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.neverCollect.queries",{defaultValue:"SQL queries or code you write"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.neverCollect.personalInfo",{defaultValue:"Personal information or identifying data"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.analytics.neverCollect.sensitiveInputs",{defaultValue:"Unmasked sensitive form inputs"})]})]}),o.jsx("p",{className:"text-xs text-white/60 mt-3",children:o.jsx("em",{children:e("pages.privacy.analytics.neverCollect.note",{defaultValue:"Note: When using DataKit AI models, only column schemas (names and types) are processed by our AI service - never your actual data."})})})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white mb-3",children:e("pages.privacy.thirdParty.title",{defaultValue:"Third-Party Services"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"font-medium text-white mb-2",children:e("pages.privacy.thirdParty.analytics.title",{defaultValue:"Analytics Provider"})}),o.jsx("p",{className:"text-sm",children:e("pages.privacy.thirdParty.analytics.description",{defaultValue:"We use PostHog for analytics, a product analytics platform. PostHog helps us understand how you use DataKit while respecting your privacy through our two-tiered consent system. Basic anonymous metrics are collected to improve app stability, while advanced tracking requires your explicit consent."})})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"font-medium text-white mb-2",children:e("pages.privacy.thirdParty.ai.title",{defaultValue:"AI Service Provider"})}),o.jsx("p",{className:"text-sm mb-2",children:e("pages.privacy.thirdParty.ai.description",{defaultValue:"DataKit's built-in AI models are powered by Anthropic's Claude API. When you use these models:"})}),o.jsxs("ul",{className:"text-sm space-y-1 ml-4",children:[o.jsxs("li",{children:["• ",e("pages.privacy.thirdParty.ai.columnNames",{defaultValue:"Only your table column names and data types are sent to Anthropic"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.thirdParty.ai.prompts",{defaultValue:"Your prompts and questions are processed to generate SQL queries"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.thirdParty.ai.noData",{defaultValue:"No actual data content is ever transmitted"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.thirdParty.ai.privacyPolicy",{defaultValue:"Anthropic processes this information according to their privacy policy"})]}),o.jsxs("li",{children:["• ",e("pages.privacy.thirdParty.ai.ownKeys",{defaultValue:"You can always use your own API keys (OpenAI, Anthropic, etc.) for full control"})]})]})]})]})]}),o.jsxs("section",{children:[o.jsx("h2",{className:"text-lg font-semibold text-white mb-3",children:e("pages.privacy.choices.title",{defaultValue:"Your Choices"})}),o.jsx("p",{className:"mb-2",children:e("pages.privacy.choices.analytics",{defaultValue:"You can accept or decline analytics at any time. DataKit works fully without analytics enabled."})}),o.jsx("p",{children:e("pages.privacy.choices.preferences",{defaultValue:"To change your preferences, click the privacy icon in the app or clear your browser data."})})]}),o.jsxs("div",{className:"text-sm text-white/50 mt-12 pt-8 border-t border-white/10",children:[e("pages.privacy.lastUpdated",{defaultValue:"Last updated"}),": ",new Date().toLocaleDateString()]})]})]})})]})},oGe=(e={})=>{const{isAuthenticated:t,isLoading:n,error:r}=ea(),{onUnauthorized:a}=e;return v.useEffect(()=>{!n&&!t&&!r&&(a==null||a())},[t,n,r,a]),{isAuthenticated:t,isLoading:n,error:r,isReady:!n}},lGe=({children:e,fallback:t,requireAuth:n=!0})=>{const{t:r}=Ze(),[a,s]=v.useState(!1),{isAuthenticated:i,isLoading:l}=oGe({onUnauthorized:()=>{n&&s(!0)}});return l?o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("div",{className:"text-white/70",children:"Loading..."})}):!i&&n?o.jsxs(o.Fragment,{children:[t||o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsxs("div",{className:"text-center",children:[o.jsx("h3",{className:"text-lg font-medium text-white mb-2",children:r("auth.protectedRoute.authRequired",{defaultValue:"Authentication Required"})}),o.jsx("p",{className:"text-white/70 mb-4",children:r("auth.protectedRoute.signInMessage",{defaultValue:"Please sign in to access this feature."})}),o.jsx("button",{onClick:()=>s(!0),className:"text-primary hover:text-primary-foreground transition-colors",children:r("auth.protectedRoute.signInButton",{defaultValue:"Sign In"})})]})}),o.jsx(Vl,{isOpen:a,onClose:()=>s(!1),defaultMode:"login"})]}):o.jsx(o.Fragment,{children:e})},cGe=({activeTab:e,onTabChange:t})=>{const{t:n}=Ze(),r=xi(),{logout:a}=ea(),{showSuccess:s}=ec(),i=()=>H(null,null,function*(){try{yield a(),r("/"),s(n("settings.signout.successTitle",{defaultValue:"Signed out successfully"}),n("settings.signout.successMessage",{defaultValue:"You've been securely signed out of DataKit."}),{icon:"shield",duration:3e3})}catch(c){}}),l=[{id:"profile",name:n("settings.tabs.profile",{defaultValue:"Profile"}),icon:z0},{id:"workspace",name:n("settings.tabs.workspace",{defaultValue:"Workspace & Team"}),icon:kL},{id:"ai",name:n("settings.tabs.ai",{defaultValue:"AI assistant settings"}),icon:H0},{id:"appearance",name:n("settings.tabs.appearance",{defaultValue:"Appearance"}),icon:rme},{id:"notifications",name:n("settings.tabs.notifications",{defaultValue:"Notifications"}),icon:PW},{id:"subscription",name:n("settings.tabs.subscription",{defaultValue:"Subscription"}),icon:BW}];return o.jsxs("div",{className:"bg-darkNav flex flex-col h-full border-r border-gray-500/20 overflow-hidden w-56",children:[o.jsxs("div",{className:"px-5 py-4 border-b border-gray-500/20 bg-black/20 flex items-center gap-3",children:[o.jsx("button",{onClick:()=>r("/"),className:"text-white/70 hover:text-white transition-colors p-1 cursor-pointer hover:bg-white/5 rounded","aria-label":"Back to DataKit",children:o.jsx(AL,{size:18})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-white font-heading font-medium text-lg",children:n("settings.header.title",{defaultValue:"Settings"})}),o.jsx("p",{className:"text-xs text-white/50",children:n("settings.header.subtitle",{defaultValue:"Manage your account"})})]})]}),o.jsx("div",{className:"px-5 pt-2 pb-2 flex-1",children:o.jsx("div",{className:"space-y-1",children:l.map(c=>{const u=c.icon;return o.jsxs("button",{onClick:()=>t(c.id),className:"w-full text-left flex items-center gap-3 px-3 py-2.5 rounded-md text-sm transition-colors ".concat(e===c.id?"bg-primary/20 text-white":"text-white/80 hover:bg-white/5 hover:text-white"),children:[o.jsx(u,{size:16,className:"flex-shrink-0 ".concat(e===c.id?"text-primary":"text-white/70")}),o.jsx("span",{className:"font-medium",children:c.name})]},c.id)})})}),o.jsxs("div",{className:"border-t border-gray-500/20 bg-black/30",children:[o.jsx("div",{className:"px-3 py-2.5 border-b border-gray-400/15",children:o.jsxs("button",{onClick:i,className:"w-full flex items-center justify-center gap-2.5 px-2 py-1.5 text-xs hover:bg-white/5 rounded transition-all duration-200 group text-red-400/80 hover:text-red-400",children:[o.jsx(iy,{size:14,className:"flex-shrink-0"}),o.jsx("span",{className:"font-medium",children:n("settings.signout.button",{defaultValue:"Sign Out"})})]})}),o.jsx("div",{className:"px-2 py-2 border-t border-gray-400/15 bg-black/40",children:o.jsx("div",{className:"text-[9px] text-white text-opacity-30",children:o.jsxs("div",{className:"flex items-center justify-center gap-1",children:[o.jsx("span",{children:"Powered by"}),o.jsx("a",{href:"https://duckdb.org/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center",children:o.jsx("img",{src:yO,className:"h-2.5 w-2.5 transition-colors hover:opacity-80",alt:"DuckDB"})}),o.jsx("span",{children:"•"}),o.jsx("a",{href:"https://amin.contact",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:n("settings.footer.built",{defaultValue:"built"})}),o.jsx("span",{children:"@"}),o.jsx("a",{href:"https://www.linkedin.com/company/datakitpage",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:n("settings.footer.company",{defaultValue:"DataKit"})})]})})})]})]})},uGe=Ki()(H1((e,t)=>({workspaces:[],currentWorkspaceMembers:[],isLoading:!1,isLoadingMembers:!1,error:null,loadWorkspaces:()=>H(null,null,function*(){e({isLoading:!0,error:null});try{const n=yield oi.getWorkspaces();e({workspaces:n,isLoading:!1})}catch(n){e({error:n instanceof Error?n.message:"Failed to load workspaces",isLoading:!1})}}),createWorkspace:n=>H(null,null,function*(){e({isLoading:!0,error:null});try{const r=yield oi.createWorkspace(n),{workspaces:a}=t();return e({workspaces:[...a,r],isLoading:!1}),r}catch(r){throw e({error:r instanceof Error?r.message:"Failed to create workspace",isLoading:!1}),r}}),updateWorkspace:(n,r)=>H(null,null,function*(){e({isLoading:!0,error:null});try{const a=yield oi.updateWorkspace(n,r),{workspaces:s}=t();e({workspaces:s.map(i=>i.id===n?a:i),isLoading:!1})}catch(a){throw e({error:a instanceof Error?a.message:"Failed to update workspace",isLoading:!1}),a}}),deleteWorkspace:n=>H(null,null,function*(){e({isLoading:!0,error:null});try{yield oi.deleteWorkspace(n);const{workspaces:r}=t();e({workspaces:r.filter(a=>a.id!==n),isLoading:!1})}catch(r){throw e({error:r instanceof Error?r.message:"Failed to delete workspace",isLoading:!1}),r}}),loadMembers:n=>H(null,null,function*(){e({isLoadingMembers:!0,error:null});try{const r=yield oi.getMembers(n);e({currentWorkspaceMembers:r,isLoadingMembers:!1})}catch(r){e({error:r instanceof Error?r.message:"Failed to load members",isLoadingMembers:!1})}}),inviteMember:(n,r)=>H(null,null,function*(){try{const a=yield oi.inviteMember(n,r),{currentWorkspaceMembers:s}=t();e({currentWorkspaceMembers:[...s,a]})}catch(a){throw e({error:a instanceof Error?a.message:"Failed to invite member"}),a}}),removeMember:(n,r)=>H(null,null,function*(){try{yield oi.removeMember(n,r);const{currentWorkspaceMembers:a}=t();e({currentWorkspaceMembers:a.filter(s=>s.id!==r)})}catch(a){throw e({error:a instanceof Error?a.message:"Failed to remove member"}),a}}),updateMemberRole:(n,r,a)=>H(null,null,function*(){try{yield oi.updateMemberRole(n,r,a);const{currentWorkspaceMembers:s}=t();e({currentWorkspaceMembers:s.map(i=>i.id===r?he(q({},i),{role:a}):i)})}catch(s){throw e({error:s instanceof Error?s.message:"Failed to update member role"}),s}}),acceptInvite:n=>H(null,null,function*(){try{yield oi.acceptInvite(n),yield t().loadWorkspaces()}catch(r){throw e({error:r instanceof Error?r.message:"Failed to accept invite"}),r}}),setError:n=>e({error:n}),clearError:()=>e({error:null}),getWorkspaceById:n=>{const{workspaces:r}=t();return r.find(a=>a.id===n)},getCurrentUserRole:(n,r)=>{const{workspaces:a,currentWorkspaceMembers:s}=t();if(r){const c=a.find(h=>h.id===r);if((c==null?void 0:c.ownerId)===n)return"owner";const u=s.find(h=>h.userId===n);return(u==null?void 0:u.role)||null}const i=a[0];if((i==null?void 0:i.ownerId)===n)return"owner";const l=s.find(c=>c.userId===n);return(l==null?void 0:l.role)||null}}),{name:"WorkspaceStore"})),dGe=()=>{var V,te,ae,ne,ce,ie,W;const{t:e}=Ze(),{user:t,currentWorkspace:n,loadCurrentWorkspace:r}=qh(),{workspaces:a,currentWorkspaceMembers:s,isLoadingMembers:i,loadWorkspaces:l,loadMembers:c,inviteMember:u,removeMember:h,updateMemberRole:m,getCurrentUserRole:p,updateWorkspace:g}=uGe(),[T,y]=v.useState(!1),[b,x]=v.useState(""),[R,A]=v.useState("member"),[w,_]=v.useState(!1),[N,I]=v.useState(!1),[D,M]=v.useState(""),[O,L]=v.useState(!1),k=n||a[0],F=p((t==null?void 0:t.id)||"",k==null?void 0:k.id),U=F==="owner"||F==="admin",B=((V=k==null?void 0:k.subscription)==null?void 0:V.planType)==="team";((te=k==null?void 0:k.subscription)==null?void 0:te.planType)==="pro"||((ae=k==null?void 0:k.subscription)==null||ae.planType),v.useEffect(()=>{a.length===0&&l(),t!=null&&t.currentWorkspaceId&&!n&&r(),k!=null&&k.id&&c(k.id)},[k==null?void 0:k.id,t==null?void 0:t.currentWorkspaceId,c,r,n,a.length,l]),v.useEffect(()=>{k!=null&&k.name&&M(k.name)},[k==null?void 0:k.name]);const j=Q=>H(null,null,function*(){if(Q.preventDefault(),!!(k!=null&&k.id)){_(!0);try{yield u(k.id,{email:b,role:R}),x(""),y(!1)}catch(se){}finally{_(!1)}}}),G=Q=>H(null,null,function*(){if(k!=null&&k.id)try{yield h(k.id,Q)}catch(se){}}),K=(Q,se)=>H(null,null,function*(){if(k!=null&&k.id)try{yield m(k.id,Q,se)}catch(z){}}),J=()=>H(null,null,function*(){if(!(!(k!=null&&k.id)||!D.trim())){L(!0);try{yield g(k.id,{name:D.trim()}),I(!1),yield r()}catch(Q){M(k.name)}finally{L(!1)}}}),$=()=>{M((k==null?void 0:k.name)||""),I(!1)},X=Q=>{switch(Q){case"owner":return o.jsx(Zhe,{className:"h-4 w-4 text-yellow-400"});case"admin":return o.jsx(V0,{className:"h-4 w-4 text-blue-400"});default:return o.jsx(z0,{className:"h-4 w-4 text-gray-400"})}},Z=Q=>{switch(Q){case"owner":return e("settings.workspace.roles.owner",{defaultValue:"Owner"});case"admin":return e("settings.workspace.roles.admin",{defaultValue:"Admin"});default:return e("settings.workspace.roles.member",{defaultValue:"Member"})}};return t?!k&&a.length===0?o.jsxs("div",{className:"text-center text-white/60 py-8",children:[o.jsx(qs,{className:"h-12 w-12 mx-auto mb-4 text-white/40"}),o.jsx("p",{children:e("settings.workspace.loading.workspaces",{defaultValue:"Loading workspaces..."})})]}):k?o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"flex items-center gap-2 mb-2",children:N?o.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[o.jsx("input",{type:"text",value:D,onChange:Q=>M(Q.target.value),className:"flex-1 px-3 py-1 bg-white/5 border border-white/20 rounded-md text-white placeholder-white/40 focus:outline-none focus:border-primary/50",placeholder:e("settings.workspace.workspaceName.placeholder",{defaultValue:"Workspace name"}),maxLength:50,autoFocus:!0,onKeyDown:Q=>{Q.key==="Enter"&&J(),Q.key==="Escape"&&$()}}),o.jsx("button",{onClick:J,disabled:O||!D.trim(),className:"p-1 text-green-400 hover:text-green-300 disabled:opacity-50",children:o.jsx(Pr,{className:"h-4 w-4"})}),o.jsx("button",{onClick:$,disabled:O,className:"p-1 text-red-400 hover:text-red-300 disabled:opacity-50",children:o.jsx(ur,{className:"h-4 w-4"})})]}):o.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[o.jsx("h4",{className:"text-lg font-medium text-white",children:k.name}),o.jsx("button",{onClick:()=>I(!0),className:"p-1 text-white/40 hover:text-white/80 transition-colors",title:e("settings.workspace.workspaceName.editTitle",{defaultValue:"Edit workspace name"}),children:o.jsx(ML,{className:"h-4 w-4"})})]})}),o.jsx("p",{className:"text-sm text-white/60",children:k.description||e("settings.workspace.personalWorkspace",{defaultValue:"Personal workspace"})})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"text-sm font-medium text-white",children:((ce=(ne=k.subscription)==null?void 0:ne.planType)==null?void 0:ce.toUpperCase())||"FREE"}),o.jsx("div",{className:"text-xs text-white/60",children:((ie=k.subscription)==null?void 0:ie.creditsRemaining)===-1?e("settings.workspace.unlimitedCredits",{defaultValue:"Unlimited credits"}):e("settings.workspace.creditsRemaining",{defaultValue:"{count} credits remaining",count:((W=k.subscription)==null?void 0:W.creditsRemaining)||0})})]})]})}),B&&o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("h4",{className:"text-lg font-medium text-white flex items-center gap-2",children:[o.jsx(kL,{className:"h-5 w-5"}),e("settings.workspace.teamMembers.title",{defaultValue:"Team Members"})]}),U&&o.jsxs(je,{variant:"outline",size:"sm",onClick:()=>y(!T),className:"flex items-center gap-2",children:[o.jsx(YW,{className:"h-4 w-4"}),e("settings.workspace.teamMembers.inviteMember",{defaultValue:"Invite Member"})]})]}),T&&U&&o.jsxs("form",{onSubmit:j,className:"bg-white/5 border border-white/10 rounded-lg p-4 mb-4",children:[o.jsx("h5",{className:"text-sm font-medium text-white mb-3",children:e("settings.workspace.inviteForm.title",{defaultValue:"Invite New Member"})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs font-medium text-white/80 mb-1",children:e("settings.workspace.inviteForm.emailLabel",{defaultValue:"Email Address"})}),o.jsx("input",{type:"email",value:b,onChange:Q=>x(Q.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/20 rounded-md text-white placeholder-white/40 focus:outline-none focus:border-primary/50",placeholder:e("settings.workspace.inviteForm.emailPlaceholder",{defaultValue:"Enter email address"}),required:!0})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-xs font-medium text-white/80 mb-1",children:e("settings.workspace.inviteForm.roleLabel",{defaultValue:"Role"})}),o.jsxs("select",{value:R,onChange:Q=>A(Q.target.value),className:"w-full px-3 py-2 bg-white/5 border border-white/20 rounded-md text-white focus:outline-none focus:border-primary/50",children:[o.jsx("option",{value:"member",children:e("settings.workspace.roles.member",{defaultValue:"Member"})}),o.jsx("option",{value:"admin",children:e("settings.workspace.roles.admin",{defaultValue:"Admin"})})]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(je,{type:"submit",variant:"primary",size:"sm",disabled:w,children:w?e("settings.workspace.inviteForm.sending",{defaultValue:"Sending..."}):e("settings.workspace.inviteForm.sendInvite",{defaultValue:"Send Invite"})}),o.jsx(je,{type:"button",variant:"ghost",size:"sm",onClick:()=>y(!1),children:e("settings.workspace.inviteForm.cancel",{defaultValue:"Cancel"})})]})]})]}),i?o.jsx("div",{className:"text-center text-white/60 py-4",children:e("settings.workspace.loading.members",{defaultValue:"Loading members..."})}):o.jsx("div",{className:"space-y-2",children:s.map(Q=>{var se,z,xe,le,pe;return o.jsxs("div",{className:"flex items-center justify-between p-3 bg-white/5 border border-white/10 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"h-8 w-8 bg-primary rounded-full flex items-center justify-center text-xs font-medium text-white",children:((z=(se=Q.user)==null?void 0:se.name)==null?void 0:z.charAt(0))||((xe=Q.user)==null?void 0:xe.email.charAt(0))||"?"}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-white",children:((le=Q.user)==null?void 0:le.name)||e("settings.workspace.unknownUser",{defaultValue:"Unknown User"})}),o.jsxs("div",{className:"text-xs text-white/60 flex items-center gap-2",children:[o.jsx(OL,{className:"h-3 w-3"}),((pe=Q.user)==null?void 0:pe.email)||Q.inviteEmail]})]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[X(Q.role),o.jsx("span",{className:"text-white/80",children:Z(Q.role)})]}),U&&Q.role!=="owner"&&Q.userId!==(t==null?void 0:t.id)&&o.jsxs("div",{className:"flex items-center gap-1",children:[F==="owner"&&o.jsxs("select",{value:Q.role,onChange:_e=>K(Q.id,_e.target.value),className:"text-xs bg-white/5 border border-white/20 rounded px-2 py-1 text-white",children:[o.jsx("option",{value:"member",children:e("settings.workspace.roles.member",{defaultValue:"Member"})}),o.jsx("option",{value:"admin",children:e("settings.workspace.roles.admin",{defaultValue:"Admin"})})]}),o.jsx(je,{variant:"ghost",size:"sm",onClick:()=>G(Q.id),className:"h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-500/10",children:o.jsx(Hl,{className:"h-3 w-3"})})]})]})]},Q.id)})})]})]}):o.jsxs("div",{className:"text-center text-white/60 py-8",children:[o.jsx(qs,{className:"h-12 w-12 mx-auto mb-4 text-white/40"}),o.jsx("p",{children:e("settings.workspace.noWorkspace",{defaultValue:"No workspace found. Please create a workspace or contact support."})})]}):o.jsxs("div",{className:"text-center text-white/60 py-8",children:[o.jsx(qs,{className:"h-12 w-12 mx-auto mb-4 text-white/40"}),o.jsx("p",{children:e("settings.workspace.loading.userData",{defaultValue:"Loading user data..."})})]})};class hGe{getRemainingCredits(){return H(this,null,function*(){return yield xt.get("/credits/remaining")})}estimateCredits(t,n,r){return H(this,null,function*(){return yield xt.post("/credits/estimate",{modelId:t,inputTokens:n,outputTokens:r})})}checkCredits(t){return H(this,null,function*(){return yield xt.post("/credits/check",{estimatedCredits:t})})}getUsageHistory(t=50,n=0){return H(this,null,function*(){return yield xt.get("/credits/usage?limit=".concat(t,"&offset=").concat(n))})}getUsageStats(){return H(this,null,function*(){return yield xt.get("/credits/stats")})}checkAIRequest(t,n){return H(this,null,function*(){return yield xt.post("/ai/chat/completions/check",{model:t,messages:n},{headers:{}})})}}const ep=new hGe,BZ=()=>{const[e,t]=v.useState(-1),[n,r]=v.useState(null),[a,s]=v.useState([]),[i,l]=v.useState(!1),[c,u]=v.useState(null),{isAuthenticated:h}=ea(),m=v.useCallback(()=>H(null,null,function*(){if(h)try{l(!0);const x=yield ep.getRemainingCredits();t(x.creditsRemaining),u(null)}catch(x){u("Failed to fetch credits")}finally{l(!1)}}),[h]),p=v.useCallback(()=>H(null,null,function*(){if(h)try{const x=yield ep.getUsageStats();r(x)}catch(x){}}),[h]),g=v.useCallback((x=50,R=0)=>H(null,null,function*(){if(h)try{const A=yield ep.getUsageHistory(x,R);s(A.usages)}catch(A){}}),[h]),T=v.useCallback((x,R,A)=>H(null,null,function*(){try{return(yield ep.estimateCredits(x,R,A)).estimatedCredits}catch(w){return 0}}),[]),y=v.useCallback(x=>H(null,null,function*(){try{return(yield ep.checkCredits(x)).hasCredits}catch(R){return!1}}),[]),b=v.useCallback(()=>H(null,null,function*(){yield m()}),[m]);return v.useEffect(()=>{h&&(m(),p())},[h,m,p]),{creditsRemaining:e,stats:n,usageHistory:a,isLoading:i,error:c,fetchCreditsRemaining:m,fetchStats:p,fetchUsageHistory:g,estimateCredits:T,checkCredits:y,refreshCredits:b}},fGe={datakit:{name:"DataKit Model",icon:o.jsx(o.Fragment,{}),color:"primary",bgGradient:"from-blue-500/20 to-purple-500/20",borderGradient:"from-blue-500/40 to-purple-500/40",description:"Optimized AI models for data analysis",helpText:"DataKit model uses your credits and provides optimized prompts for data analysis tasks.",keyFormat:null,websiteUrl:null,models:["DataKit Smart (Claude 3.5 Sonnet)","DataKit Fast (Claude 3.5 Haiku)"],features:["Optimized for data analysis","No API key required","Uses workspace credits"]},openai:{name:"OpenAI",icon:o.jsx("img",{src:bS,className:"h-5 w-5",alt:"OpenAI"}),color:"green",bgGradient:"from-green-500/20 to-emerald-500/20",borderGradient:"from-green-500/40 to-emerald-500/40",description:"Industry-leading GPT models",helpText:"Most capable models for complex reasoning and analysis. Perfect for sophisticated data insights and advanced analytics.",keyFormat:"sk-...",websiteUrl:"https://platform.openai.com/api-keys",models:["GPT-4o","GPT-4o Mini"],features:["Advanced reasoning","Large context window","$5 free credits"]},anthropic:{name:"Anthropic",icon:o.jsx("img",{src:ac,className:"h-4 w-4",alt:"Anthropic"}),color:"orange",bgGradient:"from-orange-500/20 to-amber-500/20",borderGradient:"from-orange-500/40 to-amber-500/40",description:"Claude models for thoughtful analysis",helpText:"Excellent for detailed explanations and careful analysis. Known for producing well-structured, comprehensive responses.",keyFormat:"sk-ant-...",websiteUrl:"https://console.anthropic.com/",models:["Claude 3.5 Sonnet","Claude 3.5 Haiku"],features:["Detailed explanations","Safety focused","Free trial credits"]},groq:{name:"Groq",icon:o.jsx("img",{src:eP,className:"h-4 w-4",alt:"Groq"}),color:"purple",bgGradient:"from-purple-500/20 to-violet-500/20",borderGradient:"from-purple-500/40 to-violet-500/40",description:"Lightning-fast open source models",helpText:"Blazing fast inference with Llama models. Ideal for rapid prototyping and real-time data exploration.",keyFormat:"gsk_...",websiteUrl:"https://console.groq.com/keys",models:["Llama 3.1 70B","Llama 3.1 8B"],features:["Ultra-fast inference","Open source models","Completely free"]}},mGe=({onTabChange:e})=>{var N,I;const{t}=Ze(),{currentWorkspace:n}=qh(),{apiKeys:r,activeProvider:a,autoExecuteSQL:s,setActiveProvider:i,setApiKey:l,updateSettings:c}=ys(),{creditsRemaining:u,isLoading:h}=BZ(),m=xi(),[p,g]=v.useState(new Map),[T,y]=v.useState(null),b=((N=n==null?void 0:n.subscription)==null?void 0:N.planType)==="pro"||((I=n==null?void 0:n.subscription)==null?void 0:I.planType)==="team",x=()=>{e?e("subscription"):m("/settings#subscription")},R=D=>D===-1?t("settings.ai.unlimited",{defaultValue:"Unlimited"}):D.toLocaleString();v.useEffect(()=>{const D=new Map;for(const[M,O]of r)D.set(M,O);g(D)},[r]);const A=(D,M)=>{g(new Map(p.set(D,M)))},w=D=>{const M=p.get(D);M!=null&&M.trim()&&(l(D,M.trim()),i(D))},_=D=>D.length<=12?"•".repeat(D.length):D.slice(0,6)+"•".repeat(20)+D.slice(-4);return o.jsxs("div",{className:"p-6 space-y-8",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx("img",{src:ac,className:"h-4 w-4",alt:"Anthropic"}),o.jsx("div",{className:"text-white",children:"DataKit Models"})]}),o.jsx("div",{className:"text-white/60 text-sm mb-3",children:"DataKit Smart (Claude 4.5 Sonnet) & DataKit Fast (Claude 4 Sonnert)"}),o.jsxs("div",{className:"text-white/50 text-sm",children:[!h&&(u===-1?"Unlimited credits":"".concat(R(u)," of 300 credits")),!b&&o.jsx("div",{className:"mt-1",children:o.jsx("button",{onClick:x,className:"text-white/60 text-sm hover:text-white underline",children:"Upgrade for unlimited"})})]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-white mb-4",children:"Providers"}),o.jsx("div",{className:"space-y-3",children:["openai","anthropic","groq"].map(D=>{var G;const M=fGe[D],O=a===D,L=r.has(D)&&!!r.get(D),k=T===D,F=()=>{y(D),g(new Map(p.set(D,r.get(D)||"")))},U=()=>{const K=p.get(D);K!=null&&K.trim()&&(l(D,K.trim()),i(D)),y(null)},B=()=>{g(new Map(p.set(D,r.get(D)||""))),y(null)},j=()=>{L&&i(D)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-white/80 text-sm",children:M.name}),O&&o.jsx("span",{className:"text-white/40 text-xs",children:"active"})]}),M.websiteUrl&&o.jsx("button",{onClick:K=>{K.stopPropagation(),window.open(M.websiteUrl,"_blank")},className:"text-white/40 hover:text-white/80 text-xs underline",children:t("settings.ai.providers.getApiKey",{defaultValue:"Get key"})})]}),L&&!k?o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-xs font-mono text-white/40 truncate",children:_(r.get(D)||"")}),o.jsxs("div",{className:"flex gap-2 text-xs",children:[o.jsx("button",{onClick:K=>{K.stopPropagation(),j()},className:"text-white/60 hover:text-white ".concat(O?"underline":""),children:O?"Active":"Use"}),o.jsx("button",{onClick:K=>{K.stopPropagation(),F()},className:"text-white/40 hover:text-white/60",children:t("settings.ai.providers.edit",{defaultValue:"Edit"})})]})]}):k?o.jsxs("div",{className:"space-y-2",children:[o.jsx("input",{type:"password",value:p.get(D)||"",onChange:K=>A(D,K.target.value),placeholder:"".concat(M.keyFormat||"API key"),className:"w-full px-2 py-1 bg-transparent border-b border-white/20 text-white text-sm placeholder-white/40 focus:outline-none focus:border-white/50",autoFocus:!0}),o.jsxs("div",{className:"flex gap-2 text-xs",children:[o.jsx("button",{onClick:K=>{K.stopPropagation(),U()},className:"text-white/60 hover:text-white underline",children:t("settings.ai.providers.save",{defaultValue:"Save"})}),o.jsx("button",{onClick:K=>{K.stopPropagation(),B()},className:"text-white/40 hover:text-white/60",children:"Cancel"})]})]}):o.jsxs("div",{className:"space-y-2",children:[o.jsx("input",{type:"password",value:p.get(D)||"",onChange:K=>A(D,K.target.value),placeholder:"".concat(M.keyFormat||"API key"),className:"w-full px-2 py-1 bg-transparent border-b border-white/20 text-white text-sm placeholder-white/40 focus:outline-none focus:border-white/50"}),o.jsx("button",{onClick:K=>{K.stopPropagation(),w(D)},disabled:!((G=p.get(D))!=null&&G.trim()),className:"text-white/60 hover:text-white text-xs underline disabled:opacity-30 disabled:cursor-not-allowed",children:"Save"})]})]},D)})})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-white mb-4",children:"Settings"}),o.jsx("div",{className:"space-y-3",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-white text-sm",children:"Auto-execute SQL"}),o.jsx("div",{className:"text-white/50 text-xs",children:"Automatically run AI-generated SQL queries"})]}),o.jsx("button",{onClick:()=>c({autoExecuteSQL:!s}),className:"relative inline-flex h-4 w-7 items-center rounded-full transition-colors ".concat(s?"bg-white/30":"bg-white/10"),children:o.jsx("span",{className:"inline-block h-3 w-3 transform rounded-full bg-white transition-transform ".concat(s?"translate-x-4":"translate-x-0.5")})})]})})]})]})},pGe=({variant:e="default"})=>{const{i18n:t,t:n}=Ze(),[r,a]=v.useState(!1),s=v.useRef(null),[i,l]=v.useState(null),c=[{code:"en",name:"English",nativeName:"English",flag:"🇺🇸"},{code:"pt",name:"Portuguese",nativeName:"Português",flag:"🇧🇷"}],u=c.find(g=>g.code===t.language)||c[0],h=()=>{e==="sidebar"&&s.current&&l(s.current.getBoundingClientRect()),a(!r)},m=g=>{t.changeLanguage(g),a(!1)},p=()=>o.jsx(At,{children:r&&o.jsxs(o.Fragment,{children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 z-40",onClick:()=>a(!1)}),o.jsx(me.div,{initial:{opacity:0,scale:.95,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:8},transition:{type:"spring",stiffness:400,damping:25,duration:.2},className:"fixed p-3 bg-black/95 backdrop-blur-xl border border-white/10 rounded-xl shadow-2xl z-50 min-w-[180px]",style:{top:e==="sidebar"&&i?i.top-100:void 0,left:e==="sidebar"&&i?Math.min(i.left-60,window.innerWidth-200):void 0},children:o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[o.jsx(H5,{size:12,className:"text-white/40"}),o.jsx("span",{className:"text-xs font-medium text-white/60 uppercase tracking-wide",children:"Language"})]}),o.jsx("div",{className:"space-y-0.5",children:c.map(g=>o.jsxs(me.button,{whileHover:{scale:1.02,x:2},whileTap:{scale:.98},className:"w-full flex items-center justify-between p-2.5 rounded-lg text-left transition-all duration-200 group ".concat(u.code===g.code?"bg-primary/15 text-white border border-primary/25 shadow-sm":"text-white/75 hover:text-white hover:bg-white/5 border border-transparent hover:border-white/10"),onClick:()=>m(g.code),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-xl filter drop-shadow-sm",children:g.flag}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium ".concat(u.code===g.code?"text-white":"text-white/90"),children:g.name}),o.jsx("span",{className:"text-xs text-white/40",children:g.nativeName})]})]}),u.code===g.code&&o.jsx(me.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:25},children:o.jsx(Pr,{size:12,className:"text-primary"})})]},g.code))})]})})]})});return e==="sidebar"?o.jsxs("div",{className:"relative flex items-center",children:[o.jsx(Ut,{content:"Language: ".concat(u.nativeName),placement:"top",children:o.jsxs(me.button,{ref:s,whileHover:{scale:1.05},whileTap:{scale:.95},className:"flex items-center gap-1 p-2 rounded-lg text-white/70 hover:text-white hover:bg-white/5 transition-all duration-200",onClick:h,children:[o.jsx("span",{className:"text-lg filter drop-shadow-sm",children:u.flag}),o.jsx(br,{size:10,className:"text-white/40 transition-transform duration-200 ".concat(r?"rotate-180":"")})]})}),typeof document!="undefined"&&Gh.createPortal(p(),document.body)]}):o.jsxs("div",{className:"relative flex items-center",children:[o.jsxs(je,{ref:s,variant:"ghost",size:"sm",onClick:h,className:"flex items-center gap-2 px-3 py-2 h-auto text-white/80 hover:text-white hover:bg-white/5 border border-transparent hover:border-white/10 transition-all duration-200",children:[o.jsx("span",{className:"text-lg filter drop-shadow-sm",children:u.flag}),o.jsx("span",{className:"text-xs font-medium",children:u.name}),o.jsx(br,{size:12,className:"text-white/40 transition-transform duration-200 ".concat(r?"rotate-180":"")})]}),o.jsx(At,{children:r&&o.jsxs(o.Fragment,{children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"fixed inset-0 z-40",onClick:()=>a(!1)}),o.jsx(me.div,{initial:{opacity:0,scale:.95,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:8},transition:{type:"spring",stiffness:400,damping:25,duration:.2},className:"absolute bottom-full left-0 mb-2 p-3 bg-black/95 backdrop-blur-xl border border-white/10 rounded-xl shadow-2xl z-50 min-w-[180px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[o.jsx(H5,{size:12,className:"text-white/40"}),o.jsx("span",{className:"text-xs font-medium text-white/60 uppercase tracking-wide",children:"Language"})]}),o.jsx("div",{className:"space-y-0.5",children:c.map(g=>o.jsxs(me.button,{whileHover:{scale:1.02,x:2},whileTap:{scale:.98},className:"w-full flex items-center justify-between p-2.5 rounded-lg text-left transition-all duration-200 group ".concat(u.code===g.code?"bg-primary/15 text-white border border-primary/25 shadow-sm":"text-white/75 hover:text-white hover:bg-white/5 border border-transparent hover:border-white/10"),onClick:()=>m(g.code),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"text-xl filter drop-shadow-sm",children:g.flag}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium ".concat(u.code===g.code?"text-white":"text-white/90"),children:g.name}),o.jsx("span",{className:"text-xs text-white/40",children:g.nativeName})]})]}),u.code===g.code&&o.jsx(me.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:500,damping:25},children:o.jsx(Pr,{size:12,className:"text-primary"})})]},g.code))})]})})]})})]})},gGe=()=>{const{t:e}=Ze(),[t,n]=v.useState("#00B8A9");v.useEffect(()=>{const s=localStorage.getItem("theme-primary-color");s&&n(s)},[]),v.useEffect(()=>{const s=l=>{l.key==="theme-primary-color"&&l.newValue&&n(l.newValue)};window.addEventListener("storage",s);const i=setInterval(()=>{const l=localStorage.getItem("theme-primary-color");l&&l!==t&&n(l)},100);return()=>{window.removeEventListener("storage",s),clearInterval(i)}},[t]);const r=[{name:e("settings.appearance.themes.datakitTeal"),color:"#00B8A9"},{name:e("settings.appearance.themes.oceanBlue"),color:"#3498db"},{name:e("settings.appearance.themes.royalPurple"),color:"#9b59b6"},{name:e("settings.appearance.themes.vibrantRed"),color:"#e74c3c"},{name:e("settings.appearance.themes.forestGreen"),color:"#2ecc71"},{name:e("settings.appearance.themes.coralPink"),color:"#ff6b6b"}],a=s=>{n(s),$L(s),localStorage.setItem("theme-primary-color",s)};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-white mb-1",children:e("settings.appearance.title")}),o.jsx("p",{className:"text-sm text-white/60",children:e("settings.appearance.description")})]}),o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-4",children:[o.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-6 h-6 rounded-md border border-white/30",style:{backgroundColor:t}}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-white",children:e("settings.appearance.current")}),o.jsx("div",{className:"text-xs text-white/60",children:t.toUpperCase()})]})]}),o.jsx("div",{className:"flex items-center gap-2",children:o.jsx(pGe,{})})]}),o.jsx("div",{className:"grid grid-cols-3 gap-2",children:r.map(s=>o.jsx("button",{onClick:()=>a(s.color),className:"p-2 rounded-md border transition-all text-left hover:border-white/30 ".concat(t===s.color?"bg-white/10 border-primary/50":"bg-white/5 border-white/10"),children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded-sm border border-white/30 flex-shrink-0",style:{backgroundColor:s.color}}),o.jsx("div",{className:"text-xs text-white truncate",children:s.name})]})},s.color))})]}),o.jsx("div",{className:"border-t border-white/10 pt-4",children:o.jsxs("div",{className:"opacity-50 cursor-not-allowed",children:[o.jsxs("h4",{className:"text-sm font-medium text-white/60 mb-2 flex items-center gap-2",children:[o.jsx(z5,{className:"h-4 w-4"}),e("settings.appearance.displayMode")]}),o.jsx("p",{className:"text-xs text-white/40 mb-3",children:e("common.comingSoon")}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"p-2 rounded-md bg-white/5 border border-white/10 text-center",children:[o.jsx(z5,{className:"h-4 w-4 mx-auto mb-1 text-white/40"}),o.jsx("div",{className:"text-xs text-white/40",children:e("settings.appearance.modes.system")})]}),o.jsxs("div",{className:"p-2 rounded-md bg-white/5 border border-white/10 text-center",children:[o.jsx(wme,{className:"h-4 w-4 mx-auto mb-1 text-white/40"}),o.jsx("div",{className:"text-xs text-white/40",children:e("settings.appearance.modes.light")})]}),o.jsxs("div",{className:"p-2 rounded-md bg-white/10 border border-primary/30 text-center",children:[o.jsx(Zfe,{className:"h-4 w-4 mx-auto mb-1 text-primary/60"}),o.jsx("div",{className:"text-xs text-primary/60",children:e("settings.appearance.modes.dark")})]})]})]})})]})},EGe=({width:e="500px",height:t="500px",background:n="#000",borderRadius:r="10px",borderColor:a="#333",children:s,glareColor:i="#ffffff",glareOpacity:l=.5,glareAngle:c=-45,glareSize:u=250,transitionDuration:h=650,playOnce:m=!1,className:p="",style:g={}})=>{const T=i.replace("#","");let y=i;if(/^[\dA-Fa-f]{6}$/.test(T)){const w=parseInt(T.slice(0,2),16),_=parseInt(T.slice(2,4),16),N=parseInt(T.slice(4,6),16);y="rgba(".concat(w,", ").concat(_,", ").concat(N,", ").concat(l,")")}else if(/^[\dA-Fa-f]{3}$/.test(T)){const w=parseInt(T[0]+T[0],16),_=parseInt(T[1]+T[1],16),N=parseInt(T[2]+T[2],16);y="rgba(".concat(w,", ").concat(_,", ").concat(N,", ").concat(l,")")}const b=v.useRef(null),x=()=>{const w=b.current;w&&(w.style.transition="none",w.style.backgroundPosition="-100% -100%, 0 0",w.offsetHeight,w.style.transition="".concat(h,"ms ease"),w.style.backgroundPosition="100% 100%, 0 0")},R=()=>{const w=b.current;w&&(m?(w.style.transition="none",w.style.backgroundPosition="-100% -100%, 0 0"):(w.style.transition="".concat(h,"ms ease"),w.style.backgroundPosition="-100% -100%, 0 0"))},A={position:"absolute",inset:0,background:"linear-gradient(".concat(c,"deg,\n        hsla(0,0%,0%,0) 60%,\n        ").concat(y," 70%,\n        hsla(0,0%,0%,0) 100%)"),backgroundSize:"".concat(u,"% ").concat(u,"%, 100% 100%"),backgroundRepeat:"no-repeat",backgroundPosition:"-100% -100%, 0 0",pointerEvents:"none"};return o.jsxs("div",{className:"relative grid place-items-center overflow-hidden border cursor-pointer ".concat(p),style:q({width:e,height:t,background:n,borderRadius:r,borderColor:a},g),onMouseEnter:x,onMouseLeave:R,children:[o.jsx("div",{ref:b,style:A}),s]})},TGe=({title:e,price:t,period:n,description:r,features:a,isCurrentPlan:s=!1,isComingSoon:i=!1,isEarlyAdopter:l=!1,icon:c,onSelect:u})=>{const{t:h}=Ze(),m=o.jsxs("div",{className:"h-full flex flex-col p-4 relative",children:[o.jsxs("div",{className:"text-center mb-4",children:[o.jsxs("div",{className:"flex items-center justify-center mb-2",children:[c&&o.jsx("div",{className:"mr-2 text-primary",children:c}),o.jsx("h3",{className:"text-lg font-bold text-white",children:e})]}),o.jsxs("div",{className:"mb-2",children:[o.jsx("span",{className:"text-2xl font-bold text-white",children:typeof t=="string"?t:"$".concat(t)}),n&&o.jsxs("span",{className:"text-white/60 ml-1",children:["/",n]})]}),o.jsx("p",{className:"text-xs text-white/70",children:r})]}),o.jsx("div",{className:"flex-1",children:o.jsxs("ul",{className:"space-y-2",children:[a.slice(0,4).map((p,g)=>o.jsxs("li",{className:"flex items-start",children:[o.jsx(Pr,{className:"h-3 w-3 text-primary mt-0.5 mr-2 flex-shrink-0"}),o.jsx("span",{className:"text-xs text-white/80",children:p})]},g)),a.length>4&&o.jsx("li",{className:"text-xs text-white/60 ml-5",children:h("settings.subscription.moreFeatures",{defaultValue:"+{count} more features",count:a.length-4})})]})})]});return o.jsxs("div",{className:"relative",children:[l&&!i&&o.jsx("div",{className:"absolute -top-4 -left-2 bg-gradient-to-r from-purple-600 to-pink-600 text-white text-xs font-medium px-3 py-1 rounded-full z-30 shadow-lg",children:h("settings.subscription.badges.earlyAdopter",{defaultValue:"Early Adopter: 20% OFF"})}),i&&e!=="Pro"&&o.jsx("div",{className:"absolute -top-4 -right-2 bg-gradient-to-r from-sky-800 to-green-800 text-white text-xs font-medium px-3 py-1 rounded-full z-30 shadow-lg",children:h("settings.subscription.badges.comingSoon",{defaultValue:"Coming Soon"})}),e==="Pro"&&i&&o.jsxs("div",{className:"absolute -top-4 -right-2 bg-gradient-to-r from-sky-600 via-sky-700 to-cyan-700 text-white text-xs font-medium px-3 py-1 rounded-full z-30 shadow-lg flex items-center gap-1",children:[o.jsx("img",{src:ac,className:"h-3 w-3",alt:"Anthropic"}),o.jsx("span",{children:h("settings.subscription.badges.moreCredits",{defaultValue:"More credits soon!"})})]}),s&&o.jsx("div",{className:"absolute -top-4 left-1/2 transform -translate-x-1/2 bg-gradient-to-r from-primary to-primary/80 text-white text-xs font-medium px-4 py-1 rounded-full z-30 shadow-lg",children:h("settings.subscription.badges.currentPlan",{defaultValue:"Current Plan"})}),o.jsx(EGe,{width:"100%",height:"100%",background:"linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%)",borderRadius:"12px",borderColor:s?"rgba(var(--primary), 0.5)":l?"rgba(168, 85, 247, 0.5)":"rgba(255,255,255,0.1)",glareColor:"#ffffff",glareOpacity:.15,glareAngle:-30,glareSize:300,transitionDuration:800,className:"\n          transition-all duration-300 hover:scale-[1.02] hover:shadow-xl\n          ".concat(s?"shadow-lg shadow-primary/20":"","\n          ").concat(i?"opacity-75":"","\n          ").concat(l?"shadow-lg shadow-purple-500/20":"","\n          h-full\n        "),style:{borderWidth:"1px",borderStyle:"solid"},children:m})]})},yGe=()=>{var y,b,x,R;const{t:e}=Ze(),{user:t}=ea(),{creditsRemaining:n}=BZ(),{showSuccess:r}=ec(),[a,s]=v.useState(!1),[i,l]=v.useState(""),[c,u]=v.useState(!1),h=((y=t==null?void 0:t.subscription)==null?void 0:y.planType)||"free",m=[{title:e("settings.subscription.plans.free.title",{defaultValue:"Free"}),price:0,period:e("settings.subscription.plans.period.month",{defaultValue:"month"}),description:e("settings.subscription.plans.free.description",{defaultValue:"Perfect for getting started"}),features:[e("settings.subscription.plans.free.features.credits",{defaultValue:"315 credits per month"}),e("settings.subscription.plans.free.features.anthropicModels",{defaultValue:"Powered by Anthropic models"}),e("settings.subscription.plans.free.features.personalWorkspace",{defaultValue:"Personal workspace"}),e("settings.subscription.plans.free.features.basicAnalysis",{defaultValue:"Basic data analysis"}),e("settings.subscription.plans.free.features.communitySupport",{defaultValue:"Community support"})],isCurrentPlan:h==="free",icon:o.jsx(o.Fragment,{})},{title:e("settings.subscription.plans.pro.title",{defaultValue:"Pro"}),price:19,period:e("settings.subscription.plans.period.month",{defaultValue:"month"}),description:e("settings.subscription.plans.pro.description",{defaultValue:"With more Anthropic credits"}),features:[e("settings.subscription.plans.pro.features.credits",{defaultValue:"1500 credits per month"}),e("settings.subscription.plans.pro.features.advancedAnalytics",{defaultValue:"Advanced analytics"}),e("settings.subscription.plans.pro.features.prioritySupport",{defaultValue:"Priority support"}),e("settings.subscription.plans.pro.features.exportCapabilities",{defaultValue:"More export capabilities"}),e("settings.subscription.plans.pro.features.advancedIntegrations",{defaultValue:"Advanced integrations"})],isCurrentPlan:h==="pro",isPopular:!0,isComingSoon:!0,icon:o.jsx("img",{src:ac,className:"h-4 w-4",alt:"Anthropic"})},{title:e("settings.subscription.plans.team.title",{defaultValue:"Team"}),price:e("settings.subscription.plans.team.price",{defaultValue:"Custom"}),description:e("settings.subscription.plans.team.description",{defaultValue:"For growing teams"}),features:[e("settings.subscription.plans.team.features.unlimitedCredits",{defaultValue:"Unlimited credits"}),e("settings.subscription.plans.team.features.teamCollaboration",{defaultValue:"Team collaboration"}),e("settings.subscription.plans.team.features.multipleWorkspaces",{defaultValue:"Multiple Workspaces"}),e("settings.subscription.plans.team.features.memberManagement",{defaultValue:"Member management"}),e("settings.subscription.plans.team.features.premiumSupport",{defaultValue:"Premium support"}),e("settings.subscription.plans.team.features.customIntegrations",{defaultValue:"Custom integrations"}),e("settings.subscription.plans.team.features.advancedSecurity",{defaultValue:"Advanced security"}),e("settings.subscription.plans.team.features.accountManager",{defaultValue:"Dedicated account manager"})],isCurrentPlan:h==="team",isComingSoon:!0,icon:o.jsx(o.Fragment,{})}],p=A=>{},g=A=>H(null,null,function*(){if(!(t!=null&&t.email)&&!i){u(!0);return}s(!0);try{const w=(t==null?void 0:t.email)||i;yield ty.joinWaitlist(w,A),r(e("settings.subscription.waitlist.successTitle",{defaultValue:"You're on the waitlist!"}),e("settings.subscription.waitlist.successMessage",{defaultValue:"We'll let you know at ".concat(w," when ").concat(A," features roll out.")})),u(!1),l("")}catch(w){alert(e("settings.subscription.waitlist.error",{defaultValue:"Something went wrong. Please try again."}))}finally{s(!1)}}),T=()=>{i&&g("Pro")};return o.jsxs("div",{className:"h-full flex flex-col max-w-7xl mx-auto",children:[o.jsxs("div",{className:"mb-6",children:[o.jsx("h2",{className:"text-xl font-bold text-white mb-1",children:e("settings.subscription.title",{defaultValue:"Subscription Plans"})}),o.jsx("p",{className:"text-sm text-white/70",children:e("settings.subscription.description",{defaultValue:"Choose the plan that fits your needs"})})]}),o.jsxs("div",{className:"flex-1 grid grid-cols-1 lg:grid-cols-4 gap-6 min-h-0",children:[o.jsx("div",{className:"lg:col-span-1 lg:mr-4",children:o.jsxs("div",{className:"bg-gradient-to-br from-white/5 to-white/[0.02] border border-white/10 rounded-xl p-4 h-full",children:[o.jsx("h3",{className:"text-sm font-semibold text-white mb-4",children:e("settings.subscription.currentUsage.title",{defaultValue:"Current Usage"})}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-3 text-center",children:[o.jsx("div",{className:"text-xl font-bold text-primary",children:n===-1?"∞":Number(n).toFixed(2)||0}),o.jsx("div",{className:"text-xs text-white/60",children:e("settings.subscription.currentUsage.creditsRemaining",{defaultValue:"Credits Remaining"})})]}),o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-3 text-center",children:[o.jsx("div",{className:"text-xl font-bold text-white",children:((x=(b=t==null?void 0:t.subscription)==null?void 0:b.planType)==null?void 0:x.toUpperCase())||"FREE"}),o.jsx("div",{className:"text-xs text-white/60",children:e("settings.subscription.currentUsage.currentPlan",{defaultValue:"Current Plan"})})]}),o.jsxs("div",{className:"bg-white/5 border border-white/10 rounded-lg p-3 text-center",children:[o.jsx("div",{className:"text-sm font-bold text-white",children:(R=t==null?void 0:t.subscription)!=null&&R.creditsResetAt?new Date(t.subscription.creditsResetAt).toLocaleDateString("en-US",{month:"short",day:"numeric"}):"N/A"}),o.jsx("div",{className:"text-xs text-white/60",children:e("settings.subscription.currentUsage.nextReset",{defaultValue:"Next Reset"})})]})]})]})}),o.jsx("div",{className:"lg:col-span-3",children:o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 h-full",children:m.map((A,w)=>o.jsxs("div",{className:"flex flex-col",children:[o.jsx(TGe,{title:A.title,price:A.price,period:A.period,description:A.description,features:A.features,isCurrentPlan:A.isCurrentPlan,isPopular:A.isPopular,isComingSoon:A.isComingSoon,isEarlyAdopter:A.isEarlyAdopter,icon:A.icon,onSelect:()=>p(A.title)}),o.jsx("div",{className:"flex justify-center mt-4 pb-1",children:A.isComingSoon?o.jsxs("button",{onClick:()=>g(A.title),disabled:a,className:"group flex items-center gap-2 bg-primary/10 hover:bg-primary/20 border border-primary/30 hover:border-primary/50 text-primary font-medium text-sm px-4 py-2 rounded-full transition-all duration-200 hover:scale-105 disabled:opacity-50 shadow-sm hover:shadow-md",children:[o.jsx(PW,{className:"h-4 w-4 group-hover:animate-pulse"}),a?e("settings.subscription.waitlist.joining",{defaultValue:"Joining..."}):e("settings.subscription.waitlist.getNotified",{defaultValue:"Get notified"})]}):o.jsx("div",{className:"h-10"})})]},w))})})]}),c&&o.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:o.jsxs("div",{className:"bg-gray-900 border border-white/10 rounded-xl p-6 max-w-md w-full mx-4",children:[o.jsx("h3",{className:"text-lg font-bold text-white mb-4",children:e("settings.subscription.waitlist.modalTitle",{defaultValue:"Join Waitlist"})}),o.jsx("p",{className:"text-white/70 text-sm mb-4",children:e("settings.subscription.waitlist.modalDescription",{defaultValue:"Enter your email to get notified when Pro features are released."})}),o.jsx("input",{type:"email",value:i,onChange:A=>l(A.target.value),placeholder:e("settings.subscription.waitlist.emailPlaceholder",{defaultValue:"your.email@example.com"}),className:"w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-white text-sm mb-4 focus:outline-none focus:border-primary"}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx("button",{onClick:()=>u(!1),className:"flex-1 bg-white/5 border border-white/10 text-white text-sm py-2 rounded-lg hover:bg-white/10 transition-colors",children:e("settings.subscription.waitlist.cancel",{defaultValue:"Cancel"})}),o.jsx("button",{onClick:T,disabled:!i||a,className:"flex-1 bg-primary text-white text-sm py-2 rounded-lg hover:bg-primary/90 transition-colors disabled:opacity-50",children:a?e("settings.subscription.waitlist.joining",{defaultValue:"Joining..."}):e("settings.subscription.waitlist.joinWaitlist",{defaultValue:"Join Waitlist"})})]})]})})]})},xGe=()=>{var w,_;const{t:e}=Ze(),{user:t,updateProfile:n,updateSettings:r,settings:a,isLoading:s}=ea(),{currentWorkspace:i}=qh(),l=Iu(),c=xi(),u=()=>{const N=l.hash.replace("#","");return["profile","workspace","ai","appearance","notifications","subscription"].includes(N)?N:"profile"},[h,m]=v.useState(u()),[p,g]=v.useState({name:(t==null?void 0:t.name)||"",email:(t==null?void 0:t.email)||""}),[T,y]=v.useState({defaultAIProvider:(a==null?void 0:a.defaultAIProvider)||"openai",defaultModel:(a==null?void 0:a.defaultModel)||"gpt-4",theme:(a==null?void 0:a.theme)||"dark",emailNotifications:(w=a==null?void 0:a.emailNotifications)!=null?w:!0,usageAlerts:(_=a==null?void 0:a.usageAlerts)!=null?_:!0});v.useEffect(()=>{const N=()=>{const I=u();m(I)};return window.addEventListener("hashchange",N),()=>window.removeEventListener("hashchange",N)},[]);const b=N=>{m(N),c("/settings#".concat(N),{replace:!0})};v.useEffect(()=>{t&&g({name:t.name||"",email:t.email||""})},[t]);const x=N=>H(null,null,function*(){N.preventDefault();try{yield n({name:p.name})}catch(I){}}),R=N=>H(null,null,function*(){N.preventDefault();try{yield r(T)}catch(I){}}),A=()=>{switch(h){case"profile":return o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-white mb-4",children:e("settings.profile.title")}),o.jsxs("form",{onSubmit:x,className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/90 mb-2",children:e("common.labels.fullName")}),o.jsx("input",{type:"text",value:p.name,onChange:N=>g(I=>he(q({},I),{name:N.target.value})),className:"w-full px-3 py-2 bg-background/20 border border-white/20 rounded-md text-white placeholder-white/50 focus:outline-none focus:border-primary focus:ring-1 focus:ring-primary"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-white/90 mb-2",children:e("auth.fields.emailAddress")}),o.jsx("input",{type:"email",value:p.email,disabled:!0,className:"w-full px-3 py-2 bg-background/10 border border-white/10 rounded-md text-white/60 cursor-not-allowed"}),o.jsx("p",{className:"text-xs text-white/50 mt-1",children:e("settings.profile.emailNote")})]}),o.jsx(je,{variant:"outline",type:"submit",disabled:s,children:e(s?"common.loading.saving":"settings.profile.saveChanges")})]})]})});case"workspace":return o.jsx(dGe,{});case"ai":return o.jsx(mGe,{onTabChange:b});case"appearance":return o.jsx(gGe,{});case"notifications":return o.jsx("div",{className:"space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-medium text-white mb-4",children:e("settings.notifications.title")}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-white",children:e("settings.notifications.email.title")}),o.jsx("div",{className:"text-xs text-white/60",children:e("settings.notifications.email.description")})]}),o.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:T.emailNotifications,onChange:N=>y(I=>he(q({},I),{emailNotifications:N.target.checked})),className:"sr-only peer"}),o.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-white",children:e("settings.notifications.usage.title")}),o.jsx("div",{className:"text-xs text-white/60",children:e("settings.notifications.usage.description")})]}),o.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:T.usageAlerts,onChange:N=>y(I=>he(q({},I),{usageAlerts:N.target.checked})),className:"sr-only peer"}),o.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]}),o.jsx(je,{variant:"outline",onClick:R,disabled:s,children:e(s?"common.loading.saving":"settings.notifications.saveSettings")})]})]})});case"subscription":return o.jsx(yGe,{});default:return null}};return o.jsx(lGe,{children:o.jsxs(o.Fragment,{children:[o.jsx(ff,{title:"".concat(e("settings.title")," - ").concat(e("seo.title")),description:e("seo.description"),keywords:e("seo.keywords")}),o.jsxs("div",{className:"flex h-screen bg-background overflow-hidden",children:[o.jsx(cGe,{activeTab:h,onTabChange:b}),o.jsx("div",{className:"flex-1 h-full overflow-hidden flex items-center justify-center",children:o.jsx("div",{className:"w-full max-w-6xl p-8",children:o.jsx("div",{className:"bg-darkNav rounded-lg p-8",children:A()})})})]})]})})},SGe="0.4.20",bGe={version:SGe},vGe=()=>{const{t:e}=Ze(),t=xi(),n=()=>{t("/")};return o.jsxs(o.Fragment,{children:[o.jsx(ff,{title:"".concat(e("info.title")," - ").concat(e("seo.title")),description:e("info.description"),keywords:e("seo.keywords")}),o.jsxs("div",{className:"min-h-screen bg-black text-white",children:[o.jsx("div",{className:"border-b border-white/10 px-6 py-4",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{onClick:n,className:"text-white/70 hover:text-white transition-colors p-2 hover:bg-white/5 rounded",title:e("common.buttons.back"),children:o.jsx(AL,{size:20})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold",children:e("info.title")}),o.jsx("p",{className:"text-white/60 text-sm",children:e("info.subtitle")})]})]})}),o.jsx("div",{className:"container mx-auto px-6 py-12",children:o.jsx("div",{className:"max-w-2xl mx-auto",children:o.jsx(me.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.1},className:"bg-black/50 border border-white/10 rounded-xl p-6 mb-8",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center py-2 border-b border-white/5",children:[o.jsx("span",{className:"text-white/70",children:e("info.version")}),o.jsx("span",{className:"font-mono text-primary",children:bGe.version})]}),o.jsxs("div",{className:"flex justify-between items-center py-2",children:[o.jsx("span",{className:"text-white/70",children:e("info.environment")}),o.jsx("span",{className:"font-mono",children:"production"})]})]})})})})]})]})},AGe=()=>{const{t:e}=Ze(),t=xi();return o.jsxs(o.Fragment,{children:[o.jsx(ff,{title:"".concat(e("notFound.title")," - ").concat(e("seo.title")),description:e("notFound.description")}),o.jsx("div",{className:"min-h-screen bg-black text-white flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx("h1",{className:"text-6xl font-bold text-white/20 mb-4",children:"404"}),o.jsx("h2",{className:"text-2xl font-semibold mb-2",children:e("notFound.title")}),o.jsx("p",{className:"text-white/60 mb-6",children:e("notFound.message")}),o.jsx(je,{variant:"ghost",onClick:()=>t("/"),children:e("notFound.goHome")})]})})]})},RGe=()=>{const e=xi(),{showSuccess:t,showError:n}=ec(),{addFile:r}=ut(),a=l7(),s=v.useCallback(u=>H(null,null,function*(){const{provider:h,organization:m,dataset:p}=u,g="".concat(m,"/").concat(p);try{let T,y;switch(h){case"huggingface":T=yield a.importWithProgressiveFallback(g,{config:u.config,split:u.split,authToken:u.authToken}),y="https://huggingface.co/datasets/".concat(g);break;case"kaggle":throw new Error("Kaggle import not yet implemented");case"github":throw new Error("GitHub import not yet implemented");case"custom":throw new Error("Custom URL import not yet implemented");default:throw new Error("Unsupported provider: ".concat(h))}t("Dataset Import Successful","Successfully imported ".concat(g),{icon:"check",duration:8e3});const b=he(q({},T),{isRemote:!0,remoteProvider:"huggingface",remoteURL:y});r(b)}catch(T){const y=T instanceof Error?T.message:"Failed to import dataset. Please check the dataset ID and try again.";throw n("Dataset Import Failed",y,{icon:"alert-triangle",duration:1e4}),T}}),[t,n,a]),i=v.useCallback((u,h)=>{switch(u){case"huggingface":return"https://huggingface.co/datasets/".concat(h);case"kaggle":return"https://kaggle.com/datasets/".concat(h);case"github":return"https://github.com/".concat(h);default:return"https://".concat(u,".com/datasets/").concat(h)}},[]),l=v.useCallback(u=>H(null,null,function*(){try{yield s(u),e("/")}catch(h){throw e("/"),h}}),[s,e]),c=v.useCallback(u=>{switch(u){case"huggingface":return{isImporting:a.isImporting,importProgress:a.importProgress,importStatus:a.importStatus,error:a.error};default:return{isImporting:!1,importProgress:0,importStatus:"",error:null}}},[a]);return{importDataset:s,importDatasetFromUrl:l,getImportState:c,generateProviderUrl:i}},NGe=()=>{const{importDataset:e,importDatasetFromUrl:t}=RGe(),n=v.useCallback(a=>H(null,null,function*(){const i={provider:a.provider||"huggingface",organization:a.organization,dataset:a.dataset,config:a.config,split:a.split,authToken:a.authToken};return yield e(i)}),[e]),r=v.useCallback(a=>H(null,null,function*(){const i={provider:a.provider||"huggingface",organization:a.organization,dataset:a.dataset,config:a.config,split:a.split,authToken:a.authToken};return yield t(i)}),[t]);return{importFromUrlParams:n,importFromUrlParamsWithNavigation:r}},_Ge=(e,t,n)=>({provider:n.get("provider")||"huggingface",organization:e,dataset:t,config:n.get("config")||void 0,split:n.get("split")||void 0,authToken:n.get("token")||void 0}),wGe=()=>{const{t:e}=Ze(),{organization:t,dataset:n}=Use(),[r]=fie(),{importFromUrlParamsWithNavigation:a}=NGe(),s=v.useRef(!1);return v.useEffect(()=>{H(null,null,function*(){if(!(!t||!n||s.current)){s.current=!0;try{const l=_Ge(t,n,r);yield a({organization:l.organization,dataset:l.dataset,provider:l.provider,config:l.config,split:l.split,authToken:l.authToken})}catch(l){}}})},[t,n]),o.jsx("div",{className:"flex items-center justify-center min-h-screen bg-black",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"flex items-center justify-center mb-4",children:o.jsx("img",{src:WL,alt:"HuggingFace",className:"w-12 h-12 animate-pulse"})}),o.jsx("h2",{className:"text-xl font-medium text-white mb-2",children:e("datasetImport.importing")}),o.jsx("p",{className:"text-white/70",children:e("datasetImport.processing",{organization:t,dataset:n})})]})})},CGe=({isOpen:e,onClose:t,videoUrl:n="https://www.youtube.com/embed/qqIVesU5McE?si=ZyVZQZ54loEyOWll",title:r="DataKit Demo"})=>{const{t:a}=Ze();return o.jsx(At,{children:e&&o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx(me.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"absolute inset-0 backdrop-blur-sm bg-black/60"}),o.jsxs(me.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},className:"relative w-full max-w-6xl bg-black border border-white/10 rounded-lg shadow-2xl",children:[o.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/10",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx($l,{className:"h-5 w-5"}),o.jsx("h2",{className:"text-lg font-semibold text-white",children:r||a("dataGrid.demoModal.defaultTitle",{defaultValue:"DataKit Demo"})})]}),o.jsx("button",{onClick:t,className:"p-1 hover:bg-white/10 rounded transition-colors","aria-label":a("dataGrid.demoModal.close",{defaultValue:"Close modal"}),children:o.jsx(ur,{className:"h-5 w-5 text-white/70"})})]}),o.jsx("div",{className:"relative w-full aspect-video bg-black/50 rounded-b-lg overflow-hidden",children:o.jsx("video",{src:n,controls:!0,autoPlay:!0,className:"absolute inset-0 w-full h-full object-contain",children:a("dataGrid.demoModal.videoNotSupported",{defaultValue:"Your browser does not support the video tag."})})})]})]})})},IGe="https://discord.gg/gZmXmhbBdP",OGe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAhFBMVEX///8AAAD6+vq2trbx8fHNzc3i4uL39/c0NDS6urptbW37+/vl5eXf39+3t7f09PSrq6vW1tbs7OyJiYkuLi6wsLDBwcF2dnZRUVGSkpJaWlpgYGB8fHxHR0eDg4MgICAQEBA8PDyamppoaGhDQ0OioqLJycmMjIwXFxdfX18nJycbGxv7t4whAAAK00lEQVR4nO2d6XqqMBCGUUCFamVxAesGFms9939/B3fIQiYTLMaH72crMa9knSUxOu8uo+kKPF0tof5qCfVXS6i/WkL91RLqr5ZQf7WE+qsl1F8tof5qCfVXS6i/WkL91RLqr5ZQf7WE+qtOwlXqmY7tHxWKOPq2Y3ppVFudaiIcRGvH7htX9RRKCm6F9G1nHQ3qqJwq4cHN/J5RUuCiS/PLJRlD35tvFGuoRHiM/T5Rp162wpc3cboGpf4oVnqXeMKFaZGV6aUTlbqcS51+0JDG2PxCl4gk/PZIvA/Fn/qh3WfAgOybyMaBIlyS/cUYhTXhXbSbjRmQo/UWUZY84cCjvnr2jfhmgVzqVzwJ8SJlCec98kuHYfUT2+Mg+nWXP5lpOs5s5uQyc01/3MX34FjxVgYeq0sO15I1liMMyR7Sdxacj26jLzfM9v6I1akeCnq+74S7iL1MCEeMR6xYqrHKEKZk5whC1mQ1mf9kfkANtNUaBz0vZCxlFjPGh/vpUwiXJN+Qntkn4ZT1q8Nlzaj5dJsxPtf9qZ1wNyS+Y1Tm267mn8yxASHf3CWlwjPGyBrMayWMyMr7u9K/f+zq3iavnlNcrh1Scu10qgNvCEAQTqvKXjPnrhrUHaWPFnuIGYxmTYQuQTB8rKAmaV0tk6fCWB3T/+0CFvlCwsm+XKh1n/4iT21UAcpybr/ov0/6v7ZwJSwiXBKNI7vORUlKTf3Pk+Vcu/2KbjLdpRohMRvtrxMzcyZ+qsbp5ad16Xl2pkC4KPfAa6uP9tSX/Ils9wxJDnv5AqByUK0idIlv+Jf/7V/8h62TlDU9LfG/6JmpasCpIixP8qf2HjmMMftPtT+t7Ezyr0Mc4bpYhn/I1zV/3vtY6uWLmR05BVdsOCoIi40hXwau6162oBXEnY5D/AlDuHw87286qeRe4bkapx23bLTizxl8wkcv9DoewwbWrMY/nVKf4fdELuH8/nBGmy1eQd11abLmbjW4hPdJIXi593fTsFgzrqWdR+hyy31V8eZEHuGz9wz1y5cjjJquL0IchxWH0BEX+HJypAibri1KMoRp05VFiW1jZBM2vb7GqQ8nXIpLe0kxl25MwpfYQyA0ghIumq4pWqzNPouQ5SrQQyyTDYNw03Q9FcTwFDEI9ZwqLopBhKQPRicxtok04arpWiqJ9oLThK+534XKAxDquZ65iV7XUIRzcSkvLcqaQRHaTVdRUbaIcMKK8NBJH6S7jSRkuCE1EzklkoQN+l1qEml0IwiTputXg5JKQto5p5+mlYQva/2VULeKUD87MEtuBaGORkRaTgXhS7nQ0LL4hLum61aTdlxCRkSOlvrkEr6MH1tRAY9QR3cMWxGHkAri0FYmh/BJUZQNaMwmHDRdrxo1YBLqbEUklTIJ9XNs8+WzCA9N16pWHRiEurrU2FoyCPX1x7A0YxC+y4LmooAm1NdpyNaCInynueKklCJUtQT7the662yvNucMfTNezmPHV96p2hShkiXYLmTITtbYH8uaPlbMhy/Fke+DJFTxqflJpywyCwVWJSqSgpW0BtfNz2Yol2axYjy+pN2sU0YpiUrXyQhCdPfxOQmdko2MEzup4GS4LdxuhNhy+AkrMrvNLjdVWmGlVSb8QpbCiQeU/P2tf/xS8NaxrxIhshtWH/IBHm8qs3rQDTUrESLjvASpccDhRpDTix1uRiVCnAFDlIoLm4Iory0p5Ip5XCTEWdl4kdUPgbwEwhxJbGhBVCDEjVi7qmqddQSUUjVYXYWMYVoWCFEeGWasIyFAwYAzNZBThlMgRA00kKOEJsJShL3wJNxLHD0IjyjHKKRq4rqBDvLA2aq7xzshaqARjzMnCZtpAikFOdZEd0LUpAo7fUPkVa5IHCwK532P74So1GXYWTii4A7WloIhXBDM/k6Ieh52bNJGsFnPxEWchNsO9+6EqMeBR+sJFiTAk2aQIaE3QpRLJgAe9CNoH6ITEa5C7gwGV8K1+KO0oGcHCqZa4MlWSEvg+kqIagI1vUPgOTpIQu9KiDsFAtYPt432w/2VEBf3DBtLJ4LCgYRI02L/QrjFPQ3rQaItInA+xGZibc+Ev7iHGckbDInWNFUnWhSEjSj8PROGuIdBmwJx8wI1drQ5KjwTYo3BIEKh/0FwJuFF6ByQ7EyIPVAHsj8UW2qeuD80zoOpgX8csn0CjIGJuBTkSGGcu7mh4PwVnwsLWQ8Kjnk6Ce+xC06EE3QolPglgqYx4Vij4J4eT3JChedFPbEme6lKWvIiJ1QIm+0KTqIGtn+BqUYpmW6XEyKnw7Oq52vwUqvSb6EWXR/mhEopFlVnM8L3A1aF2ftbLRFrmhOqhSjwR0KZhYSV8EpRjeq1c0LFgD2e5VvSxMk5ekU5tt7PCVUTmwOW+2IlbdximaS26hm7w46xVc+xsMk29g9jo7ao7f66hqBla2vUcr6AXTQouQ5ycBimBbvBIKsn0G5jiH0nMO2n6W61i6dqgT4905tHi7Vn1hZHODHeIeOwSonxPkkWbEXGeyTk8eUa+qc2Vys29D4kQizPeIfM3ypNjXfJyOPp03ivEH1aMyDhSx5EADp3dGbAbIn2C+abZCCv4N4Abg/jV0uh7Q1gjl3bgG4Pl53vF0r96sadCWxT5BtgQ9accVFJUzI3nQ1wazWSGENOtkPqspkmZA86nSO0Ij1DYptytnH/NH0qgX8yeACbaK7AkHEA/55NC40yXi64OcLfi5yD++NqL2rsAHr7UoGDxPfL2htu1gr2rWhP1uxqD1rJNSJJk/fdJLYy//Zgt2F6C2+RC/9ZSluE/XtuxOYP72LZPzx5cna8fcfoHCTfhVUIwvj+k2MYgvjhAdrI/apn/6F82lrpbEL3yUfY9Z1iWIusRSK5RAxJr6rLt8VO1v6zjrHr+iXPWyTbLU7TGzJGmHDITJbPuD/Idss+KWlzxPlFXGJG5I01Xcqt6dJ3y6poRjqYqbtlhLoEshjIn4d5Pd8xnNVBOfZjyhW1k9+DX4O2bnE/mN3fiBU6uVjPVCYRy0+/6LhOzAKDzCHFRUYF7IimySKzEeuBkbNMDoziQsym7f7rP2K3kDkNU26wSJRO/S5olP2wZtmaU06Cu8XnMcUUotOwHgx/XZV9tpqHqeP3hkGfgO1awXDoT+P1POE+nE9EqCoFBTddMf4uwW7h+z7vDTy0nSSraLH4yvW7yLUabARx1ElI3WsOlF0suRRhuMXvGPA3xvOEj2QqHddGnn2JPR1D5oJeqJA+oz4RV0BGiS5QLXX/BEBkxppN5oXXcmK5RRVSj+RneXqpxTpXP5GdsbvABCFpbWUXaqyMW2YscyhXcv2jzE1yG7sRM32AHa19yCTG6WeMMjdJbOyYa0gu4emeaGjJgBhfBUEXk/xruisi7ln3fdMCJkygBTIh+BXpU5U5BUvxCsB61ihzl3BAHZucsL+LBFkTkSN4kbD7zVUkiEP3Q0Ggsjgv5Ldq6wi9pF5FFTsCIV4HeHv8l8dxKAOzeBXF3Nd9WA4o3QZGmOs4z0ZUc3nOYo0Wuczqj8yKLRchKOFJm8id7gsLnmcPow89BlR/lu2+pUY3GcKrctA48z5nvvDYlfrkZelykYg7HUMIQs3UEuqvllB/tYT6qyXUXy2h/moJ9VdLqL9aQv3VEuqvllB/tYT6qyXUXy2h/moJ9VdLqL/en/A/ULfAvTFIT2kAAAAASUVORK5CYII=",LGe=()=>{const[e,t]=v.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsx(ff,{title:"DataKit",description:"Your data, your choice. Process locally for complete privacy or leverage cloud when you need to collaborate. The modern data analysis platform that adapts to you.",keywords:"data analysis, privacy-first analytics, local data processing, WebAssembly, DuckDB, data visualization, SQL queries, CSV analysis, Excel processing, data science, business intelligence, secure analytics, DataKit",url:"/"}),o.jsx("div",{className:"flex flex-col bg-black items-center justify-center h-screen p-6 text-center",children:o.jsxs("div",{className:"bg-black p-8 rounded-lg shadow-lg max-w-md w-full",children:[o.jsx("h1",{className:"text-2xl font-bold mb-4 text-white",children:"DataKit works best on desktop"}),o.jsx("p",{className:"text-white/80 mb-2 leading-relaxed",children:"Experience powerful data analysis and seamless file processing."}),o.jsx("p",{className:"text-white/60 text-sm mb-6",children:"Switch to desktop for the full experience, or"}),o.jsxs("div",{className:"flex flex-col gap-3 items-center justify-center",children:[o.jsx(je,{variant:"link",size:"lg",asChild:!0,children:o.jsxs("a",{href:IGe,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center",title:"Join our Discord community",children:[o.jsx("img",{src:OGe,alt:"Discord",className:"w-6 h-6 mr-1.5"}),o.jsx("span",{className:"text-md text-white",children:"Discord"})]})}),o.jsx(je,{variant:"link",size:"lg",asChild:!0,children:o.jsxs("a",{href:"https://www.linkedin.com/company/datakitpage",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center",title:"Visit our LinkedIn page",children:[o.jsx("svg",{className:"w-6 h-6 mr-1.5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})}),o.jsx("span",{className:"text-md text-white",children:"LinkedIn"})]})}),o.jsx(je,{variant:"link",size:"lg",asChild:!0,children:o.jsxs("a",{href:"https://amin.contact",target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center",title:"Visit Amin's contact page",children:[o.jsx("svg",{className:"w-6 h-6 mr-1.5",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14",stroke:"currentColor",fill:"none"})}),o.jsx("span",{className:"text-md text-white",children:"Amin"})]})})]})]})}),o.jsx(CGe,{isOpen:e,onClose:()=>t(!1),videoUrl:"/video/datakit-demo.mp4",title:"Take a look at your DataKit"})]})},MGe=()=>{const{initialize:e}=Dt(),{checkAuth:t}=qh(),[n,r]=v.useState(!1),[a,s]=v.useState(!1),{ConsentPopup:i}=jL();return Kme(),v.useEffect(()=>{e()},[e]),v.useEffect(()=>{t()},[t]),v.useEffect(()=>{const l=localStorage.getItem("theme-primary-color");l&&$L(l)},[]),v.useEffect(()=>{!localStorage.getItem("datakit-welcome-seen")&&!n&&s(!0)},[n]),v.useEffect(()=>{const l=()=>{const c=navigator.userAgent||navigator.vendor||window.opera,h=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(c)||window.innerWidth<768;r(h)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),n?o.jsx(LGe,{}):o.jsxs(o.Fragment,{children:[o.jsxs(eie,{children:[o.jsx(jc,{path:"/",element:o.jsxs(o.Fragment,{children:[o.jsx(sGe,{}),o.jsx(i,{})]})}),o.jsx(jc,{path:"/datasets/:organization/:dataset",element:o.jsx(wGe,{})}),o.jsx(jc,{path:"/privacy",element:o.jsx(iGe,{})}),o.jsx(jc,{path:"/settings",element:o.jsx(xGe,{})}),o.jsx(jc,{path:"/info",element:o.jsx(vGe,{})}),o.jsx(jc,{path:"*",element:o.jsx(AGe,{})})]}),o.jsx(fQ,{isOpen:a,onClose:()=>s(!1),onGetStarted:()=>s(!1)})]})},DGe=()=>o.jsx(lie,{children:o.jsx(Xme,{children:o.jsx(MGe,{})})}),Gt=e=>typeof e=="string",tp=()=>{let e,t;const n=new Promise((r,a)=>{e=r,t=a});return n.resolve=e,n.reject=t,n},_z=e=>e==null?"":""+e,PGe=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},kGe=/###/g,wz=e=>e&&e.indexOf("###")>-1?e.replace(kGe,"."):e,Cz=e=>!e||Gt(e),Bp=(e,t,n)=>{const r=Gt(t)?t.split("."):t;let a=0;for(;a<r.length-1;){if(Cz(e))return{};const s=wz(r[a]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++a}return Cz(e)?{}:{obj:e,k:wz(r[a])}},Iz=(e,t,n)=>{const{obj:r,k:a}=Bp(e,t,Object);if(r!==void 0||t.length===1){r[a]=n;return}let s=t[t.length-1],i=t.slice(0,t.length-1),l=Bp(e,i,Object);for(;l.obj===void 0&&i.length;)s="".concat(i[i.length-1],".").concat(s),i=i.slice(0,i.length-1),l=Bp(e,i,Object),l!=null&&l.obj&&typeof l.obj["".concat(l.k,".").concat(s)]!="undefined"&&(l.obj=void 0);l.obj["".concat(l.k,".").concat(s)]=n},jGe=(e,t,n,r)=>{const{obj:a,k:s}=Bp(e,t,Object);a[s]=a[s]||[],a[s].push(n)},R0=(e,t)=>{const{obj:n,k:r}=Bp(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},UGe=(e,t,n)=>{const r=R0(e,n);return r!==void 0?r:R0(t,n)},HZ=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?Gt(e[r])||e[r]instanceof String||Gt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):HZ(e[r],t[r],n):e[r]=t[r]);return e},$d=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var FGe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const $Ge=e=>Gt(e)?e.replace(/[&<>"'\/]/g,t=>FGe[t]):e;class BGe{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const n=this.regExpMap.get(t);if(n!==void 0)return n;const r=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,r),this.regExpQueue.push(t),r}}const HGe=[" ",",","?","!",";"],VGe=new BGe(20),GGe=(e,t,n)=>{t=t||"",n=n||"";const r=HGe.filter(i=>t.indexOf(i)<0&&n.indexOf(i)<0);if(r.length===0)return!0;const a=VGe.getRegExp("(".concat(r.map(i=>i==="?"?"\\?":i).join("|"),")"));let s=!a.test(e);if(!s){const i=e.indexOf(n);i>0&&!a.test(e.substring(0,i))&&(s=!0)}return s},x1=(e,t,n=".")=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;const r=t.split(n);let a=e;for(let s=0;s<r.length;){if(!a||typeof a!="object")return;let i,l="";for(let c=s;c<r.length;++c)if(c!==s&&(l+=n),l+=r[c],i=a[l],i!==void 0){if(["string","number","boolean"].indexOf(typeof i)>-1&&c<r.length-1)continue;s+=c-s+1;break}a=i}return a},_g=e=>e==null?void 0:e.replace("_","-"),zGe={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){var n,r;(r=(n=console==null?void 0:console[e])==null?void 0:n.apply)==null||r.call(n,console,t)}};class N0{constructor(t,n={}){this.init(t,n)}init(t,n={}){this.prefix=n.prefix||"i18next:",this.logger=t||zGe,this.options=n,this.debug=n.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,a){return a&&!this.debug?null:(Gt(t[0])&&(t[0]="".concat(r).concat(this.prefix," ").concat(t[0])),this.logger[n](t))}create(t){return new N0(this.logger,q({prefix:"".concat(this.prefix,":").concat(t,":")},this.options))}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new N0(this.logger,t)}}var Pi=new N0;class NS{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const a=this.observers[r].get(n)||0;this.observers[r].set(n,a+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t,...n){this.observers[t]&&Array.from(this.observers[t].entries()).forEach(([a,s])=>{for(let i=0;i<s;i++)a(...n)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([a,s])=>{for(let i=0;i<s;i++)a.apply(a,[t,...n])})}}class Oz extends NS{constructor(t,n={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r,a={}){var u,h;const s=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,i=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):Gt(r)&&s?l.push(...r.split(s)):l.push(r)));const c=R0(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!i||!Gt(r)?c:x1((h=(u=this.data)==null?void 0:u[t])==null?void 0:h[n],r,s)}addResource(t,n,r,a,s={silent:!1}){const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(i?r.split(i):r)),t.indexOf(".")>-1&&(l=t.split("."),a=n,n=l[1]),this.addNamespaces(n),Iz(this.data,l,a),s.silent||this.emit("added",t,n,r,a)}addResources(t,n,r,a={silent:!1}){for(const s in r)(Gt(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});a.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,a,s,i={silent:!1,skipCopy:!1}){let l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),a=r,r=n,n=l[1]),this.addNamespaces(n);let c=R0(this.data,l)||{};i.skipCopy||(r=JSON.parse(JSON.stringify(r))),a?HZ(c,r,s):c=q(q({},c),r),Iz(this.data,l,c),i.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(a=>n[a]&&Object.keys(n[a]).length>0)}toJSON(){return this.data}}var VZ={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,a){return e.forEach(s=>{var i,l;t=(l=(i=this.processors[s])==null?void 0:i.process(t,n,r,a))!=null?l:t}),t}};const GZ=Symbol("i18next/PATH_KEY");function qGe(){const e=[],t=Object.create(null);let n;return t.get=(r,a)=>{var s;return(s=n==null?void 0:n.revoke)==null||s.call(n),a===GZ?e:(e.push(a),n=Proxy.revocable(r,t),n.proxy)},Proxy.revocable(Object.create(null),t).proxy}function S1(e,t){var r;const{[GZ]:n}=e(qGe());return n.join((r=t==null?void 0:t.keySeparator)!=null?r:".")}const Lz={},Mz=e=>!Gt(e)&&typeof e!="boolean"&&typeof e!="number";class _0 extends NS{constructor(t,n={}){super(),PGe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Pi.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,n={interpolation:{}}){const r=q({},n);if(t==null)return!1;const a=this.resolve(t,r);return(a==null?void 0:a.res)!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const a=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const i=r&&t.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!GGe(t,r,a);if(i&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:Gt(s)?[s]:s};const u=t.split(r);(r!==a||r===a&&this.options.ns.indexOf(u[0])>-1)&&(s=u.shift()),t=u.join(a)}return{key:t,namespaces:Gt(s)?[s]:s}}translate(t,n,r){let a=typeof n=="object"?q({},n):n;if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a=q({},a)),a||(a={}),t==null)return"";typeof t=="function"&&(t=S1(t,q(q({},this.options),a))),Array.isArray(t)||(t=[String(t)]);const s=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,i=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:l,namespaces:c}=this.extractFromKey(t[t.length-1],a),u=c[c.length-1];let h=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;h===void 0&&(h=":");const m=a.lng||this.language,p=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((m==null?void 0:m.toLowerCase())==="cimode")return p?s?{res:"".concat(u).concat(h).concat(l),usedKey:l,exactUsedKey:l,usedLng:m,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:"".concat(u).concat(h).concat(l):s?{res:l,usedKey:l,exactUsedKey:l,usedLng:m,usedNS:u,usedParams:this.getUsedParamsDetails(a)}:l;const g=this.resolve(t,a);let T=g==null?void 0:g.res;const y=(g==null?void 0:g.usedKey)||l,b=(g==null?void 0:g.exactUsedKey)||l,x=["[object Number]","[object Function]","[object RegExp]"],R=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,A=!this.i18nFormat||this.i18nFormat.handleAsObject,w=a.count!==void 0&&!Gt(a.count),_=_0.hasDefaultValue(a),N=w?this.pluralResolver.getSuffix(m,a.count,a):"",I=a.ordinal&&w?this.pluralResolver.getSuffix(m,a.count,{ordinal:!1}):"",D=w&&!a.ordinal&&a.count===0,M=D&&a["defaultValue".concat(this.options.pluralSeparator,"zero")]||a["defaultValue".concat(N)]||a["defaultValue".concat(I)]||a.defaultValue;let O=T;A&&!T&&_&&(O=M);const L=Mz(O),k=Object.prototype.toString.apply(O);if(A&&O&&L&&x.indexOf(k)<0&&!(Gt(R)&&Array.isArray(O))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const F=this.options.returnedObjectHandler?this.options.returnedObjectHandler(y,O,he(q({},a),{ns:c})):"key '".concat(l," (").concat(this.language,")' returned an object instead of string.");return s?(g.res=F,g.usedParams=this.getUsedParamsDetails(a),g):F}if(i){const F=Array.isArray(O),U=F?[]:{},B=F?b:y;for(const j in O)if(Object.prototype.hasOwnProperty.call(O,j)){const G="".concat(B).concat(i).concat(j);_&&!T?U[j]=this.translate(G,he(q({},a),{defaultValue:Mz(M)?M[j]:void 0,joinArrays:!1,ns:c})):U[j]=this.translate(G,he(q({},a),{joinArrays:!1,ns:c})),U[j]===G&&(U[j]=O[j])}T=U}}else if(A&&Gt(R)&&Array.isArray(T))T=T.join(R),T&&(T=this.extendTranslation(T,t,a,r));else{let F=!1,U=!1;!this.isValidLookup(T)&&_&&(F=!0,T=M),this.isValidLookup(T)||(U=!0,T=l);const j=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&U?void 0:T,G=_&&M!==T&&this.options.updateMissing;if(U||F||G){if(this.logger.log(G?"updateKey":"missingKey",m,u,l,G?M:T),i){const X=this.resolve(l,he(q({},a),{keySeparator:!1}));X&&X.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let K=[];const J=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&J&&J[0])for(let X=0;X<J.length;X++)K.push(J[X]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(a.lng||this.language):K.push(a.lng||this.language);const $=(X,Z,V)=>{var ae;const te=_&&V!==T?V:j;this.options.missingKeyHandler?this.options.missingKeyHandler(X,u,Z,te,G,a):(ae=this.backendConnector)!=null&&ae.saveMissing&&this.backendConnector.saveMissing(X,u,Z,te,G,a),this.emit("missingKey",X,u,Z,T)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?K.forEach(X=>{const Z=this.pluralResolver.getSuffixes(X,a);D&&a["defaultValue".concat(this.options.pluralSeparator,"zero")]&&Z.indexOf("".concat(this.options.pluralSeparator,"zero"))<0&&Z.push("".concat(this.options.pluralSeparator,"zero")),Z.forEach(V=>{$([X],l+V,a["defaultValue".concat(V)]||M)})}):$(K,l,M))}T=this.extendTranslation(T,t,a,g,r),U&&T===l&&this.options.appendNamespaceToMissingKey&&(T="".concat(u).concat(h).concat(l)),(U||F)&&this.options.parseMissingKeyHandler&&(T=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?"".concat(u).concat(h).concat(l):l,F?T:void 0,a))}return s?(g.res=T,g.usedParams=this.getUsedParamsDetails(a),g):T}extendTranslation(t,n,r,a,s){var c,u;if((c=this.i18nFormat)!=null&&c.parse)t=this.i18nFormat.parse(t,q(q({},this.options.interpolation.defaultVariables),r),r.lng||this.language||a.usedLng,a.usedNS,a.usedKey,{resolved:a});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init(he(q({},r),{interpolation:q(q({},this.options.interpolation),r.interpolation)}));const h=Gt(t)&&(((u=r==null?void 0:r.interpolation)==null?void 0:u.skipOnVariables)!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(h){const g=t.match(this.interpolator.nestingRegexp);m=g&&g.length}let p=r.replace&&!Gt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p=q(q({},this.options.interpolation.defaultVariables),p)),t=this.interpolator.interpolate(t,p,r.lng||this.language||a.usedLng,r),h){const g=t.match(this.interpolator.nestingRegexp),T=g&&g.length;m<T&&(r.nest=!1)}!r.lng&&a&&a.res&&(r.lng=this.language||a.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,(...g)=>(s==null?void 0:s[0])===g[0]&&!r.context?(this.logger.warn("It seems you are nesting recursively key: ".concat(g[0]," in key: ").concat(n[0])),null):this.translate(...g,n),r)),r.interpolation&&this.interpolator.reset()}const i=r.postProcess||this.options.postProcess,l=Gt(i)?[i]:i;return t!=null&&(l!=null&&l.length)&&r.applyPostProcessor!==!1&&(t=VZ.handle(l,t,n,this.options&&this.options.postProcessPassResolved?q({i18nResolved:he(q({},a),{usedParams:this.getUsedParamsDetails(r)})},r):r,this)),t}resolve(t,n={}){let r,a,s,i,l;return Gt(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),h=u.key;a=h;let m=u.namespaces;this.options.fallbackNS&&(m=m.concat(this.options.fallbackNS));const p=n.count!==void 0&&!Gt(n.count),g=p&&!n.ordinal&&n.count===0,T=n.context!==void 0&&(Gt(n.context)||typeof n.context=="number")&&n.context!=="",y=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);m.forEach(b=>{var x,R;this.isValidLookup(r)||(l=b,!Lz["".concat(y[0],"-").concat(b)]&&((x=this.utils)!=null&&x.hasLoadedNamespace)&&!((R=this.utils)!=null&&R.hasLoadedNamespace(l))&&(Lz["".concat(y[0],"-").concat(b)]=!0,this.logger.warn('key "'.concat(a,'" for languages "').concat(y.join(", "),'" won\'t get resolved as namespace "').concat(l,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),y.forEach(A=>{var N;if(this.isValidLookup(r))return;i=A;const w=[h];if((N=this.i18nFormat)!=null&&N.addLookupKeys)this.i18nFormat.addLookupKeys(w,h,A,b,n);else{let I;p&&(I=this.pluralResolver.getSuffix(A,n.count,n));const D="".concat(this.options.pluralSeparator,"zero"),M="".concat(this.options.pluralSeparator,"ordinal").concat(this.options.pluralSeparator);if(p&&(n.ordinal&&I.indexOf(M)===0&&w.push(h+I.replace(M,this.options.pluralSeparator)),w.push(h+I),g&&w.push(h+D)),T){const O="".concat(h).concat(this.options.contextSeparator||"_").concat(n.context);w.push(O),p&&(n.ordinal&&I.indexOf(M)===0&&w.push(O+I.replace(M,this.options.pluralSeparator)),w.push(O+I),g&&w.push(O+D))}}let _;for(;_=w.pop();)this.isValidLookup(r)||(s=_,r=this.getResource(A,b,_,n))}))})}),{res:r,usedKey:a,exactUsedKey:s,usedLng:i,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r,a={}){var s;return(s=this.i18nFormat)!=null&&s.getResource?this.i18nFormat.getResource(t,n,r,a):this.resourceStore.getResource(t,n,r,a)}getUsedParamsDetails(t={}){const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!Gt(t.replace);let a=r?t.replace:t;if(r&&typeof t.count!="undefined"&&(a.count=t.count),this.options.interpolation.defaultVariables&&(a=q(q({},this.options.interpolation.defaultVariables),a)),!r){a=q({},a);for(const s of n)delete a[s]}return a}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}class Dz{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Pi.create("languageUtils")}getScriptPartFromCode(t){if(t=_g(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=_g(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(Gt(t)&&t.indexOf("-")>-1){let n;try{n=Intl.getCanonicalLocales(t)[0]}catch(r){}return n&&this.options.lowerCaseLng&&(n=n.toLowerCase()),n||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const a=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(a))&&(n=a)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const a=this.getScriptPartFromCode(r);if(this.isSupportedCode(a))return n=a;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),Gt(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes((n===!1?[]:n)||this.options.fallbackLng||[],t),a=[],s=i=>{i&&(this.isSupportedCode(i)?a.push(i):this.logger.warn("rejecting language code not found in supportedLngs: ".concat(i)))};return Gt(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):Gt(t)&&s(this.formatLanguageCode(t)),r.forEach(i=>{a.indexOf(i)<0&&s(this.formatLanguageCode(i))}),a}}const Pz={zero:0,one:1,two:2,few:3,many:4,other:5},kz={select:e=>e===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class YGe{constructor(t,n={}){this.languageUtils=t,this.options=n,this.logger=Pi.create("pluralResolver"),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t,n={}){const r=_g(t==="dev"?"en":t),a=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:a});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let i;try{i=new Intl.PluralRules(r,{type:a})}catch(l){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),kz;if(!t.match(/-|_/))return kz;const c=this.languageUtils.getLanguagePartFromCode(t);i=this.getRule(c,n)}return this.pluralRulesCache[s]=i,i}needsPlural(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),(r==null?void 0:r.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(t,n,r={}){return this.getSuffixes(t,r).map(a=>"".concat(n).concat(a))}getSuffixes(t,n={}){let r=this.getRule(t,n);return r||(r=this.getRule("dev",n)),r?r.resolvedOptions().pluralCategories.sort((a,s)=>Pz[a]-Pz[s]).map(a=>"".concat(this.options.prepend).concat(n.ordinal?"ordinal".concat(this.options.prepend):"").concat(a)):[]}getSuffix(t,n,r={}){const a=this.getRule(t,r);return a?"".concat(this.options.prepend).concat(r.ordinal?"ordinal".concat(this.options.prepend):"").concat(a.select(n)):(this.logger.warn("no plural rule found for: ".concat(t)),this.getSuffix("dev",n,r))}}const jz=(e,t,n,r=".",a=!0)=>{let s=UGe(e,t,n);return!s&&a&&Gt(n)&&(s=x1(e,n,r),s===void 0&&(s=x1(t,n,r))),s},JC=e=>e.replace(/\$/g,"$$$$");class WGe{constructor(t={}){var n;this.logger=Pi.create("interpolator"),this.options=t,this.format=((n=t==null?void 0:t.interpolation)==null?void 0:n.format)||(r=>r),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:a,prefix:s,prefixEscaped:i,suffix:l,suffixEscaped:c,formatSeparator:u,unescapeSuffix:h,unescapePrefix:m,nestingPrefix:p,nestingPrefixEscaped:g,nestingSuffix:T,nestingSuffixEscaped:y,nestingOptionsSeparator:b,maxReplaces:x,alwaysFormat:R}=t.interpolation;this.escape=n!==void 0?n:$Ge,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=a!==void 0?a:!1,this.prefix=s?$d(s):i||"{{",this.suffix=l?$d(l):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=h?"":m||"-",this.unescapeSuffix=this.unescapePrefix?"":h||"",this.nestingPrefix=p?$d(p):g||$d("$t("),this.nestingSuffix=T?$d(T):y||$d(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=x||1e3,this.alwaysFormat=R!==void 0?R:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>(n==null?void 0:n.source)===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,"".concat(this.prefix,"(.+?)").concat(this.suffix)),this.regexpUnescape=t(this.regexpUnescape,"".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix)),this.nestingRegexp=t(this.nestingRegexp,"".concat(this.nestingPrefix,"((?:[^()\"']+|\"[^\"]*\"|'[^']*'|\\((?:[^()]|\"[^\"]*\"|'[^']*')*\\))*?)").concat(this.nestingSuffix))}interpolate(t,n,r,a){var g;let s,i,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=T=>{if(T.indexOf(this.formatSeparator)<0){const R=jz(n,c,T,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(R,void 0,r,he(q(q({},a),n),{interpolationkey:T})):R}const y=T.split(this.formatSeparator),b=y.shift().trim(),x=y.join(this.formatSeparator).trim();return this.format(jz(n,c,b,this.options.keySeparator,this.options.ignoreJSONStructure),x,r,he(q(q({},a),n),{interpolationkey:b}))};this.resetRegExp();const h=(a==null?void 0:a.missingInterpolationHandler)||this.options.missingInterpolationHandler,m=((g=a==null?void 0:a.interpolation)==null?void 0:g.skipOnVariables)!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:T=>JC(T)},{regex:this.regexp,safeValue:T=>this.escapeValue?JC(this.escape(T)):JC(T)}].forEach(T=>{for(l=0;s=T.regex.exec(t);){const y=s[1].trim();if(i=u(y),i===void 0)if(typeof h=="function"){const x=h(t,s,a);i=Gt(x)?x:""}else if(a&&Object.prototype.hasOwnProperty.call(a,y))i="";else if(m){i=s[0];continue}else this.logger.warn("missed to pass in variable ".concat(y," for interpolating ").concat(t)),i="";else!Gt(i)&&!this.useRawValueToEscape&&(i=_z(i));const b=T.safeValue(i);if(t=t.replace(s[0],b),m?(T.regex.lastIndex+=i.length,T.regex.lastIndex-=s[0].length):T.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n,r={}){let a,s,i;const l=(c,u)=>{var y;const h=this.nestingOptionsSeparator;if(c.indexOf(h)<0)return c;const m=c.split(new RegExp("".concat(h,"[ ]*{")));let p="{".concat(m[1]);c=m[0],p=this.interpolate(p,i);const g=p.match(/'/g),T=p.match(/"/g);(((y=g==null?void 0:g.length)!=null?y:0)%2===0&&!T||T.length%2!==0)&&(p=p.replace(/'/g,'"'));try{i=JSON.parse(p),u&&(i=q(q({},u),i))}catch(b){return this.logger.warn("failed parsing options string in nesting for key ".concat(c),b),"".concat(c).concat(h).concat(p)}return i.defaultValue&&i.defaultValue.indexOf(this.prefix)>-1&&delete i.defaultValue,c};for(;a=this.nestingRegexp.exec(t);){let c=[];i=q({},r),i=i.replace&&!Gt(i.replace)?i.replace:i,i.applyPostProcessor=!1,delete i.defaultValue;const u=/{.*}/.test(a[1])?a[1].lastIndexOf("}")+1:a[1].indexOf(this.formatSeparator);if(u!==-1&&(c=a[1].slice(u).split(this.formatSeparator).map(h=>h.trim()).filter(Boolean),a[1]=a[1].slice(0,u)),s=n(l.call(this,a[1].trim(),i),i),s&&a[0]===t&&!Gt(s))return s;Gt(s)||(s=_z(s)),s||(this.logger.warn("missed to resolve ".concat(a[1]," for nesting ").concat(t)),s=""),c.length&&(s=c.reduce((h,m)=>this.format(h,m,r.lng,he(q({},r),{interpolationkey:a[1].trim()})),s.trim())),t=t.replace(a[0],s),this.regexp.lastIndex=0}return t}}const XGe=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const a=r[1].substring(0,r[1].length-1);t==="currency"&&a.indexOf(":")<0?n.currency||(n.currency=a.trim()):t==="relativetime"&&a.indexOf(":")<0?n.range||(n.range=a.trim()):a.split(";").forEach(i=>{if(i){const[l,...c]=i.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),h=l.trim();n[h]||(n[h]=u),u==="false"&&(n[h]=!1),u==="true"&&(n[h]=!0),isNaN(u)||(n[h]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Uz=e=>{const t={};return(n,r,a)=>{let s=a;a&&a.interpolationkey&&a.formatParams&&a.formatParams[a.interpolationkey]&&a[a.interpolationkey]&&(s=he(q({},s),{[a.interpolationkey]:void 0}));const i=r+JSON.stringify(s);let l=t[i];return l||(l=e(_g(r),a),t[i]=l),l(n)}},KGe=e=>(t,n,r)=>e(_g(n),r)(t);class QGe{constructor(t={}){this.logger=Pi.create("formatter"),this.options=t,this.init(t)}init(t,n={interpolation:{}}){this.formatSeparator=n.interpolation.formatSeparator||",";const r=n.cacheInBuiltFormats?Uz:KGe;this.formats={number:r((a,s)=>{const i=new Intl.NumberFormat(a,q({},s));return l=>i.format(l)}),currency:r((a,s)=>{const i=new Intl.NumberFormat(a,he(q({},s),{style:"currency"}));return l=>i.format(l)}),datetime:r((a,s)=>{const i=new Intl.DateTimeFormat(a,q({},s));return l=>i.format(l)}),relativetime:r((a,s)=>{const i=new Intl.RelativeTimeFormat(a,q({},s));return l=>i.format(l,s.range||"day")}),list:r((a,s)=>{const i=new Intl.ListFormat(a,q({},s));return l=>i.format(l)})}}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Uz(n)}format(t,n,r,a={}){const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(l=>l.indexOf(")")>-1)){const l=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,l)].join(this.formatSeparator)}return s.reduce((l,c)=>{var m;const{formatName:u,formatOptions:h}=XGe(c);if(this.formats[u]){let p=l;try{const g=((m=a==null?void 0:a.formatParams)==null?void 0:m[a.interpolationkey])||{},T=g.locale||g.lng||a.locale||a.lng||r;p=this.formats[u](l,T,q(q(q({},h),a),g))}catch(g){this.logger.warn(g)}return p}else this.logger.warn("there was no format function for ".concat(u));return l},t)}}const JGe=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class ZGe extends NS{constructor(t,n,r,a={}){var s,i;super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=a,this.logger=Pi.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],(i=(s=this.backend)==null?void 0:s.init)==null||i.call(s,r,a.backend,a)}queueLoad(t,n,r,a){const s={},i={},l={},c={};return t.forEach(u=>{let h=!0;n.forEach(m=>{const p="".concat(u,"|").concat(m);!r.reload&&this.store.hasResourceBundle(u,m)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?i[p]===void 0&&(i[p]=!0):(this.state[p]=1,h=!1,i[p]===void 0&&(i[p]=!0),s[p]===void 0&&(s[p]=!0),c[m]===void 0&&(c[m]=!0)))}),h||(l[u]=!0)}),(Object.keys(s).length||Object.keys(i).length)&&this.queue.push({pending:i,pendingCount:Object.keys(i).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(s),pending:Object.keys(i),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const a=t.split("|"),s=a[0],i=a[1];n&&this.emit("failedLoading",s,i,n),!n&&r&&this.store.addResourceBundle(s,i,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{jGe(c.loaded,[s],i),JGe(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{l[u]||(l[u]={});const h=c.loaded[u];h.length&&h.forEach(m=>{l[u][m]===void 0&&(l[u][m]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r,a=0,s=this.retryTimeout,i){if(!t.length)return i(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:a,wait:s,callback:i});return}this.readingCalls++;const l=(u,h)=>{if(this.readingCalls--,this.waitingReads.length>0){const m=this.waitingReads.shift();this.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(u&&h&&a<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,a+1,s*2,i)},s);return}i(u,h)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(h=>l(null,h)).catch(l):l(null,u)}catch(u){l(u)}return}return c(t,n,l)}prepareLoading(t,n,r={},a){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),a&&a();Gt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Gt(n)&&(n=[n]);const s=this.queueLoad(t,n,r,a);if(!s.toLoad.length)return s.pending.length||a(),null;s.toLoad.forEach(i=>{this.loadOne(i)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t,n=""){const r=t.split("|"),a=r[0],s=r[1];this.read(a,s,"read",void 0,void 0,(i,l)=>{i&&this.logger.warn("".concat(n,"loading namespace ").concat(s," for language ").concat(a," failed"),i),!i&&l&&this.logger.log("".concat(n,"loaded namespace ").concat(s," for language ").concat(a),l),this.loaded(t,i,l)})}saveMissing(t,n,r,a,s,i={},l=()=>{}){var c,u,h,m,p;if((u=(c=this.services)==null?void 0:c.utils)!=null&&u.hasLoadedNamespace&&!((m=(h=this.services)==null?void 0:h.utils)!=null&&m.hasLoadedNamespace(n))){this.logger.warn('did not save key "'.concat(r,'" as the namespace "').concat(n,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if((p=this.backend)!=null&&p.create){const g=he(q({},i),{isUpdate:s}),T=this.backend.create.bind(this.backend);if(T.length<6)try{let y;T.length===5?y=T(t,n,r,a,g):y=T(t,n,r,a),y&&typeof y.then=="function"?y.then(b=>l(null,b)).catch(l):l(null,y)}catch(y){l(y)}else T(t,n,r,a,l,g)}!t||!t[0]||this.store.addResource(t[0],n,r,a)}}}const Fz=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Gt(e[1])&&(t.defaultValue=e[1]),Gt(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),$z=e=>{var t,n;return Gt(e.ns)&&(e.ns=[e.ns]),Gt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Gt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),((n=(t=e.supportedLngs)==null?void 0:t.indexOf)==null?void 0:n.call(t,"cimode"))<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),typeof e.initImmediate=="boolean"&&(e.initAsync=e.initImmediate),e},QT=()=>{},e6e=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class wg extends NS{constructor(t={},n){if(super(),this.options=$z(t),this.services={},this.logger=Pi,this.modules={external:[]},e6e(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(t={},n){this.isInitializing=!0,typeof t=="function"&&(n=t,t={}),t.defaultNS==null&&t.ns&&(Gt(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const r=Fz();this.options=q(q(q({},r),this.options),$z(t)),this.options.interpolation=q(q({},r.interpolation),this.options.interpolation),t.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=t.keySeparator),t.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=t.nsSeparator);const a=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?Pi.init(a(this.modules.logger),this.options):Pi.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:u=QGe;const h=new Dz(this.options);this.store=new Oz(this.options.resources,this.options);const m=this.services;m.logger=Pi,m.resourceStore=this.store,m.languageUtils=h,m.pluralResolver=new YGe(h,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==r.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),u&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)&&(m.formatter=a(u),m.formatter.init&&m.formatter.init(m,this.options),this.options.interpolation.format=m.formatter.format.bind(m.formatter)),m.interpolator=new WGe(this.options),m.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},m.backendConnector=new ZGe(a(this.modules.backend),m.resourceStore,m,this.options),m.backendConnector.on("*",(g,...T)=>{this.emit(g,...T)}),this.modules.languageDetector&&(m.languageDetector=a(this.modules.languageDetector),m.languageDetector.init&&m.languageDetector.init(m,this.options.detection,this.options)),this.modules.i18nFormat&&(m.i18nFormat=a(this.modules.i18nFormat),m.i18nFormat.init&&m.i18nFormat.init(this)),this.translator=new _0(this.services,this.options),this.translator.on("*",(g,...T)=>{this.emit(g,...T)}),this.modules.external.forEach(g=>{g.init&&g.init(this)})}if(this.format=this.options.interpolation.format,n||(n=QT),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(u=>{this[u]=(...h)=>this.store[u](...h)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=(...h)=>(this.store[u](...h),this)});const l=tp(),c=()=>{const u=(h,m)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(m),n(h,m)};if(this.languages&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initAsync?c():setTimeout(c,0),l}loadResources(t,n=QT){var s,i;let r=n;const a=Gt(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if((a==null?void 0:a.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const l=[],c=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(m=>{m!=="cimode"&&l.indexOf(m)<0&&l.push(m)})};a?c(a):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(h=>c(h)),(i=(s=this.options.preload)==null?void 0:s.forEach)==null||i.call(s,u=>c(u)),this.services.backendConnector.load(l,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(u)})}else r(null)}reloadResources(t,n,r){const a=tp();return typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=void 0),t||(t=this.languages),n||(n=this.options.ns),r||(r=QT),this.services.backendConnector.reload(t,n,s=>{a.resolve(),r(s)}),a}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&VZ.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1)){for(let n=0;n<this.languages.length;n++){const r=this.languages[n];if(!(["cimode","dev"].indexOf(r)>-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,n){this.isLanguageChangingTo=t;const r=tp();this.emit("languageChanging",t);const a=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},s=(l,c)=>{c?this.isLanguageChangingTo===t&&(a(c),this.translator.changeLanguage(c),this.isLanguageChangingTo=void 0,this.emit("languageChanged",c),this.logger.log("languageChanged",c)):this.isLanguageChangingTo=void 0,r.resolve((...u)=>this.t(...u)),n&&n(l,(...u)=>this.t(...u))},i=l=>{var h,m;!t&&!l&&this.services.languageDetector&&(l=[]);const c=Gt(l)?l:l&&l[0],u=this.store.hasLanguageSomeTranslations(c)?c:this.services.languageUtils.getBestMatchFromCodes(Gt(l)?[l]:l);u&&(this.language||a(u),this.translator.language||this.translator.changeLanguage(u),(m=(h=this.services.languageDetector)==null?void 0:h.cacheUserLanguage)==null||m.call(h,u)),this.loadResources(u,p=>{s(p,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?i(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(i):this.services.languageDetector.detect(i):i(t),r}getFixedT(t,n,r){const a=(s,i,...l)=>{let c;typeof i!="object"?c=this.options.overloadTranslationOptionHandler([s,i].concat(l)):c=q({},i),c.lng=c.lng||a.lng,c.lngs=c.lngs||a.lngs,c.ns=c.ns||a.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||a.keyPrefix);const u=this.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(s)?h=s.map(m=>(typeof m=="function"&&(m=S1(m,q(q({},this.options),i))),"".concat(c.keyPrefix).concat(u).concat(m))):(typeof s=="function"&&(s=S1(s,q(q({},this.options),i))),h=c.keyPrefix?"".concat(c.keyPrefix).concat(u).concat(s):s),this.t(h,c)};return Gt(t)?a.lng=t:a.lngs=t,a.ns=n,a.keyPrefix=r,a}t(...t){var n;return(n=this.translator)==null?void 0:n.translate(...t)}exists(...t){var n;return(n=this.translator)==null?void 0:n.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,n={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],a=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const i=(l,c)=>{const u=this.services.backendConnector.state["".concat(l,"|").concat(c)];return u===-1||u===0||u===2};if(n.precheck){const l=n.precheck(this,i);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||i(r,t)&&(!a||i(s,t)))}loadNamespaces(t,n){const r=tp();return this.options.ns?(Gt(t)&&(t=[t]),t.forEach(a=>{this.options.ns.indexOf(a)<0&&this.options.ns.push(a)}),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=tp();Gt(t)&&(t=[t]);const a=this.options.preload||[],s=t.filter(i=>a.indexOf(i)<0&&this.services.languageUtils.isSupportedCode(i));return s.length?(this.options.preload=a.concat(s),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}dir(t){var a,s;if(t||(t=this.resolvedLanguage||(((a=this.languages)==null?void 0:a.length)>0?this.languages[0]:this.language)),!t)return"rtl";try{const i=new Intl.Locale(t);if(i&&i.getTextInfo){const l=i.getTextInfo();if(l&&l.direction)return l.direction}}catch(i){}const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=((s=this.services)==null?void 0:s.languageUtils)||new Dz(Fz());return t.toLowerCase().indexOf("-latn")>1?"ltr":n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},n){return new wg(t,n)}cloneInstance(t={},n=QT){const r=t.forkResourceStore;r&&delete t.forkResourceStore;const a=he(q(q({},this.options),t),{isClone:!0}),s=new wg(a);if((t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(l=>{s[l]=this[l]}),s.services=q({},this.services),s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r){const l=Object.keys(this.store.data).reduce((c,u)=>(c[u]=q({},this.store.data[u]),c[u]=Object.keys(c[u]).reduce((h,m)=>(h[m]=q({},c[u][m]),h),c[u]),c),{});s.store=new Oz(l,a),s.services.resourceStore=s.store}return s.translator=new _0(s.services,a),s.translator.on("*",(l,...c)=>{s.emit(l,...c)}),s.init(a,n),s.translator.options=a,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ja=wg.createInstance();ja.createInstance=wg.createInstance;ja.createInstance;ja.dir;ja.init;ja.loadResources;ja.reloadResources;ja.use;ja.changeLanguage;ja.getFixedT;ja.t;ja.exists;ja.setDefaultNamespace;ja.hasLoadedNamespace;ja.loadNamespaces;ja.loadLanguages;const{slice:t6e,forEach:n6e}=[];function r6e(e){return n6e.call(t6e.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}function a6e(e){return typeof e!="string"?!1:[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some(n=>n.test(e))}const Bz=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,s6e=function(e,t){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},a=encodeURIComponent(t);let s="".concat(e,"=").concat(a);if(r.maxAge>0){const i=r.maxAge-0;if(Number.isNaN(i))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(i))}if(r.domain){if(!Bz.test(r.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(r.domain)}if(r.path){if(!Bz.test(r.path))throw new TypeError("option path is invalid");s+="; Path=".concat(r.path)}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(r.expires.toUTCString())}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return r.partitioned&&(s+="; Partitioned"),s},Hz={create(e,t,n,r){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+n*60*1e3)),r&&(a.domain=r),document.cookie=s6e(e,t,a)},read(e){const t="".concat(e,"="),n=document.cookie.split(";");for(let r=0;r<n.length;r++){let a=n[r];for(;a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return a.substring(t.length,a.length)}return null},remove(e,t){this.create(e,"",-1,t)}};var i6e={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document!="undefined")return Hz.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:a,cookieOptions:s}=t;n&&typeof document!="undefined"&&Hz.create(n,e,r,a,s)}},o6e={name:"querystring",lookup(e){var r;let{lookupQuerystring:t}=e,n;if(typeof window!="undefined"){let{search:a}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(a=window.location.hash.substring(window.location.hash.indexOf("?")));const i=a.substring(1).split("&");for(let l=0;l<i.length;l++){const c=i[l].indexOf("=");c>0&&i[l].substring(0,c)===t&&(n=i[l].substring(c+1))}}return n}},l6e={name:"hash",lookup(e){var a;let{lookupHash:t,lookupFromHashIndex:n}=e,r;if(typeof window!="undefined"){const{hash:s}=window.location;if(s&&s.length>2){const i=s.substring(1);if(t){const l=i.split("&");for(let c=0;c<l.length;c++){const u=l[c].indexOf("=");u>0&&l[c].substring(0,u)===t&&(r=l[c].substring(u+1))}}if(r)return r;if(!r&&n>-1){const l=s.match(/\/([a-zA-Z-]*)/g);return Array.isArray(l)?(a=l[typeof n=="number"?n:0])==null?void 0:a.replace("/",""):void 0}}}return r}};let Bd=null;const Vz=()=>{if(Bd!==null)return Bd;try{if(Bd=typeof window!="undefined"&&window.localStorage!==null,!Bd)return!1;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch(e){Bd=!1}return Bd};var c6e={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Vz())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&Vz()&&window.localStorage.setItem(n,e)}};let Hd=null;const Gz=()=>{if(Hd!==null)return Hd;try{if(Hd=typeof window!="undefined"&&window.sessionStorage!==null,!Hd)return!1;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch(e){Hd=!1}return Hd};var u6e={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&Gz())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&Gz()&&window.sessionStorage.setItem(n,e)}},d6e={name:"navigator",lookup(e){const t=[];if(typeof navigator!="undefined"){const{languages:n,userLanguage:r,language:a}=navigator;if(n)for(let s=0;s<n.length;s++)t.push(n[s]);r&&t.push(r),a&&t.push(a)}return t.length>0?t:void 0}},h6e={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document!="undefined"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},f6e={name:"path",lookup(e){var a;let{lookupFromPathIndex:t}=e;if(typeof window=="undefined")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(a=n[typeof t=="number"?t:0])==null?void 0:a.replace("/",""):void 0}},m6e={name:"subdomain",lookup(e){var a,s;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window!="undefined"&&((s=(a=window.location)==null?void 0:a.hostname)==null?void 0:s.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};let zZ=!1;try{document.cookie,zZ=!0}catch(e){}const qZ=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];zZ||qZ.splice(1,1);const p6e=()=>({order:qZ,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e});class YZ{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t,this.options=r6e(n,this.options||{},p6e()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=a=>a.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(i6e),this.addDetector(o6e),this.addDetector(c6e),this.addDetector(u6e),this.addDetector(d6e),this.addDetector(h6e),this.addDetector(f6e),this.addDetector(m6e),this.addDetector(l6e)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return t.forEach(r=>{if(this.detectors[r]){let a=this.detectors[r].lookup(this.options);a&&typeof a=="string"&&(a=[a]),a&&(n=n.concat(a))}}),n=n.filter(r=>r!=null&&!a6e(r)).map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}YZ.type="languageDetector";const g6e={comingSoon:"Coming Soon",save:"Save",cancel:"Cancel",enterName:"Enter name",download:{csvTitle:"Download CSV"},actionButtons:{tooltips:{datakitStudio:"DataKit Studio"},dataKitStudio:"DataKit Studio",datakitStudio:"DataKit Studio",feedback:"Feedback",documentation:"Documentation",discord:"Discord",whatsNew:"What's New",viewDocumentation:"View documentation",joinDiscord:"Join our Discord",viewChangelog:"View changelog",feedbackModal:{title:"Share Your Feedback",thankYou:"Thank you for your feedback!",emailLabel:"Email (optional)",emailPlaceholder:"your.email@example.com",messageLabel:"Message *",messagePlaceholder:"Share your thoughts, suggestions, or report issues...",close:"Close",cancel:"Cancel",sending:"Sending...",sendFeedback:"Send Feedback"}},buttons:{cancel:"Cancel",save:"Save",close:"Close",submit:"Submit",back:"Back",next:"Next",continue:"Continue",copy:"Copy",edit:"Edit",delete:"Delete",remove:"Remove",add:"Add",create:"Create",update:"Update",import:"Import",export:"Export",connect:"Connect",disconnect:"Disconnect",test:"Test",retry:"Retry",refresh:"Refresh",reset:"Reset"},loading:{processing:"Processing...",loading:"Loading...",sending:"Sending...",saving:"Saving...",importing:"Importing...",testing:"Testing...",connecting:"Connecting...",uploading:"Uploading..."},labels:{email:"Email",emailOptional:"Email (optional)",name:"Name",fullName:"Full Name",password:"Password",username:"Username",host:"Host",port:"Port",database:"Database",schema:"Schema",url:"URL",or:"or",and:"and",required:"Required",optional:"Optional",tip:"Tip"},status:{active:"Active",inactive:"Inactive",connected:"Connected",disconnected:"Disconnected",ready:"Ready",pending:"Pending",success:"Success",error:"Error",failed:"Failed",completed:"Completed",processing:"Processing"},messages:{noResults:"No results found",noData:"No data available",noItems:"No items",comingSoon:"Coming Soon",poweredBy:"Powered by",built:"built"},on:"ON",off:"OFF"},E6e={app:{title:"DataKit"},navigation:{tabs:{preview:"Preview",query:"Query",notebook:"Notebook",visualization:"Visualize",ai:"Assistant"}},sidebar:{uploadFile:"Upload File",importDescription:"Import your data file for analysis",signIn:"Sign In",getStarted:"Get Started Free",settings:"Settings",expand:"Expand sidebar",collapse:"Collapse sidebar",fileImported:"File Imported",fileImportedMessage:"{{fileName}} has been imported successfully"},mobile:{title:"DataKit works best on desktop",description:"Experience powerful data analysis and seamless file processing.",switchNote:"Switch to desktop for the full experience, or",watchDemo:"watch the demo",discord:"Discord"},actionButtons:{dataKitStudio:"DataKit Studio",feedback:"Feedback",documentation:"Documentation",discord:"Discord",whatsNew:"What's New"},tooltips:{joinDiscord:"Join our Discord",viewDocs:"View documentation",viewChangelog:"View changelog",datakitStudio:"DataKit Studio"},splitView:{title:"Split View",swapFiles:"Swap files",close:"Close split view",columnCount:"{{count}} cols"}},T6e={modal:{welcomeBack:"Welcome Back",joinDataKit:"Join DataKit",signIn:"Sign In",signOut:"Sign Out",createAccount:"Create Account",alreadyHaveAccount:"Already have an account? ",dontHaveAccount:"Don't have an account? ",signUp:"Sign up",privacyPolicy:"Privacy Policy"},fields:{fullName:"Full Name",emailAddress:"Email Address",password:"Password"},placeholders:{enterName:"Enter your full name",enterEmail:"Enter your email",enterPassword:"Enter your password",createPassword:"Create a strong password"},loading:{signingIn:"Signing In...",creatingAccount:"Creating Account..."},messages:{welcomeSuccess:"Welcome back!",welcomeSuccessDesc:"You've successfully signed in to DataKit.",accountCreated:"Welcome to DataKit!",accountCreatedDesc:"Your account has been created successfully. You now have access to DataKit models with $3 to get started.",signedOut:"Signed out successfully",signedOutDesc:"You've been securely signed out of DataKit.",privacyNotice:"By creating an account, you agree to our "},password:{requirements:"Security Requirements",minLength:"At least 12 characters long",hasUppercase:"Contains uppercase letter (A-Z)",hasLowercase:"Contains lowercase letter (a-z)",hasNumbers:"Contains number (0-9)",hasSpecialChars:"Contains special character (!@#$%^&*...)",noCommonPatterns:"No common patterns or sequences"},benefits:{title:"Why join DataKit?",aiAccess:"Access to DataKit Assistant with built-in credits",cloudConnectors:"Access to all cloud connectors",exportReports:"Export reports from data inspector",prioritySupport:"Priority support and early access to new features"},userMenu:{getStartedFree:"Get Started Free",settings:"Settings",billing:"Billing",user:"User",signIn:"Sign In",signUp:"Sign Up",signOut:"Sign Out",signOutSuccess:"Signed out successfully",signOutMessage:"You've been securely signed out of DataKit."},authGate:{title:"Sign In Required",description:"This feature requires authentication to ensure security and enable advanced functionality.",getStartedFree:"Get Started Free",alreadyHaveAccount:"Already have an account?",signIn:"Sign In"},protectedRoute:{loading:"Loading...",authRequired:"Authentication Required",signInMessage:"Please sign in to access this feature.",signInButton:"Sign In"}},y6e={empty:{title:"Get started with DataKit",description:"Import your files to start analyzing.",privacy:"Everything runs locally",privacyNote:"— Your data stays private.",openFile:"Open file",importFrom:"import from:",selfHost:"Self-host DataKit:",watchDemo:"watch a demo",localFiles:"Local files",dropOrClick:"Drop files here or click to browse",processing:"Processing files..."},providers:{postgresql:{name:"PostgreSQL",description:"Postgres Databases"},s3:{name:"Amazon S3",description:"Public S3 buckets"},huggingface:{name:"HuggingFace",description:"ML datasets"},googleSheets:{name:"Google Sheets",description:"Published sheets"}},install:{docker:"Docker",homebrew:"Homebrew",python:"Python",nodejs:"Node.js"},tooltips:{openFile:"Open File",localFiles:"Local files"}},x6e={dropzone:{title:"Drop files here or click",description:"Supports large data files",dragTitle:"Drop your file here",dragDescription:"Ready to import"},formats:{csv:"CSV",json:"JSON",xlsx:"XLS",parquet:"PQT",txt:"TXT",duckdb:"DB"},messages:{fileRemoved:"File Removed",fileRemovedDesc:'"%s" has been removed from workspace',remoteFileImported:"Remote File Imported",remoteFileImportedDesc:'"%s" has been imported from %s'},dataFiles:"Data Files",largeSizeWarning:"This file is {{size}}MB which may cause memory issues. Continue anyway? (Consider using Chrome to have a better experience.)",modernBrowserWarning:"This file is {{size}}MB. For better performance with large files, use a modern browser (Chrome/Edge) with streaming support.",invalidFileType:"Please import a CSV, JSON, Excel, Parquet, TXT, or DuckDB database file",dragDropLargeFileWarning:"This file is {{size}}MB. For better performance, try using the file picker instead of drag-and-drop for large files.",dropHere:"Drop your file here",readyToImport:"Ready to import",processing:"Processing...",dropOrClick:"Drop files here or click",supportsLargeFiles:"Supports large data files"},S6e={googleSheets:{title:"Google Sheets Import",urlLabel:"Google Sheets URL (published to the web)",urlPlaceholder:"https://docs.google.com/spreadsheets/d/e/2PACX...",requirements:{title:"Requirements:",published:"Sheet must be published to the web",formats:"Supports CSV, Excel, and web page formats",noAuth:"No authentication required for published sheets"},status:{ready:"Published sheet - ready to import",openInSheets:"Open in Google Sheets"},buttons:{import:"Import Sheet"},validation:{enterUrl:"Please enter a Google Sheets URL",validUrl:"Please enter a valid Google Sheets URL that's published to the web",invalidUrl:"Please enter a valid URL"}},s3:{title:"S3 Import",urlLabel:"S3 URL (public bucket)",urlPlaceholder:"s3://bucket/path/file.csv or https://bucket.s3.amazonaws.com/file.csv",exampleDatasets:{title:"Example Datasets",description:"Try these curated public datasets to get started",featured:"Featured",loadingDatasets:"Loading datasets..."},browserAccess:{title:"S3 Browser Access:",corsNote:"Most S3 buckets require proxy access due to CORS",formats:"Supports CSV, JSON, Parquet, Excel formats",autoDetect:"Auto-detects file format and compression"},status:{ready:"Valid S3 URL - ready to import"},buttons:{import:"Import from S3",importDataset:"Import Dataset"},validation:{enterUrl:"Please enter an S3 URL",validUrl:"Please enter a valid S3 URL"}},postgresql:{title:"PostgreSQL Connections",description:"Connect to your PostgreSQL databases",connections:{addConnection:"Add Connection",noConnections:"No Connections",noConnectionsDesc:"Create your first PostgreSQL connection to start importing data.",createConnection:"Create Connection"},form:{newConnection:"New PostgreSQL Connection",editConnection:"Edit Connection",description:"Enter your PostgreSQL database connection details",connectionName:"Connection Name",defaultSchema:"Default Schema",enableSSL:"Enable SSL",placeholders:{connectionName:"My PostgreSQL DB",host:"localhost",username:"username",password:"password",database:"my_database",schema:"public"},buttons:{testAndCreate:"Test & Create"}},tableSelection:{title:"Select Tables",description:"Choose tables to connect from %s.",backToConnections:"Back to Connections",searchPlaceholder:"Search tables...",loadingTables:"Loading tables...",noTables:"No Tables Found",noTablesDesc:"No tables found in this database.",noSearchResults:"No tables match your search.",connectSelected:"Connect Selected Tables",tablesSelected:"%d table(s) selected"}}},b6e={header:{title:"Settings",subtitle:"Manage your account"},footer:{poweredBy:"Powered by DuckDB",built:"built",company:"DataKit"},tabs:{profile:"Profile",workspace:"Workspace & Team",ai:"AI settings",appearance:"Appearance",notifications:"Notifications",subscription:"Subscription"},signout:{successTitle:"Signed out successfully",successMessage:"You've been securely signed out of DataKit.",button:"Sign Out"},navigation:{backToDataKit:"Back to DataKit",signOut:"Sign Out"},sidebar:{expand:"Expand sidebar",collapse:"Collapse sidebar"},title:"Settings",language:"Language",themeColor:"Theme Color",profile:{title:"Profile Information",emailNote:"Email cannot be changed. Contact support if needed.",saveChanges:"Save Changes"},workspace:{title:"Workspace Information",teamMembers:{title:"Team Members",inviteMember:"Invite Member"},inviteMember:"Invite Member",inviteForm:{title:"Invite New Member",emailLabel:"Email Address",roleLabel:"Role",emailPlaceholder:"Enter email address",roles:{member:"Member",admin:"Admin",owner:"Owner"},sendInvite:"Send Invite",sending:"Sending...",cancel:"Cancel"},loadingMembers:"Loading members...",roles:{owner:"Owner",admin:"Admin",member:"Member"},loading:{userData:"Loading user data...",workspaces:"Loading workspaces...",members:"Loading members..."},noWorkspace:"No workspace found. Please create a workspace or contact support.",workspaceName:{placeholder:"Workspace name",editTitle:"Edit workspace name"},personalWorkspace:"Personal workspace",unlimitedCredits:"Unlimited credits",creditsRemaining:"{{count}} credits remaining",unknownUser:"Unknown User"},notifications:{title:"Notification Preferences",email:{title:"Email Notifications",description:"Receive updates about new features and announcements"},usage:{title:"Usage Alerts",description:"Get notified when you're close to your credit limit"},saveSettings:"Save Notification Settings"},ai:{title:"AI Configuration",description:"Choose how DataKit processes your data with AI",datakitModels:{title:"DataKit Models",description:"Premium AI models optimized for data analysis. No API keys needed.",features:{powered:"Powered by Anthropic",pretuned:"Pre-tuned for SQL & data transformation",claude:"Claude 3.5 Sonnet & Haiku included",zeroConfig:"Zero configuration required",preTuned:"Pre-tuned for SQL & data transformation",claudeModels:"Claude 3.5 Sonnet & Haiku included"},subscription:{proPlan:"Pro Plan",price:"$19/mo",viewPlans:"View All Plans →"},credits:"Credits",poweredBy:"Powered by Anthropic",active:"Active",proPlan:"Pro Plan",viewPlans:"View All Plans →"},alternativeProviders:{title:"Alternative Providers",description:"Use your own API keys for these providers"},settings:{autoExecute:{title:"Auto-execute SQL",description:"Run AI queries automatically"}},unlimited:"Unlimited",creditStatus:{good:"Good",low:"Low",veryLow:"Very Low"},providerStatus:{available:"Available",configured:"Configured",upgradeRequired:"Pro/Team Required",setupRequired:"Setup Required"},credits:{title:"Credits"},providers:{getApiKey:"Get API key",edit:"Edit",save:"Save",cancel:"Cancel",activate:"Activate",active:"Active"},whyDatakit:{title:"Why DataKit Models?",features:{noApiKeys:"No API keys to manage",monthlyCredits:"Credits monthly",optimized:"Optimized for data tasks"},learnMore:"Learn More →"},autoExecuteSql:{title:"Auto-execute SQL",description:"Run AI queries automatically"}},appearance:{title:"Appearance",description:"Customize DataKit's theme color",current:"Current",displayMode:"Display Mode",themes:{datakitTeal:"DataKit Teal",oceanBlue:"Ocean Blue",royalPurple:"Royal Purple",vibrantRed:"Vibrant Red",forestGreen:"Forest Green",coralPink:"Coral Pink"},modes:{system:"System",light:"Light",dark:"Dark"}},subscription:{title:"Subscription Plans",description:"Choose the plan that fits your needs",badges:{earlyAdopter:"Early Adopter: 20% OFF",comingSoon:"Coming Soon",moreCredits:"More credits soon!",currentPlan:"Current Plan"},plans:{period:{month:"month"},free:{title:"Free",description:"Perfect for getting started",features:{credits:"315 credits per month",anthropicModels:"Powered by Anthropic models",personalWorkspace:"Personal workspace",basicAnalysis:"Basic data analysis",communitySupport:"Community support"}},pro:{title:"Pro",description:"With more Anthropic credits",features:{credits:"1500 credits per month",advancedAnalytics:"Advanced analytics",prioritySupport:"Priority support",exportCapabilities:"More export capabilities",advancedIntegrations:"Advanced integrations"}},team:{title:"Team",price:"Custom",description:"For growing teams",features:{unlimitedCredits:"Unlimited credits",teamCollaboration:"Team collaboration",multipleWorkspaces:"Multiple Workspaces",memberManagement:"Member management",premiumSupport:"Premium support",customIntegrations:"Custom integrations",advancedSecurity:"Advanced security",accountManager:"Dedicated account manager"}}},currentUsage:{title:"Current Usage",creditsRemaining:"Credits Remaining",currentPlan:"Current Plan",nextReset:"Next Reset"},moreFeatures:"+{{count}} more features",waitlist:{successTitle:"You're on the waitlist!",successMessage:"We'll let you know at {{email}} when {{featureName}} features roll out.",error:"Something went wrong. Please try again.",joining:"Joining...",getNotified:"Get notified",modalTitle:"Join Waitlist",modalDescription:"Enter your email to get notified when Pro features are released.",emailPlaceholder:"your.email@example.com",cancel:"Cancel",joinWaitlist:"Join Waitlist"}}},v6e={title:"Share Your Feedback",emailLabel:"Your Email (optional)",feedbackLabel:"Your Feedback",placeholder:"Tell us what you think about DataKit...",placeholderAlt:"Share your thoughts, suggestions, or report issues...",success:"Thank you for your feedback!",button:{text:"Share Feedback?"},modal:{title:"Share Your Feedback",success:"Thank you for your feedback!",emailLabel:"Your Email (optional)",emailPlaceholder:"your@email.com",messageLabel:"Your Feedback",messagePlaceholder:"Tell us what you think about DataKit...",sending:"Sending..."}},A6e={templates:{title:"Templates",searchPlaceholder:"Search templates...",categories:{dataAnalysis:"Data Analysis",visualization:"Visualization",machineLearning:"Machine Learning",huggingFace:"Hugging Face",statistics:"Statistics",utilities:"Utilities"},noTemplates:"No templates found",noTemplatesAvailable:"No templates available",copyToClipboard:"Copy to clipboard",packages:"Packages:",showCode:"Show",hideCode:"Hide",filters:{all:"All"},noTemplatesFound:"No templates found",use:"Use",templateCount:"{{count}} templates",requires:"Requires:",clearSearch:"Clear search"},workspace:{aiGeneratedVisualization:"AI Generated Visualization",status:{saved:"Saved",initializing:"Initializing Python",loadingPackages:"Loading pandas, numpy on your browser..."}},apiKey:{configuration:"Configuration",configureDescription:"Configure AI providers and settings",providerTypes:{local:"Local",cloudApi:"Cloud API"},serverConfiguration:"Server Configuration",ollamaServerUrl:"Ollama Server URL",ollamaServerUrlDescription:"The URL where your Ollama server is running",apiKeyConfiguration:"API Key Configuration",apiKey:"API Key",enterApiKeyPlaceholder:"Enter your {{provider}} API key",skipApiKeysTitle:"Skip the API keys with DataKit credits",skipApiKeysDescription:"Get instant access to powerful AI models without managing API keys. Credits included with your account.",signInToGetStarted:"Sign in to get started",getApiKey:"Get API Key",generalSettings:"General Settings",autoExecuteSQL:"Auto-execute generated SQL",autoExecuteSQLDescription:"Automatically run SQL queries generated by AI",saveConfiguration:"Save Configuration",providers:{ollama:{description:"Local Ollama server - runs models on your machine",helpText:"Run AI models locally with complete privacy. Requires Ollama to be running at http://localhost:11434"},openai:{description:"GPT-4o and GPT-4o Mini models",helpText:"Most capable models for complex reasoning and analysis."},anthropic:{description:"Claude 4.5 Sonnet and smaller models",helpText:"Excellent for detailed analysis and explanations. Free credits for new users."},groq:{description:"Ultra-fast Llama 3.1 models with free tier",helpText:"Fastest inference speed, perfect for trying AI features. Completely free to start."}}},response:{title:"Response",tokens:"Tokens",tokensResponse:"response",tokensViz:"viz",placeholder:"Ask a question to see responses here",thinking:"Thinking..."},results:{placeholder:"Query results will appear here",error:{title:"Query Error"}},context:{label:"Context",more:"more",noTables:"No tables in context",addTables:"Add Tables",models:"Models",autoExecute:"Auto-execute"},error:{noModel:{title:"No Model Selected",message:"Please select an AI model from the dropdown to continue."},noData:{title:"No Data Available",message:"Please add a table to the context to ask questions about it."},auth:{title:"Authentication Required",message:"Please sign in or configure your API keys to use AI models."},rateLimit:{title:"Rate Limit Exceeded",message:"You've reached the rate limit. Please try again later or upgrade your plan."},connection:{title:"Connection Error",message:"Unable to connect to the AI service. Please check your internet connection."},generic:{title:"Something went wrong"},retry:"Retry",dismiss:"Dismiss"},pythonCell:{expandInput:"Expand input",collapseInput:"Collapse input",executing:"Executing...",executeTooltip:"Execute Cell (Shift+Enter)",previewMarkdown:"Preview Markdown",editMarkdown:"Edit Markdown",deleteCell:"Delete Cell",moveUp:"Move Up",moveDown:"Move Down",copyCode:"Copy Code",clearOutput:"Clear Output",showInput:"Show Input",hideInput:"Hide Input",showOutput:"Show Output",hideOutput:"Hide Output",bold:"Bold",italic:"Italic",header1:"Header 1",header2:"Header 2",header3:"Header 3",list:"List",quote:"Quote",link:"Link",inlineCode:"Inline Code",clickToEdit:"Click to edit markdown...",plotOutput:"Plot Output",plotOutputAlt:"Python plot output",htmlOutput:"HTML Output",columns:"Columns:",moreRows:"... and {{count}} more rows",expandOutput:"Expand output",collapseOutput:"Collapse output",output:"Output"},packageManager:{pythonNotInitialized:"Python not initialized",initializePython:"Initialize Python to manage packages",title:"Package Manager",searchPlaceholder:"Search packages...",showInstalledOnly:"Show Installed Only",installedCount:"{{count}} installed",installCustom:"Install Custom Package",packageNamePlaceholder:"Package name (e.g., requests)",packageInfo:"Only pure Python packages or packages with WebAssembly builds",noPackagesFound:"No packages found",noPackagesToShow:"No packages to show",installed:"Installed",install:"Install",installedPackagesTitle:"Installed Packages ({{count}})",refresh:"Refresh",andMore:"... and {{count}} more"},scriptHistory:{justNow:"Just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago",title:"Notebooks",searchPlaceholder:"Search Notebooks...",createNewNotebook:"Create New Notebook",newNotebook:"New Notebook",savedScriptsCount:"{{count}} saved scripts",importScript:"Import script",import:"Import",noScriptsFound:"No scripts found",noSavedScripts:"No saved scripts",saveFirstScript:"Save your first script to see it here",current:"Current",cellsCount:"{{count}} cells",executed:"Executed",loadScript:"Load Script",rename:"Rename",duplicate:"Duplicate",export:"Export",delete:"Delete",saveAndCreateNew:"Save and Create New",saveNotebook:"Save Notebook",enterNotebookName:"Enter notebook name"},variableInspector:{dataFrameDescription:"DataFrame with {{rows}} rows and {{columns}} columns",seriesDescription:"Series with {{size}} elements{{dtype}}",arrayDescription:"Array with shape {{shape}}{{dtype}}",listDescription:"List with {{size}} elements",dictDescription:"Dictionary with {{size}} keys",confirmClear:"Are you sure you want to clear the Python namespace? This will remove all variables.",pythonNotInitialized:"Python not initialized",initializePython:"Initialize Python to inspect variables",title:"Variables",refreshVariables:"Refresh variables",clearNamespace:"Clear namespace",searchPlaceholder:"Search variables...",variableCount:"{{filtered}} of {{total}} variables",noVariables:"No variables in namespace",noMatches:"No variables match your search",executeCode:"Execute some Python code to see variables here",copyVariableName:"Copy variable name",collapse:"Collapse",expand:"Expand",shape:"Shape: ({{shape}})",size:"Size: {{size}}",dtype:"DType: {{dtype}}",dataFrameInfo:"DataFrame Info:",dataFrameColumns:"Columns: {{columns}}",dataFrameIndex:"Index: {{count}} entries",memoryUsage:"Memory usage: ~{{size}} KB",contents:"Contents:",copyTip:"Click variable names to copy them to your clipboard"}},R6e={stats:{hideStats:"Hide Stats",showStats:"Show Stats",columnStats:"Column Stats"},inspector:"Inspector",jsonView:{table:"Table",tree:"Tree"},error:{loadingData:"Error loading data"},contextMenu:{sortAscending:"Sort Ascending",sortDescending:"Sort Descending",copy:'Copy "{{value}}"'},errors:{missingParameters:"Missing required parameters for AI action",aiFailed:"AI action failed:",signInRequired:"Please sign in to use AI-powered column actions with Datakit Smart.",actionFailed:"AI action failed: {{error}}",unknownError:"Unknown error"},success:{tableCreated:"Success! Created new table: {{tableName}}"},noData:"No data to display",columnHeader:{aiActions:"AI Column Actions",stats:{null:"null: {{percentage}}",unique:"uniq: {{count}}",noStats:"no stats"}},demoModal:{defaultTitle:"DataKit Demo",close:"Close modal",videoNotSupported:"Your browser does not support the video tag."}},N6e={title:"Take a look at your DataKit"},_6e={steps:{welcome:{title:"Welcome to DataKit",description:"Datakit doesn’t upload your data anywhere, it works with your files locally, with your browser as the engine.",ctaText:"Get started"},preview:{title:"Inspect & Analyze",description:"Preview your data, clean it, transform it and change and use it to build insights.",ctaText:"Explore data"},sql:{title:"SQL Editor",description:"Work with your data files just like you would as if they were in a database with the help of our AI assistance on intelligent autocomplete and suggestions.",ctaText:"Try it now"},notebooks:{title:"Python Notebooks",description:"Run Python code directly in your browser. Create interactive notebooks for advanced data science workflows.",ctaText:"Start analyzing"},remoteSources:{title:"Remote Sources",description:"Connect to cloud databases and data sources. Import from PostgreSQL, S3, HuggingFace, Google Sheets, and more remote locations.",ctaText:"Start exploring"}},buttons:{previous:"Previous",next:"Next",getStarted:"Get Started"}},w6e={title:"DataKit",description:"Your data, your choice. Process locally for complete privacy or leverage cloud when you need to collaborate. The modern data analysis platform that adapts to you.",keywords:"data analysis, privacy-first analytics, local data processing, WebAssembly, DuckDB, data visualization, SQL queries, CSV analysis, Excel processing, data science, business intelligence, secure analytics, DataKit"},C6e={importing:"Importing Dataset",processing:"Processing {{organization}}/{{dataset}}..."},I6e={title:"App Information",subtitle:"Version and build details",description:"Version information and application details for DataKit",version:"Version",environment:"Environment"},O6e={title:"Page Not Found",description:"The requested page could not be found",message:"The page you're looking for doesn't exist.",goHome:"Go Home"},L6e={title:"Privacy Policy",description:"DataKit's privacy policy - Learn how we protect your data and what analytics we collect",backToDatakit:"Back to DataKit"},M6e={placeholder:"PLACEHOLDER"},D6e={popup:{title:"The data platform that works your way",description:"Your data, your choice. Process locally for complete privacy or leverage cloud when you need to collaborate.",freeFeatures:"What you get free",features:{cloudConnectors:"All cloud connectors",credits:"$3 DataKit Assistant credits",exportViz:"Export & visualizations"},enterprise:{title:"Enterprise ready",contact:"Contact us →",description:"Deploy on-premise for complete control or hybrid cloud for flexibility. SOC2 compliant infrastructure."},startFree:"Start free with $3 credits →",existingAccount:"Already have an account? Sign in"}},P6e={closeFile:"Close file",splitWith:"Split with {{partner}}",googleSheets:"Google Sheets",contextMenu:{rename:"Rename",duplicate:"Duplicate",closeOthers:"Close Others",closeAll:"Close All"},moreTabs:"{{count}} more tabs",loading:"Loading...",import:"Import"},k6e={preview:{label:"Preview",description:"View and explore your data"},query:{label:"SQL",description:"Query with SQL"},notebook:{label:"Notebook",description:"Analyze with Jupyter notebook"},visualization:{label:"Visualize",description:"Create charts and graphs"},ai:{label:"Assistant",description:"AI-powered insights"}},j6e={googleSheets:{urlLabel:"Google Sheets URL (published to the web)",urlPlaceholder:"https://docs.google.com/spreadsheets/d/e/2PACX...",validation:{urlRequired:"Please enter a Google Sheets URL",invalidPublishedUrl:"Please enter a valid Google Sheets URL that's published to the web",invalidUrl:"Please enter a valid URL"},status:{readyToImport:"Published sheet - ready to import"},actions:{openInSheets:"Open in Google Sheets",importing:"Importing",importSheet:"Import Sheet"},requirements:{title:"Requirements",published:"Sheet must be published to the web",formats:"Supports CSV, Excel, and web page formats",noAuth:"No authentication required for published sheets"}},huggingface:{loading:{configurations:"Loading configurations...",datasets:"Loading datasets..."},config:{title:"Dataset Configuration",configuration:"Configuration (Subset)",availableSplits:"Available splits",split:"Split",willImport:"Will import"},datasetId:{label:"Dataset ID",placeholder:"microsoft/DialoGPT-medium or yandex/yambda:SelfRC/train"},dataset:{featured:"Featured",updated:"Updated",recently:"Recently",importing:"Importing",import:"Import Dataset"},strategy:{directStreaming:"Fastest, no download required",parquetDownload:"Reliable, full dataset download",alternativeFormat:"Fallback to CSV/JSON format"},validation:{datasetIdRequired:"Please enter a dataset ID",invalidDatasetId:"Please enter a valid dataset ID"},auth:{title:"Authentication (Optional)",hide:"Hide",show:"Show",description:"Required for private or gated datasets. Get your token from",settingsLink:"HuggingFace Settings",tokenPlaceholder:"hf_xxxxxxxxxxxxxxxxxxxxxxxxx"},actions:{importing:"Importing",importDataset:"Import Dataset",view:"View"},search:{title:"Search Datasets",placeholder:"Search datasets by name, task, or description...",results:"Search Results"},featured:{title:"Featured Datasets",description:"Popular datasets to get you started"},footer:{title:"HuggingFace Integration",memoryEfficient:"Memory-efficient processing for large datasets",multiFormat:"Multi-format support (Parquet, CSV, JSON, XLSX, TXT)"},error:{importFailed:"Import Failed"},status:{validDatasetId:"Valid dataset ID - ready to import"},progress:{complete:"complete",initializing:"Initializing..."}},postgresql:{confirmDelete:'Are you sure you want to delete the connection "{{name}}"?',connections:{title:"PostgreSQL Connections",description:"Connect to your PostgreSQL databases",addConnection:"Add Connection"},loading:{connections:"Loading connections...",tables:"Loading tables..."},noConnections:{title:"No Connections",description:"Create your first PostgreSQL connection to start importing data.",createConnection:"Create Connection"},status:{active:"Active",inactive:"Inactive"},form:{editConnection:"Edit Connection",newConnection:"New PostgreSQL Connection",description:"Enter your PostgreSQL database connection details",connectionName:"Connection Name",connectionNamePlaceholder:"My PostgreSQL DB",host:"Host",hostPlaceholder:"localhost",port:"Port",portPlaceholder:"5432",database:"Database",databasePlaceholder:"my_database",username:"Username",usernamePlaceholder:"username",password:"Password",passwordPlaceholder:"password",defaultSchema:"Default Schema",schemaPlaceholder:"public",enableSSL:"Enable SSL",cancel:"Cancel",testing:"Testing...",update:"Update",testCreate:"Test & Create"},tables:{title:"Select Tables",description:"Choose tables to connect from {{name}}.",backToConnections:"Back to Connections",searchPlaceholder:"Search tables...",selectedCount:"{{count}} table selected;{{count}} tables selected",connectSelected:"Connect Selected Tables"},noTables:{title:"No Tables Found",noMatches:"No tables match your search.",noTablesFound:"No tables found in this database."},auth:{title:"Sign In Required",description:"PostgreSQL connections require authentication to keep your database credentials secure."}},s3:{dataset:{featured:"Featured",importing:"Importing",import:"Import Dataset"},validation:{urlRequired:"Please enter an S3 URL",invalidUrl:"Please enter a valid S3 URL"},urlLabel:"S3 URL (public bucket)",urlPlaceholder:"s3://bucket/path/file.csv or https://bucket.s3.amazonaws.com/file.csv",status:{validUrl:"Valid S3 URL - ready to import"},actions:{importing:"Importing",importFromS3:"Import from S3"},examples:{title:"Example Datasets",description:"Try these curated public datasets to get started"},loading:{datasets:"Loading datasets..."},footer:{title:"S3 Browser Access",corsInfo:"Most S3 buckets require proxy access due to CORS",supportedFormats:"Supports CSV, JSON, Parquet, Excel formats",autoDetection:"Auto-detects file format and compression"}}},U6e={preview:{noData:"No data to preview",selectFile:"Select a file tab to view its contents"},visualization:{selectFile:"Select file",postgresqlTable:"PostgreSQL Table",rowCount:"{{count}} rows",postgresqlVisualization:"PostgreSQL Visualization",postgresqlComingSoon:"Coming soon! We're working on chart support for PostgreSQL tables.",chartTypes:{bar:"Bar",line:"Line",area:"Area",pie:"Pie",scatter:"Scatter"},noDataAvailable:"No Data Available",importDataMessage:"Import data files to create visualizations.",importData:"Import Data",hidePanel:"Hide panel",showPanel:"Show panel",pointsCount:"{{count}} points",export:"Export",chartConfiguration:"Chart Configuration",selectDataSource:"Select a data source to begin",selectColumns:"Select columns to visualize"}},F6e={header:{title:"DataKit"},footer:{poweredBy:"Powered by",visitAmin:"Visit Amin",built:"built",company:"DataKit"},workspace:{confirmRemove:'Remove "{{fileName}}" from workspace? This will not delete the actual file.',fileRemovedTitle:"File Removed",fileRemovedMessage:'"{{fileName}}" has been removed from workspace'},upload:{title:"Upload File",description:"Import your data file for analysis"},remote:{importedTitle:"Remote File Imported",importedMessage:'"{{fileName}}" has been imported from {{provider}}',defaultProvider:"remote source",notImplemented:"Remote source re-import not yet implemented. Please use the Cloud Sources button to re-import."},fileAccess:{browserNotSupported:"Your browser ({{browserName}}) does not support automatic file access. Please re-import the file manually. ",useChrome:"For automatic file access, please use Chrome or Edge.",safariLimited:"File access support is limited in Safari. For better experience, use Chrome or Edge.",useChromeForFeatures:"For automatic import features, please use Chrome or Edge.",permissionDenied:'Permission denied to access "{{fileName}}". This can happen due to browser security policies.\n\nClick "OK" to manually select the file again, or "Cancel" to skip.',nameMismatch:'The stored file reference for "{{fileName}}" points to a different file. Please re-select the correct file.',cannotAccess:'Cannot automatically access "{{fileName}}". The file may have been moved, deleted, or access permissions changed.\n\nClick "OK" to manually select the file again, or "Cancel" to skip.',selectCorrectFile:"Please select the correct file: {{fileName}}",couldNotLoad:"Could not load file {{fileName}}. Please re-import it using the file upload button."},expand:"Expand sidebar",collapse:"Collapse sidebar",fileDialog:{dataFiles:"Data Files"}},$6e={show:"Show",rows:"rows",showing:"Showing",countingRows:"Counting rows...",countingLarge:"Counting (large file)...",of:"of",columns:"columns",page:"Page",firstPage:"First page",previousPage:"Previous page",nextPage:"Next page",lastPage:"Last page",notAvailableForViews:"Not available for views"},B6e={title:"Import from Cloud",subtitle:"Connect to your cloud data sources",selectProvider:"Select a provider to get started",comingSoon:"Soon",signInRequired:"Sign in required",providers:{customUrl:"Custom URL",s3:"Amazon S3",huggingface:"HuggingFace",motherduck:"MotherDuck",postgresql:"PostgreSQL",googleSheets:"Google Sheets",googleCloud:"Google Cloud",googleDrive:"Google Drive"}},H6e={thanks:{title:"Thank you!",message:"Your preferences have been saved"},header:{title:"Help improve DataKit"},description:"We use analytics to improve your experience. All data processing happens locally - your files never leave your device.",dropdown:{title:"What do we collect?"},collection:{basic:{title:"Basic analytics (always collected):",performance:"Performance metrics",errors:"Error reports",usage:"Anonymous usage patterns"},advanced:{title:"Advanced analytics (with your consent):",detailed:"Detailed feature usage",sessions:"Session recordings (data masked)",journeys:"User journey tracking"},never:{title:"We never collect:",files:"Your uploaded files",content:"File contents or personal data",queries:"SQL queries or code"}},privacyPolicy:"Privacy Policy",buttons:{accept:"Accept Analytics",decline:"Essential Only"}},V6e={modelSelector:{selectModel:"Select Model",title:"Select AI Model",claudeModels:"Claude Models",signInRequired:"Sign in required",apiKeyRequired:"API key required",creditsPerToken:"{{cost}} credits/1K tokens",dollarsPerToken:"${{cost}}/1K",signUpCredits:"Sign up to use DataKit credits",noApiKeysNeeded:"No API keys needed. Credits included with your account.",signUpButton:"Sign up to get started",creditsRemaining:"Credits remaining: {{count}}"},providers:{datakit:"DataKit",openai:"OpenAI",anthropic:"Anthropic",groq:"Groq",ollama:"Ollama"},prompts:{schemas:"Schemas",hideSchema:"Hide Schema",showSchema:"Show Schema",navigation:{previous:"Previous message",next:"Next message"},actions:{startNewChat:"Start a new chat"},placeholders:{askAboutData:"Ask about your data...",followUp:"Ask follow up question...",askAboutTable:"Ask about {{tableName}}..."},setup:{configure:"Configure your AI model to start asking questions",signUpCredits:"Sign Up for Free Credits",useApiKeys:"Or Use Your Own API Keys",privacyNote:"Models only see your table structure, not your actual data"},suggestions:{title:"Suggestions",exploreData:{title:"Explore Data",prompt:"Give me an overview of this dataset - what columns do we have and what insights can you find?"},findPatterns:{title:"Find Patterns",prompt:"What are the most interesting patterns or trends in this data?"},dataQuality:{title:"Data Quality",prompt:"Check this dataset for missing values, duplicates, or data quality issues"},quickStats:{title:"Quick Stats",prompt:"Show me summary statistics for all numeric columns"}},status:{thinking:"Thinking..."}},localModels:{title:"Local AI Models",description:"Run AI models locally using WebLLM",webgpu:{supported:"WebGPU Supported",notSupported:"Not Supported",required:"WebGPU Required"},storage:{title:"Storage Usage",downloadedModels:"Downloaded Models"},availableModels:"Available Models",useModel:"Use Model",download:"Download",current:"Current",active:"Active",refresh:"Refresh",done:"Done",deleteConfirm:"Are you sure you want to delete this model?"},ollama:{connecting:"Connecting to Ollama...",connected:"Connected to Ollama",connectionFailed:"Connection Failed",connectionFailedTitle:"Failed to connect to Ollama",cannotConnect:"Cannot connect to Ollama server",howToFix:"How to fix this:",installStep:"1. Install Ollama from ollama.ai",runCommand:"2. Run: OLLAMA_ORIGINS=* ollama serve",browserCompatibility:"Browser Compatibility Note:",firefoxNote:"If connection still fails, try using Firefox as it has better support for localhost connections from HTTPS sites.",installedModels:"Installed Models",noModels:"No models installed",pullModelHint:"Pull a model below to get started",pullModelToStart:"Pull a model below to get started",inTerminal:"in terminal",makeSureRunning:"Make sure it's running on {{baseUrl}}",privacyNote:"Models run entirely on your machine for complete privacy.",needMoreModels:"Need more models? Visit",ollamaLibrary:"Ollama Library",tryAgain:"Try Again"},tableSelector:{title:"Select Tables for AI Context",searchPlaceholder:"Search tables...",noTablesFound:"No tables found matching your search",noTablesAvailable:"No tables available",selectedCount:"{{count}} selected",columns:"columns",postgresql:"PostgreSQL",motherduck:"MotherDuck",remote:"Remote",clearAll:"Clear all",cancel:"Cancel",addToContext:"Add to Context",applying:"Applying..."},queryCard:{query:"Query",primary:"Primary",visualize:"Visualize",copySQL:"Copy SQL",copied:"Copied!",editInQueryTab:"Edit in Query Tab",run:"Run",generatingVisualization:"Generating visualization...",queryRunning:"Query is running..."},visualization:{export:{title:"Export Visualization",format:"Export Format",quality:"Quality",options:"Options",includeTitle:"Include title",includeBackground:"Include background",copy:"Copy",copied:"Copied!",export:"Export",exporting:"Exporting...",chartNotFound:"Chart not found",exportFailed:"Export failed"}}},G6e={workspace:{poweredBy:"Powered by WebAssembly",errors:{initFailed:"DuckDB Initialization Failed"},status:{initializing:"Initializing DuckDB",notReady:"DuckDB Not Ready",settingUp:"Setting up your in-browser SQL database...",preparing:"Preparing your environment..."},actions:{retryInit:"Retry Initialization",fullScreenResults:"Full Screen Results",hideHistory:"Hide Query History",showHistory:"Show Query History",exitFullScreen:"Exit Full Screen",hideSchema:"Hide Schema Browser",showSchema:"Show Schema Browser",save:"Save",execute:"Execute",executeShortcut:"Execute query (⌘+Enter)",fullScreenEditor:"Full Screen Editor",dismiss:"Dismiss",cancel:"Cancel"},results:{title:"Query Results",executionTime:"{{time}}ms",rowCount:"{{count}} rows"},fullscreen:{editor:"SQL Editor (Fullscreen)",results:"Query Results (Fullscreen)"},editor:{title:"SQL Editor",optimize:"Optimize",optimizationAvailable:"Query optimization suggestions available"},optimization:{title:"Query Optimization Tips",applyFix:"Apply Fix",optimizeQuery:"Optimize Query"},warnings:{largeDataset:{title:"Large Result Set ({{count}} rows)",description:"This query is returning a large dataset which may affect performance. Consider adding filters or LIMIT clause with lower value to reduce the result size.",addLimit:"Add LIMIT Clause"}},gettingStarted:{title:"Ready to Query Sample Data!",dataReady:"You have uploaded data ready to query. Try the sample query above or write your own SQL.",sampleData:"A sample employees table is available for testing. Import your own CSV, JSON, or Parquet files to query your data."},saveDialog:{title:"Save Query",placeholder:"Enter query name"}},schema:{title:"Schema Browser",noData:"No data available. Import files to get started.",local:"Local",attached:"Attached",shared:"Shared",actions:{refresh:"Refresh schemas",refreshTables:"Refresh tables",refreshSchemas:"Refresh schemas",insertSelect:"Insert SELECT query",insertColumn:"Insert column query"},loading:{local:"Loading local schemas...",database:"Loading {{name}} tables...",schemas:"Loading {{name}} schemas...",postgres:"Loading PostgreSQL schemas...",columns:"Loading columns..."},empty:{local:"No local tables. Import data to get started.",database:"No tables found in {{name}}",postgres:"No tables found. Click refresh to load schemas.",columns:"No columns available"},sections:{tables:"Tables ({{count}})",views:"Views ({{count}})"},postgres:{available:"Available",connected:"Connected",connect:"Connect and browse tables"}},draft:{label:"Draft"}},z6e={saveChart:{myChart:"My Chart",title:"Save Chart",chartName:"Chart Name",enterChartName:"Enter chart name",descriptionOptional:"Description (optional)",enterChartDescription:"Enter chart description",saveAsTemplate:"Save as Template",saveChart:"Save Chart"},export:{title:"Export Chart",exportFormat:"Export Format",options:"Options",includeTitle:"Include title",includeDescription:"Include description",includeBackground:"Include background",exportButton:"Export {{format}}",copied:"Copied!",copy:"Copy"},config:{noChart:"No Chart Selected",chartTitle:"Chart Title",chartTitlePlaceholder:"Enter chart title",tabs:{data:"Data",style:"Style",transform:"Transform"},resetSettings:"Reset Chart Settings"},gallery:{title:"Chart Gallery",searchPlaceholder:"Search charts...",savedCharts:"Saved Charts",templates:"Templates",noCharts:{title:"No Charts Found",noSaved:"You haven't saved any charts yet. Create and save a chart to see it here.",noSearchResults:"No templates match your search.",noTemplates:"No chart templates available."},createNew:"Create New Chart",chartType:"{{type}} Chart",template:"Template",duplicate:"Duplicate",delete:"Delete"},canvas:{noData:{title:"No Chart Data",message:"Configure your chart or run a query to visualize data."},unsupported:"Chart type not supported"},generator:{xAxisField:"X-Axis Field",yAxisField:"Y-Axis Field",selectField:"Select field...",xAxisHelp:"Categories to group your data by",yAxisHelpDate:"Date fields for time analysis",yAxisHelpNumeric:"Numeric values to measure",aggregation:"Aggregation",aggregationHelpDate:"Date aggregations: earliest, latest, or count",aggregationHelpNumeric:"How to calculate the numeric values",aggregationHelpGeneric:"How to aggregate the values",usingAllData:"Using all {{tableName}} data for visualization",processing:"Processing...",generateChart:"Generate Chart",aggregationLabels:{sum:"Sum",avg:"Average",min:"Minimum",max:"Maximum",count:"Count"},description:{sum:'This chart will show the total sum of "{{measure}}" for each "{{dimension}}" category.',avg:'This chart will show the average "{{measure}}" for each "{{dimension}}" category.',min:'This chart will show the minimum "{{measure}}" value for each "{{dimension}}" category.',minDate:'This chart will show the earliest "{{measure}}" date for each "{{dimension}}" category.',max:'This chart will show the maximum "{{measure}}" value for each "{{dimension}}" category.',maxDate:'This chart will show the latest "{{measure}}" date for each "{{dimension}}" category.',count:'This chart will show the count of items in each "{{dimension}}" category.'}}},q6e={title:"Data Inspector",fileSelector:{placeholder:"Select file..."},postgresql:{title:"PostgreSQL Inspector",comingSoon:"Coming soon! We're working on data inspection for PostgreSQL tables."},overview:{title:"Overview",dataOverview:"Data Overview",quality:"{{score}}% Quality",analyzedAt:"Analyzed at {{time}}",rows:"Rows",columns:"Columns",duplicates:"Duplicates",issues:"Issues",critical:"{{count}} critical",qualityBreakdown:"Quality Breakdown",completeness:"Completeness",uniqueness:"Uniqueness",consistency:"Consistency",analysisCompleted:"Analysis completed in {{time}}s"},problems:{title:"Data Quality Issues",noProblems:{title:"No Problems Found!",description:"Your data appears to be clean with no critical issues detected.",healthScore:"Health Score: {{score}}%"},duplicateRows:{title:"Duplicate Rows",description:"{{count}} duplicate rows found ({{percentage}}% of total)"},missingValues:{title:"Missing Values in {{columnName}}",description:"{{count}} null values ({{percentage}}% of column)"},typeIssue:{title:"{{issue}} in {{columnName}}",description:"{{count}} problematic values found"},issueCount:"{{filtered}} of {{total}} issues",severity:{critical:"Critical",warning:"Warning",info:"Info"},filteredBy:"Filtered by:",actions:{viewDetails:"View details",exporting:"Exporting...",exportCompleted:"Export completed!",exportData:"Export data",signInToExport:"Sign in to export data"},details:{examples:"Examples:",count:"Count: {{count}}",percentage:"Percentage: {{percentage}}%",column:"Column: {{columnName}}"},noIssuesFound:"No {{filter}} issues found"},emptyStates:{noAnalysis:{title:"Ready to Analyze",descriptionWithFile:'Start analyzing "{{fileName}}" to discover data quality insights',descriptionNoFile:"Select a file to start your data quality analysis",startButton:"Start Analysis",timeEstimate:"Analysis typically takes 10-30 seconds depending on your data size"},noColumns:{title:"No Columns Found",noMatchingColumns:'No columns matching "{{searchTerm}}"',noFilteredColumns:"No {{filterType}} columns found",totalColumns:"in {{totalColumns}} total columns",noAnalyzableColumns:"This dataset doesn't have any analyzable columns",clearFiltersButton:"Clear Filters",suggestion:"Try adjusting your search or filter criteria"},error:{title:"Analysis Failed",tryAgainButton:"Try Again",resetButton:"Reset",suggestion:"If the problem persists, try with a different file or contact support"}},loading:{steps:{validation:{label:"Validating Data",description:"Checking table structure and accessibility"},schema:{label:"Reading Schema",description:"Identifying column types and structure"},duplicates:{label:"Detecting Duplicates",description:"Scanning for duplicate rows"},columns:{label:"Analyzing Columns",description:"Computing statistics and patterns"},quality:{label:"Quality Assessment",description:"Calculating health scores and recommendations"}},analyzingColumn:"Analyzing: {{currentColumn}} • Column {{currentColumnNumber}} of {{totalColumns}}"},quickActions:{lastAnalyzed:"Last analyzed: {{time}}"}},Y6e={title:"Query History",source:"from indexedDB",tabs:{recent:"Recent",saved:"Saved"},empty:{recent:"No recent queries. Execute a query to see it here.",saved:"No saved queries. Click the star icon to save a query."},unnamedQuery:"Unnamed Query",actions:{save:"Save Query",editName:"Edit Name",copy:"Copy Query",delete:"Delete Query",cancel:"Cancel",use:"Use"},dateFormat:{today:"Today at {{time}}",yesterday:"Yesterday at {{time}}"}},W6e={header:{rowsReturned:"rows returned",showingPage:"showing page {{current}} of {{total}}",downloadCSV:"Download CSV"},emptyState:{executing:"Executing query...",error:"Error",empty:"Execute a query to see results.",noResults:"Query executed successfully. No results returned."},pagination:{rowsPerPage:"Rows per page:",firstPage:"First Page",previousPage:"Previous Page",pageOf:"Page {{current}} of {{total}}",nextPage:"Next Page",lastPage:"Last Page",goTo:"Go to:"}},X6e={unsavedChanges:{title:"Unsaved Changes",message:"You have unsaved changes in your current notebook. What would you like to do?",saveAndContinue:"Save and Continue",discardChanges:"Discard Changes"}},K6e={toolbar:{uploadFiles:"Import",newFolder:"New Folder",newFolderPrompt:"Enter folder name:",openFolder:"Open Folder",browserNotSupported:"Your browser does not support folder access. Please use Chrome or Edge.",remoteSources:"Remote Sources",moreOptions:"More Options",exportStructure:"Export Structure",importStructure:"Import Structure",helpTooltip:"Help - How the workspace works",helpModal:{title:"Workspace Guide",importFiles:{title:"Import Files",description:"Add files with persistent access"},newFolder:{title:"New Folder",description:"Organize your data"},openFolder:{title:"Open Folder",description:"Import folders from your computer"},remoteSources:{title:"Remote Sources",description:"Connect to databases and cloud storage"},tip:"Files location persist between sessions and can be accessed directly from your computer."}},fileTree:{noFiles:"No files in workspace",addFilesHint:"Add files using the source panel above",workspaceFiles:"Workspace Files ({{count}})",remove:"Remove",rename:"Rename"},selector:{selectWorkspace:"Select Workspace",unsaved:"unsaved",workspaces:"Workspaces",organizeDescription:"Organize your files into workspaces. Files are referenced, not stored.",draft:"draft",fileCount:"{{count}} files",file:"file",files:"files",workspaceNamePlaceholder:"Workspace name...",saveDraftAsWorkspace:"Save Draft as Workspace",newWorkspace:"New Workspace",workspaceCreated:"Workspace Created",workspaceCreatedMessage:'"{{name}}" workspace has been created successfully',workspaceRenamed:"Workspace Renamed",workspaceRenamedMessage:'Workspace renamed from "{{oldName}}" to "{{newName}}"',deleteConfirmation:'Delete workspace "{{name}}"? This action cannot be undone.',workspaceDeleted:"Workspace Deleted",workspaceDeletedMessage:'"{{name}}" workspace has been deleted',workspaceSaved:"Workspace Saved",workspaceSavedMessage:'Draft workspace saved as "{{name}}" with {{count}} {{files}}',tooltip:{workspaces:"Workspaces",organizeFiles:"organize your files without storing actual data - only references for privacy.",draft:"Draft",draftDescription:"Temporary workspace for files before saving to a named workspace.",benefits:"Benefits",benefitsDescription:"Keep projects organized, switch between datasets.",limit:"Limit",limitDescription:"Create up to 1 workspaces.",signUp:"Sign up"}}},Q6e={files:"Files",localFiles:"Local files",remote:"Remote",remoteData:"Remote data",connectCloudSources:"Connect Cloud Sources"},J6e={notebookEditor:{title:"Edit Notebook",nameLabel:"Name",namePlaceholder:"Untitled Notebook",descriptionLabel:"Description",descriptionPlaceholder:"Optional description...",autoSaveMessage:"Changes are saved automatically"}},Z6e={title:"Settings",language:"Language",presets:"Presets"},eze={privacy:{dataStaysLocal:{title:"Your Data Stays Local",description:"All data analysis is performed locally in your browser using DuckDB-WASM. Your files and data never leave your device, ensuring complete privacy and security.",aiModelsTitle:"DataKit AI Models - Column Schema Only",importantException:"Important exception:",aiModelsDescription:"When using DataKit AI features, we only send column headers and data types to our AI models - never your actual data. This allows AI to understand your dataset structure while keeping your sensitive information completely private.",aiModelsExample:'For example, from a CSV with customer data, we only send: ["customer_id: INTEGER", "email: VARCHAR", "purchase_amount: DECIMAL"] - the AI never sees actual customer emails or purchase amounts.'},analytics:{title:"Our Two-Tiered Analytics System",description:"We use a privacy-first approach to understand how DataKit is used and improve the experience:",basic:{title:"Basic Analytics (Always Active)",items:["Page views and feature usage","Performance metrics and error tracking","Browser type and general location (country-level)"],note:"This helps us understand which features are popular and fix bugs quickly."},advanced:{title:"Advanced Analytics (Opt-in Only)",items:["Detailed user journey tracking","A/B testing for new features","More granular usage patterns"]},neverCollect:{title:"We Never Collect",items:["Your actual data or file contents","Personal information beyond what you voluntarily provide","Passwords or authentication tokens","Precise location data"]}},thirdParty:{title:"Third-Party Services",items:["Google Analytics: Website usage analytics","PostHog: Product analytics and user feedback","Anthropic Claude: AI-powered data insights (column schemas only)","OpenAI: AI-powered data insights (column schemas only)"]},choices:{title:"Your Choices",description:"You can disable advanced analytics in Settings. Basic analytics remain active to ensure DataKit works properly and securely for all users.",contact:"Questions about privacy? Contact us at privacy@datakit.dev"},lastUpdated:"Last updated"}},tze={common:g6e,layout:E6e,auth:T6e,preview:y6e,fileUpload:x6e,dataImport:S6e,settings:b6e,feedback:v6e,notebooks:A6e,dataGrid:R6e,demo:N6e,demoWizard:_6e,seo:w6e,datasetImport:C6e,info:I6e,notFound:O6e,privacy:L6e,viewer:M6e,signup:D6e,fileTabs:P6e,viewMode:k6e,importModal:j6e,tabs:U6e,sidebar:F6e,pagination:$6e,remoteImport:B6e,consent:H6e,ai:V6e,query:G6e,visualization:z6e,inspector:q6e,queryHistory:Y6e,queryResults:W6e,import:{customUrl:{dataset:{featured:"Featured",importing:"Importing",import:"Import Dataset"},validation:{enterUrl:"Please enter a URL",validUrl:"Please enter a valid URL",fileDetected:"{{format}} file detected",readyToImport:"Valid URL - ready to import"},form:{fileUrlLabel:"File URL (public access)",placeholder:"https://raw.githubusercontent.com/user/repo/main/data.csv"},actions:{importing:"Importing",importFromUrl:"Import from URL",openFileUrl:"Open file URL"},examples:{title:"Example Datasets",subtitle:"Try these curated public datasets from GitHub",loading:"Loading datasets..."},footer:{supportedUrls:"Supported URLs:",directFiles:"Direct file URLs (CSV, JSON, Parquet, Excel)",publicRepos:"Public data repositories and APIs"}},motherduck:{success:{title:"You're all set!",description:"Connection successful. You can query your MotherDuck in the query tab.",goToQuery:"Go to Query Tab"}},gcs:{categories:{all:"All Datasets",earthObservation:"Earth Observation",climate:"Climate Data",geospatial:"Geospatial",research:"Research"},dataset:{featured:"Featured",preview:"Preview",importing:"Importing",import:"Import"},preview:{category:"Category",size:"Size",formats:"Formats",lastUpdated:"Last Updated",tags:"Tags",gcsUrl:"GCS URL",cancel:"Cancel",docs:"Docs",importing:"Importing",importDataset:"Import Dataset"},header:{title:"Google Cloud Storage",subtitle:"Access public datasets and earth observation data"},search:{placeholder:"Search datasets..."},loading:{datasets:"Loading datasets..."},sections:{featured:"Featured Earth Observation",allDatasets:"All Datasets ({{count}})"},empty:{noDatasets:"No datasets found",tryAdjusting:"Try adjusting your search or category filter"}}},dialog:X6e,workspace:K6e,dataSources:Q6e,ui:J6e,settingsPopover:Z6e,pages:eze},nze={comingSoon:"Em Breve",save:"Salvar",cancel:"Cancelar",enterName:"Digite nome",download:{csvTitle:"Baixar CSV"},actionButtons:{tooltips:{datakitStudio:"DataKit Studio"},dataKitStudio:"DataKit Studio",feedback:"opinião",documentation:"Documentação",discord:"Discord",whatsNew:"Novidades",viewDocumentation:"Ver documentação",joinDiscord:"Junte-se ao nosso Discord",viewChangelog:"Ver Registro de Alterações",feedbackModal:{title:"Dê Seu Feedback",thankYou:"Obrigado pelo seu Feedback!",emailLabel:"Email (opcional)",emailPlaceholder:"seu.Email@exemplo.com",messageLabel:"Mensagem *",messagePlaceholder:"Compartilhe suas ideias, sugestões ou relate problemas...",close:"Fechar",cancel:"Cancelar",sending:"Enviando...",sendFeedback:"Enviar Feedback"}},buttons:{cancel:"Cancelar",save:"Salvar",close:"Fechar",submit:"Enviar",back:"Voltar",next:"Próximo",continue:"Continuar",copy:"Copiar",edit:"Editar",delete:"Excluir",remove:"Remover",add:"Adicionar",create:"Criar",update:"Atualizar",import:"Importar",export:"Exportar",connect:"Conectar",disconnect:"Desconectar",test:"Testar",retry:"Tentar novamente",refresh:"Atualizar",reset:"Redefinir"},loading:{processing:"Processando...",loading:"Carregando...",sending:"Enviando...",saving:"Salvando...",importing:"Importando...",testing:"Testando...",connecting:"Conectando...",uploading:"Enviando arquivo..."},labels:{email:"Email",emailOptional:"Email (opcional)",name:"Nome",fullName:"Nome completo",password:"Senha",username:"Nome de usuário",host:"Host",port:"Porta",database:"Banco de dados",schema:"Esquema",url:"URL",or:"ou",and:"e",required:"Obrigatório",optional:"Opcional",tip:"Dica"},status:{active:"Ativo",inactive:"Inativo",connected:"Conectado",disconnected:"Desconectado",ready:"Pronto",pending:"Pendente",success:"Sucesso",error:"Erro",failed:"Falhou",completed:"Concluído",processing:"Processando"},messages:{noResults:"Nenhum resultado encontrado",noData:"Nenhum dado disponível",noItems:"Nenhum item",comingSoon:"Em breve",poweredBy:"Desenvolvido por",built:"construído"},on:"LIGADO",off:"DESLIGADO"},rze={app:{title:"DataKit"},navigation:{tabs:{preview:"Visualizar",query:"Consulta",notebook:"Notebook",visualization:"Gráficos",ai:"Assistente"}},sidebar:{uploadFile:"Enviar Arquivo",importDescription:"Importar dados para análise",signIn:"Entrar",getStarted:"Começar Grátis",settings:"Configurações",expand:"Expandir barra lateral",collapse:"Recolher barra lateral",fileImported:"Arquivo Importado",fileImportedMessage:"{{fileName}} foi importado com sucesso"},mobile:{title:"DataKit funciona melhor no desktop",description:"Análise de dados fácil e sem problemas.",switchNote:"Mude para desktop para a experiência completa, ou",watchDemo:"assista a demonstração",discord:"Discord"},actionButtons:{dataKitStudio:"DataKit Studio",feedback:"Feedback",documentation:"Documentação",discord:"Discord",whatsNew:"Novidades"},tooltips:{joinDiscord:"Entrar no nosso Discord",viewDocs:"Ver documentação",viewChangelog:"Ver registro de mudanças",datakitStudio:"DataKit Studio"},splitView:{title:"Visualização Dividida",swapFiles:"Trocar arquivos",close:"Fechar visualização dividida",columnCount:"{{Count}} colunas"}},aze={modal:{welcomeBack:"Bem-vindo de volta",joinDataKit:"Junte-se ao DataKit",signIn:"Entrar",signOut:"Sair",createAccount:"Criar conta",alreadyHaveAccount:"Já possui uma conta? ",dontHaveAccount:"Não possui uma conta? ",signUp:"Registrar-se",privacyPolicy:"Política de Privacidade"},fields:{fullName:"Nome completo",emailAddress:"Endereço de Email",password:"Senha"},placeholders:{enterName:"Digite seu nome completo",enterEmail:"Digite seu Email",enterPassword:"Digite sua senha",createPassword:"Crie uma senha forte"},loading:{signingIn:"Entrando...",creatingAccount:"Criando conta..."},messages:{welcomeSuccess:"Bem-vindo de volta!",welcomeSuccessDesc:"Você está no DataKit.",accountCreated:"Bem-vindo ao DataKit!",accountCreatedDesc:"Sua conta foi criada com sucesso. Você agora tem acesso aos modelos do DataKit com R$ 15 para começar.",signedOut:"Desconectado com sucesso",signedOutDesc:"Você foi desconectado com segurança do DataKit.",privacyNotice:"Ao criar uma conta, você concorda com nossa "},password:{requirements:"Requisitos de Segurança",minLength:"Pelo menos 12 caracteres",hasUppercase:"Contém letra maiúscula (A-Z)",hasLowercase:"Contém letra minúscula (a-z)",hasNumbers:"Contém número (0-9)",hasSpecialChars:"Contém caractere especial (!@#$%^&*...)",noCommonPatterns:"Sem padrões ou sequências comuns"},benefits:{title:"Por que se juntar ao DataKit?",aiAccess:"Acesso ao Assistente de IA DataKit com créditos incluídos",cloudConnectors:"Acesso a todos os conectores de nuvem",exportReports:"Exportar relatórios do inspetor de dados",prioritySupport:"Suporte prioritário e acesso antecipado a novos recursos"},userMenu:{getStartedFree:"Começar Grátis",settings:"Configurações",billing:"Faturamento",user:"Usuário",signIn:"Entrar",signUp:"Cadastrar-se",signOut:"Sair",signOutSuccess:"Desconectado com sucesso",signOutMessage:"Você foi desconectado do DataKit com segurança."},protectedRoute:{loading:"Carregando...",authRequired:"Autenticação Obrigatória",signInMessage:"Por favor, faça login para acessar este recurso.",signInButton:"Entrar"},authGate:{title:"Entrar obrigatório",description:"Este recurso requer Autenticação por medida de segurança.",getStartedFree:"Começar Gratuitamente",alreadyHaveAccount:"Já tem conta?",signIn:"Entrar"}},sze={empty:{title:"Comece com o DataKit",description:"Importe seus arquivos e comece a analisar.",privacy:"Tudo roda localmente",privacyNote:"— Seus dados permanecem privados.",openFile:"Abrir arquivo",importFrom:"importar de:",selfHost:"Auto-hospede o DataKit:",watchDemo:"assista a demonstração",localFiles:"Arquivos locais",dropOrClick:"Solte arquivos aqui ou clique para navegar",processing:"Processando arquivos..."},providers:{postgresql:{name:"PostgreSQL",description:"Bancos de dados Postgres"},s3:{name:"Amazon S3",description:"Buckets S3 públicos"},huggingface:{name:"HuggingFace",description:"Datasets de ML"},googleSheets:{name:"Planilhas Google",description:"Planilhas públicas"}},install:{docker:"Docker",homebrew:"Homebrew",python:"Python",nodejs:"Node.js"},tooltips:{openFile:"Abrir Arquivo",localFiles:"Arquivos locais"}},ize={dropzone:{title:"Solte arquivos aqui ou clique",description:"Suporta arquivos grandes",dragTitle:"Solte seu arquivo aqui",dragDescription:"Pronto para importar"},formats:{csv:"CSV",json:"JSON",xlsx:"XLS",parquet:"PQT",txt:"TXT",duckdb:"DB"},messages:{fileRemoved:"Arquivo Removido",fileRemovedDesc:'"%s" foi removido da área de trabalho',remoteFileImported:"Arquivo Remoto Importado",remoteFileImportedDesc:'"%s" foi importado de %s'},dataFiles:"Arquivos de Dados",largeSizeWarning:"Este arquivo tem {{size}}MB e pode causar problemas de memória. Continuar mesmo assim? (Considere usar o Chrome para uma melhor experiência.)",modernBrowserWarning:"Este arquivo tem {{size}}MB. Para melhor desempenho com arquivos grandes, use um navegador moderno (Chrome/Edge) com suporte a streaming.",invalidFileType:"Por favor, importe um arquivo CSV, JSON, Excel, Parquet, TXT ou banco de dados DuckDB",dragDropLargeFileWarning:"Este arquivo tem {{size}}MB. Para melhor desempenho, tente usar o seletor de arquivos em vez de arrastar e soltar para arquivos grandes.",dropHere:"Solte seu arquivo aqui",readyToImport:"Pronto para importar",processing:"Processando...",dropOrClick:"Solte arquivos aqui ou clique",supportsLargeFiles:"Suporta arquivos grandes"},oze={googleSheets:{title:"Importação de Planilhas Google",urlLabel:"URL do Planilhas Google (publicado na web)",urlPlaceholder:"HTTPS://docs.google.com/spreadsheets/d/e/2PACX...",requirements:{title:"Requisitos:",published:"A planilha deve estar pública na web",formats:"Suporta formatos CSV, Excel e página web",noAuth:"Não requer autenticação para planilhas públicas"},status:{ready:"Planilha pública - pronta para importar",openInSheets:"Abrir no Planilhas Google"},buttons:{import:"Importar Planilha"},validation:{enterUrl:"Por favor, digite uma URL do Planilhas Google",validUrl:"Por favor, digite uma URL válida do Planilhas Google que esteja pública na web",invalidUrl:"Por favor, digite uma URL válida"}},s3:{title:"Importação S3",urlLabel:"URL S3 (bucket público)",urlPlaceholder:"S3://bucket/caminho/arquivo.CSV ou HTTPS://bucket.S3.amazonaws.com/arquivo.CSV",exampleDatasets:{title:"Datasets de Exemplo",description:"Experimente estes datasets públicos para começar",featured:"Destaque",loadingDatasets:"Carregando datasets..."},browserAccess:{title:"Acesso S3 via Navegador:",corsNote:"A maioria dos buckets S3 requer acesso via proxy devido a CORS",formats:"Suporta formatos CSV, JSON, Parquet, Excel",autoDetect:"Detecta automaticamente formato de arquivo e compressão"},status:{ready:"URL S3 válida - pronta para importar"},buttons:{import:"Importar do S3",importDataset:"Importar Dataset"},validation:{enterUrl:"Por favor, digite uma URL S3",validUrl:"Por favor, digite uma URL S3 válida"}},postgresql:{title:"Conexões PostgreSQL",description:"Conecte-se aos seus bancos de dados PostgreSQL",connections:{addConnection:"Adicionar Conexão",noConnections:"Nenhuma Conexão",noConnectionsDesc:"Crie sua primeira conexão PostgreSQL para começar a importar dados.",createConnection:"Criar Conexão"},form:{newConnection:"Nova Conexão PostgreSQL",editConnection:"Editar Conexão",description:"Digite os detalhes de conexão do seu banco de dados PostgreSQL",connectionName:"Nome da Conexão",defaultSchema:"Esquema Padrão",enableSSL:"Habilitar SSL",placeholders:{connectionName:"Meu BD PostgreSQL",host:"localhost",username:"usuário",password:"senha",database:"meu_banco",schema:"public"},buttons:{testAndCreate:"Testar e Criar"}},tableSelection:{title:"Selecionar Tabelas",description:"Escolha tabelas para conectar de %s.",backToConnections:"Voltar às Conexões",searchPlaceholder:"Buscar tabelas...",loadingTables:"Carregando tabelas...",noTables:"Nenhuma Tabela Encontrada",noTablesDesc:"Nenhuma tabela encontrada neste banco de dados.",noSearchResults:"Nenhuma tabela corresponde à sua busca.",connectSelected:"Conectar Tabelas Selecionadas",tablesSelected:"%d tabela(s) selecionada(s)"}}},lze={header:{title:"Configurações",subtitle:"Gerencie sua conta"},footer:{poweredBy:"Desenvolvido com DuckDB",built:"construído por",company:"DataKit"},tabs:{profile:"Perfil",workspace:"Área de Trabalho e Equipe",ai:"Configurações do assistente de IA",appearance:"Aparência",notifications:"Notificações",subscription:"Assinatura"},signout:{successTitle:"Desconectado com sucesso",successMessage:"Você foi desconectado com segurança do DataKit.",button:"Sair"},navigation:{backToDataKit:"Voltar ao DataKit",signOut:"Sair"},sidebar:{expand:"Expandir barra lateral",collapse:"Recolher barra lateral"},title:"Configurações",language:"Idioma",themeColor:"Cor do Tema",profile:{title:"Informações do Perfil",emailNote:"O Email não pode ser alterado. Entre em contato com o suporte se necessário.",saveChanges:"Salvar Alterações"},workspace:{title:"Informações da Área de Trabalho",teamMembers:{title:"Membros da Equipe",inviteMember:"Convidar Membro"},inviteMember:"Convidar Membro",inviteForm:{title:"Convidar Novo Membro",emailLabel:"Endereço de Email",roleLabel:"Função",emailPlaceholder:"Digite o endereço de Email",roles:{member:"Membro",admin:"Administrador",owner:"Proprietário"},sendInvite:"Enviar Convite",sending:"Enviando...",cancel:"Cancelar"},loadingMembers:"Carregando membros...",roles:{owner:"Proprietário",admin:"Administrador",member:"Membro"},loading:{userData:"Carregando Usuário Dados...",workspaces:"Carregando Áreas de Trabalho...",members:"Carregando Membros..."},noWorkspace:"Nenhuma Área de Trabalho encontrada. Por favor, crie uma Área de Trabalho ou entre em contato com o Suporte.",workspaceName:{placeholder:"Área de Trabalho Nome",editTitle:"Editar Área de Trabalho Nome"},personalWorkspace:"Pessoal Área de Trabalho",unlimitedCredits:"Créditos Ilimitados",creditsRemaining:"{{count}} créditos restantes",unknownUser:"Unknown Usuário"},notifications:{title:"Preferências de Notificação",email:{title:"Notificações por Email",description:"Receba atualizações sobre novos recursos e anúncios"},usage:{title:"Alertas de Uso",description:"Seja notificado quando estiver próximo do limite de créditos"},saveSettings:"Salvar Configurações de Notificação"},ai:{title:"Configuração de IA",description:"Escolha como o DataKit processa seus dados com IA",datakitModels:{title:"Modelos DataKit",description:"Modelos de IA Premium otimizados para análise de dados. Não requer chaves API.",features:{powered:"Desenvolvido pela Anthropic",pretuned:"Pré-ajustado para SQL e transformação de dados",claude:"Claude 3.5 Sonnet e Haiku incluídos",zeroConfig:"Zero configuração",preTuned:"Pré-ajustado para SQL e transformação de dados",claudeModels:"Claude 3.5 Sonnet & Haiku incluídos"},subscription:{proPlan:"Plano Pro",price:"R$ 99/mês",viewPlans:"Ver Todos os Planos →"},credits:"Créditos",poweredBy:"Desenvolvido pela Anthropic",active:"Ativo",proPlan:"Plano Pro",viewPlans:"Visualizar Todos os Planos →"},alternativeProviders:{title:"Provedores Alternativos",description:"Use suas próprias chaves API para estes provedores"},settings:{autoExecute:{title:"Auto-executar SQL",description:"Executar consultas de IA automaticamente"}},unlimited:"Ilimitado",creditStatus:{good:"Bom",low:"Baixo",veryLow:"Muito Baixo"},providerStatus:{available:"Disponível",configured:"Configurado",upgradeRequired:"Pro/Equipe obrigatório",setupRequired:"Configuração obrigatória"},credits:{title:"Créditos"},providers:{getApiKey:"Obtenha Chave de API",edit:"Editar",save:"Salvar",cancel:"Cancelar",activate:"Ativar",active:"Ativo"},whyDatakit:{title:"Por que Modelos DataKit?",features:{noApiKeys:"Sem chave(s) de API para gerenciar",monthlyCredits:"Créditos mensais",optimized:"Otimizado para tarefas com dados"},learnMore:"Saiba mais →"},autoExecuteSql:{title:"Auto-Executar SQL",description:"Executar consultas de IA automaticamente"}},appearance:{title:"Aparência",description:"Personalize a cor do tema do DataKit",current:"Atual",displayMode:"Modo de Exibição",themes:{datakitTeal:"DataKit verde-azulado",oceanBlue:"Azul Oceano",royalPurple:"Roxo Real",vibrantRed:"Vermelho Vibrante",forestGreen:"Verde Floresta",coralPink:"Rosa Coral"},modes:{system:"Sistema",light:"Claro",dark:"Escuro"}},subscription:{title:"Planos de Assinatura",description:"Escolha o plano que lhe atenda",badges:{earlyAdopter:"Pioneiro: 20% OFF",comingSoon:"Em Breve",moreCredits:"Mais Créditos (Em breve!)",currentPlan:"Plano Atual"},plans:{period:{month:"mês"},free:{title:"Gratuito",description:"Perfeito para começar",features:{credits:"315 Créditos por mês",anthropicModels:"Baseado em modelos Anthropic",personalWorkspace:"Área de Trabalho Pessoal",basicAnalysis:"Análise de Dados Básica",communitySupport:"Suporte da Comunidade"}},pro:{title:"Pro",description:"Com mais créditos Anthropic",features:{credits:"1500 Créditos per mês",advancedAnalytics:"Análise avançada",prioritySupport:"Suporte Prioritário",exportCapabilities:"Mais meios de Exportar",advancedIntegrations:"Integrações avançadas"}},team:{title:"Equipe",price:"Consultar",description:"Para equipes em crescimento",features:{unlimitedCredits:"Créditos Ilimitados",teamCollaboration:"Colaboração em Equipe",multipleWorkspaces:"Múltiplas Áreas de Trabalho",memberManagement:"Gerenciamento de Membros",premiumSupport:"Suporte Premium",customIntegrations:"Integrações Personalizadas",advancedSecurity:"Segurança Avançada",accountManager:"Gerente de Conta Dedicado"}}},currentUsage:{title:"Uso Atual",creditsRemaining:"Créditos Restantes",currentPlan:"Plano Atual",nextReset:"Próximo Redefinir"},moreFeatures:"+{{count}} recursos a mais",waitlist:{successTitle:"Você está na lista de espera!",successMessage:"Nós informaremos você em {{Email}} quando o recurso {{featureName}} for lançado.",error:"Algo deu errado. Por favor Tentar novamente.",joining:"Entrando...",getNotified:"Ser notificado",modalTitle:"Entrar na Lista de Espera",modalDescription:"Digite seu Email para ser notificado quando os Recursos Pro forem lançados.",emailPlaceholder:"your.Email@Exemplo.com",cancel:"Cancelar",joinWaitlist:"Entrar na Lista de Espera"}}},cze={title:"Compartilhe Seu Feedback",emailLabel:"Seu Email (opcional)",feedbackLabel:"Seu Feedback",placeholder:"Conte-nos o que você pensa sobre o DataKit...",placeholderAlt:"Compartilhe suas ideias, sugestões ou reporte problemas...",success:"Obrigado pelo seu Feedback!",button:{text:"Compartilhar Feedback?"},modal:{title:"Compartilhe Seu Feedback",success:"Obrigado pelo seu Feedback!",emailLabel:"Seu Email (opcional)",emailPlaceholder:"seu@Email.com",messageLabel:"Seu Feedback",messagePlaceholder:"Conte-nos o que você pensa sobre o DataKit...",sending:"Enviando..."}},uze={templates:{title:"Modelos",searchPlaceholder:"Pesquisar modelos...",filters:{all:"Todos"},categories:{dataAnalysis:"Análise de Dados",visualization:"Visualização",machineLearning:"Aprendizado de Máquina",huggingFace:"Hugging Face",statistics:"Estatísticas",utilities:"Utilitários"},noTemplatesFound:"Nenhum modelo encontrado",noTemplatesAvailable:"Nenhum modelo disponível",use:"Usar",copyToClipboard:"Copiar para área de transferência",showCode:"Mostrar",hideCode:"Ocultar",templateCount:"{{count}} modelos",requires:"Requer:",clearSearch:"Limpar pesquisa",noTemplates:"Nenhum Modelo encontrado",packages:"Pacotes:"},workspace:{aiGeneratedVisualization:"Visualização Gerada por IA",status:{saved:"Salvo",initializing:"Inicializando",loadingPackages:"Carregando Pacotes"}},response:{title:"Resposta",tokens:"Tokens",tokensResponse:"resposta",tokensViz:"viz",placeholder:"Faça uma pergunta para ver respostas aqui",thinking:"Pensando..."},results:{placeholder:"Resultados da Consulta aparecerão aqui",error:{title:"Erro na consulta"}},context:{label:"Contexto",more:"mais",noTables:"Nenhuma tabela no contexto",addTables:"Adicionar Tabelas",models:"Modelos",autoExecute:"Auto-Executar"},error:{noModel:{title:"Nenhum Modelo Selecionado",message:"Por favor Selecionar um Modelo de IA no dropdown para Continuar."},noData:{title:"Nenhum Dado disponível",message:"Por favor Adicionar a Tabela ao contexto para fazer perguntas sobre ela."},auth:{title:"Autenticação obrigatória",message:"Por favor Entrar ou Configurar suas chave(s) de API para usar Modelos de IA."},rateLimit:{title:"Limite de Taxa Excedido",message:"Você atingiu o limite de taxa. Por favor Tentar novamente mais tarde ou atualizar seu plano."},connection:{title:"Erro de Conexão",message:"Não foi possível conectar ao serviço de IA. Por favor verifique sua conexão com a internet."},generic:{title:"Algo deu errado"},retry:"Tentar Novamente",dismiss:"Ignorar"},pythonCell:{expandInput:"Expandir Entrada",collapseInput:"Recolher Entrada",executing:"Executando...",executeTooltip:"Executar Célula (Shift+Enter)",previewMarkdown:"Visualização Markdown",editMarkdown:"Editar Markdown",deleteCell:"Excluir Célula",moveUp:"Mover para Cima",moveDown:"Mover para Baixo",copyCode:"Copiar Código",clearOutput:"Limpar Saída",showInput:"Mostrar Entrada",hideInput:"Ocultar Entrada",showOutput:"Mostrar Saída",hideOutput:"Ocultar Saída",bold:"Negrito",italic:"Itálico",header1:"Cabeçalho 1",header2:"Cabeçalho 2",header3:"Cabeçalho 3",list:"Lista",quote:"Citação",link:"Link",inlineCode:"Código Inline",clickToEdit:"Clique para Editar Markdown...",plotOutput:"Saída de Plot",plotOutputAlt:"Saída de Plot Python",htmlOutput:"Saída HTML",columns:"Colunas:",moreRows:"... e {{count}} mais Linhas",expandOutput:"Expandir Saída",collapseOutput:"Recolher Saída",output:"Saída"},packageManager:{pythonNotInitialized:"Python não inicializado",initializePython:"Inicializar Python para gerenciar pacotes",title:"Gerenciador de Pacotes",searchPlaceholder:"Pesquisar Pacotes...",showInstalledOnly:"Mostrar Apenas Instalados",installedCount:"{{count}} instalados",installCustom:"Instalar Pacote Personalizado",packageNamePlaceholder:"Nome do Pacote (ex: pandas, requests)",packageInfo:"Apenas Pacotes Python puros ou Pacotes com _builds_ WebAssembly",noPackagesFound:"Nenhum(a) Pacotes encontrado(a)",noPackagesToShow:"No Pacotes to Mostrar",installed:"Instalado",install:"Instalar",installedPackagesTitle:"({{count}}) Pacotes Instalados",refresh:"Atualizar",andMore:"... e {{count}} mais"},scriptHistory:{justNow:"Agorinha",minutesAgo:"{{count}}m atrás",hoursAgo:"{{count}}h atrás",daysAgo:"{{count}}d atrás",title:"Notebooks",searchPlaceholder:"Pesquisar Notebooks...",createNewNotebook:"Criar Novo Notebook",newNotebook:"Novo Notebook",savedScriptsCount:"{{count}} Scripts Salvos",importScript:"Importar Script",import:"Importar",noScriptsFound:"Nenhum Script encontrado",noSavedScripts:"Nenhum Script Salvo",saveFirstScript:"Salvar seu primeiro Script para vê-lo aqui",current:"Atual",cellsCount:"{{count}} Células",executed:"Executado",loadScript:"Carregar Script",rename:"Renomear",duplicate:"Duplicar",export:"Exportar",delete:"Excluir",saveAndCreateNew:"Salvar e Criar Novo",saveNotebook:"Salvar Notebook",enterNotebookName:"Entrar Nome do Notebook"},variableInspector:{dataFrameDescription:"DataFrame com {{rows}} Linhas e {{columns}} Colunas",seriesDescription:"Série com {{size}} elementos{{dtype}}",arrayDescription:"Array com shape {{shape}}{{dtype}}",listDescription:"Lista com {{size}} elementos",dictDescription:"Dicionário com {{size}} chaves",confirmClear:"Tem certeza que deseja Limpar o namespace Python? Isso irá Remover todas as Variáveis.",pythonNotInitialized:"Python não inicializado",initializePython:"Inicializar Python para Inspecionar Variáveis",title:"Variáveis",refreshVariables:"Atualizar Variáveis",clearNamespace:"Limpar namespace",searchPlaceholder:"Pesquisar Variáveis...",variableCount:"{{filtered}} de {{total}} Variáveis",noVariables:"Nenhuma Variável no namespace",noMatches:"Nenhuma Variável corresponde à sua Pesquisa",executeCode:"Executar algum Código Python para ver Variáveis aqui",copyVariableName:"Copiar Nome da Variável",copyVariableValue:"Copiar Valor da Variável",collapse:"Recolher",expand:"Expandir",shape:"Shape: ({{shape}})",size:"Tamanho: {{size}}",dtype:"DType: {{dtype}}",dataFrameInfo:"Informação do DataFrame:",dataFrameColumns:"Colunas: {{Colunas}}",dataFrameIndex:"Índice: {{count}} entrada(s)",memoryUsage:"Uso de memória: ~{{size}} KB",contents:"Conteúdo:",copyTip:"Clique o nome da variável para Copiá-la para a Área de Transferência"}},dze={stats:{hideStats:"Ocultar Estatísticas",showStats:"Mostrar Estatísticas",columnStats:"Estatísticas da Coluna"},inspector:"Inspetor",jsonView:{table:"Tabela",tree:"Árvore"},error:{loadingData:"Erro ao carregar dados"},contextMenu:{sortAscending:"Classificar Crescente",sortDescending:"Classificar Decrescente",copy:'Copiar "{{value}}"'},errors:{missingParameters:"Parâmetro Ausente obrigatório para Ação de IA",aiFailed:"Ação de IA falhou:",signInRequired:"Por favor Entrar para usar ações de coluna com IA no DataKit Smart.",actionFailed:"Ação de IA falhou: {{error}}",unknownError:"Erro Desconhecido"},success:{tableCreated:"Sucesso! Nova Tabela: {{tableName}}"},noData:"Nenhum Dado para exibir",columnHeader:{aiActions:"Ações de Coluna com IA",stats:{null:"Nulo: {{Porcentagem}}",unique:"único: {{count}}",noStats:"sem estatísticas"}},demoModal:{defaultTitle:"Demonstração DataKit",close:"Fechar modal",videoNotSupported:"Seu browser não suporta vídeo."}},hze={title:"Dê uma olhada no seu DataKit"},fze={steps:{welcome:{title:"Bem-vindo ao DataKit",description:"Sua plataforma de análise de dados poderosa e focada em privacidade. Processe dados localmente com controle e segurança completos.",ctaText:"Começar"},preview:{title:"Inspecionar e Analisar",description:"Visualize seus dados e realize análise abrangente de colunas rapidamente. Identifique instantaneamente problemas de qualidade de dados, padrões e insights.",ctaText:"Explorar dados"},sql:{title:"Editor SQL",description:"Escreva consultas SQL poderosas com assistência de IA. Explore seus dados com autocompletar inteligente e sugestões.",ctaText:"Experimentar agora"},notebooks:{title:"Notebooks Python",description:"Execute código Python diretamente no seu navegador. Crie notebooks interativos para fluxos avançados de ciência de dados.",ctaText:"Começar a analisar"},remoteSources:{title:"Fontes Remotas",description:"Conecte-se a bancos de dados e fontes de dados na nuvem. Importe do PostgreSQL, S3, HuggingFace, Google Sheets e mais localizações remotas.",ctaText:"Começar a explorar"}},buttons:{previous:"Anterior",next:"Próximo",getStarted:"Começar"}},mze={unsavedChanges:{title:"Alterações Não Salvas",message:"Você tem alterações não salvas em seu Notebook atual. O que gostaria de fazer?",saveAndContinue:"Salvar e Continuar",discardChanges:"Descartar Alterações"}},pze={title:"DataKit",description:"Seus dados, sua escolha. Processe localmente para privacidade completa ou aproveite a nuvem quando precisar colaborar. A plataforma moderna de análise de dados que se adapta a você.",keywords:"análise de dados, análise com foco em privacidade, processamento Local de dados, WebAssembly, DuckDB, visualização de dados, consultas SQL, análise CSV, processamento Excel, ciência de dados, inteligência de negócios, análise segura, DataKit"},gze={importing:"Importando Dataset",processing:"Processando {{organization}}/{{dataset}}..."},Eze={title:"Informações do Aplicativo",subtitle:"Detalhes de versão e compilação",description:"Informações de versão e detalhes do aplicativo para DataKit",version:"Versão",environment:"Ambiente"},Tze={title:"Página Não Encontrada",description:"A página solicitada não pôde ser encontrada",message:"A página que você está procurando não existe.",goHome:"Ir Para Início"},yze={title:"Política de Privacidade",description:"Política de privacidade do DataKit - Saiba como protegemos seus dados e o que coletamos",backToDatakit:"Voltar ao DataKit"},xze={placeholder:"ESPAÇO RESERVADO"},Sze={popup:{title:"A plataforma de dados que funciona do seu jeito",description:"Seus dados, sua escolha. Processe localmente para privacidade completa ou aproveite a nuvem quando precisar colaborar.",freeFeatures:"O que você ganha grátis",features:{cloudConnectors:"Todos os conectores de nuvem",credits:"R$ 15 em créditos do Assistente DataKit",exportViz:"Exportação e visualizações"},enterprise:{title:"Pronto para empresas",contact:"Entre em contato →",description:"Implante no Local para controle completo ou nuvem híbrida para flexibilidade. Infraestrutura compatível com SOC2."},startFree:"Comece grátis com R$ 15 em créditos →",existingAccount:"Já tem uma conta? Faça login"}},bze={closeFile:"Fechar arquivo",splitWith:"Compartilhar com {{partner}}",googleSheets:"Planilhas Google",contextMenu:{rename:"Renomear",duplicate:"Duplicar",closeOthers:"Fechar Outros",closeAll:"Fechar Todos"},moreTabs:"Mais {{count}} abas",loading:"Carregando...",import:"Importar"},vze={preview:{label:"Pré-visualização",description:"Visualizar e explorar seus dados"},query:{label:"SQL",description:"Consultar com SQL"},notebook:{label:"Notebook",description:"Analisar com Notebook Jupyter"},visualization:{label:"Visualizar",description:"Criar gráficos e visualizações"},ai:{label:"Assistente",description:"Insights com IA"}},Aze={googleSheets:{urlLabel:"URL de Planilhas Google (públicas na web)",urlPlaceholder:"HTTPS://docs.google.com/spreadsheets/d/e/2PACX...",validation:{urlRequired:"Por favor, insira uma URL do Planilhas Google",invalidPublishedUrl:"Por favor, insira uma URL válida do Planilhas Google que esteja pública na web",invalidUrl:"Por favor, insira uma URL válida"},status:{readyToImport:"Planilha pública - pronta para importar"},actions:{openInSheets:"Abrir no Planilhas Google",importing:"Importando",importSheet:"Importar Planilha"},requirements:{title:"Requisitos",published:"A planilha deve estar pública na web",formats:"Suporta formatos CSV, Excel e página web",noAuth:"Não requer autenticação para planilhas públicas"}},huggingface:{loading:{configurations:"Carregando configurações...",datasets:"Carregando datasets..."},config:{title:"Configuração do Dataset",configuration:"Configuração (Subconjunto)",availableSplits:"Divisões disponíveis",split:"Divisão",willImport:"Vai importar"},datasetId:{label:"ID do Dataset",placeholder:"microsoft/DialoGPT-medium ou yandex/yambda:SelfRC/train"},dataset:{featured:"Destaque",updated:"Atualizado",recently:"Recente",importing:"Importando",import:"Importar Dataset"},strategy:{directStreaming:"Mais rápido, não é necessário baixar",parquetDownload:"Confiável, Baixar dataset completo",alternativeFormat:"Alternativa em formato CSV/JSON"},validation:{datasetIdRequired:"Por favor, insira um ID de dataset",invalidDatasetId:"Por favor, insira um ID de dataset válido"},auth:{title:"Autenticação (Opcional)",hide:"Ocultar",show:"Mostrar",description:"Necessário para datasets privados ou restritos. Obtenha seu Token em",settingsLink:"Configurações do HuggingFace",tokenPlaceholder:"hf_xxxxxxxxxxxxxxxxxxxxxxxxx"},actions:{importing:"Importando",importDataset:"Importar Dataset",view:"Visualizar"},search:{title:"Buscar Datasets",placeholder:"Buscar datasets por nome, tarefa ou descrição...",results:"Resultados da Busca"},featured:{title:"Datasets em Destaque",description:"Datasets populares para começar"},footer:{title:"Integração HuggingFace",memoryEfficient:"Processamento eficiente de memória para datasets grandes",multiFormat:"Suporte multi-formato (Parquet, CSV, JSON, XLSX, TXT)"},error:{importFailed:"Falha na Importação"},status:{validDatasetId:"ID de dataset válido - pronto para importar"},progress:{complete:"completo",initializing:"Inicializando..."}},postgresql:{confirmDelete:'Tem certeza de que deseja excluir a conexão "{{Nome}}"?',connections:{title:"Conexões PostgreSQL",description:"Conecte-se aos seus bancos de dados PostgreSQL",addConnection:"Adicionar Conexão"},loading:{connections:"Carregando conexões...",tables:"Carregando tabelas..."},noConnections:{title:"Nenhuma Conexão",description:"Crie sua primeira conexão PostgreSQL para começar a importar dados.",createConnection:"Criar Conexão"},status:{active:"Ativo",inactive:"Inativo"},form:{editConnection:"Editar Conexão",newConnection:"Nova Conexão PostgreSQL",description:"Insira os detalhes de conexão do seu banco de dados PostgreSQL",connectionName:"Nome da Conexão",connectionNamePlaceholder:"Meu BD PostgreSQL",host:"Host",hostPlaceholder:"localhost",port:"Porta",portPlaceholder:"5432",database:"Banco de Dados",databasePlaceholder:"meu_banco",username:"Usuário",usernamePlaceholder:"usuario",password:"Senha",passwordPlaceholder:"senha",defaultSchema:"Esquema Padrão",schemaPlaceholder:"public",enableSSL:"Habilitar SSL",cancel:"Cancelar",testing:"Testando...",update:"Atualizar",testCreate:"Testar e Criar"},tables:{title:"Selecionar Tabelas",description:"Escolha tabelas de {{name}} para conectar.",backToConnections:"Voltar às Conexões",searchPlaceholder:"Buscar tabelas...",selectedCount:"{{count}} tabela selecionada;{{count}} tabelas selecionadas",connectSelected:"Conectar Tabelas Selecionadas"},noTables:{title:"Nenhuma Tabela Encontrada",noMatches:"Nenhuma tabela corresponde à sua busca.",noTablesFound:"Nenhuma tabela encontrada neste banco de dados."},auth:{title:"Login Necessário",description:"Conexões PostgreSQL requerem autenticação para manter suas credenciais de banco de dados seguras."}},s3:{dataset:{featured:"Destaque",importing:"Importando",import:"Importar Dataset"},validation:{urlRequired:"Por favor, insira uma URL S3",invalidUrl:"Por favor, insira uma URL S3 válida"},urlLabel:"URL S3 (bucket público)",urlPlaceholder:"S3://bucket/caminho/arquivo.CSV ou HTTPS://bucket.S3.amazonaws.com/arquivo.CSV",status:{validUrl:"URL S3 válida - pronta para importar"},actions:{importing:"Importando",importFromS3:"Importar do S3"},examples:{title:"Datasets de Exemplo",description:"Experimente estes datasets públicos selecionados para começar"},loading:{datasets:"Carregando datasets..."},footer:{title:"Acesso ao Navegador S3",corsInfo:"A maioria dos buckets S3 requer acesso via proxy devido ao CORS",supportedFormats:"Suporta formatos CSV, JSON, Parquet, Excel",autoDetection:"Detecta automaticamente formato de arquivo e compressão"}}},Rze={preview:{noData:"Nenhum dado para visualizar",selectFile:"Selecione uma aba de arquivo para ver seu conteúdo"},visualization:{selectFile:"Selecionar arquivo",postgresqlTable:"Tabela PostgreSQL",rowCount:"{{count}} linhas",postgresqlVisualization:"Visualização PostgreSQL",postgresqlComingSoon:"Em breve! Estamos trabalhando no suporte a gráficos para tabelas PostgreSQL.",chartTypes:{bar:"Barra",line:"Linha",area:"Área",pie:"Pizza",scatter:"Dispersão"},noDataAvailable:"Nenhum Dado disponível",importDataMessage:"Importe arquivos de dados para criar visualizações.",importData:"Importar Dados",hidePanel:"Ocultar painel",showPanel:"Mostrar painel",pointsCount:"{{count}} pontos",export:"Exportar",chartConfiguration:"Configuração do Gráfico",selectDataSource:"Selecione uma fonte de dados para começar",selectColumns:"Selecione colunas para visualizar"}},Nze={header:{title:"DataKit"},footer:{poweredBy:"Tecnologia ",visitAmin:"Visitar Amin",built:"built",company:"DataKit"},workspace:{confirmRemove:'Remover "{{fileName}}" da área de trabalho? Isto não excluirá o arquivo real.',fileRemovedTitle:"Arquivo Removido",fileRemovedMessage:'"{{fileName}}" foi removido da área de trabalho'},upload:{title:"Enviar Arquivo",description:"Importe seu arquivo de dados para análise"},remote:{importedTitle:"Arquivo Remoto Importado",importedMessage:'"{{fileName}}" foi importado de {{provider}}',defaultProvider:"fonte remota",notImplemented:"Re-importação de fonte remota ainda não implementada. Use o botão Fontes da Nuvem para re-importar."},fileAccess:{browserNotSupported:"Seu navegador ({{browserName}}) não suporta acesso automático a arquivos. Por favor, re-importe o arquivo manualmente. ",useChrome:"Para acesso automático a arquivos, use Chrome ou Edge.",safariLimited:"O suporte a acesso de arquivos é limitado no Safari. Para melhor experiência, use Chrome ou Edge.",useChromeForFeatures:"Para recursos de importação automática, use Chrome ou Edge.",permissionDenied:'Permissão negada para acessar "{{fileName}}". Isso pode acontecer devido às políticas de segurança do navegador.\n\nClique "OK" para selecionar manualmente o arquivo novamente, ou "Cancelar" para pular.',nameMismatch:'A referência de arquivo armazenada para "{{fileName}}" aponta para um arquivo diferente. Por favor, re-selecione o arquivo correto.',cannotAccess:'Não é possível acessar automaticamente "{{fileName}}". O arquivo pode ter sido movido, excluído ou as permissões de acesso alteradas.\n\nClique "OK" para selecionar manualmente o arquivo novamente, ou "Cancelar" para pular.',selectCorrectFile:"Por favor, selecione o arquivo correto: {{fileName}}",couldNotLoad:"Não foi possível carregar o arquivo {{fileName}}. Por favor, re-importe-o usando o botão de upload de arquivo."},expand:"Expandir barra lateral",collapse:"Recolher barra lateral",fileDialog:{dataFiles:"Arquivos de Dados"}},_ze={show:"Mostrar",rows:"linhas",showing:"Mostrando",countingRows:"Contando linhas...",countingLarge:"Contando (arquivo grande)...",of:"de",columns:"colunas",page:"Página",firstPage:"Primeira página",previousPage:"Página anterior",nextPage:"Próxima página",lastPage:"Última página",notAvailableForViews:"Não disponível para visualizações"},wze={title:"Importar da Nuvem",subtitle:"Conecte-se às suas fontes de dados na nuvem",selectProvider:"Selecione um provedor para começar",comingSoon:"Em Breve",signInRequired:"Login necessário",providers:{customUrl:"URL Personalizada",s3:"Amazon S3",huggingface:"HuggingFace",motherduck:"MotherDuck",postgresql:"PostgreSQL",googleSheets:"Planilhas Google",googleCloud:"Google Nuvem",googleDrive:"Google Drive"}},Cze={thanks:{title:"Obrigado!",message:"Suas preferências foram salvas"},header:{title:"Ajude a melhorar o DataKit"},description:"Usamos análises para melhorar sua experiência. Todo processamento de dados acontece localmente - seus arquivos nunca saem do seu dispositivo.",dropdown:{title:"O que coletamos?"},collection:{basic:{title:"Análises básicas (sempre coletadas):",performance:"Métricas de desempenho",errors:"Relatórios de erro",usage:"Padrões de uso anônimos"},advanced:{title:"Análises avançadas (com seu consentimento):",detailed:"Uso detalhado de recursos",sessions:"Gravações de sessão (dados mascarados)",journeys:"Rastreamento de jornada do usuário"},never:{title:"Nunca coletamos:",files:"Seus arquivos enviados",content:"Conteúdo de arquivos ou dados pessoais",queries:"Consultas SQL ou código"}},privacyPolicy:"Política de Privacidade",buttons:{accept:"Aceitar Análises",decline:"Apenas Essencial"}},Ize={modelSelector:{selectModel:"Selecionar Modelo",title:"Selecionar IA Modelo",claudeModels:"Claude Modelos",signInRequired:"Login obrigatório",apiKeyRequired:"Chave de API obrigatória",creditsPerToken:"{{Custo}} Créditos/1K Tokens",dollarsPerToken:"${{Custo}}/1K",signUpCredits:"Cadastrar para usar Créditos DataKit",noApiKeysNeeded:"Sem necessidade de chaves de API. Créditos incluídos na sua Conta.",signUpButton:"Cadastre-se para Começar",creditsRemaining:"Créditos restantes: {{count}}"},providers:{datakit:"DataKit",openai:"OpenAI",anthropic:"Anthropic",groq:"Groq",ollama:"Ollama"},apiKey:{configuration:"Configuração",configureDescription:"Configurar provedor IA",providerTypes:{local:"Local",cloudApi:"Nuvem"},serverConfiguration:"Configuração do Servidor",ollamaServerUrl:"URL do Servidor Ollama",ollamaServerUrlDescription:"A URL onde seu servidor Ollama está em execução",apiKeyConfiguration:"Configuração da Chave de API",apiKey:"Chave de API",enterApiKeyPlaceholder:"Digite sua Chave de API {{provider}} ",skipApiKeysTitle:"Ignorar a(s) chave(s) de API com Créditos DataKit",skipApiKeysDescription:"Obtenha acesso instantâneo a poderosos Modelos IA sem gerenciar chave(s) de API. Créditos incluídos na sua Conta.",signInToGetStarted:"Entrar para Começar",getApiKey:"Obter Chave de API",generalSettings:"Configurações Gerais",autoExecuteSQL:"Auto-Executar SQL gerado",autoExecuteSQLDescription:"Executar Consultas SQL geradas por IA automaticamente.",saveConfiguration:"Salvar Configuração",providers:{ollama:{description:"Servidor Ollama local - executa Modelos na sua máquina",helpText:"Executar IA Modelos localmente com Privacidade Completa. Requer que o Ollama esteja em execução em HTTP://localhost:11434"},openai:{description:"Modelos GPT-4o e GPT-4o Mini",helpText:"Modelos mais capazes para raciocínio complexo e Análise."},anthropic:{description:"Modelos Claude 3.5 Sonnet e Haiku",helpText:"Excelente para Análise detalhada e explicações. Créditos Gratuitos para Novos Usuários."},groq:{description:"Modelos Llama 3.1 ultra-rápidos com nível Gratuito",helpText:"Velocidade de inferência mais rápida, perfeita para experimentar Recursos IA. Completamente Gratuito para Iniciar."}}},prompts:{schemas:"Esquemas",hideSchema:"Ocultar Esquema",showSchema:"Mostrar Esquema",navigation:{previous:"Anterior Mensagem",next:"Próximo Mensagem"},actions:{startNewChat:"Iniciar a Novo chat"},placeholders:{askAboutData:"Perguntar sobre seus Dados...",followUp:"Fazer pergunta de acompanhamento ...",askAboutTable:"Perguntar sobre {{tableName}}..."},setup:{configure:"Configurar seu Modelo IA para iniciar a fazer perguntas",signUpCredits:"Cadastrar-se para Créditos Gratuitos",useApiKeys:"Use Suas Próprias Chaves de API",privacyNote:"Modelos só veem a estrutura da sua Tabela, não seus Dados reais"},suggestions:{title:"Sugestões",exploreData:{title:"Explore Dados",prompt:"Eu quero ter uma Visão Geral deste conjunto de dados - quais Colunas temos e quais insights você pode tirar?"},findPatterns:{title:"Encontrar Padrões",prompt:"Quais são os padrões mais interessantes ou tendências neste conjunto de dados?"},dataQuality:{title:"Qualidade dos Dados",prompt:"Verifique este conjunto de dados em busca de Valores Ausentes, Duplicados ou outros Problemas de Qualidade dos Dados"},quickStats:{title:"Estatísticas Rápidas",prompt:"Mostre-me um resumo de estatísticas para todas as colunas numéricas"}},status:{thinking:"Pensando..."}},localModels:{title:"Modelos IA Locais",description:"Executar Modelos IA localmente usando WebLLM",webgpu:{supported:"WebGPU Suportado",notSupported:"Não Suportado",required:"WebGPU obrigatório"},storage:{title:"Uso do Armazenamento",downloadedModels:"Downloaded Modelos"},availableModels:"Disponível Modelos",useModel:"Usar Modeloo",download:"Baixar",current:"Atual",active:"Ativo",refresh:"Atualizar",done:"Concluído",deleteConfirm:"Tem certeza que deseja excluir este Modelo?"},ollama:{connecting:"Conectando ao Ollama...",connected:"Conectado ao Ollama",connectionFailed:"Conexão falhou",connectionFailedTitle:"Falhou ao conectar ao Ollama",cannotConnect:"Não é possível conectar ao servidor Ollama",howToFix:"Como corrigir isso:",installStep:"1. Instalar Ollama a partir do Ollama.IA",runCommand:"2. Executar: OLLAMA_ORIGINS=* Ollama serve",browserCompatibility:"3. Use Chrome, Edge, or Safari (Firefox Não Suportado)",firefoxNote:"Nota: Firefox não é suportado devido a restrições CORS",installedModels:"Modelos Instalados",noModels:"Nenhum Modelo instalado",pullModelHint:"Baixe um Modelo abaixo para Começar",pullModelToStart:"Baixe um Modelo abaixo para Começar",inTerminal:"no terminal",makeSureRunning:"Certifique-se que está executando em {{baseUrl}}",privacyNote:"Modelos executam completamente na sua máquina para total privacidade.",needMoreModels:"Precisa de mais modelos? Visite",ollamaLibrary:"Biblioteca Ollama",tryAgain:"Tentar novamente"},tableSelector:{title:"Selecionar Tabelas para Contexto de IA",searchPlaceholder:"Pesquisar Tabelas...",noTablesFound:"Nenhuma tabela encontrada neste banco de dados.",noTablesAvailable:"Nenhuma Tabela disponível",selectedCount:"{{count}} selecionada(s)",columns:"Colunas",postgresql:"PostgreSQL",motherduck:"MotherDuck",remote:"Remoto",clearAll:"Limpar all",cancel:"Cancelar",addToContext:"Adicionar to Context",applying:"Applying..."},queryCard:{query:"Consulta",primary:"Principal",visualize:"Visualize",copySQL:"Copiar SQL",copied:"Copiado!",editInQueryTab:"Editar na Aba de Consulta",run:"Executar",generatingVisualization:"Gerando visualização...",queryRunning:"Consulta em execução..."},visualization:{export:{title:"Exportar Visualização",format:"Exportar Formato",quality:"Qualidade",options:"Opções",includeTitle:"Incluir título",includeBackground:"Incluir fundo",copy:"Copiar",copied:"Copiado!",export:"Exportar",exporting:"Exportando...",chartNotFound:"Gráfico não encontrado",exportFailed:"Exportação falhou"}}},Oze={emptyStates:{noAnalysis:{title:"Pronto para Analisar",descriptionWithFile:'Comece analisando "{{fileName}}" para descobrir insights de qualidade de dados',descriptionNoFile:"Selecione um arquivo para iniciar sua análise de qualidade de dados",startButton:"Iniciar Análise",timeEstimate:"A análise normalmente leva de 10 a 30 segundos, dependendo da quantidade de dados"},noColumns:{title:"Nenhuma Coluna Encontrada",noMatchingColumns:'Nenhuma coluna correspondente a "{{searchTerm}}"',noFilteredColumns:"Nenhuma coluna de {{filterType}} encontrada",totalColumns:"em {{totalColumns}} colunas totais",noAnalyzableColumns:"Este conjunto de dados não possui colunas analisáveis",clearFiltersButton:"Limpar Filtros",suggestion:"Tente ajustar seus critérios de pesquisa ou filtro"},error:{title:"Falha na Análise",tryAgainButton:"Tentar Novamente",resetButton:"Redefinir",suggestion:"Se o problema persistir, tente com um arquivo diferente ou entre em contato com o suporte"}},loading:{steps:{validation:{label:"Validando Dados",description:"Verificando estrutura e acessibilidade da tabela"},schema:{label:"Lendo Esquema",description:"Identificando tipos e estrutura das colunas"},duplicates:{label:"Detectando Duplicatas",description:"Escaneando linhas duplicadas"},columns:{label:"Analisando Colunas",description:"Computando estatísticas e padrões"},quality:{label:"Avaliação de Qualidade",description:"Calculando pontuações de saúde e recomendações"}},analyzingColumn:"Analisando: {{currentColumn}} • Coluna {{currentColumnNumber}} de {{totalColumns}}"},quickActions:{lastAnalyzed:"Última análise: {{time}}"},title:"Dados Inspetor",fileSelector:{placeholder:"Selecionar Arquivo..."},postgresql:{title:"PostgreSQL Inspetor",comingSoon:"Em Breve! Estamos trabalhando na inspeção de dados para tabelas PostgreSQL."},overview:{title:"Visão Geral",dataOverview:"Dados Visão Geral",quality:"{{score}}% Qualidade",analyzedAt:"Analisado em {{time}}",rows:"Linhas",columns:"Colunas",duplicates:"Duplicados",issues:"Problemas",critical:"{{count}} Crítico",qualityBreakdown:"Qualidade Breakdown",completeness:"Completude",uniqueness:"Unicidade",consistency:"Consistência",analysisCompleted:"Análise concluída em {{time}}s"},problems:{title:"Problemas de Qualidade de Dados",noProblems:{title:"Nenhum Problema Encontrado!",description:"Seus dados parecem estar limpos, sem problemas críticos detectados.",healthScore:"Pontuação de Saúde: {{score}}%"},duplicateRows:{title:"Linhas Duplicadas",description:"{{count}} Linhas duplicadas encontradas ({{Porcentagem}}% do total)"},missingValues:{title:"Valores Ausentes em {{columnName}}",description:"{{count}} Valores Nulos ({{Porcentagem}}% da Coluna)"},typeIssue:{title:"{{problem}} em {{columnName}}",description:"{{count}} Valores problemáticos encontrados"},issueCount:"{{filtered}} de {{total}} Problemas",severity:{critical:"Crítico",warning:"Aviso",info:"Informação"},filteredBy:"Filtrado por:",actions:{viewDetails:"Visualizar Detalhes",exporting:"Exportando...",exportCompleted:"Exportação concluída!",exportData:"Exportar Dados",signInToExport:"Entrar para Exportar Dados"},details:{examples:"Exemplos:",count:"Contagem: {{count}}",percentage:"Porcentagem: {{Porcentagem}}%",column:"Coluna: {{columnName}}"},noIssuesFound:"Nenhum Problema encontrado"}},Lze={toolbar:{uploadFiles:"Importar Arquivos",newFolder:"Nova Pasta",newFolderPrompt:"Digite o nome da pasta:",openFolder:"Abrir Pasta",browserNotSupported:"Seu navegador não suporta acesso a pastas. Por favor, use Chrome ou Edge.",remoteSources:"Fontes Remotas",moreOptions:"Mais Opções",exportStructure:"Exportar Estrutura",importStructure:"Importar Estrutura",helpTooltip:"Ajuda - Como a área de trabalho funciona",helpModal:{title:"Guia da Área de Trabalho",importFiles:{title:"Importar Arquivos",description:"Adicionar arquivos com acesso persistente"},newFolder:{title:"Nova Pasta",description:"Organize seus dados"},openFolder:{title:"Abrir Pasta",description:"Importar pastas do seu computador"},remoteSources:{title:"Fontes Remotas",description:"Conectar a bancos de dados e armazenamento na nuvem"},tip:"A localização dos arquivos persiste entre sessões e pode ser acessada diretamente do seu computador."}},fileTree:{noFiles:"Nenhum arquivo na área de trabalho",addFilesHint:"Adicione arquivos usando o painel acima",workspaceFiles:"Arquivos da Área de Trabalho ({{count}})",remove:"Remover",rename:"Renomear"},selector:{selectWorkspace:"Selecionar Área de Trabalho",unsaved:"Rascunho Não Salvo",workspaces:"Áreas de Trabalho",organizeDescription:"Organize seus Arquivos em áreas de trabalho. Arquivos são referenciados, não armazenados.",draft:"Rascunho",fileCount:"{{count}} Arquivos",file:"Arquivo",files:"Arquivos",workspaceNamePlaceholder:"Área de Trabalho Nome...",saveDraftAsWorkspace:"Salvar Rascunho como Área de Trabalho",newWorkspace:"Nova Área de Trabalho",workspaceCreated:"Área de Trabalho Criada",workspaceCreatedMessage:'"{{Nome}}" Área de Trabalho foi criada com sucesso',workspaceRenamed:"Área de Trabalho Renomeada",workspaceRenamedMessage:'Área de Trabalho renomeada de "{{oldName}}" para "{{newName}}"',deleteConfirmation:'Excluir Área de Trabalho "{{Nome}}"? Esta ação não pode ser desfeita.',workspaceDeleted:"Área de Trabalho Excluída",workspaceDeletedMessage:'"{{Nome}}" Área de Trabalho foi excluída',workspaceSaved:"Área de Trabalho Salva",workspaceSavedMessage:'Rascunho Área de Trabalho Salvo como "{{Nome}}" com {{count}} {{Arquivos}}',tooltip:{workspaces:"Áreas de Trabalho",organizeFiles:"organize seus arquivos sem armazenar dados reais - apenas referências para sua privacidade.",draft:"Rascunho",draftDescription:"Área de Trabalho Temporária para Arquivos antes de salvar em uma Área de Trabalho nomeada.",benefits:"Benefícios",benefitsDescription:"Mantenha projetos organizados, mude de base de dados.",limit:"Limite",limitDescription:"Criar até 1 área de trabalho.",signUp:"Cadastrar-se"}}},Mze={files:"Arquivos",localFiles:"Arquivos locais",remote:"Remoto",remoteData:"Dados remotos",connectCloudSources:"Conectar Fontes em Nuvem"},Dze={draft:{label:"Rascunho"},workspace:{poweredBy:"Desenvolvido com WebAssembly",errors:{initFailed:"Inicialização do DuckDB falhou"},status:{initializing:"Inicializando DuckDB",notReady:"DuckDB não está pronto",settingUp:"Configurando seu Banco de Dados no browser...",preparing:"Preparando seu ambiente de Análise de Dados..."},actions:{retryInit:"Tentar Inicialização Novamente",fullScreenResults:"Resultados em Tela Cheia",hideHistory:"Ocultar Histórico de Consultas",showHistory:"Mostrar Histórico de Consultas",exitFullScreen:"Sair de Tela Cheia",hideSchema:"Ocultar Esquema do Navegador",showSchema:"Mostrar Esquema do Navegador",save:"Salvar",execute:"Executar",executeShortcut:"Executar Consulta (⌘+Enter)",fullScreenEditor:"Tela Cheia Editor",dismiss:"Dispensar",cancel:"Cancelar"},results:{title:"Resultados da Consulta",executionTime:"{{time}}ms",rowCount:"{{count}} Linhas"},fullscreen:{editor:"Editor SQL (Tela Cheia)",results:"Resultados da consulta (Tela Cheia)"},editor:{title:"Editor SQL",optimize:"Otimize",optimizationAvailable:"Sugestões de otimização de consulta disponíveis"},optimization:{title:"Dicas de otimização de consulta",applyFix:"Aplicar Dica",optimizeQuery:"Otimize a Consulta"},warnings:{largeDataset:{title:"Consulta Grande ({{count}} Linhas)",description:"Essa consulta está retornando muitos dados, o que pode estar afetando sua performance. Considere adicionar filtros ou cláusula LIMIT.",addLimit:"Adicionar cláusula LIMIT"}},gettingStarted:{title:"Pronto para Consulta de Dados!",dataReady:"Você está pronto para consultar dados. Tente a consulta acima ou escreva seu próprio SQL.",sampleData:"Uma tabela exemplo de empregados está disponível para teste. Importar seus Arquivos CSV, JSON, or Parquet próprios para consultar seus dados."},saveDialog:{title:"Salvar Consulta",placeholder:"Enter Consulta Nome"}},schema:{title:"Esquema Browser",noData:"No Dados disponível. Importar Arquivos to Começar.",local:"Local",attached:"Attached",shared:"Shared",actions:{refresh:"Atualizar Esquemas",refreshTables:"Atualizar Tabelas",refreshSchemas:"Atualizar Esquemas",insertSelect:"Insert Selecionar Consulta",insertColumn:"Insert Coluna Consulta"},loading:{local:"Carregando Esquemas Locais...",database:"Carregando {{Nome}} Tabelas...",schemas:"Carregando {{Nome}} Esquemas...",postgres:"Carregando PostgreSQL Esquemas...",columns:"Carregando Colunas..."},empty:{local:"No Local Tabelas. Importar Dados to Começar.",database:"No tabela(s) encontrada(s) in {{Nome}}",postgres:"No tabela(s) encontrada(s). Click Atualizar to load Esquemas.",columns:"No Colunas disponível"},sections:{tables:"Tabelas ({{count}})",views:"Views ({{count}})"},postgres:{available:"Disponível",connected:"Conectado",connect:"Connect and Navegar Tabelas"}}},Pze={notebookEditor:{title:"Editar Notebook",nameLabel:"Nome",namePlaceholder:"Notebook Sem Título",descriptionLabel:"Descrição",descriptionPlaceholder:"Descrição opcional...",autoSaveMessage:"As alterações são salvas automaticamente"}},kze={title:"Configurações",language:"Idioma",presets:"Predefinições"},jze={privacy:{dataStaysLocal:{title:"Seus Dados Ficam Locais",description:"Toda análise de dados é realizada localmente no seu navegador usando DuckDB-WASM. Seus arquivos e dados nunca saem do seu dispositivo, garantindo privacidade e segurança completas.",aiModelsTitle:"Modelos de IA do DataKit - Apenas Esquema de Colunas",importantException:"Exceção importante:",aiModelsDescription:"Ao usar recursos de IA do DataKit, enviamos apenas cabeçalhos de colunas e tipos de dados para nossos modelos de IA - nunca seus dados reais. Isso permite que a IA entenda a estrutura do seu conjunto de dados mantendo suas informações sensíveis completamente privadas.",aiModelsExample:'Por exemplo, de um CSV com dados de clientes, enviamos apenas: ["customer_id: INTEGER", "Email: VARCHAR", "purchase_amount: DECIMAL"] - a IA nunca vê emails reais de clientes ou valores de compras.'},analytics:{title:"Nosso Sistema de Análise de Duas Camadas",description:"Usamos uma abordagem focada em privacidade para entender como o DataKit é usado e melhorar a experiência:",basic:{title:"Análise Básica (Sempre Ativa)",items:["Visualizações de página e uso de recursos","Métricas de desempenho e rastreamento de erros","Tipo de navegador e localização geral (nível do país)"],note:"Isso nos ajuda a entender quais recursos são populares e corrigir bugs rapidamente."},advanced:{title:"Análise Avançada (Apenas Opt-in)",items:["Rastreamento detalhado da jornada do usuário","Testes A/B para novos recursos","Padrões de uso mais granulares"]},neverCollect:{title:"Nunca Coletamos",items:["Seus dados reais ou conteúdo de arquivos","Informações pessoais além do que você fornece voluntariamente","Senhas ou tokens de autenticação","Dados de localização precisa"]}},thirdParty:{title:"Serviços de Terceiros",items:["Google Analytics: Análise de uso do site","PostHog: Análise de produto e feedback do usuário","Anthropic Claude: Insights de dados alimentados por IA (apenas esquemas de colunas)","OpenAI: Insights de dados alimentados por IA (apenas esquemas de colunas)"]},choices:{title:"Suas Escolhas",description:"Você pode desabilitar análises avançadas nas Configurações. As análises básicas permanecem ativas para garantir que o DataKit funcione adequadamente e com segurança para todos os usuários.",contact:"Dúvidas sobre privacidade? Entre em contato conosco em privacy@DataKit.dev"},lastUpdated:"Última atualização"}},Uze={title:"Histórico de Consultas",source:"do indexedDB",tabs:{recent:"Recentes",saved:"Salvos"},empty:{recent:"Nenhuma consulta recente. Executar uma consulta para vê-la aqui.",saved:"Nenhuma consulta salva. Clique no ícone de estrela para salvar uma consulta."},unnamedQuery:"Consulta Sem Nome",actions:{save:"Salvar Consulta",editName:"Editar Nome",copy:"Copiar Consulta",delete:"Excluir Consulta",cancel:"Cancelar",use:"Usar"},dateFormat:{today:"Hoje às {{time}}",yesterday:"Ontem às {{time}}"}},Fze={header:{rowsReturned:"linhas retornadas",showingPage:"mostrando página {{Atual}} de {{total}}",downloadCSV:"Baixar CSV"},emptyState:{executing:"Executando consulta...",error:"Erro",empty:"Executar uma consulta para ver os resultados.",noResults:"Consulta executada com sucesso. Nenhum resultado retornado."},pagination:{rowsPerPage:"Linhas por página:",firstPage:"Primeira Página",previousPage:"Página Anterior",pageOf:"Página {{Atual}} de {{total}}",nextPage:"Próxima Página",lastPage:"Última Página",goTo:"Ir para:"}},$ze={saveChart:{myChart:"Meu Gráfico",title:"Salvar Gráfico",chartName:"Nome do Gráfico",enterChartName:"Digite o nome do gráfico",descriptionOptional:"Descrição (opcional)",enterChartDescription:"Digite a descrição do gráfico",saveAsTemplate:"Salvar como Modelo",saveChart:"Salvar Gráfico"},export:{title:"Exportar Gráfico",exportFormat:"Formato de Exportação",options:"Opções",includeTitle:"Incluir título",includeDescription:"Incluir descrição",includeBackground:"Incluir fundo",exportButton:"Exportar {{Formato}}",copied:"Copiado!",copy:"Copiar"},config:{noChart:"Nenhum Gráfico Selecionado",chartTitle:"Título do Gráfico",chartTitlePlaceholder:"Digite o título do gráfico",tabs:{data:"Dados",style:"Estilo",transform:"Transformar"},resetSettings:"Redefinir Configurações do Gráfico"},gallery:{title:"Galeria de Gráficos",searchPlaceholder:"Pesquisar gráficos...",savedCharts:"Gráficos Salvos",templates:"Modelos",noCharts:{title:"Nenhum Gráfico Encontrado",noSaved:"Você ainda não salvou nenhum gráfico. Crie e salve um gráfico para vê-lo aqui.",noSearchResults:"Nenhum modelo corresponde à sua pesquisa.",noTemplates:"Nenhum modelo de gráfico disponível."},createNew:"Criar Novo Gráfico",chartType:"Gráfico {{Tipo}}",template:"Modelo",duplicate:"Duplicar",delete:"Excluir"},canvas:{noData:{title:"Nenhum Dado do Gráfico",message:"Configurar seu gráfico ou Executar uma consulta para visualizar dados."},unsupported:"Tipo de gráfico não suportado"},generator:{xAxisField:"Campo do Eixo X",yAxisField:"Campo do Eixo Y",selectField:"Selecionar campo...",xAxisHelp:"Categorias para agrupar seus dados",yAxisHelpDate:"Campos de Dados para análise temporal",yAxisHelpNumeric:"Valores numéricos para medir",aggregation:"Agregação",aggregationHelpDate:"Agregações de Dados: mais antigo, mais recente ou contar",aggregationHelpNumeric:"Como calcular os valores numéricos",aggregationHelpGeneric:"Como agregar os valores",usingAllData:"Usando todos os dados de {{tableName}} para visualização",processing:"Processando...",generateChart:"Gerar Gráfico",aggregationLabels:{sum:"Soma",avg:"Média",min:"Mínimo",max:"Máximo",count:"Contagem"},description:{sum:'Este gráfico mostrará a soma total de "{{measure}}" para cada categoria "{{dimension}}".',avg:'Este gráfico mostrará a média de "{{measure}}" para cada categoria "{{dimension}}".',min:'Este gráfico mostrará o valor mínimo de "{{measure}}" para cada categoria "{{dimension}}".',minDate:'Este gráfico mostrará a Dados mais antiga de "{{measure}}" para cada categoria "{{dimension}}".',max:'Este gráfico mostrará o valor máximo de "{{measure}}" para cada categoria "{{dimension}}".',maxDate:'Este gráfico mostrará a Dados mais recente de "{{measure}}" para cada categoria "{{dimension}}".',count:'Este gráfico mostrará a contagem de itens em cada categoria "{{dimension}}".'}}},Bze={common:nze,layout:rze,auth:aze,preview:sze,fileUpload:ize,dataImport:oze,settings:lze,feedback:cze,notebooks:uze,dataGrid:dze,demo:hze,demoWizard:fze,dialog:mze,seo:pze,datasetImport:gze,info:Eze,notFound:Tze,privacy:yze,viewer:xze,signup:Sze,fileTabs:bze,viewMode:vze,importModal:Aze,tabs:Rze,sidebar:Nze,pagination:_ze,remoteImport:wze,consent:Cze,ai:Ize,inspector:Oze,workspace:Lze,dataSources:Mze,query:Dze,ui:Pze,settingsPopover:kze,pages:jze,import:{customUrl:{dataset:{featured:"Destaque",importing:"Importando",import:"Importar Conjunto de Dados"},validation:{enterUrl:"Por favor, insira uma URL",validUrl:"Por favor, insira uma URL válida",fileDetected:"Arquivo {{Formato}} detectado",readyToImport:"URL válida - pronto para importar"},form:{fileUrlLabel:"URL do arquivo (acesso público)",placeholder:"HTTPS://raw.githubusercontent.com/usuario/repo/main/dados.CSV"},actions:{importing:"Importando",importFromUrl:"Importar da URL",openFileUrl:"Abrir URL do arquivo"},examples:{title:"Conjuntos de Dados de Exemplo",subtitle:"Experimente estes conjuntos de dados públicos selecionados do GitHub",loading:"Carregando conjuntos de dados..."},footer:{supportedUrls:"URLs suportadas:",directFiles:"URLs diretas de arquivos (CSV, JSON, Parquet, Excel)",publicRepos:"Repositórios de dados públicos e APIs"}},motherduck:{success:{title:"Tudo pronto!",description:"Conexão bem-sucedida. Você pode consultar seu MotherDuck na aba de consulta.",goToQuery:"Ir para Aba de Consulta"}},gcs:{categories:{all:"Todos os Conjuntos de Dados",earthObservation:"Observação da Terra",climate:"Dados Climáticos",geospatial:"Geoespacial",research:"Pesquisa"},dataset:{featured:"Destaque",preview:"Visualizar",importing:"Importando",import:"Importar"},preview:{category:"Categoria",size:"Tamanho",formats:"Formatos",lastUpdated:"Última Atualização",tags:"Tags",gcsUrl:"URL GCS",cancel:"Cancelar",docs:"Documentos",importing:"Importando",importDataset:"Importar Conjunto de Dados"},header:{title:"Google Cloud Storage",subtitle:"Acesse conjuntos de dados públicos e dados de observação da terra"},search:{placeholder:"Pesquisar conjuntos de dados..."},loading:{datasets:"Carregando conjuntos de dados..."},sections:{featured:"Observação da Terra em Destaque",allDatasets:"Todos os Conjuntos de Dados ({{count}})"},empty:{noDatasets:"Nenhum conjunto de dados encontrado",tryAdjusting:"Tente ajustar sua pesquisa ou filtro de categoria"}}},queryHistory:Uze,queryResults:Fze,visualization:$ze};ja.use(YZ).use(soe).init({debug:!1,fallbackLng:"en",supportedLngs:["en","pt"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],caches:["localStorage"]},resources:{en:{translation:tze},pt:{translation:Bze}}});const Hze={api_host:"https://eu.i.posthog.com",person_profiles:"identified_only",capture_pageview:!1,capture_pageleave:!0,persistence:"localStorage+cookie",autocapture:!1,disable_session_recording:!1,opt_out_capturing_by_default:!1,session_recording:{maskAllInputs:!0,maskAllText:!0,maskAllImages:!0,blockAllMedia:!0,maskTextSelector:"*",maskInputOptions:{color:!0,date:!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}},loaded:e=>{e.startSessionRecording(),e.capture("$pageview",{tracking_level:"basic"})}};hne.createRoot(document.getElementById("root")).render(o.jsx(v.StrictMode,{children:o.jsx(ise,{apiKey:"phc_2N0wObe0l2IxmeQL2TfA5wLlPX47lRhOe7XLaFY4XQG",options:Hze,children:o.jsx(_8,{children:o.jsx(DGe,{})})})}));export{fn as _,oT as c,ir as g};
