diff --git a/assets/index-BxjtieRf.js b/assets/index-B2akmyp4.js similarity index 91% rename from assets/index-BxjtieRf.js rename to assets/index-B2akmyp4.js index 5bd4ad9..38a9828 100644 --- a/assets/index-BxjtieRf.js +++ b/assets/index-B2akmyp4.js @@ -225,4 +225,4 @@ You can add a description to the \`${Ao}\` by passing a \`${F0}\` component as a Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ao}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},tR=D0,nR=O0,W0=j0,B0=M0,V0=$0,q0=U0,G0=L0,K0=z0;const rR=tR,oR=nR,Q0=v.forwardRef(({className:e,...t},n)=>w.jsx(W0,{className:Se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Q0.displayName=W0.displayName;const Y0=v.forwardRef(({className:e,...t},n)=>w.jsxs(oR,{children:[w.jsx(Q0,{}),w.jsx(B0,{ref:n,className:Se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Y0.displayName=B0.displayName;const X0=({className:e,...t})=>w.jsx("div",{className:Se("flex flex-col space-y-2 text-center sm:text-left",e),...t});X0.displayName="AlertDialogHeader";const Z0=({className:e,...t})=>w.jsx("div",{className:Se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Z0.displayName="AlertDialogFooter";const J0=v.forwardRef(({className:e,...t},n)=>w.jsx(G0,{ref:n,className:Se("text-lg font-semibold",e),...t}));J0.displayName=G0.displayName;const ew=v.forwardRef(({className:e,...t},n)=>w.jsx(K0,{ref:n,className:Se("text-sm",e),...t}));ew.displayName=K0.displayName;const tw=v.forwardRef(({className:e,...t},n)=>w.jsx(V0,{ref:n,className:Se(Pf(),e),...t}));tw.displayName=V0.displayName;const nw=v.forwardRef(({className:e,...t},n)=>w.jsx(q0,{ref:n,className:Se(Pf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));nw.displayName=q0.displayName;function iR(){const{db:e,tables:t,isLoading:n,loadDatabase:r}=Jr(),[o,i]=v.useState(null),[l,a]=v.useState(!1),[f,u]=v.useState(null),p=v.useRef(!1),m=async(x,C=!1)=>{try{const E=C?`https://corsproxy.io/?${x}`:x,R=await fetch(E);if(!R.ok)i(`URL not found or invalid: ( ${R.status} )`);else{const y=await R.blob(),g=new File([y],"database.sqlite");await r(g),i(null)}}catch(E){E instanceof Error&&(C?i(`Error fetching database from URL (with proxy): ${x} - ${E.message}`):(u(x),a(!0)))}};v.useEffect(()=>{if(p.current)return;const x=new URLSearchParams(window.location.search),C=decodeURIComponent(x.get("url")||"");C&&(m(C),p.current=!0)},[]);const h=()=>{f&&(m(f,!0),a(!1))};return w.jsxs("div",{className:"flex flex-col gap-3",children:[!e&&w.jsx(Ik,{}),w.jsx(jk,{}),w.jsx(Mk,{}),o&&!e&&w.jsx(Ec,{children:o}),!n&&e&&(t.length>0?w.jsx(A_,{}):w.jsx(Ec,{children:"Your database is empty, no tables found"})),w.jsx(rR,{open:l,onOpenChange:a,children:w.jsxs(Y0,{children:[w.jsxs(X0,{children:[w.jsx(J0,{children:"Retry using a proxy?"}),w.jsx(ew,{children:"Failed to load the database from the provided URL due to possible CORS restrictions."})]}),w.jsx("div",{className:"text-sm font-semibold",children:"Using the proxy may expose your database to corsproxy.io services."}),w.jsxs(Z0,{children:[w.jsx(nw,{onClick:()=>a(!1),children:"Cancel"}),w.jsx(tw,{onClick:h,children:"Confirm"})]})]})})]})}function lR(){const[e,t]=v.useState(!1);v.useEffect(()=>{const r=()=>{const l=window.matchMedia("(prefers-color-scheme: dark)").matches;t(l),document.body.classList.toggle("dark",l)},o=localStorage.getItem("darkMode");if(o!==null){const l=o==="true";t(l),document.body.classList.toggle("dark",l)}else r();const i=window.matchMedia("(prefers-color-scheme: dark)");return i.addEventListener("change",r),()=>{i.removeEventListener("change",r)}},[]);const n=()=>{const r=!e;t(r),localStorage.setItem("darkMode",r.toString()),document.body.classList.toggle("dark",r)};return w.jsx(Dt,{onClick:n,className:"relative",variant:"outline",children:e?w.jsx(vb,{className:"h-5 w-5"}):w.jsx(pb,{className:"h-5 w-5"})})}function sR(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const rw=Q.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,handleOnly:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{},direction:"bottom"}),ya=()=>{const e=Q.useContext(rw);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};sR("[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left]{overflow-x:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]::after{content:'';position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-handle]{display:block;position:relative;opacity:.8;margin-left:auto;margin-right:auto;height:5px;width:56px;border-radius:1rem;touch-action:pan-y;cursor:grab}[vaul-handle]:active,[vaul-handle]:hover{opacity:1}[vaul-handle]:active{cursor:grabbing}[vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@media (hover:hover) and (pointer:fine){[vaul-drawer]{user-select:none}}@media (pointer:fine){[vaul-handle-hitarea]:{width:100%;height:100%}}");const aR=typeof window<"u"?v.useLayoutEffect:v.useEffect;function Pc(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}function uR(){return Xf(/^Mac/)}function cR(){return Xf(/^iPhone/)}function fR(){return Xf(/^iPad/)||uR()&&navigator.maxTouchPoints>1}function ow(){return cR()||fR()}function Xf(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const pu=typeof document<"u"&&window.visualViewport;function _m(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function iw(e){for(_m(e)&&(e=e.parentElement);e&&!_m(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const dR=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let ql=0,mu;function pR(e={}){let{isDisabled:t}=e;aR(()=>{if(!t)return ql++,ql===1&&(ow()?mu=hR():mu=mR()),()=>{ql--,ql===0&&mu()}},[t])}function mR(){return Pc(lw(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function hR(){let e,t=0,n=m=>{e=iw(m.target),!(e===document.documentElement&&e===document.body)&&(t=m.changedTouches[0].pageY)},r=m=>{if(!e||e===document.documentElement||e===document.body){m.preventDefault();return}let h=m.changedTouches[0].pageY,x=e.scrollTop,C=e.scrollHeight-e.clientHeight;C!==0&&((x<=0&&h>t||x>=C&&h{let h=m.target;Tc(h)&&h!==document.activeElement&&(m.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},i=m=>{let h=m.target;Tc(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",pu&&(pu.height{km(h)}):pu.addEventListener("resize",()=>km(h),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},a=window.pageXOffset,f=window.pageYOffset,u=Pc(lw(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let p=Pc(vi(document,"touchstart",n,{passive:!1,capture:!0}),vi(document,"touchmove",r,{passive:!1,capture:!0}),vi(document,"touchend",o,{passive:!1,capture:!0}),vi(document,"focus",i,!0),vi(window,"scroll",l));return()=>{u(),p(),window.scrollTo(a,f)}}function lw(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function vi(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function km(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=iw(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const l=n.getBoundingClientRect().bottom;i>l&&(n.scrollTop+=o-r)}e=n.parentElement}}function Tc(e){return e instanceof HTMLInputElement&&!dR.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function vR(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function gR(...e){return t=>e.forEach(n=>vR(n,t))}function sw(...e){return v.useCallback(gR(...e),e)}let gi=null;function yR({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:o,noBodyStyles:i}){const[l,a]=Q.useState(()=>typeof window<"u"?window.location.href:""),f=Q.useRef(0),u=Q.useCallback(()=>{if(gi===null&&e&&!i){gi={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:m,innerHeight:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-f.current}px`,left:`${-m}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const x=h-window.innerHeight;x&&f.current>=h&&(document.body.style.top=`${-(f.current+x)}px`)}),300)}},[e]),p=Q.useCallback(()=>{if(gi!==null&&!i){const m=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,gi),window.requestAnimationFrame(()=>{if(o&&l!==window.location.href){a(window.location.href);return}window.scrollTo(h,m)}),gi=null}},[l]);return Q.useEffect(()=>{function m(){f.current=window.scrollY}return m(),window.addEventListener("scroll",m),()=>{window.removeEventListener("scroll",m)}},[]),Q.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{p()},500)):p())},[e,r,l,t,n,u,p]),{restorePositionSetting:p}}const aw=new WeakMap;function He(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([o,i])=>{if(o.startsWith("--")){e.style.setProperty(o,i);return}r[o]=e.style[o],e.style[o]=i}),!n&&aw.set(e,r)}function Gl(e,t){if(!e||!(e instanceof HTMLElement))return;let n=aw.get(e);n&&(t?e.style[t]=n[t]:Object.entries(n).forEach(([r,o])=>{e.style[r]=o}))}const ot=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Kl(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[ot(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[ot(t)?5:4]):null)}function wR(e){return 8*(Math.log(e+1)-2)}const Ae={DURATION:.5,EASE:[.32,.72,0,1]},uw=.4;function cw(e){const t=Q.useRef(e);return Q.useEffect(()=>{t.current=e}),Q.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function xR({defaultProp:e,onChange:t}){const n=Q.useState(e),[r]=n,o=Q.useRef(r),i=cw(t);return Q.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function SR({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=xR({defaultProp:t,onChange:n}),i=e!==void 0,l=i?e:r,a=cw(n),f=Q.useCallback(u=>{if(i){const m=typeof u=="function"?u(e):u;m!==e&&a(m)}else o(u)},[i,e,o,a]);return[l,f]}function ER({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:o,fadeFromIndex:i,onSnapPointChange:l,direction:a="bottom"}){const[f,u]=SR({prop:e,defaultProp:n==null?void 0:n[0],onChange:t}),p=Q.useMemo(()=>f===(n==null?void 0:n[n.length-1])||null,[n,f]),m=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===f||!n,h=Q.useMemo(()=>n==null?void 0:n.findIndex(b=>b===f),[n,f]),x=Q.useMemo(()=>{var b;return(b=n==null?void 0:n.map(_=>{const P=typeof window<"u",D=typeof _=="string";let T=0;if(D&&(T=parseInt(_,10)),ot(a)){const j=D?T:P?_*window.innerHeight:0;return P?a==="bottom"?window.innerHeight-j:-window.innerHeight+j:j}const A=D?T:P?_*window.innerWidth:0;return P?a==="right"?window.innerWidth-A:-window.innerWidth+A:A}))!=null?b:[]},[n]),C=Q.useMemo(()=>h!==null?x==null?void 0:x[h]:null,[x,h]),E=Q.useCallback(b=>{var _;const P=(_=x==null?void 0:x.findIndex(D=>D===b))!=null?_:null;l(P),He(r.current,{transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,transform:ot(a)?`translate3d(0, ${b}px, 0)`:`translate3d(${b}px, 0, 0)`}),x&&P!==x.length-1&&P!==i?He(o.current,{transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,opacity:"0"}):He(o.current,{transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,opacity:"1"}),u(P!==null?n==null?void 0:n[P]:null)},[r.current,n,x,i,o,u]);Q.useEffect(()=>{if(f||e){var b;const _=(b=n==null?void 0:n.findIndex(P=>P===e||P===f))!=null?b:-1;x&&_!==-1&&typeof x[_]=="number"&&E(x[_])}},[f,e,n,x,E]);function R({draggedDistance:b,closeDrawer:_,velocity:P,dismissible:D}){if(i===void 0)return;const T=a==="bottom"||a==="right"?(C??0)-b:(C??0)+b,A=h===i-1,j=h===0,I=b>0;if(A&&He(o.current,{transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`}),P>2&&!I){D?_():E(x[0]);return}if(P>2&&I&&x&&n){E(x[n.length-1]);return}const V=x==null?void 0:x.reduce((F,W)=>typeof F!="number"||typeof W!="number"?F:Math.abs(W-T)uw&&Math.abs(b)0&&p){E(x[n.length-1]);return}if(j&&F<0&&D&&_(),h===null)return;E(x[h+F]);return}E(V)}function y({draggedDistance:b}){if(C===null)return;const _=a==="bottom"||a==="right"?C-b:C+b;(a==="bottom"||a==="right")&&_x[x.length-1]||He(r.current,{transform:ot(a)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}function g(b,_){if(!n||typeof h!="number"||!x||i===void 0)return null;const P=h===i-1;if(h>=i&&_)return 0;if(P&&!_)return 1;if(!m&&!P)return null;const T=P?h+1:h-1,A=P?x[T]-x[T-1]:x[T+1]-x[T],j=b/Math.abs(A);return P?1-j:j}return{isLastSnapPoint:p,activeSnapPoint:f,shouldFade:m,getPercentageDragged:g,setActiveSnapPoint:u,activeSnapPointIndex:h,onRelease:R,onDrag:y,snapPointsOffset:x}}const bR=.25,CR=100,Rm=8,Ar=16,Pm=26,hu="vaul-dragging";function fw({open:e,onOpenChange:t,children:n,shouldScaleBackground:r,onDrag:o,onRelease:i,snapPoints:l,nested:a=!1,setBackgroundColorOnScale:f=!0,closeThreshold:u=bR,scrollLockTimeout:p=CR,dismissible:m=!0,handleOnly:h=!1,fadeFromIndex:x=l&&l.length-1,activeSnapPoint:C,setActiveSnapPoint:E,fixed:R,modal:y=!0,onClose:g,noBodyStyles:b,direction:_="bottom",preventScrollRestoration:P=!0,disablePreventScroll:D=!1}){var T;const[A=!1,j]=Q.useState(!1),[I,V]=Q.useState(!1),[H,F]=Q.useState(!1),[W,Z]=Q.useState(!1),[le,ne]=Q.useState(!1),[z,B]=Q.useState(!1),ee=Q.useRef(null),se=Q.useRef(null),ue=Q.useRef(null),qe=Q.useRef(null),ve=Q.useRef(null),Xe=Q.useRef(!1),_e=Q.useRef(null),J=Q.useRef(0),ye=Q.useRef(!1),Ie=Q.useRef(0),K=Q.useRef(null),ge=Q.useRef(((T=K.current)==null?void 0:T.getBoundingClientRect().height)||0),de=Q.useRef(0),Y=Q.useCallback(ie=>{l&&ie===Tt.length-1&&(se.current=new Date)},[]),{activeSnapPoint:me,activeSnapPointIndex:ut,setActiveSnapPoint:Je,onRelease:tt,snapPointsOffset:Tt,onDrag:ke,shouldFade:rn,getPercentageDragged:eo}=ER({snapPoints:l,activeSnapPointProp:C,setActiveSnapPointProp:E,drawerRef:K,fadeFromIndex:x,overlayRef:ee,onSnapPointChange:Y,direction:_});pR({isDisabled:!A||le||!y||z||!I||D});const{restorePositionSetting:Ft}=yR({isOpen:A,modal:y,nested:a,hasBeenOpened:I,preventScrollRestoration:P,noBodyStyles:b});function yn(){return(window.innerWidth-Pm)/window.innerWidth}function G(ie){var fe;!m&&!l||K.current&&!K.current.contains(ie.target)||(ge.current=((fe=K.current)==null?void 0:fe.getBoundingClientRect().height)||0,ne(!0),ue.current=new Date,ow()&&window.addEventListener("touchend",()=>Xe.current=!1,{once:!0}),ie.target.setPointerCapture(ie.pointerId),J.current=ot(_)?ie.clientY:ie.clientX)}function oe(ie,fe){var Re;let q=ie;const De=(Re=window.getSelection())==null?void 0:Re.toString(),We=K.current?Kl(K.current,_):null,Et=new Date;if(q.hasAttribute("data-vaul-no-drag")||q.closest("[data-vaul-no-drag]"))return!1;if(_==="right"||_==="left")return!0;if(se.current&&Et.getTime()-se.current.getTime()<500)return!1;if(We!==null&&(_==="bottom"?We>0:We<0))return!0;if(De&&De.length>0)return!1;if(ve.current&&Et.getTime()-ve.current.getTime()q.clientHeight){if(q.scrollTop!==0)return ve.current=new Date,!1;if(q.getAttribute("role")==="dialog")return!0}q=q.parentNode}return!0}function Le(ie){if(K.current&&le){const fe=_==="bottom"||_==="right"?1:-1,Re=(J.current-(ot(_)?ie.clientY:ie.clientX))*fe,q=Re>0,De=l&&!m&&!q;if(De&&ut===0)return;const We=Math.abs(Re),Et=document.querySelector("[vaul-drawer-wrapper]");let vt=We/ge.current;const wn=eo(We,q);if(wn!==null&&(vt=wn),De&&vt>=1||!Xe.current&&!oe(ie.target,q))return;if(K.current.classList.add(hu),Xe.current=!0,He(K.current,{transition:"none"}),He(ee.current,{transition:"none"}),l&&ke({draggedDistance:Re}),q&&!l){const xn=wR(Re),U=Math.min(xn*-1,0)*fe;He(K.current,{transform:ot(_)?`translate3d(0, ${U}px, 0)`:`translate3d(${U}px, 0, 0)`});return}const zt=1-vt;if((rn||x&&ut===x-1)&&(o==null||o(ie,vt),He(ee.current,{opacity:`${zt}`,transition:"none"},!0)),Et&&ee.current&&r){const xn=Math.min(yn()+vt*(1-yn()),1),U=8-vt*8,to=Math.max(0,14-vt*14);He(Et,{borderRadius:`${U}px`,transform:ot(_)?`scale(${xn}) translate3d(0, ${to}px, 0)`:`scale(${xn}) translate3d(${to}px, 0, 0)`,transition:"none"},!0)}if(!l){const xn=We*fe;He(K.current,{transform:ot(_)?`translate3d(0, ${xn}px, 0)`:`translate3d(${xn}px, 0, 0)`})}}}Q.useEffect(()=>()=>{on(!1),Ft()},[]),Q.useEffect(()=>{var ie;function fe(){if(!K.current)return;const Re=document.activeElement;if(Tc(Re)||ye.current){var q;const De=((q=window.visualViewport)==null?void 0:q.height)||0;let We=window.innerHeight-De;const Et=K.current.getBoundingClientRect().height||0;de.current||(de.current=Et);const vt=K.current.getBoundingClientRect().top;if(Math.abs(Ie.current-We)>60&&(ye.current=!ye.current),l&&l.length>0&&Tt&&ut){const wn=Tt[ut]||0;We+=wn}if(Ie.current=We,Et>De||ye.current){const wn=K.current.getBoundingClientRect().height;let zt=wn;wn>De&&(zt=De-Pm),R?K.current.style.height=`${wn-Math.max(We,0)}px`:K.current.style.height=`${Math.max(zt,De-vt)}px`}else K.current.style.height=`${de.current}px`;l&&l.length>0&&!ye.current?K.current.style.bottom="0px":K.current.style.bottom=`${Math.max(We,0)}px`}}return(ie=window.visualViewport)==null||ie.addEventListener("resize",fe),()=>{var Re;return(Re=window.visualViewport)==null?void 0:Re.removeEventListener("resize",fe)}},[ut,l,Tt]);function Pe(){K.current&&(Nt(),g==null||g(),He(K.current,{transform:ot(_)?`translate3d(0, ${_==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${_==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`}),He(ee.current,{opacity:"0",transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`}),on(!1),setTimeout(()=>{F(!1),j(!1)},300),setTimeout(()=>{l&&Je(l[0])},Ae.DURATION*1e3))}Q.useEffect(()=>{if(!A&&r){const ie=setTimeout(()=>{Gl(document.body)},200);return()=>clearTimeout(ie)}},[A,r]),Q.useLayoutEffect(()=>{e?(j(!0),V(!0)):Pe()},[e]),Q.useEffect(()=>{W&&(t==null||t(A))},[A]),Q.useEffect(()=>{Z(!0)},[]);function nt(){if(!K.current)return;const ie=document.querySelector("[vaul-drawer-wrapper]"),fe=Kl(K.current,_);He(K.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`}),He(ee.current,{transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,opacity:"1"}),r&&fe&&fe>0&&A&&He(ie,{borderRadius:`${Rm}px`,overflow:"hidden",...ot(_)?{transform:`scale(${yn()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${yn()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ae.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ae.EASE.join(",")})`},!0)}function Nt(){!le||!K.current||(K.current.classList.remove(hu),Xe.current=!1,ne(!1),qe.current=new Date)}function St(ie){if(!le||!K.current)return;K.current.classList.remove(hu),Xe.current=!1,ne(!1),qe.current=new Date;const fe=Kl(K.current,_);if(!oe(ie.target,!1)||!fe||Number.isNaN(fe)||ue.current===null)return;const Re=qe.current.getTime()-ue.current.getTime(),q=J.current-(ot(_)?ie.clientY:ie.clientX),De=Math.abs(q)/Re;if(De>.05&&(B(!0),setTimeout(()=>{B(!1)},200)),l){tt({draggedDistance:q*(_==="bottom"||_==="right"?1:-1),closeDrawer:Pe,velocity:De,dismissible:m}),i==null||i(ie,!0);return}if(_==="bottom"||_==="right"?q>0:q<0){nt(),i==null||i(ie,!0);return}if(De>uw){Pe(),i==null||i(ie,!1);return}var We;const Et=Math.min((We=K.current.getBoundingClientRect().height)!=null?We:0,window.innerHeight);if(fe>=Et*u){Pe(),i==null||i(ie,!1);return}i==null||i(ie,!0),nt()}Q.useEffect(()=>{A&&(He(document.documentElement,{scrollBehavior:"auto"}),se.current=new Date,on(!0))},[A]),Q.useEffect(()=>{if(K.current&&H){var ie;const fe=K==null||(ie=K.current)==null?void 0:ie.querySelectorAll("*");fe==null||fe.forEach(Re=>{const q=Re;(q.scrollHeight>q.clientHeight||q.scrollWidth>q.clientWidth)&&q.classList.add("vaul-scrollable")})}},[H]);function on(ie){const fe=document.querySelector("[vaul-drawer-wrapper]");!fe||!r||(ie?(f&&(b||(He(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),He(document.body,{background:"black"},!0))),He(fe,{borderRadius:`${Rm}px`,overflow:"hidden",...ot(_)?{transform:`scale(${yn()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${yn()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ae.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ae.EASE.join(",")})`})):(Gl(fe,"overflow"),Gl(fe,"transform"),Gl(fe,"borderRadius"),He(fe,{transitionProperty:"transform, border-radius",transitionDuration:`${Ae.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ae.EASE.join(",")})`})))}function Yn(ie){const fe=ie?(window.innerWidth-Ar)/window.innerWidth:1,Re=ie?-Ar:0;_e.current&&window.clearTimeout(_e.current),He(K.current,{transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,transform:`scale(${fe}) translate3d(0, ${Re}px, 0)`}),!ie&&K.current&&(_e.current=setTimeout(()=>{const q=Kl(K.current,_);He(K.current,{transition:"none",transform:ot(_)?`translate3d(0, ${q}px, 0)`:`translate3d(${q}px, 0, 0)`})},500))}function Xn(ie,fe){if(fe<0)return;const Re=ot(_)?window.innerHeight:window.innerWidth,q=(Re-Ar)/Re,De=q+fe*(1-q),We=-Ar+fe*Ar;He(K.current,{transform:ot(_)?`scale(${De}) translate3d(0, ${We}px, 0)`:`scale(${De}) translate3d(${We}px, 0, 0)`,transition:"none"})}function Zn(ie,fe){const Re=ot(_)?window.innerHeight:window.innerWidth,q=fe?(Re-Ar)/Re:1,De=fe?-Ar:0;fe&&He(K.current,{transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,transform:ot(_)?`scale(${q}) translate3d(0, ${De}px, 0)`:`scale(${q}) translate3d(${De}px, 0, 0)`})}return Q.createElement(C0,{modal:y,onOpenChange:ie=>{if(e!==void 0){t==null||t(ie);return}ie?(V(!0),j(ie)):Pe()},open:A},Q.createElement(rw.Provider,{value:{visible:H,activeSnapPoint:me,snapPoints:l,setActiveSnapPoint:Je,drawerRef:K,overlayRef:ee,scaleBackground:on,onOpenChange:t,onPress:G,setVisible:F,onRelease:St,onDrag:Le,dismissible:m,handleOnly:h,isOpen:A,isDragging:le,shouldFade:rn,closeDrawer:Pe,onNestedDrag:Xn,onNestedOpenChange:Yn,onNestedRelease:Zn,keyboardIsOpen:ye,openProp:e,modal:y,snapPointsOffset:Tt,direction:_}},n))}const _R=250,kR=120,dw=Q.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{visible:o,closeDrawer:i,isDragging:l,snapPoints:a,activeSnapPoint:f,setActiveSnapPoint:u,dismissible:p,handleOnly:m,onPress:h,onDrag:x}=ya(),C=Q.useRef(null),E=Q.useRef(!1);function R(){if(E.current){b();return}window.setTimeout(()=>{y()},kR)}function y(){if(l||e||E.current){b();return}if(b(),(!a||a.length===0)&&p){i();return}if(f===a[a.length-1]&&p){i();return}const P=a.findIndex(T=>T===f);if(P===-1)return;const D=a[P+1];u(D)}function g(){C.current=window.setTimeout(()=>{E.current=!0},_R)}function b(){window.clearTimeout(C.current),E.current=!1}return Q.createElement("div",{onClick:R,onDoubleClick:()=>{E.current=!0,i()},onPointerCancel:b,onPointerDown:_=>{m&&h(_),g()},onPointerMove:_=>{m&&x(_)},ref:r,"vaul-drawer-visible":o?"true":"false","vaul-handle":"","aria-hidden":"true",...n},Q.createElement("span",{"vaul-handle-hitarea":"","aria-hidden":"true"},t))});dw.displayName="Drawer.Handle";const pw=Q.forwardRef(function({children:e,...t},n){const{overlayRef:r,snapPoints:o,onRelease:i,shouldFade:l,isOpen:a,visible:f}=ya(),u=sw(n,r),p=o&&o.length>0;return Q.createElement(R0,{onMouseUp:i,ref:u,"vaul-drawer-visible":f?"true":"false","vaul-overlay":"","vaul-snap-points":a&&p?"true":"false","vaul-snap-points-overlay":a&&l?"true":"false",...t})});pw.displayName="Drawer.Overlay";const mw=Q.forwardRef(function({onOpenAutoFocus:e,onPointerDownOutside:t,onAnimationEnd:n,style:r,...o},i){const{drawerRef:l,onPress:a,onRelease:f,onDrag:u,dismissible:p,keyboardIsOpen:m,snapPointsOffset:h,visible:x,closeDrawer:C,modal:E,openProp:R,onOpenChange:y,setVisible:g,handleOnly:b,direction:_}=ya(),P=sw(i,l),D=Q.useRef(null),T=Q.useRef(!1),A=(j,I,V=0)=>{if(T.current)return!0;const H=Math.abs(j.y),F=Math.abs(j.x),W=F>H,Z=["bottom","right"].includes(I)?1:-1;if(I==="left"||I==="right"){if(!(j.x*Z<0)&&F>=0&&F<=V)return W}else if(!(j.y*Z<0)&&H>=0&&H<=V)return!W;return T.current=!0,!0};return Q.useEffect(()=>{g(!0)},[]),Q.createElement(P0,{"vaul-drawer":"","vaul-drawer-direction":_,"vaul-drawer-visible":x?"true":"false",...o,ref:P,style:h&&h.length>0?{"--snap-point-height":`${h[0]}px`,...r}:r,onOpenAutoFocus:j=>{if(e)e(j);else{var I;j.preventDefault(),(I=l.current)==null||I.focus()}},onPointerDown:j=>{b||(o.onPointerDown==null||o.onPointerDown.call(o,j),D.current={x:j.clientX,y:j.clientY},a(j))},onPointerDownOutside:j=>{if(t==null||t(j),!E||j.defaultPrevented){j.preventDefault();return}m.current&&(m.current=!1),j.preventDefault(),y==null||y(!1),!(!p||R!==void 0)&&C()},onFocusOutside:j=>{if(!E){j.preventDefault();return}},onEscapeKeyDown:j=>{if(!E){j.preventDefault();return}},onPointerMove:j=>{if(b||(o.onPointerMove==null||o.onPointerMove.call(o,j),!D.current))return;const I=j.clientY-D.current.y,V=j.clientX-D.current.x,H=j.pointerType==="touch"?10:2;A({x:V,y:I},_,H)?u(j):(Math.abs(V)>H||Math.abs(I)>H)&&(D.current=null)},onPointerUp:j=>{o.onPointerUp==null||o.onPointerUp.call(o,j),D.current=null,T.current=!1,f(j)}})});mw.displayName="Drawer.Content";function RR({onDrag:e,onOpenChange:t,...n}){const{onNestedDrag:r,onNestedOpenChange:o,onNestedRelease:i}=ya();if(!r)throw new Error("Drawer.NestedRoot must be placed in another drawer");return Q.createElement(fw,{nested:!0,onClose:()=>{o(!1)},onDrag:(l,a)=>{r(l,a),e==null||e(l,a)},onOpenChange:l=>{l&&o(l),t==null||t(l)},onRelease:i,...n})}const gn={Root:fw,NestedRoot:RR,Content:mw,Handle:dw,Overlay:pw,Trigger:_0,Portal:k0,Close:Yf,Title:T0,Description:N0},hw=({shouldScaleBackground:e=!0,...t})=>w.jsx(gn.Root,{shouldScaleBackground:e,...t});hw.displayName="Drawer";const PR=gn.Trigger,TR=gn.Portal,NR=gn.Close,vw=v.forwardRef(({className:e,...t},n)=>w.jsx(gn.Overlay,{ref:n,className:Se("fixed inset-0 z-50 bg-black/80",e),...t}));vw.displayName=gn.Overlay.displayName;const gw=v.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(TR,{children:[w.jsx(vw,{}),w.jsxs(gn.Content,{ref:r,className:Se("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...n,children:[w.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),t]})]}));gw.displayName="DrawerContent";const yw=({className:e,...t})=>w.jsx("div",{className:Se("grid gap-1.5 p-4 text-center sm:text-left",e),...t});yw.displayName="DrawerHeader";const ww=({className:e,...t})=>w.jsx("div",{className:Se("mt-auto flex flex-col gap-2 p-4",e),...t});ww.displayName="DrawerFooter";const xw=v.forwardRef(({className:e,...t},n)=>w.jsx(gn.Title,{ref:n,className:Se("text-lg font-semibold leading-none tracking-tight",e),...t}));xw.displayName=gn.Title.displayName;const Sw=v.forwardRef(({className:e,...t},n)=>w.jsx(gn.Description,{ref:n,className:Se("text-sm text-muted-foreground",e),...t}));Sw.displayName=gn.Description.displayName;function AR(){const{setRowPerPageOrAuto:e,downloadDatabase:t,exportAllTablesAsCSV:n,exportTableAsCSV:r,selectedTable:o,setIsCustomQuery:i}=Jr(),[l,a]=v.useState(30),[f,u]=v.useState(!1);v.useEffect(()=>{f&&a(30)},[f]);const p=x=>{const C=Number(x.target.value);isNaN(C)||(a(C),u(!1))},m=()=>{u(x=>!x)},h=()=>{i(!1),e(f?"auto":l)};return w.jsxs(hw,{children:[w.jsx(PR,{asChild:!0,children:w.jsx(Dt,{variant:"outline",children:w.jsx(hb,{className:"h-5 w-5"})})}),w.jsx(gw,{children:w.jsxs("div",{className:"mx-auto w-full max-w-md",children:[w.jsxs(yw,{children:[w.jsx(xw,{children:"Settings"}),w.jsx(Sw,{children:"Personalize your site experience here."})]}),w.jsxs("div",{className:"p-4 pb-0 flex flex-col gap-4",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Rows Per Page"}),w.jsxs("div",{className:"border rounded p-2 flex gap-1 justify-center items-center",children:[w.jsx(Rf,{min:"3",max:"500",value:l,onChange:p,disabled:f,placeholder:"30",type:"number",name:"rowsPerPage"}),w.jsx("span",{className:"text-sm text-muted-foreground h-full text-center",children:"OR"}),w.jsx(Dt,{onClick:m,variant:"outline",className:f?"border border-primary":void 0,children:"Auto calculate"})]}),w.jsx(Dt,{className:"w-full mt-2",onClick:h,variant:"outline",children:w.jsx("span",{children:"Save"})})]}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Exports Settings"}),w.jsxs("div",{className:"border rounded p-2 flex flex-col gap-1",children:[w.jsx(Dt,{variant:"outline",onClick:t,children:w.jsx("span",{className:"ml-2",children:"Export as SQLite"})}),w.jsx(Dt,{variant:"outline",onClick:()=>r(parseInt(o)),children:w.jsx("span",{className:"ml-2",children:"Export selected table as CSV"})}),w.jsx(Dt,{variant:"outline",onClick:n,children:w.jsx("span",{className:"ml-2",children:"Export all tables as CSV"})})]})]})]}),w.jsx(ww,{children:w.jsx(NR,{asChild:!0,children:w.jsx(Dt,{variant:"outline",children:"Close"})})})]})})]})}function DR(){const{db:e}=Jr();return w.jsxs("footer",{className:"flex items-center justify-between my-1 p-4 border rounded",children:[w.jsxs("div",{children:[w.jsx("p",{className:"hidden sm:block text-xs",children:"No file will be uploaded to server. using JavaScript, sql.js"}),w.jsx("p",{className:"block sm:hidden text-xs",children:"No file uploads to server."}),w.jsxs("a",{href:"https://github.com/vwh/sqlite-viewer",target:"_blank",className:"text-sm text-link hover:underline flex gap-1 items-center",title:"Star on GitHub",children:[w.jsx(ab,{className:"h-4 w-4"}),w.jsx("span",{children:"Star us on GitHub"})]})]}),w.jsxs("div",{className:"flex gap-1",children:[w.jsx(lR,{}),e&&w.jsx(AR,{})]})]})}vu.createRoot(document.getElementById("root")).render(w.jsx(Q.StrictMode,{children:w.jsxs("main",{className:"container mx-auto p-4",children:[w.jsx(iR,{}),w.jsx(DR,{})]})})); +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},tR=D0,nR=O0,W0=j0,B0=M0,V0=$0,q0=U0,G0=L0,K0=z0;const rR=tR,oR=nR,Q0=v.forwardRef(({className:e,...t},n)=>w.jsx(W0,{className:Se("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Q0.displayName=W0.displayName;const Y0=v.forwardRef(({className:e,...t},n)=>w.jsxs(oR,{children:[w.jsx(Q0,{}),w.jsx(B0,{ref:n,className:Se("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Y0.displayName=B0.displayName;const X0=({className:e,...t})=>w.jsx("div",{className:Se("flex flex-col space-y-2 text-left",e),...t});X0.displayName="AlertDialogHeader";const Z0=({className:e,...t})=>w.jsx("div",{className:Se("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Z0.displayName="AlertDialogFooter";const J0=v.forwardRef(({className:e,...t},n)=>w.jsx(G0,{ref:n,className:Se("text-lg font-semibold",e),...t}));J0.displayName=G0.displayName;const ew=v.forwardRef(({className:e,...t},n)=>w.jsx(K0,{ref:n,className:Se("text-sm",e),...t}));ew.displayName=K0.displayName;const tw=v.forwardRef(({className:e,...t},n)=>w.jsx(V0,{ref:n,className:Se(Pf(),e),...t}));tw.displayName=V0.displayName;const nw=v.forwardRef(({className:e,...t},n)=>w.jsx(q0,{ref:n,className:Se(Pf({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));nw.displayName=q0.displayName;function iR(){const{db:e,tables:t,isLoading:n,loadDatabase:r}=Jr(),[o,i]=v.useState(null),[l,a]=v.useState(!1),[f,u]=v.useState(null),p=v.useRef(!1),m=async(x,C=!1)=>{try{const E=C?`https://corsproxy.io/?${x}`:x,R=await fetch(E);if(!R.ok)i(`URL not found or invalid: ( ${R.status} )`);else{const y=await R.blob(),g=new File([y],"database.sqlite");await r(g),i(null)}}catch(E){E instanceof Error&&(C?i(`Error fetching database from URL (with proxy): ${x} - ${E.message}`):(u(x),a(!0)))}};v.useEffect(()=>{if(p.current)return;const x=new URLSearchParams(window.location.search),C=decodeURIComponent(x.get("url")||"");C&&(m(C),p.current=!0)},[]);const h=()=>{f&&(m(f,!0),a(!1))};return w.jsxs("div",{className:"flex flex-col gap-3",children:[!e&&w.jsx(Ik,{}),w.jsx(jk,{}),w.jsx(Mk,{}),o&&!e&&w.jsx(Ec,{children:o}),!n&&e&&(t.length>0?w.jsx(A_,{}):w.jsx(Ec,{children:"Your database is empty, no tables found"})),w.jsx(rR,{open:l,onOpenChange:a,children:w.jsxs(Y0,{children:[w.jsxs(X0,{children:[w.jsx(J0,{children:"Retry using a proxy?"}),w.jsx(ew,{children:"Failed to load the database from the provided URL due to possible CORS restrictions."})]}),w.jsx("div",{className:"text-sm font-semibold",children:"Using the proxy may expose your database to corsproxy.io services."}),w.jsxs(Z0,{children:[w.jsx(nw,{onClick:()=>a(!1),children:"Cancel"}),w.jsx(tw,{onClick:h,children:"Confirm"})]})]})})]})}function lR(){const[e,t]=v.useState(!1);v.useEffect(()=>{const r=()=>{const l=window.matchMedia("(prefers-color-scheme: dark)").matches;t(l),document.body.classList.toggle("dark",l)},o=localStorage.getItem("darkMode");if(o!==null){const l=o==="true";t(l),document.body.classList.toggle("dark",l)}else r();const i=window.matchMedia("(prefers-color-scheme: dark)");return i.addEventListener("change",r),()=>{i.removeEventListener("change",r)}},[]);const n=()=>{const r=!e;t(r),localStorage.setItem("darkMode",r.toString()),document.body.classList.toggle("dark",r)};return w.jsx(Dt,{onClick:n,className:"relative",variant:"outline",children:e?w.jsx(vb,{className:"h-5 w-5"}):w.jsx(pb,{className:"h-5 w-5"})})}function sR(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const rw=Q.createContext({drawerRef:{current:null},overlayRef:{current:null},scaleBackground:()=>{},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,handleOnly:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},visible:!1,closeDrawer:()=>{},setVisible:()=>{},direction:"bottom"}),ya=()=>{const e=Q.useContext(rw);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};sR("[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left]{overflow-x:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]::after{content:'';position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-handle]{display:block;position:relative;opacity:.8;margin-left:auto;margin-right:auto;height:5px;width:56px;border-radius:1rem;touch-action:pan-y;cursor:grab}[vaul-handle]:active,[vaul-handle]:hover{opacity:1}[vaul-handle]:active{cursor:grabbing}[vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@media (hover:hover) and (pointer:fine){[vaul-drawer]{user-select:none}}@media (pointer:fine){[vaul-handle-hitarea]:{width:100%;height:100%}}");const aR=typeof window<"u"?v.useLayoutEffect:v.useEffect;function Pc(...e){return(...t)=>{for(let n of e)typeof n=="function"&&n(...t)}}function uR(){return Xf(/^Mac/)}function cR(){return Xf(/^iPhone/)}function fR(){return Xf(/^iPad/)||uR()&&navigator.maxTouchPoints>1}function ow(){return cR()||fR()}function Xf(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const pu=typeof document<"u"&&window.visualViewport;function _m(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function iw(e){for(_m(e)&&(e=e.parentElement);e&&!_m(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const dR=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let ql=0,mu;function pR(e={}){let{isDisabled:t}=e;aR(()=>{if(!t)return ql++,ql===1&&(ow()?mu=hR():mu=mR()),()=>{ql--,ql===0&&mu()}},[t])}function mR(){return Pc(lw(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`))}function hR(){let e,t=0,n=m=>{e=iw(m.target),!(e===document.documentElement&&e===document.body)&&(t=m.changedTouches[0].pageY)},r=m=>{if(!e||e===document.documentElement||e===document.body){m.preventDefault();return}let h=m.changedTouches[0].pageY,x=e.scrollTop,C=e.scrollHeight-e.clientHeight;C!==0&&((x<=0&&h>t||x>=C&&h{let h=m.target;Tc(h)&&h!==document.activeElement&&(m.preventDefault(),h.style.transform="translateY(-2000px)",h.focus(),requestAnimationFrame(()=>{h.style.transform=""}))},i=m=>{let h=m.target;Tc(h)&&(h.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{h.style.transform="",pu&&(pu.height{km(h)}):pu.addEventListener("resize",()=>km(h),{once:!0}))}))},l=()=>{window.scrollTo(0,0)},a=window.pageXOffset,f=window.pageYOffset,u=Pc(lw(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let p=Pc(vi(document,"touchstart",n,{passive:!1,capture:!0}),vi(document,"touchmove",r,{passive:!1,capture:!0}),vi(document,"touchend",o,{passive:!1,capture:!0}),vi(document,"focus",i,!0),vi(window,"scroll",l));return()=>{u(),p(),window.scrollTo(a,f)}}function lw(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function vi(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function km(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let n=iw(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,o=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const l=n.getBoundingClientRect().bottom;i>l&&(n.scrollTop+=o-r)}e=n.parentElement}}function Tc(e){return e instanceof HTMLInputElement&&!dR.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function vR(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function gR(...e){return t=>e.forEach(n=>vR(n,t))}function sw(...e){return v.useCallback(gR(...e),e)}let gi=null;function yR({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:o,noBodyStyles:i}){const[l,a]=Q.useState(()=>typeof window<"u"?window.location.href:""),f=Q.useRef(0),u=Q.useCallback(()=>{if(gi===null&&e&&!i){gi={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:m,innerHeight:h}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-f.current}px`,left:`${-m}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const x=h-window.innerHeight;x&&f.current>=h&&(document.body.style.top=`${-(f.current+x)}px`)}),300)}},[e]),p=Q.useCallback(()=>{if(gi!==null&&!i){const m=-parseInt(document.body.style.top,10),h=-parseInt(document.body.style.left,10);Object.assign(document.body.style,gi),window.requestAnimationFrame(()=>{if(o&&l!==window.location.href){a(window.location.href);return}window.scrollTo(h,m)}),gi=null}},[l]);return Q.useEffect(()=>{function m(){f.current=window.scrollY}return m(),window.addEventListener("scroll",m),()=>{window.removeEventListener("scroll",m)}},[]),Q.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&u(),t||window.setTimeout(()=>{p()},500)):p())},[e,r,l,t,n,u,p]),{restorePositionSetting:p}}const aw=new WeakMap;function He(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([o,i])=>{if(o.startsWith("--")){e.style.setProperty(o,i);return}r[o]=e.style[o],e.style[o]=i}),!n&&aw.set(e,r)}function Gl(e,t){if(!e||!(e instanceof HTMLElement))return;let n=aw.get(e);n&&(t?e.style[t]=n[t]:Object.entries(n).forEach(([r,o])=>{e.style[r]=o}))}const ot=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Kl(e,t){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let o=r.match(/^matrix3d\((.+)\)$/);return o?parseFloat(o[1].split(", ")[ot(t)?13:12]):(o=r.match(/^matrix\((.+)\)$/),o?parseFloat(o[1].split(", ")[ot(t)?5:4]):null)}function wR(e){return 8*(Math.log(e+1)-2)}const Ae={DURATION:.5,EASE:[.32,.72,0,1]},uw=.4;function cw(e){const t=Q.useRef(e);return Q.useEffect(()=>{t.current=e}),Q.useMemo(()=>(...n)=>t.current==null?void 0:t.current.call(t,...n),[])}function xR({defaultProp:e,onChange:t}){const n=Q.useState(e),[r]=n,o=Q.useRef(r),i=cw(t);return Q.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function SR({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=xR({defaultProp:t,onChange:n}),i=e!==void 0,l=i?e:r,a=cw(n),f=Q.useCallback(u=>{if(i){const m=typeof u=="function"?u(e):u;m!==e&&a(m)}else o(u)},[i,e,o,a]);return[l,f]}function ER({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:o,fadeFromIndex:i,onSnapPointChange:l,direction:a="bottom"}){const[f,u]=SR({prop:e,defaultProp:n==null?void 0:n[0],onChange:t}),p=Q.useMemo(()=>f===(n==null?void 0:n[n.length-1])||null,[n,f]),m=n&&n.length>0&&(i||i===0)&&!Number.isNaN(i)&&n[i]===f||!n,h=Q.useMemo(()=>n==null?void 0:n.findIndex(b=>b===f),[n,f]),x=Q.useMemo(()=>{var b;return(b=n==null?void 0:n.map(_=>{const P=typeof window<"u",D=typeof _=="string";let T=0;if(D&&(T=parseInt(_,10)),ot(a)){const j=D?T:P?_*window.innerHeight:0;return P?a==="bottom"?window.innerHeight-j:-window.innerHeight+j:j}const A=D?T:P?_*window.innerWidth:0;return P?a==="right"?window.innerWidth-A:-window.innerWidth+A:A}))!=null?b:[]},[n]),C=Q.useMemo(()=>h!==null?x==null?void 0:x[h]:null,[x,h]),E=Q.useCallback(b=>{var _;const P=(_=x==null?void 0:x.findIndex(D=>D===b))!=null?_:null;l(P),He(r.current,{transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,transform:ot(a)?`translate3d(0, ${b}px, 0)`:`translate3d(${b}px, 0, 0)`}),x&&P!==x.length-1&&P!==i?He(o.current,{transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,opacity:"0"}):He(o.current,{transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,opacity:"1"}),u(P!==null?n==null?void 0:n[P]:null)},[r.current,n,x,i,o,u]);Q.useEffect(()=>{if(f||e){var b;const _=(b=n==null?void 0:n.findIndex(P=>P===e||P===f))!=null?b:-1;x&&_!==-1&&typeof x[_]=="number"&&E(x[_])}},[f,e,n,x,E]);function R({draggedDistance:b,closeDrawer:_,velocity:P,dismissible:D}){if(i===void 0)return;const T=a==="bottom"||a==="right"?(C??0)-b:(C??0)+b,A=h===i-1,j=h===0,I=b>0;if(A&&He(o.current,{transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`}),P>2&&!I){D?_():E(x[0]);return}if(P>2&&I&&x&&n){E(x[n.length-1]);return}const V=x==null?void 0:x.reduce((F,W)=>typeof F!="number"||typeof W!="number"?F:Math.abs(W-T)uw&&Math.abs(b)0&&p){E(x[n.length-1]);return}if(j&&F<0&&D&&_(),h===null)return;E(x[h+F]);return}E(V)}function y({draggedDistance:b}){if(C===null)return;const _=a==="bottom"||a==="right"?C-b:C+b;(a==="bottom"||a==="right")&&_x[x.length-1]||He(r.current,{transform:ot(a)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}function g(b,_){if(!n||typeof h!="number"||!x||i===void 0)return null;const P=h===i-1;if(h>=i&&_)return 0;if(P&&!_)return 1;if(!m&&!P)return null;const T=P?h+1:h-1,A=P?x[T]-x[T-1]:x[T+1]-x[T],j=b/Math.abs(A);return P?1-j:j}return{isLastSnapPoint:p,activeSnapPoint:f,shouldFade:m,getPercentageDragged:g,setActiveSnapPoint:u,activeSnapPointIndex:h,onRelease:R,onDrag:y,snapPointsOffset:x}}const bR=.25,CR=100,Rm=8,Ar=16,Pm=26,hu="vaul-dragging";function fw({open:e,onOpenChange:t,children:n,shouldScaleBackground:r,onDrag:o,onRelease:i,snapPoints:l,nested:a=!1,setBackgroundColorOnScale:f=!0,closeThreshold:u=bR,scrollLockTimeout:p=CR,dismissible:m=!0,handleOnly:h=!1,fadeFromIndex:x=l&&l.length-1,activeSnapPoint:C,setActiveSnapPoint:E,fixed:R,modal:y=!0,onClose:g,noBodyStyles:b,direction:_="bottom",preventScrollRestoration:P=!0,disablePreventScroll:D=!1}){var T;const[A=!1,j]=Q.useState(!1),[I,V]=Q.useState(!1),[H,F]=Q.useState(!1),[W,Z]=Q.useState(!1),[le,ne]=Q.useState(!1),[z,B]=Q.useState(!1),ee=Q.useRef(null),se=Q.useRef(null),ue=Q.useRef(null),qe=Q.useRef(null),ve=Q.useRef(null),Xe=Q.useRef(!1),_e=Q.useRef(null),J=Q.useRef(0),ye=Q.useRef(!1),Ie=Q.useRef(0),K=Q.useRef(null),ge=Q.useRef(((T=K.current)==null?void 0:T.getBoundingClientRect().height)||0),de=Q.useRef(0),Y=Q.useCallback(ie=>{l&&ie===Tt.length-1&&(se.current=new Date)},[]),{activeSnapPoint:me,activeSnapPointIndex:ut,setActiveSnapPoint:Je,onRelease:tt,snapPointsOffset:Tt,onDrag:ke,shouldFade:rn,getPercentageDragged:eo}=ER({snapPoints:l,activeSnapPointProp:C,setActiveSnapPointProp:E,drawerRef:K,fadeFromIndex:x,overlayRef:ee,onSnapPointChange:Y,direction:_});pR({isDisabled:!A||le||!y||z||!I||D});const{restorePositionSetting:Ft}=yR({isOpen:A,modal:y,nested:a,hasBeenOpened:I,preventScrollRestoration:P,noBodyStyles:b});function yn(){return(window.innerWidth-Pm)/window.innerWidth}function G(ie){var fe;!m&&!l||K.current&&!K.current.contains(ie.target)||(ge.current=((fe=K.current)==null?void 0:fe.getBoundingClientRect().height)||0,ne(!0),ue.current=new Date,ow()&&window.addEventListener("touchend",()=>Xe.current=!1,{once:!0}),ie.target.setPointerCapture(ie.pointerId),J.current=ot(_)?ie.clientY:ie.clientX)}function oe(ie,fe){var Re;let q=ie;const De=(Re=window.getSelection())==null?void 0:Re.toString(),We=K.current?Kl(K.current,_):null,Et=new Date;if(q.hasAttribute("data-vaul-no-drag")||q.closest("[data-vaul-no-drag]"))return!1;if(_==="right"||_==="left")return!0;if(se.current&&Et.getTime()-se.current.getTime()<500)return!1;if(We!==null&&(_==="bottom"?We>0:We<0))return!0;if(De&&De.length>0)return!1;if(ve.current&&Et.getTime()-ve.current.getTime()q.clientHeight){if(q.scrollTop!==0)return ve.current=new Date,!1;if(q.getAttribute("role")==="dialog")return!0}q=q.parentNode}return!0}function Le(ie){if(K.current&&le){const fe=_==="bottom"||_==="right"?1:-1,Re=(J.current-(ot(_)?ie.clientY:ie.clientX))*fe,q=Re>0,De=l&&!m&&!q;if(De&&ut===0)return;const We=Math.abs(Re),Et=document.querySelector("[vaul-drawer-wrapper]");let vt=We/ge.current;const wn=eo(We,q);if(wn!==null&&(vt=wn),De&&vt>=1||!Xe.current&&!oe(ie.target,q))return;if(K.current.classList.add(hu),Xe.current=!0,He(K.current,{transition:"none"}),He(ee.current,{transition:"none"}),l&&ke({draggedDistance:Re}),q&&!l){const xn=wR(Re),U=Math.min(xn*-1,0)*fe;He(K.current,{transform:ot(_)?`translate3d(0, ${U}px, 0)`:`translate3d(${U}px, 0, 0)`});return}const zt=1-vt;if((rn||x&&ut===x-1)&&(o==null||o(ie,vt),He(ee.current,{opacity:`${zt}`,transition:"none"},!0)),Et&&ee.current&&r){const xn=Math.min(yn()+vt*(1-yn()),1),U=8-vt*8,to=Math.max(0,14-vt*14);He(Et,{borderRadius:`${U}px`,transform:ot(_)?`scale(${xn}) translate3d(0, ${to}px, 0)`:`scale(${xn}) translate3d(${to}px, 0, 0)`,transition:"none"},!0)}if(!l){const xn=We*fe;He(K.current,{transform:ot(_)?`translate3d(0, ${xn}px, 0)`:`translate3d(${xn}px, 0, 0)`})}}}Q.useEffect(()=>()=>{on(!1),Ft()},[]),Q.useEffect(()=>{var ie;function fe(){if(!K.current)return;const Re=document.activeElement;if(Tc(Re)||ye.current){var q;const De=((q=window.visualViewport)==null?void 0:q.height)||0;let We=window.innerHeight-De;const Et=K.current.getBoundingClientRect().height||0;de.current||(de.current=Et);const vt=K.current.getBoundingClientRect().top;if(Math.abs(Ie.current-We)>60&&(ye.current=!ye.current),l&&l.length>0&&Tt&&ut){const wn=Tt[ut]||0;We+=wn}if(Ie.current=We,Et>De||ye.current){const wn=K.current.getBoundingClientRect().height;let zt=wn;wn>De&&(zt=De-Pm),R?K.current.style.height=`${wn-Math.max(We,0)}px`:K.current.style.height=`${Math.max(zt,De-vt)}px`}else K.current.style.height=`${de.current}px`;l&&l.length>0&&!ye.current?K.current.style.bottom="0px":K.current.style.bottom=`${Math.max(We,0)}px`}}return(ie=window.visualViewport)==null||ie.addEventListener("resize",fe),()=>{var Re;return(Re=window.visualViewport)==null?void 0:Re.removeEventListener("resize",fe)}},[ut,l,Tt]);function Pe(){K.current&&(Nt(),g==null||g(),He(K.current,{transform:ot(_)?`translate3d(0, ${_==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${_==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`}),He(ee.current,{opacity:"0",transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`}),on(!1),setTimeout(()=>{F(!1),j(!1)},300),setTimeout(()=>{l&&Je(l[0])},Ae.DURATION*1e3))}Q.useEffect(()=>{if(!A&&r){const ie=setTimeout(()=>{Gl(document.body)},200);return()=>clearTimeout(ie)}},[A,r]),Q.useLayoutEffect(()=>{e?(j(!0),V(!0)):Pe()},[e]),Q.useEffect(()=>{W&&(t==null||t(A))},[A]),Q.useEffect(()=>{Z(!0)},[]);function nt(){if(!K.current)return;const ie=document.querySelector("[vaul-drawer-wrapper]"),fe=Kl(K.current,_);He(K.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`}),He(ee.current,{transition:`opacity ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,opacity:"1"}),r&&fe&&fe>0&&A&&He(ie,{borderRadius:`${Rm}px`,overflow:"hidden",...ot(_)?{transform:`scale(${yn()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${yn()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ae.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ae.EASE.join(",")})`},!0)}function Nt(){!le||!K.current||(K.current.classList.remove(hu),Xe.current=!1,ne(!1),qe.current=new Date)}function St(ie){if(!le||!K.current)return;K.current.classList.remove(hu),Xe.current=!1,ne(!1),qe.current=new Date;const fe=Kl(K.current,_);if(!oe(ie.target,!1)||!fe||Number.isNaN(fe)||ue.current===null)return;const Re=qe.current.getTime()-ue.current.getTime(),q=J.current-(ot(_)?ie.clientY:ie.clientX),De=Math.abs(q)/Re;if(De>.05&&(B(!0),setTimeout(()=>{B(!1)},200)),l){tt({draggedDistance:q*(_==="bottom"||_==="right"?1:-1),closeDrawer:Pe,velocity:De,dismissible:m}),i==null||i(ie,!0);return}if(_==="bottom"||_==="right"?q>0:q<0){nt(),i==null||i(ie,!0);return}if(De>uw){Pe(),i==null||i(ie,!1);return}var We;const Et=Math.min((We=K.current.getBoundingClientRect().height)!=null?We:0,window.innerHeight);if(fe>=Et*u){Pe(),i==null||i(ie,!1);return}i==null||i(ie,!0),nt()}Q.useEffect(()=>{A&&(He(document.documentElement,{scrollBehavior:"auto"}),se.current=new Date,on(!0))},[A]),Q.useEffect(()=>{if(K.current&&H){var ie;const fe=K==null||(ie=K.current)==null?void 0:ie.querySelectorAll("*");fe==null||fe.forEach(Re=>{const q=Re;(q.scrollHeight>q.clientHeight||q.scrollWidth>q.clientWidth)&&q.classList.add("vaul-scrollable")})}},[H]);function on(ie){const fe=document.querySelector("[vaul-drawer-wrapper]");!fe||!r||(ie?(f&&(b||(He(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),He(document.body,{background:"black"},!0))),He(fe,{borderRadius:`${Rm}px`,overflow:"hidden",...ot(_)?{transform:`scale(${yn()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${yn()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ae.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ae.EASE.join(",")})`})):(Gl(fe,"overflow"),Gl(fe,"transform"),Gl(fe,"borderRadius"),He(fe,{transitionProperty:"transform, border-radius",transitionDuration:`${Ae.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ae.EASE.join(",")})`})))}function Yn(ie){const fe=ie?(window.innerWidth-Ar)/window.innerWidth:1,Re=ie?-Ar:0;_e.current&&window.clearTimeout(_e.current),He(K.current,{transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,transform:`scale(${fe}) translate3d(0, ${Re}px, 0)`}),!ie&&K.current&&(_e.current=setTimeout(()=>{const q=Kl(K.current,_);He(K.current,{transition:"none",transform:ot(_)?`translate3d(0, ${q}px, 0)`:`translate3d(${q}px, 0, 0)`})},500))}function Xn(ie,fe){if(fe<0)return;const Re=ot(_)?window.innerHeight:window.innerWidth,q=(Re-Ar)/Re,De=q+fe*(1-q),We=-Ar+fe*Ar;He(K.current,{transform:ot(_)?`scale(${De}) translate3d(0, ${We}px, 0)`:`scale(${De}) translate3d(${We}px, 0, 0)`,transition:"none"})}function Zn(ie,fe){const Re=ot(_)?window.innerHeight:window.innerWidth,q=fe?(Re-Ar)/Re:1,De=fe?-Ar:0;fe&&He(K.current,{transition:`transform ${Ae.DURATION}s cubic-bezier(${Ae.EASE.join(",")})`,transform:ot(_)?`scale(${q}) translate3d(0, ${De}px, 0)`:`scale(${q}) translate3d(${De}px, 0, 0)`})}return Q.createElement(C0,{modal:y,onOpenChange:ie=>{if(e!==void 0){t==null||t(ie);return}ie?(V(!0),j(ie)):Pe()},open:A},Q.createElement(rw.Provider,{value:{visible:H,activeSnapPoint:me,snapPoints:l,setActiveSnapPoint:Je,drawerRef:K,overlayRef:ee,scaleBackground:on,onOpenChange:t,onPress:G,setVisible:F,onRelease:St,onDrag:Le,dismissible:m,handleOnly:h,isOpen:A,isDragging:le,shouldFade:rn,closeDrawer:Pe,onNestedDrag:Xn,onNestedOpenChange:Yn,onNestedRelease:Zn,keyboardIsOpen:ye,openProp:e,modal:y,snapPointsOffset:Tt,direction:_}},n))}const _R=250,kR=120,dw=Q.forwardRef(function({preventCycle:e=!1,children:t,...n},r){const{visible:o,closeDrawer:i,isDragging:l,snapPoints:a,activeSnapPoint:f,setActiveSnapPoint:u,dismissible:p,handleOnly:m,onPress:h,onDrag:x}=ya(),C=Q.useRef(null),E=Q.useRef(!1);function R(){if(E.current){b();return}window.setTimeout(()=>{y()},kR)}function y(){if(l||e||E.current){b();return}if(b(),(!a||a.length===0)&&p){i();return}if(f===a[a.length-1]&&p){i();return}const P=a.findIndex(T=>T===f);if(P===-1)return;const D=a[P+1];u(D)}function g(){C.current=window.setTimeout(()=>{E.current=!0},_R)}function b(){window.clearTimeout(C.current),E.current=!1}return Q.createElement("div",{onClick:R,onDoubleClick:()=>{E.current=!0,i()},onPointerCancel:b,onPointerDown:_=>{m&&h(_),g()},onPointerMove:_=>{m&&x(_)},ref:r,"vaul-drawer-visible":o?"true":"false","vaul-handle":"","aria-hidden":"true",...n},Q.createElement("span",{"vaul-handle-hitarea":"","aria-hidden":"true"},t))});dw.displayName="Drawer.Handle";const pw=Q.forwardRef(function({children:e,...t},n){const{overlayRef:r,snapPoints:o,onRelease:i,shouldFade:l,isOpen:a,visible:f}=ya(),u=sw(n,r),p=o&&o.length>0;return Q.createElement(R0,{onMouseUp:i,ref:u,"vaul-drawer-visible":f?"true":"false","vaul-overlay":"","vaul-snap-points":a&&p?"true":"false","vaul-snap-points-overlay":a&&l?"true":"false",...t})});pw.displayName="Drawer.Overlay";const mw=Q.forwardRef(function({onOpenAutoFocus:e,onPointerDownOutside:t,onAnimationEnd:n,style:r,...o},i){const{drawerRef:l,onPress:a,onRelease:f,onDrag:u,dismissible:p,keyboardIsOpen:m,snapPointsOffset:h,visible:x,closeDrawer:C,modal:E,openProp:R,onOpenChange:y,setVisible:g,handleOnly:b,direction:_}=ya(),P=sw(i,l),D=Q.useRef(null),T=Q.useRef(!1),A=(j,I,V=0)=>{if(T.current)return!0;const H=Math.abs(j.y),F=Math.abs(j.x),W=F>H,Z=["bottom","right"].includes(I)?1:-1;if(I==="left"||I==="right"){if(!(j.x*Z<0)&&F>=0&&F<=V)return W}else if(!(j.y*Z<0)&&H>=0&&H<=V)return!W;return T.current=!0,!0};return Q.useEffect(()=>{g(!0)},[]),Q.createElement(P0,{"vaul-drawer":"","vaul-drawer-direction":_,"vaul-drawer-visible":x?"true":"false",...o,ref:P,style:h&&h.length>0?{"--snap-point-height":`${h[0]}px`,...r}:r,onOpenAutoFocus:j=>{if(e)e(j);else{var I;j.preventDefault(),(I=l.current)==null||I.focus()}},onPointerDown:j=>{b||(o.onPointerDown==null||o.onPointerDown.call(o,j),D.current={x:j.clientX,y:j.clientY},a(j))},onPointerDownOutside:j=>{if(t==null||t(j),!E||j.defaultPrevented){j.preventDefault();return}m.current&&(m.current=!1),j.preventDefault(),y==null||y(!1),!(!p||R!==void 0)&&C()},onFocusOutside:j=>{if(!E){j.preventDefault();return}},onEscapeKeyDown:j=>{if(!E){j.preventDefault();return}},onPointerMove:j=>{if(b||(o.onPointerMove==null||o.onPointerMove.call(o,j),!D.current))return;const I=j.clientY-D.current.y,V=j.clientX-D.current.x,H=j.pointerType==="touch"?10:2;A({x:V,y:I},_,H)?u(j):(Math.abs(V)>H||Math.abs(I)>H)&&(D.current=null)},onPointerUp:j=>{o.onPointerUp==null||o.onPointerUp.call(o,j),D.current=null,T.current=!1,f(j)}})});mw.displayName="Drawer.Content";function RR({onDrag:e,onOpenChange:t,...n}){const{onNestedDrag:r,onNestedOpenChange:o,onNestedRelease:i}=ya();if(!r)throw new Error("Drawer.NestedRoot must be placed in another drawer");return Q.createElement(fw,{nested:!0,onClose:()=>{o(!1)},onDrag:(l,a)=>{r(l,a),e==null||e(l,a)},onOpenChange:l=>{l&&o(l),t==null||t(l)},onRelease:i,...n})}const gn={Root:fw,NestedRoot:RR,Content:mw,Handle:dw,Overlay:pw,Trigger:_0,Portal:k0,Close:Yf,Title:T0,Description:N0},hw=({shouldScaleBackground:e=!0,...t})=>w.jsx(gn.Root,{shouldScaleBackground:e,...t});hw.displayName="Drawer";const PR=gn.Trigger,TR=gn.Portal,NR=gn.Close,vw=v.forwardRef(({className:e,...t},n)=>w.jsx(gn.Overlay,{ref:n,className:Se("fixed inset-0 z-50 bg-black/80",e),...t}));vw.displayName=gn.Overlay.displayName;const gw=v.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(TR,{children:[w.jsx(vw,{}),w.jsxs(gn.Content,{ref:r,className:Se("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...n,children:[w.jsx("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),t]})]}));gw.displayName="DrawerContent";const yw=({className:e,...t})=>w.jsx("div",{className:Se("grid gap-1.5 p-4 text-center sm:text-left",e),...t});yw.displayName="DrawerHeader";const ww=({className:e,...t})=>w.jsx("div",{className:Se("mt-auto flex flex-col gap-2 p-4",e),...t});ww.displayName="DrawerFooter";const xw=v.forwardRef(({className:e,...t},n)=>w.jsx(gn.Title,{ref:n,className:Se("text-lg font-semibold leading-none tracking-tight",e),...t}));xw.displayName=gn.Title.displayName;const Sw=v.forwardRef(({className:e,...t},n)=>w.jsx(gn.Description,{ref:n,className:Se("text-sm text-muted-foreground",e),...t}));Sw.displayName=gn.Description.displayName;function AR(){const{setRowPerPageOrAuto:e,downloadDatabase:t,exportAllTablesAsCSV:n,exportTableAsCSV:r,selectedTable:o,setIsCustomQuery:i}=Jr(),[l,a]=v.useState(30),[f,u]=v.useState(!1);v.useEffect(()=>{f&&a(30)},[f]);const p=x=>{const C=Number(x.target.value);isNaN(C)||(a(C),u(!1))},m=()=>{u(x=>!x)},h=()=>{i(!1),e(f?"auto":l)};return w.jsxs(hw,{children:[w.jsx(PR,{asChild:!0,children:w.jsx(Dt,{variant:"outline",children:w.jsx(hb,{className:"h-5 w-5"})})}),w.jsx(gw,{children:w.jsxs("div",{className:"mx-auto w-full max-w-md",children:[w.jsxs(yw,{children:[w.jsx(xw,{children:"Settings"}),w.jsx(Sw,{children:"Personalize your site experience here."})]}),w.jsxs("div",{className:"p-4 pb-0 flex flex-col gap-4",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Rows Per Page"}),w.jsxs("div",{className:"border rounded p-2 flex gap-1 justify-center items-center",children:[w.jsx(Rf,{min:"3",max:"500",value:l,onChange:p,disabled:f,placeholder:"30",type:"number",name:"rowsPerPage"}),w.jsx("span",{className:"text-sm text-muted-foreground h-full text-center",children:"OR"}),w.jsx(Dt,{onClick:m,variant:"outline",className:f?"border border-primary":void 0,children:"Auto calculate"})]}),w.jsx(Dt,{className:"w-full mt-2",onClick:h,variant:"outline",children:w.jsx("span",{children:"Save"})})]}),w.jsxs("div",{children:[w.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Exports Settings"}),w.jsxs("div",{className:"border rounded p-2 flex flex-col gap-1",children:[w.jsx(Dt,{variant:"outline",onClick:t,children:w.jsx("span",{className:"ml-2",children:"Export as SQLite"})}),w.jsx(Dt,{variant:"outline",onClick:()=>r(parseInt(o)),children:w.jsx("span",{className:"ml-2",children:"Export selected table as CSV"})}),w.jsx(Dt,{variant:"outline",onClick:n,children:w.jsx("span",{className:"ml-2",children:"Export all tables as CSV"})})]})]})]}),w.jsx(ww,{children:w.jsx(NR,{asChild:!0,children:w.jsx(Dt,{variant:"outline",children:"Close"})})})]})})]})}function DR(){const{db:e}=Jr();return w.jsxs("footer",{className:"flex items-center justify-between my-1 p-4 border rounded",children:[w.jsxs("div",{children:[w.jsx("p",{className:"hidden sm:block text-xs",children:"No file will be uploaded to server. using JavaScript, sql.js"}),w.jsx("p",{className:"block sm:hidden text-xs",children:"No file uploads to server."}),w.jsxs("a",{href:"https://github.com/vwh/sqlite-viewer",target:"_blank",className:"text-sm text-link hover:underline flex gap-1 items-center",title:"Star on GitHub",children:[w.jsx(ab,{className:"h-4 w-4"}),w.jsx("span",{children:"Star us on GitHub"})]})]}),w.jsxs("div",{className:"flex gap-1",children:[w.jsx(lR,{}),e&&w.jsx(AR,{})]})]})}vu.createRoot(document.getElementById("root")).render(w.jsx(Q.StrictMode,{children:w.jsxs("main",{className:"container mx-auto p-4",children:[w.jsx(iR,{}),w.jsx(DR,{})]})})); diff --git a/index.html b/index.html index 09078a5..e448a2b 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@ font-size: 2rem; } - + diff --git a/sw.js b/sw.js index 2768787..091d475 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let e,i={};const n=(n,s)=>(n=new URL(n+".js",s).href,i[n]||new Promise((i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()})).then((()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(s,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(i[t])return;let o={};const d=e=>n(e,t),c={module:{uri:t},exports:o,require:d};i[t]=Promise.all(s.map((e=>c[e]||d(e)))).then((e=>(r(...e),o)))}}define(["./workbox-3e911b1d"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-BxjtieRf.js",revision:null},{url:"assets/index-WPbId_Ps.css",revision:null},{url:"index.html",revision:"7dd01578c9ec5c28570cb6d4507c0342"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"icon512_maskable.png",revision:"3d290f6a5aaab33e10193a7ae6363fdc"},{url:"icon512_rounded.png",revision:"b106306874aab167a6e6fca03440dcfb"},{url:"manifest.webmanifest",revision:"ce6def5658bea734d75f655c3d98523f"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))})); +if(!self.define){let e,i={};const n=(n,s)=>(n=new URL(n+".js",s).href,i[n]||new Promise((i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()})).then((()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(s,r)=>{const o=e||("document"in self?document.currentScript.src:"")||location.href;if(i[o])return;let t={};const d=e=>n(e,o),c={module:{uri:o},exports:t,require:d};i[o]=Promise.all(s.map((e=>c[e]||d(e)))).then((e=>(r(...e),t)))}}define(["./workbox-3e911b1d"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-B2akmyp4.js",revision:null},{url:"assets/index-WPbId_Ps.css",revision:null},{url:"index.html",revision:"13e34c08ee5b1c0578cd335a17494316"},{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"icon512_maskable.png",revision:"3d290f6a5aaab33e10193a7ae6363fdc"},{url:"icon512_rounded.png",revision:"b106306874aab167a6e6fca03440dcfb"},{url:"manifest.webmanifest",revision:"ce6def5658bea734d75f655c3d98523f"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));