var Mj=Object.defineProperty;var ng=e=>{throw TypeError(e)};var Lj=(e,t,r)=>t in e?Mj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Kr=(e,t,r)=>Lj(e,typeof t!="symbol"?t+"":t,r),kd=(e,t,r)=>t.has(e)||ng("Cannot "+r);var D=(e,t,r)=>(kd(e,t,"read from private field"),r?r.call(e):t.get(e)),we=(e,t,r)=>t.has(e)?ng("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),oe=(e,t,r,n)=>(kd(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),lt=(e,t,r)=>(kd(e,t,"access private method"),r);var Sl=(e,t,r,n)=>({set _(s){oe(e,t,s,r)},get _(){return D(e,t,n)}});function $j(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const s in n)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(n,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>n[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(s){if(s.ep)return;s.ep=!0;const a=r(s);fetch(s.href,a)}})();function rl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nx={exports:{}},wu={},Ex={exports:{}},me={};/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var nl=Symbol.for("react.element"),zj=Symbol.for("react.portal"),Uj=Symbol.for("react.fragment"),Fj=Symbol.for("react.strict_mode"),Bj=Symbol.for("react.profiler"),Hj=Symbol.for("react.provider"),Vj=Symbol.for("react.context"),Kj=Symbol.for("react.forward_ref"),qj=Symbol.for("react.suspense"),Wj=Symbol.for("react.memo"),Gj=Symbol.for("react.lazy"),sg=Symbol.iterator;function Yj(e){return e===null||typeof e!="object"?null:(e=sg&&e[sg]||e["@@iterator"],typeof e=="function"?e:null)}var Cx={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Tx=Object.assign,Rx={};function wi(e,t,r){this.props=e,this.context=t,this.refs=Rx,this.updater=r||Cx}wi.prototype.isReactComponent={};wi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};wi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ax(){}Ax.prototype=wi.prototype;function cp(e,t,r){this.props=e,this.context=t,this.refs=Rx,this.updater=r||Cx}var up=cp.prototype=new Ax;up.constructor=cp;Tx(up,wi.prototype);up.isPureReactComponent=!0;var ag=Array.isArray,Px=Object.prototype.hasOwnProperty,dp={current:null},Ox={key:!0,ref:!0,__self:!0,__source:!0};function Ix(e,t,r){var n,s={},a=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)Px.call(t,n)&&!Ox.hasOwnProperty(n)&&(s[n]=t[n]);var l=arguments.length-2;if(l===1)s.children=r;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];s.children=c}if(e&&e.defaultProps)for(n in l=e.defaultProps,l)s[n]===void 0&&(s[n]=l[n]);return{$$typeof:nl,type:e,key:a,ref:o,props:s,_owner:dp.current}}function Jj(e,t){return{$$typeof:nl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function hp(e){return typeof e=="object"&&e!==null&&e.$$typeof===nl}function Zj(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(r){return t[r]})}var ig=/\/+/g;function jd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Zj(""+e.key):t.toString(36)}function lc(e,t,r,n,s){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case nl:case zj:o=!0}}if(o)return o=e,s=s(o),e=n===""?"."+jd(o,0):n,ag(s)?(r="",e!=null&&(r=e.replace(ig,"$&/")+"/"),lc(s,t,r,"",function(u){return u})):s!=null&&(hp(s)&&(s=Jj(s,r+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(ig,"$&/")+"/")+e)),t.push(s)),1;if(o=0,n=n===""?".":n+":",ag(e))for(var l=0;l<e.length;l++){a=e[l];var c=n+jd(a,l);o+=lc(a,t,r,c,s)}else if(c=Yj(e),typeof c=="function")for(e=c.call(e),l=0;!(a=e.next()).done;)a=a.value,c=n+jd(a,l++),o+=lc(a,t,r,c,s);else if(a==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return o}function Nl(e,t,r){if(e==null)return e;var n=[],s=0;return lc(e,n,"","",function(a){return t.call(r,a,s++)}),n}function Qj(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(r){(e._status===0||e._status===-1)&&(e._status=1,e._result=r)},function(r){(e._status===0||e._status===-1)&&(e._status=2,e._result=r)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var vt={current:null},cc={transition:null},Xj={ReactCurrentDispatcher:vt,ReactCurrentBatchConfig:cc,ReactCurrentOwner:dp};function Dx(){throw Error("act(...) is not supported in production builds of React.")}me.Children={map:Nl,forEach:function(e,t,r){Nl(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return Nl(e,function(){t++}),t},toArray:function(e){return Nl(e,function(t){return t})||[]},only:function(e){if(!hp(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};me.Component=wi;me.Fragment=Uj;me.Profiler=Bj;me.PureComponent=cp;me.StrictMode=Fj;me.Suspense=qj;me.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Xj;me.act=Dx;me.cloneElement=function(e,t,r){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n=Tx({},e.props),s=e.key,a=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(a=t.ref,o=dp.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Px.call(t,c)&&!Ox.hasOwnProperty(c)&&(n[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)n.children=r;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];n.children=l}return{$$typeof:nl,type:e.type,key:s,ref:a,props:n,_owner:o}};me.createContext=function(e){return e={$$typeof:Vj,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Hj,_context:e},e.Consumer=e};me.createElement=Ix;me.createFactory=function(e){var t=Ix.bind(null,e);return t.type=e,t};me.createRef=function(){return{current:null}};me.forwardRef=function(e){return{$$typeof:Kj,render:e}};me.isValidElement=hp;me.lazy=function(e){return{$$typeof:Gj,_payload:{_status:-1,_result:e},_init:Qj}};me.memo=function(e,t){return{$$typeof:Wj,type:e,compare:t===void 0?null:t}};me.startTransition=function(e){var t=cc.transition;cc.transition={};try{e()}finally{cc.transition=t}};me.unstable_act=Dx;me.useCallback=function(e,t){return vt.current.useCallback(e,t)};me.useContext=function(e){return vt.current.useContext(e)};me.useDebugValue=function(){};me.useDeferredValue=function(e){return vt.current.useDeferredValue(e)};me.useEffect=function(e,t){return vt.current.useEffect(e,t)};me.useId=function(){return vt.current.useId()};me.useImperativeHandle=function(e,t,r){return vt.current.useImperativeHandle(e,t,r)};me.useInsertionEffect=function(e,t){return vt.current.useInsertionEffect(e,t)};me.useLayoutEffect=function(e,t){return vt.current.useLayoutEffect(e,t)};me.useMemo=function(e,t){return vt.current.useMemo(e,t)};me.useReducer=function(e,t,r){return vt.current.useReducer(e,t,r)};me.useRef=function(e){return vt.current.useRef(e)};me.useState=function(e){return vt.current.useState(e)};me.useSyncExternalStore=function(e,t,r){return vt.current.useSyncExternalStore(e,t,r)};me.useTransition=function(){return vt.current.useTransition()};me.version="18.3.1";Ex.exports=me;var m=Ex.exports;const B=rl(m),fp=$j({__proto__:null,default:B},[m]);/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var eS=m,tS=Symbol.for("react.element"),rS=Symbol.for("react.fragment"),nS=Object.prototype.hasOwnProperty,sS=eS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,aS={key:!0,ref:!0,__self:!0,__source:!0};function Mx(e,t,r){var n,s={},a=null,o=null;r!==void 0&&(a=""+r),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(o=t.ref);for(n in t)nS.call(t,n)&&!aS.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)s[n]===void 0&&(s[n]=t[n]);return{$$typeof:tS,type:e,key:a,ref:o,props:s,_owner:sS.current}}wu.Fragment=rS;wu.jsx=Mx;wu.jsxs=Mx;Nx.exports=wu;var i=Nx.exports,Lx={exports:{}},$t={},$x={exports:{}},zx={};/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/(function(e){function t(E,T){var L=E.length;E.push(T);e:for(;0<L;){var q=L-1>>>1,K=E[q];if(0<s(K,T))E[q]=T,E[L]=K,L=q;else break e}}function r(E){return E.length===0?null:E[0]}function n(E){if(E.length===0)return null;var T=E[0],L=E.pop();if(L!==T){E[0]=L;e:for(var q=0,K=E.length,ee=K>>>1;q<ee;){var le=2*(q+1)-1,Oe=E[le],ze=le+1,fe=E[ze];if(0>s(Oe,L))ze<K&&0>s(fe,Oe)?(E[q]=fe,E[ze]=L,q=ze):(E[q]=Oe,E[le]=L,q=le);else if(ze<K&&0>s(fe,L))E[q]=fe,E[ze]=L,q=ze;else break e}}return T}function s(E,T){var L=E.sortIndex-T.sortIndex;return L!==0?L:E.id-T.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,h=null,f=3,p=!1,b=!1,g=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(E){for(var T=r(u);T!==null;){if(T.callback===null)n(u);else if(T.startTime<=E)n(u),T.sortIndex=T.expirationTime,t(c,T);else break;T=r(u)}}function _(E){if(g=!1,x(E),!b)if(r(c)!==null)b=!0,I(j);else{var T=r(u);T!==null&&z(_,T.startTime-E)}}function j(E,T){b=!1,g&&(g=!1,y(k),k=-1),p=!0;var L=f;try{for(x(T),h=r(c);h!==null&&(!(h.expirationTime>T)||E&&!$());){var q=h.callback;if(typeof q=="function"){h.callback=null,f=h.priorityLevel;var K=q(h.expirationTime<=T);T=e.unstable_now(),typeof K=="function"?h.callback=K:h===r(c)&&n(c),x(T)}else n(c);h=r(c)}if(h!==null)var ee=!0;else{var le=r(u);le!==null&&z(_,le.startTime-T),ee=!1}return ee}finally{h=null,f=L,p=!1}}var S=!1,C=null,k=-1,A=5,P=-1;function $(){return!(e.unstable_now()-P<A)}function R(){if(C!==null){var E=e.unstable_now();P=E;var T=!0;try{T=C(!0,E)}finally{T?H():(S=!1,C=null)}}else S=!1}var H;if(typeof v=="function")H=function(){v(R)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,M=N.port2;N.port1.onmessage=R,H=function(){M.postMessage(null)}}else H=function(){w(R,0)};function I(E){C=E,S||(S=!0,H())}function z(E,T){k=w(function(){E(e.unstable_now())},T)}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(E){E.callback=null},e.unstable_continueExecution=function(){b||p||(b=!0,I(j))},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return r(c)},e.unstable_next=function(E){switch(f){case 1:case 2:case 3:var T=3;break;default:T=f}var L=f;f=T;try{return E()}finally{f=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(E,T){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var L=f;f=E;try{return T()}finally{f=L}},e.unstable_scheduleCallback=function(E,T,L){var q=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?q+L:q):L=q,E){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=L+K,E={id:d++,callback:T,priorityLevel:E,startTime:L,expirationTime:K,sortIndex:-1},L>q?(E.sortIndex=L,t(u,E),r(c)===null&&E===r(u)&&(g?(y(k),k=-1):g=!0,z(_,L-q))):(E.sortIndex=K,t(c,E),b||p||(b=!0,I(j))),E},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(E){var T=f;return function(){var L=f;f=T;try{return E.apply(this,arguments)}finally{f=L}}}})(zx);$x.exports=zx;var iS=$x.exports;/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var oS=m,Dt=iS;function F(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Ux=new Set,vo={};function Vs(e,t){si(e,t),si(e+"Capture",t)}function si(e,t){for(vo[e]=t,e=0;e<t.length;e++)Ux.add(t[e])}var nn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nh=Object.prototype.hasOwnProperty,lS=/^[: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]*$/,og={},lg={};function cS(e){return Nh.call(lg,e)?!0:Nh.call(og,e)?!1:lS.test(e)?lg[e]=!0:(og[e]=!0,!1)}function uS(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function dS(e,t,r,n){if(t===null||typeof t>"u"||uS(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function xt(e,t,r,n,s,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=s,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var ot={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ot[e]=new xt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ot[t]=new xt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ot[e]=new xt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ot[e]=new xt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ot[e]=new xt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ot[e]=new xt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ot[e]=new xt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ot[e]=new xt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ot[e]=new xt(e,5,!1,e.toLowerCase(),null,!1,!1)});var pp=/[\-:]([a-z])/g;function mp(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(pp,mp);ot[t]=new xt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(pp,mp);ot[t]=new xt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(pp,mp);ot[t]=new xt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ot[e]=new xt(e,1,!1,e.toLowerCase(),null,!1,!1)});ot.xlinkHref=new xt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ot[e]=new xt(e,1,!1,e.toLowerCase(),null,!0,!0)});function gp(e,t,r,n){var s=ot.hasOwnProperty(t)?ot[t]:null;(s!==null?s.type!==0:n||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(dS(t,r,s,n)&&(r=null),n||s===null?cS(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):s.mustUseProperty?e[s.propertyName]=r===null?s.type===3?!1:"":r:(t=s.attributeName,n=s.attributeNamespace,r===null?e.removeAttribute(t):(s=s.type,r=s===3||s===4&&r===!0?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}var hn=oS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,El=Symbol.for("react.element"),_a=Symbol.for("react.portal"),ka=Symbol.for("react.fragment"),yp=Symbol.for("react.strict_mode"),Eh=Symbol.for("react.profiler"),Fx=Symbol.for("react.provider"),Bx=Symbol.for("react.context"),vp=Symbol.for("react.forward_ref"),Ch=Symbol.for("react.suspense"),Th=Symbol.for("react.suspense_list"),xp=Symbol.for("react.memo"),Cn=Symbol.for("react.lazy"),Hx=Symbol.for("react.offscreen"),cg=Symbol.iterator;function Ii(e){return e===null||typeof e!="object"?null:(e=cg&&e[cg]||e["@@iterator"],typeof e=="function"?e:null)}var Le=Object.assign,Sd;function Gi(e){if(Sd===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);Sd=t&&t[1]||""}return`
`+Sd+e}var Nd=!1;function Ed(e,t){if(!e||Nd)return"";Nd=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var s=u.stack.split(`
`),a=n.stack.split(`
`),o=s.length-1,l=a.length-1;1<=o&&0<=l&&s[o]!==a[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==a[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==a[l]){var c=`
`+s[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Nd=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Gi(e):""}function hS(e){switch(e.tag){case 5:return Gi(e.type);case 16:return Gi("Lazy");case 13:return Gi("Suspense");case 19:return Gi("SuspenseList");case 0:case 2:case 15:return e=Ed(e.type,!1),e;case 11:return e=Ed(e.type.render,!1),e;case 1:return e=Ed(e.type,!0),e;default:return""}}function Rh(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ka:return"Fragment";case _a:return"Portal";case Eh:return"Profiler";case yp:return"StrictMode";case Ch:return"Suspense";case Th:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bx:return(e.displayName||"Context")+".Consumer";case Fx:return(e._context.displayName||"Context")+".Provider";case vp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case xp:return t=e.displayName||null,t!==null?t:Rh(e.type)||"Memo";case Cn:t=e._payload,e=e._init;try{return Rh(e(t))}catch{}}return null}function fS(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Rh(t);case 8:return t===yp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function rs(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vx(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function pS(e){var t=Vx(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var s=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){n=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Cl(e){e._valueTracker||(e._valueTracker=pS(e))}function Kx(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Vx(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Cc(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ah(e,t){var r=t.checked;return Le({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function ug(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=rs(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function qx(e,t){t=t.checked,t!=null&&gp(e,"checked",t,!1)}function Ph(e,t){qx(e,t);var r=rs(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Oh(e,t.type,r):t.hasOwnProperty("defaultValue")&&Oh(e,t.type,rs(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function dg(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function Oh(e,t,r){(t!=="number"||Cc(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Yi=Array.isArray;function Ma(e,t,r,n){if(e=e.options,t){t={};for(var s=0;s<r.length;s++)t["$"+r[s]]=!0;for(r=0;r<e.length;r++)s=t.hasOwnProperty("$"+e[r].value),e[r].selected!==s&&(e[r].selected=s),s&&n&&(e[r].defaultSelected=!0)}else{for(r=""+rs(r),t=null,s=0;s<e.length;s++){if(e[s].value===r){e[s].selected=!0,n&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Ih(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(F(91));return Le({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function hg(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(F(92));if(Yi(r)){if(1<r.length)throw Error(F(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:rs(r)}}function Wx(e,t){var r=rs(t.value),n=rs(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),n!=null&&(e.defaultValue=""+n)}function fg(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Gx(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Dh(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Gx(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Tl,Yx=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,n,s){MSApp.execUnsafeLocalFunction(function(){return e(t,r,n,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Tl=Tl||document.createElement("div"),Tl.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Tl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xo(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var no={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},mS=["Webkit","ms","Moz","O"];Object.keys(no).forEach(function(e){mS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),no[t]=no[e]})});function Jx(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||no.hasOwnProperty(e)&&no[e]?(""+t).trim():t+"px"}function Zx(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,s=Jx(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,s):e[r]=s}}var gS=Le({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Mh(e,t){if(t){if(gS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(F(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(F(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(F(61))}if(t.style!=null&&typeof t.style!="object")throw Error(F(62))}}function Lh(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var $h=null;function bp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var zh=null,La=null,$a=null;function pg(e){if(e=il(e)){if(typeof zh!="function")throw Error(F(280));var t=e.stateNode;t&&(t=Nu(t),zh(e.stateNode,e.type,t))}}function Qx(e){La?$a?$a.push(e):$a=[e]:La=e}function Xx(){if(La){var e=La,t=$a;if($a=La=null,pg(e),t)for(e=0;e<t.length;e++)pg(t[e])}}function e0(e,t){return e(t)}function t0(){}var Cd=!1;function r0(e,t,r){if(Cd)return e(t,r);Cd=!0;try{return e0(e,t,r)}finally{Cd=!1,(La!==null||$a!==null)&&(t0(),Xx())}}function bo(e,t){var r=e.stateNode;if(r===null)return null;var n=Nu(r);if(n===null)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(e=e.type,n=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!n;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(F(231,t,typeof r));return r}var Uh=!1;if(nn)try{var Di={};Object.defineProperty(Di,"passive",{get:function(){Uh=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{Uh=!1}function yS(e,t,r,n,s,a,o,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(d){this.onError(d)}}var so=!1,Tc=null,Rc=!1,Fh=null,vS={onError:function(e){so=!0,Tc=e}};function xS(e,t,r,n,s,a,o,l,c){so=!1,Tc=null,yS.apply(vS,arguments)}function bS(e,t,r,n,s,a,o,l,c){if(xS.apply(this,arguments),so){if(so){var u=Tc;so=!1,Tc=null}else throw Error(F(198));Rc||(Rc=!0,Fh=u)}}function Ks(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function n0(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function mg(e){if(Ks(e)!==e)throw Error(F(188))}function wS(e){var t=e.alternate;if(!t){if(t=Ks(e),t===null)throw Error(F(188));return t!==e?null:e}for(var r=e,n=t;;){var s=r.return;if(s===null)break;var a=s.alternate;if(a===null){if(n=s.return,n!==null){r=n;continue}break}if(s.child===a.child){for(a=s.child;a;){if(a===r)return mg(s),e;if(a===n)return mg(s),t;a=a.sibling}throw Error(F(188))}if(r.return!==n.return)r=s,n=a;else{for(var o=!1,l=s.child;l;){if(l===r){o=!0,r=s,n=a;break}if(l===n){o=!0,n=s,r=a;break}l=l.sibling}if(!o){for(l=a.child;l;){if(l===r){o=!0,r=a,n=s;break}if(l===n){o=!0,n=a,r=s;break}l=l.sibling}if(!o)throw Error(F(189))}}if(r.alternate!==n)throw Error(F(190))}if(r.tag!==3)throw Error(F(188));return r.stateNode.current===r?e:t}function s0(e){return e=wS(e),e!==null?a0(e):null}function a0(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=a0(e);if(t!==null)return t;e=e.sibling}return null}var i0=Dt.unstable_scheduleCallback,gg=Dt.unstable_cancelCallback,_S=Dt.unstable_shouldYield,kS=Dt.unstable_requestPaint,Ve=Dt.unstable_now,jS=Dt.unstable_getCurrentPriorityLevel,wp=Dt.unstable_ImmediatePriority,o0=Dt.unstable_UserBlockingPriority,Ac=Dt.unstable_NormalPriority,SS=Dt.unstable_LowPriority,l0=Dt.unstable_IdlePriority,_u=null,Ir=null;function NS(e){if(Ir&&typeof Ir.onCommitFiberRoot=="function")try{Ir.onCommitFiberRoot(_u,e,void 0,(e.current.flags&128)===128)}catch{}}var pr=Math.clz32?Math.clz32:TS,ES=Math.log,CS=Math.LN2;function TS(e){return e>>>=0,e===0?32:31-(ES(e)/CS|0)|0}var Rl=64,Al=4194304;function Ji(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Pc(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,s=e.suspendedLanes,a=e.pingedLanes,o=r&268435455;if(o!==0){var l=o&~s;l!==0?n=Ji(l):(a&=o,a!==0&&(n=Ji(a)))}else o=r&~s,o!==0?n=Ji(o):a!==0&&(n=Ji(a));if(n===0)return 0;if(t!==0&&t!==n&&!(t&s)&&(s=n&-n,a=t&-t,s>=a||s===16&&(a&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0<t;)r=31-pr(t),s=1<<r,n|=e[r],t&=~s;return n}function RS(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function AS(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,s=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-pr(a),l=1<<o,c=s[o];c===-1?(!(l&r)||l&n)&&(s[o]=RS(l,t)):c<=t&&(e.expiredLanes|=l),a&=~l}}function Bh(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function c0(){var e=Rl;return Rl<<=1,!(Rl&4194240)&&(Rl=64),e}function Td(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function sl(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-pr(t),e[t]=r}function PS(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var s=31-pr(r),a=1<<s;t[s]=0,n[s]=-1,e[s]=-1,r&=~a}}function _p(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-pr(r),s=1<<n;s&t|e[n]&t&&(e[n]|=t),r&=~s}}var je=0;function u0(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var d0,kp,h0,f0,p0,Hh=!1,Pl=[],qn=null,Wn=null,Gn=null,wo=new Map,_o=new Map,An=[],OS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function yg(e,t){switch(e){case"focusin":case"focusout":qn=null;break;case"dragenter":case"dragleave":Wn=null;break;case"mouseover":case"mouseout":Gn=null;break;case"pointerover":case"pointerout":wo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_o.delete(t.pointerId)}}function Mi(e,t,r,n,s,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:a,targetContainers:[s]},t!==null&&(t=il(t),t!==null&&kp(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function IS(e,t,r,n,s){switch(t){case"focusin":return qn=Mi(qn,e,t,r,n,s),!0;case"dragenter":return Wn=Mi(Wn,e,t,r,n,s),!0;case"mouseover":return Gn=Mi(Gn,e,t,r,n,s),!0;case"pointerover":var a=s.pointerId;return wo.set(a,Mi(wo.get(a)||null,e,t,r,n,s)),!0;case"gotpointercapture":return a=s.pointerId,_o.set(a,Mi(_o.get(a)||null,e,t,r,n,s)),!0}return!1}function m0(e){var t=ws(e.target);if(t!==null){var r=Ks(t);if(r!==null){if(t=r.tag,t===13){if(t=n0(r),t!==null){e.blockedOn=t,p0(e.priority,function(){h0(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function uc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Vh(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var n=new r.constructor(r.type,r);$h=n,r.target.dispatchEvent(n),$h=null}else return t=il(r),t!==null&&kp(t),e.blockedOn=r,!1;t.shift()}return!0}function vg(e,t,r){uc(e)&&r.delete(t)}function DS(){Hh=!1,qn!==null&&uc(qn)&&(qn=null),Wn!==null&&uc(Wn)&&(Wn=null),Gn!==null&&uc(Gn)&&(Gn=null),wo.forEach(vg),_o.forEach(vg)}function Li(e,t){e.blockedOn===t&&(e.blockedOn=null,Hh||(Hh=!0,Dt.unstable_scheduleCallback(Dt.unstable_NormalPriority,DS)))}function ko(e){function t(s){return Li(s,e)}if(0<Pl.length){Li(Pl[0],e);for(var r=1;r<Pl.length;r++){var n=Pl[r];n.blockedOn===e&&(n.blockedOn=null)}}for(qn!==null&&Li(qn,e),Wn!==null&&Li(Wn,e),Gn!==null&&Li(Gn,e),wo.forEach(t),_o.forEach(t),r=0;r<An.length;r++)n=An[r],n.blockedOn===e&&(n.blockedOn=null);for(;0<An.length&&(r=An[0],r.blockedOn===null);)m0(r),r.blockedOn===null&&An.shift()}var za=hn.ReactCurrentBatchConfig,Oc=!0;function MS(e,t,r,n){var s=je,a=za.transition;za.transition=null;try{je=1,jp(e,t,r,n)}finally{je=s,za.transition=a}}function LS(e,t,r,n){var s=je,a=za.transition;za.transition=null;try{je=4,jp(e,t,r,n)}finally{je=s,za.transition=a}}function jp(e,t,r,n){if(Oc){var s=Vh(e,t,r,n);if(s===null)zd(e,t,n,Ic,r),yg(e,n);else if(IS(s,e,t,r,n))n.stopPropagation();else if(yg(e,n),t&4&&-1<OS.indexOf(e)){for(;s!==null;){var a=il(s);if(a!==null&&d0(a),a=Vh(e,t,r,n),a===null&&zd(e,t,n,Ic,r),a===s)break;s=a}s!==null&&n.stopPropagation()}else zd(e,t,n,null,r)}}var Ic=null;function Vh(e,t,r,n){if(Ic=null,e=bp(n),e=ws(e),e!==null)if(t=Ks(e),t===null)e=null;else if(r=t.tag,r===13){if(e=n0(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Ic=e,null}function g0(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(jS()){case wp:return 1;case o0:return 4;case Ac:case SS:return 16;case l0:return 536870912;default:return 16}default:return 16}}var Un=null,Sp=null,dc=null;function y0(){if(dc)return dc;var e,t=Sp,r=t.length,n,s="value"in Un?Un.value:Un.textContent,a=s.length;for(e=0;e<r&&t[e]===s[e];e++);var o=r-e;for(n=1;n<=o&&t[r-n]===s[a-n];n++);return dc=s.slice(e,1<n?1-n:void 0)}function hc(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ol(){return!0}function xg(){return!1}function zt(e){function t(r,n,s,a,o){this._reactName=r,this._targetInst=s,this.type=n,this.nativeEvent=a,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(r=e[l],this[l]=r?r(a):a[l]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?Ol:xg,this.isPropagationStopped=xg,this}return Le(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ol)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ol)},persist:function(){},isPersistent:Ol}),t}var _i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Np=zt(_i),al=Le({},_i,{view:0,detail:0}),$S=zt(al),Rd,Ad,$i,ku=Le({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ep,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==$i&&($i&&e.type==="mousemove"?(Rd=e.screenX-$i.screenX,Ad=e.screenY-$i.screenY):Ad=Rd=0,$i=e),Rd)},movementY:function(e){return"movementY"in e?e.movementY:Ad}}),bg=zt(ku),zS=Le({},ku,{dataTransfer:0}),US=zt(zS),FS=Le({},al,{relatedTarget:0}),Pd=zt(FS),BS=Le({},_i,{animationName:0,elapsedTime:0,pseudoElement:0}),HS=zt(BS),VS=Le({},_i,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),KS=zt(VS),qS=Le({},_i,{data:0}),wg=zt(qS),WS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},GS={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"},YS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function JS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=YS[e])?!!t[e]:!1}function Ep(){return JS}var ZS=Le({},al,{key:function(e){if(e.key){var t=WS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=hc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?GS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ep,charCode:function(e){return e.type==="keypress"?hc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?hc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),QS=zt(ZS),XS=Le({},ku,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_g=zt(XS),eN=Le({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ep}),tN=zt(eN),rN=Le({},_i,{propertyName:0,elapsedTime:0,pseudoElement:0}),nN=zt(rN),sN=Le({},ku,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),aN=zt(sN),iN=[9,13,27,32],Cp=nn&&"CompositionEvent"in window,ao=null;nn&&"documentMode"in document&&(ao=document.documentMode);var oN=nn&&"TextEvent"in window&&!ao,v0=nn&&(!Cp||ao&&8<ao&&11>=ao),kg=" ",jg=!1;function x0(e,t){switch(e){case"keyup":return iN.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function b0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ja=!1;function lN(e,t){switch(e){case"compositionend":return b0(t);case"keypress":return t.which!==32?null:(jg=!0,kg);case"textInput":return e=t.data,e===kg&&jg?null:e;default:return null}}function cN(e,t){if(ja)return e==="compositionend"||!Cp&&x0(e,t)?(e=y0(),dc=Sp=Un=null,ja=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return v0&&t.locale!=="ko"?null:t.data;default:return null}}var uN={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 Sg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!uN[e.type]:t==="textarea"}function w0(e,t,r,n){Qx(n),t=Dc(t,"onChange"),0<t.length&&(r=new Np("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var io=null,jo=null;function dN(e){P0(e,0)}function ju(e){var t=Ea(e);if(Kx(t))return e}function hN(e,t){if(e==="change")return t}var _0=!1;if(nn){var Od;if(nn){var Id="oninput"in document;if(!Id){var Ng=document.createElement("div");Ng.setAttribute("oninput","return;"),Id=typeof Ng.oninput=="function"}Od=Id}else Od=!1;_0=Od&&(!document.documentMode||9<document.documentMode)}function Eg(){io&&(io.detachEvent("onpropertychange",k0),jo=io=null)}function k0(e){if(e.propertyName==="value"&&ju(jo)){var t=[];w0(t,jo,e,bp(e)),r0(dN,t)}}function fN(e,t,r){e==="focusin"?(Eg(),io=t,jo=r,io.attachEvent("onpropertychange",k0)):e==="focusout"&&Eg()}function pN(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ju(jo)}function mN(e,t){if(e==="click")return ju(t)}function gN(e,t){if(e==="input"||e==="change")return ju(t)}function yN(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gr=typeof Object.is=="function"?Object.is:yN;function So(e,t){if(gr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var s=r[n];if(!Nh.call(t,s)||!gr(e[s],t[s]))return!1}return!0}function Cg(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tg(e,t){var r=Cg(e);e=0;for(var n;r;){if(r.nodeType===3){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Cg(r)}}function j0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?j0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function S0(){for(var e=window,t=Cc();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Cc(e.document)}return t}function Tp(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function vN(e){var t=S0(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&j0(r.ownerDocument.documentElement,r)){if(n!==null&&Tp(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=r.textContent.length,a=Math.min(n.start,s);n=n.end===void 0?a:Math.min(n.end,s),!e.extend&&a>n&&(s=n,n=a,a=s),s=Tg(r,a);var o=Tg(r,n);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),a>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var xN=nn&&"documentMode"in document&&11>=document.documentMode,Sa=null,Kh=null,oo=null,qh=!1;function Rg(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;qh||Sa==null||Sa!==Cc(n)||(n=Sa,"selectionStart"in n&&Tp(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),oo&&So(oo,n)||(oo=n,n=Dc(Kh,"onSelect"),0<n.length&&(t=new Np("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=Sa)))}function Il(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Na={animationend:Il("Animation","AnimationEnd"),animationiteration:Il("Animation","AnimationIteration"),animationstart:Il("Animation","AnimationStart"),transitionend:Il("Transition","TransitionEnd")},Dd={},N0={};nn&&(N0=document.createElement("div").style,"AnimationEvent"in window||(delete Na.animationend.animation,delete Na.animationiteration.animation,delete Na.animationstart.animation),"TransitionEvent"in window||delete Na.transitionend.transition);function Su(e){if(Dd[e])return Dd[e];if(!Na[e])return e;var t=Na[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in N0)return Dd[e]=t[r];return e}var E0=Su("animationend"),C0=Su("animationiteration"),T0=Su("animationstart"),R0=Su("transitionend"),A0=new Map,Ag="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ls(e,t){A0.set(e,t),Vs(t,[e])}for(var Md=0;Md<Ag.length;Md++){var Ld=Ag[Md],bN=Ld.toLowerCase(),wN=Ld[0].toUpperCase()+Ld.slice(1);ls(bN,"on"+wN)}ls(E0,"onAnimationEnd");ls(C0,"onAnimationIteration");ls(T0,"onAnimationStart");ls("dblclick","onDoubleClick");ls("focusin","onFocus");ls("focusout","onBlur");ls(R0,"onTransitionEnd");si("onMouseEnter",["mouseout","mouseover"]);si("onMouseLeave",["mouseout","mouseover"]);si("onPointerEnter",["pointerout","pointerover"]);si("onPointerLeave",["pointerout","pointerover"]);Vs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Vs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Vs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Vs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Vs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Vs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Zi="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(" "),_N=new Set("cancel close invalid load scroll toggle".split(" ").concat(Zi));function Pg(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,bS(n,t,void 0,e),e.currentTarget=null}function P0(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var n=e[r],s=n.event;n=n.listeners;e:{var a=void 0;if(t)for(var o=n.length-1;0<=o;o--){var l=n[o],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==a&&s.isPropagationStopped())break e;Pg(s,l,u),a=c}else for(o=0;o<n.length;o++){if(l=n[o],c=l.instance,u=l.currentTarget,l=l.listener,c!==a&&s.isPropagationStopped())break e;Pg(s,l,u),a=c}}}if(Rc)throw e=Fh,Rc=!1,Fh=null,e}function Te(e,t){var r=t[Zh];r===void 0&&(r=t[Zh]=new Set);var n=e+"__bubble";r.has(n)||(O0(t,e,2,!1),r.add(n))}function $d(e,t,r){var n=0;t&&(n|=4),O0(r,e,n,t)}var Dl="_reactListening"+Math.random().toString(36).slice(2);function No(e){if(!e[Dl]){e[Dl]=!0,Ux.forEach(function(r){r!=="selectionchange"&&(_N.has(r)||$d(r,!1,e),$d(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Dl]||(t[Dl]=!0,$d("selectionchange",!1,t))}}function O0(e,t,r,n){switch(g0(t)){case 1:var s=MS;break;case 4:s=LS;break;default:s=jp}r=s.bind(null,t,r,e),s=void 0,!Uh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),n?s!==void 0?e.addEventListener(t,r,{capture:!0,passive:s}):e.addEventListener(t,r,!0):s!==void 0?e.addEventListener(t,r,{passive:s}):e.addEventListener(t,r,!1)}function zd(e,t,r,n,s){var a=n;if(!(t&1)&&!(t&2)&&n!==null)e:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var l=n.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=n.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=ws(l),o===null)return;if(c=o.tag,c===5||c===6){n=a=o;continue e}l=l.parentNode}}n=n.return}r0(function(){var u=a,d=bp(r),h=[];e:{var f=A0.get(e);if(f!==void 0){var p=Np,b=e;switch(e){case"keypress":if(hc(r)===0)break e;case"keydown":case"keyup":p=QS;break;case"focusin":b="focus",p=Pd;break;case"focusout":b="blur",p=Pd;break;case"beforeblur":case"afterblur":p=Pd;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=bg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=US;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=tN;break;case E0:case C0:case T0:p=HS;break;case R0:p=nN;break;case"scroll":p=$S;break;case"wheel":p=aN;break;case"copy":case"cut":case"paste":p=KS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=_g}var g=(t&4)!==0,w=!g&&e==="scroll",y=g?f!==null?f+"Capture":null:f;g=[];for(var v=u,x;v!==null;){x=v;var _=x.stateNode;if(x.tag===5&&_!==null&&(x=_,y!==null&&(_=bo(v,y),_!=null&&g.push(Eo(v,_,x)))),w)break;v=v.return}0<g.length&&(f=new p(f,b,null,r,d),h.push({event:f,listeners:g}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",f&&r!==$h&&(b=r.relatedTarget||r.fromElement)&&(ws(b)||b[sn]))break e;if((p||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,p?(b=r.relatedTarget||r.toElement,p=u,b=b?ws(b):null,b!==null&&(w=Ks(b),b!==w||b.tag!==5&&b.tag!==6)&&(b=null)):(p=null,b=u),p!==b)){if(g=bg,_="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(g=_g,_="onPointerLeave",y="onPointerEnter",v="pointer"),w=p==null?f:Ea(p),x=b==null?f:Ea(b),f=new g(_,v+"leave",p,r,d),f.target=w,f.relatedTarget=x,_=null,ws(d)===u&&(g=new g(y,v+"enter",b,r,d),g.target=x,g.relatedTarget=w,_=g),w=_,p&&b)t:{for(g=p,y=b,v=0,x=g;x;x=aa(x))v++;for(x=0,_=y;_;_=aa(_))x++;for(;0<v-x;)g=aa(g),v--;for(;0<x-v;)y=aa(y),x--;for(;v--;){if(g===y||y!==null&&g===y.alternate)break t;g=aa(g),y=aa(y)}g=null}else g=null;p!==null&&Og(h,f,p,g,!1),b!==null&&w!==null&&Og(h,w,b,g,!0)}}e:{if(f=u?Ea(u):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var j=hN;else if(Sg(f))if(_0)j=gN;else{j=pN;var S=fN}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(j=mN);if(j&&(j=j(e,u))){w0(h,j,r,d);break e}S&&S(e,f,u),e==="focusout"&&(S=f._wrapperState)&&S.controlled&&f.type==="number"&&Oh(f,"number",f.value)}switch(S=u?Ea(u):window,e){case"focusin":(Sg(S)||S.contentEditable==="true")&&(Sa=S,Kh=u,oo=null);break;case"focusout":oo=Kh=Sa=null;break;case"mousedown":qh=!0;break;case"contextmenu":case"mouseup":case"dragend":qh=!1,Rg(h,r,d);break;case"selectionchange":if(xN)break;case"keydown":case"keyup":Rg(h,r,d)}var C;if(Cp)e:{switch(e){case"compositionstart":var k="onCompositionStart";break e;case"compositionend":k="onCompositionEnd";break e;case"compositionupdate":k="onCompositionUpdate";break e}k=void 0}else ja?x0(e,r)&&(k="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(k="onCompositionStart");k&&(v0&&r.locale!=="ko"&&(ja||k!=="onCompositionStart"?k==="onCompositionEnd"&&ja&&(C=y0()):(Un=d,Sp="value"in Un?Un.value:Un.textContent,ja=!0)),S=Dc(u,k),0<S.length&&(k=new wg(k,e,null,r,d),h.push({event:k,listeners:S}),C?k.data=C:(C=b0(r),C!==null&&(k.data=C)))),(C=oN?lN(e,r):cN(e,r))&&(u=Dc(u,"onBeforeInput"),0<u.length&&(d=new wg("onBeforeInput","beforeinput",null,r,d),h.push({event:d,listeners:u}),d.data=C))}P0(h,t)})}function Eo(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Dc(e,t){for(var r=t+"Capture",n=[];e!==null;){var s=e,a=s.stateNode;s.tag===5&&a!==null&&(s=a,a=bo(e,r),a!=null&&n.unshift(Eo(e,a,s)),a=bo(e,t),a!=null&&n.push(Eo(e,a,s))),e=e.return}return n}function aa(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Og(e,t,r,n,s){for(var a=t._reactName,o=[];r!==null&&r!==n;){var l=r,c=l.alternate,u=l.stateNode;if(c!==null&&c===n)break;l.tag===5&&u!==null&&(l=u,s?(c=bo(r,a),c!=null&&o.unshift(Eo(r,c,l))):s||(c=bo(r,a),c!=null&&o.push(Eo(r,c,l)))),r=r.return}o.length!==0&&e.push({event:t,listeners:o})}var kN=/\r\n?/g,jN=/\u0000|\uFFFD/g;function Ig(e){return(typeof e=="string"?e:""+e).replace(kN,`
`).replace(jN,"")}function Ml(e,t,r){if(t=Ig(t),Ig(e)!==t&&r)throw Error(F(425))}function Mc(){}var Wh=null,Gh=null;function Yh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jh=typeof setTimeout=="function"?setTimeout:void 0,SN=typeof clearTimeout=="function"?clearTimeout:void 0,Dg=typeof Promise=="function"?Promise:void 0,NN=typeof queueMicrotask=="function"?queueMicrotask:typeof Dg<"u"?function(e){return Dg.resolve(null).then(e).catch(EN)}:Jh;function EN(e){setTimeout(function(){throw e})}function Ud(e,t){var r=t,n=0;do{var s=r.nextSibling;if(e.removeChild(r),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(n===0){e.removeChild(s),ko(t);return}n--}else r!=="$"&&r!=="$?"&&r!=="$!"||n++;r=s}while(r);ko(t)}function Yn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Mg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var ki=Math.random().toString(36).slice(2),Ar="__reactFiber$"+ki,Co="__reactProps$"+ki,sn="__reactContainer$"+ki,Zh="__reactEvents$"+ki,CN="__reactListeners$"+ki,TN="__reactHandles$"+ki;function ws(e){var t=e[Ar];if(t)return t;for(var r=e.parentNode;r;){if(t=r[sn]||r[Ar]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Mg(e);e!==null;){if(r=e[Ar])return r;e=Mg(e)}return t}e=r,r=e.parentNode}return null}function il(e){return e=e[Ar]||e[sn],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ea(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(F(33))}function Nu(e){return e[Co]||null}var Qh=[],Ca=-1;function cs(e){return{current:e}}function Re(e){0>Ca||(e.current=Qh[Ca],Qh[Ca]=null,Ca--)}function Ee(e,t){Ca++,Qh[Ca]=e.current,e.current=t}var ns={},ft=cs(ns),St=cs(!1),Ds=ns;function ai(e,t){var r=e.type.contextTypes;if(!r)return ns;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var s={},a;for(a in r)s[a]=t[a];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Nt(e){return e=e.childContextTypes,e!=null}function Lc(){Re(St),Re(ft)}function Lg(e,t,r){if(ft.current!==ns)throw Error(F(168));Ee(ft,t),Ee(St,r)}function I0(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var s in n)if(!(s in t))throw Error(F(108,fS(e)||"Unknown",s));return Le({},r,n)}function $c(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ns,Ds=ft.current,Ee(ft,e),Ee(St,St.current),!0}function $g(e,t,r){var n=e.stateNode;if(!n)throw Error(F(169));r?(e=I0(e,t,Ds),n.__reactInternalMemoizedMergedChildContext=e,Re(St),Re(ft),Ee(ft,e)):Re(St),Ee(St,r)}var Qr=null,Eu=!1,Fd=!1;function D0(e){Qr===null?Qr=[e]:Qr.push(e)}function RN(e){Eu=!0,D0(e)}function us(){if(!Fd&&Qr!==null){Fd=!0;var e=0,t=je;try{var r=Qr;for(je=1;e<r.length;e++){var n=r[e];do n=n(!0);while(n!==null)}Qr=null,Eu=!1}catch(s){throw Qr!==null&&(Qr=Qr.slice(e+1)),i0(wp,us),s}finally{je=t,Fd=!1}}return null}var Ta=[],Ra=0,zc=null,Uc=0,Vt=[],Kt=0,Ms=null,en=1,tn="";function ys(e,t){Ta[Ra++]=Uc,Ta[Ra++]=zc,zc=e,Uc=t}function M0(e,t,r){Vt[Kt++]=en,Vt[Kt++]=tn,Vt[Kt++]=Ms,Ms=e;var n=en;e=tn;var s=32-pr(n)-1;n&=~(1<<s),r+=1;var a=32-pr(t)+s;if(30<a){var o=s-s%5;a=(n&(1<<o)-1).toString(32),n>>=o,s-=o,en=1<<32-pr(t)+s|r<<s|n,tn=a+e}else en=1<<a|r<<s|n,tn=e}function Rp(e){e.return!==null&&(ys(e,1),M0(e,1,0))}function Ap(e){for(;e===zc;)zc=Ta[--Ra],Ta[Ra]=null,Uc=Ta[--Ra],Ta[Ra]=null;for(;e===Ms;)Ms=Vt[--Kt],Vt[Kt]=null,tn=Vt[--Kt],Vt[Kt]=null,en=Vt[--Kt],Vt[Kt]=null}var Ot=null,Pt=null,Pe=!1,dr=null;function L0(e,t){var r=qt(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function zg(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Ot=e,Pt=Yn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ot=e,Pt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=Ms!==null?{id:en,overflow:tn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=qt(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Ot=e,Pt=null,!0):!1;default:return!1}}function Xh(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ef(e){if(Pe){var t=Pt;if(t){var r=t;if(!zg(e,t)){if(Xh(e))throw Error(F(418));t=Yn(r.nextSibling);var n=Ot;t&&zg(e,t)?L0(n,r):(e.flags=e.flags&-4097|2,Pe=!1,Ot=e)}}else{if(Xh(e))throw Error(F(418));e.flags=e.flags&-4097|2,Pe=!1,Ot=e}}}function Ug(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ot=e}function Ll(e){if(e!==Ot)return!1;if(!Pe)return Ug(e),Pe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Yh(e.type,e.memoizedProps)),t&&(t=Pt)){if(Xh(e))throw $0(),Error(F(418));for(;t;)L0(e,t),t=Yn(t.nextSibling)}if(Ug(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(F(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Pt=Yn(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Pt=null}}else Pt=Ot?Yn(e.stateNode.nextSibling):null;return!0}function $0(){for(var e=Pt;e;)e=Yn(e.nextSibling)}function ii(){Pt=Ot=null,Pe=!1}function Pp(e){dr===null?dr=[e]:dr.push(e)}var AN=hn.ReactCurrentBatchConfig;function zi(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(F(309));var n=r.stateNode}if(!n)throw Error(F(147,e));var s=n,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(o){var l=s.refs;o===null?delete l[a]:l[a]=o},t._stringRef=a,t)}if(typeof e!="string")throw Error(F(284));if(!r._owner)throw Error(F(290,e))}return e}function $l(e,t){throw e=Object.prototype.toString.call(t),Error(F(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Fg(e){var t=e._init;return t(e._payload)}function z0(e){function t(y,v){if(e){var x=y.deletions;x===null?(y.deletions=[v],y.flags|=16):x.push(v)}}function r(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function n(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(y,v){return y=Xn(y,v),y.index=0,y.sibling=null,y}function a(y,v,x){return y.index=x,e?(x=y.alternate,x!==null?(x=x.index,x<v?(y.flags|=2,v):x):(y.flags|=2,v)):(y.flags|=1048576,v)}function o(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,v,x,_){return v===null||v.tag!==6?(v=Gd(x,y.mode,_),v.return=y,v):(v=s(v,x),v.return=y,v)}function c(y,v,x,_){var j=x.type;return j===ka?d(y,v,x.props.children,_,x.key):v!==null&&(v.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Cn&&Fg(j)===v.type)?(_=s(v,x.props),_.ref=zi(y,v,x),_.return=y,_):(_=xc(x.type,x.key,x.props,null,y.mode,_),_.ref=zi(y,v,x),_.return=y,_)}function u(y,v,x,_){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=Yd(x,y.mode,_),v.return=y,v):(v=s(v,x.children||[]),v.return=y,v)}function d(y,v,x,_,j){return v===null||v.tag!==7?(v=Os(x,y.mode,_,j),v.return=y,v):(v=s(v,x),v.return=y,v)}function h(y,v,x){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Gd(""+v,y.mode,x),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case El:return x=xc(v.type,v.key,v.props,null,y.mode,x),x.ref=zi(y,null,v),x.return=y,x;case _a:return v=Yd(v,y.mode,x),v.return=y,v;case Cn:var _=v._init;return h(y,_(v._payload),x)}if(Yi(v)||Ii(v))return v=Os(v,y.mode,x,null),v.return=y,v;$l(y,v)}return null}function f(y,v,x,_){var j=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return j!==null?null:l(y,v,""+x,_);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case El:return x.key===j?c(y,v,x,_):null;case _a:return x.key===j?u(y,v,x,_):null;case Cn:return j=x._init,f(y,v,j(x._payload),_)}if(Yi(x)||Ii(x))return j!==null?null:d(y,v,x,_,null);$l(y,x)}return null}function p(y,v,x,_,j){if(typeof _=="string"&&_!==""||typeof _=="number")return y=y.get(x)||null,l(v,y,""+_,j);if(typeof _=="object"&&_!==null){switch(_.$$typeof){case El:return y=y.get(_.key===null?x:_.key)||null,c(v,y,_,j);case _a:return y=y.get(_.key===null?x:_.key)||null,u(v,y,_,j);case Cn:var S=_._init;return p(y,v,x,S(_._payload),j)}if(Yi(_)||Ii(_))return y=y.get(x)||null,d(v,y,_,j,null);$l(v,_)}return null}function b(y,v,x,_){for(var j=null,S=null,C=v,k=v=0,A=null;C!==null&&k<x.length;k++){C.index>k?(A=C,C=null):A=C.sibling;var P=f(y,C,x[k],_);if(P===null){C===null&&(C=A);break}e&&C&&P.alternate===null&&t(y,C),v=a(P,v,k),S===null?j=P:S.sibling=P,S=P,C=A}if(k===x.length)return r(y,C),Pe&&ys(y,k),j;if(C===null){for(;k<x.length;k++)C=h(y,x[k],_),C!==null&&(v=a(C,v,k),S===null?j=C:S.sibling=C,S=C);return Pe&&ys(y,k),j}for(C=n(y,C);k<x.length;k++)A=p(C,y,k,x[k],_),A!==null&&(e&&A.alternate!==null&&C.delete(A.key===null?k:A.key),v=a(A,v,k),S===null?j=A:S.sibling=A,S=A);return e&&C.forEach(function($){return t(y,$)}),Pe&&ys(y,k),j}function g(y,v,x,_){var j=Ii(x);if(typeof j!="function")throw Error(F(150));if(x=j.call(x),x==null)throw Error(F(151));for(var S=j=null,C=v,k=v=0,A=null,P=x.next();C!==null&&!P.done;k++,P=x.next()){C.index>k?(A=C,C=null):A=C.sibling;var $=f(y,C,P.value,_);if($===null){C===null&&(C=A);break}e&&C&&$.alternate===null&&t(y,C),v=a($,v,k),S===null?j=$:S.sibling=$,S=$,C=A}if(P.done)return r(y,C),Pe&&ys(y,k),j;if(C===null){for(;!P.done;k++,P=x.next())P=h(y,P.value,_),P!==null&&(v=a(P,v,k),S===null?j=P:S.sibling=P,S=P);return Pe&&ys(y,k),j}for(C=n(y,C);!P.done;k++,P=x.next())P=p(C,y,k,P.value,_),P!==null&&(e&&P.alternate!==null&&C.delete(P.key===null?k:P.key),v=a(P,v,k),S===null?j=P:S.sibling=P,S=P);return e&&C.forEach(function(R){return t(y,R)}),Pe&&ys(y,k),j}function w(y,v,x,_){if(typeof x=="object"&&x!==null&&x.type===ka&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case El:e:{for(var j=x.key,S=v;S!==null;){if(S.key===j){if(j=x.type,j===ka){if(S.tag===7){r(y,S.sibling),v=s(S,x.props.children),v.return=y,y=v;break e}}else if(S.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Cn&&Fg(j)===S.type){r(y,S.sibling),v=s(S,x.props),v.ref=zi(y,S,x),v.return=y,y=v;break e}r(y,S);break}else t(y,S);S=S.sibling}x.type===ka?(v=Os(x.props.children,y.mode,_,x.key),v.return=y,y=v):(_=xc(x.type,x.key,x.props,null,y.mode,_),_.ref=zi(y,v,x),_.return=y,y=_)}return o(y);case _a:e:{for(S=x.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){r(y,v.sibling),v=s(v,x.children||[]),v.return=y,y=v;break e}else{r(y,v);break}else t(y,v);v=v.sibling}v=Yd(x,y.mode,_),v.return=y,y=v}return o(y);case Cn:return S=x._init,w(y,v,S(x._payload),_)}if(Yi(x))return b(y,v,x,_);if(Ii(x))return g(y,v,x,_);$l(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,v!==null&&v.tag===6?(r(y,v.sibling),v=s(v,x),v.return=y,y=v):(r(y,v),v=Gd(x,y.mode,_),v.return=y,y=v),o(y)):r(y,v)}return w}var oi=z0(!0),U0=z0(!1),Fc=cs(null),Bc=null,Aa=null,Op=null;function Ip(){Op=Aa=Bc=null}function Dp(e){var t=Fc.current;Re(Fc),e._currentValue=t}function tf(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function Ua(e,t){Bc=e,Op=Aa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(jt=!0),e.firstContext=null)}function Jt(e){var t=e._currentValue;if(Op!==e)if(e={context:e,memoizedValue:t,next:null},Aa===null){if(Bc===null)throw Error(F(308));Aa=e,Bc.dependencies={lanes:0,firstContext:e}}else Aa=Aa.next=e;return t}var _s=null;function Mp(e){_s===null?_s=[e]:_s.push(e)}function F0(e,t,r,n){var s=t.interleaved;return s===null?(r.next=r,Mp(t)):(r.next=s.next,s.next=r),t.interleaved=r,an(e,n)}function an(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Tn=!1;function Lp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function B0(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function rn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Jn(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,ve&2){var s=n.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),n.pending=t,an(e,r)}return s=n.interleaved,s===null?(t.next=t,Mp(n)):(t.next=s.next,s.next=t),n.interleaved=t,an(e,r)}function fc(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,_p(e,r)}}function Bg(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var s=null,a=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};a===null?s=a=o:a=a.next=o,r=r.next}while(r!==null);a===null?s=a=t:a=a.next=t}else s=a=t;r={baseState:n.baseState,firstBaseUpdate:s,lastBaseUpdate:a,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Hc(e,t,r,n){var s=e.updateQueue;Tn=!1;var a=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var h=s.baseState;o=0,d=u=c=null,l=a;do{var f=l.lane,p=l.eventTime;if((n&f)===f){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var b=e,g=l;switch(f=t,p=r,g.tag){case 1:if(b=g.payload,typeof b=="function"){h=b.call(p,h,f);break e}h=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=g.payload,f=typeof b=="function"?b.call(p,h,f):b,f==null)break e;h=Le({},h,f);break e;case 2:Tn=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else p={eventTime:p,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=h):d=d.next=p,o|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else a===null&&(s.shared.lanes=0);$s|=o,e.lanes=o,e.memoizedState=h}}function Hg(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var n=e[t],s=n.callback;if(s!==null){if(n.callback=null,n=r,typeof s!="function")throw Error(F(191,s));s.call(n)}}}var ol={},Dr=cs(ol),To=cs(ol),Ro=cs(ol);function ks(e){if(e===ol)throw Error(F(174));return e}function $p(e,t){switch(Ee(Ro,t),Ee(To,e),Ee(Dr,ol),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Dh(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Dh(t,e)}Re(Dr),Ee(Dr,t)}function li(){Re(Dr),Re(To),Re(Ro)}function H0(e){ks(Ro.current);var t=ks(Dr.current),r=Dh(t,e.type);t!==r&&(Ee(To,e),Ee(Dr,r))}function zp(e){To.current===e&&(Re(Dr),Re(To))}var Ie=cs(0);function Vc(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Bd=[];function Up(){for(var e=0;e<Bd.length;e++)Bd[e]._workInProgressVersionPrimary=null;Bd.length=0}var pc=hn.ReactCurrentDispatcher,Hd=hn.ReactCurrentBatchConfig,Ls=0,De=null,Je=null,et=null,Kc=!1,lo=!1,Ao=0,PN=0;function ct(){throw Error(F(321))}function Fp(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!gr(e[r],t[r]))return!1;return!0}function Bp(e,t,r,n,s,a){if(Ls=a,De=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,pc.current=e===null||e.memoizedState===null?MN:LN,e=r(n,s),lo){a=0;do{if(lo=!1,Ao=0,25<=a)throw Error(F(301));a+=1,et=Je=null,t.updateQueue=null,pc.current=$N,e=r(n,s)}while(lo)}if(pc.current=qc,t=Je!==null&&Je.next!==null,Ls=0,et=Je=De=null,Kc=!1,t)throw Error(F(300));return e}function Hp(){var e=Ao!==0;return Ao=0,e}function Sr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return et===null?De.memoizedState=et=e:et=et.next=e,et}function Zt(){if(Je===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var t=et===null?De.memoizedState:et.next;if(t!==null)et=t,Je=e;else{if(e===null)throw Error(F(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},et===null?De.memoizedState=et=e:et=et.next=e}return et}function Po(e,t){return typeof t=="function"?t(e):t}function Vd(e){var t=Zt(),r=t.queue;if(r===null)throw Error(F(311));r.lastRenderedReducer=e;var n=Je,s=n.baseQueue,a=r.pending;if(a!==null){if(s!==null){var o=s.next;s.next=a.next,a.next=o}n.baseQueue=s=a,r.pending=null}if(s!==null){a=s.next,n=n.baseState;var l=o=null,c=null,u=a;do{var d=u.lane;if((Ls&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),n=u.hasEagerState?u.eagerState:e(n,u.action);else{var h={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=h,o=n):c=c.next=h,De.lanes|=d,$s|=d}u=u.next}while(u!==null&&u!==a);c===null?o=n:c.next=l,gr(n,t.memoizedState)||(jt=!0),t.memoizedState=n,t.baseState=o,t.baseQueue=c,r.lastRenderedState=n}if(e=r.interleaved,e!==null){s=e;do a=s.lane,De.lanes|=a,$s|=a,s=s.next;while(s!==e)}else s===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Kd(e){var t=Zt(),r=t.queue;if(r===null)throw Error(F(311));r.lastRenderedReducer=e;var n=r.dispatch,s=r.pending,a=t.memoizedState;if(s!==null){r.pending=null;var o=s=s.next;do a=e(a,o.action),o=o.next;while(o!==s);gr(a,t.memoizedState)||(jt=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),r.lastRenderedState=a}return[a,n]}function V0(){}function K0(e,t){var r=De,n=Zt(),s=t(),a=!gr(n.memoizedState,s);if(a&&(n.memoizedState=s,jt=!0),n=n.queue,Vp(G0.bind(null,r,n,e),[e]),n.getSnapshot!==t||a||et!==null&&et.memoizedState.tag&1){if(r.flags|=2048,Oo(9,W0.bind(null,r,n,s,t),void 0,null),tt===null)throw Error(F(349));Ls&30||q0(r,t,s)}return s}function q0(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=De.updateQueue,t===null?(t={lastEffect:null,stores:null},De.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function W0(e,t,r,n){t.value=r,t.getSnapshot=n,Y0(t)&&J0(e)}function G0(e,t,r){return r(function(){Y0(t)&&J0(e)})}function Y0(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!gr(e,r)}catch{return!0}}function J0(e){var t=an(e,1);t!==null&&mr(t,e,1,-1)}function Vg(e){var t=Sr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:e},t.queue=e,e=e.dispatch=DN.bind(null,De,e),[t.memoizedState,e]}function Oo(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},t=De.updateQueue,t===null?(t={lastEffect:null,stores:null},De.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e)),e}function Z0(){return Zt().memoizedState}function mc(e,t,r,n){var s=Sr();De.flags|=e,s.memoizedState=Oo(1|t,r,void 0,n===void 0?null:n)}function Cu(e,t,r,n){var s=Zt();n=n===void 0?null:n;var a=void 0;if(Je!==null){var o=Je.memoizedState;if(a=o.destroy,n!==null&&Fp(n,o.deps)){s.memoizedState=Oo(t,r,a,n);return}}De.flags|=e,s.memoizedState=Oo(1|t,r,a,n)}function Kg(e,t){return mc(8390656,8,e,t)}function Vp(e,t){return Cu(2048,8,e,t)}function Q0(e,t){return Cu(4,2,e,t)}function X0(e,t){return Cu(4,4,e,t)}function eb(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function tb(e,t,r){return r=r!=null?r.concat([e]):null,Cu(4,4,eb.bind(null,t,e),r)}function Kp(){}function rb(e,t){var r=Zt();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Fp(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function nb(e,t){var r=Zt();t=t===void 0?null:t;var n=r.memoizedState;return n!==null&&t!==null&&Fp(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function sb(e,t,r){return Ls&21?(gr(r,t)||(r=c0(),De.lanes|=r,$s|=r,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,jt=!0),e.memoizedState=r)}function ON(e,t){var r=je;je=r!==0&&4>r?r:4,e(!0);var n=Hd.transition;Hd.transition={};try{e(!1),t()}finally{je=r,Hd.transition=n}}function ab(){return Zt().memoizedState}function IN(e,t,r){var n=Qn(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},ib(e))ob(t,r);else if(r=F0(e,t,r,n),r!==null){var s=yt();mr(r,e,n,s),lb(r,t,n)}}function DN(e,t,r){var n=Qn(e),s={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(ib(e))ob(t,s);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,r);if(s.hasEagerState=!0,s.eagerState=l,gr(l,o)){var c=t.interleaved;c===null?(s.next=s,Mp(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}r=F0(e,t,s,n),r!==null&&(s=yt(),mr(r,e,n,s),lb(r,t,n))}}function ib(e){var t=e.alternate;return e===De||t!==null&&t===De}function ob(e,t){lo=Kc=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function lb(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,_p(e,r)}}var qc={readContext:Jt,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useInsertionEffect:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useMutableSource:ct,useSyncExternalStore:ct,useId:ct,unstable_isNewReconciler:!1},MN={readContext:Jt,useCallback:function(e,t){return Sr().memoizedState=[e,t===void 0?null:t],e},useContext:Jt,useEffect:Kg,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,mc(4194308,4,eb.bind(null,t,e),r)},useLayoutEffect:function(e,t){return mc(4194308,4,e,t)},useInsertionEffect:function(e,t){return mc(4,2,e,t)},useMemo:function(e,t){var r=Sr();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=Sr();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=IN.bind(null,De,e),[n.memoizedState,e]},useRef:function(e){var t=Sr();return e={current:e},t.memoizedState=e},useState:Vg,useDebugValue:Kp,useDeferredValue:function(e){return Sr().memoizedState=e},useTransition:function(){var e=Vg(!1),t=e[0];return e=ON.bind(null,e[1]),Sr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=De,s=Sr();if(Pe){if(r===void 0)throw Error(F(407));r=r()}else{if(r=t(),tt===null)throw Error(F(349));Ls&30||q0(n,t,r)}s.memoizedState=r;var a={value:r,getSnapshot:t};return s.queue=a,Kg(G0.bind(null,n,a,e),[e]),n.flags|=2048,Oo(9,W0.bind(null,n,a,r,t),void 0,null),r},useId:function(){var e=Sr(),t=tt.identifierPrefix;if(Pe){var r=tn,n=en;r=(n&~(1<<32-pr(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Ao++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=PN++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},LN={readContext:Jt,useCallback:rb,useContext:Jt,useEffect:Vp,useImperativeHandle:tb,useInsertionEffect:Q0,useLayoutEffect:X0,useMemo:nb,useReducer:Vd,useRef:Z0,useState:function(){return Vd(Po)},useDebugValue:Kp,useDeferredValue:function(e){var t=Zt();return sb(t,Je.memoizedState,e)},useTransition:function(){var e=Vd(Po)[0],t=Zt().memoizedState;return[e,t]},useMutableSource:V0,useSyncExternalStore:K0,useId:ab,unstable_isNewReconciler:!1},$N={readContext:Jt,useCallback:rb,useContext:Jt,useEffect:Vp,useImperativeHandle:tb,useInsertionEffect:Q0,useLayoutEffect:X0,useMemo:nb,useReducer:Kd,useRef:Z0,useState:function(){return Kd(Po)},useDebugValue:Kp,useDeferredValue:function(e){var t=Zt();return Je===null?t.memoizedState=e:sb(t,Je.memoizedState,e)},useTransition:function(){var e=Kd(Po)[0],t=Zt().memoizedState;return[e,t]},useMutableSource:V0,useSyncExternalStore:K0,useId:ab,unstable_isNewReconciler:!1};function ar(e,t){if(e&&e.defaultProps){t=Le({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function rf(e,t,r,n){t=e.memoizedState,r=r(n,t),r=r==null?t:Le({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Tu={isMounted:function(e){return(e=e._reactInternals)?Ks(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=yt(),s=Qn(e),a=rn(n,s);a.payload=t,r!=null&&(a.callback=r),t=Jn(e,a,s),t!==null&&(mr(t,e,s,n),fc(t,e,s))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=yt(),s=Qn(e),a=rn(n,s);a.tag=1,a.payload=t,r!=null&&(a.callback=r),t=Jn(e,a,s),t!==null&&(mr(t,e,s,n),fc(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=yt(),n=Qn(e),s=rn(r,n);s.tag=2,t!=null&&(s.callback=t),t=Jn(e,s,n),t!==null&&(mr(t,e,n,r),fc(t,e,n))}};function qg(e,t,r,n,s,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(n,a,o):t.prototype&&t.prototype.isPureReactComponent?!So(r,n)||!So(s,a):!0}function cb(e,t,r){var n=!1,s=ns,a=t.contextType;return typeof a=="object"&&a!==null?a=Jt(a):(s=Nt(t)?Ds:ft.current,n=t.contextTypes,a=(n=n!=null)?ai(e,s):ns),t=new t(r,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Tu,e.stateNode=t,t._reactInternals=e,n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=a),t}function Wg(e,t,r,n){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,n),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&Tu.enqueueReplaceState(t,t.state,null)}function nf(e,t,r,n){var s=e.stateNode;s.props=r,s.state=e.memoizedState,s.refs={},Lp(e);var a=t.contextType;typeof a=="object"&&a!==null?s.context=Jt(a):(a=Nt(t)?Ds:ft.current,s.context=ai(e,a)),s.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(rf(e,t,a,r),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Tu.enqueueReplaceState(s,s.state,null),Hc(e,r,s,n),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function ci(e,t){try{var r="",n=t;do r+=hS(n),n=n.return;while(n);var s=r}catch(a){s=`
Error generating stack: `+a.message+`
`+a.stack}return{value:e,source:t,stack:s,digest:null}}function qd(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function sf(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var zN=typeof WeakMap=="function"?WeakMap:Map;function ub(e,t,r){r=rn(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Gc||(Gc=!0,mf=n),sf(e,t)},r}function db(e,t,r){r=rn(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var s=t.value;r.payload=function(){return n(s)},r.callback=function(){sf(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(r.callback=function(){sf(e,t),typeof n!="function"&&(Zn===null?Zn=new Set([this]):Zn.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function Gg(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new zN;var s=new Set;n.set(t,s)}else s=n.get(t),s===void 0&&(s=new Set,n.set(t,s));s.has(r)||(s.add(r),e=XN.bind(null,e,t,r),t.then(e,e))}function Yg(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Jg(e,t,r,n,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=rn(-1,1),t.tag=2,Jn(r,t,1))),r.lanes|=1),e)}var UN=hn.ReactCurrentOwner,jt=!1;function mt(e,t,r,n){t.child=e===null?U0(t,null,r,n):oi(t,e.child,r,n)}function Zg(e,t,r,n,s){r=r.render;var a=t.ref;return Ua(t,s),n=Bp(e,t,r,n,a,s),r=Hp(),e!==null&&!jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,on(e,t,s)):(Pe&&r&&Rp(t),t.flags|=1,mt(e,t,n,s),t.child)}function Qg(e,t,r,n,s){if(e===null){var a=r.type;return typeof a=="function"&&!Xp(a)&&a.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=a,hb(e,t,a,n,s)):(e=xc(r.type,null,n,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&s)){var o=a.memoizedProps;if(r=r.compare,r=r!==null?r:So,r(o,n)&&e.ref===t.ref)return on(e,t,s)}return t.flags|=1,e=Xn(a,n),e.ref=t.ref,e.return=t,t.child=e}function hb(e,t,r,n,s){if(e!==null){var a=e.memoizedProps;if(So(a,n)&&e.ref===t.ref)if(jt=!1,t.pendingProps=n=a,(e.lanes&s)!==0)e.flags&131072&&(jt=!0);else return t.lanes=e.lanes,on(e,t,s)}return af(e,t,r,n,s)}function fb(e,t,r){var n=t.pendingProps,s=n.children,a=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ee(Oa,Ct),Ct|=r;else{if(!(r&1073741824))return e=a!==null?a.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ee(Oa,Ct),Ct|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=a!==null?a.baseLanes:r,Ee(Oa,Ct),Ct|=n}else a!==null?(n=a.baseLanes|r,t.memoizedState=null):n=r,Ee(Oa,Ct),Ct|=n;return mt(e,t,s,r),t.child}function pb(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function af(e,t,r,n,s){var a=Nt(r)?Ds:ft.current;return a=ai(t,a),Ua(t,s),r=Bp(e,t,r,n,a,s),n=Hp(),e!==null&&!jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,on(e,t,s)):(Pe&&n&&Rp(t),t.flags|=1,mt(e,t,r,s),t.child)}function Xg(e,t,r,n,s){if(Nt(r)){var a=!0;$c(t)}else a=!1;if(Ua(t,s),t.stateNode===null)gc(e,t),cb(t,r,n),nf(t,r,n,s),n=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=Jt(u):(u=Nt(r)?Ds:ft.current,u=ai(t,u));var d=r.getDerivedStateFromProps,h=typeof d=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==n||c!==u)&&Wg(t,o,n,u),Tn=!1;var f=t.memoizedState;o.state=f,Hc(t,n,o,s),c=t.memoizedState,l!==n||f!==c||St.current||Tn?(typeof d=="function"&&(rf(t,r,d,n),c=t.memoizedState),(l=Tn||qg(t,r,l,n,f,c,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),o.props=n,o.state=c,o.context=u,n=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,B0(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ar(t.type,l),o.props=u,h=t.pendingProps,f=o.context,c=r.contextType,typeof c=="object"&&c!==null?c=Jt(c):(c=Nt(r)?Ds:ft.current,c=ai(t,c));var p=r.getDerivedStateFromProps;(d=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||f!==c)&&Wg(t,o,n,c),Tn=!1,f=t.memoizedState,o.state=f,Hc(t,n,o,s);var b=t.memoizedState;l!==h||f!==b||St.current||Tn?(typeof p=="function"&&(rf(t,r,p,n),b=t.memoizedState),(u=Tn||qg(t,r,u,n,f,b,c)||!1)?(d||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,b,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,b,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=b),o.props=n,o.state=b,o.context=c,n=u):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return of(e,t,r,n,a,s)}function of(e,t,r,n,s,a){pb(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return s&&$g(t,r,!1),on(e,t,a);n=t.stateNode,UN.current=t;var l=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=oi(t,e.child,null,a),t.child=oi(t,null,l,a)):mt(e,t,l,a),t.memoizedState=n.state,s&&$g(t,r,!0),t.child}function mb(e){var t=e.stateNode;t.pendingContext?Lg(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Lg(e,t.context,!1),$p(e,t.containerInfo)}function ey(e,t,r,n,s){return ii(),Pp(s),t.flags|=256,mt(e,t,r,n),t.child}var lf={dehydrated:null,treeContext:null,retryLane:0};function cf(e){return{baseLanes:e,cachePool:null,transitions:null}}function gb(e,t,r){var n=t.pendingProps,s=Ie.current,a=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Ee(Ie,s&1),e===null)return ef(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=n.children,e=n.fallback,a?(n=t.mode,a=t.child,o={mode:"hidden",children:o},!(n&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Pu(o,n,0,null),e=Os(e,n,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=cf(r),t.memoizedState=lf,e):qp(t,o));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return FN(e,t,o,n,l,s,r);if(a){a=n.fallback,o=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:n.children};return!(o&1)&&t.child!==s?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=Xn(s,c),n.subtreeFlags=s.subtreeFlags&14680064),l!==null?a=Xn(l,a):(a=Os(a,o,r,null),a.flags|=2),a.return=t,n.return=t,n.sibling=a,t.child=n,n=a,a=t.child,o=e.child.memoizedState,o=o===null?cf(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~r,t.memoizedState=lf,n}return a=e.child,e=a.sibling,n=Xn(a,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function qp(e,t){return t=Pu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function zl(e,t,r,n){return n!==null&&Pp(n),oi(t,e.child,null,r),e=qp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function FN(e,t,r,n,s,a,o){if(r)return t.flags&256?(t.flags&=-257,n=qd(Error(F(422))),zl(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=n.fallback,s=t.mode,n=Pu({mode:"visible",children:n.children},s,0,null),a=Os(a,s,o,null),a.flags|=2,n.return=t,a.return=t,n.sibling=a,t.child=n,t.mode&1&&oi(t,e.child,null,o),t.child.memoizedState=cf(o),t.memoizedState=lf,a);if(!(t.mode&1))return zl(e,t,o,null);if(s.data==="$!"){if(n=s.nextSibling&&s.nextSibling.dataset,n)var l=n.dgst;return n=l,a=Error(F(419)),n=qd(a,n,void 0),zl(e,t,o,n)}if(l=(o&e.childLanes)!==0,jt||l){if(n=tt,n!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(n.suspendedLanes|o)?0:s,s!==0&&s!==a.retryLane&&(a.retryLane=s,an(e,s),mr(n,e,s,-1))}return Qp(),n=qd(Error(F(421))),zl(e,t,o,n)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=eE.bind(null,e),s._reactRetry=t,null):(e=a.treeContext,Pt=Yn(s.nextSibling),Ot=t,Pe=!0,dr=null,e!==null&&(Vt[Kt++]=en,Vt[Kt++]=tn,Vt[Kt++]=Ms,en=e.id,tn=e.overflow,Ms=t),t=qp(t,n.children),t.flags|=4096,t)}function ty(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),tf(e.return,t,r)}function Wd(e,t,r,n,s){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:s}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=n,a.tail=r,a.tailMode=s)}function yb(e,t,r){var n=t.pendingProps,s=n.revealOrder,a=n.tail;if(mt(e,t,n.children,r),n=Ie.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ty(e,r,t);else if(e.tag===19)ty(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Ee(Ie,n),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(r=t.child,s=null;r!==null;)e=r.alternate,e!==null&&Vc(e)===null&&(s=r),r=r.sibling;r=s,r===null?(s=t.child,t.child=null):(s=r.sibling,r.sibling=null),Wd(t,!1,s,r,a);break;case"backwards":for(r=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Vc(e)===null){t.child=s;break}e=s.sibling,s.sibling=r,r=s,s=e}Wd(t,!0,r,null,a);break;case"together":Wd(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function gc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function on(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),$s|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(F(153));if(t.child!==null){for(e=t.child,r=Xn(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Xn(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function BN(e,t,r){switch(t.tag){case 3:mb(t),ii();break;case 5:H0(t);break;case 1:Nt(t.type)&&$c(t);break;case 4:$p(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,s=t.memoizedProps.value;Ee(Fc,n._currentValue),n._currentValue=s;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(Ee(Ie,Ie.current&1),t.flags|=128,null):r&t.child.childLanes?gb(e,t,r):(Ee(Ie,Ie.current&1),e=on(e,t,r),e!==null?e.sibling:null);Ee(Ie,Ie.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return yb(e,t,r);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ee(Ie,Ie.current),n)break;return null;case 22:case 23:return t.lanes=0,fb(e,t,r)}return on(e,t,r)}var vb,uf,xb,bb;vb=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};uf=function(){};xb=function(e,t,r,n){var s=e.memoizedProps;if(s!==n){e=t.stateNode,ks(Dr.current);var a=null;switch(r){case"input":s=Ah(e,s),n=Ah(e,n),a=[];break;case"select":s=Le({},s,{value:void 0}),n=Le({},n,{value:void 0}),a=[];break;case"textarea":s=Ih(e,s),n=Ih(e,n),a=[];break;default:typeof s.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Mc)}Mh(r,n);var o;r=null;for(u in s)if(!n.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(o in l)l.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(vo.hasOwnProperty(u)?a||(a=[]):(a=a||[]).push(u,null));for(u in n){var c=n[u];if(l=s!=null?s[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(r||(r={}),r[o]=c[o])}else r||(a||(a=[]),a.push(u,r)),r=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(a=a||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(a=a||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(vo.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Te("scroll",e),a||l===c||(a=[])):(a=a||[]).push(u,c))}r&&(a=a||[]).push("style",r);var u=a;(t.updateQueue=u)&&(t.flags|=4)}};bb=function(e,t,r,n){r!==n&&(t.flags|=4)};function Ui(e,t){if(!Pe)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function ut(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags&14680064,n|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)r|=s.lanes|s.childLanes,n|=s.subtreeFlags,n|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function HN(e,t,r){var n=t.pendingProps;switch(Ap(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ut(t),null;case 1:return Nt(t.type)&&Lc(),ut(t),null;case 3:return n=t.stateNode,li(),Re(St),Re(ft),Up(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ll(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,dr!==null&&(vf(dr),dr=null))),uf(e,t),ut(t),null;case 5:zp(t);var s=ks(Ro.current);if(r=t.type,e!==null&&t.stateNode!=null)xb(e,t,r,n,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(F(166));return ut(t),null}if(e=ks(Dr.current),Ll(t)){n=t.stateNode,r=t.type;var a=t.memoizedProps;switch(n[Ar]=t,n[Co]=a,e=(t.mode&1)!==0,r){case"dialog":Te("cancel",n),Te("close",n);break;case"iframe":case"object":case"embed":Te("load",n);break;case"video":case"audio":for(s=0;s<Zi.length;s++)Te(Zi[s],n);break;case"source":Te("error",n);break;case"img":case"image":case"link":Te("error",n),Te("load",n);break;case"details":Te("toggle",n);break;case"input":ug(n,a),Te("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!a.multiple},Te("invalid",n);break;case"textarea":hg(n,a),Te("invalid",n)}Mh(r,a),s=null;for(var o in a)if(a.hasOwnProperty(o)){var l=a[o];o==="children"?typeof l=="string"?n.textContent!==l&&(a.suppressHydrationWarning!==!0&&Ml(n.textContent,l,e),s=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(a.suppressHydrationWarning!==!0&&Ml(n.textContent,l,e),s=["children",""+l]):vo.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Te("scroll",n)}switch(r){case"input":Cl(n),dg(n,a,!0);break;case"textarea":Cl(n),fg(n);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(n.onclick=Mc)}n=s,t.updateQueue=n,n!==null&&(t.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Gx(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Ar]=t,e[Co]=n,vb(e,t,!1,!1),t.stateNode=e;e:{switch(o=Lh(r,n),r){case"dialog":Te("cancel",e),Te("close",e),s=n;break;case"iframe":case"object":case"embed":Te("load",e),s=n;break;case"video":case"audio":for(s=0;s<Zi.length;s++)Te(Zi[s],e);s=n;break;case"source":Te("error",e),s=n;break;case"img":case"image":case"link":Te("error",e),Te("load",e),s=n;break;case"details":Te("toggle",e),s=n;break;case"input":ug(e,n),s=Ah(e,n),Te("invalid",e);break;case"option":s=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},s=Le({},n,{value:void 0}),Te("invalid",e);break;case"textarea":hg(e,n),s=Ih(e,n),Te("invalid",e);break;default:s=n}Mh(r,s),l=s;for(a in l)if(l.hasOwnProperty(a)){var c=l[a];a==="style"?Zx(e,c):a==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Yx(e,c)):a==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&xo(e,c):typeof c=="number"&&xo(e,""+c):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(vo.hasOwnProperty(a)?c!=null&&a==="onScroll"&&Te("scroll",e):c!=null&&gp(e,a,c,o))}switch(r){case"input":Cl(e),dg(e,n,!1);break;case"textarea":Cl(e),fg(e);break;case"option":n.value!=null&&e.setAttribute("value",""+rs(n.value));break;case"select":e.multiple=!!n.multiple,a=n.value,a!=null?Ma(e,!!n.multiple,a,!1):n.defaultValue!=null&&Ma(e,!!n.multiple,n.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Mc)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ut(t),null;case 6:if(e&&t.stateNode!=null)bb(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(F(166));if(r=ks(Ro.current),ks(Dr.current),Ll(t)){if(n=t.stateNode,r=t.memoizedProps,n[Ar]=t,(a=n.nodeValue!==r)&&(e=Ot,e!==null))switch(e.tag){case 3:Ml(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ml(n.nodeValue,r,(e.mode&1)!==0)}a&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Ar]=t,t.stateNode=n}return ut(t),null;case 13:if(Re(Ie),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Pe&&Pt!==null&&t.mode&1&&!(t.flags&128))$0(),ii(),t.flags|=98560,a=!1;else if(a=Ll(t),n!==null&&n.dehydrated!==null){if(e===null){if(!a)throw Error(F(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(F(317));a[Ar]=t}else ii(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ut(t),a=!1}else dr!==null&&(vf(dr),dr=null),a=!0;if(!a)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||Ie.current&1?Ze===0&&(Ze=3):Qp())),t.updateQueue!==null&&(t.flags|=4),ut(t),null);case 4:return li(),uf(e,t),e===null&&No(t.stateNode.containerInfo),ut(t),null;case 10:return Dp(t.type._context),ut(t),null;case 17:return Nt(t.type)&&Lc(),ut(t),null;case 19:if(Re(Ie),a=t.memoizedState,a===null)return ut(t),null;if(n=(t.flags&128)!==0,o=a.rendering,o===null)if(n)Ui(a,!1);else{if(Ze!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Vc(e),o!==null){for(t.flags|=128,Ui(a,!1),n=o.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)a=r,e=n,a.flags&=14680066,o=a.alternate,o===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,a.type=o.type,e=o.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ee(Ie,Ie.current&1|2),t.child}e=e.sibling}a.tail!==null&&Ve()>ui&&(t.flags|=128,n=!0,Ui(a,!1),t.lanes=4194304)}else{if(!n)if(e=Vc(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ui(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!Pe)return ut(t),null}else 2*Ve()-a.renderingStartTime>ui&&r!==1073741824&&(t.flags|=128,n=!0,Ui(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(r=a.last,r!==null?r.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Ve(),t.sibling=null,r=Ie.current,Ee(Ie,n?r&1|2:r&1),t):(ut(t),null);case 22:case 23:return Zp(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Ct&1073741824&&(ut(t),t.subtreeFlags&6&&(t.flags|=8192)):ut(t),null;case 24:return null;case 25:return null}throw Error(F(156,t.tag))}function VN(e,t){switch(Ap(t),t.tag){case 1:return Nt(t.type)&&Lc(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return li(),Re(St),Re(ft),Up(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return zp(t),null;case 13:if(Re(Ie),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Re(Ie),null;case 4:return li(),null;case 10:return Dp(t.type._context),null;case 22:case 23:return Zp(),null;case 24:return null;default:return null}}var Ul=!1,ht=!1,KN=typeof WeakSet=="function"?WeakSet:Set,Y=null;function Pa(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){He(e,t,n)}else r.current=null}function df(e,t,r){try{r()}catch(n){He(e,t,n)}}var ry=!1;function qN(e,t){if(Wh=Oc,e=S0(),Tp(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var s=n.anchorOffset,a=n.focusNode;n=n.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var o=0,l=-1,c=-1,u=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==r||s!==0&&h.nodeType!==3||(l=o+s),h!==a||n!==0&&h.nodeType!==3||(c=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)f=h,h=p;for(;;){if(h===e)break t;if(f===r&&++u===s&&(l=o),f===a&&++d===n&&(c=o),(p=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=p}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Gh={focusedElem:e,selectionRange:r},Oc=!1,Y=t;Y!==null;)if(t=Y,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Y=e;else for(;Y!==null;){t=Y;try{var b=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var g=b.memoizedProps,w=b.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?g:ar(t.type,g),w);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(F(163))}}catch(_){He(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,Y=e;break}Y=t.return}return b=ry,ry=!1,b}function co(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.destroy;s.destroy=void 0,a!==void 0&&df(t,r,a)}s=s.next}while(s!==n)}}function Ru(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function hf(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function wb(e){var t=e.alternate;t!==null&&(e.alternate=null,wb(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ar],delete t[Co],delete t[Zh],delete t[CN],delete t[TN])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function _b(e){return e.tag===5||e.tag===3||e.tag===4}function ny(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||_b(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ff(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Mc));else if(n!==4&&(e=e.child,e!==null))for(ff(e,t,r),e=e.sibling;e!==null;)ff(e,t,r),e=e.sibling}function pf(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(pf(e,t,r),e=e.sibling;e!==null;)pf(e,t,r),e=e.sibling}var at=null,ur=!1;function _n(e,t,r){for(r=r.child;r!==null;)kb(e,t,r),r=r.sibling}function kb(e,t,r){if(Ir&&typeof Ir.onCommitFiberUnmount=="function")try{Ir.onCommitFiberUnmount(_u,r)}catch{}switch(r.tag){case 5:ht||Pa(r,t);case 6:var n=at,s=ur;at=null,_n(e,t,r),at=n,ur=s,at!==null&&(ur?(e=at,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):at.removeChild(r.stateNode));break;case 18:at!==null&&(ur?(e=at,r=r.stateNode,e.nodeType===8?Ud(e.parentNode,r):e.nodeType===1&&Ud(e,r),ko(e)):Ud(at,r.stateNode));break;case 4:n=at,s=ur,at=r.stateNode.containerInfo,ur=!0,_n(e,t,r),at=n,ur=s;break;case 0:case 11:case 14:case 15:if(!ht&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){s=n=n.next;do{var a=s,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&df(r,t,o),s=s.next}while(s!==n)}_n(e,t,r);break;case 1:if(!ht&&(Pa(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){He(r,t,l)}_n(e,t,r);break;case 21:_n(e,t,r);break;case 22:r.mode&1?(ht=(n=ht)||r.memoizedState!==null,_n(e,t,r),ht=n):_n(e,t,r);break;default:_n(e,t,r)}}function sy(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new KN),t.forEach(function(n){var s=tE.bind(null,e,n);r.has(n)||(r.add(n),n.then(s,s))})}}function rr(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var s=r[n];try{var a=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:at=l.stateNode,ur=!1;break e;case 3:at=l.stateNode.containerInfo,ur=!0;break e;case 4:at=l.stateNode.containerInfo,ur=!0;break e}l=l.return}if(at===null)throw Error(F(160));kb(a,o,s),at=null,ur=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){He(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)jb(t,e),t=t.sibling}function jb(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(rr(t,e),kr(e),n&4){try{co(3,e,e.return),Ru(3,e)}catch(g){He(e,e.return,g)}try{co(5,e,e.return)}catch(g){He(e,e.return,g)}}break;case 1:rr(t,e),kr(e),n&512&&r!==null&&Pa(r,r.return);break;case 5:if(rr(t,e),kr(e),n&512&&r!==null&&Pa(r,r.return),e.flags&32){var s=e.stateNode;try{xo(s,"")}catch(g){He(e,e.return,g)}}if(n&4&&(s=e.stateNode,s!=null)){var a=e.memoizedProps,o=r!==null?r.memoizedProps:a,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&a.type==="radio"&&a.name!=null&&qx(s,a),Lh(l,o);var u=Lh(l,a);for(o=0;o<c.length;o+=2){var d=c[o],h=c[o+1];d==="style"?Zx(s,h):d==="dangerouslySetInnerHTML"?Yx(s,h):d==="children"?xo(s,h):gp(s,d,h,u)}switch(l){case"input":Ph(s,a);break;case"textarea":Wx(s,a);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!a.multiple;var p=a.value;p!=null?Ma(s,!!a.multiple,p,!1):f!==!!a.multiple&&(a.defaultValue!=null?Ma(s,!!a.multiple,a.defaultValue,!0):Ma(s,!!a.multiple,a.multiple?[]:"",!1))}s[Co]=a}catch(g){He(e,e.return,g)}}break;case 6:if(rr(t,e),kr(e),n&4){if(e.stateNode===null)throw Error(F(162));s=e.stateNode,a=e.memoizedProps;try{s.nodeValue=a}catch(g){He(e,e.return,g)}}break;case 3:if(rr(t,e),kr(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{ko(t.containerInfo)}catch(g){He(e,e.return,g)}break;case 4:rr(t,e),kr(e);break;case 13:rr(t,e),kr(e),s=e.child,s.flags&8192&&(a=s.memoizedState!==null,s.stateNode.isHidden=a,!a||s.alternate!==null&&s.alternate.memoizedState!==null||(Yp=Ve())),n&4&&sy(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(ht=(u=ht)||d,rr(t,e),ht=u):rr(t,e),kr(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Y=e,d=e.child;d!==null;){for(h=Y=d;Y!==null;){switch(f=Y,p=f.child,f.tag){case 0:case 11:case 14:case 15:co(4,f,f.return);break;case 1:Pa(f,f.return);var b=f.stateNode;if(typeof b.componentWillUnmount=="function"){n=f,r=f.return;try{t=n,b.props=t.memoizedProps,b.state=t.memoizedState,b.componentWillUnmount()}catch(g){He(n,r,g)}}break;case 5:Pa(f,f.return);break;case 22:if(f.memoizedState!==null){iy(h);continue}}p!==null?(p.return=f,Y=p):iy(h)}d=d.sibling}e:for(d=null,h=e;;){if(h.tag===5){if(d===null){d=h;try{s=h.stateNode,u?(a=s.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Jx("display",o))}catch(g){He(e,e.return,g)}}}else if(h.tag===6){if(d===null)try{h.stateNode.nodeValue=u?"":h.memoizedProps}catch(g){He(e,e.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===e)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;h.sibling===null;){if(h.return===null||h.return===e)break e;d===h&&(d=null),h=h.return}d===h&&(d=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:rr(t,e),kr(e),n&4&&sy(e);break;case 21:break;default:rr(t,e),kr(e)}}function kr(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(_b(r)){var n=r;break e}r=r.return}throw Error(F(160))}switch(n.tag){case 5:var s=n.stateNode;n.flags&32&&(xo(s,""),n.flags&=-33);var a=ny(e);pf(e,a,s);break;case 3:case 4:var o=n.stateNode.containerInfo,l=ny(e);ff(e,l,o);break;default:throw Error(F(161))}}catch(c){He(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function WN(e,t,r){Y=e,Sb(e)}function Sb(e,t,r){for(var n=(e.mode&1)!==0;Y!==null;){var s=Y,a=s.child;if(s.tag===22&&n){var o=s.memoizedState!==null||Ul;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||ht;l=Ul;var u=ht;if(Ul=o,(ht=c)&&!u)for(Y=s;Y!==null;)o=Y,c=o.child,o.tag===22&&o.memoizedState!==null?oy(s):c!==null?(c.return=o,Y=c):oy(s);for(;a!==null;)Y=a,Sb(a),a=a.sibling;Y=s,Ul=l,ht=u}ay(e)}else s.subtreeFlags&8772&&a!==null?(a.return=s,Y=a):ay(e)}}function ay(e){for(;Y!==null;){var t=Y;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:ht||Ru(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!ht)if(r===null)n.componentDidMount();else{var s=t.elementType===t.type?r.memoizedProps:ar(t.type,r.memoizedProps);n.componentDidUpdate(s,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&Hg(t,a,n);break;case 3:var o=t.updateQueue;if(o!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}Hg(t,o,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var h=d.dehydrated;h!==null&&ko(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(F(163))}ht||t.flags&512&&hf(t)}catch(f){He(t,t.return,f)}}if(t===e){Y=null;break}if(r=t.sibling,r!==null){r.return=t.return,Y=r;break}Y=t.return}}function iy(e){for(;Y!==null;){var t=Y;if(t===e){Y=null;break}var r=t.sibling;if(r!==null){r.return=t.return,Y=r;break}Y=t.return}}function oy(e){for(;Y!==null;){var t=Y;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Ru(4,t)}catch(c){He(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var s=t.return;try{n.componentDidMount()}catch(c){He(t,s,c)}}var a=t.return;try{hf(t)}catch(c){He(t,a,c)}break;case 5:var o=t.return;try{hf(t)}catch(c){He(t,o,c)}}}catch(c){He(t,t.return,c)}if(t===e){Y=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Y=l;break}Y=t.return}}var GN=Math.ceil,Wc=hn.ReactCurrentDispatcher,Wp=hn.ReactCurrentOwner,Gt=hn.ReactCurrentBatchConfig,ve=0,tt=null,We=null,it=0,Ct=0,Oa=cs(0),Ze=0,Io=null,$s=0,Au=0,Gp=0,uo=null,kt=null,Yp=0,ui=1/0,Yr=null,Gc=!1,mf=null,Zn=null,Fl=!1,Fn=null,Yc=0,ho=0,gf=null,yc=-1,vc=0;function yt(){return ve&6?Ve():yc!==-1?yc:yc=Ve()}function Qn(e){return e.mode&1?ve&2&&it!==0?it&-it:AN.transition!==null?(vc===0&&(vc=c0()),vc):(e=je,e!==0||(e=window.event,e=e===void 0?16:g0(e.type)),e):1}function mr(e,t,r,n){if(50<ho)throw ho=0,gf=null,Error(F(185));sl(e,r,n),(!(ve&2)||e!==tt)&&(e===tt&&(!(ve&2)&&(Au|=r),Ze===4&&Pn(e,it)),Et(e,n),r===1&&ve===0&&!(t.mode&1)&&(ui=Ve()+500,Eu&&us()))}function Et(e,t){var r=e.callbackNode;AS(e,t);var n=Pc(e,e===tt?it:0);if(n===0)r!==null&&gg(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&gg(r),t===1)e.tag===0?RN(ly.bind(null,e)):D0(ly.bind(null,e)),NN(function(){!(ve&6)&&us()}),r=null;else{switch(u0(n)){case 1:r=wp;break;case 4:r=o0;break;case 16:r=Ac;break;case 536870912:r=l0;break;default:r=Ac}r=Ob(r,Nb.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Nb(e,t){if(yc=-1,vc=0,ve&6)throw Error(F(327));var r=e.callbackNode;if(Fa()&&e.callbackNode!==r)return null;var n=Pc(e,e===tt?it:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Jc(e,n);else{t=n;var s=ve;ve|=2;var a=Cb();(tt!==e||it!==t)&&(Yr=null,ui=Ve()+500,Ps(e,t));do try{ZN();break}catch(l){Eb(e,l)}while(!0);Ip(),Wc.current=a,ve=s,We!==null?t=0:(tt=null,it=0,t=Ze)}if(t!==0){if(t===2&&(s=Bh(e),s!==0&&(n=s,t=yf(e,s))),t===1)throw r=Io,Ps(e,0),Pn(e,n),Et(e,Ve()),r;if(t===6)Pn(e,n);else{if(s=e.current.alternate,!(n&30)&&!YN(s)&&(t=Jc(e,n),t===2&&(a=Bh(e),a!==0&&(n=a,t=yf(e,a))),t===1))throw r=Io,Ps(e,0),Pn(e,n),Et(e,Ve()),r;switch(e.finishedWork=s,e.finishedLanes=n,t){case 0:case 1:throw Error(F(345));case 2:vs(e,kt,Yr);break;case 3:if(Pn(e,n),(n&130023424)===n&&(t=Yp+500-Ve(),10<t)){if(Pc(e,0)!==0)break;if(s=e.suspendedLanes,(s&n)!==n){yt(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Jh(vs.bind(null,e,kt,Yr),t);break}vs(e,kt,Yr);break;case 4:if(Pn(e,n),(n&4194240)===n)break;for(t=e.eventTimes,s=-1;0<n;){var o=31-pr(n);a=1<<o,o=t[o],o>s&&(s=o),n&=~a}if(n=s,n=Ve()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*GN(n/1960))-n,10<n){e.timeoutHandle=Jh(vs.bind(null,e,kt,Yr),n);break}vs(e,kt,Yr);break;case 5:vs(e,kt,Yr);break;default:throw Error(F(329))}}}return Et(e,Ve()),e.callbackNode===r?Nb.bind(null,e):null}function yf(e,t){var r=uo;return e.current.memoizedState.isDehydrated&&(Ps(e,t).flags|=256),e=Jc(e,t),e!==2&&(t=kt,kt=r,t!==null&&vf(t)),e}function vf(e){kt===null?kt=e:kt.push.apply(kt,e)}function YN(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var s=r[n],a=s.getSnapshot;s=s.value;try{if(!gr(a(),s))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Pn(e,t){for(t&=~Gp,t&=~Au,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-pr(t),n=1<<r;e[r]=-1,t&=~n}}function ly(e){if(ve&6)throw Error(F(327));Fa();var t=Pc(e,0);if(!(t&1))return Et(e,Ve()),null;var r=Jc(e,t);if(e.tag!==0&&r===2){var n=Bh(e);n!==0&&(t=n,r=yf(e,n))}if(r===1)throw r=Io,Ps(e,0),Pn(e,t),Et(e,Ve()),r;if(r===6)throw Error(F(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,vs(e,kt,Yr),Et(e,Ve()),null}function Jp(e,t){var r=ve;ve|=1;try{return e(t)}finally{ve=r,ve===0&&(ui=Ve()+500,Eu&&us())}}function zs(e){Fn!==null&&Fn.tag===0&&!(ve&6)&&Fa();var t=ve;ve|=1;var r=Gt.transition,n=je;try{if(Gt.transition=null,je=1,e)return e()}finally{je=n,Gt.transition=r,ve=t,!(ve&6)&&us()}}function Zp(){Ct=Oa.current,Re(Oa)}function Ps(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,SN(r)),We!==null)for(r=We.return;r!==null;){var n=r;switch(Ap(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Lc();break;case 3:li(),Re(St),Re(ft),Up();break;case 5:zp(n);break;case 4:li();break;case 13:Re(Ie);break;case 19:Re(Ie);break;case 10:Dp(n.type._context);break;case 22:case 23:Zp()}r=r.return}if(tt=e,We=e=Xn(e.current,null),it=Ct=t,Ze=0,Io=null,Gp=Au=$s=0,kt=uo=null,_s!==null){for(t=0;t<_s.length;t++)if(r=_s[t],n=r.interleaved,n!==null){r.interleaved=null;var s=n.next,a=r.pending;if(a!==null){var o=a.next;a.next=s,n.next=o}r.pending=n}_s=null}return e}function Eb(e,t){do{var r=We;try{if(Ip(),pc.current=qc,Kc){for(var n=De.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}Kc=!1}if(Ls=0,et=Je=De=null,lo=!1,Ao=0,Wp.current=null,r===null||r.return===null){Ze=1,Io=t,We=null;break}e:{var a=e,o=r.return,l=r,c=t;if(t=it,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,h=d.tag;if(!(d.mode&1)&&(h===0||h===11||h===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=Yg(o);if(p!==null){p.flags&=-257,Jg(p,o,l,a,t),p.mode&1&&Gg(a,u,t),t=p,c=u;var b=t.updateQueue;if(b===null){var g=new Set;g.add(c),t.updateQueue=g}else b.add(c);break e}else{if(!(t&1)){Gg(a,u,t),Qp();break e}c=Error(F(426))}}else if(Pe&&l.mode&1){var w=Yg(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Jg(w,o,l,a,t),Pp(ci(c,l));break e}}a=c=ci(c,l),Ze!==4&&(Ze=2),uo===null?uo=[a]:uo.push(a),a=o;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var y=ub(a,c,t);Bg(a,y);break e;case 1:l=c;var v=a.type,x=a.stateNode;if(!(a.flags&128)&&(typeof v.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Zn===null||!Zn.has(x)))){a.flags|=65536,t&=-t,a.lanes|=t;var _=db(a,l,t);Bg(a,_);break e}}a=a.return}while(a!==null)}Rb(r)}catch(j){t=j,We===r&&r!==null&&(We=r=r.return);continue}break}while(!0)}function Cb(){var e=Wc.current;return Wc.current=qc,e===null?qc:e}function Qp(){(Ze===0||Ze===3||Ze===2)&&(Ze=4),tt===null||!($s&268435455)&&!(Au&268435455)||Pn(tt,it)}function Jc(e,t){var r=ve;ve|=2;var n=Cb();(tt!==e||it!==t)&&(Yr=null,Ps(e,t));do try{JN();break}catch(s){Eb(e,s)}while(!0);if(Ip(),ve=r,Wc.current=n,We!==null)throw Error(F(261));return tt=null,it=0,Ze}function JN(){for(;We!==null;)Tb(We)}function ZN(){for(;We!==null&&!_S();)Tb(We)}function Tb(e){var t=Pb(e.alternate,e,Ct);e.memoizedProps=e.pendingProps,t===null?Rb(e):We=t,Wp.current=null}function Rb(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=VN(r,t),r!==null){r.flags&=32767,We=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ze=6,We=null;return}}else if(r=HN(r,t,Ct),r!==null){We=r;return}if(t=t.sibling,t!==null){We=t;return}We=t=e}while(t!==null);Ze===0&&(Ze=5)}function vs(e,t,r){var n=je,s=Gt.transition;try{Gt.transition=null,je=1,QN(e,t,r,n)}finally{Gt.transition=s,je=n}return null}function QN(e,t,r,n){do Fa();while(Fn!==null);if(ve&6)throw Error(F(327));r=e.finishedWork;var s=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(F(177));e.callbackNode=null,e.callbackPriority=0;var a=r.lanes|r.childLanes;if(PS(e,a),e===tt&&(We=tt=null,it=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||Fl||(Fl=!0,Ob(Ac,function(){return Fa(),null})),a=(r.flags&15990)!==0,r.subtreeFlags&15990||a){a=Gt.transition,Gt.transition=null;var o=je;je=1;var l=ve;ve|=4,Wp.current=null,qN(e,r),jb(r,e),vN(Gh),Oc=!!Wh,Gh=Wh=null,e.current=r,WN(r),kS(),ve=l,je=o,Gt.transition=a}else e.current=r;if(Fl&&(Fl=!1,Fn=e,Yc=s),a=e.pendingLanes,a===0&&(Zn=null),NS(r.stateNode),Et(e,Ve()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)s=t[r],n(s.value,{componentStack:s.stack,digest:s.digest});if(Gc)throw Gc=!1,e=mf,mf=null,e;return Yc&1&&e.tag!==0&&Fa(),a=e.pendingLanes,a&1?e===gf?ho++:(ho=0,gf=e):ho=0,us(),null}function Fa(){if(Fn!==null){var e=u0(Yc),t=Gt.transition,r=je;try{if(Gt.transition=null,je=16>e?16:e,Fn===null)var n=!1;else{if(e=Fn,Fn=null,Yc=0,ve&6)throw Error(F(331));var s=ve;for(ve|=4,Y=e.current;Y!==null;){var a=Y,o=a.child;if(Y.flags&16){var l=a.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Y=u;Y!==null;){var d=Y;switch(d.tag){case 0:case 11:case 15:co(8,d,a)}var h=d.child;if(h!==null)h.return=d,Y=h;else for(;Y!==null;){d=Y;var f=d.sibling,p=d.return;if(wb(d),d===u){Y=null;break}if(f!==null){f.return=p,Y=f;break}Y=p}}}var b=a.alternate;if(b!==null){var g=b.child;if(g!==null){b.child=null;do{var w=g.sibling;g.sibling=null,g=w}while(g!==null)}}Y=a}}if(a.subtreeFlags&2064&&o!==null)o.return=a,Y=o;else e:for(;Y!==null;){if(a=Y,a.flags&2048)switch(a.tag){case 0:case 11:case 15:co(9,a,a.return)}var y=a.sibling;if(y!==null){y.return=a.return,Y=y;break e}Y=a.return}}var v=e.current;for(Y=v;Y!==null;){o=Y;var x=o.child;if(o.subtreeFlags&2064&&x!==null)x.return=o,Y=x;else e:for(o=v;Y!==null;){if(l=Y,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ru(9,l)}}catch(j){He(l,l.return,j)}if(l===o){Y=null;break e}var _=l.sibling;if(_!==null){_.return=l.return,Y=_;break e}Y=l.return}}if(ve=s,us(),Ir&&typeof Ir.onPostCommitFiberRoot=="function")try{Ir.onPostCommitFiberRoot(_u,e)}catch{}n=!0}return n}finally{je=r,Gt.transition=t}}return!1}function cy(e,t,r){t=ci(r,t),t=ub(e,t,1),e=Jn(e,t,1),t=yt(),e!==null&&(sl(e,1,t),Et(e,t))}function He(e,t,r){if(e.tag===3)cy(e,e,r);else for(;t!==null;){if(t.tag===3){cy(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Zn===null||!Zn.has(n))){e=ci(r,e),e=db(t,e,1),t=Jn(t,e,1),e=yt(),t!==null&&(sl(t,1,e),Et(t,e));break}}t=t.return}}function XN(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=yt(),e.pingedLanes|=e.suspendedLanes&r,tt===e&&(it&r)===r&&(Ze===4||Ze===3&&(it&130023424)===it&&500>Ve()-Yp?Ps(e,0):Gp|=r),Et(e,t)}function Ab(e,t){t===0&&(e.mode&1?(t=Al,Al<<=1,!(Al&130023424)&&(Al=4194304)):t=1);var r=yt();e=an(e,t),e!==null&&(sl(e,t,r),Et(e,r))}function eE(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Ab(e,r)}function tE(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,s=e.memoizedState;s!==null&&(r=s.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(F(314))}n!==null&&n.delete(t),Ab(e,r)}var Pb;Pb=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||St.current)jt=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return jt=!1,BN(e,t,r);jt=!!(e.flags&131072)}else jt=!1,Pe&&t.flags&1048576&&M0(t,Uc,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;gc(e,t),e=t.pendingProps;var s=ai(t,ft.current);Ua(t,r),s=Bp(null,t,n,e,s,r);var a=Hp();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Nt(n)?(a=!0,$c(t)):a=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Lp(t),s.updater=Tu,t.stateNode=s,s._reactInternals=t,nf(t,n,e,r),t=of(null,t,n,!0,a,r)):(t.tag=0,Pe&&a&&Rp(t),mt(null,t,s,r),t=t.child),t;case 16:n=t.elementType;e:{switch(gc(e,t),e=t.pendingProps,s=n._init,n=s(n._payload),t.type=n,s=t.tag=nE(n),e=ar(n,e),s){case 0:t=af(null,t,n,e,r);break e;case 1:t=Xg(null,t,n,e,r);break e;case 11:t=Zg(null,t,n,e,r);break e;case 14:t=Qg(null,t,n,ar(n.type,e),r);break e}throw Error(F(306,n,""))}return t;case 0:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:ar(n,s),af(e,t,n,s,r);case 1:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:ar(n,s),Xg(e,t,n,s,r);case 3:e:{if(mb(t),e===null)throw Error(F(387));n=t.pendingProps,a=t.memoizedState,s=a.element,B0(e,t),Hc(t,n,null,r);var o=t.memoizedState;if(n=o.element,a.isDehydrated)if(a={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){s=ci(Error(F(423)),t),t=ey(e,t,n,r,s);break e}else if(n!==s){s=ci(Error(F(424)),t),t=ey(e,t,n,r,s);break e}else for(Pt=Yn(t.stateNode.containerInfo.firstChild),Ot=t,Pe=!0,dr=null,r=U0(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(ii(),n===s){t=on(e,t,r);break e}mt(e,t,n,r)}t=t.child}return t;case 5:return H0(t),e===null&&ef(t),n=t.type,s=t.pendingProps,a=e!==null?e.memoizedProps:null,o=s.children,Yh(n,s)?o=null:a!==null&&Yh(n,a)&&(t.flags|=32),pb(e,t),mt(e,t,o,r),t.child;case 6:return e===null&&ef(t),null;case 13:return gb(e,t,r);case 4:return $p(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=oi(t,null,n,r):mt(e,t,n,r),t.child;case 11:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:ar(n,s),Zg(e,t,n,s,r);case 7:return mt(e,t,t.pendingProps,r),t.child;case 8:return mt(e,t,t.pendingProps.children,r),t.child;case 12:return mt(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,s=t.pendingProps,a=t.memoizedProps,o=s.value,Ee(Fc,n._currentValue),n._currentValue=o,a!==null)if(gr(a.value,o)){if(a.children===s.children&&!St.current){t=on(e,t,r);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(a.tag===1){c=rn(-1,r&-r),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=r,c=a.alternate,c!==null&&(c.lanes|=r),tf(a.return,r,t),l.lanes|=r;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(F(341));o.lanes|=r,l=o.alternate,l!==null&&(l.lanes|=r),tf(o,r,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}mt(e,t,s.children,r),t=t.child}return t;case 9:return s=t.type,n=t.pendingProps.children,Ua(t,r),s=Jt(s),n=n(s),t.flags|=1,mt(e,t,n,r),t.child;case 14:return n=t.type,s=ar(n,t.pendingProps),s=ar(n.type,s),Qg(e,t,n,s,r);case 15:return hb(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,s=t.pendingProps,s=t.elementType===n?s:ar(n,s),gc(e,t),t.tag=1,Nt(n)?(e=!0,$c(t)):e=!1,Ua(t,r),cb(t,n,s),nf(t,n,s,r),of(null,t,n,!0,e,r);case 19:return yb(e,t,r);case 22:return fb(e,t,r)}throw Error(F(156,t.tag))};function Ob(e,t){return i0(e,t)}function rE(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qt(e,t,r,n){return new rE(e,t,r,n)}function Xp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function nE(e){if(typeof e=="function")return Xp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===vp)return 11;if(e===xp)return 14}return 2}function Xn(e,t){var r=e.alternate;return r===null?(r=qt(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function xc(e,t,r,n,s,a){var o=2;if(n=e,typeof e=="function")Xp(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ka:return Os(r.children,s,a,t);case yp:o=8,s|=8;break;case Eh:return e=qt(12,r,t,s|2),e.elementType=Eh,e.lanes=a,e;case Ch:return e=qt(13,r,t,s),e.elementType=Ch,e.lanes=a,e;case Th:return e=qt(19,r,t,s),e.elementType=Th,e.lanes=a,e;case Hx:return Pu(r,s,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fx:o=10;break e;case Bx:o=9;break e;case vp:o=11;break e;case xp:o=14;break e;case Cn:o=16,n=null;break e}throw Error(F(130,e==null?e:typeof e,""))}return t=qt(o,r,t,s),t.elementType=e,t.type=n,t.lanes=a,t}function Os(e,t,r,n){return e=qt(7,e,n,t),e.lanes=r,e}function Pu(e,t,r,n){return e=qt(22,e,n,t),e.elementType=Hx,e.lanes=r,e.stateNode={isHidden:!1},e}function Gd(e,t,r){return e=qt(6,e,null,t),e.lanes=r,e}function Yd(e,t,r){return t=qt(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sE(e,t,r,n,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Td(0),this.expirationTimes=Td(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Td(0),this.identifierPrefix=n,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function em(e,t,r,n,s,a,o,l,c){return e=new sE(e,t,r,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=qt(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lp(a),e}function aE(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_a,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function Ib(e){if(!e)return ns;e=e._reactInternals;e:{if(Ks(e)!==e||e.tag!==1)throw Error(F(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Nt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(F(171))}if(e.tag===1){var r=e.type;if(Nt(r))return I0(e,r,t)}return t}function Db(e,t,r,n,s,a,o,l,c){return e=em(r,n,!0,e,s,a,o,l,c),e.context=Ib(null),r=e.current,n=yt(),s=Qn(r),a=rn(n,s),a.callback=t??null,Jn(r,a,s),e.current.lanes=s,sl(e,s,n),Et(e,n),e}function Ou(e,t,r,n){var s=t.current,a=yt(),o=Qn(s);return r=Ib(r),t.context===null?t.context=r:t.pendingContext=r,t=rn(a,o),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=Jn(s,t,o),e!==null&&(mr(e,s,o,a),fc(e,s,o)),o}function Zc(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function uy(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function tm(e,t){uy(e,t),(e=e.alternate)&&uy(e,t)}function iE(){return null}var Mb=typeof reportError=="function"?reportError:function(e){console.error(e)};function rm(e){this._internalRoot=e}Iu.prototype.render=rm.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(F(409));Ou(e,t,null,null)};Iu.prototype.unmount=rm.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;zs(function(){Ou(null,e,null,null)}),t[sn]=null}};function Iu(e){this._internalRoot=e}Iu.prototype.unstable_scheduleHydration=function(e){if(e){var t=f0();e={blockedOn:null,target:e,priority:t};for(var r=0;r<An.length&&t!==0&&t<An[r].priority;r++);An.splice(r,0,e),r===0&&m0(e)}};function nm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Du(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dy(){}function oE(e,t,r,n,s){if(s){if(typeof n=="function"){var a=n;n=function(){var u=Zc(o);a.call(u)}}var o=Db(t,n,e,0,null,!1,!1,"",dy);return e._reactRootContainer=o,e[sn]=o.current,No(e.nodeType===8?e.parentNode:e),zs(),o}for(;s=e.lastChild;)e.removeChild(s);if(typeof n=="function"){var l=n;n=function(){var u=Zc(c);l.call(u)}}var c=em(e,0,!1,null,null,!1,!1,"",dy);return e._reactRootContainer=c,e[sn]=c.current,No(e.nodeType===8?e.parentNode:e),zs(function(){Ou(t,c,r,n)}),c}function Mu(e,t,r,n,s){var a=r._reactRootContainer;if(a){var o=a;if(typeof s=="function"){var l=s;s=function(){var c=Zc(o);l.call(c)}}Ou(t,o,e,s)}else o=oE(r,t,e,s,n);return Zc(o)}d0=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Ji(t.pendingLanes);r!==0&&(_p(t,r|1),Et(t,Ve()),!(ve&6)&&(ui=Ve()+500,us()))}break;case 13:zs(function(){var n=an(e,1);if(n!==null){var s=yt();mr(n,e,1,s)}}),tm(e,1)}};kp=function(e){if(e.tag===13){var t=an(e,134217728);if(t!==null){var r=yt();mr(t,e,134217728,r)}tm(e,134217728)}};h0=function(e){if(e.tag===13){var t=Qn(e),r=an(e,t);if(r!==null){var n=yt();mr(r,e,t,n)}tm(e,t)}};f0=function(){return je};p0=function(e,t){var r=je;try{return je=e,t()}finally{je=r}};zh=function(e,t,r){switch(t){case"input":if(Ph(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var s=Nu(n);if(!s)throw Error(F(90));Kx(n),Ph(n,s)}}}break;case"textarea":Wx(e,r);break;case"select":t=r.value,t!=null&&Ma(e,!!r.multiple,t,!1)}};e0=Jp;t0=zs;var lE={usingClientEntryPoint:!1,Events:[il,Ea,Nu,Qx,Xx,Jp]},Fi={findFiberByHostInstance:ws,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},cE={bundleType:Fi.bundleType,version:Fi.version,rendererPackageName:Fi.rendererPackageName,rendererConfig:Fi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:hn.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=s0(e),e===null?null:e.stateNode},findFiberByHostInstance:Fi.findFiberByHostInstance||iE,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bl.isDisabled&&Bl.supportsFiber)try{_u=Bl.inject(cE),Ir=Bl}catch{}}$t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=lE;$t.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!nm(t))throw Error(F(200));return aE(e,t,null,r)};$t.createRoot=function(e,t){if(!nm(e))throw Error(F(299));var r=!1,n="",s=Mb;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=em(e,1,!1,null,null,r,!1,n,s),e[sn]=t.current,No(e.nodeType===8?e.parentNode:e),new rm(t)};$t.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(F(188)):(e=Object.keys(e).join(","),Error(F(268,e)));return e=s0(t),e=e===null?null:e.stateNode,e};$t.flushSync=function(e){return zs(e)};$t.hydrate=function(e,t,r){if(!Du(t))throw Error(F(200));return Mu(null,e,t,!0,r)};$t.hydrateRoot=function(e,t,r){if(!nm(e))throw Error(F(405));var n=r!=null&&r.hydratedSources||null,s=!1,a="",o=Mb;if(r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(a=r.identifierPrefix),r.onRecoverableError!==void 0&&(o=r.onRecoverableError)),t=Db(t,null,e,1,r??null,s,!1,a,o),e[sn]=t.current,No(e),n)for(e=0;e<n.length;e++)r=n[e],s=r._getVersion,s=s(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,s]:t.mutableSourceEagerHydrationData.push(r,s);return new Iu(t)};$t.render=function(e,t,r){if(!Du(t))throw Error(F(200));return Mu(null,e,t,!1,r)};$t.unmountComponentAtNode=function(e){if(!Du(e))throw Error(F(40));return e._reactRootContainer?(zs(function(){Mu(null,null,e,!1,function(){e._reactRootContainer=null,e[sn]=null})}),!0):!1};$t.unstable_batchedUpdates=Jp;$t.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Du(r))throw Error(F(200));if(e==null||e._reactInternals===void 0)throw Error(F(38));return Mu(e,t,r,!1,n)};$t.version="18.3.1-next-f1338f8080-20240426";function Lb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Lb)}catch(e){console.error(e)}}Lb(),Lx.exports=$t;var ll=Lx.exports;const $b=rl(ll);var zb,hy=ll;zb=hy.createRoot,hy.hydrateRoot;var uE=typeof Element<"u",dE=typeof Map=="function",hE=typeof Set=="function",fE=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function bc(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,s;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!bc(e[n],t[n]))return!1;return!0}var a;if(dE&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;for(a=e.entries();!(n=a.next()).done;)if(!bc(n.value[1],t.get(n.value[0])))return!1;return!0}if(hE&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(fE&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[n]))return!1;if(uE&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((s[n]==="_owner"||s[n]==="__v"||s[n]==="__o")&&e.$$typeof)&&!bc(e[s[n]],t[s[n]]))return!1;return!0}return e!==e&&t!==t}var pE=function(t,r){try{return bc(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const mE=rl(pE);var gE=function(e,t,r,n,s,a,o,l){if(!e){var c;if(t===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[r,n,s,a,o,l],d=0;c=new Error(t.replace(/%s/g,function(){return u[d++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},yE=gE;const fy=rl(yE);var vE=function(t,r,n,s){var a=n?n.call(s,t,r):void 0;if(a!==void 0)return!!a;if(t===r)return!0;if(typeof t!="object"||!t||typeof r!="object"||!r)return!1;var o=Object.keys(t),l=Object.keys(r);if(o.length!==l.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(r),u=0;u<o.length;u++){var d=o[u];if(!c(d))return!1;var h=t[d],f=r[d];if(a=n?n.call(s,h,f,d):void 0,a===!1||a===void 0&&h!==f)return!1}return!0};const xE=rl(vE);var Ub=(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))(Ub||{}),Jd={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"]}},py=Object.values(Ub),sm={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},bE=Object.entries(sm).reduce((e,[t,r])=>(e[r]=t,e),{}),fr="data-rh",Ba={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},Ha=(e,t)=>{for(let r=e.length-1;r>=0;r-=1){const n=e[r];if(Object.prototype.hasOwnProperty.call(n,t))return n[t]}return null},wE=e=>{let t=Ha(e,"title");const r=Ha(e,Ba.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),r&&t)return r.replace(/%s/g,()=>t);const n=Ha(e,Ba.DEFAULT_TITLE);return t||n||void 0},_E=e=>Ha(e,Ba.ON_CHANGE_CLIENT_STATE)||(()=>{}),Zd=(e,t)=>t.filter(r=>typeof r[e]<"u").map(r=>r[e]).reduce((r,n)=>({...r,...n}),{}),kE=(e,t)=>t.filter(r=>typeof r.base<"u").map(r=>r.base).reverse().reduce((r,n)=>{if(!r.length){const s=Object.keys(n);for(let a=0;a<s.length;a+=1){const l=s[a].toLowerCase();if(e.indexOf(l)!==-1&&n[l])return r.concat(n)}}return r},[]),jE=e=>console&&typeof console.warn=="function"&&console.warn(e),Bi=(e,t,r)=>{const n={};return r.filter(s=>Array.isArray(s[e])?!0:(typeof s[e]<"u"&&jE(`Helmet: ${e} should be of type "Array". Instead found type "${typeof s[e]}"`),!1)).map(s=>s[e]).reverse().reduce((s,a)=>{const o={};a.filter(c=>{let u;const d=Object.keys(c);for(let f=0;f<d.length;f+=1){const p=d[f],b=p.toLowerCase();t.indexOf(b)!==-1&&!(u==="rel"&&c[u].toLowerCase()==="canonical")&&!(b==="rel"&&c[b].toLowerCase()==="stylesheet")&&(u=b),t.indexOf(p)!==-1&&(p==="innerHTML"||p==="cssText"||p==="itemprop")&&(u=p)}if(!u||!c[u])return!1;const h=c[u].toLowerCase();return n[u]||(n[u]={}),o[u]||(o[u]={}),n[u][h]?!1:(o[u][h]=!0,!0)}).reverse().forEach(c=>s.push(c));const l=Object.keys(o);for(let c=0;c<l.length;c+=1){const u=l[c],d={...n[u],...o[u]};n[u]=d}return s},[]).reverse()},SE=(e,t)=>{if(Array.isArray(e)&&e.length){for(let r=0;r<e.length;r+=1)if(e[r][t])return!0}return!1},NE=e=>({baseTag:kE(["href"],e),bodyAttributes:Zd("bodyAttributes",e),defer:Ha(e,Ba.DEFER),encode:Ha(e,Ba.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Zd("htmlAttributes",e),linkTags:Bi("link",["rel","href"],e),metaTags:Bi("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:Bi("noscript",["innerHTML"],e),onChangeClientState:_E(e),scriptTags:Bi("script",["src","innerHTML"],e),styleTags:Bi("style",["cssText"],e),title:wE(e),titleAttributes:Zd("titleAttributes",e),prioritizeSeoTags:SE(e,Ba.PRIORITIZE_SEO_TAGS)}),Fb=e=>Array.isArray(e)?e.join(""):e,EE=(e,t)=>{const r=Object.keys(e);for(let n=0;n<r.length;n+=1)if(t[r[n]]&&t[r[n]].includes(e[r[n]]))return!0;return!1},Qd=(e,t)=>Array.isArray(e)?e.reduce((r,n)=>(EE(n,t)?r.priority.push(n):r.default.push(n),r),{priority:[],default:[]}):{default:e,priority:[]},my=(e,t)=>({...e,[t]:void 0}),CE=["noscript","script","style"],xf=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Bb=e=>Object.keys(e).reduce((t,r)=>{const n=typeof e[r]<"u"?`${r}="${e[r]}"`:`${r}`;return t?`${t} ${n}`:n},""),TE=(e,t,r,n)=>{const s=Bb(r),a=Fb(t);return s?`<${e} ${fr}="true" ${s}>${xf(a,n)}</${e}>`:`<${e} ${fr}="true">${xf(a,n)}</${e}>`},RE=(e,t,r=!0)=>t.reduce((n,s)=>{const a=s,o=Object.keys(a).filter(u=>!(u==="innerHTML"||u==="cssText")).reduce((u,d)=>{const h=typeof a[d]>"u"?d:`${d}="${xf(a[d],r)}"`;return u?`${u} ${h}`:h},""),l=a.innerHTML||a.cssText||"",c=CE.indexOf(e)===-1;return`${n}<${e} ${fr}="true" ${o}${c?"/>":`>${l}</${e}>`}`},""),Hb=(e,t={})=>Object.keys(e).reduce((r,n)=>{const s=sm[n];return r[s||n]=e[n],r},t),AE=(e,t,r)=>{const n={key:t,[fr]:!0},s=Hb(r,n);return[B.createElement("title",s,t)]},wc=(e,t)=>t.map((r,n)=>{const s={key:n,[fr]:!0};return Object.keys(r).forEach(a=>{const l=sm[a]||a;if(l==="innerHTML"||l==="cssText"){const c=r.innerHTML||r.cssText;s.dangerouslySetInnerHTML={__html:c}}else s[l]=r[a]}),B.createElement(e,s)}),Bt=(e,t,r=!0)=>{switch(e){case"title":return{toComponent:()=>AE(e,t.title,t.titleAttributes),toString:()=>TE(e,t.title,t.titleAttributes,r)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Hb(t),toString:()=>Bb(t)};default:return{toComponent:()=>wc(e,t),toString:()=>RE(e,t,r)}}},PE=({metaTags:e,linkTags:t,scriptTags:r,encode:n})=>{const s=Qd(e,Jd.meta),a=Qd(t,Jd.link),o=Qd(r,Jd.script);return{priorityMethods:{toComponent:()=>[...wc("meta",s.priority),...wc("link",a.priority),...wc("script",o.priority)],toString:()=>`${Bt("meta",s.priority,n)} ${Bt("link",a.priority,n)} ${Bt("script",o.priority,n)}`},metaTags:s.default,linkTags:a.default,scriptTags:o.default}},OE=e=>{const{baseTag:t,bodyAttributes:r,encode:n=!0,htmlAttributes:s,noscriptTags:a,styleTags:o,title:l="",titleAttributes:c,prioritizeSeoTags:u}=e;let{linkTags:d,metaTags:h,scriptTags:f}=e,p={toComponent:()=>{},toString:()=>""};return u&&({priorityMethods:p,linkTags:d,metaTags:h,scriptTags:f}=PE(e)),{priority:p,base:Bt("base",t,n),bodyAttributes:Bt("bodyAttributes",r,n),htmlAttributes:Bt("htmlAttributes",s,n),link:Bt("link",d,n),meta:Bt("meta",h,n),noscript:Bt("noscript",a,n),script:Bt("script",f,n),style:Bt("style",o,n),title:Bt("title",{title:l,titleAttributes:c},n)}},bf=OE,Hl=[],Vb=!!(typeof window<"u"&&window.document&&window.document.createElement),wf=class{constructor(e,t){Kr(this,"instances",[]);Kr(this,"canUseDOM",Vb);Kr(this,"context");Kr(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?Hl:this.instances,add:e=>{(this.canUseDOM?Hl:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?Hl:this.instances).indexOf(e);(this.canUseDOM?Hl:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=bf({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},IE={},Kb=B.createContext(IE),Ss,qb=(Ss=class extends m.Component{constructor(r){super(r);Kr(this,"helmetData");this.helmetData=new wf(this.props.context||{},Ss.canUseDOM)}render(){return B.createElement(Kb.Provider,{value:this.helmetData.value},this.props.children)}},Kr(Ss,"canUseDOM",Vb),Ss),ia=(e,t)=>{const r=document.head||document.querySelector("head"),n=r.querySelectorAll(`${e}[${fr}]`),s=[].slice.call(n),a=[];let o;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 d=u,h=typeof l[d]>"u"?"":l[d];c.setAttribute(u,h)}c.setAttribute(fr,"true"),s.some((u,d)=>(o=d,c.isEqualNode(u)))?s.splice(o,1):a.push(c)}),s.forEach(l=>{var c;return(c=l.parentNode)==null?void 0:c.removeChild(l)}),a.forEach(l=>r.appendChild(l)),{oldTags:s,newTags:a}},_f=(e,t)=>{const r=document.getElementsByTagName(e)[0];if(!r)return;const n=r.getAttribute(fr),s=n?n.split(","):[],a=[...s],o=Object.keys(t);for(const l of o){const c=t[l]||"";r.getAttribute(l)!==c&&r.setAttribute(l,c),s.indexOf(l)===-1&&s.push(l);const u=a.indexOf(l);u!==-1&&a.splice(u,1)}for(let l=a.length-1;l>=0;l-=1)r.removeAttribute(a[l]);s.length===a.length?r.removeAttribute(fr):r.getAttribute(fr)!==o.join(",")&&r.setAttribute(fr,o.join(","))},DE=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=Fb(e)),_f("title",t)},gy=(e,t)=>{const{baseTag:r,bodyAttributes:n,htmlAttributes:s,linkTags:a,metaTags:o,noscriptTags:l,onChangeClientState:c,scriptTags:u,styleTags:d,title:h,titleAttributes:f}=e;_f("body",n),_f("html",s),DE(h,f);const p={baseTag:ia("base",r),linkTags:ia("link",a),metaTags:ia("meta",o),noscriptTags:ia("noscript",l),scriptTags:ia("script",u),styleTags:ia("style",d)},b={},g={};Object.keys(p).forEach(w=>{const{newTags:y,oldTags:v}=p[w];y.length&&(b[w]=y),v.length&&(g[w]=p[w].oldTags)}),t&&t(),c(e,b,g)},Hi=null,ME=e=>{Hi&&cancelAnimationFrame(Hi),e.defer?Hi=requestAnimationFrame(()=>{gy(e,()=>{Hi=null})}):(gy(e),Hi=null)},LE=ME,yy=class extends m.Component{constructor(){super(...arguments);Kr(this,"rendered",!1)}shouldComponentUpdate(t){return!xE(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:r}=this.props.context;let n=null;const s=NE(t.get().map(a=>{const o={...a.props};return delete o.context,o}));qb.canUseDOM?LE(s):bf&&(n=bf(s)),r(n)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},Sh,$E=(Sh=class extends m.Component{shouldComponentUpdate(e){return!mE(my(this.props,"helmetData"),my(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(`<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(e,t,r,n){return{...t,[e.type]:[...t[e.type]||[],{...r,...this.mapNestedChildrenToProps(e,n)}]}}mapObjectTypeChildren(e,t,r,n){switch(e.type){case"title":return{...t,[e.type]:n,titleAttributes:{...r}};case"body":return{...t,bodyAttributes:{...r}};case"html":return{...t,htmlAttributes:{...r}};default:return{...t,[e.type]:{...r}}}}mapArrayTypeChildrenToProps(e,t){let r={...t};return Object.keys(e).forEach(n=>{r={...r,[n]:e[n]}}),r}warnOnInvalidChildren(e,t){return fy(py.some(r=>e.type===r),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 ${py.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),fy(!t||typeof t=="string"||Array.isArray(t)&&!t.some(r=>typeof r!="string"),`Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`}</${e.type}> ) Refer to our API for more information.`),!0}mapChildrenToProps(e,t){let r={};return B.Children.forEach(e,n=>{if(!n||!n.props)return;const{children:s,...a}=n.props,o=Object.keys(a).reduce((c,u)=>(c[bE[u]||u]=a[u],c),{});let{type:l}=n;switch(typeof l=="symbol"?l=l.toString():this.warnOnInvalidChildren(n,s),l){case"Symbol(react.fragment)":t=this.mapChildrenToProps(s,t);break;case"link":case"meta":case"noscript":case"script":case"style":r=this.flattenArrayTypeChildren(n,r,o,s);break;default:t=this.mapObjectTypeChildren(n,t,o,s);break}}),this.mapArrayTypeChildrenToProps(r,t)}render(){const{children:e,...t}=this.props;let r={...t},{helmetData:n}=t;if(e&&(r=this.mapChildrenToProps(e,r)),n&&!(n instanceof wf)){const s=n;n=new wf(s.context,!0),delete r.helmetData}return n?B.createElement(yy,{...r,context:n.value}):B.createElement(Kb.Consumer,null,s=>B.createElement(yy,{...r,context:s}))}},Kr(Sh,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),Sh),Lu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},$u=typeof window>"u"||"Deno"in globalThis;function ir(){}function zE(e,t){return typeof e=="function"?e(t):e}function UE(e){return typeof e=="number"&&e>=0&&e!==1/0}function FE(e,t){return Math.max(e+(t||0)-Date.now(),0)}function kf(e,t){return typeof e=="function"?e(t):e}function BE(e,t){return typeof e=="function"?e(t):e}function vy(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:o,stale:l}=e;if(o){if(n){if(t.queryHash!==am(o,t.options))return!1}else if(!Mo(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||a&&!a(t))}function xy(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(Do(t.options.mutationKey)!==Do(a))return!1}else if(!Mo(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function am(e,t){return((t==null?void 0:t.queryKeyHashFn)||Do)(e)}function Do(e){return JSON.stringify(e,(t,r)=>jf(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Mo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Mo(e[r],t[r])):!1}function Wb(e,t){if(e===t)return e;const r=by(e)&&by(t);if(r||jf(e)&&jf(t)){const n=r?e:Object.keys(e),s=n.length,a=r?t:Object.keys(t),o=a.length,l=r?[]:{},c=new Set(n);let u=0;for(let d=0;d<o;d++){const h=r?d:a[d];(!r&&c.has(h)||r)&&e[h]===void 0&&t[h]===void 0?(l[h]=void 0,u++):(l[h]=Wb(e[h],t[h]),l[h]===e[h]&&e[h]!==void 0&&u++)}return s===o&&u===s?e:l}return t}function by(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function jf(e){if(!wy(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!wy(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function wy(e){return Object.prototype.toString.call(e)==="[object Object]"}function HE(e){return new Promise(t=>{setTimeout(t,e)})}function VE(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?Wb(e,t):t}function KE(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function qE(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var im=Symbol();function Gb(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===im?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Ns,Dn,Ja,vx,WE=(vx=class extends Lu{constructor(){super();we(this,Ns);we(this,Dn);we(this,Ja);oe(this,Ja,t=>{if(!$u&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){D(this,Dn)||this.setEventListener(D(this,Ja))}onUnsubscribe(){var t;this.hasListeners()||((t=D(this,Dn))==null||t.call(this),oe(this,Dn,void 0))}setEventListener(t){var r;oe(this,Ja,t),(r=D(this,Dn))==null||r.call(this),oe(this,Dn,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){D(this,Ns)!==t&&(oe(this,Ns,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof D(this,Ns)=="boolean"?D(this,Ns):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Ns=new WeakMap,Dn=new WeakMap,Ja=new WeakMap,vx),Yb=new WE,Za,Mn,Qa,xx,GE=(xx=class extends Lu{constructor(){super();we(this,Za,!0);we(this,Mn);we(this,Qa);oe(this,Qa,t=>{if(!$u&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){D(this,Mn)||this.setEventListener(D(this,Qa))}onUnsubscribe(){var t;this.hasListeners()||((t=D(this,Mn))==null||t.call(this),oe(this,Mn,void 0))}setEventListener(t){var r;oe(this,Qa,t),(r=D(this,Mn))==null||r.call(this),oe(this,Mn,t(this.setOnline.bind(this)))}setOnline(t){D(this,Za)!==t&&(oe(this,Za,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return D(this,Za)}},Za=new WeakMap,Mn=new WeakMap,Qa=new WeakMap,xx),Qc=new GE;function YE(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}function JE(e){return Math.min(1e3*2**e,3e4)}function Jb(e){return(e??"online")==="online"?Qc.isOnline():!0}var Zb=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Xd(e){return e instanceof Zb}function Qb(e){let t=!1,r=0,n=!1,s;const a=YE(),o=g=>{var w;n||(f(new Zb(g)),(w=e.abort)==null||w.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>Yb.isFocused()&&(e.networkMode==="always"||Qc.isOnline())&&e.canRun(),d=()=>Jb(e.networkMode)&&e.canRun(),h=g=>{var w;n||(n=!0,(w=e.onSuccess)==null||w.call(e,g),s==null||s(),a.resolve(g))},f=g=>{var w;n||(n=!0,(w=e.onError)==null||w.call(e,g),s==null||s(),a.reject(g))},p=()=>new Promise(g=>{var w;s=y=>{(n||u())&&g(y)},(w=e.onPause)==null||w.call(e)}).then(()=>{var g;s=void 0,n||(g=e.onContinue)==null||g.call(e)}),b=()=>{if(n)return;let g;const w=r===0?e.initialPromise:void 0;try{g=w??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(h).catch(y=>{var S;if(n)return;const v=e.retry??($u?0:3),x=e.retryDelay??JE,_=typeof x=="function"?x(r,y):x,j=v===!0||typeof v=="number"&&r<v||typeof v=="function"&&v(r,y);if(t||!j){f(y);return}r++,(S=e.onFail)==null||S.call(e,r,y),HE(_).then(()=>u()?void 0:p()).then(()=>{t?f(y):b()})})};return{promise:a,cancel:o,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?b():p().then(b),a)}}var ZE=e=>setTimeout(e,0);function QE(){let e=[],t=0,r=l=>{l()},n=l=>{l()},s=ZE;const a=l=>{t?e.push(l):s(()=>{r(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{n(()=>{l.forEach(c=>{r(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{s=l}}}var gt=QE(),Es,bx,Xb=(bx=class{constructor(){we(this,Es)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),UE(this.gcTime)&&oe(this,Es,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??($u?1/0:5*60*1e3))}clearGcTimeout(){D(this,Es)&&(clearTimeout(D(this,Es)),oe(this,Es,void 0))}},Es=new WeakMap,bx),Xa,Cs,Ht,Ts,dt,el,Rs,lr,Gr,wx,XE=(wx=class extends Xb{constructor(t){super();we(this,lr);we(this,Xa);we(this,Cs);we(this,Ht);we(this,Ts);we(this,dt);we(this,el);we(this,Rs);oe(this,Rs,!1),oe(this,el,t.defaultOptions),this.setOptions(t.options),this.observers=[],oe(this,Ts,t.client),oe(this,Ht,D(this,Ts).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,oe(this,Xa,tC(this.options)),this.state=t.state??D(this,Xa),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=D(this,dt))==null?void 0:t.promise}setOptions(t){this.options={...D(this,el),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&D(this,Ht).remove(this)}setData(t,r){const n=VE(this.state.data,t,this.options);return lt(this,lr,Gr).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){lt(this,lr,Gr).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=D(this,dt))==null?void 0:n.promise;return(s=D(this,dt))==null||s.cancel(t),r?r.then(ir).catch(ir):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(D(this,Xa))}isActive(){return this.observers.some(t=>BE(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===im||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>kf(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!FE(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=D(this,dt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=D(this,dt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),D(this,Ht).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(D(this,dt)&&(D(this,Rs)?D(this,dt).cancel({revert:!0}):D(this,dt).cancelRetry()),this.scheduleGc()),D(this,Ht).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||lt(this,lr,Gr).call(this,{type:"invalidate"})}fetch(t,r){var u,d,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(D(this,dt))return D(this,dt).continueRetry(),D(this,dt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(oe(this,Rs,!0),n.signal)})},a=()=>{const f=Gb(this.options,r),b=(()=>{const g={client:D(this,Ts),queryKey:this.queryKey,meta:this.meta};return s(g),g})();return oe(this,Rs,!1),this.options.persister?this.options.persister(f,b,this):f(b)},l=(()=>{const f={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:D(this,Ts),state:this.state,fetchFn:a};return s(f),f})();(u=this.options.behavior)==null||u.onFetch(l,this),oe(this,Cs,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=l.fetchOptions)==null?void 0:d.meta))&<(this,lr,Gr).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta});const c=f=>{var p,b,g,w;Xd(f)&&f.silent||lt(this,lr,Gr).call(this,{type:"error",error:f}),Xd(f)||((b=(p=D(this,Ht).config).onError)==null||b.call(p,f,this),(w=(g=D(this,Ht).config).onSettled)==null||w.call(g,this.state.data,f,this)),this.scheduleGc()};return oe(this,dt,Qb({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,abort:n.abort.bind(n),onSuccess:f=>{var p,b,g,w;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(y){c(y);return}(b=(p=D(this,Ht).config).onSuccess)==null||b.call(p,f,this),(w=(g=D(this,Ht).config).onSettled)==null||w.call(g,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,p)=>{lt(this,lr,Gr).call(this,{type:"failed",failureCount:f,error:p})},onPause:()=>{lt(this,lr,Gr).call(this,{type:"pause"})},onContinue:()=>{lt(this,lr,Gr).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),D(this,dt).start()}},Xa=new WeakMap,Cs=new WeakMap,Ht=new WeakMap,Ts=new WeakMap,dt=new WeakMap,el=new WeakMap,Rs=new WeakMap,lr=new WeakSet,Gr=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...eC(n.data,this.options),fetchMeta:t.meta??null};case"success":return oe(this,Cs,void 0),{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return Xd(s)&&s.revert&&D(this,Cs)?{...D(this,Cs),fetchStatus:"idle"}:{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),gt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),D(this,Ht).notify({query:this,type:"updated",action:t})})},wx);function eC(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Jb(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function tC(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Er,_x,rC=(_x=class extends Lu{constructor(t={}){super();we(this,Er);this.config=t,oe(this,Er,new Map)}build(t,r,n){const s=r.queryKey,a=r.queryHash??am(s,r);let o=this.get(a);return o||(o=new XE({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){D(this,Er).has(t.queryHash)||(D(this,Er).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=D(this,Er).get(t.queryHash);r&&(t.destroy(),r===t&&D(this,Er).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){gt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return D(this,Er).get(t)}getAll(){return[...D(this,Er).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>vy(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>vy(t,n)):r}notify(t){gt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){gt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){gt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Er=new WeakMap,_x),Cr,pt,As,Tr,Nn,kx,nC=(kx=class extends Xb{constructor(t){super();we(this,Tr);we(this,Cr);we(this,pt);we(this,As);this.mutationId=t.mutationId,oe(this,pt,t.mutationCache),oe(this,Cr,[]),this.state=t.state||sC(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){D(this,Cr).includes(t)||(D(this,Cr).push(t),this.clearGcTimeout(),D(this,pt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){oe(this,Cr,D(this,Cr).filter(r=>r!==t)),this.scheduleGc(),D(this,pt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){D(this,Cr).length||(this.state.status==="pending"?this.scheduleGc():D(this,pt).remove(this))}continue(){var t;return((t=D(this,As))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,o,l,c,u,d,h,f,p,b,g,w,y,v,x,_,j,S,C,k;const r=()=>{lt(this,Tr,Nn).call(this,{type:"continue"})};oe(this,As,Qb({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,P)=>{lt(this,Tr,Nn).call(this,{type:"failed",failureCount:A,error:P})},onPause:()=>{lt(this,Tr,Nn).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>D(this,pt).canRun(this)}));const n=this.state.status==="pending",s=!D(this,As).canStart();try{if(n)r();else{lt(this,Tr,Nn).call(this,{type:"pending",variables:t,isPaused:s}),await((o=(a=D(this,pt).config).onMutate)==null?void 0:o.call(a,t,this));const P=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,t));P!==this.state.context&<(this,Tr,Nn).call(this,{type:"pending",context:P,variables:t,isPaused:s})}const A=await D(this,As).start();return await((d=(u=D(this,pt).config).onSuccess)==null?void 0:d.call(u,A,t,this.state.context,this)),await((f=(h=this.options).onSuccess)==null?void 0:f.call(h,A,t,this.state.context)),await((b=(p=D(this,pt).config).onSettled)==null?void 0:b.call(p,A,null,this.state.variables,this.state.context,this)),await((w=(g=this.options).onSettled)==null?void 0:w.call(g,A,null,t,this.state.context)),lt(this,Tr,Nn).call(this,{type:"success",data:A}),A}catch(A){try{throw await((v=(y=D(this,pt).config).onError)==null?void 0:v.call(y,A,t,this.state.context,this)),await((_=(x=this.options).onError)==null?void 0:_.call(x,A,t,this.state.context)),await((S=(j=D(this,pt).config).onSettled)==null?void 0:S.call(j,void 0,A,this.state.variables,this.state.context,this)),await((k=(C=this.options).onSettled)==null?void 0:k.call(C,void 0,A,t,this.state.context)),A}finally{lt(this,Tr,Nn).call(this,{type:"error",error:A})}}finally{D(this,pt).runNext(this)}}},Cr=new WeakMap,pt=new WeakMap,As=new WeakMap,Tr=new WeakSet,Nn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),gt.batch(()=>{D(this,Cr).forEach(n=>{n.onMutationUpdate(t)}),D(this,pt).notify({mutation:this,type:"updated",action:t})})},kx);function sC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Xr,cr,tl,jx,aC=(jx=class extends Lu{constructor(t={}){super();we(this,Xr);we(this,cr);we(this,tl);this.config=t,oe(this,Xr,new Set),oe(this,cr,new Map),oe(this,tl,0)}build(t,r,n){const s=new nC({mutationCache:this,mutationId:++Sl(this,tl)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){D(this,Xr).add(t);const r=Vl(t);if(typeof r=="string"){const n=D(this,cr).get(r);n?n.push(t):D(this,cr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(D(this,Xr).delete(t)){const r=Vl(t);if(typeof r=="string"){const n=D(this,cr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&D(this,cr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=Vl(t);if(typeof r=="string"){const n=D(this,cr).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=Vl(t);if(typeof r=="string"){const s=(n=D(this,cr).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){gt.batch(()=>{D(this,Xr).forEach(t=>{this.notify({type:"removed",mutation:t})}),D(this,Xr).clear(),D(this,cr).clear()})}getAll(){return Array.from(D(this,Xr))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>xy(r,n))}findAll(t={}){return this.getAll().filter(r=>xy(t,r))}notify(t){gt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return gt.batch(()=>Promise.all(t.map(r=>r.continue().catch(ir))))}},Xr=new WeakMap,cr=new WeakMap,tl=new WeakMap,jx);function Vl(e){var t;return(t=e.options.scope)==null?void 0:t.id}function _y(e){return{onFetch:(t,r)=>{var d,h,f,p,b;const n=t.options,s=(f=(h=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:f.direction,a=((p=t.state.data)==null?void 0:p.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let g=!1;const w=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},y=Gb(t.options,t.fetchOptions),v=async(x,_,j)=>{if(g)return Promise.reject();if(_==null&&x.pages.length)return Promise.resolve(x);const C=(()=>{const $={client:t.client,queryKey:t.queryKey,pageParam:_,direction:j?"backward":"forward",meta:t.options.meta};return w($),$})(),k=await y(C),{maxPages:A}=t.options,P=j?qE:KE;return{pages:P(x.pages,k,A),pageParams:P(x.pageParams,_,A)}};if(s&&a.length){const x=s==="backward",_=x?iC:ky,j={pages:a,pageParams:o},S=_(n,j);l=await v(j,S,x)}else{const x=e??a.length;do{const _=c===0?o[0]??n.initialPageParam:ky(n,l);if(c>0&&_==null)break;l=await v(l,_),c++}while(c<x)}return l};t.options.persister?t.fetchFn=()=>{var g,w;return(w=(g=t.options).persister)==null?void 0:w.call(g,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=u}}}function ky(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function iC(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Ue,Ln,$n,ei,ti,zn,ri,ni,Sx,oC=(Sx=class{constructor(e={}){we(this,Ue);we(this,Ln);we(this,$n);we(this,ei);we(this,ti);we(this,zn);we(this,ri);we(this,ni);oe(this,Ue,e.queryCache||new rC),oe(this,Ln,e.mutationCache||new aC),oe(this,$n,e.defaultOptions||{}),oe(this,ei,new Map),oe(this,ti,new Map),oe(this,zn,0)}mount(){Sl(this,zn)._++,D(this,zn)===1&&(oe(this,ri,Yb.subscribe(async e=>{e&&(await this.resumePausedMutations(),D(this,Ue).onFocus())})),oe(this,ni,Qc.subscribe(async e=>{e&&(await this.resumePausedMutations(),D(this,Ue).onOnline())})))}unmount(){var e,t;Sl(this,zn)._--,D(this,zn)===0&&((e=D(this,ri))==null||e.call(this),oe(this,ri,void 0),(t=D(this,ni))==null||t.call(this),oe(this,ni,void 0))}isFetching(e){return D(this,Ue).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return D(this,Ln).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=D(this,Ue).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=D(this,Ue).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(kf(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return D(this,Ue).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=D(this,Ue).get(n.queryHash),a=s==null?void 0:s.state.data,o=zE(t,a);if(o!==void 0)return D(this,Ue).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return gt.batch(()=>D(this,Ue).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=D(this,Ue).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=D(this,Ue);gt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=D(this,Ue);return gt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=gt.batch(()=>D(this,Ue).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(ir).catch(ir)}invalidateQueries(e,t={}){return gt.batch(()=>(D(this,Ue).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=gt.batch(()=>D(this,Ue).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(ir)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(ir)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=D(this,Ue).build(this,t);return r.isStaleByTime(kf(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ir).catch(ir)}fetchInfiniteQuery(e){return e.behavior=_y(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ir).catch(ir)}ensureInfiniteQueryData(e){return e.behavior=_y(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Qc.isOnline()?D(this,Ln).resumePausedMutations():Promise.resolve()}getQueryCache(){return D(this,Ue)}getMutationCache(){return D(this,Ln)}getDefaultOptions(){return D(this,$n)}setDefaultOptions(e){oe(this,$n,e)}setQueryDefaults(e,t){D(this,ei).set(Do(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...D(this,ei).values()],r={};return t.forEach(n=>{Mo(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){D(this,ti).set(Do(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...D(this,ti).values()],r={};return t.forEach(n=>{Mo(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...D(this,$n).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=am(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===im&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...D(this,$n).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){D(this,Ue).clear(),D(this,Ln).clear()}},Ue=new WeakMap,Ln=new WeakMap,$n=new WeakMap,ei=new WeakMap,ti=new WeakMap,zn=new WeakMap,ri=new WeakMap,ni=new WeakMap,Sx),lC=m.createContext(void 0),cC=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(lC.Provider,{value:e,children:t}));/**
* @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 Lo(){return Lo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Lo.apply(this,arguments)}var Bn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Bn||(Bn={}));const jy="popstate";function uC(e){e===void 0&&(e={});function t(n,s){let{pathname:a,search:o,hash:l}=n.location;return Sf("",{pathname:a,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(n,s){return typeof s=="string"?s:Xc(s)}return hC(t,r,null,e)}function Me(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ew(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function dC(){return Math.random().toString(36).substr(2,8)}function Sy(e,t){return{usr:e.state,key:e.key,idx:t}}function Sf(e,t,r,n){return r===void 0&&(r=null),Lo({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ji(t):t,{state:r,key:t&&t.key||n||dC()})}function Xc(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function ji(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function hC(e,t,r,n){n===void 0&&(n={});let{window:s=document.defaultView,v5Compat:a=!1}=n,o=s.history,l=Bn.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Lo({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function h(){l=Bn.Pop;let w=d(),y=w==null?null:w-u;u=w,c&&c({action:l,location:g.location,delta:y})}function f(w,y){l=Bn.Push;let v=Sf(g.location,w,y);u=d()+1;let x=Sy(v,u),_=g.createHref(v);try{o.pushState(x,"",_)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;s.location.assign(_)}a&&c&&c({action:l,location:g.location,delta:1})}function p(w,y){l=Bn.Replace;let v=Sf(g.location,w,y);u=d();let x=Sy(v,u),_=g.createHref(v);o.replaceState(x,"",_),a&&c&&c({action:l,location:g.location,delta:0})}function b(w){let y=s.location.origin!=="null"?s.location.origin:s.location.href,v=typeof w=="string"?w:Xc(w);return v=v.replace(/ $/,"%20"),Me(y,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,y)}let g={get action(){return l},get location(){return e(s,o)},listen(w){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(jy,h),c=w,()=>{s.removeEventListener(jy,h),c=null}},createHref(w){return t(s,w)},createURL:b,encodeLocation(w){let y=b(w);return{pathname:y.pathname,search:y.search,hash:y.hash}},push:f,replace:p,go(w){return o.go(w)}};return g}var Ny;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ny||(Ny={}));function fC(e,t,r){return r===void 0&&(r="/"),pC(e,t,r,!1)}function pC(e,t,r,n){let s=typeof t=="string"?ji(t):t,a=di(s.pathname||"/",r);if(a==null)return null;let o=tw(e);mC(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let u=NC(a);l=jC(o[c],u,n)}return l}function tw(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let s=(a,o,l)=>{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(Me(c.relativePath.startsWith(n),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(n.length));let u=es([n,c.relativePath]),d=r.concat(c);a.children&&a.children.length>0&&(Me(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),tw(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:_C(u,a.index),routesMeta:d})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))s(a,o);else for(let c of rw(a.path))s(a,o,c)}),t}function rw(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return s?[a,""]:[a];let o=rw(n.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function mC(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:kC(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const gC=/^:[\w-]+$/,yC=3,vC=2,xC=1,bC=10,wC=-2,Ey=e=>e==="*";function _C(e,t){let r=e.split("/"),n=r.length;return r.some(Ey)&&(n+=wC),t&&(n+=vC),r.filter(s=>!Ey(s)).reduce((s,a)=>s+(gC.test(a)?yC:a===""?xC:bC),n)}function kC(e,t){return e.length===t.length&&e.slice(0,-1).every((n,s)=>n===t[s])?e[e.length-1]-t[t.length-1]:0}function jC(e,t,r){let{routesMeta:n}=e,s={},a="/",o=[];for(let l=0;l<n.length;++l){let c=n[l],u=l===n.length-1,d=a==="/"?t:t.slice(a.length)||"/",h=eu({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},d),f=c.route;if(!h&&u&&r&&!n[n.length-1].route.index&&(h=eu({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},d)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:es([a,h.pathname]),pathnameBase:RC(es([a,h.pathnameBase])),route:f}),h.pathnameBase!=="/"&&(a=es([a,h.pathnameBase]))}return o}function eu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=SC(e.path,e.caseSensitive,e.end),s=t.match(r);if(!s)return null;let a=s[0],o=a.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:n.reduce((u,d,h)=>{let{paramName:f,isOptional:p}=d;if(f==="*"){let g=l[h]||"";o=a.slice(0,a.length-g.length).replace(/(.)\/+$/,"$1")}const b=l[h];return p&&!b?u[f]=void 0:u[f]=(b||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function SC(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),ew(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 n=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(n.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function NC(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ew(!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 di(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function EC(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?ji(e):e;return{pathname:r?r.startsWith("/")?r:CC(r,t):t,search:AC(n),hash:PC(s)}}function CC(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function eh(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function TC(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function om(e,t){let r=TC(e);return t?r.map((n,s)=>s===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function lm(e,t,r,n){n===void 0&&(n=!1);let s;typeof e=="string"?s=ji(e):(s=Lo({},e),Me(!s.pathname||!s.pathname.includes("?"),eh("?","pathname","search",s)),Me(!s.pathname||!s.pathname.includes("#"),eh("#","pathname","hash",s)),Me(!s.search||!s.search.includes("#"),eh("#","search","hash",s)));let a=e===""||s.pathname==="",o=a?"/":s.pathname,l;if(o==null)l=r;else{let h=t.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;s.pathname=f.join("/")}l=h>=0?t[h]:"/"}let c=EC(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&r.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const es=e=>e.join("/").replace(/\/\/+/g,"/"),RC=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),AC=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,PC=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function OC(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const nw=["post","put","patch","delete"];new Set(nw);const IC=["get",...nw];new Set(IC);/**
* React Router v6.30.1
*
* 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 $o(){return $o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$o.apply(this,arguments)}const zu=m.createContext(null),sw=m.createContext(null),fn=m.createContext(null),Uu=m.createContext(null),zr=m.createContext({outlet:null,matches:[],isDataRoute:!1}),aw=m.createContext(null);function DC(e,t){let{relative:r}=t===void 0?{}:t;Si()||Me(!1);let{basename:n,navigator:s}=m.useContext(fn),{hash:a,pathname:o,search:l}=Fu(e,{relative:r}),c=o;return n!=="/"&&(c=o==="/"?n:es([n,o])),s.createHref({pathname:c,search:l,hash:a})}function Si(){return m.useContext(Uu)!=null}function Ur(){return Si()||Me(!1),m.useContext(Uu).location}function iw(e){m.useContext(fn).static||m.useLayoutEffect(e)}function xr(){let{isDataRoute:e}=m.useContext(zr);return e?JC():MC()}function MC(){Si()||Me(!1);let e=m.useContext(zu),{basename:t,future:r,navigator:n}=m.useContext(fn),{matches:s}=m.useContext(zr),{pathname:a}=Ur(),o=JSON.stringify(om(s,r.v7_relativeSplatPath)),l=m.useRef(!1);return iw(()=>{l.current=!0}),m.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let h=lm(u,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:es([t,h.pathname])),(d.replace?n.replace:n.push)(h,d.state,d)},[t,n,o,a,e])}const LC=m.createContext(null);function $C(e){let t=m.useContext(zr).outlet;return t&&m.createElement(LC.Provider,{value:e},t)}function cm(){let{matches:e}=m.useContext(zr),t=e[e.length-1];return t?t.params:{}}function Fu(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=m.useContext(fn),{matches:s}=m.useContext(zr),{pathname:a}=Ur(),o=JSON.stringify(om(s,n.v7_relativeSplatPath));return m.useMemo(()=>lm(e,JSON.parse(o),a,r==="path"),[e,o,a,r])}function zC(e,t){return UC(e,t)}function UC(e,t,r,n){Si()||Me(!1);let{navigator:s}=m.useContext(fn),{matches:a}=m.useContext(zr),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=Ur(),d;if(t){var h;let w=typeof t=="string"?ji(t):t;c==="/"||(h=w.pathname)!=null&&h.startsWith(c)||Me(!1),d=w}else d=u;let f=d.pathname||"/",p=f;if(c!=="/"){let w=c.replace(/^\//,"").split("/");p="/"+f.replace(/^\//,"").split("/").slice(w.length).join("/")}let b=fC(e,{pathname:p}),g=KC(b&&b.map(w=>Object.assign({},w,{params:Object.assign({},l,w.params),pathname:es([c,s.encodeLocation?s.encodeLocation(w.pathname).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?c:es([c,s.encodeLocation?s.encodeLocation(w.pathnameBase).pathname:w.pathnameBase])})),a,r,n);return t&&g?m.createElement(Uu.Provider,{value:{location:$o({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Bn.Pop}},g):g}function FC(){let e=YC(),t=OC(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),r?m.createElement("pre",{style:s},r):null,null)}const BC=m.createElement(FC,null);class HC extends m.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?m.createElement(zr.Provider,{value:this.props.routeContext},m.createElement(aw.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function VC(e){let{routeContext:t,match:r,children:n}=e,s=m.useContext(zu);return s&&s.static&&s.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=r.route.id),m.createElement(zr.Provider,{value:t},n)}function KC(e,t,r,n){var s;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var a;if(!r)return null;if(r.errors)e=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=(s=r)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);d>=0||Me(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let d=0;d<o.length;d++){let h=o[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(u=d),h.route.id){let{loaderData:f,errors:p}=r,b=h.route.loader&&f[h.route.id]===void 0&&(!p||p[h.route.id]===void 0);if(h.route.lazy||b){c=!0,u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,h,f)=>{let p,b=!1,g=null,w=null;r&&(p=l&&h.route.id?l[h.route.id]:void 0,g=h.route.errorElement||BC,c&&(u<0&&f===0?(b=!0,w=null):u===f&&(b=!0,w=h.route.hydrateFallbackElement||null)));let y=t.concat(o.slice(0,f+1)),v=()=>{let x;return p?x=g:b?x=w:h.route.Component?x=m.createElement(h.route.Component,null):h.route.element?x=h.route.element:x=d,m.createElement(VC,{match:h,routeContext:{outlet:d,matches:y,isDataRoute:r!=null},children:x})};return r&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?m.createElement(HC,{location:r.location,revalidation:r.revalidation,component:g,error:p,children:v(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):v()},null)}var ow=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(ow||{}),tu=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}(tu||{});function qC(e){let t=m.useContext(zu);return t||Me(!1),t}function WC(e){let t=m.useContext(sw);return t||Me(!1),t}function GC(e){let t=m.useContext(zr);return t||Me(!1),t}function lw(e){let t=GC(),r=t.matches[t.matches.length-1];return r.route.id||Me(!1),r.route.id}function YC(){var e;let t=m.useContext(aw),r=WC(tu.UseRouteError),n=lw(tu.UseRouteError);return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function JC(){let{router:e}=qC(ow.UseNavigateStable),t=lw(tu.UseNavigateStable),r=m.useRef(!1);return iw(()=>{r.current=!0}),m.useCallback(function(s,a){a===void 0&&(a={}),r.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,$o({fromRouteId:t},a)))},[e,t])}function ZC(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Ke(e){let{to:t,replace:r,state:n,relative:s}=e;Si()||Me(!1);let{future:a,static:o}=m.useContext(fn),{matches:l}=m.useContext(zr),{pathname:c}=Ur(),u=xr(),d=lm(t,om(l,a.v7_relativeSplatPath),c,s==="path"),h=JSON.stringify(d);return m.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:s}),[u,h,s,r,n]),null}function QC(e){return $C(e.context)}function te(e){Me(!1)}function XC(e){let{basename:t="/",children:r=null,location:n,navigationType:s=Bn.Pop,navigator:a,static:o=!1,future:l}=e;Si()&&Me(!1);let c=t.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:c,navigator:a,static:o,future:$o({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof n=="string"&&(n=ji(n));let{pathname:d="/",search:h="",hash:f="",state:p=null,key:b="default"}=n,g=m.useMemo(()=>{let w=di(d,c);return w==null?null:{location:{pathname:w,search:h,hash:f,state:p,key:b},navigationType:s}},[c,d,h,f,p,b,s]);return g==null?null:m.createElement(fn.Provider,{value:u},m.createElement(Uu.Provider,{children:r,value:g}))}function eT(e){let{children:t,location:r}=e;return zC(Nf(t),r)}new Promise(()=>{});function Nf(e,t){t===void 0&&(t=[]);let r=[];return m.Children.forEach(e,(n,s)=>{if(!m.isValidElement(n))return;let a=[...t,s];if(n.type===m.Fragment){r.push.apply(r,Nf(n.props.children,a));return}n.type!==te&&Me(!1),!n.props.index||!n.props.children||Me(!1);let o={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=Nf(n.props.children,a)),r.push(o)}),r}/**
* React Router DOM v6.30.1
*
* 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 ru(){return ru=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ru.apply(this,arguments)}function cw(e,t){if(e==null)return{};var r={},n=Object.keys(e),s,a;for(a=0;a<n.length;a++)s=n[a],!(t.indexOf(s)>=0)&&(r[s]=e[s]);return r}function tT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function rT(e,t){return e.button===0&&(!t||t==="_self")&&!tT(e)}function Ef(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function nT(e,t){let r=Ef(e);return t&&t.forEach((n,s)=>{r.has(s)||t.getAll(s).forEach(a=>{r.append(s,a)})}),r}const sT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],aT=["aria-current","caseSensitive","className","end","style","to","viewTransition","children"],iT="6";try{window.__reactRouterVersion=iT}catch{}const oT=m.createContext({isTransitioning:!1}),lT="startTransition",Cy=fp[lT];function cT(e){let{basename:t,children:r,future:n,window:s}=e,a=m.useRef();a.current==null&&(a.current=uC({window:s,v5Compat:!0}));let o=a.current,[l,c]=m.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},d=m.useCallback(h=>{u&&Cy?Cy(()=>c(h)):c(h)},[c,u]);return m.useLayoutEffect(()=>o.listen(d),[o,d]),m.useEffect(()=>ZC(n),[n]),m.createElement(XC,{basename:t,children:r,location:l.location,navigationType:l.action,navigator:o,future:n})}const uT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ue=m.forwardRef(function(t,r){let{onClick:n,relative:s,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:h}=t,f=cw(t,sT),{basename:p}=m.useContext(fn),b,g=!1;if(typeof u=="string"&&dT.test(u)&&(b=u,uT))try{let x=new URL(window.location.href),_=u.startsWith("//")?new URL(x.protocol+u):new URL(u),j=di(_.pathname,p);_.origin===x.origin&&j!=null?u=j+_.search+_.hash:g=!0}catch{}let w=DC(u,{relative:s}),y=pT(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:h});function v(x){n&&n(x),x.defaultPrevented||y(x)}return m.createElement("a",ru({},f,{href:b||w,onClick:g||a?n:v,ref:r,target:c}))}),hT=m.forwardRef(function(t,r){let{"aria-current":n="page",caseSensitive:s=!1,className:a="",end:o=!1,style:l,to:c,viewTransition:u,children:d}=t,h=cw(t,aT),f=Fu(c,{relative:h.relative}),p=Ur(),b=m.useContext(sw),{navigator:g,basename:w}=m.useContext(fn),y=b!=null&&mT(f)&&u===!0,v=g.encodeLocation?g.encodeLocation(f).pathname:f.pathname,x=p.pathname,_=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;s||(x=x.toLowerCase(),_=_?_.toLowerCase():null,v=v.toLowerCase()),_&&w&&(_=di(_,w)||_);const j=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let S=x===v||!o&&x.startsWith(v)&&x.charAt(j)==="/",C=_!=null&&(_===v||!o&&_.startsWith(v)&&_.charAt(v.length)==="/"),k={isActive:S,isPending:C,isTransitioning:y},A=S?n:void 0,P;typeof a=="function"?P=a(k):P=[a,S?"active":null,C?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let $=typeof l=="function"?l(k):l;return m.createElement(ue,ru({},h,{"aria-current":A,className:P,ref:r,style:$,to:c,viewTransition:u}),typeof d=="function"?d(k):d)});var Cf;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Cf||(Cf={}));var Ty;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Ty||(Ty={}));function fT(e){let t=m.useContext(zu);return t||Me(!1),t}function pT(e,t){let{target:r,replace:n,state:s,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=xr(),u=Ur(),d=Fu(e,{relative:o});return m.useCallback(h=>{if(rT(h,r)){h.preventDefault();let f=n!==void 0?n:Xc(u)===Xc(d);c(e,{replace:f,state:s,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,d,n,s,r,e,a,o,l])}function Bu(e){let t=m.useRef(Ef(e)),r=m.useRef(!1),n=Ur(),s=m.useMemo(()=>nT(n.search,r.current?null:t.current),[n.search]),a=xr(),o=m.useCallback((l,c)=>{const u=Ef(typeof l=="function"?l(s):l);r.current=!0,a("?"+u,c)},[a,s]);return[s,o]}function mT(e,t){t===void 0&&(t={});let r=m.useContext(oT);r==null&&Me(!1);let{basename:n}=fT(Cf.useViewTransitionState),s=Fu(e,{relative:t.relative});if(!r.isTransitioning)return!1;let a=di(r.currentLocation.pathname,n)||r.currentLocation.pathname,o=di(r.nextLocation.pathname,n)||r.nextLocation.pathname;return eu(s.pathname,o)!=null||eu(s.pathname,a)!=null}var Ry=["light","dark"],gT="(prefers-color-scheme: dark)",yT=m.createContext(void 0),vT={setTheme:e=>{},themes:[]},xT=()=>{var e;return(e=m.useContext(yT))!=null?e:vT};m.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:a,value:o,attrs:l,nonce:c})=>{let u=a==="system",d=r==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(b=>`'${b}'`).join(",")})`};`:`var d=document.documentElement,n='${r}',s='setAttribute';`,h=s?Ry.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(b,g=!1,w=!0)=>{let y=o?o[b]:b,v=g?b+"|| ''":`'${y}'`,x="";return s&&w&&!g&&Ry.includes(b)&&(x+=`d.style.colorScheme = '${b}';`),r==="class"?g||y?x+=`c.add(${v})`:x+="null":y&&(x+=`d[s](n,${v})`),x},p=e?`!function(){${d}${f(e)}}()`:n?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${gT}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${u?"":"else{"+f(a,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(a,!1,!1)};}${h}}catch(t){}}();`;return m.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var bT=e=>{switch(e){case"success":return kT;case"info":return ST;case"warning":return jT;case"error":return NT;default:return null}},wT=Array(12).fill(0),_T=({visible:e,className:t})=>B.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},B.createElement("div",{className:"sonner-spinner"},wT.map((r,n)=>B.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),kT=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),jT=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},B.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ST=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),NT=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ET=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},B.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),B.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),CT=()=>{let[e,t]=B.useState(document.hidden);return B.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},Tf=1,TT=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Tf++,a=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),a?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:r}),{...l,...e,id:s,dismissible:o,title:r}):l):this.addToast({title:r,...n,dismissible:o,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),s=r!==void 0,a,o=n.then(async c=>{if(a=["resolve",c],B.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(AT(c)&&!c.ok){s=!1;let u=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,d=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:r,type:"error",message:u,description:d})}else if(t.success!==void 0){s=!1;let u=typeof t.success=="function"?await t.success(c):t.success,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"success",message:u,description:d})}}).catch(async c=>{if(a=["reject",c],t.error!==void 0){s=!1;let u=typeof t.error=="function"?await t.error(c):t.error,d=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"error",message:u,description:d})}}).finally(()=>{var c;s&&(this.dismiss(r),r=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,u)=>o.then(()=>a[0]==="reject"?u(a[1]):c(a[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||Tf++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},_t=new TT,RT=(e,t)=>{let r=(t==null?void 0:t.id)||Tf++;return _t.addToast({title:e,...t,id:r}),r},AT=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",PT=RT,OT=()=>_t.toasts,IT=()=>_t.getActiveToasts(),O=Object.assign(PT,{success:_t.success,info:_t.info,warning:_t.warning,error:_t.error,custom:_t.custom,message:_t.message,promise:_t.promise,dismiss:_t.dismiss,loading:_t.loading},{getHistory:OT,getToasts:IT});function DT(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}DT(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
`);function Kl(e){return e.label!==void 0}var MT=3,LT="32px",$T="16px",Ay=4e3,zT=356,UT=14,FT=20,BT=200;function nr(...e){return e.filter(Boolean).join(" ")}function HT(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var VT=e=>{var t,r,n,s,a,o,l,c,u,d,h;let{invert:f,toast:p,unstyled:b,interacting:g,setHeights:w,visibleToasts:y,heights:v,index:x,toasts:_,expanded:j,removeToast:S,defaultRichColors:C,closeButton:k,style:A,cancelButtonStyle:P,actionButtonStyle:$,className:R="",descriptionClassName:H="",duration:N,position:M,gap:I,loadingIcon:z,expandByDefault:E,classNames:T,icons:L,closeButtonAriaLabel:q="Close toast",pauseWhenPageIsHidden:K}=e,[ee,le]=B.useState(null),[Oe,ze]=B.useState(null),[fe,Vr]=B.useState(!1),[Qe,_r]=B.useState(!1),[yn,ea]=B.useState(!1),[vn,_l]=B.useState(!1),[xd,kl]=B.useState(!1),[bd,Pi]=B.useState(0),[ta,Zm]=B.useState(0),Oi=B.useRef(p.duration||N||Ay),Qm=B.useRef(null),hs=B.useRef(null),Ej=x===0,Cj=x+1<=y,Ut=p.type,ra=p.dismissible!==!1,Tj=p.className||"",Rj=p.descriptionClassName||"",jl=B.useMemo(()=>v.findIndex(ie=>ie.toastId===p.id)||0,[v,p.id]),Aj=B.useMemo(()=>{var ie;return(ie=p.closeButton)!=null?ie:k},[p.closeButton,k]),Xm=B.useMemo(()=>p.duration||N||Ay,[p.duration,N]),wd=B.useRef(0),na=B.useRef(0),eg=B.useRef(0),sa=B.useRef(null),[Pj,Oj]=M.split("-"),tg=B.useMemo(()=>v.reduce((ie,Se,Ae)=>Ae>=jl?ie:ie+Se.height,0),[v,jl]),rg=CT(),Ij=p.invert||f,_d=Ut==="loading";na.current=B.useMemo(()=>jl*I+tg,[jl,tg]),B.useEffect(()=>{Oi.current=Xm},[Xm]),B.useEffect(()=>{Vr(!0)},[]),B.useEffect(()=>{let ie=hs.current;if(ie){let Se=ie.getBoundingClientRect().height;return Zm(Se),w(Ae=>[{toastId:p.id,height:Se,position:p.position},...Ae]),()=>w(Ae=>Ae.filter(Xt=>Xt.toastId!==p.id))}},[w,p.id]),B.useLayoutEffect(()=>{if(!fe)return;let ie=hs.current,Se=ie.style.height;ie.style.height="auto";let Ae=ie.getBoundingClientRect().height;ie.style.height=Se,Zm(Ae),w(Xt=>Xt.find(er=>er.toastId===p.id)?Xt.map(er=>er.toastId===p.id?{...er,height:Ae}:er):[{toastId:p.id,height:Ae,position:p.position},...Xt])},[fe,p.title,p.description,w,p.id]);let xn=B.useCallback(()=>{_r(!0),Pi(na.current),w(ie=>ie.filter(Se=>Se.toastId!==p.id)),setTimeout(()=>{S(p)},BT)},[p,S,w,na]);B.useEffect(()=>{if(p.promise&&Ut==="loading"||p.duration===1/0||p.type==="loading")return;let ie;return j||g||K&&rg?(()=>{if(eg.current<wd.current){let Se=new Date().getTime()-wd.current;Oi.current=Oi.current-Se}eg.current=new Date().getTime()})():Oi.current!==1/0&&(wd.current=new Date().getTime(),ie=setTimeout(()=>{var Se;(Se=p.onAutoClose)==null||Se.call(p,p),xn()},Oi.current)),()=>clearTimeout(ie)},[j,g,p,Ut,K,rg,xn]),B.useEffect(()=>{p.delete&&xn()},[xn,p.delete]);function Dj(){var ie,Se,Ae;return L!=null&&L.loading?B.createElement("div",{className:nr(T==null?void 0:T.loader,(ie=p==null?void 0:p.classNames)==null?void 0:ie.loader,"sonner-loader"),"data-visible":Ut==="loading"},L.loading):z?B.createElement("div",{className:nr(T==null?void 0:T.loader,(Se=p==null?void 0:p.classNames)==null?void 0:Se.loader,"sonner-loader"),"data-visible":Ut==="loading"},z):B.createElement(_T,{className:nr(T==null?void 0:T.loader,(Ae=p==null?void 0:p.classNames)==null?void 0:Ae.loader),visible:Ut==="loading"})}return B.createElement("li",{tabIndex:0,ref:hs,className:nr(R,Tj,T==null?void 0:T.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,T==null?void 0:T.default,T==null?void 0:T[Ut],(r=p==null?void 0:p.classNames)==null?void 0:r[Ut]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:C,"data-styled":!(p.jsx||p.unstyled||b),"data-mounted":fe,"data-promise":!!p.promise,"data-swiped":xd,"data-removed":Qe,"data-visible":Cj,"data-y-position":Pj,"data-x-position":Oj,"data-index":x,"data-front":Ej,"data-swiping":yn,"data-dismissible":ra,"data-type":Ut,"data-invert":Ij,"data-swipe-out":vn,"data-swipe-direction":Oe,"data-expanded":!!(j||E&&fe),style:{"--index":x,"--toasts-before":x,"--z-index":_.length-x,"--offset":`${Qe?bd:na.current}px`,"--initial-height":E?"auto":`${ta}px`,...A,...p.style},onDragEnd:()=>{ea(!1),le(null),sa.current=null},onPointerDown:ie=>{_d||!ra||(Qm.current=new Date,Pi(na.current),ie.target.setPointerCapture(ie.pointerId),ie.target.tagName!=="BUTTON"&&(ea(!0),sa.current={x:ie.clientX,y:ie.clientY}))},onPointerUp:()=>{var ie,Se,Ae,Xt;if(vn||!ra)return;sa.current=null;let er=Number(((ie=hs.current)==null?void 0:ie.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),bn=Number(((Se=hs.current)==null?void 0:Se.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),fs=new Date().getTime()-((Ae=Qm.current)==null?void 0:Ae.getTime()),tr=ee==="x"?er:bn,wn=Math.abs(tr)/fs;if(Math.abs(tr)>=FT||wn>.11){Pi(na.current),(Xt=p.onDismiss)==null||Xt.call(p,p),ze(ee==="x"?er>0?"right":"left":bn>0?"down":"up"),xn(),_l(!0),kl(!1);return}ea(!1),le(null)},onPointerMove:ie=>{var Se,Ae,Xt,er;if(!sa.current||!ra||((Se=window.getSelection())==null?void 0:Se.toString().length)>0)return;let bn=ie.clientY-sa.current.y,fs=ie.clientX-sa.current.x,tr=(Ae=e.swipeDirections)!=null?Ae:HT(M);!ee&&(Math.abs(fs)>1||Math.abs(bn)>1)&&le(Math.abs(fs)>Math.abs(bn)?"x":"y");let wn={x:0,y:0};ee==="y"?(tr.includes("top")||tr.includes("bottom"))&&(tr.includes("top")&&bn<0||tr.includes("bottom")&&bn>0)&&(wn.y=bn):ee==="x"&&(tr.includes("left")||tr.includes("right"))&&(tr.includes("left")&&fs<0||tr.includes("right")&&fs>0)&&(wn.x=fs),(Math.abs(wn.x)>0||Math.abs(wn.y)>0)&&kl(!0),(Xt=hs.current)==null||Xt.style.setProperty("--swipe-amount-x",`${wn.x}px`),(er=hs.current)==null||er.style.setProperty("--swipe-amount-y",`${wn.y}px`)}},Aj&&!p.jsx?B.createElement("button",{"aria-label":q,"data-disabled":_d,"data-close-button":!0,onClick:_d||!ra?()=>{}:()=>{var ie;xn(),(ie=p.onDismiss)==null||ie.call(p,p)},className:nr(T==null?void 0:T.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(a=L==null?void 0:L.close)!=null?a:ET):null,p.jsx||m.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:B.createElement(B.Fragment,null,Ut||p.icon||p.promise?B.createElement("div",{"data-icon":"",className:nr(T==null?void 0:T.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Dj():null,p.type!=="loading"?p.icon||(L==null?void 0:L[Ut])||bT(Ut):null):null,B.createElement("div",{"data-content":"",className:nr(T==null?void 0:T.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},B.createElement("div",{"data-title":"",className:nr(T==null?void 0:T.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?B.createElement("div",{"data-description":"",className:nr(H,Rj,T==null?void 0:T.description,(u=p==null?void 0:p.classNames)==null?void 0:u.description)},typeof p.description=="function"?p.description():p.description):null),m.isValidElement(p.cancel)?p.cancel:p.cancel&&Kl(p.cancel)?B.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||P,onClick:ie=>{var Se,Ae;Kl(p.cancel)&&ra&&((Ae=(Se=p.cancel).onClick)==null||Ae.call(Se,ie),xn())},className:nr(T==null?void 0:T.cancelButton,(d=p==null?void 0:p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,m.isValidElement(p.action)?p.action:p.action&&Kl(p.action)?B.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||$,onClick:ie=>{var Se,Ae;Kl(p.action)&&((Ae=(Se=p.action).onClick)==null||Ae.call(Se,ie),!ie.defaultPrevented&&xn())},className:nr(T==null?void 0:T.actionButton,(h=p==null?void 0:p.classNames)==null?void 0:h.actionButton)},p.action.label):null))};function Py(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function KT(e,t){let r={};return[e,t].forEach((n,s)=>{let a=s===1,o=a?"--mobile-offset":"--offset",l=a?$T:LT;function c(u){["top","right","bottom","left"].forEach(d=>{r[`${o}-${d}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${o}-${u}`]=l:r[`${o}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(l)}),r}var qT=m.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:a,closeButton:o,className:l,offset:c,mobileOffset:u,theme:d="light",richColors:h,duration:f,style:p,visibleToasts:b=MT,toastOptions:g,dir:w=Py(),gap:y=UT,loadingIcon:v,icons:x,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:j}=e,[S,C]=B.useState([]),k=B.useMemo(()=>Array.from(new Set([n].concat(S.filter(K=>K.position).map(K=>K.position)))),[S,n]),[A,P]=B.useState([]),[$,R]=B.useState(!1),[H,N]=B.useState(!1),[M,I]=B.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),z=B.useRef(null),E=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),T=B.useRef(null),L=B.useRef(!1),q=B.useCallback(K=>{C(ee=>{var le;return(le=ee.find(Oe=>Oe.id===K.id))!=null&&le.delete||_t.dismiss(K.id),ee.filter(({id:Oe})=>Oe!==K.id)})},[]);return B.useEffect(()=>_t.subscribe(K=>{if(K.dismiss){C(ee=>ee.map(le=>le.id===K.id?{...le,delete:!0}:le));return}setTimeout(()=>{$b.flushSync(()=>{C(ee=>{let le=ee.findIndex(Oe=>Oe.id===K.id);return le!==-1?[...ee.slice(0,le),{...ee[le],...K},...ee.slice(le+1)]:[K,...ee]})})})}),[]),B.useEffect(()=>{if(d!=="system"){I(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?I("dark"):I("light")),typeof window>"u")return;let K=window.matchMedia("(prefers-color-scheme: dark)");try{K.addEventListener("change",({matches:ee})=>{I(ee?"dark":"light")})}catch{K.addListener(({matches:le})=>{try{I(le?"dark":"light")}catch(Oe){console.error(Oe)}})}},[d]),B.useEffect(()=>{S.length<=1&&R(!1)},[S]),B.useEffect(()=>{let K=ee=>{var le,Oe;s.every(ze=>ee[ze]||ee.code===ze)&&(R(!0),(le=z.current)==null||le.focus()),ee.code==="Escape"&&(document.activeElement===z.current||(Oe=z.current)!=null&&Oe.contains(document.activeElement))&&R(!1)};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[s]),B.useEffect(()=>{if(z.current)return()=>{T.current&&(T.current.focus({preventScroll:!0}),T.current=null,L.current=!1)}},[z.current]),B.createElement("section",{ref:t,"aria-label":`${_} ${E}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},k.map((K,ee)=>{var le;let[Oe,ze]=K.split("-");return S.length?B.createElement("ol",{key:K,dir:w==="auto"?Py():w,tabIndex:-1,ref:z,className:l,"data-sonner-toaster":!0,"data-theme":M,"data-y-position":Oe,"data-lifted":$&&S.length>1&&!a,"data-x-position":ze,style:{"--front-toast-height":`${((le=A[0])==null?void 0:le.height)||0}px`,"--width":`${zT}px`,"--gap":`${y}px`,...p,...KT(c,u)},onBlur:fe=>{L.current&&!fe.currentTarget.contains(fe.relatedTarget)&&(L.current=!1,T.current&&(T.current.focus({preventScroll:!0}),T.current=null))},onFocus:fe=>{fe.target instanceof HTMLElement&&fe.target.dataset.dismissible==="false"||L.current||(L.current=!0,T.current=fe.relatedTarget)},onMouseEnter:()=>R(!0),onMouseMove:()=>R(!0),onMouseLeave:()=>{H||R(!1)},onDragEnd:()=>R(!1),onPointerDown:fe=>{fe.target instanceof HTMLElement&&fe.target.dataset.dismissible==="false"||N(!0)},onPointerUp:()=>N(!1)},S.filter(fe=>!fe.position&&ee===0||fe.position===K).map((fe,Vr)=>{var Qe,_r;return B.createElement(VT,{key:fe.id,icons:x,index:Vr,toast:fe,defaultRichColors:h,duration:(Qe=g==null?void 0:g.duration)!=null?Qe:f,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:b,closeButton:(_r=g==null?void 0:g.closeButton)!=null?_r:o,interacting:H,position:K,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:q,toasts:S.filter(yn=>yn.position==fe.position),heights:A.filter(yn=>yn.position==fe.position),setHeights:P,expandByDefault:a,gap:y,loadingIcon:v,expanded:$,pauseWhenPageIsHidden:j,swipeDirections:e.swipeDirections})})):null}))});const WT=({...e})=>{const{theme:t="system"}=xT();return i.jsx(qT,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},GT=1,YT=1e6;let th=0;function JT(){return th=(th+1)%Number.MAX_SAFE_INTEGER,th.toString()}const rh=new Map,Oy=e=>{if(rh.has(e))return;const t=setTimeout(()=>{rh.delete(e),fo({type:"REMOVE_TOAST",toastId:e})},YT);rh.set(e,t)},ZT=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,GT)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Oy(r):e.toasts.forEach(n=>{Oy(n.id)}),{...e,toasts:e.toasts.map(n=>n.id===r||r===void 0?{...n,open:!1}:n)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},_c=[];let kc={toasts:[]};function fo(e){kc=ZT(kc,e),_c.forEach(t=>{t(kc)})}function QT({...e}){const t=JT(),r=s=>fo({type:"UPDATE_TOAST",toast:{...s,id:t}}),n=()=>fo({type:"DISMISS_TOAST",toastId:t});return fo({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:s=>{s||n()}}}),{id:t,dismiss:n,update:r}}function XT(){const[e,t]=m.useState(kc);return m.useEffect(()=>(_c.push(t),()=>{const r=_c.indexOf(t);r>-1&&_c.splice(r,1)}),[e]),{...e,toast:QT,dismiss:r=>fo({type:"DISMISS_TOAST",toastId:r})}}function X(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Iy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Hu(...e){return t=>{let r=!1;const n=e.map(s=>{const a=Iy(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<n.length;s++){const a=n[s];typeof a=="function"?a():Iy(e[s],null)}}}}function $e(...e){return m.useCallback(Hu(...e),e)}function e2(e,t){const r=m.createContext(t),n=a=>{const{children:o,...l}=a,c=m.useMemo(()=>l,Object.values(l));return i.jsx(r.Provider,{value:c,children:o})};n.displayName=e+"Provider";function s(a){const o=m.useContext(r);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[n,s]}function Fr(e,t=[]){let r=[];function n(a,o){const l=m.createContext(o),c=r.length;r=[...r,o];const u=h=>{var y;const{scope:f,children:p,...b}=h,g=((y=f==null?void 0:f[e])==null?void 0:y[c])||l,w=m.useMemo(()=>b,Object.values(b));return i.jsx(g.Provider,{value:w,children:p})};u.displayName=a+"Provider";function d(h,f){var g;const p=((g=f==null?void 0:f[e])==null?void 0:g[c])||l,b=m.useContext(p);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[u,d]}const s=()=>{const a=r.map(o=>m.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,t2(s,...t)]}function t2(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=n.reduce((l,{useScope:c,scopeName:u})=>{const h=c(a)[`__scope${u}`];return{...l,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function hi(e){const t=n2(e),r=m.forwardRef((n,s)=>{const{children:a,...o}=n,l=m.Children.toArray(a),c=l.find(s2);if(c){const u=c.props.children,d=l.map(h=>h===c?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:h);return i.jsx(t,{...o,ref:s,children:m.isValidElement(u)?m.cloneElement(u,void 0,d):null})}return i.jsx(t,{...o,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}var r2=hi("Slot");function n2(e){const t=m.forwardRef((r,n)=>{const{children:s,...a}=r;if(m.isValidElement(s)){const o=i2(s),l=a2(a,s.props);return s.type!==m.Fragment&&(l.ref=n?Hu(n,o):o),m.cloneElement(s,l)}return m.Children.count(s)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uw=Symbol("radix.slottable");function dw(e){const t=({children:r})=>i.jsx(i.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=uw,t}function s2(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uw}function a2(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function i2(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function um(e){const t=e+"CollectionProvider",[r,n]=Fr(t),[s,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:w,children:y}=g,v=B.useRef(null),x=B.useRef(new Map).current;return i.jsx(s,{scope:w,itemMap:x,collectionRef:v,children:y})};o.displayName=t;const l=e+"CollectionSlot",c=hi(l),u=B.forwardRef((g,w)=>{const{scope:y,children:v}=g,x=a(l,y),_=$e(w,x.collectionRef);return i.jsx(c,{ref:_,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",h="data-radix-collection-item",f=hi(d),p=B.forwardRef((g,w)=>{const{scope:y,children:v,...x}=g,_=B.useRef(null),j=$e(w,_),S=a(d,y);return B.useEffect(()=>(S.itemMap.set(_,{ref:_,...x}),()=>void S.itemMap.delete(_))),i.jsx(f,{[h]:"",ref:j,children:v})});p.displayName=d;function b(g){const w=a(e+"CollectionConsumer",g);return B.useCallback(()=>{const v=w.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((S,C)=>x.indexOf(S.ref.current)-x.indexOf(C.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:u,ItemSlot:p},b,n]}var o2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xe=o2.reduce((e,t)=>{const r=hi(`Primitive.${t}`),n=m.forwardRef((s,a)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function dm(e,t){e&&ll.flushSync(()=>e.dispatchEvent(t))}function Mt(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)},[])}function l2(e,t=globalThis==null?void 0:globalThis.document){const r=Mt(e);m.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var c2="DismissableLayer",Rf="dismissableLayer.update",u2="dismissableLayer.pointerDownOutside",d2="dismissableLayer.focusOutside",Dy,hw=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cl=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=e,u=m.useContext(hw),[d,h]=m.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=m.useState({}),b=$e(t,C=>h(C)),g=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(w),v=d?g.indexOf(d):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,_=v>=y,j=f2(C=>{const k=C.target,A=[...u.branches].some(P=>P.contains(k));!_||A||(s==null||s(C),o==null||o(C),C.defaultPrevented||l==null||l())},f),S=p2(C=>{const k=C.target;[...u.branches].some(P=>P.contains(k))||(a==null||a(C),o==null||o(C),C.defaultPrevented||l==null||l())},f);return l2(C=>{v===u.layers.size-1&&(n==null||n(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},f),m.useEffect(()=>{if(d)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Dy=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),My(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Dy)}},[d,f,r,u]),m.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),My())},[d,u]),m.useEffect(()=>{const C=()=>p({});return document.addEventListener(Rf,C),()=>document.removeEventListener(Rf,C)},[]),i.jsx(xe.div,{...c,ref:b,style:{pointerEvents:x?_?"auto":"none":void 0,...e.style},onFocusCapture:X(e.onFocusCapture,S.onFocusCapture),onBlurCapture:X(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:X(e.onPointerDownCapture,j.onPointerDownCapture)})});cl.displayName=c2;var h2="DismissableLayerBranch",fw=m.forwardRef((e,t)=>{const r=m.useContext(hw),n=m.useRef(null),s=$e(t,n);return m.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),i.jsx(xe.div,{...e,ref:s})});fw.displayName=h2;function f2(e,t=globalThis==null?void 0:globalThis.document){const r=Mt(e),n=m.useRef(!1),s=m.useRef(()=>{});return m.useEffect(()=>{const a=l=>{if(l.target&&!n.current){let c=function(){pw(u2,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function p2(e,t=globalThis==null?void 0:globalThis.document){const r=Mt(e),n=m.useRef(!1);return m.useEffect(()=>{const s=a=>{a.target&&!n.current&&pw(d2,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function My(){const e=new CustomEvent(Rf);document.dispatchEvent(e)}function pw(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?dm(s,a):s.dispatchEvent(a)}var m2=cl,g2=fw,ln=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},y2="Portal",Vu=m.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[s,a]=m.useState(!1);ln(()=>a(!0),[]);const o=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?$b.createPortal(i.jsx(xe.div,{...n,ref:t}),o):null});Vu.displayName=y2;function v2(e,t){return m.useReducer((r,n)=>t[r][n]??r,e)}var br=e=>{const{present:t,children:r}=e,n=x2(t),s=typeof r=="function"?r({present:n.isPresent}):m.Children.only(r),a=$e(n.ref,b2(s));return typeof r=="function"||n.isPresent?m.cloneElement(s,{ref:a}):null};br.displayName="Presence";function x2(e){const[t,r]=m.useState(),n=m.useRef(null),s=m.useRef(e),a=m.useRef("none"),o=e?"mounted":"unmounted",[l,c]=v2(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=ql(n.current);a.current=l==="mounted"?u:"none"},[l]),ln(()=>{const u=n.current,d=s.current;if(d!==e){const f=a.current,p=ql(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&f!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),ln(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=p=>{const g=ql(n.current).includes(p.animationName);if(p.target===t&&g&&(c("ANIMATION_END"),!s.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},f=p=>{p.target===t&&(a.current=ql(n.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(u=>{n.current=u?getComputedStyle(u):null,r(u)},[])}}function ql(e){return(e==null?void 0:e.animationName)||"none"}function b2(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var w2=fp[" useInsertionEffect ".trim().toString()]||ln;function ul({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,o]=_2({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:s;{const d=m.useRef(e!==void 0);m.useEffect(()=>{const h=d.current;h!==l&&console.warn(`${n} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const u=m.useCallback(d=>{var h;if(l){const f=k2(d)?d(e):d;f!==e&&((h=o.current)==null||h.call(o,f))}else a(d)},[l,e,a,o]);return[c,u]}function _2({defaultProp:e,onChange:t}){const[r,n]=m.useState(e),s=m.useRef(r),a=m.useRef(t);return w2(()=>{a.current=t},[t]),m.useEffect(()=>{var o;s.current!==r&&((o=a.current)==null||o.call(a,r),s.current=r)},[r,s]),[r,n,a]}function k2(e){return typeof e=="function"}var j2=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),S2="VisuallyHidden",Ku=m.forwardRef((e,t)=>i.jsx(xe.span,{...e,ref:t,style:{...j2,...e.style}}));Ku.displayName=S2;var N2=Ku,hm="ToastProvider",[fm,E2,C2]=um("Toast"),[mw,R$]=Fr("Toast",[C2]),[T2,qu]=mw(hm),gw=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:a=50,children:o}=e,[l,c]=m.useState(null),[u,d]=m.useState(0),h=m.useRef(!1),f=m.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${hm}\`. Expected non-empty \`string\`.`),i.jsx(fm.Provider,{scope:t,children:i.jsx(T2,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:a,toastCount:u,viewport:l,onViewportChange:c,onToastAdd:m.useCallback(()=>d(p=>p+1),[]),onToastRemove:m.useCallback(()=>d(p=>p-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:f,children:o})})};gw.displayName=hm;var yw="ToastViewport",R2=["F8"],Af="toast.viewportPause",Pf="toast.viewportResume",vw=m.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=R2,label:s="Notifications ({hotkey})",...a}=e,o=qu(yw,r),l=E2(r),c=m.useRef(null),u=m.useRef(null),d=m.useRef(null),h=m.useRef(null),f=$e(t,h,o.onViewportChange),p=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),b=o.toastCount>0;m.useEffect(()=>{const w=y=>{var x;n.length!==0&&n.every(_=>y[_]||y.code===_)&&((x=h.current)==null||x.focus())};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[n]),m.useEffect(()=>{const w=c.current,y=h.current;if(b&&w&&y){const v=()=>{if(!o.isClosePausedRef.current){const S=new CustomEvent(Af);y.dispatchEvent(S),o.isClosePausedRef.current=!0}},x=()=>{if(o.isClosePausedRef.current){const S=new CustomEvent(Pf);y.dispatchEvent(S),o.isClosePausedRef.current=!1}},_=S=>{!w.contains(S.relatedTarget)&&x()},j=()=>{w.contains(document.activeElement)||x()};return w.addEventListener("focusin",v),w.addEventListener("focusout",_),w.addEventListener("pointermove",v),w.addEventListener("pointerleave",j),window.addEventListener("blur",v),window.addEventListener("focus",x),()=>{w.removeEventListener("focusin",v),w.removeEventListener("focusout",_),w.removeEventListener("pointermove",v),w.removeEventListener("pointerleave",j),window.removeEventListener("blur",v),window.removeEventListener("focus",x)}}},[b,o.isClosePausedRef]);const g=m.useCallback(({tabbingDirection:w})=>{const v=l().map(x=>{const _=x.ref.current,j=[_,...H2(_)];return w==="forwards"?j:j.reverse()});return(w==="forwards"?v.reverse():v).flat()},[l]);return m.useEffect(()=>{const w=h.current;if(w){const y=v=>{var j,S,C;const x=v.altKey||v.ctrlKey||v.metaKey;if(v.key==="Tab"&&!x){const k=document.activeElement,A=v.shiftKey;if(v.target===w&&A){(j=u.current)==null||j.focus();return}const R=g({tabbingDirection:A?"backwards":"forwards"}),H=R.findIndex(N=>N===k);nh(R.slice(H+1))?v.preventDefault():A?(S=u.current)==null||S.focus():(C=d.current)==null||C.focus()}};return w.addEventListener("keydown",y),()=>w.removeEventListener("keydown",y)}},[l,g]),i.jsxs(g2,{ref:c,role:"region","aria-label":s.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:b?void 0:"none"},children:[b&&i.jsx(Of,{ref:u,onFocusFromOutsideViewport:()=>{const w=g({tabbingDirection:"forwards"});nh(w)}}),i.jsx(fm.Slot,{scope:r,children:i.jsx(xe.ol,{tabIndex:-1,...a,ref:f})}),b&&i.jsx(Of,{ref:d,onFocusFromOutsideViewport:()=>{const w=g({tabbingDirection:"backwards"});nh(w)}})]})});vw.displayName=yw;var xw="ToastFocusProxy",Of=m.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,a=qu(xw,r);return i.jsx(Ku,{"aria-hidden":!0,tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:o=>{var u;const l=o.relatedTarget;!((u=a.viewport)!=null&&u.contains(l))&&n()}})});Of.displayName=xw;var dl="Toast",A2="toast.swipeStart",P2="toast.swipeMove",O2="toast.swipeCancel",I2="toast.swipeEnd",bw=m.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:a,...o}=e,[l,c]=ul({prop:n,defaultProp:s??!0,onChange:a,caller:dl});return i.jsx(br,{present:r||l,children:i.jsx(L2,{open:l,...o,ref:t,onClose:()=>c(!1),onPause:Mt(e.onPause),onResume:Mt(e.onResume),onSwipeStart:X(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:X(e.onSwipeMove,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:X(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:X(e.onSwipeEnd,u=>{const{x:d,y:h}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});bw.displayName=dl;var[D2,M2]=mw(dl,{onClose(){}}),L2=m.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:a,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:h,onSwipeCancel:f,onSwipeEnd:p,...b}=e,g=qu(dl,r),[w,y]=m.useState(null),v=$e(t,N=>y(N)),x=m.useRef(null),_=m.useRef(null),j=s||g.duration,S=m.useRef(0),C=m.useRef(j),k=m.useRef(0),{onToastAdd:A,onToastRemove:P}=g,$=Mt(()=>{var M;(w==null?void 0:w.contains(document.activeElement))&&((M=g.viewport)==null||M.focus()),o()}),R=m.useCallback(N=>{!N||N===1/0||(window.clearTimeout(k.current),S.current=new Date().getTime(),k.current=window.setTimeout($,N))},[$]);m.useEffect(()=>{const N=g.viewport;if(N){const M=()=>{R(C.current),u==null||u()},I=()=>{const z=new Date().getTime()-S.current;C.current=C.current-z,window.clearTimeout(k.current),c==null||c()};return N.addEventListener(Af,I),N.addEventListener(Pf,M),()=>{N.removeEventListener(Af,I),N.removeEventListener(Pf,M)}}},[g.viewport,j,c,u,R]),m.useEffect(()=>{a&&!g.isClosePausedRef.current&&R(j)},[a,j,g.isClosePausedRef,R]),m.useEffect(()=>(A(),()=>P()),[A,P]);const H=m.useMemo(()=>w?Ew(w):null,[w]);return g.viewport?i.jsxs(i.Fragment,{children:[H&&i.jsx($2,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite","aria-atomic":!0,children:H}),i.jsx(D2,{scope:r,onClose:$,children:ll.createPortal(i.jsx(fm.ItemSlot,{scope:r,children:i.jsx(m2,{asChild:!0,onEscapeKeyDown:X(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||$(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:i.jsx(xe.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":g.swipeDirection,...b,ref:v,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:X(e.onKeyDown,N=>{N.key==="Escape"&&(l==null||l(N.nativeEvent),N.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:X(e.onPointerDown,N=>{N.button===0&&(x.current={x:N.clientX,y:N.clientY})}),onPointerMove:X(e.onPointerMove,N=>{if(!x.current)return;const M=N.clientX-x.current.x,I=N.clientY-x.current.y,z=!!_.current,E=["left","right"].includes(g.swipeDirection),T=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,L=E?T(0,M):0,q=E?0:T(0,I),K=N.pointerType==="touch"?10:2,ee={x:L,y:q},le={originalEvent:N,delta:ee};z?(_.current=ee,Wl(P2,h,le,{discrete:!1})):Ly(ee,g.swipeDirection,K)?(_.current=ee,Wl(A2,d,le,{discrete:!1}),N.target.setPointerCapture(N.pointerId)):(Math.abs(M)>K||Math.abs(I)>K)&&(x.current=null)}),onPointerUp:X(e.onPointerUp,N=>{const M=_.current,I=N.target;if(I.hasPointerCapture(N.pointerId)&&I.releasePointerCapture(N.pointerId),_.current=null,x.current=null,M){const z=N.currentTarget,E={originalEvent:N,delta:M};Ly(M,g.swipeDirection,g.swipeThreshold)?Wl(I2,p,E,{discrete:!0}):Wl(O2,f,E,{discrete:!0}),z.addEventListener("click",T=>T.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),$2=e=>{const{__scopeToast:t,children:r,...n}=e,s=qu(dl,t),[a,o]=m.useState(!1),[l,c]=m.useState(!1);return F2(()=>o(!0)),m.useEffect(()=>{const u=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(u)},[]),l?null:i.jsx(Vu,{asChild:!0,children:i.jsx(Ku,{...n,children:a&&i.jsxs(i.Fragment,{children:[s.label," ",r]})})})},z2="ToastTitle",ww=m.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return i.jsx(xe.div,{...n,ref:t})});ww.displayName=z2;var U2="ToastDescription",_w=m.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return i.jsx(xe.div,{...n,ref:t})});_w.displayName=U2;var kw="ToastAction",jw=m.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?i.jsx(Nw,{altText:r,asChild:!0,children:i.jsx(pm,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${kw}\`. Expected non-empty \`string\`.`),null)});jw.displayName=kw;var Sw="ToastClose",pm=m.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=M2(Sw,r);return i.jsx(Nw,{asChild:!0,children:i.jsx(xe.button,{type:"button",...n,ref:t,onClick:X(e.onClick,s.onClose)})})});pm.displayName=Sw;var Nw=m.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return i.jsx(xe.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function Ew(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),B2(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",a=n.dataset.radixToastAnnounceExclude==="";if(!s)if(a){const o=n.dataset.radixToastAnnounceAlt;o&&t.push(o)}else t.push(...Ew(n))}}),t}function Wl(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?dm(s,a):s.dispatchEvent(a)}var Ly=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),a=n>s;return t==="left"||t==="right"?a&&n>r:!a&&s>r};function F2(e=()=>{}){const t=Mt(e);ln(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function B2(e){return e.nodeType===e.ELEMENT_NODE}function H2(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function nh(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var V2=gw,Cw=vw,Tw=bw,Rw=ww,Aw=_w,Pw=jw,Ow=pm;function Iw(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Iw(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Dw(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Iw(e))&&(n&&(n+=" "),n+=t);return n}const $y=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,zy=Dw,Wu=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return zy(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:a}=t,o=Object.keys(s).map(u=>{const d=r==null?void 0:r[u],h=a==null?void 0:a[u];if(d===null)return null;const f=$y(d)||$y(h);return s[u][f]}),l=r&&Object.entries(r).reduce((u,d)=>{let[h,f]=d;return f===void 0||(u[h]=f),u},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((u,d)=>{let{class:h,className:f,...p}=d;return Object.entries(p).every(b=>{let[g,w]=b;return Array.isArray(w)?w.includes({...a,...l}[g]):{...a,...l}[g]===w})?[...u,h,f]:u},[]);return zy(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)};/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Mw=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/var q2={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.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W2=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:o,...l},c)=>m.createElement("svg",{ref:c,...q2,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Mw("lucide",s),...l},[...o.map(([u,d])=>m.createElement(u,d)),...Array.isArray(a)?a:[a]]));/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const re=(e,t)=>{const r=m.forwardRef(({className:n,...s},a)=>m.createElement(W2,{ref:a,iconNode:t,className:Mw(`lucide-${K2(e)}`,n),...s}));return r.displayName=`${e}`,r};/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const G2=re("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Y2=re("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const J2=re("ArrowUpDown",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Z2=re("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Q2=re("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Gu=re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const X2=re("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eR=re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Yu=re("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tR=re("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ju=re("CircleX",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rR=re("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nR=re("Copy",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sR=re("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const aR=re("Eye",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const iR=re("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const oR=re("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const lR=re("GripVertical",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zo=re("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const cR=re("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const uR=re("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rt=re("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const dR=re("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const hR=re("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const fR=re("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pR=re("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mR=re("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Us=re("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const mm=re("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gR=re("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Lw=re("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Zu=re("Package",[["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"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Qu=re("Pencil",[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const yR=re("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qs=re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const vR=re("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uy=re("RotateCcw",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const gm=re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uo=re("Send",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const xR=re("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $w=re("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const po=re("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const bR=re("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const zw=re("Star",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const wR=re("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _R=re("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const kR=re("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ws=re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sh=re("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const jR=re("TriangleAlert",[["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"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const SR=re("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const NR=re("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const If=re("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Uw=re("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ds=re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ER=re("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]),ym="-",CR=e=>{const t=RR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(ym);return l[0]===""&&l.length!==1&&l.shift(),Fw(l,t)||TR(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},Fw=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?Fw(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const a=e.join(ym);return(o=t.validators.find(({validator:l})=>l(a)))==null?void 0:o.classGroupId},Fy=/^\[(.+)\]$/,TR=e=>{if(Fy.test(e)){const t=Fy.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},RR=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return PR(Object.entries(e.classGroups),r).forEach(([a,o])=>{Df(o,n,a,t)}),n},Df=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?t:By(t,s);a.classGroupId=r;return}if(typeof s=="function"){if(AR(s)){Df(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([a,o])=>{Df(o,By(t,a),r,n)})})},By=(e,t)=>{let r=e;return t.split(ym).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},AR=e=>e.isThemeGetter,PR=(e,t)=>t?e.map(([r,n])=>{const s=n.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,l])=>[t+o,l])):a);return[r,s]}):e,OR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(a,o)=>{r.set(a,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(a){let o=r.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return s(a,o),o},set(a,o){r.has(a)?r.set(a,o):s(a,o)}}},Bw="!",IR=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],a=t.length,o=l=>{const c=[];let u=0,d=0,h;for(let w=0;w<l.length;w++){let y=l[w];if(u===0){if(y===s&&(n||l.slice(w,w+a)===t)){c.push(l.slice(d,w)),d=w+a;continue}if(y==="/"){h=w;continue}}y==="["?u++:y==="]"&&u--}const f=c.length===0?l:l.substring(d),p=f.startsWith(Bw),b=p?f.substring(1):f,g=h&&h>d?h-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:b,maybePostfixModifierPosition:g}};return r?l=>r({className:l,parseClassName:o}):o},DR=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},MR=e=>({cache:OR(e.cacheSize),parseClassName:IR(e),...CR(e)}),LR=/\s+/,$R=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,a=[],o=e.trim().split(LR);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:h,baseClassName:f,maybePostfixModifierPosition:p}=r(u);let b=!!p,g=n(b?f.substring(0,p):f);if(!g){if(!b){l=u+(l.length>0?" "+l:l);continue}if(g=n(f),!g){l=u+(l.length>0?" "+l:l);continue}b=!1}const w=DR(d).join(":"),y=h?w+Bw:w,v=y+g;if(a.includes(v))continue;a.push(v);const x=s(g,b);for(let _=0;_<x.length;++_){const j=x[_];a.push(y+j)}l=u+(l.length>0?" "+l:l)}return l};function zR(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=Hw(t))&&(n&&(n+=" "),n+=r);return n}const Hw=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Hw(e[n]))&&(r&&(r+=" "),r+=t);return r};function UR(e,...t){let r,n,s,a=o;function o(c){const u=t.reduce((d,h)=>h(d),e());return r=MR(u),n=r.cache.get,s=r.cache.set,a=l,l(c)}function l(c){const u=n(c);if(u)return u;const d=$R(c,r);return s(c,d),d}return function(){return a(zR.apply(null,arguments))}}const Ce=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},Vw=/^\[(?:([a-z-]+):)?(.+)\]$/i,FR=/^\d+\/\d+$/,BR=new Set(["px","full","screen"]),HR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,VR=/\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$/,KR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,qR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,WR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qr=e=>Va(e)||BR.has(e)||FR.test(e),kn=e=>Ni(e,"length",tA),Va=e=>!!e&&!Number.isNaN(Number(e)),ah=e=>Ni(e,"number",Va),Vi=e=>!!e&&Number.isInteger(Number(e)),GR=e=>e.endsWith("%")&&Va(e.slice(0,-1)),ce=e=>Vw.test(e),jn=e=>HR.test(e),YR=new Set(["length","size","percentage"]),JR=e=>Ni(e,YR,Kw),ZR=e=>Ni(e,"position",Kw),QR=new Set(["image","url"]),XR=e=>Ni(e,QR,nA),eA=e=>Ni(e,"",rA),Ki=()=>!0,Ni=(e,t,r)=>{const n=Vw.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},tA=e=>VR.test(e)&&!KR.test(e),Kw=()=>!1,rA=e=>qR.test(e),nA=e=>WR.test(e),sA=()=>{const e=Ce("colors"),t=Ce("spacing"),r=Ce("blur"),n=Ce("brightness"),s=Ce("borderColor"),a=Ce("borderRadius"),o=Ce("borderSpacing"),l=Ce("borderWidth"),c=Ce("contrast"),u=Ce("grayscale"),d=Ce("hueRotate"),h=Ce("invert"),f=Ce("gap"),p=Ce("gradientColorStops"),b=Ce("gradientColorStopPositions"),g=Ce("inset"),w=Ce("margin"),y=Ce("opacity"),v=Ce("padding"),x=Ce("saturate"),_=Ce("scale"),j=Ce("sepia"),S=Ce("skew"),C=Ce("space"),k=Ce("translate"),A=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",ce,t],R=()=>[ce,t],H=()=>["",qr,kn],N=()=>["auto",Va,ce],M=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],I=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],E=()=>["start","end","center","between","around","evenly","stretch"],T=()=>["","0",ce],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[Va,ce];return{cacheSize:500,separator:":",theme:{colors:[Ki],spacing:[qr,kn],blur:["none","",jn,ce],brightness:q(),borderColor:[e],borderRadius:["none","","full",jn,ce],borderSpacing:R(),borderWidth:H(),contrast:q(),grayscale:T(),hueRotate:q(),invert:T(),gap:R(),gradientColorStops:[e],gradientColorStopPositions:[GR,kn],inset:$(),margin:$(),opacity:q(),padding:R(),saturate:q(),scale:q(),sepia:T(),skew:q(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",ce]}],container:["container"],columns:[{columns:[jn]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...M(),ce]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Vi,ce]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ce]}],grow:[{grow:T()}],shrink:[{shrink:T()}],order:[{order:["first","last","none",Vi,ce]}],"grid-cols":[{"grid-cols":[Ki]}],"col-start-end":[{col:["auto",{span:["full",Vi,ce]},ce]}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":[Ki]}],"row-start-end":[{row:["auto",{span:[Vi,ce]},ce]}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ce]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ce]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...E()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...E(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...E(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ce,t]}],"min-w":[{"min-w":[ce,t,"min","max","fit"]}],"max-w":[{"max-w":[ce,t,"none","full","min","max","fit","prose",{screen:[jn]},jn]}],h:[{h:[ce,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ce,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ce,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ce,t,"auto","min","max","fit"]}],"font-size":[{text:["base",jn,kn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ah]}],"font-family":[{font:[Ki]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ce]}],"line-clamp":[{"line-clamp":["none",Va,ah]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",qr,ce]}],"list-image":[{"list-image":["none",ce]}],"list-style-type":[{list:["none","disc","decimal",ce]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...I(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",qr,kn]}],"underline-offset":[{"underline-offset":["auto",qr,ce]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ce]}],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",ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...M(),ZR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",JR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},XR]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[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":[y]}],"border-style":[{border:[...I(),"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":[y]}],"divide-style":[{divide:I()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...I()]}],"outline-offset":[{"outline-offset":[qr,ce]}],"outline-w":[{outline:[qr,kn]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[qr,kn]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",jn,eA]}],"shadow-color":[{shadow:[Ki]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",jn,ce]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[x]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[x]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ce]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",ce]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",ce]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Vi,ce]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ce]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ce]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ce]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[qr,kn,ah]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},aA=UR(sA);function de(...e){return aA(Dw(e))}const iA=V2,qw=m.forwardRef(({className:e,...t},r)=>i.jsx(Cw,{ref:r,className:de("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));qw.displayName=Cw.displayName;const oA=Wu("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Ww=m.forwardRef(({className:e,variant:t,...r},n)=>i.jsx(Tw,{ref:n,className:de(oA({variant:t}),e),...r}));Ww.displayName=Tw.displayName;const lA=m.forwardRef(({className:e,...t},r)=>i.jsx(Pw,{ref:r,className:de("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));lA.displayName=Pw.displayName;const Gw=m.forwardRef(({className:e,...t},r)=>i.jsx(Ow,{ref:r,className:de("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:i.jsx(ds,{className:"h-4 w-4"})}));Gw.displayName=Ow.displayName;const Yw=m.forwardRef(({className:e,...t},r)=>i.jsx(Rw,{ref:r,className:de("text-sm font-semibold",e),...t}));Yw.displayName=Rw.displayName;const Jw=m.forwardRef(({className:e,...t},r)=>i.jsx(Aw,{ref:r,className:de("text-sm opacity-90",e),...t}));Jw.displayName=Aw.displayName;function cA(){const{toasts:e}=XT();return i.jsxs(iA,{children:[e.map(function({id:t,title:r,description:n,action:s,...a}){return i.jsxs(Ww,{...a,children:[i.jsxs("div",{className:"grid gap-1",children:[r&&i.jsx(Yw,{children:r}),n&&i.jsx(Jw,{children:n})]}),s,i.jsx(Gw,{})]},t)}),i.jsx(qw,{})]})}var uA=fp[" useId ".trim().toString()]||(()=>{}),dA=0;function Is(e){const[t,r]=m.useState(uA());return ln(()=>{e||r(n=>n??String(dA++))},[e]),e||(t?`radix-${t}`:"")}const hA=["top","right","bottom","left"],ss=Math.min,Rt=Math.max,nu=Math.round,Gl=Math.floor,Mr=e=>({x:e,y:e}),fA={left:"right",right:"left",bottom:"top",top:"bottom"},pA={start:"end",end:"start"};function Mf(e,t,r){return Rt(e,ss(t,r))}function cn(e,t){return typeof e=="function"?e(t):e}function un(e){return e.split("-")[0]}function Ei(e){return e.split("-")[1]}function vm(e){return e==="x"?"y":"x"}function xm(e){return e==="y"?"height":"width"}const mA=new Set(["top","bottom"]);function Or(e){return mA.has(un(e))?"y":"x"}function bm(e){return vm(Or(e))}function gA(e,t,r){r===void 0&&(r=!1);const n=Ei(e),s=bm(e),a=xm(s);let o=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=su(o)),[o,su(o)]}function yA(e){const t=su(e);return[Lf(e),t,Lf(t)]}function Lf(e){return e.replace(/start|end/g,t=>pA[t])}const Hy=["left","right"],Vy=["right","left"],vA=["top","bottom"],xA=["bottom","top"];function bA(e,t,r){switch(e){case"top":case"bottom":return r?t?Vy:Hy:t?Hy:Vy;case"left":case"right":return t?vA:xA;default:return[]}}function wA(e,t,r,n){const s=Ei(e);let a=bA(un(e),r==="start",n);return s&&(a=a.map(o=>o+"-"+s),t&&(a=a.concat(a.map(Lf)))),a}function su(e){return e.replace(/left|right|bottom|top/g,t=>fA[t])}function _A(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zw(e){return typeof e!="number"?_A(e):{top:e,right:e,bottom:e,left:e}}function au(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function Ky(e,t,r){let{reference:n,floating:s}=e;const a=Or(t),o=bm(t),l=xm(o),c=un(t),u=a==="y",d=n.x+n.width/2-s.width/2,h=n.y+n.height/2-s.height/2,f=n[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:n.y-s.height};break;case"bottom":p={x:d,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:h};break;case"left":p={x:n.x-s.width,y:h};break;default:p={x:n.x,y:n.y}}switch(Ei(t)){case"start":p[o]-=f*(r&&u?-1:1);break;case"end":p[o]+=f*(r&&u?-1:1);break}return p}const kA=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:a=[],platform:o}=r,l=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:h}=Ky(u,n,c),f=n,p={},b=0;for(let g=0;g<l.length;g++){const{name:w,fn:y}=l[g],{x:v,y:x,data:_,reset:j}=await y({x:d,y:h,initialPlacement:n,placement:f,strategy:s,middlewareData:p,rects:u,platform:o,elements:{reference:e,floating:t}});d=v??d,h=x??h,p={...p,[w]:{...p[w],..._}},j&&b<=50&&(b++,typeof j=="object"&&(j.placement&&(f=j.placement),j.rects&&(u=j.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:d,y:h}=Ky(u,f,c)),g=-1)}return{x:d,y:h,placement:f,strategy:s,middlewareData:p}};async function Fo(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:a,rects:o,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=cn(t,e),b=Zw(p),w=l[f?h==="floating"?"reference":"floating":h],y=au(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(w)))==null||r?w:w.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=h==="floating"?{x:n,y:s,width:o.floating.width,height:o.floating.height}:o.reference,x=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),_=await(a.isElement==null?void 0:a.isElement(x))?await(a.getScale==null?void 0:a.getScale(x))||{x:1,y:1}:{x:1,y:1},j=au(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-j.top+b.top)/_.y,bottom:(j.bottom-y.bottom+b.bottom)/_.y,left:(y.left-j.left+b.left)/_.x,right:(j.right-y.right+b.right)/_.x}}const jA=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:a,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=cn(e,t)||{};if(u==null)return{};const h=Zw(d),f={x:r,y:n},p=bm(s),b=xm(p),g=await o.getDimensions(u),w=p==="y",y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",_=a.reference[b]+a.reference[p]-f[p]-a.floating[b],j=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let C=S?S[x]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=l.floating[x]||a.floating[b]);const k=_/2-j/2,A=C/2-g[b]/2-1,P=ss(h[y],A),$=ss(h[v],A),R=P,H=C-g[b]-$,N=C/2-g[b]/2+k,M=Mf(R,N,H),I=!c.arrow&&Ei(s)!=null&&N!==M&&a.reference[b]/2-(N<R?P:$)-g[b]/2<0,z=I?N<R?N-R:N-H:0;return{[p]:f[p]+z,data:{[p]:M,centerOffset:N-M-z,...I&&{alignmentOffset:z}},reset:I}}}),SA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:a,rects:o,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:g=!0,...w}=cn(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const y=un(s),v=Or(l),x=un(l)===l,_=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=f||(x||!g?[su(l)]:yA(l)),S=b!=="none";!f&&S&&j.push(...wA(l,g,b,_));const C=[l,...j],k=await Fo(t,w),A=[];let P=((n=a.flip)==null?void 0:n.overflows)||[];if(d&&A.push(k[y]),h){const N=gA(s,o,_);A.push(k[N[0]],k[N[1]])}if(P=[...P,{placement:s,overflows:A}],!A.every(N=>N<=0)){var $,R;const N=((($=a.flip)==null?void 0:$.index)||0)+1,M=C[N];if(M&&(!(h==="alignment"?v!==Or(M):!1)||P.every(E=>E.overflows[0]>0&&Or(E.placement)===v)))return{data:{index:N,overflows:P},reset:{placement:M}};let I=(R=P.filter(z=>z.overflows[0]<=0).sort((z,E)=>z.overflows[1]-E.overflows[1])[0])==null?void 0:R.placement;if(!I)switch(p){case"bestFit":{var H;const z=(H=P.filter(E=>{if(S){const T=Or(E.placement);return T===v||T==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(T=>T>0).reduce((T,L)=>T+L,0)]).sort((E,T)=>E[1]-T[1])[0])==null?void 0:H[0];z&&(I=z);break}case"initialPlacement":I=l;break}if(s!==I)return{reset:{placement:I}}}return{}}}};function qy(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Wy(e){return hA.some(t=>e[t]>=0)}const NA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=cn(e,t);switch(n){case"referenceHidden":{const a=await Fo(t,{...s,elementContext:"reference"}),o=qy(a,r.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Wy(o)}}}case"escaped":{const a=await Fo(t,{...s,altBoundary:!0}),o=qy(a,r.floating);return{data:{escapedOffsets:o,escaped:Wy(o)}}}default:return{}}}}},Qw=new Set(["left","top"]);async function EA(e,t){const{placement:r,platform:n,elements:s}=e,a=await(n.isRTL==null?void 0:n.isRTL(s.floating)),o=un(r),l=Ei(r),c=Or(r)==="y",u=Qw.has(o)?-1:1,d=a&&c?-1:1,h=cn(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof b=="number"&&(p=l==="end"?b*-1:b),c?{x:p*d,y:f*u}:{x:f*u,y:p*d}}const CA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:a,placement:o,middlewareData:l}=t,c=await EA(t,e);return o===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:{...c,placement:o}}}}},TA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:w=>{let{x:y,y:v}=w;return{x:y,y:v}}},...c}=cn(e,t),u={x:r,y:n},d=await Fo(t,c),h=Or(un(s)),f=vm(h);let p=u[f],b=u[h];if(a){const w=f==="y"?"top":"left",y=f==="y"?"bottom":"right",v=p+d[w],x=p-d[y];p=Mf(v,p,x)}if(o){const w=h==="y"?"top":"left",y=h==="y"?"bottom":"right",v=b+d[w],x=b-d[y];b=Mf(v,b,x)}const g=l.fn({...t,[f]:p,[h]:b});return{...g,data:{x:g.x-r,y:g.y-n,enabled:{[f]:a,[h]:o}}}}}},RA=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:a,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=cn(e,t),d={x:r,y:n},h=Or(s),f=vm(h);let p=d[f],b=d[h];const g=cn(l,t),w=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const x=f==="y"?"height":"width",_=a.reference[f]-a.floating[x]+w.mainAxis,j=a.reference[f]+a.reference[x]-w.mainAxis;p<_?p=_:p>j&&(p=j)}if(u){var y,v;const x=f==="y"?"width":"height",_=Qw.has(un(s)),j=a.reference[h]-a.floating[x]+(_&&((y=o.offset)==null?void 0:y[h])||0)+(_?0:w.crossAxis),S=a.reference[h]+a.reference[x]+(_?0:((v=o.offset)==null?void 0:v[h])||0)-(_?w.crossAxis:0);b<j?b=j:b>S&&(b=S)}return{[f]:p,[h]:b}}}},AA=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:a,platform:o,elements:l}=t,{apply:c=()=>{},...u}=cn(e,t),d=await Fo(t,u),h=un(s),f=Ei(s),p=Or(s)==="y",{width:b,height:g}=a.floating;let w,y;h==="top"||h==="bottom"?(w=h,y=f===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(y=h,w=f==="end"?"top":"bottom");const v=g-d.top-d.bottom,x=b-d.left-d.right,_=ss(g-d[w],v),j=ss(b-d[y],x),S=!t.middlewareData.shift;let C=_,k=j;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(k=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(C=v),S&&!f){const P=Rt(d.left,0),$=Rt(d.right,0),R=Rt(d.top,0),H=Rt(d.bottom,0);p?k=b-2*(P!==0||$!==0?P+$:Rt(d.left,d.right)):C=g-2*(R!==0||H!==0?R+H:Rt(d.top,d.bottom))}await c({...t,availableWidth:k,availableHeight:C});const A=await o.getDimensions(l.floating);return b!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function Xu(){return typeof window<"u"}function Ci(e){return Xw(e)?(e.nodeName||"").toLowerCase():"#document"}function It(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Br(e){var t;return(t=(Xw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xw(e){return Xu()?e instanceof Node||e instanceof It(e).Node:!1}function yr(e){return Xu()?e instanceof Element||e instanceof It(e).Element:!1}function $r(e){return Xu()?e instanceof HTMLElement||e instanceof It(e).HTMLElement:!1}function Gy(e){return!Xu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof It(e).ShadowRoot}const PA=new Set(["inline","contents"]);function hl(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=vr(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!PA.has(s)}const OA=new Set(["table","td","th"]);function IA(e){return OA.has(Ci(e))}const DA=[":popover-open",":modal"];function ed(e){return DA.some(t=>{try{return e.matches(t)}catch{return!1}})}const MA=["transform","translate","scale","rotate","perspective"],LA=["transform","translate","scale","rotate","perspective","filter"],$A=["paint","layout","strict","content"];function wm(e){const t=_m(),r=yr(e)?vr(e):e;return MA.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||LA.some(n=>(r.willChange||"").includes(n))||$A.some(n=>(r.contain||"").includes(n))}function zA(e){let t=as(e);for(;$r(t)&&!fi(t);){if(wm(t))return t;if(ed(t))return null;t=as(t)}return null}function _m(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const UA=new Set(["html","body","#document"]);function fi(e){return UA.has(Ci(e))}function vr(e){return It(e).getComputedStyle(e)}function td(e){return yr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function as(e){if(Ci(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Gy(e)&&e.host||Br(e);return Gy(t)?t.host:t}function e_(e){const t=as(e);return fi(t)?e.ownerDocument?e.ownerDocument.body:e.body:$r(t)&&hl(t)?t:e_(t)}function Bo(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=e_(e),a=s===((n=e.ownerDocument)==null?void 0:n.body),o=It(s);if(a){const l=$f(o);return t.concat(o,o.visualViewport||[],hl(s)?s:[],l&&r?Bo(l):[])}return t.concat(s,Bo(s,[],r))}function $f(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function t_(e){const t=vr(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=$r(e),a=s?e.offsetWidth:r,o=s?e.offsetHeight:n,l=nu(r)!==a||nu(n)!==o;return l&&(r=a,n=o),{width:r,height:n,$:l}}function km(e){return yr(e)?e:e.contextElement}function Ka(e){const t=km(e);if(!$r(t))return Mr(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:a}=t_(t);let o=(a?nu(r.width):r.width)/n,l=(a?nu(r.height):r.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const FA=Mr(0);function r_(e){const t=It(e);return!_m()||!t.visualViewport?FA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function BA(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==It(e)?!1:t}function Fs(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),a=km(e);let o=Mr(1);t&&(n?yr(n)&&(o=Ka(n)):o=Ka(e));const l=BA(a,r,n)?r_(a):Mr(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,h=s.height/o.y;if(a){const f=It(a),p=n&&yr(n)?It(n):n;let b=f,g=$f(b);for(;g&&n&&p!==b;){const w=Ka(g),y=g.getBoundingClientRect(),v=vr(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*w.x,_=y.top+(g.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,h*=w.y,c+=x,u+=_,b=It(g),g=$f(b)}}return au({width:d,height:h,x:c,y:u})}function jm(e,t){const r=td(e).scrollLeft;return t?t.left+r:Fs(Br(e)).left+r}function n_(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-(r?0:jm(e,n)),a=n.top+t.scrollTop;return{x:s,y:a}}function HA(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const a=s==="fixed",o=Br(n),l=t?ed(t.floating):!1;if(n===o||l&&a)return r;let c={scrollLeft:0,scrollTop:0},u=Mr(1);const d=Mr(0),h=$r(n);if((h||!h&&!a)&&((Ci(n)!=="body"||hl(o))&&(c=td(n)),$r(n))){const p=Fs(n);u=Ka(n),d.x=p.x+n.clientLeft,d.y=p.y+n.clientTop}const f=o&&!h&&!a?n_(o,c,!0):Mr(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+d.x+f.x,y:r.y*u.y-c.scrollTop*u.y+d.y+f.y}}function VA(e){return Array.from(e.getClientRects())}function KA(e){const t=Br(e),r=td(e),n=e.ownerDocument.body,s=Rt(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),a=Rt(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let o=-r.scrollLeft+jm(e);const l=-r.scrollTop;return vr(n).direction==="rtl"&&(o+=Rt(t.clientWidth,n.clientWidth)-s),{width:s,height:a,x:o,y:l}}function qA(e,t){const r=It(e),n=Br(e),s=r.visualViewport;let a=n.clientWidth,o=n.clientHeight,l=0,c=0;if(s){a=s.width,o=s.height;const u=_m();(!u||u&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l,y:c}}const WA=new Set(["absolute","fixed"]);function GA(e,t){const r=Fs(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,a=$r(e)?Ka(e):Mr(1),o=e.clientWidth*a.x,l=e.clientHeight*a.y,c=s*a.x,u=n*a.y;return{width:o,height:l,x:c,y:u}}function Yy(e,t,r){let n;if(t==="viewport")n=qA(e,r);else if(t==="document")n=KA(Br(e));else if(yr(t))n=GA(t,r);else{const s=r_(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return au(n)}function s_(e,t){const r=as(e);return r===t||!yr(r)||fi(r)?!1:vr(r).position==="fixed"||s_(r,t)}function YA(e,t){const r=t.get(e);if(r)return r;let n=Bo(e,[],!1).filter(l=>yr(l)&&Ci(l)!=="body"),s=null;const a=vr(e).position==="fixed";let o=a?as(e):e;for(;yr(o)&&!fi(o);){const l=vr(o),c=wm(o);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&WA.has(s.position)||hl(o)&&!c&&s_(e,o))?n=n.filter(d=>d!==o):s=l,o=as(o)}return t.set(e,n),n}function JA(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const o=[...r==="clippingAncestors"?ed(t)?[]:YA(t,this._c):[].concat(r),n],l=o[0],c=o.reduce((u,d)=>{const h=Yy(t,d,s);return u.top=Rt(h.top,u.top),u.right=ss(h.right,u.right),u.bottom=ss(h.bottom,u.bottom),u.left=Rt(h.left,u.left),u},Yy(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function ZA(e){const{width:t,height:r}=t_(e);return{width:t,height:r}}function QA(e,t,r){const n=$r(t),s=Br(t),a=r==="fixed",o=Fs(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=Mr(0);function u(){c.x=jm(s)}if(n||!n&&!a)if((Ci(t)!=="body"||hl(s))&&(l=td(t)),n){const p=Fs(t,!0,a,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&u();a&&!n&&s&&u();const d=s&&!n&&!a?n_(s,l):Mr(0),h=o.left+l.scrollLeft-c.x-d.x,f=o.top+l.scrollTop-c.y-d.y;return{x:h,y:f,width:o.width,height:o.height}}function ih(e){return vr(e).position==="static"}function Jy(e,t){if(!$r(e)||vr(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Br(e)===r&&(r=r.ownerDocument.body),r}function a_(e,t){const r=It(e);if(ed(e))return r;if(!$r(e)){let s=as(e);for(;s&&!fi(s);){if(yr(s)&&!ih(s))return s;s=as(s)}return r}let n=Jy(e,t);for(;n&&IA(n)&&ih(n);)n=Jy(n,t);return n&&fi(n)&&ih(n)&&!wm(n)?r:n||zA(e)||r}const XA=async function(e){const t=this.getOffsetParent||a_,r=this.getDimensions,n=await r(e.floating);return{reference:QA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function eP(e){return vr(e).direction==="rtl"}const tP={convertOffsetParentRelativeRectToViewportRelativeRect:HA,getDocumentElement:Br,getClippingRect:JA,getOffsetParent:a_,getElementRects:XA,getClientRects:VA,getDimensions:ZA,getScale:Ka,isElement:yr,isRTL:eP};function i_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rP(e,t){let r=null,n;const s=Br(e);function a(){var l;clearTimeout(n),(l=r)==null||l.disconnect(),r=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const u=e.getBoundingClientRect(),{left:d,top:h,width:f,height:p}=u;if(l||t(),!f||!p)return;const b=Gl(h),g=Gl(s.clientWidth-(d+f)),w=Gl(s.clientHeight-(h+p)),y=Gl(d),x={rootMargin:-b+"px "+-g+"px "+-w+"px "+-y+"px",threshold:Rt(0,ss(1,c))||1};let _=!0;function j(S){const C=S[0].intersectionRatio;if(C!==c){if(!_)return o();C?o(!1,C):n=setTimeout(()=>{o(!1,1e-7)},1e3)}C===1&&!i_(u,e.getBoundingClientRect())&&o(),_=!1}try{r=new IntersectionObserver(j,{...x,root:s.ownerDocument})}catch{r=new IntersectionObserver(j,x)}r.observe(e)}return o(!0),a}function nP(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=km(e),d=s||a?[...u?Bo(u):[],...Bo(t)]:[];d.forEach(y=>{s&&y.addEventListener("scroll",r,{passive:!0}),a&&y.addEventListener("resize",r)});const h=u&&l?rP(u,r):null;let f=-1,p=null;o&&(p=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),r()}),u&&!c&&p.observe(u),p.observe(t));let b,g=c?Fs(e):null;c&&w();function w(){const y=Fs(e);g&&!i_(g,y)&&r(),g=y,b=requestAnimationFrame(w)}return r(),()=>{var y;d.forEach(v=>{s&&v.removeEventListener("scroll",r),a&&v.removeEventListener("resize",r)}),h==null||h(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(b)}}const sP=CA,aP=TA,iP=SA,oP=AA,lP=NA,Zy=jA,cP=RA,uP=(e,t,r)=>{const n=new Map,s={platform:tP,...r},a={...s.platform,_c:n};return kA(e,t,{...s,platform:a})};var dP=typeof document<"u",hP=function(){},jc=dP?m.useLayoutEffect:hP;function iu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!iu(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const a=s[n];if(!(a==="_owner"&&e.$$typeof)&&!iu(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function o_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qy(e,t){const r=o_(e);return Math.round(t*r)/r}function oh(e){const t=m.useRef(e);return jc(()=>{t.current=e}),t}function fP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:a,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,h]=m.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=m.useState(n);iu(f,n)||p(n);const[b,g]=m.useState(null),[w,y]=m.useState(null),v=m.useCallback(E=>{E!==S.current&&(S.current=E,g(E))},[]),x=m.useCallback(E=>{E!==C.current&&(C.current=E,y(E))},[]),_=a||b,j=o||w,S=m.useRef(null),C=m.useRef(null),k=m.useRef(d),A=c!=null,P=oh(c),$=oh(s),R=oh(u),H=m.useCallback(()=>{if(!S.current||!C.current)return;const E={placement:t,strategy:r,middleware:f};$.current&&(E.platform=$.current),uP(S.current,C.current,E).then(T=>{const L={...T,isPositioned:R.current!==!1};N.current&&!iu(k.current,L)&&(k.current=L,ll.flushSync(()=>{h(L)}))})},[f,t,r,$,R]);jc(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(E=>({...E,isPositioned:!1})))},[u]);const N=m.useRef(!1);jc(()=>(N.current=!0,()=>{N.current=!1}),[]),jc(()=>{if(_&&(S.current=_),j&&(C.current=j),_&&j){if(P.current)return P.current(_,j,H);H()}},[_,j,H,P,A]);const M=m.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:x}),[v,x]),I=m.useMemo(()=>({reference:_,floating:j}),[_,j]),z=m.useMemo(()=>{const E={position:r,left:0,top:0};if(!I.floating)return E;const T=Qy(I.floating,d.x),L=Qy(I.floating,d.y);return l?{...E,transform:"translate("+T+"px, "+L+"px)",...o_(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:T,top:L}},[r,l,I.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:H,refs:M,elements:I,floatingStyles:z}),[d,H,M,I,z])}const pP=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Zy({element:n.current,padding:s}).fn(r):{}:n?Zy({element:n,padding:s}).fn(r):{}}}},mP=(e,t)=>({...sP(e),options:[e,t]}),gP=(e,t)=>({...aP(e),options:[e,t]}),yP=(e,t)=>({...cP(e),options:[e,t]}),vP=(e,t)=>({...iP(e),options:[e,t]}),xP=(e,t)=>({...oP(e),options:[e,t]}),bP=(e,t)=>({...lP(e),options:[e,t]}),wP=(e,t)=>({...pP(e),options:[e,t]});var _P="Arrow",l_=m.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...a}=e;return i.jsx(xe.svg,{...a,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});l_.displayName=_P;var kP=l_;function jP(e){const[t,r]=m.useState(void 0);return ln(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;r({width:o,height:l})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Sm="Popper",[c_,rd]=Fr(Sm),[SP,u_]=c_(Sm),d_=e=>{const{__scopePopper:t,children:r}=e,[n,s]=m.useState(null);return i.jsx(SP,{scope:t,anchor:n,onAnchorChange:s,children:r})};d_.displayName=Sm;var h_="PopperAnchor",f_=m.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,a=u_(h_,r),o=m.useRef(null),l=$e(t,o);return m.useEffect(()=>{a.onAnchorChange((n==null?void 0:n.current)||o.current)}),n?null:i.jsx(xe.div,{...s,ref:l})});f_.displayName=h_;var Nm="PopperContent",[NP,EP]=c_(Nm),p_=m.forwardRef((e,t)=>{var fe,Vr,Qe,_r,yn,ea;const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:a="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:f=!1,updatePositionStrategy:p="optimized",onPlaced:b,...g}=e,w=u_(Nm,r),[y,v]=m.useState(null),x=$e(t,vn=>v(vn)),[_,j]=m.useState(null),S=jP(_),C=(S==null?void 0:S.width)??0,k=(S==null?void 0:S.height)??0,A=n+(a!=="center"?"-"+a:""),P=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},$=Array.isArray(u)?u:[u],R=$.length>0,H={padding:P,boundary:$.filter(TP),altBoundary:R},{refs:N,floatingStyles:M,placement:I,isPositioned:z,middlewareData:E}=fP({strategy:"fixed",placement:A,whileElementsMounted:(...vn)=>nP(...vn,{animationFrame:p==="always"}),elements:{reference:w.anchor},middleware:[mP({mainAxis:s+k,alignmentAxis:o}),c&&gP({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?yP():void 0,...H}),c&&vP({...H}),xP({...H,apply:({elements:vn,rects:_l,availableWidth:xd,availableHeight:kl})=>{const{width:bd,height:Pi}=_l.reference,ta=vn.floating.style;ta.setProperty("--radix-popper-available-width",`${xd}px`),ta.setProperty("--radix-popper-available-height",`${kl}px`),ta.setProperty("--radix-popper-anchor-width",`${bd}px`),ta.setProperty("--radix-popper-anchor-height",`${Pi}px`)}}),_&&wP({element:_,padding:l}),RP({arrowWidth:C,arrowHeight:k}),f&&bP({strategy:"referenceHidden",...H})]}),[T,L]=y_(I),q=Mt(b);ln(()=>{z&&(q==null||q())},[z,q]);const K=(fe=E.arrow)==null?void 0:fe.x,ee=(Vr=E.arrow)==null?void 0:Vr.y,le=((Qe=E.arrow)==null?void 0:Qe.centerOffset)!==0,[Oe,ze]=m.useState();return ln(()=>{y&&ze(window.getComputedStyle(y).zIndex)},[y]),i.jsx("div",{ref:N.setFloating,"data-radix-popper-content-wrapper":"",style:{...M,transform:z?M.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Oe,"--radix-popper-transform-origin":[(_r=E.transformOrigin)==null?void 0:_r.x,(yn=E.transformOrigin)==null?void 0:yn.y].join(" "),...((ea=E.hide)==null?void 0:ea.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(NP,{scope:r,placedSide:T,onArrowChange:j,arrowX:K,arrowY:ee,shouldHideArrow:le,children:i.jsx(xe.div,{"data-side":T,"data-align":L,...g,ref:x,style:{...g.style,animation:z?void 0:"none"}})})})});p_.displayName=Nm;var m_="PopperArrow",CP={top:"bottom",right:"left",bottom:"top",left:"right"},g_=m.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,a=EP(m_,n),o=CP[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(kP,{...s,ref:r,style:{...s.style,display:"block"}})})});g_.displayName=m_;function TP(e){return e!==null}var RP=e=>({name:"transformOrigin",options:e,fn(t){var w,y,v;const{placement:r,rects:n,middlewareData:s}=t,o=((w=s.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=y_(r),h={start:"0%",center:"50%",end:"100%"}[d],f=(((y=s.arrow)==null?void 0:y.x)??0)+l/2,p=(((v=s.arrow)==null?void 0:v.y)??0)+c/2;let b="",g="";return u==="bottom"?(b=o?h:`${f}px`,g=`${-c}px`):u==="top"?(b=o?h:`${f}px`,g=`${n.floating.height+c}px`):u==="right"?(b=`${-c}px`,g=o?h:`${p}px`):u==="left"&&(b=`${n.floating.width+c}px`,g=o?h:`${p}px`),{data:{x:b,y:g}}}});function y_(e){const[t,r="center"]=e.split("-");return[t,r]}var AP=d_,v_=f_,x_=p_,b_=g_,[nd,A$]=Fr("Tooltip",[rd]),Em=rd(),w_="TooltipProvider",PP=700,Xy="tooltip.open",[OP,__]=nd(w_),k_=e=>{const{__scopeTooltip:t,delayDuration:r=PP,skipDelayDuration:n=300,disableHoverableContent:s=!1,children:a}=e,o=m.useRef(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),i.jsx(OP,{scope:t,isOpenDelayedRef:o,delayDuration:r,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,n)},[n]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:s,children:a})};k_.displayName=w_;var j_="Tooltip",[P$,sd]=nd(j_),zf="TooltipTrigger",IP=m.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=sd(zf,r),a=__(zf,r),o=Em(r),l=m.useRef(null),c=$e(t,l,s.onTriggerChange),u=m.useRef(!1),d=m.useRef(!1),h=m.useCallback(()=>u.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),i.jsx(v_,{asChild:!0,...o,children:i.jsx(xe.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...n,ref:c,onPointerMove:X(e.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:X(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:X(e.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:X(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:X(e.onBlur,s.onClose),onClick:X(e.onClick,s.onClose)})})});IP.displayName=zf;var DP="TooltipPortal",[O$,MP]=nd(DP,{forceMount:void 0}),pi="TooltipContent",S_=m.forwardRef((e,t)=>{const r=MP(pi,e.__scopeTooltip),{forceMount:n=r.forceMount,side:s="top",...a}=e,o=sd(pi,e.__scopeTooltip);return i.jsx(br,{present:n||o.open,children:o.disableHoverableContent?i.jsx(N_,{side:s,...a,ref:t}):i.jsx(LP,{side:s,...a,ref:t})})}),LP=m.forwardRef((e,t)=>{const r=sd(pi,e.__scopeTooltip),n=__(pi,e.__scopeTooltip),s=m.useRef(null),a=$e(t,s),[o,l]=m.useState(null),{trigger:c,onClose:u}=r,d=s.current,{onPointerInTransitChange:h}=n,f=m.useCallback(()=>{l(null),h(!1)},[h]),p=m.useCallback((b,g)=>{const w=b.currentTarget,y={x:b.clientX,y:b.clientY},v=BP(y,w.getBoundingClientRect()),x=HP(y,v),_=VP(g.getBoundingClientRect()),j=qP([...x,..._]);l(j),h(!0)},[h]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(c&&d){const b=w=>p(w,d),g=w=>p(w,c);return c.addEventListener("pointerleave",b),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",g)}}},[c,d,p,f]),m.useEffect(()=>{if(o){const b=g=>{const w=g.target,y={x:g.clientX,y:g.clientY},v=(c==null?void 0:c.contains(w))||(d==null?void 0:d.contains(w)),x=!KP(y,o);v?f():x&&(f(),u())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,d,o,u,f]),i.jsx(N_,{...e,ref:a})}),[$P,zP]=nd(j_,{isInside:!1}),UP=dw("TooltipContent"),N_=m.forwardRef((e,t)=>{const{__scopeTooltip:r,children:n,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:o,...l}=e,c=sd(pi,r),u=Em(r),{onClose:d}=c;return m.useEffect(()=>(document.addEventListener(Xy,d),()=>document.removeEventListener(Xy,d)),[d]),m.useEffect(()=>{if(c.trigger){const h=f=>{const p=f.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),i.jsx(cl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:i.jsxs(x_,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[i.jsx(UP,{children:n}),i.jsx($P,{scope:r,isInside:!0,children:i.jsx(N2,{id:c.contentId,role:"tooltip",children:s||n})})]})})});S_.displayName=pi;var E_="TooltipArrow",FP=m.forwardRef((e,t)=>{const{__scopeTooltip:r,...n}=e,s=Em(r);return zP(E_,r).isInside?null:i.jsx(b_,{...s,...n,ref:t})});FP.displayName=E_;function BP(e,t){const r=Math.abs(t.top-e.y),n=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(r,n,s,a)){case a:return"left";case s:return"right";case r:return"top";case n:return"bottom";default:throw new Error("unreachable")}}function HP(e,t,r=5){const n=[];switch(t){case"top":n.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":n.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":n.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":n.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return n}function VP(e){const{top:t,right:r,bottom:n,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:n},{x:s,y:n}]}function KP(e,t){const{x:r,y:n}=e;let s=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){const l=t[a],c=t[o],u=l.x,d=l.y,h=c.x,f=c.y;d>n!=f>n&&r<(h-u)*(n-d)/(f-d)+u&&(s=!s)}return s}function qP(e){const t=e.slice();return t.sort((r,n)=>r.x<n.x?-1:r.x>n.x?1:r.y<n.y?-1:r.y>n.y?1:0),WP(t)}function WP(e){if(e.length<=1)return e.slice();const t=[];for(let n=0;n<e.length;n++){const s=e[n];for(;t.length>=2;){const a=t[t.length-1],o=t[t.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let n=e.length-1;n>=0;n--){const s=e[n];for(;r.length>=2;){const a=r[r.length-1],o=r[r.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.y-o.y)*(s.x-o.x))r.pop();else break}r.push(s)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var GP=k_,C_=S_;const YP=GP,JP=m.forwardRef(({className:e,sideOffset:t=4,...r},n)=>i.jsx(C_,{ref:n,sideOffset:t,className:de("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));JP.displayName=C_.displayName;function ZP(e,t,r,n){function s(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function l(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?a(d.value):s(d.value).then(l,c)}u((n=n.apply(e,t||[])).next())})}const QP=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class Cm extends Error{constructor(t,r="FunctionsError",n){super(t),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class XP extends Cm{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class ev extends Cm{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class tv extends Cm{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Uf;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Uf||(Uf={}));class eO{constructor(t,{headers:r={},customFetch:n,region:s=Uf.Any}={}){this.url=t,this.headers=r,this.region=s,this.fetch=QP(n)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return ZP(this,arguments,void 0,function*(r,n={}){var s;let a,o;try{const{headers:l,method:c,body:u,signal:d,timeout:h}=n;let f={},{region:p}=n;p||(p=this.region);const b=new URL(`${this.url}/${r}`);p&&p!=="any"&&(f["x-region"]=p,b.searchParams.set("forceFunctionRegion",p));let g;u&&(l&&!Object.prototype.hasOwnProperty.call(l,"Content-Type")||!l)?typeof Blob<"u"&&u instanceof Blob||u instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",g=u):typeof u=="string"?(f["Content-Type"]="text/plain",g=u):typeof FormData<"u"&&u instanceof FormData?g=u:(f["Content-Type"]="application/json",g=JSON.stringify(u)):u&&typeof u!="string"&&!(typeof Blob<"u"&&u instanceof Blob)&&!(u instanceof ArrayBuffer)&&!(typeof FormData<"u"&&u instanceof FormData)?g=JSON.stringify(u):g=u;let w=d;h&&(o=new AbortController,a=setTimeout(()=>o.abort(),h),d?(w=o.signal,d.addEventListener("abort",()=>o.abort())):w=o.signal);const y=yield this.fetch(b.toString(),{method:c||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),l),body:g,signal:w}).catch(j=>{throw new XP(j)}),v=y.headers.get("x-relay-error");if(v&&v==="true")throw new ev(y);if(!y.ok)throw new tv(y);let x=((s=y.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),_;return x==="application/json"?_=yield y.json():x==="application/octet-stream"||x==="application/pdf"?_=yield y.blob():x==="text/event-stream"?_=y:x==="multipart/form-data"?_=yield y.formData():_=yield y.text(),{data:_,error:null,response:y}}catch(l){return{data:null,error:l,response:l instanceof tv||l instanceof ev?l.context:void 0}}finally{a&&clearTimeout(a)}})}}const T_=3,rv=e=>Math.min(1e3*2**e,3e4),tO=[520,503],R_=["GET","HEAD","OPTIONS"];var rO=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function nv(e,t){return new Promise(r=>{if(t!=null&&t.aborted){r();return}const n=setTimeout(()=>{t==null||t.removeEventListener("abort",s),r()},e);function s(){clearTimeout(n),r()}t==null||t.addEventListener("abort",s)})}function nO(e,t,r,n){return!(!n||r>=T_||!R_.includes(e)||!tO.includes(t))}var sO=class{constructor(e){var t,r,n,s,a;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=e.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=e.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(a=e.retry)!==null&&a!==void 0?a:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let a=(async()=>{let o=0;for(;;){const u=new Headers(r.headers);o>0&&u.set("X-Retry-Count",String(o));let d;try{d=await n(r.url.toString(),{method:r.method,headers:u,body:JSON.stringify(r.body,(h,f)=>typeof f=="bigint"?f.toString():f),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!R_.includes(r.method))throw h;if(r.retryEnabled&&o<T_){const f=rv(o);o++,await nv(f,r.signal);continue}throw h}if(nO(r.method,d.status,o,r.retryEnabled)){var l,c;const h=(l=(c=d.headers)===null||c===void 0?void 0:c.get("Retry-After"))!==null&&l!==void 0?l:null,f=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:rv(o);await d.text(),o++,await nv(f,r.signal);continue}return await r.processResponse(d)}})();return this.shouldThrowOnError||(a=a.catch(o=>{var l;let c="",u="",d="";const h=o==null?void 0:o.cause;if(h){var f,p,b,g;const v=(f=h==null?void 0:h.message)!==null&&f!==void 0?f:"",x=(p=h==null?void 0:h.code)!==null&&p!==void 0?p:"";c=`${(b=o==null?void 0:o.name)!==null&&b!==void 0?b:"FetchError"}: ${o==null?void 0:o.message}`,c+=`
Caused by: ${(g=h==null?void 0:h.name)!==null&&g!==void 0?g:"Error"}: ${v}`,x&&(c+=` (${x})`),h!=null&&h.stack&&(c+=`
${h.stack}`)}else{var w;c=(w=o==null?void 0:o.stack)!==null&&w!==void 0?w:""}const y=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(d="",u="Request was aborted (timeout or manual cancellation)",y>this.urlLengthLimit&&(u+=`. Note: Your request URL is ${y} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(d="",u="HTTP headers exceeded server limits (typically 16KB)",y>this.urlLengthLimit&&(u+=`. Your request URL is ${y} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(l=o==null?void 0:o.name)!==null&&l!==void 0?l:"FetchError"}: ${o==null?void 0:o.message}`,details:c,hint:u,code:d},data:null,count:null,status:0,statusText:""}})),a.then(e,t)}async processResponse(e){var t=this;let r=null,n=null,s=null,a=e.status,o=e.statusText;if(e.ok){var l,c;if(t.method!=="HEAD"){var u;const f=await e.text();f===""||(t.headers.get("Accept")==="text/csv"||t.headers.get("Accept")&&(!((u=t.headers.get("Accept"))===null||u===void 0)&&u.includes("application/vnd.pgrst.plan+text"))?n=f:n=JSON.parse(f))}const d=(l=t.headers.get("Prefer"))===null||l===void 0?void 0:l.match(/count=(exact|planned|estimated)/),h=(c=e.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");d&&h&&h.length>1&&(s=parseInt(h[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,a=406,o="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const d=await e.text();try{r=JSON.parse(d),Array.isArray(r)&&e.status===404&&(n=[],r=null,a=200,o="OK")}catch{e.status===404&&d===""?(a=204,o="No Content"):r={message:d}}if(r&&t.shouldThrowOnError)throw new rO(r)}return{success:r===null,error:r,data:n,count:s,status:a,statusText:o}}returns(){return this}overrideTypes(){return this}},aO=class extends sO{select(e){let t=!1;const r=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const a=s?`${s}.order`:"order",o=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${o?`${o},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,a=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(a,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:a="text"}={}){var o;const l=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${c}"; options=${l};`),a==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const sv=new RegExp("[,()]");var ga=class extends aO{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(n=>typeof n=="string"&&sv.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(n=>typeof n=="string"&&sv.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const a=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${s}fts${a}.${t}`),this}match(e){return Object.entries(e).filter(([t,r])=>r!==void 0).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},iO=class{constructor(e,{headers:t={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:a}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=a}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:n}=t??{},s=r?"HEAD":"GET";let a=!1;const o=(e??"*").split("").map(u=>/\s/.test(u)&&!a?"":(u==='"'&&(a=!a),u)).join(""),{url:l,headers:c}=this.cloneRequestState();return l.searchParams.set("select",o),n&&c.append("Prefer",`count=${n}`),new ga({method:s,url:l,headers:c,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;const s="POST",{url:a,headers:o}=this.cloneRequestState();if(t&&o.append("Prefer",`count=${t}`),r||o.append("Prefer","missing=default"),Array.isArray(e)){const l=e.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(l.length>0){const c=[...new Set(l)].map(u=>`"${u}"`);a.searchParams.set("columns",c.join(","))}}return new ga({method:s,url:a,headers:o,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var a;const o="POST",{url:l,headers:c}=this.cloneRequestState();if(c.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&l.searchParams.set("on_conflict",t),n&&c.append("Prefer",`count=${n}`),s||c.append("Prefer","missing=default"),Array.isArray(e)){const u=e.reduce((d,h)=>d.concat(Object.keys(h)),[]);if(u.length>0){const d=[...new Set(u)].map(h=>`"${h}"`);l.searchParams.set("columns",d.join(","))}}return new ga({method:o,url:l,headers:c,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const n="PATCH",{url:s,headers:a}=this.cloneRequestState();return t&&a.append("Prefer",`count=${t}`),new ga({method:n,url:s,headers:a,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new ga({method:r,url:n,headers:s,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Ho(e){"@babel/helpers - typeof";return Ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ho(e)}function oO(e,t){if(Ho(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ho(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lO(e){var t=oO(e,"string");return Ho(t)=="symbol"?t:t+""}function cO(e,t,r){return(t=lO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function av(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Yl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?av(Object(r),!0).forEach(function(n){cO(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):av(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var uO=class A_{constructor(t,{headers:r={},schema:n,fetch:s,timeout:a,urlLengthLimit:o=8e3,retry:l}={}){this.url=t,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const c=s??globalThis.fetch;a!==void 0&&a>0?this.fetch=(u,d)=>{const h=new AbortController,f=setTimeout(()=>h.abort(),a),p=d==null?void 0:d.signal;if(p){if(p.aborted)return clearTimeout(f),c(u,d);const b=()=>{clearTimeout(f),h.abort()};return p.addEventListener("abort",b,{once:!0}),c(u,Yl(Yl({},d),{},{signal:h.signal})).finally(()=>{clearTimeout(f),p.removeEventListener("abort",b)})}return c(u,Yl(Yl({},d),{},{signal:h.signal})).finally(()=>clearTimeout(f))}:this.fetch=c,this.retry=l}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new iO(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new A_(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,r={},{head:n=!1,get:s=!1,count:a}={}){var o;let l;const c=new URL(`${this.url}/rpc/${t}`);let u;const d=p=>p!==null&&typeof p=="object"&&(!Array.isArray(p)||p.some(d)),h=n&&Object.values(r).some(d);h?(l="POST",u=r):n||s?(l=n?"HEAD":"GET",Object.entries(r).filter(([p,b])=>b!==void 0).map(([p,b])=>[p,Array.isArray(b)?`{${b.join(",")}}`:`${b}`]).forEach(([p,b])=>{c.searchParams.append(p,b)})):(l="POST",u=r);const f=new Headers(this.headers);return h?f.set("Prefer",a?`count=${a},return=minimal`:"return=minimal"):a&&f.set("Prefer",`count=${a}`),new ga({method:l,url:c,headers:f,schema:this.schemaName,body:u,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class dO{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const r=globalThis.process;if(r){const n=r.versions;if(n&&n.node){const s=n.node,a=parseInt(s.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
import ws from "ws"
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.constructor)return t.constructor;let r=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(r+=`
Suggested solution: ${t.workaround}`),new Error(r)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const hO="2.105.0",fO=`realtime-js/${hO}`,pO="1.0.0",P_="2.0.0",mO=P_,gO=1e4,yO=100,On={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},O_={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave",access_token:"access_token"},Ff={connecting:"connecting",open:"open",closing:"closing",closed:"closed"};class vO{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=t??[]}encode(t,r){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(t));let n=[t.join_ref,t.ref,t.topic,t.event,t.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(t){var r;return this._isArrayBuffer((r=t.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var r,n;const s=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(t){var r,n;const s=(n=(r=t.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(t,r,n){var s,a;const o=t.topic,l=(s=t.ref)!==null&&s!==void 0?s:"",c=(a=t.join_ref)!==null&&a!==void 0?a:"",u=t.payload.event,d=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},h=Object.keys(d).length===0?"":JSON.stringify(d);if(c.length>255)throw new Error(`joinRef length ${c.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`ref length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`userEvent length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+c.length+l.length+o.length+u.length+h.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let b=new DataView(p),g=0;b.setUint8(g++,this.KINDS.userBroadcastPush),b.setUint8(g++,c.length),b.setUint8(g++,l.length),b.setUint8(g++,o.length),b.setUint8(g++,u.length),b.setUint8(g++,h.length),b.setUint8(g++,r),Array.from(c,y=>b.setUint8(g++,y.charCodeAt(0))),Array.from(l,y=>b.setUint8(g++,y.charCodeAt(0))),Array.from(o,y=>b.setUint8(g++,y.charCodeAt(0))),Array.from(u,y=>b.setUint8(g++,y.charCodeAt(0))),Array.from(h,y=>b.setUint8(g++,y.charCodeAt(0)));var w=new Uint8Array(p.byteLength+n.byteLength);return w.set(new Uint8Array(p),0),w.set(new Uint8Array(n),p.byteLength),w.buffer}decode(t,r){if(this._isArrayBuffer(t)){let n=this._binaryDecode(t);return r(n)}if(typeof t=="string"){const n=JSON.parse(t),[s,a,o,l,c]=n;return r({join_ref:s,ref:a,topic:o,event:l,payload:c})}return r({})}_binaryDecode(t){const r=new DataView(t),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(t,r,s)}}_decodeUserBroadcast(t,r,n){const s=r.getUint8(1),a=r.getUint8(2),o=r.getUint8(3),l=r.getUint8(4);let c=this.HEADER_LENGTH+4;const u=n.decode(t.slice(c,c+s));c=c+s;const d=n.decode(t.slice(c,c+a));c=c+a;const h=n.decode(t.slice(c,c+o));c=c+o;const f=t.slice(c,t.byteLength),p=l===this.JSON_ENCODING?JSON.parse(n.decode(f)):f,b={type:this.BROADCAST_EVENT,event:d,payload:p};return o>0&&(b.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:u,event:this.BROADCAST_EVENT,payload:b}}_isArrayBuffer(t){var r;return t instanceof ArrayBuffer||((r=t==null?void 0:t.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(t,r){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([n])=>r.includes(n)))}}var Ne;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Ne||(Ne={}));const iv=(e,t,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return t?Object.keys(t).reduce((a,o)=>(a[o]=xO(o,e,t,s),a),{}):{}},xO=(e,t,r,n)=>{const s=t.find(l=>l.name===e),a=s==null?void 0:s.type,o=r[e];return a&&!n.includes(a)?I_(a,o):Bf(o)},I_=(e,t)=>{if(e.charAt(0)==="_"){const r=e.slice(1,e.length);return kO(t,r)}switch(e){case Ne.bool:return bO(t);case Ne.float4:case Ne.float8:case Ne.int2:case Ne.int4:case Ne.int8:case Ne.numeric:case Ne.oid:return wO(t);case Ne.json:case Ne.jsonb:return _O(t);case Ne.timestamp:return jO(t);case Ne.abstime:case Ne.date:case Ne.daterange:case Ne.int4range:case Ne.int8range:case Ne.money:case Ne.reltime:case Ne.text:case Ne.time:case Ne.timestamptz:case Ne.timetz:case Ne.tsrange:case Ne.tstzrange:return Bf(t);default:return Bf(t)}},Bf=e=>e,bO=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},wO=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},_O=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},kO=(e,t)=>{if(typeof e!="string")return e;const r=e.length-1,n=e[r];if(e[0]==="{"&&n==="}"){let a;const o=e.slice(1,r);try{a=JSON.parse("["+o+"]")}catch{a=o?o.split(","):[]}return a.map(l=>I_(t,l))}return e},jO=e=>typeof e=="string"?e.replace(" ","T"):e,D_=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var mo=e=>typeof e=="function"?e:function(){return e},SO=typeof self<"u"?self:null,ya=typeof window<"u"?window:null,Nr=SO||ya||globalThis,NO="2.0.0",EO=1e4,CO=1e3,Rr={connecting:0,open:1,closing:2,closed:3},wt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Jr={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Hf={longpoll:"longpoll",websocket:"websocket"},TO={complete:4},Vf="base64url.bearer.phx.",Jl=class{constructor(e,t,r,n){this.channel=e,this.event=t,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},M_=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},RO=class{constructor(e,t,r){this.state=wt.closed,this.topic=e,this.params=mo(t||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Jl(this,Jr.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new M_(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=wt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=wt.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=wt.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=wt.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new Jl(this,Jr.leave,mo({}),this.timeout).send(),this.state=wt.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Jr.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=wt.closed,this.bindings=[]}onClose(e){this.on(Jr.close,e)}onError(e){return this.on(Jr.error,t=>e(t))}on(e,t){let r=this.bindingRef++;return this.bindings.push({event:e,ref:r,callback:t}),r}off(e,t){this.bindings=this.bindings.filter(r=>!(r.event===e&&(typeof t>"u"||t===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,r=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new Jl(this,e,function(){return t},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=wt.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Jr.close,"leave")},r=new Jl(this,Jr.leave,mo({}),e);return r.receive("ok",()=>t()).receive("timeout",()=>t()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(e,t,r){return t}filterBindings(e,t,r){return!0}isMember(e,t,r,n){return this.topic!==e?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=wt.joining,this.joinPush.resend(e))}trigger(e,t,r,n){let s=this.onMessage(e,t,r,n);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let a=this.bindings.filter(o=>o.event===e&&this.filterBindings(o,t,r));for(let o=0;o<a.length;o++)a[o].callback(s,r,n||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===wt.closed}isErrored(){return this.state===wt.errored}isJoined(){return this.state===wt.joined}isJoining(){return this.state===wt.joining}isLeaving(){return this.state===wt.leaving}},ou=class{static request(e,t,r,n,s,a,o){if(Nr.XDomainRequest){let l=new Nr.XDomainRequest;return this.xdomainRequest(l,e,t,n,s,a,o)}else if(Nr.XMLHttpRequest){let l=new Nr.XMLHttpRequest;return this.xhrRequest(l,e,t,r,n,s,a,o)}else{if(Nr.fetch&&Nr.AbortController)return this.fetchRequest(e,t,r,n,s,a,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,r,n,s,a,o){let l={method:e,headers:r,body:n},c=null;return s&&(c=new AbortController,setTimeout(()=>c.abort(),s),l.signal=c.signal),Nr.fetch(t,l).then(u=>u.text()).then(u=>this.parseJSON(u)).then(u=>o&&o(u)).catch(u=>{u.name==="AbortError"&&a?a():o&&o(null)}),c}static xdomainRequest(e,t,r,n,s,a,o){return e.timeout=s,e.open(t,r),e.onload=()=>{let l=this.parseJSON(e.responseText);o&&o(l)},a&&(e.ontimeout=a),e.onprogress=()=>{},e.send(n),e}static xhrRequest(e,t,r,n,s,a,o,l){e.open(t,r,!0),e.timeout=a;for(let[c,u]of Object.entries(n))e.setRequestHeader(c,u);return e.onerror=()=>l&&l(null),e.onreadystatechange=()=>{if(e.readyState===TO.complete&&l){let c=this.parseJSON(e.responseText);l(c)}},o&&(e.ontimeout=o),e.send(s),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let r=[];for(var n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=t?`${t}[${n}]`:n,a=e[n];typeof a=="object"?r.push(this.serialize(a,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(a))}return r.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let r=e.match(/\?/)?"&":"?";return`${e}${r}${this.serialize(t)}`}},AO=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let s=0;s<n;s++)t+=String.fromCharCode(r[s]);return btoa(t)},oa=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(Vf)&&(this.authToken=atob(t[1].slice(Vf.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=Rr.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Hf.websocket),"$1/"+Hf.longpoll)}endpointURL(){return ou.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,r){this.close(e,t,r),this.readyState=Rr.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Rr.open||this.readyState===Rr.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:r,token:n,messages:s}=t;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(a=>{setTimeout(()=>this.onmessage({data:a}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Rr.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(e){typeof e!="string"&&(e=AO(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,r){for(let s of this.reqs)s.abort();this.readyState=Rr.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(e,t,r,n,s){let a,o=()=>{this.reqs.delete(a),n()};a=ou.request(e,this.endpointURL(),t,r,this.timeout,o,l=>{this.reqs.delete(a),this.isActive()&&s(l)}),this.reqs.add(a)}},PO=class Qi{constructor(t,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:a,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Qi.syncState(this.state,s,a,o),this.pendingDiffs.forEach(c=>{this.state=Qi.syncDiff(this.state,c,a,o)}),this.pendingDiffs=[],l()}),this.channel.on(n.diff,s=>{let{onJoin:a,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=Qi.syncDiff(this.state,s,a,o),l())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return Qi.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,r,n,s){let a=this.clone(t),o={},l={};return this.map(a,(c,u)=>{r[c]||(l[c]=u)}),this.map(r,(c,u)=>{let d=a[c];if(d){let h=u.metas.map(g=>g.phx_ref),f=d.metas.map(g=>g.phx_ref),p=u.metas.filter(g=>f.indexOf(g.phx_ref)<0),b=d.metas.filter(g=>h.indexOf(g.phx_ref)<0);p.length>0&&(o[c]=u,o[c].metas=p),b.length>0&&(l[c]=this.clone(d),l[c].metas=b)}else o[c]=u}),this.syncDiff(a,{joins:o,leaves:l},n,s)}static syncDiff(t,r,n,s){let{joins:a,leaves:o}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(a,(l,c)=>{let u=t[l];if(t[l]=this.clone(c),u){let d=t[l].metas.map(f=>f.phx_ref),h=u.metas.filter(f=>d.indexOf(f.phx_ref)<0);t[l].metas.unshift(...h)}n(l,u,c)}),this.map(o,(l,c)=>{let u=t[l];if(!u)return;let d=c.metas.map(h=>h.phx_ref);u.metas=u.metas.filter(h=>d.indexOf(h.phx_ref)<0),s(l,u,c),u.metas.length===0&&delete t[l]}),t}static list(t,r){return r||(r=function(n,s){return s}),this.map(t,(n,s)=>r(n,s))}static map(t,r){return Object.getOwnPropertyNames(t).map(n=>r(n,t[n]))}static clone(t){return JSON.parse(JSON.stringify(t))}},Zl={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(r))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[r,n,s,a,o]=JSON.parse(e);return t({join_ref:r,ref:n,topic:s,event:a,payload:o})}},binaryEncode(e){let{join_ref:t,ref:r,event:n,topic:s,payload:a}=e,o=this.META_LENGTH+t.length+r.length+s.length+n.length,l=new ArrayBuffer(this.HEADER_LENGTH+o),c=new DataView(l),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,t.length),c.setUint8(u++,r.length),c.setUint8(u++,s.length),c.setUint8(u++,n.length),Array.from(t,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(r,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(s,h=>c.setUint8(u++,h.charCodeAt(0))),Array.from(n,h=>c.setUint8(u++,h.charCodeAt(0)));var d=new Uint8Array(l.byteLength+a.byteLength);return d.set(new Uint8Array(l),0),d.set(new Uint8Array(a),l.byteLength),d.buffer},binaryDecode(e){let t=new DataView(e),r=t.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(e,t,n);case this.KINDS.reply:return this.decodeReply(e,t,n);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,n)}},decodePush(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),a=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,l=r.decode(e.slice(o,o+n));o=o+n;let c=r.decode(e.slice(o,o+s));o=o+s;let u=r.decode(e.slice(o,o+a));o=o+a;let d=e.slice(o,e.byteLength);return{join_ref:l,ref:null,topic:c,event:u,payload:d}},decodeReply(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),a=t.getUint8(3),o=t.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,c=r.decode(e.slice(l,l+n));l=l+n;let u=r.decode(e.slice(l,l+s));l=l+s;let d=r.decode(e.slice(l,l+a));l=l+a;let h=r.decode(e.slice(l,l+o));l=l+o;let f=e.slice(l,e.byteLength),p={status:h,response:f};return{join_ref:c,ref:u,topic:d,event:Jr.reply,payload:p}},decodeBroadcast(e,t,r){let n=t.getUint8(1),s=t.getUint8(2),a=this.HEADER_LENGTH+2,o=r.decode(e.slice(a,a+n));a=a+n;let l=r.decode(e.slice(a,a+s));a=a+s;let c=e.slice(a,e.byteLength);return{join_ref:null,ref:null,topic:o,event:l,payload:c}}},OO=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||EO,this.transport=t.transport||Nr.WebSocket||oa,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Nr&&Nr.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Zl.encode.bind(Zl),this.defaultDecoder=Zl.decode.bind(Zl),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==oa?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let r=null;ya&&ya.addEventListener&&(ya.addEventListener("pagehide",n=>{this.conn&&(this.disconnect(),r=this.connectClock)}),ya.addEventListener("pageshow",n=>{r===this.connectClock&&(r=null,this.connect())}),ya.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=n=>t.rejoinAfterMs?t.rejoinAfterMs(n):[1e3,2e3,5e3][n-1]||1e4,this.reconnectAfterMs=n=>t.reconnectAfterMs?t.reconnectAfterMs(n):[10,50,100,150,200,250,500,1e3,2e3][n-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(n,s,a)=>{console.log(`${n}: ${s}`,a)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=mo(t.params||{}),this.endPoint=`${e}/${Hf.websocket}`,this.vsn=t.vsn||NO,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new M_(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return oa}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=ou.appendParams(ou.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,r)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=mo(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==oa?this.connectWithFallback(oa,this.longPollFallbackMs):this.transportConnect())}log(e,t,r){this.logger&&this.logger(e,t,r)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let n=this.onMessage(s=>{s.ref===t&&(this.off([n]),e(Date.now()-r))});return!0}transportName(e){switch(e){case oa:return"LongPoll";default:return e.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${Vf}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,a,o=this.transportName(e),l=c=>{this.log("transport",`falling back to ${o}...`,c),this.off([s,a]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return l("memorized");this.fallbackTimer=setTimeout(l,t),a=this.onError(c=>{this.log("transport","error",c),n&&!r&&(clearTimeout(this.fallbackTimer),l(c))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let c=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${c}`,"true"),this.log("transport",`established ${c} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(l,t),this.ping(c=>{this.log("transport","connected to primary after",c),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),CO,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,r){if(!this.conn)return e&&e();const n=this.conn;this.waitForBufferDone(n,()=>{t?n.close(t,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,r=1){if(r===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,r+1)},150*r)}waitForSocketClosed(e,t,r=1){if(r===5||e.readyState===Rr.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,r+1)},150*r)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",e,t,r),(t===this.transport||r>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Jr.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case Rr.connecting:return"connecting";case Rr.open:return"open";case Rr.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([r])=>e.indexOf(r)===-1)}channel(e,t={}){let r=new RO(e,t,this);return this.channels.push(r),r}push(e){if(this.hasLogger()){let{topic:t,event:r,payload:n,ref:s,join_ref:a}=e;this.log("push",`${t} ${r} (${a}, ${s})`,n)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:r,event:n,payload:s,ref:a,join_ref:o}=t;if(a&&a===this.pendingHeartbeatRef){const l=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",l)}catch(c){this.log("error","error in heartbeat callback",c)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${r} ${n} ${a&&"("+a+")"||""}`.trim(),s);for(let l=0;l<this.channels.length;l++){const c=this.channels[l];c.isMember(r,n,s,o)&&c.trigger(n,s,a,o)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([r,n])=>{try{n(...t)}catch(s){this.log("error",`error in ${e} callback`,s)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}leaveOpenTopic(e){let t=this.channels.find(r=>r.topic===e&&(r.isJoined()||r.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class go{constructor(t,r){const n=DO(r);this.presence=new PO(t.getChannel(),n),this.presence.onJoin((s,a,o)=>{const l=go.onJoinPayload(s,a,o);t.getChannel().trigger("presence",l)}),this.presence.onLeave((s,a,o)=>{const l=go.onLeavePayload(s,a,o);t.getChannel().trigger("presence",l)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return go.transformState(this.presence.state)}static transformState(t){return t=IO(t),Object.getOwnPropertyNames(t).reduce((r,n)=>{const s=t[n];return r[n]=Sc(s),r},{})}static onJoinPayload(t,r,n){const s=ov(r),a=Sc(n);return{event:"join",key:t,currentPresences:s,newPresences:a}}static onLeavePayload(t,r,n){const s=ov(r),a=Sc(n);return{event:"leave",key:t,currentPresences:s,leftPresences:a}}}function Sc(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function IO(e){return JSON.parse(JSON.stringify(e))}function DO(e){return(e==null?void 0:e.events)&&{events:e.events}}function ov(e){return e!=null&&e.metas?Sc(e):[]}var lv;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(lv||(lv={}));class MO{get state(){return this.presenceAdapter.state}constructor(t,r){this.channel=t,this.presenceAdapter=new go(this.channel.channelAdapter,r)}}class LO{constructor(t,r,n){const s=$O(n);this.channel=t.getSocket().channel(r,s),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,r){return this.channel.on(t,r)}off(t,r){this.channel.off(t,r)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,r,n){let s;try{s=this.channel.push(t,r,n)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>yO){const a=this.channel.pushBuffer.shift();a.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${a.event}`,a.payload())}return s}updateJoinPayload(t){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),t)}canPush(){return this.socket.isConnected()&&this.state===On.joined}isJoined(){return this.state===On.joined}isJoining(){return this.state===On.joining}isClosed(){return this.state===On.closed}isLeaving(){return this.state===On.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function $O(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}var cv;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(cv||(cv={}));var Ia;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Ia||(Ia={}));var Zr;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Zr||(Zr={}));class yo{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,r={config:{}},n){var s,a;if(this.topic=t,this.params=r,this.socket=n,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new LO(this.socket.socketAdapter,t,this.params),this.presence=new MO(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=D_(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((a=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||a===void 0)&&a.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,r=this.timeout){var n,s,a;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:l,private:c}}=this.params,u=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(p=>p.filter))!==null&&s!==void 0?s:[],d=!!this.bindings[Ia.PRESENCE]&&this.bindings[Ia.PRESENCE].length>0||((a=this.params.config.presence)===null||a===void 0?void 0:a.enabled)===!0,h={},f={broadcast:o,presence:Object.assign(Object.assign({},l),{enabled:d}),postgres_changes:u,private:c};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(p=>{t==null||t(Zr.CHANNEL_ERROR,p)}),this._onClose(()=>t==null?void 0:t(Zr.CLOSED)),this.updateJoinPayload(Object.assign({config:f},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:p})=>{if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){t==null||t(Zr.SUBSCRIBED);return}this._updatePostgresBindings(p,t)}).receive("error",p=>{this.state=On.errored,t==null||t(Zr.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Zr.TIMED_OUT)})}return this}_updatePostgresBindings(t,r){var n;const s=this.bindings.postgres_changes,a=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,o=[];for(let l=0;l<a;l++){const c=s[l],{filter:{event:u,schema:d,table:h,filter:f}}=c,p=t&&t[l];if(p&&p.event===u&&yo.isFilterValueEqual(p.schema,d)&&yo.isFilterValueEqual(p.table,h)&&yo.isFilterValueEqual(p.filter,f))o.push(Object.assign(Object.assign({},c),{id:p.id}));else{this.unsubscribe(),this.state=On.errored,r==null||r(Zr.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=On.errored&&r&&r(Zr.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,r={}){return await this.send({type:"presence",event:"track",payload:t},r.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),a=t===Ia.PRESENCE||t===Ia.POSTGRES_CHANGES;if(s&&a)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,r,n)}async httpSend(t,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:r,private:this.private}]})},l=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(l.status===202)return{success:!0};let c=l.statusText;try{const u=await l.json();c=u.error||u.message||c}catch{}return Promise.reject(new Error(c))}async send(t,r={}){var n,s;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:a,payload:o}=t,l={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(l.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:"POST",headers:l,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:o,private:this.private}]})};try{const u=await this._fetchWithTimeout(this.broadcastEndpointURL,c,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=u.body)===null||s===void 0?void 0:s.cancel()),u.ok?"ok":"error"}catch(u){return u.name==="AbortError"?"timed out":"error"}}else return new Promise(a=>{var o,l,c;const u=this.channelAdapter.push(t.type,t,r.timeout||this.timeout);t.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&a("ok"),u.receive("ok",()=>a("ok")),u.receive("error",()=>a("error")),u.receive("timeout",()=>a("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,r,n){const s=new AbortController,a=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(t,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(a),o}_on(t,r,n){const s=t.toLocaleLowerCase(),a=this.channelAdapter.on(t,n),o={type:s,filter:r,callback:n,ref:a};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,r,n)=>{var s,a,o,l,c,u,d;const h=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const f=(s=this.bindings[h])===null||s===void 0?void 0:s.find(p=>p.ref===t.ref);if(!f)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in f){const p=f.id,b=(a=f.filter)===null||a===void 0?void 0:a.event;return p&&((o=r.ids)===null||o===void 0?void 0:o.includes(p))&&(b==="*"||(b==null?void 0:b.toLocaleLowerCase())===((l=r.data)===null||l===void 0?void 0:l.type.toLocaleLowerCase()))}else{const p=(u=(c=f==null?void 0:f.filter)===null||c===void 0?void 0:c.event)===null||u===void 0?void 0:u.toLocaleLowerCase();return p==="*"||p===((d=r==null?void 0:r.event)===null||d===void 0?void 0:d.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===h})}_notThisChannelEvent(t,r){const{close:n,error:s,leave:a,join:o}=O_;return r&&[n,s,a,o].includes(t)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:a,table:o,commit_timestamp:l,type:c,errors:u}=s;return Object.assign(Object.assign({},{schema:a,table:o,commit_timestamp:l,eventType:c,new:{},old:{},errors:u}),this._getPayloadRecords(s))}return r})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in t.bindings)for(const n of t.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(t,r){return(t??void 0)===(r??void 0)}_getPayloadRecords(t){const r={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(r.new=iv(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(r.old=iv(t.columns,t.old_record)),r}}class zO{constructor(t,r){this.socket=new OO(t,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,r,n,s=1e4){return new Promise(a=>{setTimeout(()=>a("timeout"),s),this.socket.disconnect(()=>{t(),a("ok")},r,n)})}push(t){this.socket.push(t)}log(t,r,n){this.socket.log(t,r,n)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Ff.connecting}isDisconnecting(){return this.socket.connectionState()==Ff.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const uv={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},UO=[1e3,2e3,5e3,1e4],FO=1e4,BO=`
addEventListener("message", (e) => {
if (e.data.event === "start") {
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
}
});`;class HO{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,r){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new vO,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=a=>a?(...o)=>a(...o):(...o)=>fetch(...o),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new zO(t,s),this.httpEndpoint=D_(t),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const r=t.message;throw r.includes("Node.js")?new Error(`${r}
To use Realtime in Node.js, you need to provide a WebSocket implementation:
Option 1: Use Node.js 22+ which has native WebSocket support
Option 2: Install and provide the "ws" package:
npm install ws
import ws from "ws"
const client = new RealtimeClient(url, {
...options,
transport: ws
})`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,r)}getChannels(){return this.channels}async removeChannel(t){const r=await t.unsubscribe();return r==="ok"&&t.teardown(),r}async removeAllChannels(){const t=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(t);return await this.disconnect(),r}log(t,r,n){this.socketAdapter.log(t,r,n)}connectionState(){return this.socketAdapter.connectionState()||Ff.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,r={config:{}}){const n=`realtime:${t}`,s=this.getChannels().find(a=>a.topic===n);if(s)return s;{const a=new yo(`realtime:${t}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(a),a}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(r=>r.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let r,n=!1;if(t)r=t,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const a={access_token:r,version:fO};r&&s.updateJoinPayload(a),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(O_.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${t}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(r,n)=>{r=="sent"&&this._setAuthSafely(),t&&t(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let r;if(t)r=t;else{const n=new Blob([BO],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(t){var r,n,s,a,o,l,c,u,d,h,f;this.worker=(r=t==null?void 0:t.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=t==null?void 0:t.accessToken)!==null&&n!==void 0?n:null;const p={};p.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:gO,p.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:uv.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=t==null?void 0:t.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((l=t==null?void 0:t.heartbeatIntervalMs)!==null&&l!==void 0?l:uv.HEARTBEAT_INTERVAL),p.transport=(c=t==null?void 0:t.transport)!==null&&c!==void 0?c:dO.getWebSocketConstructor(),p.params=t==null?void 0:t.params,p.logger=t==null?void 0:t.logger,p.heartbeatCallback=this._wrapHeartbeatCallback(t==null?void 0:t.heartbeatCallback),p.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:y=>UO[y-1]||FO;let b,g;const w=(d=t==null?void 0:t.vsn)!==null&&d!==void 0?d:mO;switch(w){case pO:b=(y,v)=>v(JSON.stringify(y)),g=(y,v)=>v(JSON.parse(y));break;case P_:b=this.serializer.encode.bind(this.serializer),g=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${p.vsn}`)}if(p.vsn=w,p.encode=(h=t==null?void 0:t.encode)!==null&&h!==void 0?h:b,p.decode=(f=t==null?void 0:t.decode)!==null&&f!==void 0?f:g,p.beforeReconnect=this._reconnectAuth.bind(this),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,p.params=Object.assign(Object.assign({},p.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl,p.autoSendHeartbeat=!this.worker}return p}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Vo=class extends Error{constructor(e,t){var r;super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&((r=t.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function VO(e,t,r){const n=new URL(t,e);if(r)for(const[s,a]of Object.entries(r))a!==void 0&&n.searchParams.set(s,a);return n.toString()}async function KO(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function qO(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:a,headers:o}){const l=VO(e.baseUrl,n,s),c=await KO(e.auth),u=await t(l,{method:r,headers:{...a?{"Content-Type":"application/json"}:{},...c,...o},body:a?JSON.stringify(a):void 0}),d=await u.text(),h=(u.headers.get("content-type")||"").includes("application/json"),f=h&&d?JSON.parse(d):d;if(!u.ok){const p=h?f:void 0,b=p==null?void 0:p.error;throw new Vo((b==null?void 0:b.message)??`Request failed with status ${u.status}`,{status:u.status,icebergType:b==null?void 0:b.type,icebergCode:b==null?void 0:b.code,details:p})}return{status:u.status,headers:u.headers,data:f}}}}function Ql(e){return e.join("")}var WO=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Ql(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(e,t){const r={namespace:e.namespace,properties:t==null?void 0:t.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ql(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ql(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ql(e.namespace)}`}),!0}catch(t){if(t instanceof Vo&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(r){if(r instanceof Vo&&r.status===409)return;throw r}}};function la(e){return e.join("")}var GO=class{constructor(e,t="",r){this.client=e,this.prefix=t,this.accessDelegation=r}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${la(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${la(e.namespace)}/tables`,body:t,headers:r})).data.metadata}async updateTable(e,t){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${la(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${la(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String((t==null?void 0:t.purge)??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${la(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${la(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(r){if(r instanceof Vo&&r.status===404)return!1;throw r}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(r){if(r instanceof Vo&&r.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw r}}},YO=class{constructor(e){var n;let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const r=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=qO({baseUrl:r,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=(n=e.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new WO(this.client,t),this.tableOps=new GO(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function Ko(e){"@babel/helpers - typeof";return Ko=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ko(e)}function JO(e,t){if(Ko(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Ko(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ZO(e){var t=JO(e,"string");return Ko(t)=="symbol"?t:t+""}function QO(e,t,r){return(t=ZO(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?dv(Object(r),!0).forEach(function(n){QO(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dv(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var ad=class extends Error{constructor(e,t="storage",r,n){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function id(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var Kf=class extends ad{constructor(e,t,r,n="storage"){super(e,n,t,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=r}toJSON(){return ne({},super.toJSON())}},L_=class extends ad{constructor(e,t,r="storage"){super(e,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function lu(e,t,r){const n=ne({},e),s=t.toLowerCase();for(const a of Object.keys(n))a.toLowerCase()===s&&delete n[a];return n[s]=r,n}function XO(e){const t={};for(const[r,n]of Object.entries(e))t[r.toLowerCase()]=n;return t}const eI=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),tI=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)},qf=e=>{if(Array.isArray(e))return e.map(r=>qf(r));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,a=>a.toUpperCase().replace(/[-_]/g,""));t[s]=qf(n)}),t},rI=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),hv=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},nI=async(e,t,r,n)=>{if(e!==null&&typeof e=="object"&&typeof e.json=="function"){const s=e;let a=parseInt(s.status,10);Number.isFinite(a)||(a=500),s.json().then(o=>{const l=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||a+"";t(new Kf(hv(o),a,l,n))}).catch(()=>{const o=a+"";t(new Kf(s.statusText||`HTTP ${a} error`,a,o,n))})}else t(new L_(hv(e),e,n))},sI=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};if(e==="GET"||e==="HEAD"||!n)return ne(ne({},s),r);if(tI(n)){var a;const o=(t==null?void 0:t.headers)||{};let l;for(const[c,u]of Object.entries(o))c.toLowerCase()==="content-type"&&(l=u);s.headers=lu(o,"Content-Type",(a=l)!==null&&a!==void 0?a:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return t!=null&&t.duplex&&(s.duplex=t.duplex),ne(ne({},s),r)};async function qi(e,t,r,n,s,a,o){return new Promise((l,c)=>{e(r,sI(t,n,s,a)).then(u=>{if(!u.ok)throw u;if(n!=null&&n.noResolveJson)return u;if(o==="vectors"){const d=u.headers.get("content-type");if(u.headers.get("content-length")==="0"||u.status===204)return{};if(!d||!d.includes("application/json"))return{}}return u.json()}).then(u=>l(u)).catch(u=>nI(u,c,n,o))})}function $_(e="storage"){return{get:async(t,r,n,s)=>qi(t,"GET",r,n,s,void 0,e),post:async(t,r,n,s,a)=>qi(t,"POST",r,s,a,n,e),put:async(t,r,n,s,a)=>qi(t,"PUT",r,s,a,n,e),head:async(t,r,n,s)=>qi(t,"HEAD",r,ne(ne({},n),{},{noResolveJson:!0}),s,void 0,e),remove:async(t,r,n,s,a)=>qi(t,"DELETE",r,s,a,n,e)}}const aI=$_("storage"),{get:qo,post:or,put:Wf,head:iI,remove:Tm}=aI,At=$_("vectors");var Ti=class{constructor(e,t={},r,n="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=XO(t),this.fetch=eI(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=lu(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(r){if(t.shouldThrowOnError)throw r;if(id(r))return{data:null,error:r};throw r}}},oI=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(id(t))return{data:null,error:t};throw t}}};let z_;z_=Symbol.toStringTag;var lI=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[z_]="BlobDownloadBuilder",this.promise=null}asStream(){return new oI(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(id(t))return{data:null,error:t};throw t}}};const cI={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},fv={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var uI=class extends Ti{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var s=this;return s.handleOperation(async()=>{let a;const o=ne(ne({},fv),n);let l=ne(ne({},s.headers),e==="POST"&&{"x-upsert":String(o.upsert)});const c=o.metadata;if(typeof Blob<"u"&&r instanceof Blob?(a=new FormData,a.append("cacheControl",o.cacheControl),c&&a.append("metadata",s.encodeMetadata(c)),a.append("",r)):typeof FormData<"u"&&r instanceof FormData?(a=r,a.has("cacheControl")||a.append("cacheControl",o.cacheControl),c&&!a.has("metadata")&&a.append("metadata",s.encodeMetadata(c))):(a=r,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType,c&&(l["x-metadata"]=s.toBase64(s.encodeMetadata(c))),(typeof ReadableStream<"u"&&a instanceof ReadableStream||a&&typeof a=="object"&&"pipe"in a&&typeof a.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))l=lu(l,f,p);const u=s._removeEmptyFolders(t),d=s._getFinalPath(u),h=await(e=="PUT"?Wf:or)(s.fetch,`${s.url}/object/${d}`,a,ne({headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:u,id:h.Id,fullPath:h.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var s=this;const a=s._removeEmptyFolders(e),o=s._getFinalPath(a),l=new URL(s.url+`/object/upload/sign/${o}`);return l.searchParams.set("token",t),s.handleOperation(async()=>{let c;const u=ne(ne({},fv),n);let d=ne(ne({},s.headers),{"x-upsert":String(u.upsert)});const h=u.metadata;if(typeof Blob<"u"&&r instanceof Blob?(c=new FormData,c.append("cacheControl",u.cacheControl),h&&c.append("metadata",s.encodeMetadata(h)),c.append("",r)):typeof FormData<"u"&&r instanceof FormData?(c=r,c.has("cacheControl")||c.append("cacheControl",u.cacheControl),h&&!c.has("metadata")&&c.append("metadata",s.encodeMetadata(h))):(c=r,d["cache-control"]=`max-age=${u.cacheControl}`,d["content-type"]=u.contentType,h&&(d["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&c instanceof ReadableStream||c&&typeof c=="object"&&"pipe"in c&&typeof c.pipe=="function")&&!u.duplex&&(u.duplex="half")),n!=null&&n.headers)for(const[f,p]of Object.entries(n.headers))d=lu(d,f,p);return{path:a,fullPath:(await Wf(s.fetch,l.toString(),c,ne({headers:d},u!=null&&u.duplex?{duplex:u.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const s=ne({},r.headers);t!=null&&t.upsert&&(s["x-upsert"]="true");const a=await or(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+a.url),l=o.searchParams.get("token");if(!l)throw new ad("No token returned by API");return{signedUrl:o.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await or(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await or(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(e);const a=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await or(n.fetch,`${n.url}/object/sign/${s}`,ne({expiresIn:t},a?{transform:r.transform}:{}),{headers:n.headers});const l=new URLSearchParams;r!=null&&r.download&&l.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&l.set("cacheNonce",String(r.cacheNonce));const c=l.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${c?`&${c}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const s=await or(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const o=a.toString();return s.map(l=>ne(ne({},l),{},{signedUrl:l.signedURL?encodeURI(`${n.url}${l.signedURL}${o?`&${o}`:""}`):null}))})}download(e,t,r){const n=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;t!=null&&t.transform&&this.applyTransformOptsToQuery(s,t.transform),(t==null?void 0:t.cacheNonce)!=null&&s.set("cacheNonce",String(t.cacheNonce));const a=s.toString(),o=this._getFinalPath(e),l=()=>qo(this.fetch,`${this.url}/${n}/${o}${a?`?${a}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new lI(l,this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>qf(await qo(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await iI(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(s){if(t.shouldThrowOnError)throw s;if(id(s)){var n;const a=s instanceof Kf?s.status:s instanceof L_?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(a!==void 0&&[400,404].includes(a))return{data:!1,error:s}}throw s}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;t!=null&&t.download&&n.set("download",t.download===!0?"":t.download),t!=null&&t.transform&&this.applyTransformOptsToQuery(n,t.transform),(t==null?void 0:t.cacheNonce)!=null&&n.set("cacheNonce",String(t.cacheNonce));const s=n.toString(),a=typeof(t==null?void 0:t.transform)=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${r}`)+(s?`?${s}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await Tm(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const s=ne(ne(ne({},cI),t),{},{prefix:e||""});return await or(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=ne({},e);return await or(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const dI="2.105.0",fl={"X-Client-Info":`storage-js/${dI}`};var hI=class extends Ti{constructor(e,t={},r,n){const s=new URL(e);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const a=s.href.replace(/\/$/,""),o=ne(ne({},fl),t);super(a,o,r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await qo(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await qo(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await or(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await Wf(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await or(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Tm(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},fI=class extends Ti{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=ne(ne({},fl),t);super(n,s,r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await or(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&r.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&r.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&r.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&r.set("sortOrder",e.sortOrder),e!=null&&e.search&&r.set("search",e.search);const n=r.toString(),s=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await qo(t.fetch,s,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Tm(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!rI(e))throw new ad("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new YO({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,a){const o=s[a];return typeof o!="function"?o:async(...l)=>{try{return{data:await o.apply(s,l),error:null}}catch(c){if(n)throw c;return{data:null,error:c}}}}})}},pI=class extends Ti{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=ne(ne({},fl),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await At.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await At.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},mI=class extends Ti{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=ne(ne({},fl),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},gI=class extends Ti{constructor(e,t={},r){const n=e.replace(/\/$/,""),s=ne(ne({},fl),{},{"Content-Type":"application/json"},t);super(n,s,r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await At.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},yI=class extends gI{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new vI(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,r=this;return t().call(r,e)}async getBucket(e){var t=()=>super.getBucket,r=this;return t().call(r,e)}async listBuckets(e={}){var t=()=>super.listBuckets,r=this;return t().call(r,e)}async deleteBucket(e){var t=()=>super.deleteBucket,r=this;return t().call(r,e)}},vI=class extends pI{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){var t=()=>super.createIndex,r=this;return t().call(r,ne(ne({},e),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,r=this;return t().call(r,ne(ne({},e),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,r=this;return t().call(r,r.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,r=this;return t().call(r,r.vectorBucketName,e)}index(e){return new xI(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},xI=class extends mI{constructor(e,t,r,n,s){super(e,t,s),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=()=>super.putVectors,r=this;return t().call(r,ne(ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(e){var t=()=>super.getVectors,r=this;return t().call(r,ne(ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,r=this;return t().call(r,ne(ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,r=this;return t().call(r,ne(ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,r=this;return t().call(r,ne(ne({},e),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},bI=class extends hI{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new uI(this.url,this.headers,e,this.fetch)}get vectors(){return new yI(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new fI(this.url+"/iceberg",this.headers,this.fetch)}};function od(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}const U_="2.105.0",va=30*1e3,Gf=3,lh=Gf*va,wI="http://localhost:9999",_I="supabase.auth.token",kI={"X-Client-Info":`gotrue-js/${U_}`},Yf="X-Supabase-Api-Version",F_={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},jI=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,SI=10*60*1e3;class Wo extends Error{constructor(t,r,n){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function W(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class NI extends Wo{constructor(t,r,n){super(t,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function EI(e){return W(e)&&e.name==="AuthApiError"}class hr extends Wo{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}}class pn extends Wo{constructor(t,r,n,s){super(t,n,s),this.name=r,this.status=n}}class Xe extends pn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Xl(e){return W(e)&&e.name==="AuthSessionMissingError"}class ca extends pn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ec extends pn{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class tc extends pn{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function CI(e){return W(e)&&e.name==="AuthImplicitGrantRedirectError"}class pv extends pn{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class TI extends pn{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Jf extends pn{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}}function ch(e){return W(e)&&e.name==="AuthRetryableFetchError"}class mv extends pn{constructor(t,r,n){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Zf extends pn{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),gv=`
\r=`.split(""),RI=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<gv.length;t+=1)e[gv[t].charCodeAt(0)]=-2;for(let t=0;t<cu.length;t+=1)e[cu[t].charCodeAt(0)]=t;return e})();function yv(e,t,r){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r(cu[n]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const n=t.queue>>t.queuedBits-6&63;r(cu[n]),t.queuedBits-=6}}function B_(e,t,r){const n=RI[e];if(n>-1)for(t.queue=t.queue<<6|n,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function vv(e){const t=[],r=o=>{t.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},a=o=>{OI(o,n,r)};for(let o=0;o<e.length;o+=1)B_(e.charCodeAt(o),s,a);return t.join("")}function AI(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function PI(e,t){for(let r=0;r<e.length;r+=1){let n=e.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(e.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}AI(n,t)}}function OI(e,t,r){if(t.utf8seq===0){if(e<=127){r(e);return}for(let n=1;n<6;n+=1)if(!(e>>7-n&1)){t.utf8seq=n;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&r(t.codepoint)}}function qa(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};for(let s=0;s<e.length;s+=1)B_(e.charCodeAt(s),r,n);return new Uint8Array(t)}function II(e){const t=[];return PI(e,r=>t.push(r)),new Uint8Array(t)}function js(e){const t=[],r={queue:0,queuedBits:0},n=s=>{t.push(s)};return e.forEach(s=>yv(s,r,n)),yv(null,r,n),t.join("")}function DI(e){return Math.round(Date.now()/1e3)+e}function MI(){return Symbol("auth-callback")}const st=()=>typeof window<"u"&&typeof document<"u",ps={tested:!1,writable:!1},H_=()=>{if(!st())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ps.tested)return ps.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),ps.tested=!0,ps.writable=!0}catch{ps.tested=!0,ps.writable=!1}return ps.writable};function LI(e){const t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,a)=>{t[a]=s})}catch{}return r.searchParams.forEach((n,s)=>{t[s]=n}),t}const V_=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),$I=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",xa=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},ms=async(e,t)=>{const r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}},nt=async(e,t)=>{await e.removeItem(t)};class ld{constructor(){this.promise=new ld.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}}ld.promiseConstructor=Promise;function rc(e){const t=e.split(".");if(t.length!==3)throw new Zf("Invalid JWT structure");for(let n=0;n<t.length;n++)if(!jI.test(t[n]))throw new Zf("JWT not in base64url format");return{header:JSON.parse(vv(t[0])),payload:JSON.parse(vv(t[1])),signature:qa(t[2]),raw:{header:t[0],payload:t[1]}}}async function zI(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function UI(e,t){return new Promise((n,s)=>{(async()=>{for(let a=0;a<1/0;a++)try{const o=await e(a);if(!t(a,null,o)){n(o);return}}catch(o){if(!t(a,o)){s(o);return}}})()})}function FI(e){return("0"+e.toString(16)).substr(-2)}function BI(){const t=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let a=0;a<56;a++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(t),Array.from(t,FI).join("")}async function HI(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(a=>String.fromCharCode(a)).join("")}async function VI(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const r=await HI(e);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ua(e,t,r=!1){const n=BI();let s=n;r&&(s+="/recovery"),await xa(e,`${t}-code-verifier`,s);const a=await VI(n);return[a,n===a?"plain":"s256"]}const KI=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function qI(e){const t=e.headers.get(Yf);if(!t||!t.match(KI))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function WI(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function GI(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const YI=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Wr(e){if(!YI.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function sr(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function uh(){const e={};return new Proxy(e,{get:(t,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function JI(e,t){return new Proxy(e,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const a=n.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="Symbol(util.inspect.custom)"||a==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!t.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(r,n,s)}})}function xv(e){return JSON.parse(JSON.stringify(e))}const xs=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),ZI=[502,503,504,520,521,522,523,524,530];async function bv(e){var t;if(!$I(e))throw new Jf(xs(e),0);if(ZI.includes(e.status))throw new Jf(xs(e),e.status);let r;try{r=await e.json()}catch(a){throw new hr(xs(a),a)}let n;const s=qI(e);if(s&&s.getTime()>=F_["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new mv(xs(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(n==="session_not_found")throw new Xe}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((a,o)=>a&&typeof o=="string",!0))throw new mv(xs(r),e.status,r.weak_password.reasons);throw new NI(xs(r),e.status||500,n)}const QI=(e,t,r,n)=>{const s={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function J(e,t,r,n){var s;const a=Object.assign({},n==null?void 0:n.headers);a[Yf]||(a[Yf]=F_["2024-01-01"].name),n!=null&&n.jwt&&(a.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await XI(e,t,r+l,{headers:a,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(c):{data:Object.assign({},c),error:null}}async function XI(e,t,r,n,s,a){const o=QI(t,n,s,a);let l;try{l=await e(r,Object.assign({},o))}catch(c){throw console.error(c),new Jf(xs(c),0)}if(l.ok||await bv(l),n!=null&&n.noResolveJson)return l;try{return await l.json()}catch(c){await bv(c)}}function Ft(e){var t;let r=null;r5(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=DI(e.expires_in)));const n=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:n},error:null}}function wv(e){const t=Ft(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(t.data.weak_password=e.weak_password),t}function In(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function e5(e){return{data:e,error:null}}function t5(e){const{action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:a}=e,o=od(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:t,email_otp:r,hashed_token:n,redirect_to:s,verification_type:a},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function _v(e){return e}function r5(e){return e.access_token&&e.refresh_token&&e.expires_in}const dh=["global","local","others"];class n5{constructor({url:t="",headers:r={},fetch:n,experimental:s}){this.url=t,this.headers=r,this.fetch=V_(n),this.experimental=s??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,r=dh[0]){if(dh.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${dh.join(", ")}`);try{return await J(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(n){if(W(n))return{data:null,error:n};throw n}}async inviteUserByEmail(t,r={}){try{return await J(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:In})}catch(n){if(W(n))return{data:{user:null},error:n};throw n}}async generateLink(t){try{const{options:r}=t,n=od(t,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await J(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:t5,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if(W(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await J(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:In})}catch(r){if(W(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,n,s,a,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await J(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(a=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&a!==void 0?a:""},xform:_v});if(d.error)throw d.error;const h=await d.json(),f=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(b=>{const g=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(b.split(";")[1].split("=")[1]);u[`${w}Page`]=g}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(W(u))return{data:{users:[]},error:u};throw u}}async getUserById(t){Wr(t);try{return await J(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:In})}catch(r){if(W(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){Wr(t);try{return await J(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:In})}catch(n){if(W(n))return{data:{user:null},error:n};throw n}}async deleteUser(t,r=!1){Wr(t);try{return await J(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:In})}catch(n){if(W(n))return{data:{user:null},error:n};throw n}}async _listFactors(t){Wr(t.userId);try{const{data:r,error:n}=await J(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if(W(r))return{data:null,error:r};throw r}}async _deleteFactor(t){Wr(t.userId),Wr(t.id);try{return{data:await J(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}async _listOAuthClients(t){var r,n,s,a,o,l,c;try{const u={nextPage:null,lastPage:0,total:0},d=await J(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=t==null?void 0:t.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(a=(s=t==null?void 0:t.perPage)===null||s===void 0?void 0:s.toString())!==null&&a!==void 0?a:""},xform:_v});if(d.error)throw d.error;const h=await d.json(),f=(o=d.headers.get("x-total-count"))!==null&&o!==void 0?o:0,p=(c=(l=d.headers.get("link"))===null||l===void 0?void 0:l.split(","))!==null&&c!==void 0?c:[];return p.length>0&&(p.forEach(b=>{const g=parseInt(b.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(b.split(";")[1].split("=")[1]);u[`${w}Page`]=g}),u.total=parseInt(f)),{data:Object.assign(Object.assign({},h),u),error:null}}catch(u){if(W(u))return{data:{clients:[]},error:u};throw u}}async _createOAuthClient(t){try{return await J(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _getOAuthClient(t){try{return await J(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _updateOAuthClient(t,r){try{return await J(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(W(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(t){try{return await J(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(t){try{return await J(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _listCustomProviders(t){try{const r={};return t!=null&&t.type&&(r.type=t.type),await J(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if(W(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(t){try{return await J(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _getCustomProvider(t){try{return await J(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _updateCustomProvider(t,r){try{return await J(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(W(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(t){try{return await J(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}async _adminListPasskeys(t){sr(this.experimental),Wr(t.userId);try{return await J(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(W(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(t){sr(this.experimental),Wr(t.userId),Wr(t.passkeyId);try{return await J(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(W(r))return{data:null,error:r};throw r}}}function kv(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}const jr={debug:!!(globalThis&&H_()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class K_ extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class jv extends K_{}async function s5(e,t,r){jr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const n=new globalThis.AbortController;let s;t>0&&(s=setTimeout(()=>{n.abort(),jr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t)),await Promise.resolve();try{return await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async a=>{if(a){clearTimeout(s),jr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await r()}finally{jr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw jr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new jv(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(jr.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(s),await r()}})}catch(a){if(t>0&&clearTimeout(s),(a==null?void 0:a.name)==="AbortError"&&t>0){if(n.signal.aborted)return jr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:"exclusive",steal:!0},async o=>{if(o){jr.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",e,o.name);try{return await r()}finally{jr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",e,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw jr.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",e),new jv(`Lock "${e}" was released because another request stole it`)}throw a}}function a5(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function q_(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function i5(e){return parseInt(e,16)}function o5(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}function l5(e){var t;const{chainId:r,domain:n,expirationTime:s,issuedAt:a=new Date,nonce:o,notBefore:l,requestId:c,resources:u,scheme:d,uri:h,version:f}=e;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const p=q_(e.address),b=d?`${d}://${n}`:n,g=e.statement?`${e.statement}
`:"",w=`${b} wants you to sign in with your Ethereum account:
${p}
${g}`;let y=`URI: ${h}
Version: ${f}
Chain ID: ${r}${o?`
Nonce: ${o}`:""}
Issued At: ${a.toISOString()}`;if(s&&(y+=`
Expiration Time: ${s.toISOString()}`),l&&(y+=`
Not Before: ${l.toISOString()}`),c&&(y+=`
Request ID: ${c}`),u){let v=`
Resources:`;for(const x of u){if(!x||typeof x!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${x}`);v+=`
- ${x}`}y+=v}return`${w}
${y}`}class qe extends Error{constructor({message:t,code:r,cause:n,name:s}){var a;super(t,{cause:n}),this.__isWebAuthnError=!0,this.name=(a=s??(n instanceof Error?n.name:void 0))!==null&&a!==void 0?a:"Unknown Error",this.code=r}}class uu extends qe{constructor(t,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:t}),this.name="WebAuthnUnknownError",this.originalError=r}}function c5({error:e,options:t}){var r,n,s;const{publicKey:a}=t;if(!a)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new qe({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((r=a.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new qe({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((n=a.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new qe({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((s=a.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new qe({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new qe({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new qe({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return a.pubKeyCredParams.filter(l=>l.type==="public-key").length===0?new qe({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new qe({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const o=window.location.hostname;if(W_(o)){if(a.rp.id!==o)return new qe({message:`The RP ID "${a.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new qe({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(a.user.id.byteLength<1||a.user.id.byteLength>64)return new qe({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new qe({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new qe({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function u5({error:e,options:t}){const{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new qe({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new qe({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const n=window.location.hostname;if(W_(n)){if(r.rpId!==n)return new qe({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new qe({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new qe({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new qe({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class d5{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const Qf=new d5;function Sv(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:r,excludeCredentials:n}=e,s=od(e,["challenge","user","excludeCredentials"]),a=qa(t).buffer,o=Object.assign(Object.assign({},r),{id:qa(r.id).buffer}),l=Object.assign(Object.assign({},s),{challenge:a,user:o});if(n&&n.length>0){l.excludeCredentials=new Array(n.length);for(let c=0;c<n.length;c++){const u=n[c];l.excludeCredentials[c]=Object.assign(Object.assign({},u),{id:qa(u.id).buffer,type:u.type||"public-key",transports:u.transports})}}return l}function Nv(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:r}=e,n=od(e,["challenge","allowCredentials"]),s=qa(t).buffer,a=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){a.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const l=r[o];a.allowCredentials[o]=Object.assign(Object.assign({},l),{id:qa(l.id).buffer,type:l.type||"public-key",transports:l.transports})}}return a}function Ev(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e;return{id:e.id,rawId:e.id,response:{attestationObject:js(new Uint8Array(e.response.attestationObject)),clientDataJSON:js(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function Cv(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const r=e,n=e.getClientExtensionResults(),s=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:js(new Uint8Array(s.authenticatorData)),clientDataJSON:js(new Uint8Array(s.clientDataJSON)),signature:js(new Uint8Array(s.signature)),userHandle:s.userHandle?js(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(t=r.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function W_(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function du(){var e,t;return!!(st()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.get)=="function")}async function G_(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new uu("Browser returned unexpected credential type",t)}:{data:null,error:new uu("Empty credential response",t)}}catch(t){return{data:null,error:c5({error:t,options:e})}}}async function Y_(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new uu("Browser returned unexpected credential type",t)}:{data:null,error:new uu("Empty credential response",t)}}catch(t){return{data:null,error:u5({error:t,options:e})}}}const h5={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},f5={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function hu(...e){const t=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of e)if(s)for(const a in s){const o=s[a];if(o!==void 0)if(Array.isArray(o))n[a]=o;else if(r(o))n[a]=o;else if(t(o)){const l=n[a];t(l)?n[a]=hu(l,o):n[a]=hu(o)}else n[a]=o}return n}function p5(e,t){return hu(h5,e,t||{})}function m5(e,t){return hu(f5,e,t||{})}class g5{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:r,friendlyName:n,signal:s},a){var o;try{const{data:l,error:c}=await this.client.mfa.challenge({factorId:t,webauthn:r});if(!l)return{data:null,error:c};const u=s??Qf.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:d}=l.webauthn.credential_options.publicKey;if(!d.name){const h=n;if(h)d.name=`${d.id}:${h}`;else{const p=(await this.client.getUser()).data.user,b=((o=p==null?void 0:p.user_metadata)===null||o===void 0?void 0:o.name)||(p==null?void 0:p.email)||(p==null?void 0:p.id)||"User";d.name=`${d.id}:${b}`}}d.displayName||(d.displayName=d.name)}switch(l.webauthn.type){case"create":{const d=p5(l.webauthn.credential_options.publicKey,a==null?void 0:a.create),{data:h,error:f}=await G_({publicKey:d,signal:u});return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}case"request":{const d=m5(l.webauthn.credential_options.publicKey,a==null?void 0:a.request),{data:h,error:f}=await Y_(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:d,signal:u}));return h?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:h}},error:null}:{data:null,error:f}}}}catch(l){return W(l)?{data:null,error:l}:{data:null,error:new hr("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:t,webauthn:n})}async _authenticate({factorId:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},a){if(!r)return{data:null,error:new Wo("rpId is required for WebAuthn authentication")};try{if(!du())return{data:null,error:new hr("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this.challenge({factorId:t,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:a});if(!o)return{data:null,error:l};const{webauthn:c}=o;return this._verify({factorId:t,challengeId:o.challengeId,webauthn:{type:c.type,rpId:r,rpOrigins:n,credential_response:c.credential_response}})}catch(o){return W(o)?{data:null,error:o}:{data:null,error:new hr("Unexpected error in authenticate",o)}}}async _register({friendlyName:t,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},a){if(!r)return{data:null,error:new Wo("rpId is required for WebAuthn registration")};try{if(!du())return{data:null,error:new hr("Browser does not support WebAuthn",null)};const{data:o,error:l}=await this._enroll({friendlyName:t});if(!o)return await this.client.mfa.listFactors().then(d=>{var h;return(h=d.data)===null||h===void 0?void 0:h.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===t&&f.status!=="unverified")}).then(d=>d?this.client.mfa.unenroll({factorId:d==null?void 0:d.id}):void 0),{data:null,error:l};const{data:c,error:u}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:a});return c?this._verify({factorId:o.id,challengeId:c.challengeId,webauthn:{rpId:r,rpOrigins:n,type:c.webauthn.type,credential_response:c.webauthn.credential_response}}):{data:null,error:u}}catch(o){return W(o)?{data:null,error:o}:{data:null,error:new hr("Unexpected error in register",o)}}}}a5();const y5={url:wI,storageKey:_I,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:kI,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function Tv(e,t,r){return await r()}const da={};class Go{get jwks(){var t,r;return(r=(t=da[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(t){da[this.storageKey]=Object.assign(Object.assign({},da[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,r;return(r=(t=da[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){da[this.storageKey]=Object.assign(Object.assign({},da[this.storageKey]),{cachedAt:t})}constructor(t){var r,n,s,a;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},y5),t);if(this.storageKey=o.storageKey,this.instanceID=(r=Go.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Go.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&st()){const l=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(l),this.logDebugMessages&&console.trace(l)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(n=o.experimental)!==null&&n!==void 0?n:{},this.admin=new n5({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=V_(o.fetch),this.lock=o.lock||Tv,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&st()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=s5:this.lock=Tv,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new g5(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:H_()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=kv(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=kv(this.memoryStorage)),st()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(l){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",l)}(a=this.broadcastChannel)===null||a===void 0||a.addEventListener("message",async l=>{this._debug("received broadcast notification from other tab or client",l);try{await this._notifyAllSubscribers(l.data.event,l.data.session,!1)}catch(c){this._debug("#broadcastChannel","error",c)}})}o.skipAutoInitialize||this.initialize().catch(l=>{this._debug("#initialize()","error",l)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${U_}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{let r={},n="none";if(st()&&(r=LI(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),st()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:a}=await this._getSessionFromURL(r,n);if(a){if(this._debug("#_initialize()","error detecting session from URL",a),CI(a)){const c=(t=a.details)===null||t===void 0?void 0:t.code;if(c==="identity_already_exists"||c==="identity_not_found"||c==="single_identity_not_deletable")return{error:a}}return{error:a}}const{session:o,redirectType:l}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",l),await this._saveSession(o),setTimeout(async()=>{l==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return W(r)?this._returnResult({error:r}):this._returnResult({error:new hr("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,n,s;try{const a=await J(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=t==null?void 0:t.options)===null||s===void 0?void 0:s.captchaToken}},xform:Ft}),{data:o,error:l}=a;if(l||!o)return this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(a){if(W(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signUp(t){var r,n,s;try{let a;if("email"in t){const{email:d,password:h,options:f}=t;let p=null,b=null;this.flowType==="pkce"&&([p,b]=await ua(this.storage,this.storageKey)),a=await J(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:d,password:h,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:b},xform:Ft})}else if("phone"in t){const{phone:d,password:h,options:f}=t;a=await J(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:d,password:h,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},channel:(s=f==null?void 0:f.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:Ft})}else throw new ec("You must provide either an email or phone number and a password");const{data:o,error:l}=a;if(l||!o)return await nt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:l});const c=o.session,u=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(a){if(await nt(this.storage,`${this.storageKey}-code-verifier`),W(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithPassword(t){try{let r;if("email"in t){const{email:a,password:o,options:l}=t;r=await J(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:wv})}else if("phone"in t){const{phone:a,password:o,options:l}=t;r=await J(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:wv})}else throw new ec("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const a=new ca;return this._returnResult({data:{user:null,session:null},error:a})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if(W(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(t){var r,n,s,a;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=t.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=t.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(a=t.options)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:r}=t;switch(r){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(t){var r,n,s,a,o,l,c,u,d,h,f;let p,b;if("message"in t)p=t.message,b=t.signature;else{const{chain:g,wallet:w,statement:y,options:v}=t;let x;if(st())if(typeof w=="object")x=w;else{const A=window;if("ethereum"in A&&typeof A.ethereum=="object"&&"request"in A.ethereum&&typeof A.ethereum.request=="function")x=A.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof w!="object"||!(v!=null&&v.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=w}const _=new URL((r=v==null?void 0:v.url)!==null&&r!==void 0?r:window.location.href),j=await x.request({method:"eth_requestAccounts"}).then(A=>A).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!j||j.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const S=q_(j[0]);let C=(n=v==null?void 0:v.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!C){const A=await x.request({method:"eth_chainId"});C=i5(A)}const k={domain:_.host,address:S,statement:y,uri:_.href,version:"1",chainId:C,nonce:(s=v==null?void 0:v.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(a=v==null?void 0:v.signInWithEthereum)===null||a===void 0?void 0:a.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(l=v==null?void 0:v.signInWithEthereum)===null||l===void 0?void 0:l.expirationTime,notBefore:(c=v==null?void 0:v.signInWithEthereum)===null||c===void 0?void 0:c.notBefore,requestId:(u=v==null?void 0:v.signInWithEthereum)===null||u===void 0?void 0:u.requestId,resources:(d=v==null?void 0:v.signInWithEthereum)===null||d===void 0?void 0:d.resources};p=l5(k),b=await x.request({method:"personal_sign",params:[o5(p),S]})}try{const{data:g,error:w}=await J(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:b},!((h=t.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(f=t.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:Ft});if(w)throw w;if(!g||!g.session||!g.user){const y=new ca;return this._returnResult({data:{user:null,session:null},error:y})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:w})}catch(g){if(W(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(t){var r,n,s,a,o,l,c,u,d,h,f,p;let b,g;if("message"in t)b=t.message,g=t.signature;else{const{chain:w,wallet:y,statement:v,options:x}=t;let _;if(st())if(typeof y=="object")_=y;else{const S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))_=S.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof y!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");_=y}const j=new URL((r=x==null?void 0:x.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in _&&_.signIn){const S=await _.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},x==null?void 0:x.signInWithSolana),{version:"1",domain:j.host,uri:j.href}),v?{statement:v}:null));let C;if(Array.isArray(S)&&S[0]&&typeof S[0]=="object")C=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)C=S;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in C&&"signature"in C&&(typeof C.signedMessage=="string"||C.signedMessage instanceof Uint8Array)&&C.signature instanceof Uint8Array)b=typeof C.signedMessage=="string"?C.signedMessage:new TextDecoder().decode(C.signedMessage),g=C.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in _)||typeof _.signMessage!="function"||!("publicKey"in _)||typeof _!="object"||!_.publicKey||!("toBase58"in _.publicKey)||typeof _.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");b=[`${j.host} wants you to sign in with your Solana account:`,_.publicKey.toBase58(),...v?["",v,""]:[""],"Version: 1",`URI: ${j.href}`,`Issued At: ${(s=(n=x==null?void 0:x.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((a=x==null?void 0:x.signInWithSolana)===null||a===void 0)&&a.notBefore?[`Not Before: ${x.signInWithSolana.notBefore}`]:[],...!((o=x==null?void 0:x.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${x.signInWithSolana.expirationTime}`]:[],...!((l=x==null?void 0:x.signInWithSolana)===null||l===void 0)&&l.chainId?[`Chain ID: ${x.signInWithSolana.chainId}`]:[],...!((c=x==null?void 0:x.signInWithSolana)===null||c===void 0)&&c.nonce?[`Nonce: ${x.signInWithSolana.nonce}`]:[],...!((u=x==null?void 0:x.signInWithSolana)===null||u===void 0)&&u.requestId?[`Request ID: ${x.signInWithSolana.requestId}`]:[],...!((h=(d=x==null?void 0:x.signInWithSolana)===null||d===void 0?void 0:d.resources)===null||h===void 0)&&h.length?["Resources",...x.signInWithSolana.resources.map(C=>`- ${C}`)]:[]].join(`
`);const S=await _.signMessage(new TextEncoder().encode(b),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=S}}try{const{data:w,error:y}=await J(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:b,signature:js(g)},!((f=t.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=t.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:Ft});if(y)throw y;if(!w||!w.session||!w.user){const v=new ca;return this._returnResult({data:{user:null,session:null},error:v})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:y})}catch(w){if(W(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(t){const r=await ms(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new TI;const{data:a,error:o}=await J(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:n},xform:Ft});if(await nt(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!a||!a.session||!a.user){const l=new ca;return this._returnResult({data:{user:null,session:null,redirectType:null},error:l})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",a.session)),this._returnResult({data:Object.assign(Object.assign({},a),{redirectType:s??null}),error:o})}catch(a){if(await nt(this.storage,`${this.storageKey}-code-verifier`),W(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(t){try{const{options:r,provider:n,token:s,access_token:a,nonce:o}=t,l=await J(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:a,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:Ft}),{data:c,error:u}=l;if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!c||!c.session||!c.user){const d=new ca;return this._returnResult({data:{user:null,session:null},error:d})}return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),this._returnResult({data:c,error:u})}catch(r){if(W(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(t){var r,n,s,a,o;try{if("email"in t){const{email:l,options:c}=t;let u=null,d=null;this.flowType==="pkce"&&([u,d]=await ua(this.storage,this.storageKey));const{error:h}=await J(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:u,code_challenge_method:d},redirectTo:c==null?void 0:c.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in t){const{phone:l,options:c}=t,{data:u,error:d}=await J(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(s=c==null?void 0:c.data)!==null&&s!==void 0?s:{},create_user:(a=c==null?void 0:c.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:u==null?void 0:u.message_id},error:d})}throw new ec("You must provide either an email or phone number.")}catch(l){if(await nt(this.storage,`${this.storageKey}-code-verifier`),W(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async verifyOtp(t){var r,n;try{let s,a;"options"in t&&(s=(r=t.options)===null||r===void 0?void 0:r.redirectTo,a=(n=t.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:l}=await J(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:a}}),redirectTo:s,xform:Ft});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,u=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),this._returnResult({data:{user:u,session:c},error:null})}catch(s){if(W(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(t){var r,n,s,a,o;try{let l=null,c=null;this.flowType==="pkce"&&([l,c]=await ua(this.storage,this.storageKey));const u=await J(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=t==null?void 0:t.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:l,code_challenge_method:c}),headers:this.headers,xform:e5});return!((a=u.data)===null||a===void 0)&&a.url&&st()&&!(!((o=t.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(u.data.url),this._returnResult(u)}catch(l){if(await nt(this.storage,`${this.storageKey}-code-verifier`),W(l))return this._returnResult({data:null,error:l});throw l}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)throw n;if(!r)throw new Xe;const{error:s}=await J(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(t){if(W(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const r=`${this.url}/resend`;if("email"in t){const{email:n,type:s,options:a}=t,{error:o}=await J(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},redirectTo:a==null?void 0:a.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in t){const{phone:n,type:s,options:a}=t,{data:o,error:l}=await J(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l})}throw new ec("You must provide either an email or phone number and a type")}catch(r){if(W(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await t(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const r=await ms(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const n=t.expires_at?t.expires_at*1e3-Date.now()<lh:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",t.expires_at),!n){if(this.userStorage){const o=await ms(this.userStorage,this.storageKey+"-user");o!=null&&o.user?t.user=o.user:t.user=uh()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};t.user=JI(t.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:s,error:a}=await this._callRefreshToken(t.refresh_token);return a?this._returnResult({data:{session:null},error:a}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(t){try{return t?await J(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:In}):await this._useSession(async r=>{var n,s,a;const{data:o,error:l}=r;if(l)throw l;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Xe}:await J(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0,xform:In})})}catch(r){if(W(r))return Xl(r)&&(await this._removeSession(),await nt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async n=>{const{data:s,error:a}=n;if(a)throw a;if(!s.session)throw new Xe;const o=s.session;let l=null,c=null;this.flowType==="pkce"&&t.email!=null&&([l,c]=await ua(this.storage,this.storageKey));const{data:u,error:d}=await J(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:In});if(d)throw d;return o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if(await nt(this.storage,`${this.storageKey}-code-verifier`),W(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Xe;const r=Date.now()/1e3;let n=r,s=!0,a=null;const{payload:o}=rc(t.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){const{data:l,error:c}=await this._callRefreshToken(t.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l)return{data:{user:null,session:null},error:null};a=l}else{const{data:l,error:c}=await this._getUser(t.access_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});a={access_token:t.access_token,refresh_token:t.refresh_token,user:l.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return this._returnResult({data:{user:a.user,session:a},error:null})}catch(r){if(W(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var n;if(!t){const{data:o,error:l}=r;if(l)throw l;t=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(t!=null&&t.refresh_token))throw new Xe;const{data:s,error:a}=await this._callRefreshToken(t.refresh_token);return a?this._returnResult({data:{user:null,session:null},error:a}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(W(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(t,r){var n;try{if(!st())throw new tc("No browser detected.");if(t.error||t.error_description||t.error_code)throw new tc(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new pv("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new tc("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new pv("No code detected.");const{data:x,error:_}=await this._exchangeCodeForSession(t.code);if(_)throw _;const j=new URL(window.location.href);return j.searchParams.delete("code"),window.history.replaceState(window.history.state,"",j.toString()),{data:{session:x.session,redirectType:(n=x.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:a,access_token:o,refresh_token:l,expires_in:c,expires_at:u,token_type:d}=t;if(!o||!c||!l||!d)throw new tc("No session defined in URL");const h=Math.round(Date.now()/1e3),f=parseInt(c);let p=h+f;u&&(p=parseInt(u));const b=p-h;b*1e3<=va&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${b}s, should have been closer to ${f}s`);const g=p-f;h-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,p,h):h-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,p,h);const{data:w,error:y}=await this._getUser(o);if(y)throw y;const v={provider_token:s,provider_refresh_token:a,access_token:o,expires_in:f,expires_at:p,refresh_token:l,token_type:d,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:v,redirectType:t.type},error:null})}catch(s){if(W(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error_description)}async _isPKCECallback(t){const r=await ms(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:a}=r;if(a&&!Xl(a))return this._returnResult({error:a});const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:l}=await this.admin.signOut(o,t);if(l&&!(EI(l)&&(l.status===404||l.status===401||l.status===403)||Xl(l)))return this._returnResult({error:l})}return t!=="others"&&(await this._removeSession(),await nt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(t){const r=MI(),n={id:r,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(t){return await this._useSession(async r=>{var n,s;try{const{data:{session:a},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",t,"session",a)}catch(a){await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",a),Xl(a)?console.warn(a):console.error(a)}})}async resetPasswordForEmail(t,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await ua(this.storage,this.storageKey,!0));try{return await J(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(a){if(await nt(this.storage,`${this.storageKey}-code-verifier`),W(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var t;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var r;try{const{data:n,error:s}=await this._useSession(async a=>{var o,l,c,u,d;const{data:h,error:f}=a;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(o=t.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=t.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=t.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await J(this.fetch,"GET",p,{headers:this.headers,jwt:(d=(u=h.session)===null||u===void 0?void 0:u.access_token)!==null&&d!==void 0?d:void 0})});if(s)throw s;return st()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:t.provider,url:n==null?void 0:n.url},error:null})}catch(n){if(W(n))return this._returnResult({data:{provider:t.provider,url:null},error:n});throw n}}async linkIdentityIdToken(t){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:a}}=r;if(s)throw s;const{options:o,provider:l,token:c,access_token:u,nonce:d}=t,h=await J(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=a==null?void 0:a.access_token)!==null&&n!==void 0?n:void 0,body:{provider:l,id_token:c,access_token:u,nonce:d,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:Ft}),{data:f,error:p}=h;return p?this._returnResult({data:{user:null,session:null},error:p}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new ca}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(s){if(await nt(this.storage,`${this.storageKey}-code-verifier`),W(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(t){try{return await this._useSession(async r=>{var n,s;const{data:a,error:o}=r;if(o)throw o;return await J(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(s=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(t){const r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await UI(async s=>(s>0&&await zI(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await J(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Ft})),(s,a)=>{const o=200*Math.pow(2,s);return a&&ch(a)&&Date.now()+o-n<va})}catch(n){if(this._debug(r,"error",n),W(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",n),st()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:t,url:n},error:null}}async _recoverAndRefresh(){var t,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await ms(this.storage,this.storageKey);if(s&&this.userStorage){let o=await ms(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await xa(this.userStorage,this.storageKey+"-user",o)),s.user=(t=o==null?void 0:o.user)!==null&&t!==void 0?t:uh()}else if(s&&!s.user&&!s.user){const o=await ms(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await nt(this.storage,this.storageKey+"-user"),await xa(this.storage,this.storageKey,s)):s.user=uh()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const a=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<lh;if(this._debug(n,`session has${a?"":" not"} expired with margin of ${lh}s`),a){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),ch(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:l}=await this._getUser(s.access_token);!l&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(t){var r,n;if(!t)throw new Xe;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new ld;const{data:a,error:o}=await this._refreshAccessToken(t);if(o)throw o;if(!a.session)throw new Xe;await this._saveSession(a.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",a.session);const l={data:a.session,error:null};return this.refreshingDeferred.resolve(l),l}catch(a){if(this._debug(s,"error",a),W(a)){const o={data:null,error:a};return ch(a)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(a),a}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(t,r,n=!0){const s=`#_notifyAllSubscribers(${t})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:t,session:r});const a=[],o=Array.from(this.stateChangeEmitters.values()).map(async l=>{try{await l.callback(t,r)}catch(c){a.push(c)}});if(await Promise.all(o),a.length>0){for(let l=0;l<a.length;l+=1)console.error(a[l]);throw a[0]}}finally{this._debug(s,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await nt(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},t),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await xa(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const a=xv(s);await xa(this.storage,this.storageKey,a)}else{const s=xv(r);await xa(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await nt(this.storage,this.storageKey),await nt(this.storage,this.storageKey+"-code-verifier"),await nt(this.storage,this.storageKey+"-user"),this.userStorage&&await nt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&st()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),va);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-t)/va);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${va}ms, refresh threshold is ${Gf} ticks`),s<=Gf&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof K_)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!st()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[a,o]=await ua(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(l.toString())}if(n!=null&&n.queryParams){const a=new URLSearchParams(n.queryParams);s.push(a.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${t}?${s.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var n;const{data:s,error:a}=r;return a?this._returnResult({data:null,error:a}):await J(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(t){try{return await this._useSession(async r=>{var n,s;const{data:a,error:o}=r;if(o)return this._returnResult({data:null,error:o});const l=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:c,error:u}=await J(this.fetch,"POST",`${this.url}/factors`,{body:l,headers:this.headers,jwt:(n=a==null?void 0:a.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(t.factorType==="totp"&&c.type==="totp"&&(!((s=c==null?void 0:c.totp)===null||s===void 0)&&s.qr_code)&&(c.totp.qr_code=`data:image/svg+xml;utf-8,${c.totp.qr_code}`),this._returnResult({data:c,error:null}))})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _verify(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:a}=r;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Ev(t.webauthn.credential_response):Cv(t.webauthn.credential_response)})}:{code:t.code}),{data:l,error:c}=await J(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),this._returnResult({data:l,error:c}))})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(t){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:a}=r;if(a)return this._returnResult({data:null,error:a});const o=await J(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;const{data:l}=o;if(l.type!=="webauthn")return{data:l,error:null};switch(l.webauthn.type){case"create":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:Sv(l.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},l),{webauthn:Object.assign(Object.assign({},l.webauthn),{credential_options:Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:Nv(l.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(t){const{data:r,error:n}=await this._challenge({factorId:t.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){var t;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const a of(t=r==null?void 0:r.factors)!==null&&t!==void 0?t:[])s.all.push(a),a.status==="verified"&&s[a.factor_type].push(a);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(t){var r,n,s,a;if(t)try{const{payload:p}=rc(t);let b=null;p.aal&&(b=p.aal);let g=b;const{data:{user:w},error:y}=await this.getUser(t);if(y)return this._returnResult({data:null,error:y});((n=(r=w==null?void 0:w.factors)===null||r===void 0?void 0:r.filter(_=>_.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(g="aal2");const x=p.amr||[];return{data:{currentLevel:b,nextLevel:g,currentAuthenticationMethods:x},error:null}}catch(p){if(W(p))return this._returnResult({data:null,error:p});throw p}const{data:{session:o},error:l}=await this.getSession();if(l)return this._returnResult({data:null,error:l});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:c}=rc(o.access_token);let u=null;c.aal&&(u=c.aal);let d=u;((a=(s=o.user.factors)===null||s===void 0?void 0:s.filter(p=>p.status==="verified"))!==null&&a!==void 0?a:[]).length>0&&(d="aal2");const f=c.amr||[];return{data:{currentLevel:u,nextLevel:d,currentAuthenticationMethods:f},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await J(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:n.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new Xe})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:s},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!s)return this._returnResult({data:null,error:new Xe});const o=await J(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&st()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(t,r){try{return await this._useSession(async n=>{const{data:{session:s},error:a}=n;if(a)return this._returnResult({data:null,error:a});if(!s)return this._returnResult({data:null,error:new Xe});const o=await J(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:l=>({data:l,error:null})});return o.data&&o.data.redirect_url&&st()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;return n?this._returnResult({data:null,error:n}):r?await J(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Xe})})}catch(t){if(W(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await J(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Xe})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(t,r={keys:[]}){let n=r.keys.find(l=>l.kid===t);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(l=>l.kid===t),n&&this.jwks_cached_at+SI>s)return n;const{data:a,error:o}=await J(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!a.keys||a.keys.length===0||(this.jwks=a,this.jwks_cached_at=s,n=a.keys.find(l=>l.kid===t),!n)?null:n}async getClaims(t,r={}){try{let n=t;if(!n){const{data:p,error:b}=await this.getSession();if(b||!p.session)return this._returnResult({data:null,error:b});n=p.session.access_token}const{header:s,payload:a,signature:o,raw:{header:l,payload:c}}=rc(n);r!=null&&r.allowExpired||WI(a.exp);const u=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!u){const{error:p}=await this.getUser(n);if(p)throw p;return{data:{claims:a,header:s,signature:o},error:null}}const d=GI(s.alg),h=await crypto.subtle.importKey("jwk",u,d,!0,["verify"]);if(!await crypto.subtle.verify(d,h,o,II(`${l}.${c}`)))throw new Zf("Invalid JWT signature");return{data:{claims:a,header:s,signature:o},error:null}}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(t){var r,n,s;sr(this.experimental);try{if(!du())return this._returnResult({data:null,error:new hr("Browser does not support WebAuthn",null)});const{data:a,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}});if(o||!a)return this._returnResult({data:null,error:o});const l=Nv(a.options),c=(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:Qf.createNewAbortSignal(),{data:u,error:d}=await Y_({publicKey:l,signal:c});if(d||!u)return this._returnResult({data:null,error:d??new hr("WebAuthn ceremony failed",null)});const h=Cv(u);return this._verifyPasskeyAuthentication({challengeId:a.challenge_id,credential:h})}catch(a){if(W(a))return this._returnResult({data:null,error:a});throw a}}async registerPasskey(t){var r,n;sr(this.experimental);try{if(!du())return this._returnResult({data:null,error:new hr("Browser does not support WebAuthn",null)});const{data:s,error:a}=await this._startPasskeyRegistration();if(a||!s)return this._returnResult({data:null,error:a});const o=Sv(s.options),l=(n=(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:Qf.createNewAbortSignal(),{data:c,error:u}=await G_({publicKey:o,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new hr("WebAuthn ceremony failed",null)});const d=Ev(c);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:d})}catch(s){if(W(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){sr(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Xe});const{data:s,error:a}=await J(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return a?this._returnResult({data:null,error:a}):this._returnResult({data:s,error:null})})}catch(t){if(W(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){sr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Xe});const{data:a,error:o}=await J(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(t){var r;sr(this.experimental);try{const{data:n,error:s}=await J(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=t==null?void 0:t.options)===null||r===void 0?void 0:r.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})}catch(n){if(W(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(t){sr(this.experimental);try{const{data:r,error:n}=await J(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:Ft});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){sr(this.experimental);try{return await this._useSession(async t=>{const{data:{session:r},error:n}=t;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Xe});const{data:s,error:a}=await J(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return a?this._returnResult({data:null,error:a}):this._returnResult({data:s,error:null})})}catch(t){if(W(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){sr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Xe});const{data:a,error:o}=await J(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:t.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(t){sr(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Xe});const{error:a}=await J(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return a?this._returnResult({data:null,error:a}):this._returnResult({data:null,error:null})})}catch(r){if(W(r))return this._returnResult({data:null,error:r});throw r}}}Go.nextInstanceID={};const v5=Go,x5="2.105.0";let Xi="";typeof Deno<"u"?Xi="deno":typeof document<"u"?Xi="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Xi="react-native":Xi="node";const b5={"X-Client-Info":`supabase-js-${Xi}/${x5}`},w5={headers:b5},_5={schema:"public"},k5={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},j5={};function Yo(e){"@babel/helpers - typeof";return Yo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yo(e)}function S5(e,t){if(Yo(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(Yo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function N5(e){var t=S5(e,"string");return Yo(t)=="symbol"?t:t+""}function E5(e,t,r){return(t=N5(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Fe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rv(Object(r),!0).forEach(function(n){E5(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rv(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}const C5=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),T5=()=>Headers,R5=(e,t,r)=>{const n=C5(r),s=T5();return async(a,o)=>{var l;const c=(l=await t())!==null&&l!==void 0?l:e;let u=new s(o==null?void 0:o.headers);return u.has("apikey")||u.set("apikey",e),u.has("Authorization")||u.set("Authorization",`Bearer ${c}`),n(a,Fe(Fe({},o),{},{headers:u}))}};function A5(e){return e.endsWith("/")?e:e+"/"}function P5(e,t){var r,n;const{db:s,auth:a,realtime:o,global:l}=e,{db:c,auth:u,realtime:d,global:h}=t,f={db:Fe(Fe({},c),s),auth:Fe(Fe({},u),a),realtime:Fe(Fe({},d),o),storage:{},global:Fe(Fe(Fe({},h),l),{},{headers:Fe(Fe({},(r=h==null?void 0:h.headers)!==null&&r!==void 0?r:{}),(n=l==null?void 0:l.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return e.accessToken?f.accessToken=e.accessToken:delete f.accessToken,f}function O5(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(A5(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var I5=class extends v5{constructor(e){super(e)}},D5=class{constructor(e,t,r){var n,s;this.supabaseUrl=e,this.supabaseKey=t;const a=O5(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const o=`sb-${a.hostname.split(".")[0]}-auth-token`,l={db:_5,realtime:j5,auth:Fe(Fe({},k5),{},{storageKey:o}),global:w5},c=P5(r??{},l);if(this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=c.global.headers)!==null&&s!==void 0?s:{},c.accessToken)this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var u;this.auth=this._initSupabaseAuthClient((u=c.auth)!==null&&u!==void 0?u:{},this.headers,c.global.fetch)}this.fetch=R5(t,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Fe({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},c.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new uO(new URL("rest/v1",a).href,{headers:this.headers,schema:c.db.schema,fetch:this.fetch,timeout:c.db.timeout,urlLengthLimit:c.db.urlLengthLimit}),this.storage=new bI(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),c.accessToken||this._listenForAuthEvents()}get functions(){return new eO(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,r;if(e.accessToken)return await e.accessToken();const{data:n}=await e.auth.getSession();return(t=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:a,flowType:o,lock:l,debug:c,throwOnError:u,experimental:d},h,f){const p={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new I5({url:this.authUrl.href,headers:Fe(Fe({},p),h),storageKey:a,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:l,debug:c,throwOnError:u,experimental:d,fetch:f,hasCustomAuthorizationHeader:Object.keys(this.headers).some(b=>b.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new HO(this.realtimeUrl.href,Fe(Fe({},e),{},{params:Fe(Fe({},{apikey:this.supabaseKey}),e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,r){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const M5=(e,t,r)=>new D5(e,t,r);function L5(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const r=t.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}L5()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const $5="https://ryheooziihtlvsvdijtu.supabase.co",z5="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJ5aGVvb3ppaWh0bHZzdmRpanR1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzY3ODM4NDUsImV4cCI6MjA5MjM1OTg0NX0.XMS0YvVXxMzHEl3eBbV3SmbCDeMz9cVGE_ks6OMWDGQ",U=M5($5,z5,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),J_=m.createContext(void 0),U5=({children:e})=>{const[t,r]=m.useState(null),[n,s]=m.useState(null),[a,o]=m.useState(!0),[l,c]=m.useState(!1);m.useEffect(()=>{const{data:{subscription:h}}=U.auth.onAuthStateChange((f,p)=>{s(p),r((p==null?void 0:p.user)??null),p!=null&&p.user?setTimeout(()=>{u(p.user.id)},0):c(!1)});return U.auth.getSession().then(({data:{session:f}})=>{s(f),r((f==null?void 0:f.user)??null),f!=null&&f.user&&u(f.user.id),o(!1)}),()=>h.unsubscribe()},[]);const u=async h=>{const{data:f}=await U.rpc("has_role",{_user_id:h,_role:"admin"});c(!!f)},d=async()=>{await U.auth.signOut(),c(!1)};return i.jsx(J_.Provider,{value:{user:t,session:n,loading:a,isAdmin:l,signOut:d},children:e})},Hr=()=>{const e=m.useContext(J_);if(!e)throw new Error("useAuth must be used inside AuthProvider");return e},Z_=m.createContext(void 0),Av="dr_cart_v1",F5=({children:e})=>{const[t,r]=m.useState([]),[n,s]=m.useState(!1);m.useEffect(()=>{try{const h=localStorage.getItem(Av);h&&r(JSON.parse(h))}catch{}},[]),m.useEffect(()=>{localStorage.setItem(Av,JSON.stringify(t))},[t]);const a=(h,f=1)=>{r(p=>p.find(g=>g.product_id===h.product_id)?p.map(g=>g.product_id===h.product_id?{...g,quantity:g.quantity+f}:g):[...p,{...h,quantity:f}]),s(!0)},o=h=>r(f=>f.filter(p=>p.product_id!==h)),l=(h,f)=>{if(f<=0)return o(h);r(p=>p.map(b=>b.product_id===h?{...b,quantity:f}:b))},c=()=>r([]),u=t.reduce((h,f)=>h+f.price*f.quantity,0),d=t.reduce((h,f)=>h+f.quantity,0);return i.jsx(Z_.Provider,{value:{items:t,addItem:a,removeItem:o,updateQuantity:l,clear:c,total:u,count:d,open:n,setOpen:s},children:e})},pl=()=>{const e=m.useContext(Z_);return e||{items:[],addItem:()=>{},removeItem:()=>{},updateQuantity:()=>{},clear:()=>{},total:0,count:0,open:!1,setOpen:()=>{}}},Q_=m.createContext(void 0),B5=({children:e})=>{const{user:t}=Hr(),[r,n]=m.useState(new Set),[s,a]=m.useState(!1),o=m.useCallback(async()=>{if(!t){n(new Set);return}a(!0);const{data:c}=await U.from("wishlist").select("product_id").eq("user_id",t.id);n(new Set((c??[]).map(u=>u.product_id))),a(!1)},[t]);m.useEffect(()=>{o()},[o]);const l=async c=>{if(!t)throw new Error("Auth required");return r.has(c)?(await U.from("wishlist").delete().eq("user_id",t.id).eq("product_id",c),n(u=>{const d=new Set(u);return d.delete(c),d}),!1):(await U.from("wishlist").insert({user_id:t.id,product_id:c}),n(u=>new Set(u).add(c)),!0)};return i.jsx(Q_.Provider,{value:{productIds:r,count:r.size,loading:s,isInWishlist:c=>r.has(c),toggle:l,refresh:o},children:e})},Rm=()=>{const e=m.useContext(Q_);return e||{productIds:new Set,count:0,loading:!1,isInWishlist:()=>!1,toggle:async()=>!1,refresh:async()=>{}}};var hh="focusScope.autoFocusOnMount",fh="focusScope.autoFocusOnUnmount",Pv={bubbles:!1,cancelable:!0},H5="FocusScope",Am=m.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=e,[l,c]=m.useState(null),u=Mt(s),d=Mt(a),h=m.useRef(null),f=$e(t,g=>c(g)),p=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(n){let g=function(x){if(p.paused||!l)return;const _=x.target;l.contains(_)?h.current=_:En(h.current,{select:!0})},w=function(x){if(p.paused||!l)return;const _=x.relatedTarget;_!==null&&(l.contains(_)||En(h.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const j of x)j.removedNodes.length>0&&En(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",w);const v=new MutationObserver(y);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",w),v.disconnect()}}},[n,l,p.paused]),m.useEffect(()=>{if(l){Iv.add(p);const g=document.activeElement;if(!l.contains(g)){const y=new CustomEvent(hh,Pv);l.addEventListener(hh,u),l.dispatchEvent(y),y.defaultPrevented||(V5(Y5(X_(l)),{select:!0}),document.activeElement===g&&En(l))}return()=>{l.removeEventListener(hh,u),setTimeout(()=>{const y=new CustomEvent(fh,Pv);l.addEventListener(fh,d),l.dispatchEvent(y),y.defaultPrevented||En(g??document.body,{select:!0}),l.removeEventListener(fh,d),Iv.remove(p)},0)}}},[l,u,d,p]);const b=m.useCallback(g=>{if(!r&&!n||p.paused)return;const w=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(w&&y){const v=g.currentTarget,[x,_]=K5(v);x&&_?!g.shiftKey&&y===_?(g.preventDefault(),r&&En(x,{select:!0})):g.shiftKey&&y===x&&(g.preventDefault(),r&&En(_,{select:!0})):y===v&&g.preventDefault()}},[r,n,p.paused]);return i.jsx(xe.div,{tabIndex:-1,...o,ref:f,onKeyDown:b})});Am.displayName=H5;function V5(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(En(n,{select:t}),document.activeElement!==r)return}function K5(e){const t=X_(e),r=Ov(t,e),n=Ov(t.reverse(),e);return[r,n]}function X_(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Ov(e,t){for(const r of e)if(!q5(r,{upTo:t}))return r}function q5(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function W5(e){return e instanceof HTMLInputElement&&"select"in e}function En(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&W5(e)&&t&&e.select()}}var Iv=G5();function G5(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Dv(e,t),e.unshift(t)},remove(t){var r;e=Dv(e,t),(r=e[0])==null||r.resume()}}}function Dv(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Y5(e){return e.filter(t=>t.tagName!=="A")}var ph=0;function ek(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Mv()),document.body.insertAdjacentElement("beforeend",e[1]??Mv()),ph++,()=>{ph===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ph--}},[])}function Mv(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Pr=function(){return Pr=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},Pr.apply(this,arguments)};function tk(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function J5(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,a;n<s;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}var Nc="right-scroll-bar-position",Ec="width-before-scroll-bar",Z5="with-scroll-bars-hidden",Q5="--removed-body-scroll-bar-size";function mh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function X5(e,t){var r=m.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var eD=typeof window<"u"?m.useLayoutEffect:m.useEffect,Lv=new WeakMap;function tD(e,t){var r=X5(null,function(n){return e.forEach(function(s){return mh(s,n)})});return eD(function(){var n=Lv.get(r);if(n){var s=new Set(n),a=new Set(e),o=r.current;s.forEach(function(l){a.has(l)||mh(l,null)}),a.forEach(function(l){s.has(l)||mh(l,o)})}Lv.set(r,e)},[e]),r}function rD(e){return e}function nD(e,t){t===void 0&&(t=rD);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var o=t(a,n);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(n=!0;r.length;){var o=r;r=[],o.forEach(a)}r={push:function(l){return a(l)},filter:function(){return r}}},assignMedium:function(a){n=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(a),o=r}var c=function(){var d=o;o=[],d.forEach(a)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(d){o.push(d),u()},filter:function(d){return o=o.filter(d),r}}}};return s}function sD(e){e===void 0&&(e={});var t=nD(null);return t.options=Pr({async:!0,ssr:!1},e),t}var rk=function(e){var t=e.sideCar,r=tk(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return m.createElement(n,Pr({},r))};rk.isSideCarExport=!0;function aD(e,t){return e.useMedium(t),rk}var nk=sD(),gh=function(){},cd=m.forwardRef(function(e,t){var r=m.useRef(null),n=m.useState({onScrollCapture:gh,onWheelCapture:gh,onTouchMoveCapture:gh}),s=n[0],a=n[1],o=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,f=e.sideCar,p=e.noRelative,b=e.noIsolation,g=e.inert,w=e.allowPinchZoom,y=e.as,v=y===void 0?"div":y,x=e.gapMode,_=tk(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=f,S=tD([r,t]),C=Pr(Pr({},_),s);return m.createElement(m.Fragment,null,d&&m.createElement(j,{sideCar:nk,removeScrollBar:u,shards:h,noRelative:p,noIsolation:b,inert:g,setCallbacks:a,allowPinchZoom:!!w,lockRef:r,gapMode:x}),o?m.cloneElement(m.Children.only(l),Pr(Pr({},C),{ref:S})):m.createElement(v,Pr({},C,{className:c,ref:S}),l))});cd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cd.classNames={fullWidth:Ec,zeroRight:Nc};var iD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function oD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=iD();return t&&e.setAttribute("nonce",t),e}function lD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function cD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var uD=function(){var e=0,t=null;return{add:function(r){e==0&&(t=oD())&&(lD(t,r),cD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},dD=function(){var e=uD();return function(t,r){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},sk=function(){var e=dD(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},hD={left:0,top:0,right:0,gap:0},yh=function(e){return parseInt(e||"",10)||0},fD=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[yh(r),yh(n),yh(s)]},pD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return hD;var t=fD(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},mD=sk(),Wa="data-scroll-locked",gD=function(e,t,r,n){var s=e.left,a=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
.`.concat(Z5,` {
overflow: hidden `).concat(n,`;
padding-right: `).concat(l,"px ").concat(n,`;
}
body[`).concat(Wa,`] {
overflow: hidden `).concat(n,`;
overscroll-behavior: contain;
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
padding-left: `.concat(s,`px;
padding-top: `).concat(a,`px;
padding-right: `).concat(o,`px;
margin-left:0;
margin-top:0;
margin-right: `).concat(l,"px ").concat(n,`;
`),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),`
}
.`).concat(Nc,` {
right: `).concat(l,"px ").concat(n,`;
}
.`).concat(Ec,` {
margin-right: `).concat(l,"px ").concat(n,`;
}
.`).concat(Nc," .").concat(Nc,` {
right: 0 `).concat(n,`;
}
.`).concat(Ec," .").concat(Ec,` {
margin-right: 0 `).concat(n,`;
}
body[`).concat(Wa,`] {
`).concat(Q5,": ").concat(l,`px;
}
`)},$v=function(){var e=parseInt(document.body.getAttribute(Wa)||"0",10);return isFinite(e)?e:0},yD=function(){m.useEffect(function(){return document.body.setAttribute(Wa,($v()+1).toString()),function(){var e=$v()-1;e<=0?document.body.removeAttribute(Wa):document.body.setAttribute(Wa,e.toString())}},[])},vD=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;yD();var a=m.useMemo(function(){return pD(s)},[s]);return m.createElement(mD,{styles:gD(a,!t,s,r?"":"!important")})},Xf=!1;if(typeof window<"u")try{var nc=Object.defineProperty({},"passive",{get:function(){return Xf=!0,!0}});window.addEventListener("test",nc,nc),window.removeEventListener("test",nc,nc)}catch{Xf=!1}var ha=Xf?{passive:!1}:!1,xD=function(e){return e.tagName==="TEXTAREA"},ak=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!xD(e)&&r[t]==="visible")},bD=function(e){return ak(e,"overflowY")},wD=function(e){return ak(e,"overflowX")},zv=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=ik(e,n);if(s){var a=ok(e,n),o=a[1],l=a[2];if(o>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},_D=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},kD=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},ik=function(e,t){return e==="v"?bD(t):wD(t)},ok=function(e,t){return e==="v"?_D(t):kD(t)},jD=function(e,t){return e==="h"&&t==="rtl"?-1:1},SD=function(e,t,r,n,s){var a=jD(e,window.getComputedStyle(t).direction),o=a*n,l=r.target,c=t.contains(l),u=!1,d=o>0,h=0,f=0;do{if(!l)break;var p=ok(e,l),b=p[0],g=p[1],w=p[2],y=g-w-a*b;(b||y)&&ik(e,l)&&(h+=y,f+=b);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(h)<1||!s)||!d&&(Math.abs(f)<1||!s))&&(u=!0),u},sc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Uv=function(e){return[e.deltaX,e.deltaY]},Fv=function(e){return e&&"current"in e?e.current:e},ND=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ED=function(e){return`
.block-interactivity-`.concat(e,` {pointer-events: none;}
.allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},CD=0,fa=[];function TD(e){var t=m.useRef([]),r=m.useRef([0,0]),n=m.useRef(),s=m.useState(CD++)[0],a=m.useState(sk)[0],o=m.useRef(e);m.useEffect(function(){o.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var g=J5([e.lockRef.current],(e.shards||[]).map(Fv),!0).filter(Boolean);return g.forEach(function(w){return w.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(g,w){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var y=sc(g),v=r.current,x="deltaX"in g?g.deltaX:v[0]-y[0],_="deltaY"in g?g.deltaY:v[1]-y[1],j,S=g.target,C=Math.abs(x)>Math.abs(_)?"h":"v";if("touches"in g&&C==="h"&&S.type==="range")return!1;var k=zv(C,S);if(!k)return!0;if(k?j=C:(j=C==="v"?"h":"v",k=zv(C,S)),!k)return!1;if(!n.current&&"changedTouches"in g&&(x||_)&&(n.current=j),!j)return!0;var A=n.current||j;return SD(A,w,g,A==="h"?x:_,!0)},[]),c=m.useCallback(function(g){var w=g;if(!(!fa.length||fa[fa.length-1]!==a)){var y="deltaY"in w?Uv(w):sc(w),v=t.current.filter(function(j){return j.name===w.type&&(j.target===w.target||w.target===j.shadowParent)&&ND(j.delta,y)})[0];if(v&&v.should){w.cancelable&&w.preventDefault();return}if(!v){var x=(o.current.shards||[]).map(Fv).filter(Boolean).filter(function(j){return j.contains(w.target)}),_=x.length>0?l(w,x[0]):!o.current.noIsolation;_&&w.cancelable&&w.preventDefault()}}},[]),u=m.useCallback(function(g,w,y,v){var x={name:g,delta:w,target:y,should:v,shadowParent:RD(y)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(_){return _!==x})},1)},[]),d=m.useCallback(function(g){r.current=sc(g),n.current=void 0},[]),h=m.useCallback(function(g){u(g.type,Uv(g),g.target,l(g,e.lockRef.current))},[]),f=m.useCallback(function(g){u(g.type,sc(g),g.target,l(g,e.lockRef.current))},[]);m.useEffect(function(){return fa.push(a),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",c,ha),document.addEventListener("touchmove",c,ha),document.addEventListener("touchstart",d,ha),function(){fa=fa.filter(function(g){return g!==a}),document.removeEventListener("wheel",c,ha),document.removeEventListener("touchmove",c,ha),document.removeEventListener("touchstart",d,ha)}},[]);var p=e.removeScrollBar,b=e.inert;return m.createElement(m.Fragment,null,b?m.createElement(a,{styles:ED(s)}):null,p?m.createElement(vD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function RD(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const AD=aD(nk,TD);var Pm=m.forwardRef(function(e,t){return m.createElement(cd,Pr({},e,{ref:t,sideCar:AD}))});Pm.classNames=cd.classNames;var PD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},pa=new WeakMap,ac=new WeakMap,ic={},vh=0,lk=function(e){return e&&(e.host||lk(e.parentNode))},OD=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=lk(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},ID=function(e,t,r,n){var s=OD(t,Array.isArray(e)?e:[e]);ic[r]||(ic[r]=new WeakMap);var a=ic[r],o=[],l=new Set,c=new Set(s),u=function(h){!h||l.has(h)||(l.add(h),u(h.parentNode))};s.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(f){if(l.has(f))d(f);else try{var p=f.getAttribute(n),b=p!==null&&p!=="false",g=(pa.get(f)||0)+1,w=(a.get(f)||0)+1;pa.set(f,g),a.set(f,w),o.push(f),g===1&&b&&ac.set(f,!0),w===1&&f.setAttribute(r,"true"),b||f.setAttribute(n,"true")}catch(y){console.error("aria-hidden: cannot operate on ",f,y)}})};return d(t),l.clear(),vh++,function(){o.forEach(function(h){var f=pa.get(h)-1,p=a.get(h)-1;pa.set(h,f),a.set(h,p),f||(ac.has(h)||h.removeAttribute(n),ac.delete(h)),p||h.removeAttribute(r)}),vh--,vh||(pa=new WeakMap,pa=new WeakMap,ac=new WeakMap,ic={})}},ck=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=PD(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),ID(n,s,r,"aria-hidden")):function(){return null}},ud="Dialog",[uk,dk]=Fr(ud),[DD,wr]=uk(ud),hk=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:a,modal:o=!0}=e,l=m.useRef(null),c=m.useRef(null),[u,d]=ul({prop:n,defaultProp:s??!1,onChange:a,caller:ud});return i.jsx(DD,{scope:t,triggerRef:l,contentRef:c,contentId:Is(),titleId:Is(),descriptionId:Is(),open:u,onOpenChange:d,onOpenToggle:m.useCallback(()=>d(h=>!h),[d]),modal:o,children:r})};hk.displayName=ud;var fk="DialogTrigger",pk=m.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=wr(fk,r),a=$e(t,s.triggerRef);return i.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Dm(s.open),...n,ref:a,onClick:X(e.onClick,s.onOpenToggle)})});pk.displayName=fk;var Om="DialogPortal",[MD,mk]=uk(Om,{forceMount:void 0}),gk=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,a=wr(Om,t);return i.jsx(MD,{scope:t,forceMount:r,children:m.Children.map(n,o=>i.jsx(br,{present:r||a.open,children:i.jsx(Vu,{asChild:!0,container:s,children:o})}))})};gk.displayName=Om;var fu="DialogOverlay",yk=m.forwardRef((e,t)=>{const r=mk(fu,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=wr(fu,e.__scopeDialog);return a.modal?i.jsx(br,{present:n||a.open,children:i.jsx($D,{...s,ref:t})}):null});yk.displayName=fu;var LD=hi("DialogOverlay.RemoveScroll"),$D=m.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=wr(fu,r);return i.jsx(Pm,{as:LD,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(xe.div,{"data-state":Dm(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),Bs="DialogContent",vk=m.forwardRef((e,t)=>{const r=mk(Bs,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,a=wr(Bs,e.__scopeDialog);return i.jsx(br,{present:n||a.open,children:a.modal?i.jsx(zD,{...s,ref:t}):i.jsx(UD,{...s,ref:t})})});vk.displayName=Bs;var zD=m.forwardRef((e,t)=>{const r=wr(Bs,e.__scopeDialog),n=m.useRef(null),s=$e(t,r.contentRef,n);return m.useEffect(()=>{const a=n.current;if(a)return ck(a)},[]),i.jsx(xk,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:X(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:X(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:X(e.onFocusOutside,a=>a.preventDefault())})}),UD=m.forwardRef((e,t)=>{const r=wr(Bs,e.__scopeDialog),n=m.useRef(!1),s=m.useRef(!1);return i.jsx(xk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((u=r.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),xk=m.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=e,l=wr(Bs,r),c=m.useRef(null),u=$e(t,c);return ek(),i.jsxs(i.Fragment,{children:[i.jsx(Am,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(cl,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Dm(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(BD,{titleId:l.titleId}),i.jsx(VD,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Im="DialogTitle",bk=m.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=wr(Im,r);return i.jsx(xe.h2,{id:s.titleId,...n,ref:t})});bk.displayName=Im;var wk="DialogDescription",_k=m.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=wr(wk,r);return i.jsx(xe.p,{id:s.descriptionId,...n,ref:t})});_k.displayName=wk;var kk="DialogClose",jk=m.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=wr(kk,r);return i.jsx(xe.button,{type:"button",...n,ref:t,onClick:X(e.onClick,()=>s.onOpenChange(!1))})});jk.displayName=kk;function Dm(e){return e?"open":"closed"}var Sk="DialogTitleWarning",[FD,Nk]=e2(Sk,{contentName:Bs,titleName:Im,docsSlug:"dialog"}),BD=({titleId:e})=>{const t=Nk(Sk),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},HD="DialogDescriptionWarning",VD=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Nk(HD).contentName}}.`;return m.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Mm=hk,Ek=pk,Lm=gk,ml=yk,gl=vk,yl=bk,vl=_k,dd=jk;const KD=Mm,qD=Lm,Ck=m.forwardRef(({className:e,...t},r)=>i.jsx(ml,{className:de("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:r}));Ck.displayName=ml.displayName;const WD=Wu("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Tk=m.forwardRef(({side:e="right",className:t,children:r,...n},s)=>i.jsxs(qD,{children:[i.jsx(Ck,{}),i.jsxs(gl,{ref:s,className:de(WD({side:e}),t),...n,children:[r,i.jsxs(dd,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(ds,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Tk.displayName=gl.displayName;const Rk=({className:e,...t})=>i.jsx("div",{className:de("flex flex-col space-y-2 text-center sm:text-left",e),...t});Rk.displayName="SheetHeader";const Ak=m.forwardRef(({className:e,...t},r)=>i.jsx(yl,{ref:r,className:de("text-lg font-semibold text-foreground",e),...t}));Ak.displayName=yl.displayName;const GD=m.forwardRef(({className:e,...t},r)=>i.jsx(vl,{ref:r,className:de("text-sm text-muted-foreground",e),...t}));GD.displayName=vl.displayName;const ye=(e,t="TRY")=>new Intl.NumberFormat("tr-TR",{style:"currency",currency:t,maximumFractionDigits:0}).format(e),YD=()=>{const{items:e,open:t,setOpen:r,updateQuantity:n,removeItem:s,total:a}=pl(),o=xr(),l=()=>{r(!1),o("/odeme")};return i.jsx(KD,{open:t,onOpenChange:r,children:i.jsxs(Tk,{className:"w-full sm:max-w-md flex flex-col",children:[i.jsx(Rk,{children:i.jsxs(Ak,{className:"display-text font-extralight text-xl",children:["Sepetiniz (",e.length,")"]})}),e.length===0?i.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-center space-y-4",children:[i.jsx("p",{className:"editorial-serif text-lg text-foreground/60",children:"Sepetiniz boş"}),i.jsx("button",{onClick:()=>r(!1),className:"btn-outline-ink",children:"Alışverişe Devam Et"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex-1 overflow-y-auto py-4 space-y-4",children:e.map(c=>i.jsxs("div",{className:"flex gap-4 border-b border-border/50 pb-4",children:[i.jsx("div",{className:"w-20 h-24 bg-secondary flex-shrink-0 overflow-hidden",children:c.image&&i.jsx("img",{src:c.image,alt:c.name,className:"w-full h-full object-cover"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"text-sm font-light truncate",children:c.name}),i.jsx("p",{className:"text-sm text-foreground/70 mt-1",children:ye(c.price)}),i.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[i.jsx("button",{onClick:()=>n(c.product_id,c.quantity-1),className:"w-7 h-7 border border-border flex items-center justify-center hover:bg-secondary",children:i.jsx(Lw,{className:"h-3 w-3"})}),i.jsx("span",{className:"text-sm w-8 text-center",children:c.quantity}),i.jsx("button",{onClick:()=>n(c.product_id,c.quantity+1),className:"w-7 h-7 border border-border flex items-center justify-center hover:bg-secondary",children:i.jsx(qs,{className:"h-3 w-3"})})]})]}),i.jsx("button",{onClick:()=>s(c.product_id),"aria-label":"Kaldır",className:"text-foreground/50 hover:text-foreground self-start",children:i.jsx(ds,{className:"h-4 w-4"})})]},c.product_id))}),i.jsxs("div",{className:"border-t border-border pt-4 space-y-4",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{className:"uppercase tracking-[0.2em] text-[11px]",children:"Ara Toplam"}),i.jsx("span",{children:ye(a)})]}),i.jsx("button",{onClick:l,className:"btn-ink w-full",children:"Ödemeye Geç"})]})]})]})})},JD=()=>{const{pathname:e}=Ur();return m.useEffect(()=>{window.scrollTo({top:0,left:0})},[e]),null},ZD=({children:e})=>{const{user:t,isAdmin:r,loading:n}=Hr();return n?i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:i.jsx("p",{className:"text-foreground/60",children:"Yükleniyor..."})}):t?r?i.jsx(i.Fragment,{children:e}):i.jsx(Ke,{to:"/",replace:!0}):i.jsx(Ke,{to:"/giris",replace:!0})},mi="/assets/product-serum-BkflX0uj.jpg",QD=({open:e,onClose:t})=>{const[r,n]=m.useState(""),[s,a]=m.useState([]),[o,l]=m.useState(!1);return m.useEffect(()=>{e||(n(""),a([]))},[e]),m.useEffect(()=>{if(!r.trim()||r.length<2){a([]);return}const c=setTimeout(async()=>{l(!0);const{data:u}=await U.from("products").select("id, slug, name, price, images, short_description").eq("active",!0).or(`name.ilike.%${r}%,short_description.ilike.%${r}%,description.ilike.%${r}%`).limit(8);a(u??[]),l(!1)},250);return()=>clearTimeout(c)},[r]),m.useEffect(()=>{const c=u=>{u.key==="Escape"&&t()};return e&&document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),e?i.jsx("div",{className:"fixed inset-0 z-[60] bg-background/95 backdrop-blur-sm",children:i.jsxs("div",{className:"container-editorial pt-12 pb-20",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Ara"}),i.jsx("button",{onClick:t,"aria-label":"Kapat",className:"hover:opacity-70",children:i.jsx(ds,{className:"h-5 w-5"})})]}),i.jsxs("div",{className:"flex items-center gap-4 border-b border-foreground/30 pb-3",children:[i.jsx(gm,{className:"h-5 w-5 text-foreground/60"}),i.jsx("input",{autoFocus:!0,value:r,onChange:c=>n(c.target.value),placeholder:"ürün ara...",className:"flex-1 bg-transparent text-2xl md:text-3xl font-extralight focus:outline-none placeholder:text-foreground/30"})]}),i.jsxs("div",{className:"mt-10",children:[r.length>0&&r.length<2&&i.jsx("p",{className:"text-foreground/50 text-sm",children:"En az 2 karakter girin"}),o&&i.jsx("p",{className:"text-foreground/50 text-sm",children:"Aranıyor..."}),!o&&r.length>=2&&s.length===0&&i.jsx("p",{className:"text-foreground/50 text-sm",children:"Sonuç bulunamadı"}),s.length>0&&i.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-6",children:s.map(c=>{var u;return i.jsxs(ue,{to:`/urunler/${c.slug}`,onClick:t,className:"block group",children:[i.jsx("div",{className:"aspect-[4/5] bg-secondary overflow-hidden mb-3",children:i.jsx("img",{src:((u=c.images)==null?void 0:u[0])??mi,alt:c.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-700"})}),i.jsx("h3",{className:"text-sm font-light",children:c.name}),i.jsx("p",{className:"text-xs text-foreground/70 mt-1",children:ye(Number(c.price))})]},c.id)})})]})]})}):null};var XD=m.createContext(void 0);function $m(e){const t=m.useContext(XD);return e||t||"ltr"}var xh="rovingFocusGroup.onEntryFocus",e4={bubbles:!1,cancelable:!0},xl="RovingFocusGroup",[ep,Pk,t4]=um(xl),[r4,hd]=Fr(xl,[t4]),[n4,s4]=r4(xl),Ok=m.forwardRef((e,t)=>i.jsx(ep.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(ep.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(a4,{...e,ref:t})})}));Ok.displayName=xl;var a4=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,f=m.useRef(null),p=$e(t,f),b=$m(a),[g,w]=ul({prop:o,defaultProp:l??null,onChange:c,caller:xl}),[y,v]=m.useState(!1),x=Mt(u),_=Pk(r),j=m.useRef(!1),[S,C]=m.useState(0);return m.useEffect(()=>{const k=f.current;if(k)return k.addEventListener(xh,x),()=>k.removeEventListener(xh,x)},[x]),i.jsx(n4,{scope:r,orientation:n,dir:b,loop:s,currentTabStopId:g,onItemFocus:m.useCallback(k=>w(k),[w]),onItemShiftTab:m.useCallback(()=>v(!0),[]),onFocusableItemAdd:m.useCallback(()=>C(k=>k+1),[]),onFocusableItemRemove:m.useCallback(()=>C(k=>k-1),[]),children:i.jsx(xe.div,{tabIndex:y||S===0?-1:0,"data-orientation":n,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:X(e.onMouseDown,()=>{j.current=!0}),onFocus:X(e.onFocus,k=>{const A=!j.current;if(k.target===k.currentTarget&&A&&!y){const P=new CustomEvent(xh,e4);if(k.currentTarget.dispatchEvent(P),!P.defaultPrevented){const $=_().filter(I=>I.focusable),R=$.find(I=>I.active),H=$.find(I=>I.id===g),M=[R,H,...$].filter(Boolean).map(I=>I.ref.current);Mk(M,d)}}j.current=!1}),onBlur:X(e.onBlur,()=>v(!1))})})}),Ik="RovingFocusGroupItem",Dk=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:a,children:o,...l}=e,c=Is(),u=a||c,d=s4(Ik,r),h=d.currentTabStopId===u,f=Pk(r),{onFocusableItemAdd:p,onFocusableItemRemove:b,currentTabStopId:g}=d;return m.useEffect(()=>{if(n)return p(),()=>b()},[n,p,b]),i.jsx(ep.ItemSlot,{scope:r,id:u,focusable:n,active:s,children:i.jsx(xe.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:X(e.onMouseDown,w=>{n?d.onItemFocus(u):w.preventDefault()}),onFocus:X(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:X(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){d.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const y=l4(w,d.orientation,d.dir);if(y!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let x=f().filter(_=>_.focusable).map(_=>_.ref.current);if(y==="last")x.reverse();else if(y==="prev"||y==="next"){y==="prev"&&x.reverse();const _=x.indexOf(w.currentTarget);x=d.loop?c4(x,_+1):x.slice(_+1)}setTimeout(()=>Mk(x))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:g!=null}):o})})});Dk.displayName=Ik;var i4={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o4(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function l4(e,t,r){const n=o4(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return i4[n]}function Mk(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function c4(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Lk=Ok,$k=Dk,tp=["Enter"," "],u4=["ArrowDown","PageUp","Home"],zk=["ArrowUp","PageDown","End"],d4=[...u4,...zk],h4={ltr:[...tp,"ArrowRight"],rtl:[...tp,"ArrowLeft"]},f4={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bl="Menu",[Jo,p4,m4]=um(bl),[Gs,Uk]=Fr(bl,[m4,rd,hd]),fd=rd(),Fk=hd(),[g4,Ys]=Gs(bl),[y4,wl]=Gs(bl),Bk=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:a,modal:o=!0}=e,l=fd(t),[c,u]=m.useState(null),d=m.useRef(!1),h=Mt(a),f=$m(s);return m.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),i.jsx(AP,{...l,children:i.jsx(g4,{scope:t,open:r,onOpenChange:h,content:c,onContentChange:u,children:i.jsx(y4,{scope:t,onClose:m.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:f,modal:o,children:n})})})};Bk.displayName=bl;var v4="MenuAnchor",zm=m.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=fd(r);return i.jsx(v_,{...s,...n,ref:t})});zm.displayName=v4;var Um="MenuPortal",[x4,Hk]=Gs(Um,{forceMount:void 0}),Vk=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,a=Ys(Um,t);return i.jsx(x4,{scope:t,forceMount:r,children:i.jsx(br,{present:r||a.open,children:i.jsx(Vu,{asChild:!0,container:s,children:n})})})};Vk.displayName=Um;var Yt="MenuContent",[b4,Fm]=Gs(Yt),Kk=m.forwardRef((e,t)=>{const r=Hk(Yt,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,a=Ys(Yt,e.__scopeMenu),o=wl(Yt,e.__scopeMenu);return i.jsx(Jo.Provider,{scope:e.__scopeMenu,children:i.jsx(br,{present:n||a.open,children:i.jsx(Jo.Slot,{scope:e.__scopeMenu,children:o.modal?i.jsx(w4,{...s,ref:t}):i.jsx(_4,{...s,ref:t})})})})}),w4=m.forwardRef((e,t)=>{const r=Ys(Yt,e.__scopeMenu),n=m.useRef(null),s=$e(t,n);return m.useEffect(()=>{const a=n.current;if(a)return ck(a)},[]),i.jsx(Bm,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:X(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),_4=m.forwardRef((e,t)=>{const r=Ys(Yt,e.__scopeMenu);return i.jsx(Bm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),k4=hi("MenuContent.ScrollLock"),Bm=m.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,disableOutsideScroll:b,...g}=e,w=Ys(Yt,r),y=wl(Yt,r),v=fd(r),x=Fk(r),_=p4(r),[j,S]=m.useState(null),C=m.useRef(null),k=$e(t,C,w.onContentChange),A=m.useRef(0),P=m.useRef(""),$=m.useRef(0),R=m.useRef(null),H=m.useRef("right"),N=m.useRef(0),M=b?Pm:m.Fragment,I=b?{as:k4,allowPinchZoom:!0}:void 0,z=T=>{var fe,Vr;const L=P.current+T,q=_().filter(Qe=>!Qe.disabled),K=document.activeElement,ee=(fe=q.find(Qe=>Qe.ref.current===K))==null?void 0:fe.textValue,le=q.map(Qe=>Qe.textValue),Oe=D4(le,L,ee),ze=(Vr=q.find(Qe=>Qe.textValue===Oe))==null?void 0:Vr.ref.current;(function Qe(_r){P.current=_r,window.clearTimeout(A.current),_r!==""&&(A.current=window.setTimeout(()=>Qe(""),1e3))})(L),ze&&setTimeout(()=>ze.focus())};m.useEffect(()=>()=>window.clearTimeout(A.current),[]),ek();const E=m.useCallback(T=>{var q,K;return H.current===((q=R.current)==null?void 0:q.side)&&L4(T,(K=R.current)==null?void 0:K.area)},[]);return i.jsx(b4,{scope:r,searchRef:P,onItemEnter:m.useCallback(T=>{E(T)&&T.preventDefault()},[E]),onItemLeave:m.useCallback(T=>{var L;E(T)||((L=C.current)==null||L.focus(),S(null))},[E]),onTriggerLeave:m.useCallback(T=>{E(T)&&T.preventDefault()},[E]),pointerGraceTimerRef:$,onPointerGraceIntentChange:m.useCallback(T=>{R.current=T},[]),children:i.jsx(M,{...I,children:i.jsx(Am,{asChild:!0,trapped:s,onMountAutoFocus:X(a,T=>{var L;T.preventDefault(),(L=C.current)==null||L.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:i.jsx(cl,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:f,onDismiss:p,children:i.jsx(Lk,{asChild:!0,...x,dir:y.dir,orientation:"vertical",loop:n,currentTabStopId:j,onCurrentTabStopIdChange:S,onEntryFocus:X(c,T=>{y.isUsingKeyboardRef.current||T.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(x_,{role:"menu","aria-orientation":"vertical","data-state":o1(w.open),"data-radix-menu-content":"",dir:y.dir,...v,...g,ref:k,style:{outline:"none",...g.style},onKeyDown:X(g.onKeyDown,T=>{const q=T.target.closest("[data-radix-menu-content]")===T.currentTarget,K=T.ctrlKey||T.altKey||T.metaKey,ee=T.key.length===1;q&&(T.key==="Tab"&&T.preventDefault(),!K&&ee&&z(T.key));const le=C.current;if(T.target!==le||!d4.includes(T.key))return;T.preventDefault();const ze=_().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);zk.includes(T.key)&&ze.reverse(),O4(ze)}),onBlur:X(e.onBlur,T=>{T.currentTarget.contains(T.target)||(window.clearTimeout(A.current),P.current="")}),onPointerMove:X(e.onPointerMove,Zo(T=>{const L=T.target,q=N.current!==T.clientX;if(T.currentTarget.contains(L)&&q){const K=T.clientX>N.current?"right":"left";H.current=K,N.current=T.clientX}}))})})})})})})});Kk.displayName=Yt;var j4="MenuGroup",Hm=m.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return i.jsx(xe.div,{role:"group",...n,ref:t})});Hm.displayName=j4;var S4="MenuLabel",qk=m.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return i.jsx(xe.div,{...n,ref:t})});qk.displayName=S4;var pu="MenuItem",Bv="menu.itemSelect",pd=m.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,a=m.useRef(null),o=wl(pu,e.__scopeMenu),l=Fm(pu,e.__scopeMenu),c=$e(t,a),u=m.useRef(!1),d=()=>{const h=a.current;if(!r&&h){const f=new CustomEvent(Bv,{bubbles:!0,cancelable:!0});h.addEventListener(Bv,p=>n==null?void 0:n(p),{once:!0}),dm(h,f),f.defaultPrevented?u.current=!1:o.onClose()}};return i.jsx(Wk,{...s,ref:c,disabled:r,onClick:X(e.onClick,d),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),u.current=!0},onPointerUp:X(e.onPointerUp,h=>{var f;u.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:X(e.onKeyDown,h=>{const f=l.searchRef.current!=="";r||f&&h.key===" "||tp.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});pd.displayName=pu;var Wk=m.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...a}=e,o=Fm(pu,r),l=Fk(r),c=m.useRef(null),u=$e(t,c),[d,h]=m.useState(!1),[f,p]=m.useState("");return m.useEffect(()=>{const b=c.current;b&&p((b.textContent??"").trim())},[a.children]),i.jsx(Jo.ItemSlot,{scope:r,disabled:n,textValue:s??f,children:i.jsx($k,{asChild:!0,...l,focusable:!n,children:i.jsx(xe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...a,ref:u,onPointerMove:X(e.onPointerMove,Zo(b=>{n?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:X(e.onPointerLeave,Zo(b=>o.onItemLeave(b))),onFocus:X(e.onFocus,()=>h(!0)),onBlur:X(e.onBlur,()=>h(!1))})})})}),N4="MenuCheckboxItem",Gk=m.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return i.jsx(Xk,{scope:e.__scopeMenu,checked:r,children:i.jsx(pd,{role:"menuitemcheckbox","aria-checked":mu(r)?"mixed":r,...s,ref:t,"data-state":Km(r),onSelect:X(s.onSelect,()=>n==null?void 0:n(mu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});Gk.displayName=N4;var Yk="MenuRadioGroup",[E4,C4]=Gs(Yk,{value:void 0,onValueChange:()=>{}}),Jk=m.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,a=Mt(n);return i.jsx(E4,{scope:e.__scopeMenu,value:r,onValueChange:a,children:i.jsx(Hm,{...s,ref:t})})});Jk.displayName=Yk;var Zk="MenuRadioItem",Qk=m.forwardRef((e,t)=>{const{value:r,...n}=e,s=C4(Zk,e.__scopeMenu),a=r===s.value;return i.jsx(Xk,{scope:e.__scopeMenu,checked:a,children:i.jsx(pd,{role:"menuitemradio","aria-checked":a,...n,ref:t,"data-state":Km(a),onSelect:X(n.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,r)},{checkForDefaultPrevented:!1})})})});Qk.displayName=Zk;var Vm="MenuItemIndicator",[Xk,T4]=Gs(Vm,{checked:!1}),e1=m.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,a=T4(Vm,r);return i.jsx(br,{present:n||mu(a.checked)||a.checked===!0,children:i.jsx(xe.span,{...s,ref:t,"data-state":Km(a.checked)})})});e1.displayName=Vm;var R4="MenuSeparator",t1=m.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return i.jsx(xe.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});t1.displayName=R4;var A4="MenuArrow",r1=m.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=fd(r);return i.jsx(b_,{...s,...n,ref:t})});r1.displayName=A4;var P4="MenuSub",[I$,n1]=Gs(P4),eo="MenuSubTrigger",s1=m.forwardRef((e,t)=>{const r=Ys(eo,e.__scopeMenu),n=wl(eo,e.__scopeMenu),s=n1(eo,e.__scopeMenu),a=Fm(eo,e.__scopeMenu),o=m.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=a,u={__scopeMenu:e.__scopeMenu},d=m.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return m.useEffect(()=>d,[d]),m.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),i.jsx(zm,{asChild:!0,...u,children:i.jsx(Wk,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":o1(r.open),...e,ref:Hu(t,s.onTriggerChange),onClick:h=>{var f;(f=e.onClick)==null||f.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:X(e.onPointerMove,Zo(h=>{a.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),d()},100))})),onPointerLeave:X(e.onPointerLeave,Zo(h=>{var p,b;d();const f=(p=r.content)==null?void 0:p.getBoundingClientRect();if(f){const g=(b=r.content)==null?void 0:b.dataset.side,w=g==="right",y=w?-5:5,v=f[w?"left":"right"],x=f[w?"right":"left"];a.onPointerGraceIntentChange({area:[{x:h.clientX+y,y:h.clientY},{x:v,y:f.top},{x,y:f.top},{x,y:f.bottom},{x:v,y:f.bottom}],side:g}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(h),h.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:X(e.onKeyDown,h=>{var p;const f=a.searchRef.current!=="";e.disabled||f&&h.key===" "||h4[n.dir].includes(h.key)&&(r.onOpenChange(!0),(p=r.content)==null||p.focus(),h.preventDefault())})})})});s1.displayName=eo;var a1="MenuSubContent",i1=m.forwardRef((e,t)=>{const r=Hk(Yt,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,a=Ys(Yt,e.__scopeMenu),o=wl(Yt,e.__scopeMenu),l=n1(a1,e.__scopeMenu),c=m.useRef(null),u=$e(t,c);return i.jsx(Jo.Provider,{scope:e.__scopeMenu,children:i.jsx(br,{present:n||a.open,children:i.jsx(Jo.Slot,{scope:e.__scopeMenu,children:i.jsx(Bm,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:X(e.onFocusOutside,d=>{d.target!==l.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:X(e.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:X(e.onKeyDown,d=>{var p;const h=d.currentTarget.contains(d.target),f=f4[o.dir].includes(d.key);h&&f&&(a.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});i1.displayName=a1;function o1(e){return e?"open":"closed"}function mu(e){return e==="indeterminate"}function Km(e){return mu(e)?"indeterminate":e?"checked":"unchecked"}function O4(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function I4(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function D4(e,t,r){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let o=I4(e,Math.max(a,0));s.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function M4(e,t){const{x:r,y:n}=e;let s=!1;for(let a=0,o=t.length-1;a<t.length;o=a++){const l=t[a],c=t[o],u=l.x,d=l.y,h=c.x,f=c.y;d>n!=f>n&&r<(h-u)*(n-d)/(f-d)+u&&(s=!s)}return s}function L4(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return M4(r,t)}function Zo(e){return t=>t.pointerType==="mouse"?e(t):void 0}var $4=Bk,z4=zm,U4=Vk,F4=Kk,B4=Hm,H4=qk,V4=pd,K4=Gk,q4=Jk,W4=Qk,G4=e1,Y4=t1,J4=r1,Z4=s1,Q4=i1,md="DropdownMenu",[X4,D$]=Fr(md,[Uk]),bt=Uk(),[eM,l1]=X4(md),c1=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=e,c=bt(t),u=m.useRef(null),[d,h]=ul({prop:s,defaultProp:a??!1,onChange:o,caller:md});return i.jsx(eM,{scope:t,triggerId:Is(),triggerRef:u,contentId:Is(),open:d,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(f=>!f),[h]),modal:l,children:i.jsx($4,{...c,open:d,onOpenChange:h,dir:n,modal:l,children:r})})};c1.displayName=md;var u1="DropdownMenuTrigger",d1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,a=l1(u1,r),o=bt(r);return i.jsx(z4,{asChild:!0,...o,children:i.jsx(xe.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:Hu(t,a.triggerRef),onPointerDown:X(e.onPointerDown,l=>{!n&&l.button===0&&l.ctrlKey===!1&&(a.onOpenToggle(),a.open||l.preventDefault())}),onKeyDown:X(e.onKeyDown,l=>{n||(["Enter"," "].includes(l.key)&&a.onOpenToggle(),l.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});d1.displayName=u1;var tM="DropdownMenuPortal",h1=e=>{const{__scopeDropdownMenu:t,...r}=e,n=bt(t);return i.jsx(U4,{...n,...r})};h1.displayName=tM;var f1="DropdownMenuContent",p1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=l1(f1,r),a=bt(r),o=m.useRef(!1);return i.jsx(F4,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...n,ref:t,onCloseAutoFocus:X(e.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:X(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});p1.displayName=f1;var rM="DropdownMenuGroup",nM=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(B4,{...s,...n,ref:t})});nM.displayName=rM;var sM="DropdownMenuLabel",m1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(H4,{...s,...n,ref:t})});m1.displayName=sM;var aM="DropdownMenuItem",g1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(V4,{...s,...n,ref:t})});g1.displayName=aM;var iM="DropdownMenuCheckboxItem",y1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(K4,{...s,...n,ref:t})});y1.displayName=iM;var oM="DropdownMenuRadioGroup",lM=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(q4,{...s,...n,ref:t})});lM.displayName=oM;var cM="DropdownMenuRadioItem",v1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(W4,{...s,...n,ref:t})});v1.displayName=cM;var uM="DropdownMenuItemIndicator",x1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(G4,{...s,...n,ref:t})});x1.displayName=uM;var dM="DropdownMenuSeparator",b1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(Y4,{...s,...n,ref:t})});b1.displayName=dM;var hM="DropdownMenuArrow",fM=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(J4,{...s,...n,ref:t})});fM.displayName=hM;var pM="DropdownMenuSubTrigger",w1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(Z4,{...s,...n,ref:t})});w1.displayName=pM;var mM="DropdownMenuSubContent",_1=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=bt(r);return i.jsx(Q4,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});_1.displayName=mM;var gM=c1,yM=d1,vM=h1,k1=p1,j1=m1,S1=g1,N1=y1,E1=v1,C1=x1,T1=b1,R1=w1,A1=_1;const xM=gM,bM=yM,wM=m.forwardRef(({className:e,inset:t,children:r,...n},s)=>i.jsxs(R1,{ref:s,className:de("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...n,children:[r,i.jsx(eR,{className:"ml-auto h-4 w-4"})]}));wM.displayName=R1.displayName;const _M=m.forwardRef(({className:e,...t},r)=>i.jsx(A1,{ref:r,className:de("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));_M.displayName=A1.displayName;const P1=m.forwardRef(({className:e,sideOffset:t=4,...r},n)=>i.jsx(vM,{children:i.jsx(k1,{ref:n,sideOffset:t,className:de("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));P1.displayName=k1.displayName;const to=m.forwardRef(({className:e,inset:t,...r},n)=>i.jsx(S1,{ref:n,className:de("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...r}));to.displayName=S1.displayName;const kM=m.forwardRef(({className:e,children:t,checked:r,...n},s)=>i.jsxs(N1,{ref:s,className:de("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:r,...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(C1,{children:i.jsx(Gu,{className:"h-4 w-4"})})}),t]}));kM.displayName=N1.displayName;const jM=m.forwardRef(({className:e,children:t,...r},n)=>i.jsxs(E1,{ref:n,className:de("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...r,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(C1,{children:i.jsx(rR,{className:"h-2 w-2 fill-current"})})}),t]}));jM.displayName=E1.displayName;const SM=m.forwardRef(({className:e,inset:t,...r},n)=>i.jsx(j1,{ref:n,className:de("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));SM.displayName=j1.displayName;const O1=m.forwardRef(({className:e,...t},r)=>i.jsx(T1,{ref:r,className:de("-mx-1 my-1 h-px bg-muted",e),...t}));O1.displayName=T1.displayName;const Hv=[{label:"Ürünler",href:"/urunler"},{label:"Hikayemiz",href:"/hakkimizda"},{label:"İletişim",href:"/iletisim"}],Ge=()=>{const[e,t]=m.useState(!1),[r,n]=m.useState(!1),{count:s,setOpen:a}=pl(),{user:o,isAdmin:l,signOut:c}=Hr(),{count:u}=Rm();return i.jsxs(i.Fragment,{children:[i.jsxs("header",{className:"sticky top-0 z-40 border-b border-border/60 bg-background/80 backdrop-blur-md",children:[i.jsxs("div",{className:"container-editorial flex h-20 items-center justify-between gap-6",children:[i.jsx("button",{type:"button","aria-label":"Menüyü aç",onClick:()=>t(d=>!d),className:"md:hidden",children:i.jsx(gR,{className:"h-5 w-5"})}),i.jsx(ue,{to:"/",className:"flex items-center","aria-label":"Derma Royal Shop ana sayfa",children:i.jsxs("div",{className:"brand-frame",children:[i.jsx("div",{className:"display-text text-base md:text-lg font-light text-foreground",children:"Derma Royal"}),i.jsx("div",{className:"absolute -bottom-3 right-2 text-[10px] tracking-[0.2em] text-foreground/70",children:"shop"})]})}),i.jsxs("nav",{className:"hidden md:flex items-center gap-10",children:[Hv.map(d=>i.jsx(ue,{to:d.href,className:"text-[11px] uppercase tracking-[0.22em] text-foreground/75 transition-colors hover:text-foreground",children:d.label},d.href)),l&&i.jsx(ue,{to:"/admin",className:"text-[11px] uppercase tracking-[0.22em] text-foreground/75 hover:text-foreground",children:"Admin"})]}),i.jsxs("div",{className:"flex items-center gap-4 md:gap-5",children:[i.jsx("button",{onClick:()=>n(!0),"aria-label":"Ara",className:"hover:opacity-70 transition-opacity",children:i.jsx(gm,{className:"h-[18px] w-[18px]"})}),o&&i.jsxs(ue,{to:"/favorilerim","aria-label":"Favoriler",className:"relative hidden sm:block hover:opacity-70 transition-opacity",children:[i.jsx(zo,{className:"h-[18px] w-[18px]",strokeWidth:1.25}),u>0&&i.jsx("span",{className:"absolute -right-2 -top-2 flex h-4 w-4 items-center justify-center rounded-full bg-foreground text-[9px] text-background",children:u})]}),o?i.jsxs(xM,{children:[i.jsx(bM,{asChild:!0,children:i.jsx("button",{"aria-label":"Hesabım",className:"hidden sm:block hover:opacity-70 transition-opacity",children:i.jsx(If,{className:"h-[18px] w-[18px]"})})}),i.jsxs(P1,{align:"end",className:"w-56",children:[i.jsx("div",{className:"px-2 py-1.5 text-xs text-foreground/70 truncate",children:o.email}),i.jsx(O1,{}),i.jsx(to,{asChild:!0,children:i.jsxs(ue,{to:"/hesabim",className:"cursor-pointer",children:[i.jsx(tR,{className:"mr-2 h-4 w-4"}),"Profilim"]})}),i.jsx(to,{asChild:!0,children:i.jsxs(ue,{to:"/favorilerim",className:"cursor-pointer",children:[i.jsx(zo,{className:"mr-2 h-4 w-4"}),"Favorilerim"]})}),l&&i.jsx(to,{asChild:!0,children:i.jsxs(ue,{to:"/admin",className:"cursor-pointer",children:[i.jsx($w,{className:"mr-2 h-4 w-4"}),"Admin Paneli"]})}),i.jsxs(to,{onClick:()=>c(),className:"cursor-pointer",children:[i.jsx(hR,{className:"mr-2 h-4 w-4"}),"Çıkış Yap"]})]})]}):i.jsx(ue,{to:"/giris","aria-label":"Giriş yap",className:"hidden sm:block hover:opacity-70 transition-opacity",children:i.jsx(If,{className:"h-[18px] w-[18px]"})}),i.jsxs("button",{onClick:()=>a(!0),"aria-label":"Sepetim",className:"relative hover:opacity-70 transition-opacity",children:[i.jsx(po,{className:"h-[18px] w-[18px]"}),i.jsx("span",{className:"absolute -right-2 -top-2 flex h-4 w-4 items-center justify-center rounded-full bg-foreground text-[9px] text-background",children:s})]})]})]}),e&&i.jsx("nav",{className:"md:hidden border-t border-border/60 bg-background",children:i.jsxs("div",{className:"container-editorial flex flex-col py-6 gap-5",children:[Hv.map(d=>i.jsx(ue,{to:d.href,onClick:()=>t(!1),className:"text-xs uppercase tracking-[0.22em] text-foreground/80",children:d.label},d.href)),l&&i.jsx(ue,{to:"/admin",onClick:()=>t(!1),className:"text-xs uppercase tracking-[0.22em] text-foreground/80",children:"Admin"}),o?i.jsxs(i.Fragment,{children:[i.jsx(ue,{to:"/hesabim",onClick:()=>t(!1),className:"text-xs uppercase tracking-[0.22em] text-foreground/80",children:"Profilim"}),i.jsx(ue,{to:"/favorilerim",onClick:()=>t(!1),className:"text-xs uppercase tracking-[0.22em] text-foreground/80",children:"Favorilerim"})]}):i.jsx(ue,{to:"/giris",onClick:()=>t(!1),className:"text-xs uppercase tracking-[0.22em] text-foreground/80",children:"Giriş Yap"})]})})]}),i.jsx(QD,{open:r,onClose:()=>n(!1)})]})};var _e;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const a={};for(const o of s)a[o]=o;return a},e.getValidEnumValues=s=>{const a=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of a)o[l]=s[l];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(a){return s[a]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},e.find=(s,a)=>{for(const o of s)if(a(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(_e||(_e={}));var Vv;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Vv||(Vv={}));const Z=_e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rn=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.unknown}},V=_e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class dn extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(a){return a.message},n={_errors:[]},s=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let l=n,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(r(o))):l[u]=l[u]||{_errors:[]},l=l[u],c++}}};return s(this),n}static assert(t){if(!(t instanceof dn))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(t(s))}else n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}dn.create=e=>new dn(e);const rp=(e,t)=>{let r;switch(e.code){case V.invalid_type:e.received===Z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,_e.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:r=`Unrecognized key(s) in object: ${_e.joinValues(e.keys,", ")}`;break;case V.invalid_union:r="Invalid input";break;case V.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${_e.joinValues(e.options)}`;break;case V.invalid_enum_value:r=`Invalid enum value. Expected ${_e.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:r="Invalid function arguments";break;case V.invalid_return_type:r="Invalid function return type";break;case V.invalid_date:r="Invalid date";break;case V.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:_e.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case V.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case V.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case V.custom:r="Invalid input";break;case V.invalid_intersection_types:r="Intersection results could not be merged";break;case V.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:r="Number must be finite";break;default:r=t.defaultError,_e.assertNever(e)}return{message:r}};let NM=rp;function EM(){return NM}const CM=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,a=[...r,...s.path||[]],o={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let l="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...s,path:a,message:l}};function G(e,t){const r=EM(),n=CM({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===rp?void 0:rp].filter(s=>!!s)});e.common.issues.push(n)}class Lt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return se;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const a=await s.key,o=await s.value;n.push({key:a,value:o})}return Lt.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return se;a.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[a.value]=o.value)}return{status:t.value,value:n}}}const se=Object.freeze({status:"aborted"}),ro=e=>({status:"dirty",value:e}),Qt=e=>({status:"valid",value:e}),Kv=e=>e.status==="aborted",qv=e=>e.status==="dirty",gi=e=>e.status==="valid",gu=e=>typeof Promise<"u"&&e instanceof Promise;var Q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Q||(Q={}));class is{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Wv=(e,t)=>{if(gi(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new dn(e.common.issues);return this._error=r,this._error}}};function he(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,l)=>{const{message:c}=e;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??n??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??r??l.defaultError}},description:s}}class be{get description(){return this._def.description}_getType(t){return Rn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Rn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Lt,ctx:{common:t.parent.common,data:t.data,parsedType:Rn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(gu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){const n={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rn(t)},s=this._parseSync({data:t,path:n.path,parent:n});return Wv(n,s)}"~validate"(t){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rn(t)};if(!this["~standard"].async)try{const a=this._parseSync({data:t,path:[],parent:r});return gi(a)?{value:a.value}:{issues:r.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(a=>gi(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Rn(t)},s=this._parse({data:t,path:n.path,parent:n}),a=await(gu(s)?s:Promise.resolve(s));return Wv(n,a)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const o=t(s),l=()=>a.addIssue({code:V.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new xi({schema:this,typeName:ae.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ts.create(this,this._def)}nullable(){return bi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lr.create(this)}promise(){return bu.create(this,this._def)}or(t){return vu.create([this,t],this._def)}and(t){return xu.create(this,t,this._def)}transform(t){return new xi({...he(this._def),schema:this,typeName:ae.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new ip({...he(this._def),innerType:this,defaultValue:r,typeName:ae.ZodDefault})}brand(){return new ZM({typeName:ae.ZodBranded,type:this,...he(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new op({...he(this._def),innerType:this,catchValue:r,typeName:ae.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return qm.create(this,t)}readonly(){return lp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const TM=/^c[^\s-]{8,}$/i,RM=/^[0-9a-z]+$/,AM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,PM=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,OM=/^[a-z0-9_-]{21}$/i,IM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,DM=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,MM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,LM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let bh;const $M=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,UM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,FM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,HM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,I1="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",VM=new RegExp(`^${I1}$`);function D1(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function KM(e){return new RegExp(`^${D1(e)}$`)}function qM(e){let t=`${I1}T${D1(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function WM(e,t){return!!((t==="v4"||!t)&&$M.test(e)||(t==="v6"||!t)&&UM.test(e))}function GM(e,t){if(!IM.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function YM(e,t){return!!((t==="v4"||!t)&&zM.test(e)||(t==="v6"||!t)&&FM.test(e))}class Hn extends be{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){const a=this._getOrReturnCtx(t);return G(a,{code:V.invalid_type,expected:Z.string,received:a.parsedType}),se}const n=new Lt;let s;for(const a of this._def.checks)if(a.kind==="min")t.data.length<a.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:V.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")t.data.length>a.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:V.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=t.data.length>a.value,l=t.data.length<a.value;(o||l)&&(s=this._getOrReturnCtx(t,s),o?G(s,{code:V.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):l&&G(s,{code:V.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")MM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"email",code:V.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")bh||(bh=new RegExp(LM,"u")),bh.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"emoji",code:V.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")PM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"uuid",code:V.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")OM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"nanoid",code:V.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")TM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid",code:V.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")RM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cuid2",code:V.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")AM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ulid",code:V.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),G(s,{validation:"url",code:V.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"regex",code:V.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?t.data=t.data.trim():a.kind==="includes"?t.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?t.data=t.data.toLowerCase():a.kind==="toUpperCase"?t.data=t.data.toUpperCase():a.kind==="startsWith"?t.data.startsWith(a.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?t.data.endsWith(a.value)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?qM(a).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?VM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?KM(a).test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{code:V.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?DM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"duration",code:V.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?WM(t.data,a.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"ip",code:V.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?GM(t.data,a.alg)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"jwt",code:V.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?YM(t.data,a.version)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"cidr",code:V.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?BM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64",code:V.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?HM.test(t.data)||(s=this._getOrReturnCtx(t,s),G(s,{validation:"base64url",code:V.invalid_string,message:a.message}),n.dirty()):_e.assertNever(a);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:V.invalid_string,...Q.errToObj(n)})}_addCheck(t){return new Hn({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Q.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Q.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Q.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Q.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r==null?void 0:r.position,...Q.errToObj(r==null?void 0:r.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Q.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Q.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Q.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Q.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Q.errToObj(r)})}nonempty(t){return this.min(1,Q.errToObj(t))}trim(){return new Hn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Hn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Hn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}Hn.create=e=>new Hn({checks:[],typeName:ae.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...he(e)});function JM(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return a%o/10**s}class yi extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Z.number){const a=this._getOrReturnCtx(t);return G(a,{code:V.invalid_type,expected:Z.number,received:a.parsedType}),se}let n;const s=new Lt;for(const a of this._def.checks)a.kind==="int"?_e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),G(n,{code:V.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),G(n,{code:V.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),G(n,{code:V.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?JM(t.data,a.value)!==0&&(n=this._getOrReturnCtx(t,n),G(n,{code:V.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),G(n,{code:V.not_finite,message:a.message}),s.dirty()):_e.assertNever(a);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Q.toString(r))}setLimit(t,r,n,s){return new yi({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Q.toString(s)}]})}_addCheck(t){return new yi({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&_e.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}}yi.create=e=>new yi({checks:[],typeName:ae.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...he(e)});class Qo extends be{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Z.bigint)return this._getInvalidInput(t);let n;const s=new Lt;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.data<a.value:t.data<=a.value)&&(n=this._getOrReturnCtx(t,n),G(n,{code:V.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?t.data>a.value:t.data>=a.value)&&(n=this._getOrReturnCtx(t,n),G(n,{code:V.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),G(n,{code:V.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):_e.assertNever(a);return{status:s.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Z.bigint,received:r.parsedType}),se}gte(t,r){return this.setLimit("min",t,!0,Q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Q.toString(r))}setLimit(t,r,n,s){return new Qo({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Q.toString(s)}]})}_addCheck(t){return new Qo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}Qo.create=e=>new Qo({checks:[],typeName:ae.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...he(e)});class np extends be{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Z.boolean,received:n.parsedType}),se}return Qt(t.data)}}np.create=e=>new np({typeName:ae.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...he(e)});class yu extends be{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){const a=this._getOrReturnCtx(t);return G(a,{code:V.invalid_type,expected:Z.date,received:a.parsedType}),se}if(Number.isNaN(t.data.getTime())){const a=this._getOrReturnCtx(t);return G(a,{code:V.invalid_date}),se}const n=new Lt;let s;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()<a.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:V.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?t.data.getTime()>a.value&&(s=this._getOrReturnCtx(t,s),G(s,{code:V.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):_e.assertNever(a);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new yu({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Q.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Q.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}yu.create=e=>new yu({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ae.ZodDate,...he(e)});class Gv extends be{_parse(t){if(this._getType(t)!==Z.symbol){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Z.symbol,received:n.parsedType}),se}return Qt(t.data)}}Gv.create=e=>new Gv({typeName:ae.ZodSymbol,...he(e)});class Yv extends be{_parse(t){if(this._getType(t)!==Z.undefined){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Z.undefined,received:n.parsedType}),se}return Qt(t.data)}}Yv.create=e=>new Yv({typeName:ae.ZodUndefined,...he(e)});class Jv extends be{_parse(t){if(this._getType(t)!==Z.null){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Z.null,received:n.parsedType}),se}return Qt(t.data)}}Jv.create=e=>new Jv({typeName:ae.ZodNull,...he(e)});class Zv extends be{constructor(){super(...arguments),this._any=!0}_parse(t){return Qt(t.data)}}Zv.create=e=>new Zv({typeName:ae.ZodAny,...he(e)});class Qv extends be{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Qt(t.data)}}Qv.create=e=>new Qv({typeName:ae.ZodUnknown,...he(e)});class os extends be{_parse(t){const r=this._getOrReturnCtx(t);return G(r,{code:V.invalid_type,expected:Z.never,received:r.parsedType}),se}}os.create=e=>new os({typeName:ae.ZodNever,...he(e)});class Xv extends be{_parse(t){if(this._getType(t)!==Z.undefined){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Z.void,received:n.parsedType}),se}return Qt(t.data)}}Xv.create=e=>new Xv({typeName:ae.ZodVoid,...he(e)});class Lr extends be{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==Z.array)return G(r,{code:V.invalid_type,expected:Z.array,received:r.parsedType}),se;if(s.exactLength!==null){const o=r.data.length>s.exactLength.value,l=r.data.length<s.exactLength.value;(o||l)&&(G(r,{code:o?V.too_big:V.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(G(r,{code:V.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(G(r,{code:V.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,l)=>s.type._parseAsync(new is(r,o,r.path,l)))).then(o=>Lt.mergeArray(n,o));const a=[...r.data].map((o,l)=>s.type._parseSync(new is(r,o,r.path,l)));return Lt.mergeArray(n,a)}get element(){return this._def.type}min(t,r){return new Lr({...this._def,minLength:{value:t,message:Q.toString(r)}})}max(t,r){return new Lr({...this._def,maxLength:{value:t,message:Q.toString(r)}})}length(t,r){return new Lr({...this._def,exactLength:{value:t,message:Q.toString(r)}})}nonempty(t){return this.min(1,t)}}Lr.create=(e,t)=>new Lr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ae.ZodArray,...he(t)});function ba(e){if(e instanceof Be){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=ts.create(ba(n))}return new Be({...e._def,shape:()=>t})}else return e instanceof Lr?new Lr({...e._def,type:ba(e.element)}):e instanceof ts?ts.create(ba(e.unwrap())):e instanceof bi?bi.create(ba(e.unwrap())):e instanceof Hs?Hs.create(e.items.map(t=>ba(t))):e}class Be extends be{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=_e.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Z.object){const u=this._getOrReturnCtx(t);return G(u,{code:V.invalid_type,expected:Z.object,received:u.parsedType}),se}const{status:n,ctx:s}=this._processInputParams(t),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof os&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=a[u],h=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new is(s,h,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof os){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(G(s,{code:V.unrecognized_keys,keys:l}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const h=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new is(s,h,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const h=await d.key,f=await d.value;u.push({key:h,value:f,alwaysSet:d.alwaysSet})}return u}).then(u=>Lt.mergeObjectSync(n,u)):Lt.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new Be({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var a,o;const s=((o=(a=this._def).errorMap)==null?void 0:o.call(a,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new Be({...this._def,unknownKeys:"strip"})}passthrough(){return new Be({...this._def,unknownKeys:"passthrough"})}extend(t){return new Be({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Be({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ae.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new Be({...this._def,catchall:t})}pick(t){const r={};for(const n of _e.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new Be({...this._def,shape:()=>r})}omit(t){const r={};for(const n of _e.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new Be({...this._def,shape:()=>r})}deepPartial(){return ba(this)}partial(t){const r={};for(const n of _e.objectKeys(this.shape)){const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}return new Be({...this._def,shape:()=>r})}required(t){const r={};for(const n of _e.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ts;)a=a._def.innerType;r[n]=a}return new Be({...this._def,shape:()=>r})}keyof(){return M1(_e.objectKeys(this.shape))}}Be.create=(e,t)=>new Be({shape:()=>e,unknownKeys:"strip",catchall:os.create(),typeName:ae.ZodObject,...he(t)});Be.strictCreate=(e,t)=>new Be({shape:()=>e,unknownKeys:"strict",catchall:os.create(),typeName:ae.ZodObject,...he(t)});Be.lazycreate=(e,t)=>new Be({shape:e,unknownKeys:"strip",catchall:os.create(),typeName:ae.ZodObject,...he(t)});class vu extends be{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(a){for(const l of a)if(l.result.status==="valid")return l.result;for(const l of a)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;const o=a.map(l=>new dn(l.ctx.common.issues));return G(r,{code:V.invalid_union,unionErrors:o}),se}if(r.common.async)return Promise.all(n.map(async a=>{const o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let a;const o=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const l=o.map(c=>new dn(c));return G(r,{code:V.invalid_union,unionErrors:l}),se}}get options(){return this._def.options}}vu.create=(e,t)=>new vu({options:e,typeName:ae.ZodUnion,...he(t)});function sp(e,t){const r=Rn(e),n=Rn(t);if(e===t)return{valid:!0,data:e};if(r===Z.object&&n===Z.object){const s=_e.objectKeys(t),a=_e.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of a){const c=sp(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(r===Z.array&&n===Z.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const o=e[a],l=t[a],c=sp(o,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===Z.date&&n===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class xu extends be{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(a,o)=>{if(Kv(a)||Kv(o))return se;const l=sp(a.value,o.value);return l.valid?((qv(a)||qv(o))&&r.dirty(),{status:r.value,value:l.data}):(G(n,{code:V.invalid_intersection_types}),se)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}xu.create=(e,t,r)=>new xu({left:e,right:t,typeName:ae.ZodIntersection,...he(r)});class Hs extends be{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.array)return G(n,{code:V.invalid_type,expected:Z.array,received:n.parsedType}),se;if(n.data.length<this._def.items.length)return G(n,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),se;!this._def.rest&&n.data.length>this._def.items.length&&(G(n,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new is(n,o,n.path,l)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>Lt.mergeArray(r,o)):Lt.mergeArray(r,a)}get items(){return this._def.items}rest(t){return new Hs({...this._def,rest:t})}}Hs.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Hs({items:e,typeName:ae.ZodTuple,rest:null,...he(t)})};class ex extends be{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.map)return G(n,{code:V.invalid_type,expected:Z.map,received:n.parsedType}),se;const s=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([l,c],u)=>({key:s._parse(new is(n,l,n.path,[u,"key"])),value:a._parse(new is(n,c,n.path,[u,"value"]))}));if(n.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return se;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(u.value,d.value)}return{status:r.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return se;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),l.set(u.value,d.value)}return{status:r.value,value:l}}}}ex.create=(e,t,r)=>new ex({valueType:t,keyType:e,typeName:ae.ZodMap,...he(r)});class Xo extends be{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.set)return G(n,{code:V.invalid_type,expected:Z.set,received:n.parsedType}),se;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(G(n,{code:V.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(G(n,{code:V.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return se;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}const l=[...n.data.values()].map((c,u)=>a._parse(new is(n,c,n.path,u)));return n.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,r){return new Xo({...this._def,minSize:{value:t,message:Q.toString(r)}})}max(t,r){return new Xo({...this._def,maxSize:{value:t,message:Q.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}Xo.create=(e,t)=>new Xo({valueType:e,minSize:null,maxSize:null,typeName:ae.ZodSet,...he(t)});class tx extends be{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}tx.create=(e,t)=>new tx({getter:e,typeName:ae.ZodLazy,...he(t)});class ap extends be{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return G(r,{received:r.data,code:V.invalid_literal,expected:this._def.value}),se}return{status:"valid",value:t.data}}get value(){return this._def.value}}ap.create=(e,t)=>new ap({value:e,typeName:ae.ZodLiteral,...he(t)});function M1(e,t){return new vi({values:e,typeName:ae.ZodEnum,...he(t)})}class vi extends be{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return G(r,{expected:_e.joinValues(n),received:r.parsedType,code:V.invalid_type}),se}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return G(r,{received:r.data,code:V.invalid_enum_value,options:n}),se}return Qt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return vi.create(t,{...this._def,...r})}exclude(t,r=this._def){return vi.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}vi.create=M1;class rx extends be{_parse(t){const r=_e.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){const s=_e.objectValues(r);return G(n,{expected:_e.joinValues(s),received:n.parsedType,code:V.invalid_type}),se}if(this._cache||(this._cache=new Set(_e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=_e.objectValues(r);return G(n,{received:n.data,code:V.invalid_enum_value,options:s}),se}return Qt(t.data)}get enum(){return this._def.values}}rx.create=(e,t)=>new rx({values:e,typeName:ae.ZodNativeEnum,...he(t)});class bu extends be{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.promise&&r.common.async===!1)return G(r,{code:V.invalid_type,expected:Z.promise,received:r.parsedType}),se;const n=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return Qt(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}bu.create=(e,t)=>new bu({type:e,typeName:ae.ZodPromise,...he(t)});class xi extends be{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ae.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:o=>{G(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const o=s.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async l=>{if(r.value==="aborted")return se;const c=await this._def.schema._parseAsync({data:l,path:n.path,parent:n});return c.status==="aborted"?se:c.status==="dirty"||r.value==="dirty"?ro(c.value):c});{if(r.value==="aborted")return se;const l=this._def.schema._parseSync({data:o,path:n.path,parent:n});return l.status==="aborted"?se:l.status==="dirty"||r.value==="dirty"?ro(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(n.common.async===!1){const l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?se:(l.status==="dirty"&&r.dirty(),o(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?se:(l.status==="dirty"&&r.dirty(),o(l.value).then(()=>({status:r.value,value:l.value}))))}if(s.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!gi(o))return se;const l=s.transform(o.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>gi(o)?Promise.resolve(s.transform(o.value,a)).then(l=>({status:r.value,value:l})):se);_e.assertNever(s)}}xi.create=(e,t,r)=>new xi({schema:e,typeName:ae.ZodEffects,effect:t,...he(r)});xi.createWithPreprocess=(e,t,r)=>new xi({schema:t,effect:{type:"preprocess",transform:e},typeName:ae.ZodEffects,...he(r)});class ts extends be{_parse(t){return this._getType(t)===Z.undefined?Qt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ts.create=(e,t)=>new ts({innerType:e,typeName:ae.ZodOptional,...he(t)});class bi extends be{_parse(t){return this._getType(t)===Z.null?Qt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}bi.create=(e,t)=>new bi({innerType:e,typeName:ae.ZodNullable,...he(t)});class ip extends be{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ip.create=(e,t)=>new ip({innerType:e,typeName:ae.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...he(t)});class op extends be{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return gu(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new dn(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new dn(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}op.create=(e,t)=>new op({innerType:e,typeName:ae.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...he(t)});class nx extends be{_parse(t){if(this._getType(t)!==Z.nan){const n=this._getOrReturnCtx(t);return G(n,{code:V.invalid_type,expected:Z.nan,received:n.parsedType}),se}return{status:"valid",value:t.data}}}nx.create=e=>new nx({typeName:ae.ZodNaN,...he(e)});class ZM extends be{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class qm extends be{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?se:a.status==="dirty"?(r.dirty(),ro(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?se:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new qm({in:t,out:r,typeName:ae.ZodPipeline})}}class lp extends be{_parse(t){const r=this._def.innerType._parse(t),n=s=>(gi(s)&&(s.value=Object.freeze(s.value)),s);return gu(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}lp.create=(e,t)=>new lp({innerType:e,typeName:ae.ZodReadonly,...he(t)});Be.lazycreate;var ae;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ae||(ae={}));const pe=Hn.create,QM=yi.create,XM=np.create;os.create;Lr.create;const mn=Be.create;Be.strictCreate;vu.create;xu.create;Hs.create;const Wt=ap.create;vi.create;bu.create;ts.create;bi.create;const eL=[{title:"Alışveriş",links:[{label:"Tüm Ürünler",href:"/urunler"},{label:"Favorilerim",href:"/favorilerim"}]},{title:"Yardım",links:[{label:"İletişim",href:"/iletisim"},{label:"Sıkça Sorulanlar",href:"/sss"},{label:"Kargo & Teslimat",href:"/kargo-teslimat"},{label:"İade & Değişim",href:"/iade-degisim"}]},{title:"Marka",links:[{label:"Hakkımızda",href:"/hakkimizda"}]}],tL=[{label:"Gizlilik Politikası",href:"/gizlilik"},{label:"KVKK",href:"/kvkk"},{label:"Çerez Politikası",href:"/cerezler"},{label:"Mesafeli Satış Sözleşmesi",href:"/mesafeli-satis"},{label:"Ön Bilgilendirme",href:"/on-bilgilendirme"}],rL=pe().trim().email().max(254),Ye=()=>{const[e,t]=m.useState(""),[r,n]=m.useState(!1),s=async a=>{a.preventDefault();const o=rL.safeParse(e);if(!o.success){O.error("Geçerli bir e-posta girin");return}n(!0);const{error:l}=await U.from("newsletter_subscribers").insert({email:o.data.toLowerCase(),source:"footer"});if(n(!1),l){l.code==="23505"?O.info("Bu e-posta zaten abone"):O.error("Bir hata oluştu");return}O.success("Bültenimize abone oldunuz!"),t("")};return i.jsx("footer",{className:"border-t border-border/60 bg-secondary/40 mt-24",children:i.jsxs("div",{className:"container-editorial py-20",children:[i.jsxs("div",{className:"grid gap-12 md:grid-cols-12",children:[i.jsxs("div",{className:"md:col-span-5 space-y-6",children:[i.jsxs("div",{className:"brand-frame",children:[i.jsx("div",{className:"display-text text-lg font-light",children:"Derma Royal"}),i.jsx("div",{className:"absolute -bottom-3 right-2 text-[10px] tracking-[0.2em] text-foreground/70",children:"shop"})]}),i.jsx("p",{className:"editorial-serif text-lg leading-relaxed text-foreground/70 max-w-md mt-6",children:"Bilime dayalı zarafet. Her formül, cildinizin asaletini ortaya çıkarmak için özenle hazırlandı."}),i.jsxs("form",{onSubmit:s,className:"mt-8 max-w-md",children:[i.jsx("label",{className:"block text-[10px] uppercase tracking-[0.25em] text-foreground/60 mb-3",children:"Bültene katılın"}),i.jsxs("div",{className:"flex border-b border-foreground/40 focus-within:border-foreground transition-colors",children:[i.jsx("input",{type:"email",required:!0,value:e,onChange:a=>t(a.target.value),placeholder:"e-posta adresiniz",className:"flex-1 bg-transparent py-3 text-sm placeholder:text-foreground/40 focus:outline-none"}),i.jsx("button",{type:"submit",disabled:r,className:"px-3 text-[10px] uppercase tracking-[0.25em] hover:opacity-70 transition-opacity disabled:opacity-40",children:r?"...":"Katıl →"})]})]})]}),eL.map(a=>i.jsxs("div",{className:"md:col-span-2 space-y-4",children:[i.jsx("h4",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground",children:a.title}),i.jsx("ul",{className:"space-y-3",children:a.links.map(o=>i.jsx("li",{children:i.jsx(ue,{to:o.href,className:"text-sm text-foreground/65 hover:text-foreground transition-colors",children:o.label})},o.href))})]},a.title)),i.jsxs("div",{className:"md:col-span-1 flex md:flex-col gap-4",children:[i.jsx("a",{href:"https://www.instagram.com/dermaroyalshop?igsh=dnVpbzZkb2k3MDkw",target:"_blank",rel:"noopener noreferrer","aria-label":"Instagram",className:"hover:opacity-60 transition-opacity",children:i.jsx(cR,{className:"h-4 w-4"})}),i.jsx("a",{href:"#","aria-label":"Facebook",className:"hover:opacity-60 transition-opacity",children:i.jsx(iR,{className:"h-4 w-4"})}),i.jsx("a",{href:"#","aria-label":"Youtube",className:"hover:opacity-60 transition-opacity",children:i.jsx(ER,{className:"h-4 w-4"})})]})]}),i.jsxs("div",{className:"mt-16 pt-8 border-t border-border/60 flex flex-col md:flex-row items-start md:items-center justify-between gap-4 text-[11px] tracking-wider text-foreground/55",children:[i.jsxs("p",{children:["© ",new Date().getFullYear()," Derma Royal Shop. Tüm hakları saklıdır."]}),i.jsx("div",{className:"flex flex-wrap gap-x-5 gap-y-2",children:tL.map(a=>i.jsx(ue,{to:a.href,className:"hover:text-foreground transition-colors",children:a.label},a.href))})]})]})})},sx="https://dermaroyal.com",wh="Derma Royal",Ri=({title:e,description:t,path:r,image:n,type:s="website",jsonLd:a,noindex:o})=>{const l=`${sx}${r??(typeof window<"u"?window.location.pathname:"/")}`,c=t.length>160?t.slice(0,157).trimEnd()+"…":t,u=e.includes(wh)?e:`${e} | ${wh}`,d=n||`${sx}/og-image.jpg`;return i.jsxs($E,{children:[i.jsx("title",{children:u}),i.jsx("meta",{name:"description",content:c}),i.jsx("link",{rel:"canonical",href:l}),o&&i.jsx("meta",{name:"robots",content:"noindex,nofollow"}),i.jsx("meta",{property:"og:title",content:u}),i.jsx("meta",{property:"og:description",content:c}),i.jsx("meta",{property:"og:url",content:l}),i.jsx("meta",{property:"og:type",content:s}),i.jsx("meta",{property:"og:image",content:d}),i.jsx("meta",{property:"og:site_name",content:wh}),i.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),i.jsx("meta",{name:"twitter:title",content:u}),i.jsx("meta",{name:"twitter:description",content:c}),i.jsx("meta",{name:"twitter:image",content:d}),a&&i.jsx("script",{type:"application/ld+json",children:JSON.stringify(a)})]})},L1=({productId:e,className:t="",size:r=18})=>{const{user:n}=Hr(),{isInWishlist:s,toggle:a}=Rm(),[o,l]=m.useState(!1),[c,u]=m.useState(!1),d=xr();m.useEffect(()=>{u(s(e))},[s,e]);const h=async f=>{if(f.preventDefault(),f.stopPropagation(),!n){O.info("Favorilere eklemek için giriş yapın"),d("/giris");return}if(!o){l(!0);try{const p=await a(e);u(p),O.success(p?"Favorilere eklendi":"Favorilerden çıkarıldı")}catch{O.error("Bir hata oluştu")}finally{l(!1)}}};return i.jsx("button",{type:"button",onClick:h,"aria-label":c?"Favorilerden çıkar":"Favorilere ekle",className:`transition-all ${t}`,children:i.jsx(zo,{style:{width:r,height:r},className:`${c?"fill-foreground text-foreground":"text-foreground"} transition-all`,strokeWidth:1.25})})},nL={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},Ga=({value:e,onChange:t,size:r="md",readOnly:n=!t})=>{const s=nL[r];return i.jsx("div",{className:"inline-flex items-center gap-0.5",children:[1,2,3,4,5].map(a=>{const o=a<=Math.round(e);return i.jsx("button",{type:"button",disabled:n,onClick:()=>t==null?void 0:t(a),className:`${n?"cursor-default":"cursor-pointer hover:opacity-70"} transition-opacity`,"aria-label":`${a} yıldız`,children:i.jsx(zw,{className:`${s} ${o?"fill-foreground text-foreground":"text-foreground/25"}`,strokeWidth:1})},a)})})},gd=({id:e,slug:t,image:r,name:n,category:s,price:a,compareAtPrice:o,badge:l,stockQuantity:c})=>{const{addItem:u}=pl(),[d,h]=m.useState(null),f=typeof c=="number"&&c<=0;m.useEffect(()=>{let b=!1;return U.rpc("get_product_rating",{_product_id:e}).then(({data:g})=>{if(b||!g)return;const w=g;w.count>0&&h({avg:Number(w.avg),count:w.count})}),()=>{b=!0}},[e]);const p=b=>{b.preventDefault(),b.stopPropagation(),!f&&u({product_id:e,name:n,price:a,image:r})};return i.jsxs("article",{className:"product-card group relative",children:[i.jsx("div",{className:"absolute right-3 top-3 z-10",children:i.jsx(L1,{productId:e,className:"bg-background/80 backdrop-blur-sm p-2 rounded-full",size:16})}),i.jsxs(ue,{to:`/urunler/${t}`,className:"block",children:[i.jsxs("div",{className:"product-card-image relative",children:[i.jsx("img",{src:r,alt:n,loading:"lazy",width:800,height:1e3}),(l||f)&&i.jsx("span",{className:"absolute left-4 top-4 bg-background/90 px-3 py-1 text-[10px] uppercase tracking-[0.2em]",children:f?"Stokta Yok":l}),!f&&i.jsx("button",{type:"button",onClick:p,className:`absolute inset-x-4 bottom-4 translate-y-3 opacity-0 group-hover:translate-y-0 group-hover:opacity-100 transition-all duration-500
bg-foreground text-background py-3 text-[10px] uppercase tracking-[0.25em]`,children:"Sepete Ekle"})]}),i.jsxs("div",{className:"pt-5 px-3 space-y-1",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.22em] text-foreground/55",children:s}),i.jsx("h3",{className:"text-base font-light tracking-wide text-foreground",children:n}),i.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[i.jsx("p",{className:"text-sm text-foreground/80",children:ye(a)}),o&&o>a&&i.jsx("p",{className:"text-xs text-foreground/45 line-through",children:ye(o)})]}),d&&i.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[i.jsx(Ga,{value:d.avg,size:"sm",readOnly:!0}),i.jsxs("span",{className:"text-[10px] text-foreground/55",children:["(",d.count,")"]})]})]})]})]})},sL="/assets/hero-serum-Dvp6ujCr.jpg",aL="/assets/product-eyecream-BaCn38Gd.jpg",iL=()=>{const[e,t]=m.useState([]),[r,n]=m.useState([]);return m.useEffect(()=>{(async()=>{const[{data:s},{data:a}]=await Promise.all([U.from("products").select("*, categories(name)").eq("active",!0).eq("featured",!0).limit(4),U.from("categories").select("*").order("sort_order").limit(4)]);t(s??[]),n(a??[])})()},[]),i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ri,{title:"Derma Royal — Lüks Cilt Bakım Ürünleri",description:"Derma Royal — bilime dayalı, zarif lüks cilt bakım koleksiyonu. Serum, krem ve temizleyici ile zamansız güzelliğin sırrı.",path:"/",jsonLd:{"@context":"https://schema.org","@type":"Organization",name:"Derma Royal",url:"https://dermaroyal.com",logo:"https://dermaroyal.com/og-image.jpg"}}),i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1",children:[i.jsx("section",{className:"relative",children:i.jsx("div",{className:"container-editorial pt-12 md:pt-20 pb-20 md:pb-32",children:i.jsxs("div",{className:"grid lg:grid-cols-12 gap-12 lg:gap-20 items-center",children:[i.jsxs("div",{className:"lg:col-span-5 space-y-10 order-2 lg:order-1",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.35em] text-foreground/60",children:"Yeni Koleksiyon — 2026"}),i.jsxs("h1",{className:"display-text text-[40px] md:text-[56px] lg:text-[64px] leading-[1.05] font-extralight",children:["Cildin",i.jsx("br",{}),"asil ",i.jsx("span",{className:"editorial-serif normal-case tracking-normal",children:"parlaklığı"})]}),i.jsx("p",{className:"text-base text-foreground/70 leading-relaxed max-w-md",children:"Bilime dayalı saf formüller. Her damla, zamansız zarafetin modern yorumudur. Royal Glow koleksiyonunu keşfedin."}),i.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[i.jsx(ue,{to:"/urunler",className:"btn-ink",children:"Koleksiyonu Keşfet"}),i.jsx("a",{href:"#hikayemiz",className:"text-xs uppercase tracking-[0.25em] underline-offset-8 hover:underline",children:"Hikayemiz →"})]})]}),i.jsx("div",{className:"lg:col-span-7 order-1 lg:order-2",children:i.jsxs("div",{className:"relative aspect-[4/5] lg:aspect-[5/6] overflow-hidden bg-secondary",children:[i.jsx("img",{src:sL,alt:"Derma Royal lüks serum",width:1600,height:1200,className:"h-full w-full object-cover"}),i.jsxs("div",{className:"absolute bottom-6 left-6 right-6 flex items-end justify-between text-background/95",children:[i.jsx("p",{className:"editorial-serif text-2xl",children:"Royal Glow"}),i.jsx("p",{className:"text-[10px] uppercase tracking-[0.25em]",children:"№ 01 / Serum"})]})]})})]})})}),i.jsx("section",{className:"border-y border-border/60 bg-secondary/30",children:i.jsx("div",{className:"container-editorial py-8 grid grid-cols-2 md:grid-cols-4 gap-6 text-center",children:["Dermatologlarca Onaylı","Hayvanlar Üzerinde Test Edilmemiş","%100 Vegan Formüller","4000 TL Üzeri Alışverişlerde Kıbrıs Geneli Ücretsiz Kargo"].map(s=>i.jsx("p",{className:"text-[10px] uppercase tracking-[0.22em] text-foreground/65",children:s},s))})}),r.length>0&&i.jsxs("section",{id:"kategoriler",className:"container-editorial py-24 md:py-32",children:[i.jsxs("div",{className:"flex items-end justify-between mb-12",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3",children:"Koleksiyon"}),i.jsx("h2",{className:"display-text text-3xl md:text-4xl font-extralight",children:"Ritüelinizi Seçin"})]}),i.jsx(ue,{to:"/urunler",className:"hidden md:inline-block text-[11px] uppercase tracking-[0.25em] underline-offset-8 hover:underline",children:"Tüm Ürünler →"})]}),i.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6",children:r.map(s=>i.jsxs(ue,{to:`/urunler?kategori=${s.slug}`,className:"group block aspect-[4/5] relative overflow-hidden bg-secondary",children:[i.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-brand-sand to-secondary group-hover:scale-105 transition-transform duration-700"}),i.jsxs("div",{className:"relative h-full flex flex-col items-center justify-center p-8 text-center",children:[i.jsx("h3",{className:"display-text text-xl font-extralight mb-2",children:s.name}),s.description&&i.jsx("p",{className:"editorial-serif text-base text-foreground/70",children:s.description}),i.jsx("span",{className:"absolute bottom-8 text-[10px] uppercase tracking-[0.25em] underline-offset-4 group-hover:underline",children:"Keşfet"})]})]},s.id))})]}),e.length>0&&i.jsxs("section",{id:"urunler",className:"container-editorial py-12 md:py-20",children:[i.jsxs("div",{className:"text-center mb-16 space-y-4",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Çok Satanlar"}),i.jsx("h2",{className:"display-text text-3xl md:text-4xl font-extralight",children:"Müşterilerimizin Favorisi"}),i.jsx("p",{className:"editorial-serif text-lg text-foreground/65 max-w-xl mx-auto",children:"Her birini elle seçtiğimiz, ciltte hissedilen lüks formüller."})]}),i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-6 md:gap-10",children:e.map(s=>{var a,o;return i.jsx(gd,{id:s.id,slug:s.slug,name:s.name,category:((a=s.categories)==null?void 0:a.name)??"",price:Number(s.price),image:((o=s.images)==null?void 0:o[0])??mi,badge:s.featured?"Çok Satan":void 0},s.id)})}),i.jsx("div",{className:"text-center mt-16",children:i.jsx(ue,{to:"/urunler",className:"btn-outline-ink",children:"Tüm Koleksiyonu Gör"})})]}),i.jsx("section",{id:"hikayemiz",className:"bg-secondary/40 mt-12",children:i.jsxs("div",{className:"container-editorial py-24 md:py-32 grid lg:grid-cols-2 gap-16 items-center",children:[i.jsx("div",{className:"aspect-[4/5] overflow-hidden bg-background",children:i.jsx("img",{src:aL,alt:"Derma Royal göz kremi",width:800,height:1e3,loading:"lazy",className:"h-full w-full object-cover"})}),i.jsxs("div",{className:"space-y-8",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Marka Hikayesi"}),i.jsxs("h2",{className:"display-text text-3xl md:text-5xl font-extralight leading-tight",children:["Bilim ve ",i.jsx("span",{className:"editorial-serif normal-case tracking-normal",children:"zarafet"})," arasındaki dengede."]}),i.jsx("p",{className:"text-base text-foreground/75 leading-relaxed max-w-lg",children:"Derma Royal, dermatolojik araştırmadan ilham alan ve klasik güzellik anlayışını modern bir disiplinle yeniden yorumlayan bir Türk markasıdır. Saf etken maddeler, sade tasarım ve sürdürülebilir paketler ile günlük ritüelinizi bir törene dönüştürür."}),i.jsx(ue,{to:"/urunler",className:"btn-outline-ink",children:"Daha Fazlası"})]})]})})]}),i.jsx(Ye,{})]})},oL=()=>{const e=Ur();return m.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),i.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:i.jsxs("div",{className:"text-center",children:[i.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),i.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),i.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})},lL=mn({full_name:pe().trim().min(2,"Ad en az 2 karakter").max(100),email:pe().trim().email("Geçersiz e-posta").max(255),password:pe().min(6,"Şifre en az 6 karakter").max(72)}),cL=mn({email:pe().trim().email("Geçersiz e-posta").max(255),password:pe().min(1,"Şifre gerekli").max(72)}),uL=()=>{const e=xr(),{user:t,loading:r}=Hr(),[n,s]=m.useState("signin"),[a,o]=m.useState(!1),[l,c]=m.useState({full_name:"",email:"",password:""});m.useEffect(()=>{!r&&t&&e("/",{replace:!0})},[t,r,e]);const u=async d=>{d.preventDefault(),o(!0);try{if(n==="signup"){const h=lL.safeParse(l);if(!h.success){O.error(h.error.issues[0].message);return}const{error:f}=await U.auth.signUp({email:h.data.email,password:h.data.password,options:{emailRedirectTo:`${window.location.origin}/giris/dogrulama`,data:{full_name:h.data.full_name}}});if(f)throw f;O.success("Hesabınız oluşturuldu! E-postanızı onayladıktan sonra hesabınıza giriş yapabilirsiniz. Lütfen Spam veya Gereksiz klasörünüzü de kontrol edin.",{duration:8e3}),s("signin"),c({full_name:"",email:l.email,password:""})}else{const h=cL.safeParse(l);if(!h.success){O.error(h.error.issues[0].message);return}const{error:f}=await U.auth.signInWithPassword({email:h.data.email,password:h.data.password});if(f)throw f;O.success("Hoş geldiniz!"),e("/")}}catch(h){O.error(h.message??"Bir hata oluştu")}finally{o(!1)}};return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsx("main",{className:"flex-1 flex items-center justify-center py-20",children:i.jsxs("div",{className:"w-full max-w-md px-6",children:[i.jsxs("div",{className:"text-center mb-10",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3",children:"Hesap"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:n==="signin"?"Giriş Yap":"Hesap Oluştur"})]}),i.jsxs("form",{onSubmit:u,className:"space-y-5",children:[n==="signup"&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Ad Soyad"}),i.jsx("input",{type:"text",required:!0,value:l.full_name,onChange:d=>c({...l,full_name:d.target.value}),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground transition-colors"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"E-posta"}),i.jsx("input",{type:"email",required:!0,value:l.email,onChange:d=>c({...l,email:d.target.value}),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground transition-colors"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Şifre"}),i.jsx("input",{type:"password",required:!0,value:l.password,onChange:d=>c({...l,password:d.target.value}),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground transition-colors"})]}),i.jsx("button",{type:"submit",disabled:a,className:"btn-ink w-full disabled:opacity-50",children:a?"Bekleyin...":n==="signin"?"Giriş Yap":"Hesap Oluştur"})]}),i.jsx("div",{className:"text-center mt-8",children:i.jsx("button",{type:"button",onClick:()=>s(n==="signin"?"signup":"signin"),className:"text-[11px] uppercase tracking-[0.22em] text-foreground/70 hover:text-foreground underline-offset-8 hover:underline",children:n==="signin"?"Hesabınız yok mu? Kayıt olun":"Zaten hesabınız var mı? Giriş yapın"})}),i.jsx("div",{className:"text-center mt-6",children:i.jsx(ue,{to:"/",className:"text-[10px] uppercase tracking-[0.22em] text-foreground/55",children:"← Mağazaya dön"})})]})}),i.jsx(Ye,{})]})},dL=()=>{const e=xr(),[t]=Bu(),[r,n]=m.useState("loading"),[s,a]=m.useState("Doğrulanıyor"),[o,l]=m.useState("Lütfen bekleyin, bağlantınız doğrulanıyor..."),[c,u]=m.useState(!1);return m.useEffect(()=>{(async()=>{const h=window.location.hash.substring(1),f=new URLSearchParams(h),p=t.get("error_code")||t.get("error")||f.get("error_code")||f.get("error"),b=t.get("error_description")||f.get("error_description");if(p){n("error"),p==="otp_expired"||b!=null&&b.includes("expired")?(a("Bağlantının Süresi Doldu"),l("Bu doğrulama bağlantısının süresi dolmuş. Lütfen yeni bir bağlantı talep edin.")):p==="access_denied"?(a("Erişim Reddedildi"),l("Bağlantı geçersiz veya daha önce kullanılmış olabilir.")):(a("Bir Hata Oluştu"),l(b?decodeURIComponent(b.replace(/\+/g," ")):"Doğrulama sırasında bir sorun oluştu."));return}const g=f.get("type")||t.get("type");await new Promise(y=>setTimeout(y,400));const{data:{session:w}}=await U.auth.getSession();if(!w){n("error"),a("Doğrulanamadı"),l("Oturum oluşturulamadı. Bağlantı geçersiz veya süresi dolmuş olabilir.");return}if(g==="recovery"){u(!0),n("success"),a("Şifre Sıfırlama Onaylandı"),l("Yeni şifrenizi belirlemek için yönlendiriliyorsunuz..."),setTimeout(()=>e("/sifre-sifirla",{replace:!0}),1500);return}if(g==="signup"||g==="email"){n("success"),a("E-posta Doğrulandı"),l("Hesabınız başarıyla aktifleştirildi. Mağazaya yönlendiriliyorsunuz..."),setTimeout(()=>e("/",{replace:!0}),2e3);return}if(g==="magiclink"){n("success"),a("Giriş Başarılı"),l("Hoş geldiniz. Mağazaya yönlendiriliyorsunuz..."),setTimeout(()=>e("/",{replace:!0}),1500);return}if(g==="email_change"){n("success"),a("E-posta Adresi Güncellendi"),l("Yeni e-posta adresiniz onaylandı. Profilinize yönlendiriliyorsunuz..."),setTimeout(()=>e("/hesabim",{replace:!0}),2e3);return}n("success"),a("Doğrulama Başarılı"),l("Yönlendiriliyorsunuz..."),setTimeout(()=>e("/",{replace:!0}),1500)})()},[e,t]),i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsx("main",{className:"flex-1 flex items-center justify-center py-20",children:i.jsxs("div",{className:"w-full max-w-md px-6 text-center",children:[i.jsxs("div",{className:"mb-8 flex justify-center",children:[r==="loading"&&i.jsx(rt,{className:"h-12 w-12 text-foreground/60 animate-spin",strokeWidth:1}),r==="success"&&i.jsx(Yu,{className:"h-12 w-12 text-foreground",strokeWidth:1}),r==="error"&&i.jsx(Ju,{className:"h-12 w-12 text-foreground",strokeWidth:1})]}),i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3",children:r==="loading"?"Lütfen Bekleyin":r==="success"?"Başarılı":"Hata"}),i.jsx("h1",{className:"display-text text-3xl font-extralight mb-4",children:s}),i.jsx("p",{className:"text-sm text-foreground/70 leading-relaxed mb-10",children:o}),r==="error"&&i.jsxs("div",{className:"space-y-4",children:[i.jsx(ue,{to:"/giris",className:"btn-ink w-full inline-block",children:"Giriş Sayfasına Dön"}),i.jsx("div",{children:i.jsx(ue,{to:"/",className:"text-[10px] uppercase tracking-[0.22em] text-foreground/55 hover:text-foreground",children:"← Mağazaya dön"})})]}),r==="success"&&!c&&i.jsx(ue,{to:"/",className:"text-[11px] uppercase tracking-[0.22em] text-foreground/70 hover:text-foreground underline-offset-8 hover:underline",children:"Hemen mağazaya git"})]})}),i.jsx(Ye,{})]})},hL=()=>{const[e,t]=m.useState([]),[r,n]=m.useState([]),[s,a]=m.useState(null),[o,l]=m.useState(!0),[c,u]=Bu();m.useEffect(()=>{(async()=>{const[{data:p},{data:b}]=await Promise.all([U.from("products").select("*, categories(name, slug)").eq("active",!0).order("featured",{ascending:!1}),U.from("categories").select("*").order("sort_order")]);t(p??[]),n(b??[]),l(!1)})()},[]),m.useEffect(()=>{const f=c.get("kategori");if(!f){d(null);return}const p=r.find(b=>b.slug===f);p&&a(p.id)},[c,r]);const d=f=>{if(a(f),f===null)return u({});const p=r.find(b=>b.id===f);p&&u({kategori:p.slug})},h=s?e.filter(f=>f.category_id===s):e;return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ri,{title:"Tüm Ürünler",description:"Derma Royal'in tüm lüks cilt bakım koleksiyonu — serum, krem, temizleyici ve daha fazlası.",path:"/urunler"}),i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-16 md:py-24",children:[i.jsxs("div",{className:"text-center mb-12 space-y-4",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Tüm Koleksiyon"}),i.jsx("h1",{className:"display-text text-3xl md:text-5xl font-extralight",children:"Ürünlerimiz"})]}),i.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2 md:gap-4 mb-12",children:[i.jsx("button",{onClick:()=>d(null),className:`text-[11px] uppercase tracking-[0.22em] px-4 py-2 border transition-colors ${s===null?"bg-foreground text-background border-foreground":"border-border hover:border-foreground"}`,children:"Tümü"}),r.map(f=>i.jsx("button",{onClick:()=>d(f.id),className:`text-[11px] uppercase tracking-[0.22em] px-4 py-2 border transition-colors ${s===f.id?"bg-foreground text-background border-foreground":"border-border hover:border-foreground"}`,children:f.name},f.id))]}),o?i.jsx("p",{className:"text-center text-foreground/60",children:"Yükleniyor..."}):h.length===0?i.jsx("p",{className:"text-center text-foreground/60 py-20 editorial-serif text-xl",children:"Bu kategoride henüz ürün yok."}):i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-6 md:gap-10",children:h.map(f=>{var p,b;return i.jsx(gd,{id:f.id,slug:f.slug,name:f.name,category:((p=f.categories)==null?void 0:p.name)??"",price:Number(f.price),image:((b=f.images)==null?void 0:b[0])??mi,badge:f.featured?"Çok Satan":void 0},f.id)})})]}),i.jsx(Ye,{})]})},fL=()=>{var k,A,P;const{slug:e}=cm(),{user:t}=Hr(),[r,n]=m.useState(null),[s,a]=m.useState(!0),[o,l]=m.useState(1),[c,u]=m.useState(0),[d,h]=m.useState({avg:0,count:0}),[f,p]=m.useState([]),[b,g]=m.useState([]),{addItem:w}=pl();if(m.useEffect(()=>{e&&(a(!0),(async()=>{const{data:$}=await U.from("products").select("*, categories(name)").eq("slug",e).eq("active",!0).maybeSingle();if(n($),a(!1),$){const[{data:R},{data:H},{data:N}]=await Promise.all([U.rpc("get_product_rating",{_product_id:$.id}),U.from("product_reviews").select("*").eq("product_id",$.id).eq("approved",!0).order("created_at",{ascending:!1}).limit(20),U.from("products").select("id, slug, name, price, compare_at_price, images, stock_quantity").eq("active",!0).eq("category_id",$.category_id??"").neq("id",$.id).limit(4)]);R&&h(R),p(H??[]),g(N??[])}})())},[e]),s)return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsx("main",{className:"flex-1 flex items-center justify-center",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}),i.jsx(Ye,{})]});if(!r)return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 flex flex-col items-center justify-center gap-4",children:[i.jsx("p",{className:"editorial-serif text-2xl",children:"Ürün bulunamadı"}),i.jsx(ue,{to:"/urunler",className:"btn-outline-ink",children:"Tüm Ürünler"})]}),i.jsx(Ye,{})]});const y=(k=r.images)!=null&&k.length?r.images:[mi],v=y[0],x=v!=null&&v.startsWith("http")?v:`https://dermaroyal.com${v}`,_=r.short_description||r.description||`${r.name} — Derma Royal lüks cilt bakım koleksiyonundan.`,j=_.replace(/\s+/g," ").trim().slice(0,160),S=(r.stock_quantity??0)>0,C={"@context":"https://schema.org","@type":"Product",name:r.name,description:_,image:y.map($=>$!=null&&$.startsWith("http")?$:`https://dermaroyal.com${$}`),sku:r.id,category:(A=r.categories)==null?void 0:A.name,brand:{"@type":"Brand",name:"Derma Royal"},offers:{"@type":"Offer",price:Number(r.price).toFixed(2),priceCurrency:"TRY",availability:S?"https://schema.org/InStock":"https://schema.org/OutOfStock",url:`https://dermaroyal.com/urunler/${r.slug}`},...d.count>0&&{aggregateRating:{"@type":"AggregateRating",ratingValue:d.avg,reviewCount:d.count}}};return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ri,{title:r.name,description:j,path:`/urunler/${r.slug}`,image:x,type:"product",jsonLd:C}),i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-12 md:py-20",children:[i.jsx(ue,{to:"/urunler",className:"text-[11px] uppercase tracking-[0.22em] text-foreground/60 hover:text-foreground",children:"← Tüm Ürünler"}),i.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 md:gap-20 mt-8",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"aspect-[4/5] bg-secondary overflow-hidden relative",children:[i.jsx("img",{src:y[c],alt:r.name,className:"w-full h-full object-cover"}),i.jsx("div",{className:"absolute top-4 right-4",children:i.jsx(L1,{productId:r.id})})]}),y.length>1&&i.jsx("div",{className:"grid grid-cols-4 gap-3",children:y.map(($,R)=>i.jsx("button",{onClick:()=>u(R),className:`aspect-square overflow-hidden border-2 ${R===c?"border-foreground":"border-transparent"}`,children:i.jsx("img",{src:$,alt:"",className:"w-full h-full object-cover"})},R))})]}),i.jsxs("div",{className:"space-y-8",children:[((P=r.categories)==null?void 0:P.name)&&i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:r.categories.name}),i.jsx("h1",{className:"display-text text-3xl md:text-5xl font-extralight",children:r.name}),d.count>0&&i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(Ga,{value:d.avg,size:"sm"}),i.jsxs("a",{href:"#reviews",className:"text-xs text-foreground/60 hover:text-foreground",children:[d.count," yorum"]})]}),r.short_description&&i.jsx("p",{className:"editorial-serif text-lg text-foreground/70",children:r.short_description}),i.jsxs("div",{className:"flex items-baseline gap-4",children:[i.jsx("p",{className:"text-2xl",children:ye(Number(r.price))}),r.compare_at_price&&i.jsx("p",{className:"text-base text-foreground/50 line-through",children:ye(Number(r.compare_at_price))})]}),i.jsx("div",{className:"hairline"}),r.description&&i.jsxs("div",{className:"space-y-3",children:[i.jsx("h2",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Ürün Açıklaması"}),i.jsx("p",{className:"text-sm text-foreground/75 leading-relaxed whitespace-pre-line",children:r.description})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Adet"}),i.jsxs("div",{className:"flex items-center border border-border",children:[i.jsx("button",{onClick:()=>l(Math.max(1,o-1)),className:"w-10 h-10 flex items-center justify-center hover:bg-secondary",children:i.jsx(Lw,{className:"h-3 w-3"})}),i.jsx("span",{className:"w-10 text-center text-sm",children:o}),i.jsx("button",{onClick:()=>l(Math.min(r.stock_quantity||99,o+1)),className:"w-10 h-10 flex items-center justify-center hover:bg-secondary",children:i.jsx(qs,{className:"h-3 w-3"})})]}),r.stock_quantity>0&&r.stock_quantity<=5&&i.jsxs("span",{className:"text-[10px] uppercase tracking-[0.2em] text-destructive",children:["Son ",r.stock_quantity," ürün"]})]}),i.jsx("button",{onClick:()=>w({product_id:r.id,name:r.name,price:Number(r.price),image:y[0]},o),disabled:r.stock_quantity===0,className:"btn-ink w-full disabled:opacity-50",children:r.stock_quantity===0?"Stokta Yok":"Sepete Ekle"})]}),r.ingredients&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"İçerikler"}),i.jsx("p",{className:"text-sm text-foreground/75 leading-relaxed",children:r.ingredients})]}),r.how_to_use&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Kullanım"}),i.jsx("p",{className:"text-sm text-foreground/75 leading-relaxed whitespace-pre-line",children:r.how_to_use})]})]})]}),i.jsx("section",{id:"reviews",className:"mt-24 pt-12 border-t border-border",children:i.jsxs("div",{className:"grid md:grid-cols-3 gap-12",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3",children:"Müşteri Yorumları"}),i.jsx("h2",{className:"display-text text-2xl font-extralight mb-4",children:d.count>0?`${d.avg} / 5`:"Henüz yorum yok"}),d.count>0&&i.jsxs(i.Fragment,{children:[i.jsx(Ga,{value:d.avg}),i.jsxs("p",{className:"text-xs text-foreground/60 mt-2",children:[d.count," yorum"]})]})]}),i.jsxs("div",{className:"md:col-span-2 space-y-6",children:[t?i.jsx(mL,{productId:r.id,userId:t.id,onSuccess:async()=>{const{data:$}=await U.from("product_reviews").select("*").eq("product_id",r.id).eq("approved",!0).order("created_at",{ascending:!1}).limit(20);p($??[]);const{data:R}=await U.rpc("get_product_rating",{_product_id:r.id});R&&h(R)}}):i.jsxs("div",{className:"border border-border bg-secondary/30 p-6 text-sm",children:["Yorum yapmak için"," ",i.jsx(ue,{to:"/giris",className:"underline",children:"giriş yapın"}),"."]}),f.length===0?i.jsx("p",{className:"text-sm text-foreground/55 italic",children:"İlk yorumu siz yazın."}):f.map($=>i.jsxs("div",{className:"border-b border-border pb-5",children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx(Ga,{value:$.rating,size:"sm"}),i.jsx("span",{className:"text-xs text-foreground/55",children:new Date($.created_at).toLocaleDateString("tr-TR")})]}),$.title&&i.jsx("p",{className:"font-light mb-1",children:$.title}),$.comment&&i.jsx("p",{className:"text-sm text-foreground/75",children:$.comment})]},$.id))]})]})}),b.length>0&&i.jsxs("section",{className:"mt-24 pt-12 border-t border-border",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3 text-center",children:"Tamamlayıcı Ürünler"}),i.jsx("h2",{className:"display-text text-2xl md:text-3xl font-extralight mb-12 text-center",children:"Bunları da beğenebilirsiniz"}),i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6 md:gap-8",children:b.map($=>{var R;return i.jsx(gd,{id:$.id,slug:$.slug,name:$.name,category:"",price:Number($.price),compareAtPrice:$.compare_at_price?Number($.compare_at_price):null,stockQuantity:$.stock_quantity,image:((R=$.images)==null?void 0:R[0])??mi},$.id)})})]})]}),i.jsx(Ye,{})]})},pL=mn({rating:QM().min(1).max(5),title:pe().trim().max(100).optional().or(Wt("")),comment:pe().trim().max(2e3).optional().or(Wt(""))}),mL=({productId:e,userId:t,onSuccess:r})=>{const[n,s]=m.useState(5),[a,o]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState(!1),[h,f]=m.useState(!1);m.useEffect(()=>{(async()=>{const{data:b}=await U.from("product_reviews").select("id").eq("product_id",e).eq("user_id",t).maybeSingle();f(!!b)})()},[e,t]);const p=async b=>{b.preventDefault();const g=pL.safeParse({rating:n,title:a,comment:l});if(!g.success)return O.error("Geçersiz veri");d(!0);const{error:w}=await U.from("product_reviews").insert({product_id:e,user_id:t,rating:g.data.rating,title:g.data.title||null,comment:g.data.comment||null});if(d(!1),w){w.code==="23505"?O.error("Bu ürüne zaten yorum yaptınız"):O.error(w.message);return}O.success("Yorumunuz gönderildi"),o(""),c(""),f(!0),r()};return h?i.jsx("div",{className:"border border-border bg-secondary/30 p-6 text-sm",children:"Bu ürün için yorumunuz alındı. Teşekkürler!"}):i.jsxs("form",{onSubmit:p,className:"border border-border bg-card p-6 space-y-4",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Yorum Yaz"}),i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:"text-xs text-foreground/65",children:"Puan:"}),i.jsx(Ga,{value:n,onChange:s})]}),i.jsx("input",{type:"text",value:a,onChange:b=>o(b.target.value),placeholder:"Başlık (opsiyonel)",maxLength:100,className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"}),i.jsx("textarea",{value:l,onChange:b=>c(b.target.value),placeholder:"Deneyiminizi paylaşın...",rows:3,maxLength:2e3,className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"}),i.jsx("button",{type:"submit",disabled:u,className:"btn-ink disabled:opacity-50",children:u?"Gönderiliyor...":"Yorumu Gönder"})]})},gL=mn({customer_name:pe().trim().min(2).max(100),customer_email:pe().trim().email().max(255),customer_phone:pe().trim().min(7).max(20).optional().or(Wt("")),shipping_address_line1:pe().trim().min(3).max(200),shipping_address_line2:pe().trim().max(200).optional().or(Wt("")),shipping_city:pe().trim().min(2).max(100),shipping_state:pe().trim().max(100).optional().or(Wt("")),shipping_postal_code:pe().trim().min(3).max(20),notes:pe().trim().max(500).optional().or(Wt(""))}),yL=()=>{const e=xr(),{items:t,total:r,clear:n}=pl(),{user:s,loading:a}=Hr(),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,h]=m.useState(null),[f,p]=m.useState(!1),[b,g]=m.useState([]),[w,y]=m.useState(""),[v,x]=m.useState(!1),[_,j]=m.useState("Ev"),[S,C]=m.useState({customer_name:"",customer_email:"",customer_phone:"",shipping_address_line1:"",shipping_address_line2:"",shipping_city:"",shipping_state:"",shipping_postal_code:"",notes:""}),k=N=>{C(M=>({...M,customer_name:N.full_name??M.customer_name,customer_phone:N.phone??M.customer_phone,shipping_address_line1:N.address_line1??"",shipping_address_line2:N.address_line2??"",shipping_city:N.city??"",shipping_state:N.state??"",shipping_postal_code:N.postal_code??""}))};m.useEffect(()=>{s!=null&&s.email&&(C(N=>({...N,customer_email:s.email??""})),(async()=>{const{data:N}=await U.from("addresses").select("*").eq("user_id",s.id).order("is_default",{ascending:!1}).order("created_at",{ascending:!1}),M=N??[];g(M);const I=M.find(z=>z.is_default)??M[0];if(I)y(I.id),k(I);else{const{data:z}=await U.from("profiles").select("full_name, phone").eq("user_id",s.id).maybeSingle();z&&C(E=>({...E,customer_name:z.full_name??E.customer_name,customer_phone:z.phone??E.customer_phone}))}})())},[s]),m.useEffect(()=>{!a&&!s&&(O.info("Sipariş için giriş yapın"),e("/giris?redirect=/odeme",{replace:!0}))},[s,a,e]),m.useEffect(()=>{t.length===0&&!o&&e("/urunler",{replace:!0})},[t,e,o]);const A=r>=4e3?0:49,P=(d==null?void 0:d.discount_amount)??0,$=Math.max(0,r+A-P),R=async()=>{const N=c.trim().toUpperCase();if(N){p(!0);try{const{data:M,error:I}=await U.rpc("validate_coupon",{_code:N});if(I)throw I;const z=Array.isArray(M)?M[0]:null;if(!z){O.error("Geçersiz veya süresi dolmuş kupon kodu");return}if(z.expires_at&&new Date(z.expires_at)<new Date){O.error("Kuponun süresi dolmuş");return}if(z.max_uses&&z.used_count>=z.max_uses){O.error("Kupon kullanım limiti dolmuş");return}if(Number(z.min_subtotal)>r){O.error(`Minimum sepet tutarı: ${ye(Number(z.min_subtotal))}`);return}const E=z.discount_type==="percent"?r*Number(z.discount_value)/100:Number(z.discount_value);h({code:z.code,discount_type:z.discount_type,discount_value:Number(z.discount_value),discount_amount:Math.min(E,r)}),O.success(`Kupon uygulandı: ${z.code}`),u("")}catch(M){O.error(M.message)}finally{p(!1)}}},H=async N=>{N.preventDefault();const M=gL.safeParse(S);if(!M.success){O.error(M.error.issues[0].message);return}l(!0);try{const{data:I,error:z}=await U.from("orders").insert({user_id:(s==null?void 0:s.id)??null,customer_name:M.data.customer_name,customer_email:M.data.customer_email,customer_phone:M.data.customer_phone||null,shipping_address_line1:M.data.shipping_address_line1,shipping_address_line2:M.data.shipping_address_line2||null,shipping_city:M.data.shipping_city,shipping_state:M.data.shipping_state||null,shipping_postal_code:M.data.shipping_postal_code,shipping_country:"TR",notes:M.data.notes||null,subtotal:r,shipping_cost:A,tax:0,discount_amount:P,coupon_code:(d==null?void 0:d.code)??null,total:$,currency:"TRY"}).select().single();if(z)throw z;const{error:E}=await U.from("order_items").insert(t.map(T=>({order_id:I.id,product_id:T.product_id,product_name:T.name,product_image:T.image,quantity:T.quantity,unit_price:T.price,subtotal:T.price*T.quantity})));if(E)throw E;v&&s&&await U.from("addresses").insert({user_id:s.id,label:_.trim()||"Adresim",full_name:M.data.customer_name,phone:M.data.customer_phone||null,address_line1:M.data.shipping_address_line1,address_line2:M.data.shipping_address_line2||null,city:M.data.shipping_city,state:M.data.shipping_state||null,postal_code:M.data.shipping_postal_code,country:"TR",is_default:b.length===0}),n(),e("/odeme/kart",{state:{orderId:I.id}})}catch(I){O.error(I.message??"Sipariş oluşturulamadı"),l(!1)}};return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-12 md:py-20",children:[i.jsxs("div",{className:"text-center mb-12",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3",children:"Ödeme"}),i.jsx("h1",{className:"display-text text-3xl md:text-4xl font-extralight",children:"Sipariş Tamamla"})]}),i.jsxs("form",{onSubmit:H,className:"grid lg:grid-cols-3 gap-12",children:[i.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[i.jsxs("section",{className:"space-y-4",children:[i.jsx("h2",{className:"display-text text-lg font-extralight border-b border-border pb-3",children:"İletişim Bilgileri"}),i.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[i.jsx(Sn,{label:"Ad Soyad",required:!0,value:S.customer_name,onChange:N=>C({...S,customer_name:N})}),i.jsx(Sn,{label:"E-posta",type:"email",required:!0,value:S.customer_email,onChange:N=>C({...S,customer_email:N})}),i.jsx(Sn,{label:"Telefon",value:S.customer_phone,onChange:N=>C({...S,customer_phone:N})})]})]}),i.jsxs("section",{className:"space-y-4",children:[i.jsx("h2",{className:"display-text text-lg font-extralight border-b border-border pb-3",children:"Teslimat Adresi"}),b.length>0&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Kayıtlı Adresler"}),i.jsxs("select",{value:w,onChange:N=>{const M=N.target.value;if(y(M),M==="new")C(I=>({...I,shipping_address_line1:"",shipping_address_line2:"",shipping_city:"",shipping_state:"",shipping_postal_code:""}));else{const I=b.find(z=>z.id===M);I&&k(I),x(!1)}},className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground",children:[b.map(N=>i.jsxs("option",{value:N.id,children:[N.label," — ",N.address_line1,", ",N.city]},N.id)),i.jsx("option",{value:"new",children:"+ Yeni adres gir"})]})]}),i.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[i.jsx("div",{className:"sm:col-span-2",children:i.jsx(Sn,{label:"Adres",required:!0,value:S.shipping_address_line1,onChange:N=>C({...S,shipping_address_line1:N})})}),i.jsx("div",{className:"sm:col-span-2",children:i.jsx(Sn,{label:"Adres 2 (opsiyonel)",value:S.shipping_address_line2,onChange:N=>C({...S,shipping_address_line2:N})})}),i.jsx(Sn,{label:"Şehir",required:!0,value:S.shipping_city,onChange:N=>C({...S,shipping_city:N})}),i.jsx(Sn,{label:"İlçe / Eyalet",value:S.shipping_state,onChange:N=>C({...S,shipping_state:N})}),i.jsx(Sn,{label:"Posta Kodu",required:!0,value:S.shipping_postal_code,onChange:N=>C({...S,shipping_postal_code:N})})]}),s&&(w==="new"||b.length===0)&&i.jsxs("div",{className:"border border-border bg-secondary/30 p-3 space-y-2",children:[i.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[i.jsx("input",{type:"checkbox",checked:v,onChange:N=>x(N.target.checked),className:"h-4 w-4"}),"Bu adresi hesabıma kaydet"]}),v&&i.jsx("input",{type:"text",value:_,onChange:N=>j(N.target.value),placeholder:"Adres etiketi (Ev, İş, vb.)",maxLength:50,className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"})]})]}),i.jsxs("section",{className:"space-y-4",children:[i.jsx("h2",{className:"display-text text-lg font-extralight border-b border-border pb-3",children:"Notlar"}),i.jsx("textarea",{value:S.notes,onChange:N=>C({...S,notes:N.target.value}),rows:3,className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground",placeholder:"Sipariş notunuz (opsiyonel)"})]})]}),i.jsx("aside",{className:"lg:col-span-1",children:i.jsxs("div",{className:"bg-secondary/40 p-6 space-y-4 sticky top-24",children:[i.jsx("h2",{className:"display-text text-lg font-extralight border-b border-border pb-3",children:"Sipariş Özeti"}),i.jsx("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:t.map(N=>i.jsxs("div",{className:"flex justify-between text-sm gap-3",children:[i.jsxs("span",{className:"truncate flex-1",children:[N.name," ",i.jsxs("span",{className:"text-foreground/60",children:["× ",N.quantity]})]}),i.jsx("span",{children:ye(N.price*N.quantity)})]},N.product_id))}),i.jsx("div",{className:"border-t border-border pt-4",children:d?i.jsxs("div",{className:"flex items-center justify-between bg-background border border-border px-3 py-2 text-sm",children:[i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(wR,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"font-mono",children:d.code})]}),i.jsx("button",{type:"button",onClick:()=>h(null),className:"text-foreground/55 hover:text-foreground",children:i.jsx(ds,{className:"h-4 w-4"})})]}):i.jsxs("div",{className:"flex gap-2",children:[i.jsx("input",{type:"text",value:c,onChange:N=>u(N.target.value),placeholder:"İndirim kodu",className:"flex-1 border border-border bg-background px-3 py-2 text-xs uppercase focus:outline-none focus:border-foreground"}),i.jsx("button",{type:"button",onClick:R,disabled:f||!c,className:"px-4 text-[10px] uppercase tracking-[0.2em] bg-foreground text-background disabled:opacity-50",children:f?"...":"Uygula"})]})}),i.jsxs("div",{className:"border-t border-border pt-4 space-y-2 text-sm",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Ara Toplam"}),i.jsx("span",{children:ye(r)})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Kargo"}),i.jsx("span",{children:A===0?"Ücretsiz":ye(A)})]}),P>0&&i.jsxs("div",{className:"flex justify-between text-foreground/80",children:[i.jsx("span",{children:"İndirim"}),i.jsxs("span",{children:["−",ye(P)]})]}),i.jsxs("div",{className:"flex justify-between text-base pt-2 border-t border-border",children:[i.jsx("span",{className:"uppercase tracking-[0.2em] text-[11px]",children:"Toplam"}),i.jsx("span",{children:ye($)})]})]}),i.jsx("button",{type:"submit",disabled:o||t.length===0,className:"btn-ink w-full disabled:opacity-50",children:o?"İşleniyor...":"Ödemeye Geç"}),i.jsx("p",{className:"text-[10px] text-foreground/55 text-center",children:"Güvenli ödeme PayTR altyapısı ile gerçekleşir. Tek çekim ve taksit seçenekleri mevcuttur."})]})})]})]}),i.jsx(Ye,{})]})},Sn=({label:e,value:t,onChange:r,type:n="text",required:s})=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:[e," ",s&&i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx("input",{type:n,required:s,value:t,onChange:a=>r(a.target.value),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground transition-colors"})]}),vL=()=>{var u;const e=xr(),t=Ur(),[r,n]=m.useState(null),[s,a]=m.useState(!0),[o,l]=m.useState(null),c=(u=t.state)==null?void 0:u.orderId;return m.useEffect(()=>{if(!c){e("/odeme",{replace:!0});return}(async()=>{try{const{data:d,error:h}=await U.functions.invoke("paytr-create-payment",{body:{order_id:c,test_mode:!1}});if(h)throw h;if(!(d!=null&&d.token))throw new Error((d==null?void 0:d.error)??"Token alınamadı");n(d.token)}catch(d){const h=(d==null?void 0:d.message)??"Ödeme başlatılamadı";l(h),O.error(h)}finally{a(!1)}})()},[c,e]),m.useEffect(()=>{if(!r)return;const d=document.createElement("script");return d.src="https://www.paytr.com/js/iframeResizer.min.js",d.async=!0,d.onload=()=>{window.iFrameResize&&window.iFrameResize({},"#paytriframe")},document.body.appendChild(d),()=>{document.body.removeChild(d)}},[r]),i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-12 md:py-20",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3",children:"Güvenli Ödeme"}),i.jsx("h1",{className:"display-text text-3xl md:text-4xl font-extralight",children:"Kart ile Ödeme"})]}),s&&i.jsx("p",{className:"text-center text-sm text-foreground/65",children:"Ödeme sayfası hazırlanıyor..."}),o&&i.jsxs("div",{className:"max-w-md mx-auto text-center space-y-4",children:[i.jsx("p",{className:"text-sm text-destructive",children:o}),i.jsx("button",{onClick:()=>e("/odeme"),className:"btn-ink",children:"Ödeme sayfasına dön"})]}),r&&i.jsx("div",{className:"max-w-2xl mx-auto",children:i.jsx("iframe",{id:"paytriframe",src:`https://www.paytr.com/odeme/guvenli/${r}`,frameBorder:0,scrolling:"no",style:{width:"100%",minHeight:600}})})]}),i.jsx(Ye,{})]})},xL=()=>{const[e]=Bu(),t=xr(),r=e.get("oid"),[n,s]=m.useState(null);return m.useEffect(()=>{if(!r)return;let a=0;const o=async()=>{a++;const{data:l}=await U.from("orders").select("order_number, payment_status").eq("paytr_merchant_oid",r).maybeSingle();if(l!=null&&l.order_number){s(l.order_number),setTimeout(()=>t(`/siparis-onayi/${l.order_number}`,{replace:!0}),1200);return}a<8&&setTimeout(o,1e3)};o()},[r,t]),i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-20 text-center",children:[i.jsx(Yu,{className:"h-16 w-16 mx-auto text-foreground mb-6"}),i.jsx("h1",{className:"display-text text-3xl md:text-4xl font-extralight mb-4",children:"Ödemeniz Alındı"}),i.jsx("p",{className:"text-sm text-foreground/65",children:"Sipariş bilgileriniz hazırlanıyor, yönlendiriliyorsunuz..."})]}),i.jsx(Ye,{})]})},bL=()=>i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-20 text-center space-y-6",children:[i.jsx(Ju,{className:"h-16 w-16 mx-auto text-destructive"}),i.jsx("h1",{className:"display-text text-3xl md:text-4xl font-extralight",children:"Ödeme Tamamlanamadı"}),i.jsx("p",{className:"text-sm text-foreground/65 max-w-md mx-auto",children:"Ödemeniz işlenemedi. Lütfen tekrar deneyin veya farklı bir kart kullanın. Hesabınızdan herhangi bir tahsilat yapılmadı."}),i.jsxs("div",{className:"flex justify-center gap-3",children:[i.jsx(ue,{to:"/odeme",className:"btn-ink",children:"Tekrar Dene"}),i.jsx(ue,{to:"/sepet",className:"text-xs uppercase tracking-[0.25em] underline",children:"Sepete Dön"})]})]}),i.jsx(Ye,{})]}),wL=()=>{const{orderNumber:e}=cm(),[t,r]=m.useState(null),[n,s]=m.useState([]),[a,o]=m.useState(!0);return m.useEffect(()=>{(async()=>{if(!e)return;const{data:c}=await U.from("orders").select("id, subtotal, shipping_cost, tax, discount_amount, total, currency").eq("order_number",e).maybeSingle();if(c){r(c);const{data:u}=await U.from("order_items").select("id, product_name, product_image, quantity, unit_price, subtotal").eq("order_id",c.id);s(u||[])}o(!1)})()},[e]),i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsx("main",{className:"flex-1 container-editorial py-20",children:i.jsxs("div",{className:"max-w-2xl mx-auto space-y-10",children:[i.jsxs("div",{className:"text-center space-y-6",children:[i.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-foreground text-background flex items-center justify-center",children:i.jsx(Gu,{className:"h-7 w-7"})}),i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Teşekkürler"}),i.jsx("h1",{className:"display-text text-3xl md:text-4xl font-extralight",children:"Siparişiniz Alındı"}),i.jsx("p",{className:"editorial-serif text-lg text-foreground/70",children:"Sipariş numaranız:"}),i.jsx("p",{className:"text-xl font-light tracking-widest",children:e}),i.jsx("p",{className:"text-sm text-foreground/65",children:"Sipariş detayları e-posta adresinize gönderilecektir. Hazırlık ve kargo süreci başladığında sizi bilgilendireceğiz."})]}),a?i.jsx("p",{className:"text-center text-sm text-foreground/55",children:"Yükleniyor..."}):t?i.jsxs("div",{className:"border border-border p-6 md:p-8 space-y-6",children:[i.jsx("h2",{className:"text-[11px] uppercase tracking-[0.25em] text-foreground/60",children:"Sipariş Özeti"}),i.jsx("div",{className:"space-y-4",children:n.map(l=>i.jsxs("div",{className:"flex gap-4 border-b border-border/50 pb-4 last:border-0",children:[i.jsx("div",{className:"w-16 h-20 bg-secondary flex-shrink-0 overflow-hidden",children:l.product_image&&i.jsx("img",{src:l.product_image,alt:l.product_name,className:"w-full h-full object-cover"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h3",{className:"text-sm font-light",children:l.product_name}),i.jsxs("p",{className:"text-xs text-foreground/60 mt-1",children:[l.quantity," × ",ye(Number(l.unit_price))]})]}),i.jsx("div",{className:"text-sm font-light",children:ye(Number(l.subtotal))})]},l.id))}),i.jsxs("div",{className:"space-y-2 pt-2 text-sm",children:[i.jsxs("div",{className:"flex justify-between text-foreground/70",children:[i.jsx("span",{children:"Ara Toplam"}),i.jsx("span",{children:ye(Number(t.subtotal))})]}),Number(t.discount_amount)>0&&i.jsxs("div",{className:"flex justify-between text-foreground/70",children:[i.jsx("span",{children:"İndirim"}),i.jsxs("span",{children:["-",ye(Number(t.discount_amount))]})]}),i.jsxs("div",{className:"flex justify-between text-foreground/70",children:[i.jsx("span",{children:"Kargo"}),i.jsx("span",{children:Number(t.shipping_cost)===0?"Ücretsiz":ye(Number(t.shipping_cost))})]}),Number(t.tax)>0&&i.jsxs("div",{className:"flex justify-between text-foreground/70",children:[i.jsx("span",{children:"KDV"}),i.jsx("span",{children:ye(Number(t.tax))})]}),i.jsxs("div",{className:"flex justify-between pt-3 border-t border-border text-base font-light",children:[i.jsx("span",{className:"uppercase tracking-[0.2em] text-[11px]",children:"Toplam"}),i.jsx("span",{children:ye(Number(t.total))})]})]})]}):null,i.jsx("div",{className:"text-center pt-2",children:i.jsx(ue,{to:"/urunler",className:"btn-outline-ink",children:"Alışverişe Devam Et"})})]})}),i.jsx(Ye,{})]})};var yd="Tabs",[_L,M$]=Fr(yd,[hd]),$1=hd(),[kL,Wm]=_L(yd),z1=m.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:a,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=$m(l),[h,f]=ul({prop:n,onChange:s,defaultProp:a??"",caller:yd});return i.jsx(kL,{scope:r,baseId:Is(),value:h,onValueChange:f,orientation:o,dir:d,activationMode:c,children:i.jsx(xe.div,{dir:d,"data-orientation":o,...u,ref:t})})});z1.displayName=yd;var U1="TabsList",F1=m.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,a=Wm(U1,r),o=$1(r);return i.jsx(Lk,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:i.jsx(xe.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});F1.displayName=U1;var B1="TabsTrigger",H1=m.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...a}=e,o=Wm(B1,r),l=$1(r),c=q1(o.baseId,n),u=W1(o.baseId,n),d=n===o.value;return i.jsx($k,{asChild:!0,...l,focusable:!s,active:d,children:i.jsx(xe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...a,ref:t,onMouseDown:X(e.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(n):h.preventDefault()}),onKeyDown:X(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(n)}),onFocus:X(e.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!s&&h&&o.onValueChange(n)})})})});H1.displayName=B1;var V1="TabsContent",K1=m.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:a,...o}=e,l=Wm(V1,r),c=q1(l.baseId,n),u=W1(l.baseId,n),d=n===l.value,h=m.useRef(d);return m.useEffect(()=>{const f=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(f)},[]),i.jsx(br,{present:s||d,children:({present:f})=>i.jsx(xe.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:f&&a})})});K1.displayName=V1;function q1(e,t){return`${e}-trigger-${t}`}function W1(e,t){return`${e}-content-${t}`}var jL=z1,G1=F1,Y1=H1,J1=K1;const Z1=jL,Gm=m.forwardRef(({className:e,...t},r)=>i.jsx(G1,{ref:r,className:de("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Gm.displayName=G1.displayName;const Vn=m.forwardRef(({className:e,...t},r)=>i.jsx(Y1,{ref:r,className:de("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));Vn.displayName=Y1.displayName;const Kn=m.forwardRef(({className:e,...t},r)=>i.jsx(J1,{ref:r,className:de("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Kn.displayName=J1.displayName;const Ai=Mm,vd=Ek,SL=Lm,Q1=m.forwardRef(({className:e,...t},r)=>i.jsx(ml,{ref:r,className:de("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}));Q1.displayName=ml.displayName;const Js=m.forwardRef(({className:e,children:t,...r},n)=>i.jsxs(SL,{children:[i.jsx(Q1,{}),i.jsxs(gl,{ref:n,className:de("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),...r,children:[t,i.jsxs(dd,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[i.jsx(ds,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Js.displayName=gl.displayName;const Zs=({className:e,...t})=>i.jsx("div",{className:de("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Zs.displayName="DialogHeader";const Qs=m.forwardRef(({className:e,...t},r)=>i.jsx(yl,{ref:r,className:de("text-lg font-semibold leading-none tracking-tight",e),...t}));Qs.displayName=yl.displayName;const NL=m.forwardRef(({className:e,...t},r)=>i.jsx(vl,{ref:r,className:de("text-sm text-muted-foreground",e),...t}));NL.displayName=vl.displayName;const EL=["pending","paid","processing"],ax={pending:"Beklemede",approved:"Onaylandı",rejected:"Reddedildi"},CL={pending:"Beklemede",paid:"Ödendi",processing:"Hazırlanıyor",shipped:"Kargoda",delivered:"Teslim Edildi",cancelled:"İptal",refunded:"İade"},TL=()=>{const{user:e,loading:t,session:r}=Hr(),[n,s]=m.useState("info");return t?i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}):e?i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-12 md:py-16",children:[i.jsxs("div",{className:"text-center mb-10",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3",children:"Hesabım"}),i.jsx("h1",{className:"display-text text-3xl md:text-4xl font-extralight",children:"Profilim"}),i.jsx("p",{className:"text-sm text-foreground/60 mt-2",children:e.email})]}),i.jsxs(Z1,{value:n,onValueChange:s,className:"max-w-4xl mx-auto",children:[i.jsxs(Gm,{className:"grid grid-cols-2 sm:grid-cols-4 w-full bg-secondary/40 p-1 rounded-none",children:[i.jsxs(Vn,{value:"info",className:"rounded-none data-[state=active]:bg-background gap-2",children:[i.jsx(If,{className:"h-3.5 w-3.5"})," Bilgilerim"]}),i.jsxs(Vn,{value:"orders",className:"rounded-none data-[state=active]:bg-background gap-2",children:[i.jsx(Zu,{className:"h-3.5 w-3.5"})," Siparişlerim"]}),i.jsxs(Vn,{value:"addresses",className:"rounded-none data-[state=active]:bg-background gap-2",children:[i.jsx(mm,{className:"h-3.5 w-3.5"})," Adreslerim"]}),i.jsxs(Vn,{value:"security",className:"rounded-none data-[state=active]:bg-background gap-2",children:[i.jsx(dR,{className:"h-3.5 w-3.5"})," Güvenlik"]})]}),i.jsx(Kn,{value:"info",className:"mt-8",children:i.jsx(AL,{userId:e.id,email:e.email??""})}),i.jsx(Kn,{value:"orders",className:"mt-8",children:i.jsx(PL,{userId:e.id})}),i.jsx(Kn,{value:"addresses",className:"mt-8",children:i.jsx(IL,{userId:e.id})}),i.jsx(Kn,{value:"security",className:"mt-8",children:i.jsx(ML,{email:e.email??""})})]})]}),i.jsx(Ye,{})]}):i.jsx(Ke,{to:"/giris",replace:!0})},RL=mn({full_name:pe().trim().min(2,"Ad soyad en az 2 karakter olmalı").max(100),phone:pe().trim().max(20).optional().or(Wt(""))}),AL=({userId:e,email:t})=>{const[r,n]=m.useState(null),[s,a]=m.useState(""),[o,l]=m.useState(""),[c,u]=m.useState(!0),[d,h]=m.useState(!1);m.useEffect(()=>{(async()=>{const{data:p}=await U.from("profiles").select("*").eq("user_id",e).maybeSingle();p&&(n(p),a(p.full_name??""),l(p.phone??"")),u(!1)})()},[e]);const f=async p=>{p.preventDefault();const b=RL.safeParse({full_name:s,phone:o});if(!b.success){O.error(b.error.issues[0].message);return}h(!0);try{if(r){const{error:g}=await U.from("profiles").update({full_name:b.data.full_name,phone:b.data.phone||null}).eq("user_id",e);if(g)throw g}else{const{error:g}=await U.from("profiles").insert({user_id:e,full_name:b.data.full_name,phone:b.data.phone||null});if(g)throw g}O.success("Bilgileriniz güncellendi")}catch(g){O.error(g.message)}finally{h(!1)}};return c?i.jsx(Ym,{}):i.jsxs("form",{onSubmit:f,className:"border border-border bg-card p-6 md:p-8 space-y-5 max-w-xl",children:[i.jsx(Tt,{label:"E-posta",value:t,disabled:!0,onChange:()=>{}}),i.jsx(Tt,{label:"Ad Soyad",value:s,onChange:a,required:!0}),i.jsx(Tt,{label:"Telefon",value:o,onChange:l}),i.jsx("button",{type:"submit",disabled:d,className:"btn-ink disabled:opacity-50",children:d?"Kaydediliyor...":"Kaydet"})]})},PL=({userId:e})=>{const[t,r]=m.useState([]),[n,s]=m.useState(!0),[a,o]=m.useState(null),[l,c]=m.useState(""),[u,d]=m.useState(!1),h=async()=>{const{data:p,error:b}=await U.from("orders").select("*, order_items(*), return_requests(id, status, reason, admin_notes, updated_at)").eq("user_id",e).neq("payment_status","pending").order("created_at",{ascending:!1});b&&O.error(b.message),r(p??[]),s(!1)};m.useEffect(()=>{h()},[e]);const f=async()=>{if(!a)return;if(l.trim().length<10){O.error("Lütfen iade sebebini en az 10 karakter ile açıklayın");return}d(!0);const{error:p}=await U.from("return_requests").insert({order_id:a.id,user_id:e,reason:l.trim(),status:"pending"});if(d(!1),p)return O.error(p.message);O.success("İade isteğiniz alındı"),o(null),c(""),h()};return n?i.jsx(Ym,{}):t.length===0?i.jsxs("div",{className:"border border-dashed border-border p-12 text-center",children:[i.jsx(Zu,{className:"h-8 w-8 mx-auto text-foreground/40 mb-3"}),i.jsx("p",{className:"text-foreground/60 mb-4",children:"Henüz hiç siparişiniz yok"}),i.jsx(ue,{to:"/urunler",className:"btn-ink inline-block",children:"Alışverişe Başla"})]}):i.jsxs("div",{className:"space-y-4",children:[t.map(p=>{const b=p.return_requests,g=Array.isArray(b)?b[0]:b??void 0,w=EL.includes(p.status)&&!g;return i.jsxs("div",{className:"border border-border bg-card",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 p-4 border-b border-border bg-secondary/30",children:[i.jsxs("div",{children:[i.jsxs("p",{className:"font-light text-sm",children:["Sipariş ",i.jsx("span",{className:"font-normal",children:p.order_number})]}),i.jsx("p",{className:"text-xs text-foreground/55 mt-0.5",children:new Date(p.created_at).toLocaleDateString("tr-TR",{day:"2-digit",month:"long",year:"numeric"})})]}),i.jsxs("div",{className:"flex items-center gap-3",children:[g&&i.jsxs("span",{className:`text-[10px] uppercase tracking-[0.2em] px-2 py-1 font-medium ${g.status==="approved"?"bg-green-100 text-green-800":g.status==="rejected"?"bg-red-100 text-red-800":"bg-yellow-100 text-yellow-800"}`,children:["İade ",ax[g.status]??g.status]}),i.jsx("span",{className:"text-[10px] uppercase tracking-[0.2em] px-2 py-1 bg-foreground/10",children:CL[p.status]??p.status}),i.jsx("span",{className:"text-sm font-light",children:ye(Number(p.total))})]})]}),i.jsxs("div",{className:"p-4 space-y-3",children:[p.order_items.map(y=>i.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[y.product_image&&i.jsx("img",{src:y.product_image,alt:"",className:"w-12 h-14 object-cover"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:"font-light truncate",children:y.product_name}),i.jsxs("p",{className:"text-xs text-foreground/55",children:[y.quantity," × ",ye(Number(y.unit_price))]})]}),i.jsx("span",{className:"text-sm",children:ye(Number(y.subtotal))})]},y.id)),i.jsxs("p",{className:"text-xs text-foreground/55 pt-2 border-t border-border mt-3",children:["Teslimat: ",p.shipping_address_line1,", ",p.shipping_city]}),i.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 pt-2",children:[g?i.jsxs("div",{className:"flex flex-col gap-1 text-xs",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-foreground/70",children:"İade İsteği:"}),i.jsx("span",{className:`text-[10px] uppercase tracking-[0.2em] px-2 py-1 font-medium ${g.status==="approved"?"bg-green-100 text-green-800":g.status==="rejected"?"bg-red-100 text-red-800":"bg-yellow-100 text-yellow-800"}`,children:ax[g.status]??g.status})]}),g.admin_notes&&i.jsxs("p",{className:"text-foreground/70 mt-1",children:[i.jsx("span",{className:"font-medium",children:"Yönetici notu:"})," ",g.admin_notes]})]}):i.jsx("span",{}),w?i.jsx("button",{onClick:()=>{o(p),c("")},className:"text-xs border border-border px-3 py-1.5 hover:bg-secondary/50 transition-colors",children:"İade İsteği Gönder"}):g?i.jsx("span",{className:"text-xs text-foreground/55 border border-border px-3 py-1.5 bg-secondary/30",children:"İade İsteği Gönderildi"}):null]})]})]},p.id)}),i.jsx(Ai,{open:!!a,onOpenChange:p=>!p&&o(null),children:i.jsxs(Js,{children:[i.jsx(Zs,{children:i.jsxs(Qs,{children:["İade İsteği — ",a==null?void 0:a.order_number]})}),i.jsxs("div",{className:"space-y-3 mt-2",children:[i.jsx("p",{className:"text-xs text-foreground/60",children:"İade isteğiniz yalnızca sipariş kargoya verilmeden önce gönderilebilir. Lütfen sebebinizi açıklayın."}),i.jsx("textarea",{value:l,onChange:p=>c(p.target.value),rows:5,maxLength:1e3,placeholder:"İade sebebiniz...",className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"}),i.jsx("button",{onClick:f,disabled:u,className:"btn-ink w-full disabled:opacity-50",children:u?"Gönderiliyor...":"Gönder"})]})]})})]})},OL=mn({label:pe().trim().min(1).max(50),full_name:pe().trim().min(2).max(100),phone:pe().trim().max(20).optional().or(Wt("")),address_line1:pe().trim().min(3).max(200),address_line2:pe().trim().max(200).optional().or(Wt("")),city:pe().trim().min(2).max(100),state:pe().trim().max(100).optional().or(Wt("")),postal_code:pe().trim().min(3).max(20),country:pe().trim().min(2).max(2),is_default:XM()}),ix={label:"Ev",full_name:"",phone:"",address_line1:"",address_line2:"",city:"",state:"",postal_code:"",country:"TR",is_default:!1},IL=({userId:e})=>{const[t,r]=m.useState([]),[n,s]=m.useState(!0),[a,o]=m.useState(!1),[l,c]=m.useState(null),[u,d]=m.useState(ix),[h,f]=m.useState(!1),p=async()=>{s(!0);const{data:x}=await U.from("addresses").select("*").eq("user_id",e).order("is_default",{ascending:!1}).order("created_at",{ascending:!1});r(x??[]),s(!1)};m.useEffect(()=>{p()},[e]);const b=()=>{c(null),d({...ix,is_default:t.length===0}),o(!0)},g=x=>{c(x),d({label:x.label,full_name:x.full_name,phone:x.phone??"",address_line1:x.address_line1,address_line2:x.address_line2??"",city:x.city,state:x.state??"",postal_code:x.postal_code,country:x.country,is_default:x.is_default}),o(!0)},w=async x=>{x.preventDefault();const _=OL.safeParse(u);if(!_.success){O.error(_.error.issues[0].message);return}f(!0);try{const j={label:_.data.label,full_name:_.data.full_name,phone:_.data.phone||null,address_line1:_.data.address_line1,address_line2:_.data.address_line2||null,city:_.data.city,state:_.data.state||null,postal_code:_.data.postal_code,country:_.data.country,is_default:_.data.is_default};if(l){const{error:S}=await U.from("addresses").update(j).eq("id",l.id);if(S)throw S;O.success("Adres güncellendi")}else{const{error:S}=await U.from("addresses").insert({...j,user_id:e});if(S)throw S;O.success("Adres eklendi")}o(!1),p()}catch(j){O.error(j.message)}finally{f(!1)}},y=async x=>{if(!confirm("Adresi sil?"))return;const{error:_}=await U.from("addresses").delete().eq("id",x);if(_)return O.error(_.message);O.success("Silindi"),p()},v=async x=>{const{error:_}=await U.from("addresses").update({is_default:!0}).eq("id",x);if(_)return O.error(_.message);p()};return n?i.jsx(Ym,{}):i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex justify-end",children:i.jsxs(Ai,{open:a,onOpenChange:o,children:[i.jsx(vd,{asChild:!0,children:i.jsxs("button",{onClick:b,className:"btn-ink flex items-center gap-2",children:[i.jsx(qs,{className:"h-4 w-4"})," Yeni Adres"]})}),i.jsxs(Js,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[i.jsx(Zs,{children:i.jsx(Qs,{children:l?"Adresi Düzenle":"Yeni Adres"})}),i.jsxs("form",{onSubmit:w,className:"space-y-4 mt-4",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Tt,{label:"Etiket",required:!0,value:u.label,onChange:x=>d({...u,label:x})}),i.jsx(Tt,{label:"Ad Soyad",required:!0,value:u.full_name,onChange:x=>d({...u,full_name:x})})]}),i.jsx(Tt,{label:"Telefon",value:u.phone,onChange:x=>d({...u,phone:x})}),i.jsx(Tt,{label:"Adres",required:!0,value:u.address_line1,onChange:x=>d({...u,address_line1:x})}),i.jsx(Tt,{label:"Adres 2 (opsiyonel)",value:u.address_line2,onChange:x=>d({...u,address_line2:x})}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(Tt,{label:"Şehir",required:!0,value:u.city,onChange:x=>d({...u,city:x})}),i.jsx(Tt,{label:"İlçe",value:u.state,onChange:x=>d({...u,state:x})})]}),i.jsx(Tt,{label:"Posta Kodu",required:!0,value:u.postal_code,onChange:x=>d({...u,postal_code:x})}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"checkbox",checked:u.is_default,onChange:x=>d({...u,is_default:x.target.checked})}),"Varsayılan adres olarak ayarla"]}),i.jsx("button",{type:"submit",disabled:h,className:"btn-ink w-full disabled:opacity-50",children:h?"Kaydediliyor...":l?"Güncelle":"Ekle"})]})]})]})}),t.length===0?i.jsxs("div",{className:"border border-dashed border-border p-12 text-center",children:[i.jsx(mm,{className:"h-8 w-8 mx-auto text-foreground/40 mb-3"}),i.jsx("p",{className:"text-foreground/60",children:"Henüz kayıtlı adresiniz yok"})]}):i.jsx("div",{className:"grid sm:grid-cols-2 gap-4",children:t.map(x=>i.jsxs("div",{className:"border border-border bg-card p-5 space-y-2 relative",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.2em] px-2 py-1 bg-foreground/10",children:x.label}),x.is_default&&i.jsx("span",{className:"text-[10px] uppercase tracking-[0.2em] px-2 py-1 bg-accent",children:"Varsayılan"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:()=>g(x),"aria-label":"Düzenle",className:"text-foreground/60 hover:text-foreground",children:i.jsx(Qu,{className:"h-4 w-4"})}),i.jsx("button",{onClick:()=>y(x.id),"aria-label":"Sil",className:"text-foreground/60 hover:text-destructive",children:i.jsx(Ws,{className:"h-4 w-4"})})]})]}),i.jsx("p",{className:"text-sm font-light",children:x.full_name}),x.phone&&i.jsx("p",{className:"text-xs text-foreground/65",children:x.phone}),i.jsxs("p",{className:"text-sm text-foreground/75",children:[x.address_line1,x.address_line2&&`, ${x.address_line2}`]}),i.jsxs("p",{className:"text-sm text-foreground/75",children:[x.city,x.state&&`, ${x.state}`," ",x.postal_code]}),!x.is_default&&i.jsx("button",{onClick:()=>v(x.id),className:"text-[10px] uppercase tracking-[0.2em] text-foreground/60 hover:text-foreground pt-2",children:"Varsayılan yap →"})]},x.id))})]})},DL=mn({password:pe().min(8,"Şifre en az 8 karakter olmalı").max(72),confirm:pe()}).refine(e=>e.password===e.confirm,{message:"Şifreler eşleşmiyor",path:["confirm"]}),ML=({email:e})=>{const[t,r]=m.useState(""),[n,s]=m.useState(""),[a,o]=m.useState(!1),[l,c]=m.useState(!1),u=async h=>{h.preventDefault();const f=DL.safeParse({password:t,confirm:n});if(!f.success){O.error(f.error.issues[0].message);return}o(!0);try{const{error:p}=await U.auth.updateUser({password:f.data.password});if(p)throw p;O.success("Şifreniz güncellendi"),r(""),s("")}catch(p){O.error(p.message)}finally{o(!1)}},d=async()=>{c(!0);try{const{error:h}=await U.auth.resetPasswordForEmail(e,{redirectTo:`${window.location.origin}/giris/dogrulama`});if(h)throw h;O.success("Sıfırlama linki e-postanıza gönderildi")}catch(h){O.error(h.message)}finally{c(!1)}};return i.jsxs("div",{className:"space-y-6 max-w-xl",children:[i.jsxs("form",{onSubmit:u,className:"border border-border bg-card p-6 md:p-8 space-y-5",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"display-text text-lg font-extralight",children:"Şifreyi Değiştir"}),i.jsx("p",{className:"text-xs text-foreground/60 mt-1",children:"En az 8 karakter olmalı"})]}),i.jsx(Tt,{label:"Yeni Şifre",type:"password",value:t,onChange:r,required:!0}),i.jsx(Tt,{label:"Yeni Şifre (Tekrar)",type:"password",value:n,onChange:s,required:!0}),i.jsx("button",{type:"submit",disabled:a,className:"btn-ink disabled:opacity-50",children:a?"Güncelleniyor...":"Şifreyi Güncelle"})]}),i.jsxs("div",{className:"border border-border bg-card p-6 md:p-8 space-y-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"display-text text-lg font-extralight",children:"E-posta ile Sıfırlama"}),i.jsx("p",{className:"text-xs text-foreground/60 mt-1",children:"Mevcut şifrenizi hatırlamıyorsanız, e-postanıza bir sıfırlama linki gönderebiliriz."})]}),i.jsx("button",{type:"button",onClick:d,disabled:l,className:"text-sm border border-border px-5 py-2.5 hover:bg-secondary/50 transition-colors disabled:opacity-50",children:l?"Gönderiliyor...":"Sıfırlama Linki Gönder"})]})]})},Tt=({label:e,value:t,onChange:r,type:n="text",required:s,disabled:a})=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:[e," ",s&&i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx("input",{type:n,required:s,value:t,disabled:a,onChange:o=>r(o.target.value),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground transition-colors disabled:opacity-60 disabled:cursor-not-allowed"})]}),Ym=()=>i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}),LL=mn({password:pe().min(8,"Şifre en az 8 karakter olmalı").max(72),confirm:pe()}).refine(e=>e.password===e.confirm,{message:"Şifreler eşleşmiyor",path:["confirm"]}),$L=()=>{const e=xr(),[t,r]=m.useState(!1),[n,s]=m.useState(""),[a,o]=m.useState(""),[l,c]=m.useState(!1);m.useEffect(()=>{const{data:{subscription:d}}=U.auth.onAuthStateChange(h=>{(h==="PASSWORD_RECOVERY"||h==="SIGNED_IN")&&r(!0)});return U.auth.getSession().then(({data:{session:h}})=>{h&&r(!0)}),()=>d.unsubscribe()},[]);const u=async d=>{d.preventDefault();const h=LL.safeParse({password:n,confirm:a});if(!h.success){O.error(h.error.issues[0].message);return}c(!0);try{const{error:f}=await U.auth.updateUser({password:h.data.password});if(f)throw f;O.success("Şifreniz güncellendi"),e("/hesabim",{replace:!0})}catch(f){O.error(f.message)}finally{c(!1)}};return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsx("main",{className:"flex-1 container-editorial py-16 flex items-start justify-center",children:i.jsxs("div",{className:"w-full max-w-md border border-border bg-card p-8 space-y-6",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"Şifre Sıfırlama"}),i.jsx("h1",{className:"display-text text-2xl font-extralight",children:"Yeni Şifre Belirle"})]}),t?i.jsxs("form",{onSubmit:u,className:"space-y-5",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Yeni Şifre"}),i.jsx("input",{type:"password",required:!0,value:n,onChange:d=>s(d.target.value),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Yeni Şifre (Tekrar)"}),i.jsx("input",{type:"password",required:!0,value:a,onChange:d=>o(d.target.value),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground"})]}),i.jsx("button",{type:"submit",disabled:l,className:"btn-ink w-full disabled:opacity-50",children:l?"Kaydediliyor...":"Şifreyi Güncelle"})]}):i.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"}),i.jsx("p",{className:"text-sm text-foreground/60 text-center",children:"Sıfırlama bağlantısı doğrulanıyor..."})]})]})}),i.jsx(Ye,{})]})},zL=()=>{const{user:e,loading:t}=Hr(),{productIds:r,loading:n}=Rm(),[s,a]=m.useState([]),[o,l]=m.useState(!0);return m.useEffect(()=>{if(!e||n)return;const c=Array.from(r);if(c.length===0){a([]),l(!1);return}U.from("products").select("id, slug, name, price, compare_at_price, images, stock_quantity, categories(name)").in("id",c).eq("active",!0).then(({data:u})=>{a(u??[]),l(!1)})},[e,r,n]),!t&&!e?i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 flex flex-col items-center justify-center text-center py-20 px-6",children:[i.jsx(zo,{className:"h-12 w-12 text-foreground/30 mb-6",strokeWidth:1}),i.jsx("h1",{className:"display-text text-3xl font-extralight mb-4",children:"Favorileriniz"}),i.jsx("p",{className:"text-foreground/65 mb-8 max-w-md",children:"Favorilerinizi kaydetmek ve istediğiniz zaman ulaşmak için giriş yapın."}),i.jsx(ue,{to:"/giris",className:"btn-ink",children:"Giriş Yap"})]}),i.jsx(Ye,{})]}):i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-16 md:py-24",children:[i.jsxs("div",{className:"text-center mb-12 space-y-3",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Sizin için saklanan"}),i.jsx("h1",{className:"display-text text-3xl md:text-5xl font-extralight",children:"Favorilerim"})]}),o||n?i.jsx("p",{className:"text-center text-foreground/60",children:"Yükleniyor..."}):s.length===0?i.jsxs("div",{className:"text-center py-20",children:[i.jsx(zo,{className:"h-12 w-12 text-foreground/25 mx-auto mb-6",strokeWidth:1}),i.jsx("p",{className:"editorial-serif text-xl text-foreground/65 mb-6",children:"Henüz favori ürününüz yok."}),i.jsx(ue,{to:"/urunler",className:"btn-outline-ink",children:"Ürünleri Keşfedin"})]}):i.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-6 md:gap-10",children:s.map(c=>{var u,d;return i.jsx(gd,{id:c.id,slug:c.slug,name:c.name,category:((u=c.categories)==null?void 0:u.name)??"",price:Number(c.price),compareAtPrice:c.compare_at_price?Number(c.compare_at_price):null,image:((d=c.images)==null?void 0:d[0])??mi,stockQuantity:c.stock_quantity},c.id)})})]}),i.jsx(Ye,{})]})},UL=()=>i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ri,{title:"Hakkımızda",description:"DermaRoyal — profesyonel güzellik ve estetik dünyasındaki yılların uzmanlığıyla seçkin dermokozmetik ürünler.",path:"/hakkimizda",jsonLd:{"@context":"https://schema.org","@type":"AboutPage",name:"Hakkımızda — Derma Royal",url:"https://dermaroyal.com/hakkimizda",about:{"@type":"Organization",name:"Derma Royal"}}}),i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-16 md:py-24",children:[i.jsxs("div",{className:"text-center mb-12 space-y-3",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Marka Hikayesi"}),i.jsx("h1",{className:"display-text text-3xl md:text-5xl font-extralight",children:"Hakkımızda"})]}),i.jsxs("div",{className:"max-w-3xl mx-auto space-y-8 mt-16",children:[i.jsx("p",{className:"editorial-serif text-xl leading-relaxed text-foreground/75",children:"DermaRoyal, profesyonel güzellik ve estetik dünyasındaki yıllara dayanan uzmanlığını, kaliteli dermokozmetik ve profesyonel bakım ürünleriyle kullanıcılarla buluşturmak amacıyla kurulmuştur. Akademi Royal'in eğitim ve sektörel tecrübesinden doğan DermaRoyal, yalnızca ürün satan bir marka değil; güzellik profesyonelleri ve bilinçli tüketiciler için güvenilir bir çözüm ortağıdır."}),i.jsx("div",{className:"hairline"}),i.jsx("p",{className:"text-foreground/75 leading-relaxed",children:"20 yılı aşkın sektör deneyimi, binlerce mezun ve profesyonel eğitim altyapısından gelen bilgi birikimimizle; cilt bakımı, medikal estetik, kalıcı makyaj ve profesyonel güzellik uygulamalarında kullanılan seçkin ürünleri sizlerle buluşturuyoruz."}),i.jsx("p",{className:"text-foreground/75 leading-relaxed",children:"Ürün portföyümüzde kalite, etkinlik ve profesyonel standartlar ön plandadır. Her ürün; uzmanlık, deneyim ve sektör ihtiyaçları doğrultusunda özenle seçilir. DermaRoyal'de yalnızca kozmetik değil, sonuç odaklı bakım çözümleri sunulur."}),i.jsx("p",{className:"text-foreground/75 leading-relaxed",children:"Kurucumuz Aslıhan Çoban'ın liderliğinde şekillenen vizyonumuz; güzellik sektörüne yenilik kazandırmak, profesyonelleri doğru ürünlerle desteklemek ve son kullanıcıya güvenilir bakım alternatifleri sunmaktır."}),i.jsx("div",{className:"hairline"}),i.jsxs("p",{className:"editorial-serif text-lg leading-relaxed text-foreground/80 text-center",children:["DermaRoyal olarak inanıyoruz ki güzellik, doğru bilgi ve doğru ürünle başlar.",i.jsx("br",{}),"Bu anlayışla profesyonel kaliteyi herkes için erişilebilir kılıyoruz."]})]})]}),i.jsx(Ye,{})]}),FL=mn({name:pe().trim().min(2,"Ad en az 2 karakter").max(100),email:pe().trim().email("Geçersiz e-posta").max(254),phone:pe().trim().max(30).optional().or(Wt("")),subject:pe().trim().max(200).optional().or(Wt("")),message:pe().trim().min(10,"Mesaj en az 10 karakter").max(2e3)}),BL=()=>{const[e,t]=m.useState(!1),[r,n]=m.useState(!1),[s,a]=m.useState({name:"",email:"",phone:"",subject:"",message:""}),o=async l=>{l.preventDefault();const c=FL.safeParse(s);if(!c.success){O.error(c.error.issues[0].message);return}t(!0);try{const{error:u}=await U.from("contact_messages").insert({name:c.data.name,email:c.data.email.toLowerCase(),phone:c.data.phone||null,subject:c.data.subject||null,message:c.data.message});if(u)throw u;U.functions.invoke("send-order-email",{body:{type:"contact_received",to:c.data.email,data:{customer_name:c.data.name}}}).catch(()=>{}),n(!0),O.success("Mesajınız gönderildi")}catch(u){O.error(u.message??"Mesaj gönderilemedi")}finally{t(!1)}};return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ri,{title:"İletişim",description:"Derma Royal ile iletişime geçin. Sorularınız, önerileriniz veya geri bildirimleriniz için bize yazın.",path:"/iletisim",jsonLd:{"@context":"https://schema.org","@type":"ContactPage",name:"İletişim — Derma Royal",url:"https://dermaroyal.com/iletisim",mainEntity:{"@type":"Organization",name:"Derma Royal",email:"info@dermaroyal.com",telephone:"+90 532 674 85 95",address:{"@type":"PostalAddress",addressLocality:"Girne",addressCountry:"CY"}}}}),i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-16 md:py-24",children:[i.jsxs("div",{className:"text-center mb-12 space-y-3",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Bize Ulaşın"}),i.jsx("h1",{className:"display-text text-3xl md:text-5xl font-extralight",children:"İletişim"}),i.jsx("p",{className:"editorial-serif text-lg text-foreground/65 max-w-xl mx-auto",children:"Sorularınız, önerileriniz veya geri bildirimleriniz için bize yazın."})]}),i.jsxs("div",{className:"grid lg:grid-cols-3 gap-12 max-w-5xl mx-auto",children:[i.jsxs("div",{className:"space-y-8",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Us,{className:"h-5 w-5 text-foreground/60 mb-2",strokeWidth:1.25}),i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"E-posta"}),i.jsx("a",{href:"mailto:info@dermaroyal.com",className:"text-sm text-foreground hover:underline",children:"info@dermaroyal.com"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(yR,{className:"h-5 w-5 text-foreground/60 mb-2",strokeWidth:1.25}),i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Telefon"}),i.jsx("a",{href:"tel:+905326748595",className:"text-sm text-foreground hover:underline block",children:"+90 532 674 85 95"}),i.jsx("p",{className:"text-sm text-foreground/80",children:"Hafta içi 09:00 — 18:00"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(mm,{className:"h-5 w-5 text-foreground/60 mb-2",strokeWidth:1.25}),i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Adres"}),i.jsx("p",{className:"text-sm text-foreground/80",children:"Girne, KKTC"})]})]}),i.jsx("div",{className:"lg:col-span-2",children:r?i.jsxs("div",{className:"bg-secondary/40 p-12 text-center",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-3",children:"Teşekkürler"}),i.jsx("h2",{className:"display-text text-2xl font-extralight mb-4",children:"Mesajınız Alındı"}),i.jsx("p",{className:"text-foreground/65 text-sm",children:"En kısa sürede size dönüş yapacağız. Onay e-postası gönderildi."})]}):i.jsxs("form",{onSubmit:o,className:"space-y-5",children:[i.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[i.jsx(oc,{label:"Ad Soyad",required:!0,value:s.name,onChange:l=>a({...s,name:l})}),i.jsx(oc,{label:"E-posta",type:"email",required:!0,value:s.email,onChange:l=>a({...s,email:l})})]}),i.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[i.jsx(oc,{label:"Telefon (opsiyonel)",value:s.phone,onChange:l=>a({...s,phone:l})}),i.jsx(oc,{label:"Konu (opsiyonel)",value:s.subject,onChange:l=>a({...s,subject:l})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:["Mesajınız ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx("textarea",{required:!0,rows:6,value:s.message,onChange:l=>a({...s,message:l.target.value}),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground"})]}),i.jsx("button",{type:"submit",disabled:e,className:"btn-ink disabled:opacity-50",children:e?"Gönderiliyor...":"Mesajı Gönder"})]})})]})]}),i.jsx(Ye,{})]})},oc=({label:e,value:t,onChange:r,type:n="text",required:s})=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:[e," ",s&&i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx("input",{type:n,required:s,value:t,onChange:a=>r(a.target.value),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground transition-colors"})]}),ox=[{q:"Sipariş verdikten sonra ne kadar sürede kargoya verilir?",a:"Siparişleriniz aynı gün veya en geç bir sonraki iş günü kargoya teslim edilir."},{q:"Kargo süresi ne kadardır?",a:"Kıbrıs genelinde 1-3 iş günü içinde teslim edilir. Anlaşmalı kargo firmamız aracılığıyla gönderim yapılır."},{q:"Kargo ücreti ne kadar?",a:"4000 TL üzeri alışverişlerde Kıbrıs geneli kargo ücretsizdir. Altındaki siparişlerde sabit 49 TL kargo ücreti uygulanır."},{q:"İade ve değişim koşulları nedir?",a:"Tesellümünüzden itibaren 14 gün içinde, ürün açılmamış ve orijinal ambalajında olduğu sürece iade veya değişim yapabilirsiniz."},{q:"Ürünlerinizin son kullanma tarihi var mı?",a:"Tüm ürünlerimiz ambalajında üretim ve son kullanma tarihi belirtilerek size ulaşır. Açıldıktan sonraki kullanım süresi (PAO) sembolü de etikette yer alır."},{q:"Hassas ciltler için uygun mu?",a:"Ürünlerimiz dermatolog kontrolünde geliştirilmiştir. Yine de her cilt farklıdır; ilk kullanımdan önce küçük bir test alanında denemenizi öneririz."},{q:"Hayvanlar üzerinde test ediliyor mu?",a:"Hayır. Tüm ürünlerimiz cruelty-free üretilir."},{q:"Sipariş takibi nasıl yapılır?",a:"Siparişiniz kargoya verildiğinde size kargo firması ve takip numarası içeren bir e-posta gönderilir. Hesabınızdan da siparişlerinizi takip edebilirsiniz."}],HL=()=>{const[e,t]=m.useState(0);return i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ri,{title:"Sıkça Sorulan Sorular",description:"Derma Royal hakkında merak edilenler — kargo, iade, ödeme ve ürün kullanımıyla ilgili tüm cevaplar.",path:"/sss",jsonLd:{"@context":"https://schema.org","@type":"FAQPage",mainEntity:ox.map(r=>({"@type":"Question",name:r.q,acceptedAnswer:{"@type":"Answer",text:r.a}}))}}),i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-16 md:py-24",children:[i.jsxs("div",{className:"text-center mb-12 space-y-3",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:"Yardım"}),i.jsx("h1",{className:"display-text text-3xl md:text-5xl font-extralight",children:"Sıkça Sorulanlar"})]}),i.jsx("div",{className:"max-w-3xl mx-auto divide-y divide-border border-y border-border",children:ox.map((r,n)=>i.jsxs("div",{children:[i.jsxs("button",{onClick:()=>t(e===n?null:n),className:"w-full flex items-center justify-between text-left py-6 hover:opacity-80",children:[i.jsx("span",{className:"text-base font-light pr-4",children:r.q}),i.jsx(X2,{className:`h-4 w-4 flex-shrink-0 transition-transform ${e===n?"rotate-180":""}`})]}),e===n&&i.jsx("p",{className:"text-sm text-foreground/75 leading-relaxed pb-6 pr-8",children:r.a})]},n))})]}),i.jsx(Ye,{})]})},Xs=({eyebrow:e,title:t,children:r})=>i.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[i.jsx(Ge,{}),i.jsxs("main",{className:"flex-1 container-editorial py-16 md:py-24",children:[i.jsxs("div",{className:"text-center mb-12 space-y-3",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55",children:e}),i.jsx("h1",{className:"display-text text-3xl md:text-4xl font-extralight",children:t})]}),i.jsx("article",{className:"max-w-3xl mx-auto prose-legal space-y-6 text-sm text-foreground/80 leading-relaxed",children:r})]}),i.jsx(Ye,{})]}),ke=({children:e})=>i.jsx("h2",{className:"display-text text-base font-extralight pt-6 text-foreground",children:e}),ge=({children:e})=>i.jsx("p",{className:"text-sm leading-relaxed text-foreground/75",children:e}),VL=()=>i.jsxs(Xs,{eyebrow:"Yasal",title:"Gizlilik Politikası",children:[i.jsxs(ge,{children:["Son güncelleme: ",new Date().toLocaleDateString("tr-TR")]}),i.jsx(ge,{children:"Derma Royal olarak kişisel verilerinizin gizliliğine önem veriyoruz. Bu politika, web sitemizi kullanırken hangi bilgileri topladığımızı, nasıl kullandığımızı ve nasıl koruduğumuzu açıklar."}),i.jsx(ke,{children:"Toplanan Bilgiler"}),i.jsx(ge,{children:"Ad, soyad, e-posta, telefon, teslimat adresi, sipariş geçmişi gibi alışveriş için gerekli bilgileri toplarız. Çerezler aracılığıyla site kullanım istatistikleri elde ederiz."}),i.jsx(ke,{children:"Kullanım Amacı"}),i.jsx(ge,{children:"Siparişlerinizi işlemek, kargo takibi yapmak, müşteri hizmetleri sunmak, yasal yükümlülükleri yerine getirmek ve onay vermeniz halinde pazarlama iletişimi göndermek için kullanılır."}),i.jsx(ke,{children:"Üçüncü Taraflarla Paylaşım"}),i.jsx(ge,{children:"Kargo firmaları ve ödeme altyapı sağlayıcıları dışında üçüncü taraflarla paylaşılmaz. Yasal bir zorunluluk olmadıkça verileriniz satılmaz veya kiralanmaz."}),i.jsx(ke,{children:"Haklarınız"}),i.jsx(ge,{children:"KVKK kapsamında verilerinize erişme, düzeltme, silme ve işlenmesine itiraz etme haklarınız bulunmaktadır. Talepleriniz için info@dermaroyal.com adresine yazabilirsiniz."})]}),KL=()=>i.jsxs(Xs,{eyebrow:"Yasal",title:"KVKK Aydınlatma Metni",children:[i.jsx(ge,{children:"6698 sayılı Kişisel Verilerin Korunması Kanunu (KVKK) uyarınca, veri sorumlusu sıfatıyla Derma Royal tarafından aşağıda açıklandığı şekilde işlenebilecektir."}),i.jsx(ke,{children:"Veri Sorumlusu"}),i.jsx(ge,{children:"Derma Royal — info@dermaroyal.com"}),i.jsx(ke,{children:"İşlenen Veriler"}),i.jsx(ge,{children:"Kimlik bilgileri (ad, soyad), iletişim bilgileri (e-posta, telefon, adres), müşteri işlem bilgileri (sipariş geçmişi, ödeme bilgileri), pazarlama bilgileri (onay verdiğiniz iletişim tercihleri)."}),i.jsx(ke,{children:"İşleme Amacı"}),i.jsx(ge,{children:"Sipariş süreçlerinin yürütülmesi, sözleşmesel yükümlülüklerin yerine getirilmesi, müşteri memnuniyetinin sağlanması, yasal yükümlülüklerin yerine getirilmesi."}),i.jsx(ke,{children:"Hukuki Sebep"}),i.jsx(ge,{children:"KVKK'nın 5. ve 6. maddelerinde belirtilen sözleşmenin kurulması ve ifası, hukuki yükümlülük, meşru menfaat ve açık rıza hukuki sebeplerine dayanmaktadır."}),i.jsx(ke,{children:"Haklarınız"}),i.jsx(ge,{children:"KVKK'nın 11. maddesi kapsamında verilerinize erişme, düzeltme, silme, anonimleştirilmesini talep etme ve aktarıma itiraz etme haklarına sahipsiniz."})]}),qL=()=>i.jsxs(Xs,{eyebrow:"Yasal",title:"Çerez Politikası",children:[i.jsx(ge,{children:"Web sitemiz, deneyiminizi iyileştirmek için çerezler kullanır. Çerezler, tarayıcınız tarafından cihazınızda saklanan küçük metin dosyalarıdır."}),i.jsx(ke,{children:"Kullanılan Çerezler"}),i.jsxs(ge,{children:[i.jsx("strong",{children:"Zorunlu çerezler:"})," Sepet, oturum, güvenlik gibi sitenin çalışması için gereklidir."]}),i.jsxs(ge,{children:[i.jsx("strong",{children:"İşlevsel çerezler:"})," Tercihlerinizi (dil, tema) hatırlamak için kullanılır."]}),i.jsxs(ge,{children:[i.jsx("strong",{children:"Analitik çerezler:"})," Site kullanımını anlamak için anonim istatistikler toplar."]}),i.jsx(ke,{children:"Çerezleri Yönetme"}),i.jsx(ge,{children:"Tarayıcı ayarlarınızdan çerezleri silebilir veya engelleyebilirsiniz. Ancak bu durumda sitenin bazı özellikleri çalışmayabilir."})]}),WL=()=>i.jsxs(Xs,{eyebrow:"Yasal",title:"Mesafeli Satış Sözleşmesi",children:[i.jsx(ke,{children:"1. Taraflar"}),i.jsxs(ge,{children:[i.jsx("strong",{children:"Satıcı:"})," Derma Royal — info@dermaroyal.com",i.jsx("br",{}),i.jsx("strong",{children:"Alıcı:"})," Sipariş formunda belirtilen ad-soyad ve adres bilgileri sahibi."]}),i.jsx(ke,{children:"2. Konu"}),i.jsx(ge,{children:"İşbu sözleşmenin konusu, alıcının satıcıya ait dermaroyal.com web sitesinden elektronik ortamda sipariş verdiği, sözleşmede belirtilen niteliklere sahip ürünün satışı ve teslimi ile ilgili tarafların hak ve yükümlülüklerinin saptanmasıdır."}),i.jsx(ke,{children:"3. Sözleşme Konusu Ürün"}),i.jsx(ge,{children:"Ürün ad, adet, satış fiyatı ve ödeme şekli sipariş özetinde belirtildiği gibidir."}),i.jsx(ke,{children:"4. Genel Hükümler"}),i.jsx(ge,{children:"Alıcı, web sitesinde gösterilen ürünlerin temel nitelikleri, satış fiyatı ve ödeme şekli ile teslimata ilişkin tüm ön bilgileri okuyup onayladığını kabul eder."}),i.jsx(ke,{children:"5. Cayma Hakkı"}),i.jsx(ge,{children:"Alıcı, ürünü teslim aldığı tarihten itibaren 14 gün içinde herhangi bir gerekçe göstermeksizin ve cezai şart ödemeksizin sözleşmeden cayma hakkına sahiptir. Hijyenik nedenlerden dolayı ambalajı açılmış kozmetik ürünleri iade edilemez."}),i.jsx(ke,{children:"6. Yetkili Mahkeme"}),i.jsx(ge,{children:"Bu sözleşmeden doğan uyuşmazlıklarda Tüketici Hakem Heyetleri ve Tüketici Mahkemeleri yetkilidir."})]}),GL=()=>i.jsxs(Xs,{eyebrow:"Yasal",title:"Ön Bilgilendirme Formu",children:[i.jsx(ke,{children:"Satıcı Bilgileri"}),i.jsx(ge,{children:"Derma Royal — info@dermaroyal.com — dermaroyal.com"}),i.jsx(ke,{children:"Ürün Bilgileri"}),i.jsx(ge,{children:"Sipariş ettiğiniz ürünlerin adı, adedi, satış bedeli ve toplam tutarı sipariş özetinizde yer almaktadır."}),i.jsx(ke,{children:"Ödeme ve Teslimat"}),i.jsx(ge,{children:"Ödeme online olarak gerçekleştirilir. Ürünler, anlaşmalı kargo firması aracılığıyla 1-3 iş günü içinde teslim edilir. 4000 TL üzeri alışverişlerde Kıbrıs geneli kargo ücretsizdir."}),i.jsx(ke,{children:"Cayma Hakkı"}),i.jsx(ge,{children:"Tüketici, ürünü teslim aldığı tarihten itibaren 14 gün içinde cayma hakkını kullanabilir. Cayma bildirimi info@dermaroyal.com adresine yapılmalıdır. Hijyenik nedenlerle ambalajı açılmış ürünler iade edilemez."}),i.jsx(ke,{children:"Şikayet ve İtirazlar"}),i.jsx(ge,{children:"Şikayet ve itirazlarınızı, parasal sınırlar dahilinde tüketicinin yerleşim yerindeki veya tüketici işleminin yapıldığı yerdeki Tüketici Hakem Heyetine veya Tüketici Mahkemesine yapabilirsiniz."})]}),YL=()=>i.jsxs(Xs,{eyebrow:"Yardım",title:"İade & Değişim",children:[i.jsx(ke,{children:"İade Süresi"}),i.jsx(ge,{children:"Ürünü teslim aldığınız tarihten itibaren 14 gün içinde iade talebinde bulunabilirsiniz."}),i.jsx(ke,{children:"İade Koşulları"}),i.jsx(ge,{children:"Ürün açılmamış, kullanılmamış ve orijinal ambalajında olmalıdır. Hijyenik nedenlerle açılmış kozmetik ürünleri iade alınmaz. Promosyon ürünleri ve setlerin tüm parçaları eksiksiz iade edilmelidir."}),i.jsx(ke,{children:"İade Süreci"}),i.jsx(ge,{children:"info@dermaroyal.com adresine sipariş numaranız ve iade talebinizi içeren bir e-posta gönderin. Talebiniz onaylandıktan sonra size iade talimatları iletilecektir."}),i.jsx(ke,{children:"İade Tutarı"}),i.jsx(ge,{children:"Onaylanan iadelerde tutar, 7-14 iş günü içinde ödeme yaptığınız karta iade edilir."})]}),JL=()=>i.jsxs(Xs,{eyebrow:"Yardım",title:"Kargo & Teslimat",children:[i.jsx(ke,{children:"Kargo Süresi"}),i.jsx(ge,{children:"Siparişler 1 iş günü içinde kargoya verilir. Kıbrıs genelinde 1-3 iş günü içinde teslim edilir."}),i.jsx(ke,{children:"Kargo Ücreti"}),i.jsx(ge,{children:"4000 TL üzeri alışverişlerde Kıbrıs geneli kargo ücretsizdir. Altındaki siparişlerde sabit 49 TL kargo ücreti uygulanır."}),i.jsx(ke,{children:"Sipariş Takibi"}),i.jsx(ge,{children:"Siparişiniz kargoya verildiğinde size kargo firması ve takip numarası içeren bir e-posta gönderilir. Hesabınızdan da siparişlerinizi takip edebilirsiniz."}),i.jsx(ke,{children:"Teslimat Sorunları"}),i.jsx(ge,{children:"Teslimat sırasında ürün hasarlı görünüyorsa, kargo görevlisi yanında tutanak tutturarak teslim almayın ve info@dermaroyal.com adresine bildirin."})]}),ZL=[{to:"/admin",label:"Gösterge Paneli",icon:uR,end:!0},{to:"/admin/products",label:"Ürünler",icon:Zu,end:!1},{to:"/admin/categories",label:"Kategoriler",icon:_R,end:!1},{to:"/admin/orders",label:"Siparişler",icon:po,end:!1},{to:"/admin/users",label:"Müşteriler",icon:Uw,end:!1},{to:"/admin/coupons",label:"Kuponlar",icon:kR,end:!1},{to:"/admin/reviews",label:"Yorumlar",icon:zw,end:!1},{to:"/admin/messages",label:"Mesajlar",icon:Us,end:!1},{to:"/admin/newsletter",label:"Bülten",icon:Uo,end:!1},{to:"/admin/raporlar",label:"PayTR Raporları",icon:vR,end:!1}],QL=()=>i.jsxs("div",{className:"min-h-screen bg-background flex",children:[i.jsxs("aside",{className:"w-60 border-r border-border bg-secondary/30 flex flex-col sticky top-0 h-screen",children:[i.jsxs("div",{className:"p-6 border-b border-border",children:[i.jsxs(ue,{to:"/",className:"text-[11px] uppercase tracking-[0.22em] text-foreground/70 hover:text-foreground flex items-center gap-2",children:[i.jsx(Y2,{className:"h-3 w-3"})," Mağazaya dön"]}),i.jsx("h1",{className:"display-text text-lg font-extralight mt-4",children:"Admin"})]}),i.jsx("nav",{className:"flex-1 p-4 space-y-1 overflow-y-auto",children:ZL.map(e=>i.jsxs(hT,{to:e.to,end:e.end,className:({isActive:t})=>`flex items-center gap-3 px-3 py-2.5 text-sm transition-colors ${t?"bg-foreground text-background":"text-foreground/75 hover:bg-secondary"}`,children:[i.jsx(e.icon,{className:"h-4 w-4"}),e.label]},e.to))})]}),i.jsx("main",{className:"flex-1 overflow-x-hidden",children:i.jsx(QC,{})})]}),XL=()=>{const[e,t]=m.useState(null),[r,n]=m.useState(!0);if(m.useEffect(()=>{(async()=>{const{data:a,error:o}=await U.rpc("admin_dashboard_stats");!o&&a&&t(a),n(!1)})()},[]),r)return i.jsx("div",{className:"p-12 flex justify-center",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})});if(!e)return i.jsx("div",{className:"p-8 text-foreground/60",children:"İstatistikler yüklenemedi."});const s=[{label:"Bugünkü Gelir",value:ye(e.revenue_today),icon:sh},{label:"Bu Ay Gelir",value:ye(e.revenue_this_month),icon:sh},{label:"Toplam Gelir",value:ye(e.revenue_total),icon:sh},{label:"Bekleyen Sipariş",value:e.pending_orders.toString(),icon:po,link:"/admin/orders"},{label:"Bugünkü Sipariş",value:e.orders_today.toString(),icon:po},{label:"Toplam Sipariş",value:e.total_orders.toString(),icon:po},{label:"Aktif Ürün",value:e.total_products.toString(),icon:Zu,link:"/admin/products"},{label:"Düşük Stok",value:e.low_stock_count.toString(),icon:jR,alert:e.low_stock_count>0,link:"/admin/products"},{label:"Müşteri",value:e.total_customers.toString(),icon:Uw,link:"/admin/users"},{label:"Okunmamış Mesaj",value:e.unread_messages.toString(),icon:Us,alert:e.unread_messages>0,link:"/admin/messages"},{label:"Bülten Abonesi",value:e.newsletter_subscribers.toString(),icon:Us,link:"/admin/newsletter"}];return i.jsxs("div",{className:"p-6 md:p-10",children:[i.jsxs("div",{className:"mb-8",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"Genel Bakış"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:"Gösterge Paneli"})]}),i.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:s.map(a=>{const o=i.jsxs("div",{className:`border bg-card p-5 h-full ${a.alert?"border-destructive/40":"border-border"}`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.22em] text-foreground/60",children:a.label}),i.jsx(a.icon,{className:`h-4 w-4 ${a.alert?"text-destructive":"text-foreground/50"}`})]}),i.jsx("p",{className:"text-2xl font-light",children:a.value})]});return a.link?i.jsx(ue,{to:a.link,className:"hover:opacity-80 transition-opacity",children:o},a.label):i.jsx("div",{children:o},a.label)})})]})},lx={name:"",slug:"",description:"",short_description:"",price:0,compare_at_price:null,stock_quantity:0,images:[],ingredients:"",how_to_use:"",category_id:null,featured:!1,active:!0,sku:""},cx=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),e$=()=>{const[e,t]=m.useState([]),[r,n]=m.useState([]),[s,a]=m.useState(!0),[o,l]=m.useState(!1),[c,u]=m.useState(null),[d,h]=m.useState(lx),[f,p]=m.useState(!1),b=m.useRef(null),g=m.useRef(null),w=async()=>{a(!0);const[{data:k},{data:A}]=await Promise.all([U.from("products").select("*").order("created_at",{ascending:!1}),U.from("categories").select("id, name").order("name")]);t(k??[]),n(A??[]),a(!1)};m.useEffect(()=>{w()},[]);const y=()=>{u(null),h(lx),l(!0)},v=k=>{u(k),h({name:k.name,slug:k.slug,description:k.description??"",short_description:k.short_description??"",price:Number(k.price),compare_at_price:k.compare_at_price?Number(k.compare_at_price):null,stock_quantity:k.stock_quantity,images:k.images??[],ingredients:k.ingredients??"",how_to_use:k.how_to_use??"",category_id:k.category_id,featured:k.featured,active:k.active,sku:k.sku??""}),l(!0)},x=async k=>{if(!(!k||k.length===0)){p(!0);try{const A=[];for(const P of Array.from(k)){if(!P.type.startsWith("image/")){O.error(`${P.name} bir görsel değil`);continue}const $=P.name.split(".").pop()||"jpg",R=`${crypto.randomUUID()}.${$}`,{error:H}=await U.storage.from("product-images").upload(R,P,{cacheControl:"3600",upsert:!1});if(H){O.error(`${P.name}: ${H.message}`);continue}const{data:N}=U.storage.from("product-images").getPublicUrl(R);A.push(N.publicUrl)}A.length&&(h(P=>({...P,images:[...P.images,...A]})),O.success(`${A.length} görsel yüklendi`))}finally{p(!1),b.current&&(b.current.value="")}}},_=k=>{h(A=>({...A,images:A.images.filter((P,$)=>$!==k)}))},j=(k,A)=>{h(P=>{const $=[...P.images],[R]=$.splice(k,1);return $.splice(A,0,R),{...P,images:$}})},S=async k=>{k.preventDefault();const A={...d,slug:d.slug||cx(d.name),sku:d.sku||null,description:d.description||null,short_description:d.short_description||null,ingredients:d.ingredients||null,how_to_use:d.how_to_use||null};try{if(c){const{error:P}=await U.from("products").update(A).eq("id",c.id);if(P)throw P;O.success("Ürün güncellendi")}else{const{error:P}=await U.from("products").insert(A);if(P)throw P;O.success("Ürün oluşturuldu")}l(!1),w()}catch(P){O.error(P.message)}},C=async k=>{if(!confirm("Ürün silinsin mi?"))return;const{error:A}=await U.from("products").delete().eq("id",k);if(A)return O.error(A.message);O.success("Silindi"),w()};return i.jsxs("div",{className:"p-8",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"display-text text-2xl font-extralight",children:"Ürünler"}),i.jsxs("p",{className:"text-sm text-foreground/60 mt-1",children:[e.length," ürün"]})]}),i.jsxs(Ai,{open:o,onOpenChange:l,children:[i.jsx(vd,{asChild:!0,children:i.jsxs("button",{onClick:y,className:"btn-ink flex items-center gap-2",children:[i.jsx(qs,{className:"h-4 w-4"})," Yeni Ürün"]})}),i.jsxs(Js,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[i.jsx(Zs,{children:i.jsx(Qs,{children:c?"Ürünü Düzenle":"Yeni Ürün"})}),i.jsxs("form",{onSubmit:S,className:"space-y-4 mt-4",children:[i.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[i.jsx(gs,{label:"Ad",required:!0,value:d.name,onChange:k=>h({...d,name:k,slug:d.slug||cx(k)})}),i.jsx(gs,{label:"Slug",value:d.slug,onChange:k=>h({...d,slug:k})})]}),i.jsx(gs,{label:"Kısa Açıklama",value:d.short_description,onChange:k=>h({...d,short_description:k})}),i.jsx(_h,{label:"Açıklama",rows:4,value:d.description,onChange:k=>h({...d,description:k})}),i.jsxs("div",{className:"grid sm:grid-cols-3 gap-4",children:[i.jsx(gs,{label:"Fiyat (TRY)",type:"number",required:!0,value:String(d.price),onChange:k=>h({...d,price:Number(k)})}),i.jsx(gs,{label:"Karşılaştırma Fiyatı",type:"number",value:d.compare_at_price!==null?String(d.compare_at_price):"",onChange:k=>h({...d,compare_at_price:k?Number(k):null})}),i.jsx(gs,{label:"Stok",type:"number",value:String(d.stock_quantity),onChange:k=>h({...d,stock_quantity:Number(k)})})]}),i.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Kategori"}),i.jsxs("select",{value:d.category_id??"",onChange:k=>h({...d,category_id:k.target.value||null}),className:"w-full border border-border bg-background px-4 py-3 text-sm focus:outline-none focus:border-foreground",children:[i.jsx("option",{value:"",children:"— Seçiniz —"}),r.map(k=>i.jsx("option",{value:k.id,children:k.name},k.id))]})]}),i.jsx(gs,{label:"SKU",value:d.sku,onChange:k=>h({...d,sku:k})})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:["Görseller ",d.images.length>0&&`(${d.images.length})`]}),i.jsx("input",{ref:b,type:"file",accept:"image/*",multiple:!0,onChange:k=>x(k.target.files),className:"hidden",id:"product-image-upload"}),i.jsx("label",{htmlFor:"product-image-upload",className:`flex flex-col items-center justify-center gap-2 border border-dashed border-border bg-background px-4 py-8 text-sm cursor-pointer hover:border-foreground transition-colors ${f?"opacity-50 pointer-events-none":""}`,children:f?i.jsxs(i.Fragment,{children:[i.jsx(rt,{className:"h-5 w-5 animate-spin"}),i.jsx("span",{className:"text-foreground/60",children:"Yükleniyor..."})]}):i.jsxs(i.Fragment,{children:[i.jsx(NR,{className:"h-5 w-5 text-foreground/60"}),i.jsx("span",{className:"text-foreground/70",children:"Görsel seç veya buraya bırak"}),i.jsx("span",{className:"text-[10px] text-foreground/50",children:"Birden fazla görsel seçebilirsiniz"})]})}),d.images.length>0&&i.jsx("div",{className:"grid grid-cols-4 gap-2 mt-3",children:d.images.map((k,A)=>i.jsxs("div",{draggable:!0,onDragStart:()=>g.current=A,onDragOver:P=>P.preventDefault(),onDrop:()=>{g.current!==null&&g.current!==A&&j(g.current,A),g.current=null},className:"group relative aspect-square border border-border bg-secondary/20 cursor-move",children:[i.jsx("img",{src:k,alt:"",className:"w-full h-full object-cover"}),A===0&&i.jsx("span",{className:"absolute top-1 left-1 text-[9px] uppercase tracking-wider bg-foreground text-background px-1.5 py-0.5",children:"Ana"}),i.jsx("div",{className:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity",children:i.jsx("button",{type:"button",onClick:()=>_(A),className:"bg-background/90 hover:bg-destructive hover:text-destructive-foreground p-1 rounded-sm","aria-label":"Görseli kaldır",children:i.jsx(ds,{className:"h-3 w-3"})})}),i.jsx("div",{className:"absolute bottom-1 left-1 opacity-0 group-hover:opacity-100 transition-opacity",children:i.jsx(lR,{className:"h-3 w-3 text-background bg-foreground/70 rounded-sm"})})]},k+A))}),d.images.length>1&&i.jsx("p",{className:"text-[10px] text-foreground/55",children:"İlk görsel ana görsel olarak kullanılır. Sıralamayı değiştirmek için sürükleyin."})]}),i.jsx(_h,{label:"İçerikler",rows:2,value:d.ingredients,onChange:k=>h({...d,ingredients:k})}),i.jsx(_h,{label:"Kullanım",rows:2,value:d.how_to_use,onChange:k=>h({...d,how_to_use:k})}),i.jsxs("div",{className:"flex items-center gap-6",children:[i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"checkbox",checked:d.featured,onChange:k=>h({...d,featured:k.target.checked})}),"Öne Çıkan"]}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"checkbox",checked:d.active,onChange:k=>h({...d,active:k.target.checked})}),"Aktif"]})]}),i.jsx("button",{type:"submit",className:"btn-ink w-full",children:c?"Güncelle":"Oluştur"})]})]})]})]}),s?i.jsx("p",{className:"text-foreground/60",children:"Yükleniyor..."}):i.jsx("div",{className:"border border-border bg-card",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-secondary/50",children:i.jsxs("tr",{className:"text-left",children:[i.jsx("th",{className:"p-3",children:"Ürün"}),i.jsx("th",{className:"p-3",children:"Fiyat"}),i.jsx("th",{className:"p-3",children:"Stok"}),i.jsx("th",{className:"p-3",children:"Durum"}),i.jsx("th",{className:"p-3 w-24"})]})}),i.jsxs("tbody",{children:[e.map(k=>{var A;return i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex items-center gap-3",children:[((A=k.images)==null?void 0:A[0])&&i.jsx("img",{src:k.images[0],alt:"",className:"w-10 h-12 object-cover"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-light",children:k.name}),i.jsx("p",{className:"text-xs text-foreground/55",children:k.slug})]})]})}),i.jsx("td",{className:"p-3",children:ye(Number(k.price))}),i.jsx("td",{className:"p-3",children:k.stock_quantity}),i.jsxs("td",{className:"p-3",children:[i.jsx("span",{className:`text-[10px] uppercase tracking-[0.2em] px-2 py-1 ${k.active?"bg-foreground/10":"bg-destructive/10 text-destructive"}`,children:k.active?"Aktif":"Pasif"}),k.featured&&i.jsx("span",{className:"ml-2 text-[10px] uppercase tracking-[0.2em] px-2 py-1 bg-accent",children:"Öne Çıkan"})]}),i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:()=>v(k),"aria-label":"Düzenle",className:"hover:text-foreground text-foreground/60",children:i.jsx(Qu,{className:"h-4 w-4"})}),i.jsx("button",{onClick:()=>C(k.id),"aria-label":"Sil",className:"hover:text-destructive text-foreground/60",children:i.jsx(Ws,{className:"h-4 w-4"})})]})})]},k.id)}),e.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"p-8 text-center text-foreground/60",children:"Henüz ürün yok"})})]})]})})]})},gs=({label:e,value:t,onChange:r,type:n="text",required:s})=>i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:e}),i.jsx("input",{type:n,required:s,value:t,onChange:a=>r(a.target.value),className:"w-full border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:border-foreground"})]}),_h=({label:e,value:t,onChange:r,rows:n=3})=>i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:e}),i.jsx("textarea",{rows:n,value:t,onChange:s=>r(s.target.value),className:"w-full border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:border-foreground"})]}),ux=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),t$=()=>{const[e,t]=m.useState([]),[r,n]=m.useState(!0),[s,a]=m.useState(!1),[o,l]=m.useState(null),[c,u]=m.useState({name:"",slug:"",description:"",image_url:"",sort_order:0}),d=async()=>{n(!0);const{data:g}=await U.from("categories").select("*").order("sort_order");t(g??[]),n(!1)};m.useEffect(()=>{d()},[]);const h=()=>{l(null),u({name:"",slug:"",description:"",image_url:"",sort_order:0}),a(!0)},f=g=>{l(g),u({name:g.name,slug:g.slug,description:g.description??"",image_url:g.image_url??"",sort_order:g.sort_order}),a(!0)},p=async g=>{g.preventDefault();const w={name:c.name,slug:c.slug||ux(c.name),description:c.description||null,image_url:c.image_url||null,sort_order:Number(c.sort_order)};try{if(o){const{error:y}=await U.from("categories").update(w).eq("id",o.id);if(y)throw y;O.success("Güncellendi")}else{const{error:y}=await U.from("categories").insert(w);if(y)throw y;O.success("Oluşturuldu")}a(!1),d()}catch(y){O.error(y.message)}},b=async g=>{if(!confirm("Kategori silinsin mi?"))return;const{error:w}=await U.from("categories").delete().eq("id",g);if(w)return O.error(w.message);O.success("Silindi"),d()};return i.jsxs("div",{className:"p-8",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"display-text text-2xl font-extralight",children:"Kategoriler"}),i.jsxs("p",{className:"text-sm text-foreground/60 mt-1",children:[e.length," kategori"]})]}),i.jsxs(Ai,{open:s,onOpenChange:a,children:[i.jsx(vd,{asChild:!0,children:i.jsxs("button",{onClick:h,className:"btn-ink flex items-center gap-2",children:[i.jsx(qs,{className:"h-4 w-4"})," Yeni Kategori"]})}),i.jsxs(Js,{children:[i.jsx(Zs,{children:i.jsx(Qs,{children:o?"Kategoriyi Düzenle":"Yeni Kategori"})}),i.jsxs("form",{onSubmit:p,className:"space-y-4 mt-4",children:[i.jsx(Wi,{label:"Ad",required:!0,value:c.name,onChange:g=>u({...c,name:g,slug:c.slug||ux(g)})}),i.jsx(Wi,{label:"Slug",value:c.slug,onChange:g=>u({...c,slug:g})}),i.jsx(Wi,{label:"Açıklama",value:c.description,textarea:!0,onChange:g=>u({...c,description:g})}),i.jsx(Wi,{label:"Görsel URL",value:c.image_url,onChange:g=>u({...c,image_url:g})}),i.jsx(Wi,{label:"Sıralama",type:"number",value:String(c.sort_order),onChange:g=>u({...c,sort_order:Number(g)})}),i.jsx("button",{type:"submit",className:"btn-ink w-full",children:o?"Güncelle":"Oluştur"})]})]})]})]}),r?i.jsx("p",{className:"text-foreground/60",children:"Yükleniyor..."}):i.jsx("div",{className:"border border-border bg-card",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-secondary/50",children:i.jsxs("tr",{className:"text-left",children:[i.jsx("th",{className:"p-3",children:"Ad"}),i.jsx("th",{className:"p-3",children:"Slug"}),i.jsx("th",{className:"p-3",children:"Sıra"}),i.jsx("th",{className:"p-3 w-24"})]})}),i.jsx("tbody",{children:e.map(g=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-3 font-light",children:g.name}),i.jsx("td",{className:"p-3 text-foreground/60",children:g.slug}),i.jsx("td",{className:"p-3",children:g.sort_order}),i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex gap-2",children:[i.jsx("button",{onClick:()=>f(g),className:"hover:text-foreground text-foreground/60",children:i.jsx(Qu,{className:"h-4 w-4"})}),i.jsx("button",{onClick:()=>b(g.id),className:"hover:text-destructive text-foreground/60",children:i.jsx(Ws,{className:"h-4 w-4"})})]})})]},g.id))})]})})]})},Wi=({label:e,value:t,onChange:r,type:n="text",required:s,textarea:a})=>i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:e}),a?i.jsx("textarea",{required:s,value:t,rows:3,onChange:o=>r(o.target.value),className:"w-full border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:border-foreground resize-none"}):i.jsx("input",{type:n,required:s,value:t,onChange:o=>r(o.target.value),className:"w-full border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:border-foreground"})]});var X1="AlertDialog",[r$,L$]=Fr(X1,[dk]),gn=dk(),ej=e=>{const{__scopeAlertDialog:t,...r}=e,n=gn(t);return i.jsx(Mm,{...n,...r,modal:!0})};ej.displayName=X1;var n$="AlertDialogTrigger",s$=m.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=gn(r);return i.jsx(Ek,{...s,...n,ref:t})});s$.displayName=n$;var a$="AlertDialogPortal",tj=e=>{const{__scopeAlertDialog:t,...r}=e,n=gn(t);return i.jsx(Lm,{...n,...r})};tj.displayName=a$;var i$="AlertDialogOverlay",rj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=gn(r);return i.jsx(ml,{...s,...n,ref:t})});rj.displayName=i$;var Ya="AlertDialogContent",[o$,l$]=r$(Ya),c$=dw("AlertDialogContent"),nj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,a=gn(r),o=m.useRef(null),l=$e(t,o),c=m.useRef(null);return i.jsx(FD,{contentName:Ya,titleName:sj,docsSlug:"alert-dialog",children:i.jsx(o$,{scope:r,cancelRef:c,children:i.jsxs(gl,{role:"alertdialog",...a,...s,ref:l,onOpenAutoFocus:X(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[i.jsx(c$,{children:n}),i.jsx(d$,{contentRef:o})]})})})});nj.displayName=Ya;var sj="AlertDialogTitle",aj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=gn(r);return i.jsx(yl,{...s,...n,ref:t})});aj.displayName=sj;var ij="AlertDialogDescription",oj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=gn(r);return i.jsx(vl,{...s,...n,ref:t})});oj.displayName=ij;var u$="AlertDialogAction",lj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=gn(r);return i.jsx(dd,{...s,...n,ref:t})});lj.displayName=u$;var cj="AlertDialogCancel",uj=m.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=l$(cj,r),a=gn(r),o=$e(t,s);return i.jsx(dd,{...a,...n,ref:o})});uj.displayName=cj;var d$=({contentRef:e})=>{const t=`\`${Ya}\` requires a description for the component to be accessible for screen reader users.
You can add a description to the \`${Ya}\` by passing a \`${ij}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
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 \`${Ya}\`. 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 m.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},h$=ej,f$=tj,dj=rj,hj=nj,fj=lj,pj=uj,mj=aj,gj=oj;const Jm=Wu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Da=m.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},a)=>{const o=n?r2:"button";return i.jsx(o,{className:de(Jm({variant:t,size:r,className:e})),ref:a,...s})});Da.displayName="Button";const p$=h$,m$=f$,yj=m.forwardRef(({className:e,...t},r)=>i.jsx(dj,{className:de("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:r}));yj.displayName=dj.displayName;const vj=m.forwardRef(({className:e,...t},r)=>i.jsxs(m$,{children:[i.jsx(yj,{}),i.jsx(hj,{ref:r,className:de("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})]}));vj.displayName=hj.displayName;const xj=({className:e,...t})=>i.jsx("div",{className:de("flex flex-col space-y-2 text-center sm:text-left",e),...t});xj.displayName="AlertDialogHeader";const bj=({className:e,...t})=>i.jsx("div",{className:de("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});bj.displayName="AlertDialogFooter";const wj=m.forwardRef(({className:e,...t},r)=>i.jsx(mj,{ref:r,className:de("text-lg font-semibold",e),...t}));wj.displayName=mj.displayName;const _j=m.forwardRef(({className:e,...t},r)=>i.jsx(gj,{ref:r,className:de("text-sm text-muted-foreground",e),...t}));_j.displayName=gj.displayName;const kj=m.forwardRef(({className:e,...t},r)=>i.jsx(fj,{ref:r,className:de(Jm(),e),...t}));kj.displayName=fj.displayName;const jj=m.forwardRef(({className:e,...t},r)=>i.jsx(pj,{ref:r,className:de(Jm({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));jj.displayName=pj.displayName;const kh=["pending","paid","processing","shipped","delivered","cancelled","refunded"],jh={pending:"Beklemede",paid:"Ödendi",processing:"Hazırlanıyor",shipped:"Kargoda",delivered:"Teslim Edildi",cancelled:"İptal",refunded:"İade"},g$={paid:"Ödendi",pending:"Beklemede",failed:"Başarısız",refunded:"İade"},dx=({status:e})=>{const t=e==="paid"?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border-emerald-500/40":e==="pending"?"bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/40":"bg-destructive/15 text-destructive border-destructive/40";return i.jsx("span",{className:`inline-flex items-center text-[10px] uppercase tracking-[0.2em] px-2 py-1 border ${t}`,children:g$[e]??e})},y$=()=>{var $;const[e,t]=m.useState([]),[r,n]=m.useState(!0),[s,a]=m.useState(null),[o,l]=m.useState([]),[c,u]=m.useState("all"),[d,h]=m.useState(""),[f,p]=m.useState(""),[b,g]=m.useState({}),[w,y]=m.useState(null),[v,x]=m.useState(!1),_=async()=>{n(!0);const{data:R}=await U.from("orders").select("*").order("created_at",{ascending:!1}),H=R??[];if(H.length){const N=H.map(z=>z.id),{data:M}=await U.from("return_requests").select("id, order_id, status, reason, created_at, updated_at, admin_notes").in("order_id",N),I={};(M??[]).forEach(z=>{var E;(I[E=z.order_id]??(I[E]=[])).push(z)}),H.forEach(z=>{z.return_requests=I[z.id]??[]})}t(H),n(!1)};m.useEffect(()=>{_()},[]);const j=async R=>{a(R),h(R.tracking_number??""),p(R.shipping_carrier??"");const H={};(R.return_requests??[]).forEach(M=>{H[M.id]=M.admin_notes??""}),g(H);const{data:N}=await U.from("order_items").select("*").eq("order_id",R.id);l(N??[])},S=async()=>{var I;if(!w||!s)return;const{requestId:R,next:H}=w;x(!0);const N=((I=b[R])==null?void 0:I.trim())||null;if(H==="approved"){const{data:z,error:E}=await U.functions.invoke("paytr-refund",{body:{order_id:s.id,return_request_id:R}});if(E||z&&z.error){x(!1);const T=(z==null?void 0:z.error)||(E==null?void 0:E.message)||"PayTR iadesi başarısız";return O.error(`İade başarısız: ${T}`)}}const{error:M}=await U.from("return_requests").update({status:H,admin_notes:N}).eq("id",R);if(x(!1),M)return O.error(M.message);O.success(H==="approved"?"İade onaylandı ve müşteriye geri ödendi":"İade isteği reddedildi"),y(null),a({...s,return_requests:s.return_requests.map(z=>z.id===R?{...z,status:H,admin_notes:N??"",updated_at:new Date().toISOString()}:z)}),_()},C=async R=>{var M;const H=((M=b[R])==null?void 0:M.trim())||null,{error:N}=await U.from("return_requests").update({admin_notes:H}).eq("id",R);if(N)return O.error(N.message);O.success("Not kaydedildi"),s&&a({...s,return_requests:s.return_requests.map(I=>I.id===R?{...I,admin_notes:H??"",updated_at:new Date().toISOString()}:I)})},k=async(R,H)=>{const N=e.find(z=>z.id===R)??((s==null?void 0:s.id)===R?s:null),M=N==null?void 0:N.status,{error:I}=await U.from("orders").update({status:H}).eq("id",R);if(I)return O.error(I.message);N&&M!==H?(U.functions.invoke("send-order-email",{body:{type:"order_status_update",to:N.customer_email,data:{customer_name:N.customer_name,order_number:N.order_number,status:H,previous_status:M,currency:N.currency,tracking_number:N.tracking_number??void 0,shipping_carrier:N.shipping_carrier??void 0}}}).catch(()=>{}),O.success("Durum güncellendi ve müşteriye e-posta gönderildi")):O.success("Durum güncellendi"),_(),(s==null?void 0:s.id)===R&&a({...s,status:H})},A=async()=>{if(!s)return;const{error:R}=await U.from("orders").update({tracking_number:d||null,shipping_carrier:f||null,status:"shipped"}).eq("id",s.id);if(R)return O.error(R.message);U.functions.invoke("send-order-email",{body:{type:"order_shipped",to:s.customer_email,data:{customer_name:s.customer_name,order_number:s.order_number,tracking_number:d,shipping_carrier:f}}}).catch(()=>{}),O.success("Kargo bilgileri kaydedildi ve müşteriye e-posta gönderildi"),a({...s,tracking_number:d,shipping_carrier:f,status:"shipped"}),_()},P=e.filter(R=>c==="all"||R.status===c);return i.jsxs("div",{className:"p-6 md:p-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8 flex-wrap gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"Yönetim"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:"Siparişler"}),i.jsxs("p",{className:"text-sm text-foreground/60 mt-1",children:[P.length," sipariş"]})]}),i.jsxs("select",{value:c,onChange:R=>u(R.target.value),className:"border border-border bg-background px-3 py-2 text-sm",children:[i.jsx("option",{value:"all",children:"Tümü"}),kh.map(R=>i.jsx("option",{value:R,children:jh[R]},R))]})]}),r?i.jsx("p",{className:"text-foreground/60",children:"Yükleniyor..."}):P.length===0?i.jsx("p",{className:"text-foreground/60",children:"Sipariş yok"}):i.jsx("div",{className:"border border-border bg-card overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-secondary/50 text-[10px] uppercase tracking-[0.2em] text-foreground/60",children:i.jsxs("tr",{className:"text-left",children:[i.jsx("th",{className:"p-3",children:"Sipariş No"}),i.jsx("th",{className:"p-3",children:"Müşteri"}),i.jsx("th",{className:"p-3",children:"Tarih"}),i.jsx("th",{className:"p-3",children:"Toplam"}),i.jsx("th",{className:"p-3",children:"Ödeme"}),i.jsx("th",{className:"p-3",children:"Durum"})]})}),i.jsx("tbody",{children:P.map(R=>i.jsxs("tr",{className:"border-t border-border cursor-pointer hover:bg-secondary/30",onClick:()=>j(R),children:[i.jsx("td",{className:"p-3 font-mono text-xs",children:i.jsxs("div",{className:"flex items-center gap-2",children:[R.order_number,R.return_requests&&R.return_requests.length>0&&(()=>{const H=R.return_requests[0],N=H.status==="approved"?"İade Onaylandı":H.status==="rejected"?"İade Reddedildi":"İade Beklemede",M=H.status==="approved"?"bg-green-500/15 text-green-700 dark:text-green-400 border-green-500/30":H.status==="rejected"?"bg-red-500/15 text-red-700 dark:text-red-400 border-red-500/30":"bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/30";return i.jsxs("span",{title:N,className:`inline-flex items-center gap-1 text-[9px] uppercase tracking-wider px-1.5 py-0.5 border ${M}`,children:[i.jsx(Uy,{className:"h-2.5 w-2.5"})," ",N]})})()]})}),i.jsxs("td",{className:"p-3",children:[i.jsx("p",{children:R.customer_name}),i.jsx("p",{className:"text-xs text-foreground/55",children:R.customer_email})]}),i.jsx("td",{className:"p-3 text-xs",children:new Date(R.created_at).toLocaleDateString("tr-TR")}),i.jsx("td",{className:"p-3",children:ye(Number(R.total),R.currency)}),i.jsx("td",{className:"p-3",children:i.jsx(dx,{status:R.payment_status})}),i.jsx("td",{className:"p-3",children:i.jsx("select",{value:R.status,onClick:H=>H.stopPropagation(),onChange:H=>k(R.id,H.target.value),className:"border border-border bg-background px-2 py-1 text-xs",children:kh.map(H=>i.jsx("option",{value:H,children:jh[H]},H))})})]},R.id))})]})}),i.jsx(Ai,{open:!!s,onOpenChange:R=>!R&&a(null),children:i.jsx(Js,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:s&&i.jsxs(i.Fragment,{children:[i.jsx(Zs,{children:i.jsxs(Qs,{children:["Sipariş ",s.order_number]})}),i.jsxs("div",{className:"space-y-6 mt-4 text-sm",children:[i.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60",children:"Ödeme Durumu:"}),i.jsx(dx,{status:s.payment_status}),s.paid_at&&i.jsx("span",{className:"text-xs text-foreground/55",children:new Date(s.paid_at).toLocaleString("tr-TR")})]}),i.jsxs("section",{className:"grid sm:grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60 mb-2",children:"Müşteri"}),i.jsx("p",{children:s.customer_name}),i.jsx("p",{className:"text-foreground/70",children:s.customer_email}),s.customer_phone&&i.jsx("p",{className:"text-foreground/70",children:s.customer_phone})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60 mb-2",children:"Adres"}),i.jsx("p",{children:s.shipping_address_line1}),s.shipping_address_line2&&i.jsx("p",{children:s.shipping_address_line2}),i.jsxs("p",{children:[s.shipping_postal_code," ",s.shipping_city,s.shipping_state&&`, ${s.shipping_state}`]})]})]}),i.jsxs("section",{children:[i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60 mb-2",children:"Ürünler"}),i.jsx("div",{className:"border border-border",children:o.map(R=>i.jsxs("div",{className:"flex items-center gap-3 p-3 border-b border-border last:border-0",children:[R.product_image&&i.jsx("img",{src:R.product_image,alt:"",className:"w-12 h-14 object-cover"}),i.jsxs("div",{className:"flex-1",children:[i.jsx("p",{children:R.product_name}),i.jsxs("p",{className:"text-xs text-foreground/55",children:[R.quantity," × ",ye(Number(R.unit_price))]})]}),i.jsx("p",{children:ye(Number(R.subtotal))})]},R.id))})]}),i.jsxs("section",{className:"space-y-1",children:[i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Ara Toplam"}),i.jsx("span",{children:ye(Number(s.subtotal))})]}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx("span",{children:"Kargo"}),i.jsx("span",{children:ye(Number(s.shipping_cost))})]}),Number(s.discount_amount)>0&&i.jsxs("div",{className:"flex justify-between text-foreground/80",children:[i.jsxs("span",{children:["İndirim ",s.coupon_code&&`(${s.coupon_code})`]}),i.jsxs("span",{children:["−",ye(Number(s.discount_amount))]})]}),i.jsxs("div",{className:"flex justify-between font-medium pt-2 border-t border-border",children:[i.jsx("span",{children:"Toplam"}),i.jsx("span",{children:ye(Number(s.total))})]})]}),s.notes&&i.jsxs("section",{children:[i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60 mb-2",children:"Müşteri Notu"}),i.jsx("p",{className:"text-foreground/75",children:s.notes})]}),s.return_requests&&s.return_requests.length>0&&i.jsxs("section",{className:"border border-amber-500/30 bg-amber-500/5 p-4 space-y-3",children:[i.jsxs("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-amber-700 dark:text-amber-400 flex items-center gap-2",children:[i.jsx(Uy,{className:"h-3.5 w-3.5"})," İade İsteği"]}),s.return_requests.map(R=>{const H=R.status==="approved"||R.status==="rejected",N=R.status==="approved"?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-400 border-emerald-500/30":R.status==="rejected"?"bg-destructive/15 text-destructive border-destructive/30":"bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/30",M=R.status==="approved"?"Onaylandı":R.status==="rejected"?"Reddedildi":"Beklemede";return i.jsxs("div",{className:"space-y-3 pb-3 border-b border-amber-500/20 last:border-0 last:pb-0",children:[i.jsxs("div",{className:"flex items-center justify-between text-xs flex-wrap gap-2",children:[i.jsx("span",{className:`text-[10px] uppercase tracking-[0.2em] px-2 py-1 border ${N}`,children:M}),i.jsxs("span",{className:"text-foreground/55",children:["Talep: ",new Date(R.created_at).toLocaleString("tr-TR"),R.updated_at&&R.updated_at!==R.created_at&&i.jsxs(i.Fragment,{children:[" · Güncelleme: ",new Date(R.updated_at).toLocaleString("tr-TR")]})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.2em] text-foreground/60 mb-1",children:"Müşteri Sebebi"}),i.jsx("p",{className:"text-sm text-foreground/80 whitespace-pre-wrap",children:R.reason})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.2em] text-foreground/60 mb-1 block",children:"Yönetici Notu (denetim kaydı)"}),i.jsx("textarea",{value:b[R.id]??"",onChange:I=>g(z=>({...z,[R.id]:I.target.value})),rows:2,maxLength:1e3,placeholder:"Karar gerekçesi veya iletişim notu...",className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[!H&&i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>y({requestId:R.id,next:"approved"}),className:"inline-flex items-center gap-1.5 text-xs px-3 py-1.5 bg-emerald-600 text-white hover:bg-emerald-700 transition-colors",children:[i.jsx(Yu,{className:"h-3.5 w-3.5"})," Onayla"]}),i.jsxs("button",{onClick:()=>y({requestId:R.id,next:"rejected"}),className:"inline-flex items-center gap-1.5 text-xs px-3 py-1.5 bg-destructive text-destructive-foreground hover:opacity-90 transition-opacity",children:[i.jsx(Ju,{className:"h-3.5 w-3.5"})," Reddet"]})]}),i.jsx("button",{onClick:()=>C(R.id),className:"text-xs px-3 py-1.5 border border-border hover:bg-secondary/50 transition-colors",children:"Notu Kaydet"})]})]},R.id)})]}),i.jsxs("section",{className:"border border-border p-4 space-y-3",children:[i.jsxs("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60 flex items-center gap-2",children:[i.jsx(SR,{className:"h-3.5 w-3.5"})," Kargo Bilgileri"]}),i.jsxs("div",{className:"grid sm:grid-cols-2 gap-3",children:[i.jsx("input",{placeholder:"Kargo firması",value:f,onChange:R=>p(R.target.value),className:"border border-border bg-background px-3 py-2 text-sm"}),i.jsx("input",{placeholder:"Takip numarası",value:d,onChange:R=>h(R.target.value),className:"border border-border bg-background px-3 py-2 text-sm"})]}),i.jsxs("button",{onClick:A,className:"btn-ink flex items-center gap-2",children:[i.jsx(Uo,{className:"h-3.5 w-3.5"}),"Kaydet ve Müşteriye Bildir"]})]}),i.jsxs("section",{children:[i.jsx("h3",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60 mb-2",children:"Durumu Güncelle"}),i.jsx("select",{value:s.status,onChange:R=>k(s.id,R.target.value),className:"border border-border bg-background px-3 py-2",children:kh.map(R=>i.jsx("option",{value:R,children:jh[R]},R))})]})]})]})})}),i.jsx(p$,{open:!!w,onOpenChange:R=>!R&&!v&&y(null),children:i.jsxs(vj,{children:[i.jsxs(xj,{children:[i.jsx(wj,{children:(w==null?void 0:w.next)==="approved"?"İade isteğini onayla":"İade isteğini reddet"}),i.jsxs(_j,{children:[(w==null?void 0:w.next)==="approved"?"Bu iade isteğini onaylamak üzeresiniz. Karar müşteriye iletilecektir.":"Bu iade isteğini reddetmek üzeresiniz. Karar geri alınamaz olarak kayda geçer.",w&&(($=b[w.requestId])!=null&&$.trim())?i.jsx("span",{className:"block mt-2 text-foreground/80",children:"Yönetici notu kayda geçirilecek."}):i.jsx("span",{className:"block mt-2 text-amber-600",children:"Henüz yönetici notu eklemediniz. Yine de devam edilsin mi?"})]})]}),i.jsxs(bj,{children:[i.jsx(jj,{disabled:v,children:"Vazgeç"}),i.jsx(kj,{onClick:S,disabled:v,children:v?"Kaydediliyor...":(w==null?void 0:w.next)==="approved"?"Evet, Onayla":"Evet, Reddet"})]})]})})]})},v$=()=>{const{user:e}=Hr(),[t,r]=m.useState([]),[n,s]=m.useState(!0),[a,o]=m.useState(""),[l,c]=m.useState("all"),[u,d]=m.useState(null),[h,f]=m.useState(null),[p,b]=m.useState("asc"),g=k=>{h!==k?(f(k),b(k==="spent"?"desc":"asc")):p==="asc"?b("desc"):f(null)},w=({col:k})=>h!==k?i.jsx(J2,{className:"h-3 w-3 opacity-50"}):p==="asc"?i.jsx(Z2,{className:"h-3 w-3"}):i.jsx(G2,{className:"h-3 w-3"}),y=async()=>{s(!0);const{data:k,error:A}=await U.rpc("admin_get_users");A&&O.error(A.message),r(k??[]),s(!1)};m.useEffect(()=>{y()},[]);const v=async(k,A)=>{if(!confirm(A?"Admin yetkisini kaldır?":"Admin yetkisi ver?"))return;d(k);const{error:P}=await U.rpc("admin_toggle_admin_role",{_target_user_id:k});if(d(null),P)return O.error(P.message);O.success("Güncellendi"),y()},x=async(k,A)=>{if(!confirm(`${A} adresini manuel olarak onaylamak istediğine emin misin?`))return;d(k);const{error:P}=await U.rpc("admin_confirm_user_email",{_target_user_id:k});if(d(null),P)return O.error(P.message);O.success("E-posta onaylandı"),y()},_=async(k,A)=>{if(!confirm(`${A} hesabı SİLİNECEK.
Geçmiş siparişler korunur, ancak profil, favoriler, yorumlar ve adresler silinir.
Devam edilsin mi?`)||!confirm("Bu işlem geri alınamaz. Onaylıyor musun?"))return;d(k);const{error:P}=await U.rpc("admin_delete_user",{_target_user_id:k});if(d(null),P)return O.error(P.message);O.success("Hesap silindi"),y()},j=t.filter(k=>{var A,P;return!(l==="pending"&&k.email_confirmed||l==="confirmed"&&!k.email_confirmed||a&&!((A=k.email)!=null&&A.toLowerCase().includes(a.toLowerCase()))&&!((P=k.full_name)!=null&&P.toLowerCase().includes(a.toLowerCase())))}),S=h?[...j].sort((k,A)=>{let P=0;return h==="name"?P=(k.full_name||"").localeCompare(A.full_name||"","tr",{sensitivity:"base"}):h==="spent"&&(P=Number(k.total_spent)-Number(A.total_spent)),p==="asc"?P:-P}):j,C=t.filter(k=>!k.email_confirmed).length;return i.jsxs("div",{className:"p-6 md:p-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6 flex-wrap gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"Yönetim"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:"Müşteriler"})]}),i.jsx("input",{type:"text",value:a,onChange:k=>o(k.target.value),placeholder:"Ara...",className:"border border-border bg-background px-4 py-2 text-sm focus:outline-none focus:border-foreground"})]}),i.jsx("div",{className:"flex gap-2 mb-6 text-[10px] uppercase tracking-[0.2em]",children:[{key:"all",label:`Tümü (${t.length})`},{key:"pending",label:`Bekleyen (${C})`},{key:"confirmed",label:`Onaylı (${t.length-C})`}].map(k=>i.jsx("button",{onClick:()=>c(k.key),className:`px-3 py-2 border ${l===k.key?"bg-foreground text-background border-foreground":"border-border text-foreground/70 hover:text-foreground"}`,children:k.label},k.key))}),n?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}):i.jsx("div",{className:"border border-border bg-card overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-secondary/50 text-[10px] uppercase tracking-[0.2em] text-foreground/60",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left p-3",children:i.jsxs("button",{onClick:()=>g("name"),className:"inline-flex items-center gap-1 uppercase tracking-[0.2em] hover:text-foreground",children:["İsim",i.jsx(w,{col:"name"})]})}),i.jsx("th",{className:"text-left p-3",children:"E-posta"}),i.jsx("th",{className:"text-left p-3",children:"Telefon"}),i.jsx("th",{className:"text-center p-3",children:"Onay"}),i.jsx("th",{className:"text-right p-3",children:"Sipariş"}),i.jsx("th",{className:"text-right p-3",children:i.jsxs("button",{onClick:()=>g("spent"),className:"inline-flex items-center gap-1 uppercase tracking-[0.2em] hover:text-foreground ml-auto",children:["Harcama",i.jsx(w,{col:"spent"})]})}),i.jsx("th",{className:"text-left p-3",children:"Kayıt"}),i.jsx("th",{className:"text-center p-3",children:"Rol"}),i.jsx("th",{className:"text-center p-3",children:"İşlem"})]})}),i.jsxs("tbody",{children:[S.map(k=>{const A=(e==null?void 0:e.id)===k.user_id,P=u===k.user_id;return i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-3",children:k.full_name||"—"}),i.jsx("td",{className:"p-3 text-foreground/75",children:k.email}),i.jsx("td",{className:"p-3 text-foreground/75",children:k.phone||"—"}),i.jsx("td",{className:"p-3 text-center",children:k.email_confirmed?i.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] uppercase tracking-[0.18em] text-foreground/70",children:[i.jsx(fR,{className:"h-3 w-3"}),"Onaylı"]}):i.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] uppercase tracking-[0.18em] text-destructive",children:[i.jsx(mR,{className:"h-3 w-3"}),"Bekliyor"]})}),i.jsx("td",{className:"p-3 text-right",children:k.order_count}),i.jsx("td",{className:"p-3 text-right",children:ye(Number(k.total_spent))}),i.jsx("td",{className:"p-3 text-foreground/60 text-xs",children:new Date(k.created_at).toLocaleDateString("tr-TR")}),i.jsx("td",{className:"p-3 text-center",children:i.jsxs("button",{disabled:P,onClick:()=>v(k.user_id,k.is_admin),className:`inline-flex items-center gap-1 px-2 py-1 text-[10px] uppercase tracking-[0.18em] disabled:opacity-50 ${k.is_admin?"bg-foreground text-background":"bg-secondary text-foreground/70"}`,children:[k.is_admin?i.jsx($w,{className:"h-3 w-3"}):i.jsx(xR,{className:"h-3 w-3"}),k.is_admin?"Admin":"Müşteri"]})}),i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex items-center justify-center gap-1",children:[!k.email_confirmed&&i.jsx("button",{disabled:P,onClick:()=>x(k.user_id,k.email),title:"E-postayı manuel onayla",className:"p-1.5 border border-border hover:bg-secondary disabled:opacity-50",children:i.jsx(Gu,{className:"h-3.5 w-3.5"})}),i.jsx("button",{disabled:P||A,onClick:()=>_(k.user_id,k.email),title:A?"Kendi hesabınızı silemezsiniz":"Hesabı sil",className:"p-1.5 border border-border hover:bg-destructive hover:text-destructive-foreground hover:border-destructive disabled:opacity-30 disabled:cursor-not-allowed",children:i.jsx(Ws,{className:"h-3.5 w-3.5"})})]})})]},k.user_id)}),S.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:9,className:"p-8 text-center text-foreground/55",children:"Kayıt bulunamadı."})})]})]})})]})},hx={code:"",description:"",discount_type:"percent",discount_value:10,min_subtotal:0,max_uses:"",expires_at:"",active:!0},x$=()=>{const[e,t]=m.useState([]),[r,n]=m.useState(!0),[s,a]=m.useState(!1),[o,l]=m.useState(null),[c,u]=m.useState(hx),[d,h]=m.useState(!1),f=async()=>{n(!0);const{data:y,error:v}=await U.from("coupons").select("*").order("created_at",{ascending:!1});v&&O.error(v.message),t(y??[]),n(!1)};m.useEffect(()=>{f()},[]);const p=()=>{l(null),u(hx),a(!0)},b=y=>{var v;l(y),u({code:y.code,description:y.description??"",discount_type:y.discount_type,discount_value:Number(y.discount_value),min_subtotal:Number(y.min_subtotal),max_uses:((v=y.max_uses)==null?void 0:v.toString())??"",expires_at:y.expires_at?y.expires_at.slice(0,10):"",active:y.active}),a(!0)},g=async y=>{if(y.preventDefault(),!c.code.trim())return O.error("Kod gerekli");h(!0);try{const v={code:c.code.trim().toUpperCase(),description:c.description||null,discount_type:c.discount_type,discount_value:Number(c.discount_value),min_subtotal:Number(c.min_subtotal),max_uses:c.max_uses?Number(c.max_uses):null,expires_at:c.expires_at?new Date(c.expires_at).toISOString():null,active:c.active};if(o){const{error:x}=await U.from("coupons").update(v).eq("id",o.id);if(x)throw x;O.success("Güncellendi")}else{const{error:x}=await U.from("coupons").insert(v);if(x)throw x;O.success("Eklendi")}a(!1),f()}catch(v){O.error(v.message)}finally{h(!1)}},w=async y=>{if(!confirm("Kuponu sil?"))return;const{error:v}=await U.from("coupons").delete().eq("id",y);if(v)return O.error(v.message);O.success("Silindi"),f()};return i.jsxs("div",{className:"p-6 md:p-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"Yönetim"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:"Kuponlar"})]}),i.jsxs(Ai,{open:s,onOpenChange:a,children:[i.jsx(vd,{asChild:!0,children:i.jsxs("button",{onClick:p,className:"btn-ink flex items-center gap-2",children:[i.jsx(qs,{className:"h-4 w-4"})," Yeni Kupon"]})}),i.jsxs(Js,{className:"max-w-md max-h-[90vh] overflow-y-auto",children:[i.jsx(Zs,{children:i.jsx(Qs,{children:o?"Kuponu Düzenle":"Yeni Kupon"})}),i.jsxs("form",{onSubmit:g,className:"space-y-4 mt-4",children:[i.jsx(ma,{label:"Kod",required:!0,value:c.code,onChange:y=>u({...c,code:y})}),i.jsx(ma,{label:"Açıklama",value:c.description,onChange:y=>u({...c,description:y})}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:"Tür"}),i.jsxs("select",{value:c.discount_type,onChange:y=>u({...c,discount_type:y.target.value}),className:"w-full border border-border bg-background px-3 py-2 text-sm",children:[i.jsx("option",{value:"percent",children:"Yüzde (%)"}),i.jsx("option",{value:"fixed",children:"Sabit (₺)"})]})]}),i.jsx(ma,{label:"Değer",type:"number",required:!0,value:String(c.discount_value),onChange:y=>u({...c,discount_value:Number(y)})})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsx(ma,{label:"Min. Sepet (₺)",type:"number",value:String(c.min_subtotal),onChange:y=>u({...c,min_subtotal:Number(y)})}),i.jsx(ma,{label:"Max Kullanım",type:"number",value:c.max_uses,onChange:y=>u({...c,max_uses:y})})]}),i.jsx(ma,{label:"Son Kullanma",type:"date",value:c.expires_at,onChange:y=>u({...c,expires_at:y})}),i.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[i.jsx("input",{type:"checkbox",checked:c.active,onChange:y=>u({...c,active:y.target.checked})}),"Aktif"]}),i.jsx("button",{type:"submit",disabled:d,className:"btn-ink w-full disabled:opacity-50",children:d?"Kaydediliyor...":o?"Güncelle":"Ekle"})]})]})]})]}),r?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}):i.jsx("div",{className:"border border-border bg-card overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-secondary/50 text-[10px] uppercase tracking-[0.2em] text-foreground/60",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left p-3",children:"Kod"}),i.jsx("th",{className:"text-left p-3",children:"İndirim"}),i.jsx("th",{className:"text-right p-3",children:"Min"}),i.jsx("th",{className:"text-right p-3",children:"Kullanım"}),i.jsx("th",{className:"text-left p-3",children:"Bitiş"}),i.jsx("th",{className:"text-center p-3",children:"Durum"}),i.jsx("th",{className:"p-3"})]})}),i.jsxs("tbody",{children:[e.map(y=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-3 font-mono",children:y.code}),i.jsx("td",{className:"p-3",children:y.discount_type==="percent"?`%${y.discount_value}`:`₺${y.discount_value}`}),i.jsxs("td",{className:"p-3 text-right",children:["₺",y.min_subtotal]}),i.jsxs("td",{className:"p-3 text-right",children:[y.used_count,y.max_uses?` / ${y.max_uses}`:""]}),i.jsx("td",{className:"p-3 text-xs text-foreground/60",children:y.expires_at?new Date(y.expires_at).toLocaleDateString("tr-TR"):"—"}),i.jsx("td",{className:"p-3 text-center",children:i.jsx("span",{className:`text-[10px] uppercase px-2 py-1 ${y.active?"bg-foreground text-background":"bg-secondary"}`,children:y.active?"Aktif":"Pasif"})}),i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex gap-2 justify-end",children:[i.jsx("button",{onClick:()=>b(y),className:"text-foreground/60 hover:text-foreground",children:i.jsx(Qu,{className:"h-4 w-4"})}),i.jsx("button",{onClick:()=>w(y.id),className:"text-destructive/70 hover:text-destructive",children:i.jsx(Ws,{className:"h-4 w-4"})})]})})]},y.id)),e.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"p-8 text-center text-foreground/55",children:"Kupon yok"})})]})]})})]})},ma=({label:e,value:t,onChange:r,type:n="text",required:s})=>i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/65",children:[e," ",s&&i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx("input",{type:n,required:s,value:t,onChange:a=>r(a.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"})]}),b$=()=>{const[e,t]=m.useState([]),[r,n]=m.useState(!0),[s,a]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(""),[d,h]=m.useState(""),[f,p]=m.useState(!1),b=v=>{u(`Re: ${v.subject||"Mesajınız"}`),h(""),l(!0)},g=async()=>{if(!s)return;if(d.trim().length<2){O.error("Yanıt boş olamaz");return}p(!0);const{data:v,error:x}=await U.functions.invoke("send-contact-reply",{body:{to:s.email,subject:c,message:d,customer_name:s.name,original_message:s.message}});if(p(!1),x||v!=null&&v.error){O.error((x==null?void 0:x.message)??(v==null?void 0:v.error)??"Gönderilemedi");return}O.success("Yanıt gönderildi"),l(!1),h("")},w=async()=>{n(!0);const{data:v,error:x}=await U.from("contact_messages").select("*").order("created_at",{ascending:!1});x&&O.error(x.message),t(v??[]),n(!1)};m.useEffect(()=>{w()},[]);const y=async v=>{const{error:x}=await U.from("contact_messages").update({read:!v.read}).eq("id",v.id);if(x)return O.error(x.message);w(),(s==null?void 0:s.id)===v.id&&a({...v,read:!v.read})};return i.jsxs("div",{className:"p-6 md:p-10",children:[i.jsxs("div",{className:"mb-8",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"İletişim"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:"Mesajlar"})]}),r?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}):i.jsxs("div",{className:"grid lg:grid-cols-2 gap-6",children:[i.jsx("div",{className:"space-y-2",children:e.length===0?i.jsx("div",{className:"border border-dashed border-border p-12 text-center text-foreground/60",children:"Mesaj yok"}):e.map(v=>i.jsxs("button",{onClick:()=>{a(v),l(!1),h(""),v.read||y(v)},className:`w-full text-left border p-4 transition-colors ${(s==null?void 0:s.id)===v.id?"border-foreground bg-secondary/40":"border-border bg-card hover:bg-secondary/20"}`,children:[i.jsxs("div",{className:"flex items-center justify-between mb-1",children:[i.jsx("span",{className:`text-sm ${v.read?"font-light":"font-medium"}`,children:v.name}),!v.read&&i.jsx("span",{className:"h-2 w-2 rounded-full bg-foreground"})]}),i.jsx("p",{className:"text-xs text-foreground/60 truncate",children:v.subject||v.message}),i.jsx("p",{className:"text-[10px] text-foreground/50 mt-1",children:new Date(v.created_at).toLocaleString("tr-TR")})]},v.id))}),i.jsx("div",{className:"border border-border bg-card p-6 sticky top-6 h-fit",children:s?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"display-text text-lg font-light",children:s.subject||"(konu yok)"}),i.jsx("button",{onClick:()=>y(s),className:"text-foreground/60 hover:text-foreground",children:s.read?i.jsx(Us,{className:"h-4 w-4"}):i.jsx(pR,{className:"h-4 w-4"})})]}),i.jsxs("div",{className:"space-y-1 text-sm border-b border-border pb-3 mb-4",children:[i.jsxs("p",{children:[i.jsx("span",{className:"text-foreground/55",children:"Ad:"})," ",s.name]}),i.jsxs("p",{children:[i.jsx("span",{className:"text-foreground/55",children:"E-posta:"})," ",i.jsx("a",{href:`mailto:${s.email}`,className:"underline",children:s.email})]}),s.phone&&i.jsxs("p",{children:[i.jsx("span",{className:"text-foreground/55",children:"Telefon:"})," ",s.phone]}),i.jsx("p",{className:"text-xs text-foreground/55",children:new Date(s.created_at).toLocaleString("tr-TR")})]}),i.jsx("p",{className:"text-sm whitespace-pre-line leading-relaxed",children:s.message}),o?i.jsxs("div",{className:"mt-6 border-t border-border pt-4 space-y-3",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60 mb-1 block",children:"Konu"}),i.jsx("input",{value:c,onChange:v=>u(v.target.value),className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.25em] text-foreground/60 mb-1 block",children:"Mesaj"}),i.jsx("textarea",{value:d,onChange:v=>h(v.target.value),rows:6,placeholder:`Merhaba ${s.name},`,className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{type:"button",onClick:g,disabled:f,className:"btn-ink inline-flex items-center gap-2 disabled:opacity-50",children:[i.jsx(Uo,{className:"h-3.5 w-3.5"}),f?"Gönderiliyor...":"Gönder"]}),i.jsx("button",{type:"button",onClick:()=>l(!1),disabled:f,className:"text-xs px-4 py-2 border border-border hover:bg-secondary/50 transition-colors",children:"Vazgeç"})]})]}):i.jsxs("div",{className:"flex flex-wrap gap-2 mt-6",children:[i.jsxs("button",{type:"button",onClick:()=>b(s),className:"btn-ink inline-flex items-center gap-2",children:[i.jsx(Uo,{className:"h-3.5 w-3.5"})," Yanıtla"]}),i.jsx("a",{href:`mailto:${s.email}?subject=Re: ${encodeURIComponent(s.subject||"")}`,className:"text-xs px-4 py-2 border border-border hover:bg-secondary/50 transition-colors inline-flex items-center",children:"Mail uygulamasında aç"})]})]}):i.jsx("p",{className:"text-foreground/55 text-sm",children:"Bir mesaj seçin"})})]})]})},w$=()=>{const[e,t]=m.useState([]),[r,n]=m.useState(!0),[s,a]=m.useState("all"),o=async()=>{n(!0);const{data:d,error:h}=await U.from("product_reviews").select("*, products(name, slug)").order("created_at",{ascending:!1});h&&O.error(h.message),t(d??[]),n(!1)};m.useEffect(()=>{o()},[]);const l=async(d,h)=>{const{error:f}=await U.from("product_reviews").update({approved:h}).eq("id",d);if(f)return O.error(f.message);O.success(h?"Onaylandı":"Gizlendi"),o()},c=async d=>{if(!confirm("Yorumu sil?"))return;const{error:h}=await U.from("product_reviews").delete().eq("id",d);if(h)return O.error(h.message);O.success("Silindi"),o()},u=e.filter(d=>s==="all"?!0:s==="approved"?d.approved:!d.approved);return i.jsxs("div",{className:"p-6 md:p-10",children:[i.jsxs("div",{className:"flex items-center justify-between mb-8 flex-wrap gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"Moderasyon"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:"Yorumlar"})]}),i.jsx("div",{className:"flex gap-2",children:["all","pending","approved"].map(d=>i.jsx("button",{onClick:()=>a(d),className:`text-[10px] uppercase tracking-[0.2em] px-3 py-2 ${s===d?"bg-foreground text-background":"bg-secondary"}`,children:d==="all"?"Tümü":d==="pending"?"Bekleyen":"Onaylı"},d))})]}),r?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}):i.jsx("div",{className:"space-y-3",children:u.length===0?i.jsx("div",{className:"border border-dashed border-border p-12 text-center text-foreground/60",children:"Yorum yok"}):u.map(d=>{var h;return i.jsx("div",{className:"border border-border bg-card p-5",children:i.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[i.jsx(Ga,{value:d.rating,size:"sm"}),i.jsx("span",{className:"text-xs text-foreground/55",children:(h=d.products)==null?void 0:h.name}),!d.approved&&i.jsx("span",{className:"text-[9px] uppercase tracking-[0.2em] px-2 py-0.5 bg-destructive/10 text-destructive",children:"Bekliyor"})]}),d.title&&i.jsx("p",{className:"font-light mb-1",children:d.title}),d.comment&&i.jsx("p",{className:"text-sm text-foreground/75",children:d.comment}),i.jsx("p",{className:"text-[10px] text-foreground/50 mt-2",children:new Date(d.created_at).toLocaleString("tr-TR")})]}),i.jsxs("div",{className:"flex gap-2",children:[d.approved?i.jsx("button",{onClick:()=>l(d.id,!1),className:"p-2 hover:bg-secondary",title:"Gizle",children:i.jsx(ds,{className:"h-4 w-4"})}):i.jsx("button",{onClick:()=>l(d.id,!0),className:"p-2 hover:bg-secondary text-foreground",title:"Onayla",children:i.jsx(Gu,{className:"h-4 w-4"})}),i.jsx("button",{onClick:()=>c(d.id),className:"p-2 hover:bg-secondary text-destructive",title:"Sil",children:i.jsx(Ws,{className:"h-4 w-4"})})]})]})},d.id)})})]})},fx=`<h2 style="margin:0 0 16px;font-size:22px;color:#1a1a1a;">Merhaba 👋</h2>
<p>Bu ay öne çıkan ürünlerimizi sizler için derledik.</p>
<p style="margin:24px 0;">
<a href="https://dermaroyal.com/products" style="display:inline-block;background:#1a1a1a;color:#fff;padding:12px 24px;text-decoration:none;letter-spacing:0.15em;text-transform:uppercase;font-size:12px;">Koleksiyonu İncele</a>
</p>
<p style="color:#666;font-size:13px;">Keyifli alışverişler dileriz,<br/>Dermaroyal Ekibi</p>`,_$=()=>{const[e,t]=m.useState([]),[r,n]=m.useState(!0),[s,a]=m.useState(null),[o,l]=m.useState(!1),[c,u]=m.useState(0),[d,h]=m.useState(""),[f,p]=m.useState(""),[b,g]=m.useState(fx),[w,y]=m.useState(!1),[v,x]=m.useState(!1),[_,j]=m.useState(""),[S,C]=m.useState(null),k=async()=>{n(!0);const[{data:E,error:T},{count:L}]=await Promise.all([U.from("newsletter_campaigns").select("*").order("created_at",{ascending:!1}),U.from("newsletter_subscribers").select("*",{count:"exact",head:!0}).is("unsubscribed_at",null)]);T&&O.error(T.message),t(E??[]),u(L??0),n(!1)};m.useEffect(()=>{k()},[]);const A=()=>{a(null),h(""),p(""),g(fx),x(!1),l(!0)},P=E=>{a(E),h(E.subject),p(E.preheader??""),g(E.html_content),x(!1),l(!0)},$=E=>{a(null),h(`${E.subject} (kopya)`),p(E.preheader??""),g(E.html_content),x(!1),l(!0)},R=async()=>{if(!d.trim()||!b.trim()){O.error("Konu ve içerik zorunlu");return}y(!0);const E={subject:d.trim(),preheader:f.trim()||null,html_content:b};let T;if(s?{error:T}=await U.from("newsletter_campaigns").update(E).eq("id",s.id):{error:T}=await U.from("newsletter_campaigns").insert(E),y(!1),T)return O.error(T.message);O.success(s?"Güncellendi":"Taslak oluşturuldu"),l(!1),k()},H=async E=>{if(!confirm("Kampanya silinsin mi?"))return;const{error:T}=await U.from("newsletter_campaigns").delete().eq("id",E);if(T)return O.error(T.message);O.success("Silindi"),k()},N=async E=>{const T=prompt("Test gönderimi için e-posta adresi:");if(!T)return;C(E);const{data:L,error:q}=await U.functions.invoke("send-newsletter",{body:{campaign_id:E,test_email:T}});if(C(null),q||L!=null&&L.error){O.error((L==null?void 0:L.error)||(q==null?void 0:q.message)||"Test başarısız");return}O.success(`Test e-postası ${T} adresine gönderildi`)},M=async(E,T)=>{const L=T?`Bu kampanyayı ${c} aktif aboneye TEKRAR göndermek istediğine emin misin?`:`Bu kampanyayı ${c} aktif aboneye GÖNDERMEK istediğine emin misin?`;if(!confirm(L)||!confirm("Bu işlem geri alınamaz. Onaylıyor musun?"))return;C(E);const{data:q,error:K}=await U.functions.invoke("send-newsletter",{body:{campaign_id:E}});if(C(null),K||q!=null&&q.error){O.error((q==null?void 0:q.error)||(K==null?void 0:K.message)||"Gönderim başarısız"),k();return}const ee=q;O.success(`Gönderildi: ${ee.sent}/${ee.total} (başarısız: ${ee.failed})`),k()},I=async()=>{if(!_.trim())return O.error("Test e-postası girin");if(!d.trim()||!b.trim())return O.error("Konu ve içerik zorunlu");y(!0);let E=s==null?void 0:s.id;const T={subject:d.trim(),preheader:f.trim()||null,html_content:b};if(s){const{error:K}=await U.from("newsletter_campaigns").update(T).eq("id",s.id);if(K)return y(!1),O.error(K.message)}else{const{data:K,error:ee}=await U.from("newsletter_campaigns").insert(T).select("id").single();if(ee||!K)return y(!1),O.error((ee==null?void 0:ee.message)||"Kayıt başarısız");E=K.id,a({...T,id:E,status:"draft"})}y(!1);const{data:L,error:q}=await U.functions.invoke("send-newsletter",{body:{campaign_id:E,test_email:_.trim()}});if(q||L!=null&&L.error){O.error((L==null?void 0:L.error)||(q==null?void 0:q.message)||"Test başarısız");return}O.success(`Test ${_} adresine gönderildi`),k()},z=E=>{const T={draft:"bg-secondary text-foreground/70",sending:"bg-yellow-500/20 text-yellow-700 dark:text-yellow-300",sent:"bg-foreground text-background",failed:"bg-destructive text-destructive-foreground"},L={draft:"Taslak",sending:"Gönderiliyor",sent:"Gönderildi",failed:"Başarısız"};return i.jsx("span",{className:`text-[10px] uppercase tracking-[0.18em] px-2 py-1 ${T[E]}`,children:L[E]})};return o?i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-6 flex-wrap gap-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:s?"Kampanyayı Düzenle":"Yeni Kampanya"}),i.jsx("h2",{className:"display-text text-2xl font-extralight",children:(s==null?void 0:s.subject)||"Yeni bülten"})]}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs("button",{onClick:()=>x(!v),className:"px-4 py-2 border border-border text-sm hover:bg-secondary flex items-center gap-2",children:[i.jsx(aR,{className:"h-4 w-4"})," ",v?"Düzenle":"Önizle"]}),i.jsx("button",{onClick:()=>l(!1),className:"px-4 py-2 border border-border text-sm hover:bg-secondary",children:"İptal"}),i.jsx("button",{onClick:R,disabled:w,className:"px-4 py-2 bg-foreground text-background text-sm disabled:opacity-50",children:w?"Kaydediliyor...":s?"Güncelle":"Taslak Kaydet"})]})]}),i.jsxs("div",{className:"grid gap-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.2em] text-foreground/60 block mb-2",children:"Konu"}),i.jsx("input",{value:d,onChange:E=>h(E.target.value),placeholder:"Mart bülteni — Yeni gelenler",className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.2em] text-foreground/60 block mb-2",children:"Ön gösterim metni (opsiyonel) — gelen kutusunda konunun yanında görünür"}),i.jsx("input",{value:f,onChange:E=>p(E.target.value),placeholder:"Bu ay özenle seçtiklerimiz...",className:"w-full border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-[10px] uppercase tracking-[0.2em] text-foreground/60 block mb-2",children:"HTML içerik (gövde — başlık ve alt bilgi otomatik eklenir)"}),v?i.jsx("iframe",{title:"Önizleme",sandbox:"",srcDoc:b,className:"border border-border bg-white w-full min-h-[400px]"}):i.jsx("textarea",{value:b,onChange:E=>g(E.target.value),rows:20,className:"w-full border border-border bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:border-foreground",placeholder:"<h2>Başlık</h2><p>İçerik...</p>"}),i.jsxs("p",{className:"text-xs text-foreground/55 mt-2",children:["İpucu: ",i.jsx("code",{className:"bg-secondary px-1",children:"<h2>"}),","," ",i.jsx("code",{className:"bg-secondary px-1",children:"<p>"}),","," ",i.jsx("code",{className:"bg-secondary px-1",children:'<a href="">'}),","," ",i.jsx("code",{className:"bg-secondary px-1",children:'<img src="" />'}),", inline style kullanabilirsin."]})]}),i.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.2em] text-foreground/60 mb-3",children:"Test gönderimi"}),i.jsxs("div",{className:"flex gap-2 flex-wrap",children:[i.jsx("input",{value:_,onChange:E=>j(E.target.value),placeholder:"test@ornek.com",className:"flex-1 min-w-[240px] border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:border-foreground"}),i.jsxs("button",{onClick:I,disabled:w,className:"px-4 py-2 border border-foreground text-sm hover:bg-foreground hover:text-background flex items-center gap-2 disabled:opacity-50",children:[i.jsx(Us,{className:"h-4 w-4"})," Test Gönder"]})]}),i.jsx("p",{className:"text-xs text-foreground/55 mt-2",children:'Gerçek aboneler için kaydet ve listede "Gönder" butonunu kullan.'})]})]})]}):i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center justify-between mb-6 flex-wrap gap-4",children:[i.jsx("div",{children:i.jsxs("p",{className:"text-sm text-foreground/60",children:[c," aktif abone · ",e.length," kampanya"]})}),i.jsxs("button",{onClick:A,className:"px-4 py-2 bg-foreground text-background text-sm flex items-center gap-2",children:[i.jsx(qs,{className:"h-4 w-4"})," Yeni Kampanya"]})]}),r?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}):i.jsx("div",{className:"border border-border bg-card overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-secondary/50 text-[10px] uppercase tracking-[0.2em] text-foreground/60",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left p-3",children:"Konu"}),i.jsx("th",{className:"text-center p-3",children:"Durum"}),i.jsx("th",{className:"text-right p-3",children:"Gönderim"}),i.jsx("th",{className:"text-left p-3",children:"Son gönderim"}),i.jsx("th",{className:"text-center p-3",children:"İşlem"})]})}),i.jsxs("tbody",{children:[e.map(E=>{const T=S===E.id,L=E.status==="sent"||E.status==="failed";return i.jsxs("tr",{className:"border-t border-border",children:[i.jsxs("td",{className:"p-3",children:[i.jsx("div",{className:"font-medium",children:E.subject}),E.preheader&&i.jsx("div",{className:"text-xs text-foreground/55 mt-1",children:E.preheader})]}),i.jsx("td",{className:"p-3 text-center",children:z(E.status)}),i.jsxs("td",{className:"p-3 text-right text-foreground/75",children:[L?`${E.sent_count}/${E.total_recipients}`:"—",E.failed_count>0&&i.jsxs("div",{className:"text-xs text-destructive",children:[E.failed_count," hata"]})]}),i.jsx("td",{className:"p-3 text-foreground/60 text-xs",children:E.last_sent_at?new Date(E.last_sent_at).toLocaleString("tr-TR"):"—"}),i.jsx("td",{className:"p-3",children:i.jsxs("div",{className:"flex items-center justify-center gap-1",children:[i.jsx("button",{onClick:()=>P(E),title:"Düzenle",className:"p-1.5 border border-border hover:bg-secondary",children:i.jsx(bR,{className:"h-3.5 w-3.5"})}),i.jsx("button",{onClick:()=>$(E),title:"Kopyala",className:"p-1.5 border border-border hover:bg-secondary",children:i.jsx(nR,{className:"h-3.5 w-3.5"})}),i.jsx("button",{disabled:T,onClick:()=>N(E.id),title:"Test gönder",className:"p-1.5 border border-border hover:bg-secondary disabled:opacity-50",children:i.jsx(Us,{className:"h-3.5 w-3.5"})}),i.jsx("button",{disabled:T||E.status==="sending",onClick:()=>M(E.id,L),title:L?"Tekrar gönder":"Tüm abonelere gönder",className:"p-1.5 border border-foreground bg-foreground text-background hover:opacity-80 disabled:opacity-50 flex items-center gap-1",children:T?i.jsx(rt,{className:"h-3.5 w-3.5 animate-spin"}):i.jsx(Uo,{className:"h-3.5 w-3.5"})}),i.jsx("button",{onClick:()=>H(E.id),title:"Sil",className:"p-1.5 border border-border hover:bg-destructive hover:text-destructive-foreground hover:border-destructive",children:i.jsx(Ws,{className:"h-3.5 w-3.5"})})]})})]},E.id)}),e.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:5,className:"p-12 text-center text-foreground/55",children:'Henüz kampanya yok. "Yeni Kampanya" ile başla.'})})]})]})})]})},k$=()=>{const[e,t]=m.useState("campaigns"),[r,n]=m.useState([]),[s,a]=m.useState(!1);m.useEffect(()=>{e==="subscribers"&&(a(!0),(async()=>{const{data:c,error:u}=await U.from("newsletter_subscribers").select("*").order("subscribed_at",{ascending:!1});u&&O.error(u.message),n(c??[]),a(!1)})())},[e]);const o=()=>{const u=["email,source,subscribed_at",...r.filter(p=>!p.unsubscribed_at).map(p=>`${p.email},${p.source??""},${p.subscribed_at}`)].join(`
`),d=new Blob([u],{type:"text/csv"}),h=URL.createObjectURL(d),f=document.createElement("a");f.href=h,f.download=`newsletter-${new Date().toISOString().slice(0,10)}.csv`,f.click(),URL.revokeObjectURL(h)},l=r.filter(c=>!c.unsubscribed_at).length;return i.jsxs("div",{className:"p-6 md:p-10",children:[i.jsxs("div",{className:"mb-6",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"Pazarlama"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:"Bülten"})]}),i.jsx("div",{className:"flex gap-2 mb-6 text-[10px] uppercase tracking-[0.2em] border-b border-border",children:[{key:"campaigns",label:"Kampanyalar"},{key:"subscribers",label:"Aboneler"}].map(c=>i.jsx("button",{onClick:()=>t(c.key),className:`px-4 py-2 -mb-px border-b-2 ${e===c.key?"border-foreground text-foreground":"border-transparent text-foreground/60 hover:text-foreground"}`,children:c.label},c.key))}),e==="campaigns"&&i.jsx(_$,{}),e==="subscribers"&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-6 flex-wrap gap-4",children:[i.jsxs("p",{className:"text-sm text-foreground/60",children:[l," aktif abone"]}),i.jsxs("button",{onClick:o,className:"px-4 py-2 border border-border text-sm hover:bg-secondary flex items-center gap-2",children:[i.jsx(sR,{className:"h-4 w-4"})," CSV İndir"]})]}),s?i.jsx("div",{className:"flex justify-center py-12",children:i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"})}):i.jsx("div",{className:"border border-border bg-card overflow-x-auto",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{className:"bg-secondary/50 text-[10px] uppercase tracking-[0.2em] text-foreground/60",children:i.jsxs("tr",{children:[i.jsx("th",{className:"text-left p-3",children:"E-posta"}),i.jsx("th",{className:"text-left p-3",children:"Kaynak"}),i.jsx("th",{className:"text-left p-3",children:"Abonelik"}),i.jsx("th",{className:"text-center p-3",children:"Durum"})]})}),i.jsxs("tbody",{children:[r.map(c=>i.jsxs("tr",{className:"border-t border-border",children:[i.jsx("td",{className:"p-3",children:c.email}),i.jsx("td",{className:"p-3 text-foreground/65",children:c.source||"—"}),i.jsx("td",{className:"p-3 text-xs text-foreground/60",children:new Date(c.subscribed_at).toLocaleDateString("tr-TR")}),i.jsx("td",{className:"p-3 text-center",children:i.jsx("span",{className:`text-[10px] uppercase px-2 py-1 ${c.unsubscribed_at?"bg-secondary text-foreground/60":"bg-foreground text-background"}`,children:c.unsubscribed_at?"Çıktı":"Aktif"})})]},c.id)),r.length===0&&i.jsx("tr",{children:i.jsx("td",{colSpan:4,className:"p-8 text-center text-foreground/55",children:"Abone yok"})})]})]})})]})]})},bs=m.forwardRef(({className:e,type:t,...r},n)=>i.jsx("input",{type:t,className:de("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));bs.displayName="Input";var j$="Label",Sj=m.forwardRef((e,t)=>i.jsx(xe.label,{...e,ref:t,onMouseDown:r=>{var s;r.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Sj.displayName=j$;var Nj=Sj;const S$=Wu("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),wa=m.forwardRef(({className:e,...t},r)=>i.jsx(Nj,{ref:r,className:de(S$(),e),...t}));wa.displayName=Nj.displayName;const px=()=>new Date().toISOString().slice(0,10),mx=()=>{const e=new Date;return e.setDate(e.getDate()-30),e.toISOString().slice(0,10)},N$=()=>{const[e,t]=m.useState(""),[r,n]=m.useState(!1),[s,a]=m.useState(null),[o,l]=m.useState(mx()),[c,u]=m.useState(px()),[d,h]=m.useState(!1),[f,p]=m.useState(null),[b,g]=m.useState(mx()),[w,y]=m.useState(px()),[v,x]=m.useState(!1),[_,j]=m.useState(null),S=async N=>{var z;const{data:M,error:I}=await U.functions.invoke("paytr-reports",{body:N});if(I){const E=((z=I==null?void 0:I.context)==null?void 0:z.error)||(I==null?void 0:I.message)||"İstek başarısız";throw new Error(E)}if(!(M!=null&&M.success))throw new Error((M==null?void 0:M.error)||"PayTR isteği başarısız");return M.data},C=async()=>{if(!e.trim())return O.error("merchant_oid girin");n(!0),a(null);try{const N=await S({action:"transaction_status",merchant_oid:e.trim()});a(N),O.success("Durum sorgulandı")}catch(N){O.error(N.message)}finally{n(!1)}},k=async()=>{h(!0),p(null);try{const N=await S({action:"transaction_list",start_date:o,end_date:c});p(N),O.success("İşlem dökümü alındı")}catch(N){O.error(N.message)}finally{h(!1)}},A=async()=>{x(!0),j(null);try{const N=await S({action:"payout_report",start_date:b,end_date:w});j(N),O.success("Ödeme raporu alındı")}catch(N){O.error(N.message)}finally{x(!1)}},P=(N,M)=>{if(!(N!=null&&N.length))return O.error("İndirilecek veri yok");const I=Array.from(N.reduce((K,ee)=>(Object.keys(ee??{}).forEach(le=>K.add(le)),K),new Set)),z=K=>{const ee=K==null?"":String(K);return/[",\n;]/.test(ee)?`"${ee.replace(/"/g,'""')}"`:ee},E=[I.join(","),...N.map(K=>I.map(ee=>z(K==null?void 0:K[ee])).join(","))].join(`
`),T=new Blob(["\uFEFF"+E],{type:"text/csv;charset=utf-8;"}),L=URL.createObjectURL(T),q=document.createElement("a");q.href=L,q.download=M,q.click(),URL.revokeObjectURL(L)},$=N=>{if(!N)return null;if(Array.isArray(N))return N;for(const M of Object.keys(N))if(Array.isArray(N[M]))return N[M];return null},R=N=>{const M=Array.from(N.reduce((I,z)=>(Object.keys(z??{}).forEach(E=>I.add(E)),I),new Set));return i.jsx("div",{className:"overflow-x-auto border border-border",children:i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{className:"bg-secondary/50",children:i.jsx("tr",{children:M.map(I=>i.jsx("th",{className:"px-3 py-2 text-left font-medium uppercase tracking-wide text-foreground/70",children:I},I))})}),i.jsx("tbody",{children:N.map((I,z)=>i.jsx("tr",{className:"border-t border-border",children:M.map(E=>i.jsx("td",{className:"px-3 py-2 align-top",children:(I==null?void 0:I[E])==null?"":String(I[E])},E))},z))})]})})},H=(N,M)=>{if(N==null)return null;const I=$(N);return i.jsxs("div",{className:"space-y-3",children:[I&&I.length>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsxs("p",{className:"text-sm text-foreground/70",children:[I.length," kayıt"]}),i.jsx(Da,{size:"sm",variant:"outline",onClick:()=>P(I,M),children:"CSV indir"})]}),R(I)]}),i.jsxs("details",{className:"text-xs",children:[i.jsx("summary",{className:"cursor-pointer text-foreground/60",children:"Ham yanıt (JSON)"}),i.jsx("pre",{className:"mt-2 p-3 bg-secondary/40 overflow-x-auto",children:JSON.stringify(N,null,2)})]})]})};return i.jsxs("div",{className:"p-6 md:p-10 max-w-6xl",children:[i.jsxs("div",{className:"mb-8",children:[i.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] text-foreground/55 mb-2",children:"PayTR"}),i.jsx("h1",{className:"display-text text-3xl font-extralight",children:"Ödeme Raporları"}),i.jsx("p",{className:"text-sm text-foreground/65 mt-2",children:"İşlem durumu sorgulama, işlem dökümü ve ödeme (havale) raporu."})]}),i.jsxs(Z1,{defaultValue:"status",className:"w-full",children:[i.jsxs(Gm,{children:[i.jsxs(Vn,{value:"status",children:[i.jsx(gm,{className:"h-3.5 w-3.5 mr-2"}),"İşlem Durum Sorgu"]}),i.jsxs(Vn,{value:"list",children:[i.jsx(oR,{className:"h-3.5 w-3.5 mr-2"}),"İşlem Dökümü"]}),i.jsxs(Vn,{value:"payout",children:[i.jsx(Q2,{className:"h-3.5 w-3.5 mr-2"}),"Ödeme Raporu"]})]}),i.jsxs(Kn,{value:"status",className:"space-y-4 mt-6",children:[i.jsxs("p",{className:"text-sm text-foreground/65",children:["Belirli bir ",i.jsx("code",{children:"merchant_oid"}),` için PayTR'den anlık işlem durumunu sorgular. Sipariş detayında "PayTR Kimliği" alanından kopyalayabilirsiniz.`]}),i.jsxs("div",{className:"flex flex-col md:flex-row gap-3 items-end",children:[i.jsxs("div",{className:"flex-1 w-full",children:[i.jsx(wa,{htmlFor:"oid",children:"Merchant OID"}),i.jsx(bs,{id:"oid",value:e,onChange:N=>t(N.target.value),placeholder:"DR..."})]}),i.jsx(Da,{onClick:C,disabled:r,children:r?i.jsx(rt,{className:"h-4 w-4 animate-spin"}):"Sorgula"})]}),s&&i.jsx("pre",{className:"mt-2 p-3 text-xs bg-secondary/40 overflow-x-auto border border-border",children:JSON.stringify(s,null,2)})]}),i.jsxs(Kn,{value:"list",className:"space-y-4 mt-6",children:[i.jsx("p",{className:"text-sm text-foreground/65",children:"Tarih aralığındaki tüm PayTR işlemlerini listeler (başarılı/başarısız/iade)."}),i.jsxs("div",{className:"flex flex-col md:flex-row gap-3 items-end",children:[i.jsxs("div",{children:[i.jsx(wa,{htmlFor:"tx-start",children:"Başlangıç"}),i.jsx(bs,{id:"tx-start",type:"date",value:o,onChange:N=>l(N.target.value)})]}),i.jsxs("div",{children:[i.jsx(wa,{htmlFor:"tx-end",children:"Bitiş"}),i.jsx(bs,{id:"tx-end",type:"date",value:c,onChange:N=>u(N.target.value)})]}),i.jsx(Da,{onClick:k,disabled:d,children:d?i.jsx(rt,{className:"h-4 w-4 animate-spin"}):"Getir"})]}),H(f,`paytr-islem-dokumu-${o}_${c}.csv`)]}),i.jsxs(Kn,{value:"payout",className:"space-y-4 mt-6",children:[i.jsx("p",{className:"text-sm text-foreground/65",children:"PayTR'nin banka hesabınıza yatırdığı tutarları listeler. Mutabakat için kullanın."}),i.jsxs("div",{className:"flex flex-col md:flex-row gap-3 items-end",children:[i.jsxs("div",{children:[i.jsx(wa,{htmlFor:"po-start",children:"Başlangıç"}),i.jsx(bs,{id:"po-start",type:"date",value:b,onChange:N=>g(N.target.value)})]}),i.jsxs("div",{children:[i.jsx(wa,{htmlFor:"po-end",children:"Bitiş"}),i.jsx(bs,{id:"po-end",type:"date",value:w,onChange:N=>y(N.target.value)})]}),i.jsx(Da,{onClick:A,disabled:v,children:v?i.jsx(rt,{className:"h-4 w-4 animate-spin"}):"Getir"})]}),H(_,`paytr-odeme-raporu-${b}_${w}.csv`)]})]})]})},gx=()=>{const[e]=Bu(),t=e.get("email")??"",[r,n]=m.useState(t),[s,a]=m.useState("idle"),[o,l]=m.useState(""),c=async u=>{if(!u||!u.includes("@")){a("error"),l("Geçerli bir e-posta adresi girin.");return}a("loading");const{data:d,error:h}=await U.rpc("unsubscribe_newsletter",{_email:u});if(h){a("error"),l("Bir hata oluştu. Lütfen daha sonra tekrar deneyin.");return}d===!0?(a("success"),l("Bültenimizden başarıyla çıkarıldınız. Sizi tekrar aramızda görmekten mutluluk duyarız.")):(a("error"),l("Bu e-posta adresi listemizde bulunamadı."))};return m.useEffect(()=>{t&&c(t)},[]),i.jsx("div",{className:"min-h-screen flex items-center justify-center px-6 py-24 bg-background",children:i.jsxs("div",{className:"w-full max-w-md text-center space-y-6",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx("h1",{className:"display-text text-3xl font-light",children:"Bülten Aboneliği"}),i.jsx("p",{className:"editorial-serif text-foreground/60 text-sm",children:"Dermaroyal e-posta listesinden çıkış"})]}),s==="loading"&&i.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[i.jsx(rt,{className:"h-6 w-6 animate-spin text-foreground/60"}),i.jsx("p",{className:"text-sm text-foreground/60",children:"İşleniyor..."})]}),s==="success"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-8 border border-border/60 p-8",children:[i.jsx(Yu,{className:"h-10 w-10 text-foreground/80"}),i.jsx("p",{className:"text-sm leading-relaxed",children:o})]}),s==="error"&&i.jsxs("div",{className:"flex flex-col items-center gap-4 py-6 border border-destructive/40 p-6",children:[i.jsx(Ju,{className:"h-8 w-8 text-destructive"}),i.jsx("p",{className:"text-sm",children:o})]}),(s==="idle"||s==="error")&&i.jsxs("form",{onSubmit:u=>{u.preventDefault(),c(r)},className:"space-y-4 pt-4",children:[i.jsx(bs,{type:"email",required:!0,value:r,onChange:u=>n(u.target.value),placeholder:"e-posta adresiniz",className:"text-center"}),i.jsx(Da,{type:"submit",variant:"outline",className:"w-full",children:"Abonelikten çık"})]}),i.jsx("div",{className:"pt-6",children:i.jsx(ue,{to:"/",className:"text-[11px] uppercase tracking-[0.25em] text-foreground/60 hover:text-foreground transition-colors",children:"← Anasayfaya dön"})})]})})},E$=new oC,C$=()=>i.jsx(cC,{client:E$,children:i.jsxs(YP,{children:[i.jsx(cA,{}),i.jsx(WT,{}),i.jsxs(cT,{children:[i.jsx(JD,{}),i.jsx(U5,{children:i.jsx(B5,{children:i.jsxs(F5,{children:[i.jsx(YD,{}),i.jsxs(eT,{children:[i.jsx(te,{path:"/",element:i.jsx(iL,{})}),i.jsx(te,{path:"/giris",element:i.jsx(uL,{})}),i.jsx(te,{path:"/giris/dogrulama",element:i.jsx(dL,{})}),i.jsx(te,{path:"/urunler",element:i.jsx(hL,{})}),i.jsx(te,{path:"/urunler/:slug",element:i.jsx(fL,{})}),i.jsx(te,{path:"/odeme",element:i.jsx(yL,{})}),i.jsx(te,{path:"/odeme/kart",element:i.jsx(vL,{})}),i.jsx(te,{path:"/odeme/basarili",element:i.jsx(xL,{})}),i.jsx(te,{path:"/odeme/basarisiz",element:i.jsx(bL,{})}),i.jsx(te,{path:"/siparis-onayi/:orderNumber",element:i.jsx(wL,{})}),i.jsx(te,{path:"/hesabim",element:i.jsx(TL,{})}),i.jsx(te,{path:"/sifre-sifirla",element:i.jsx($L,{})}),i.jsx(te,{path:"/favorilerim",element:i.jsx(zL,{})}),i.jsx(te,{path:"/hakkimizda",element:i.jsx(UL,{})}),i.jsx(te,{path:"/iletisim",element:i.jsx(BL,{})}),i.jsx(te,{path:"/sss",element:i.jsx(HL,{})}),i.jsx(te,{path:"/gizlilik",element:i.jsx(VL,{})}),i.jsx(te,{path:"/kvkk",element:i.jsx(KL,{})}),i.jsx(te,{path:"/cerezler",element:i.jsx(qL,{})}),i.jsx(te,{path:"/mesafeli-satis",element:i.jsx(WL,{})}),i.jsx(te,{path:"/on-bilgilendirme",element:i.jsx(GL,{})}),i.jsx(te,{path:"/iade-degisim",element:i.jsx(YL,{})}),i.jsx(te,{path:"/kargo-teslimat",element:i.jsx(JL,{})}),i.jsx(te,{path:"/unsubscribe",element:i.jsx(gx,{})}),i.jsx(te,{path:"/abonelikten-cik",element:i.jsx(gx,{})}),i.jsx(te,{path:"/auth",element:i.jsx(Ke,{to:"/giris",replace:!0})}),i.jsx(te,{path:"/auth/callback",element:i.jsx(Ke,{to:"/giris/dogrulama",replace:!0})}),i.jsx(te,{path:"/products",element:i.jsx(Ke,{to:"/urunler",replace:!0})}),i.jsx(te,{path:"/products/:slug",element:i.jsx(yx,{from:"slug",to:"/urunler"})}),i.jsx(te,{path:"/checkout",element:i.jsx(Ke,{to:"/odeme",replace:!0})}),i.jsx(te,{path:"/order-confirmation/:orderNumber",element:i.jsx(yx,{from:"orderNumber",to:"/siparis-onayi"})}),i.jsx(te,{path:"/profile",element:i.jsx(Ke,{to:"/hesabim",replace:!0})}),i.jsx(te,{path:"/reset-password",element:i.jsx(Ke,{to:"/sifre-sifirla",replace:!0})}),i.jsx(te,{path:"/wishlist",element:i.jsx(Ke,{to:"/favorilerim",replace:!0})}),i.jsx(te,{path:"/about",element:i.jsx(Ke,{to:"/hakkimizda",replace:!0})}),i.jsx(te,{path:"/contact",element:i.jsx(Ke,{to:"/iletisim",replace:!0})}),i.jsx(te,{path:"/faq",element:i.jsx(Ke,{to:"/sss",replace:!0})}),i.jsx(te,{path:"/privacy",element:i.jsx(Ke,{to:"/gizlilik",replace:!0})}),i.jsx(te,{path:"/cookies",element:i.jsx(Ke,{to:"/cerezler",replace:!0})}),i.jsx(te,{path:"/distance-sales",element:i.jsx(Ke,{to:"/mesafeli-satis",replace:!0})}),i.jsx(te,{path:"/preliminary-info",element:i.jsx(Ke,{to:"/on-bilgilendirme",replace:!0})}),i.jsx(te,{path:"/returns",element:i.jsx(Ke,{to:"/iade-degisim",replace:!0})}),i.jsx(te,{path:"/shipping",element:i.jsx(Ke,{to:"/kargo-teslimat",replace:!0})}),i.jsxs(te,{path:"/admin",element:i.jsx(ZD,{children:i.jsx(QL,{})}),children:[i.jsx(te,{index:!0,element:i.jsx(XL,{})}),i.jsx(te,{path:"products",element:i.jsx(e$,{})}),i.jsx(te,{path:"categories",element:i.jsx(t$,{})}),i.jsx(te,{path:"orders",element:i.jsx(y$,{})}),i.jsx(te,{path:"users",element:i.jsx(v$,{})}),i.jsx(te,{path:"coupons",element:i.jsx(x$,{})}),i.jsx(te,{path:"messages",element:i.jsx(b$,{})}),i.jsx(te,{path:"reviews",element:i.jsx(w$,{})}),i.jsx(te,{path:"newsletter",element:i.jsx(k$,{})}),i.jsx(te,{path:"raporlar",element:i.jsx(N$,{})})]}),i.jsx(te,{path:"*",element:i.jsx(oL,{})})]})]})})})]})]})}),yx=({from:e,to:t})=>{const n=cm()[e];return i.jsx(Ke,{to:n?`${t}/${n}`:t,replace:!0})};zb(document.getElementById("root")).render(i.jsx(qb,{children:i.jsx(C$,{})}));